mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-28 10:45:31 +08:00
Update release
This commit is contained in:
+112
-45
@@ -804,6 +804,24 @@ GuiControl
|
|||||||
|
|
||||||
void GuiControl::OnParentLineChanged()
|
void GuiControl::OnParentLineChanged()
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
GuiControlSignalEventArgs arguments(boundsComposition);
|
||||||
|
arguments.controlSignal = ControlSignal::ParentLineChanged;
|
||||||
|
ControlSignalTrigerred.Execute(arguments);
|
||||||
|
}
|
||||||
|
for(vint i=0;i<children.Count();i++)
|
||||||
|
{
|
||||||
|
children[i]->OnParentLineChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiControl::OnServiceAdded()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GuiControlSignalEventArgs arguments(boundsComposition);
|
||||||
|
arguments.controlSignal = ControlSignal::ServiceAdded;
|
||||||
|
ControlSignalTrigerred.Execute(arguments);
|
||||||
|
}
|
||||||
for(vint i=0;i<children.Count();i++)
|
for(vint i=0;i<children.Count();i++)
|
||||||
{
|
{
|
||||||
children[i]->OnParentLineChanged();
|
children[i]->OnParentLineChanged();
|
||||||
@@ -812,7 +830,9 @@ GuiControl
|
|||||||
|
|
||||||
void GuiControl::OnRenderTargetChanged(elements::IGuiGraphicsRenderTarget* renderTarget)
|
void GuiControl::OnRenderTargetChanged(elements::IGuiGraphicsRenderTarget* renderTarget)
|
||||||
{
|
{
|
||||||
RenderTargetChanged.Execute(GetNotifyEventArguments());
|
GuiControlSignalEventArgs arguments(boundsComposition);
|
||||||
|
arguments.controlSignal = ControlSignal::RenderTargetChanged;
|
||||||
|
ControlSignalTrigerred.Execute(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiControl::OnBeforeReleaseGraphicsHost()
|
void GuiControl::OnBeforeReleaseGraphicsHost()
|
||||||
@@ -919,7 +939,7 @@ GuiControl
|
|||||||
{
|
{
|
||||||
ControlThemeNameChanged.SetAssociatedComposition(boundsComposition);
|
ControlThemeNameChanged.SetAssociatedComposition(boundsComposition);
|
||||||
ControlTemplateChanged.SetAssociatedComposition(boundsComposition);
|
ControlTemplateChanged.SetAssociatedComposition(boundsComposition);
|
||||||
RenderTargetChanged.SetAssociatedComposition(boundsComposition);
|
ControlSignalTrigerred.SetAssociatedComposition(boundsComposition);
|
||||||
VisibleChanged.SetAssociatedComposition(boundsComposition);
|
VisibleChanged.SetAssociatedComposition(boundsComposition);
|
||||||
EnabledChanged.SetAssociatedComposition(boundsComposition);
|
EnabledChanged.SetAssociatedComposition(boundsComposition);
|
||||||
VisuallyEnabledChanged.SetAssociatedComposition(boundsComposition);
|
VisuallyEnabledChanged.SetAssociatedComposition(boundsComposition);
|
||||||
@@ -1261,16 +1281,34 @@ GuiControl
|
|||||||
}
|
}
|
||||||
else if (identifier == IGuiAltActionContainer::Identifier)
|
else if (identifier == IGuiAltActionContainer::Identifier)
|
||||||
{
|
{
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
|
||||||
else if(parent)
|
|
||||||
{
|
|
||||||
return parent->QueryService(identifier);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
vint index = controlServices.Keys().IndexOf(identifier);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
return controlServices.Values()[index].Obj();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parent)
|
||||||
|
{
|
||||||
|
return parent->QueryService(identifier);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GuiControl::AddService(const WString& identifier, Ptr<IDescriptable> value)
|
||||||
|
{
|
||||||
|
if (controlServices.Keys().Contains(identifier))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
controlServices.Add(identifier, value);
|
||||||
|
OnServiceAdded();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
@@ -22199,7 +22237,7 @@ GuiToolstripCommand
|
|||||||
{
|
{
|
||||||
if (auto control = dynamic_cast<GuiControl*>(attachedRootObject))
|
if (auto control = dynamic_cast<GuiControl*>(attachedRootObject))
|
||||||
{
|
{
|
||||||
control->RenderTargetChanged.Detach(renderTargetChangedHandler);
|
control->ControlSignalTrigerred.Detach(renderTargetChangedHandler);
|
||||||
}
|
}
|
||||||
else if (auto composition = dynamic_cast<GuiGraphicsComposition*>(attachedRootObject))
|
else if (auto composition = dynamic_cast<GuiGraphicsComposition*>(attachedRootObject))
|
||||||
{
|
{
|
||||||
@@ -22213,7 +22251,11 @@ GuiToolstripCommand
|
|||||||
{
|
{
|
||||||
if (auto control = dynamic_cast<GuiControl*>(attachedRootObject))
|
if (auto control = dynamic_cast<GuiControl*>(attachedRootObject))
|
||||||
{
|
{
|
||||||
renderTargetChangedHandler = control->RenderTargetChanged.AttachMethod(this, &GuiToolstripCommand::OnRenderTargetChanged);
|
renderTargetChangedHandler = control->ControlSignalTrigerred.AttachLambda(
|
||||||
|
[=](GuiGraphicsComposition* sender, GuiControlSignalEventArgs& arguments)
|
||||||
|
{
|
||||||
|
OnRenderTargetChanged(sender, arguments);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if (auto composition = dynamic_cast<GuiGraphicsComposition*>(attachedRootObject))
|
else if (auto composition = dynamic_cast<GuiGraphicsComposition*>(attachedRootObject))
|
||||||
{
|
{
|
||||||
@@ -32239,35 +32281,41 @@ namespace vl
|
|||||||
tempResource->AddItem(L"Document", tempResourceItem);
|
tempResource->AddItem(L"Document", tempResourceItem);
|
||||||
auto tempResolver = MakePtr<GuiResourcePathResolver>(tempResource, L"");
|
auto tempResolver = MakePtr<GuiResourcePathResolver>(tempResource, L"");
|
||||||
|
|
||||||
|
internal::ContextFreeReader reader(stream);
|
||||||
{
|
{
|
||||||
vint32_t count = 0;
|
WString title;
|
||||||
if (stream.Read(&count, sizeof(count)) != sizeof(count)) return nullptr;
|
vint32_t version = 0;
|
||||||
for (vint i = 0; i < count; i++)
|
reader << title << version;
|
||||||
|
|
||||||
|
if (title != L"WCF_Document" || version < 1)
|
||||||
{
|
{
|
||||||
vint32_t size = 0;
|
return nullptr;
|
||||||
if (stream.Read(&size, sizeof(size)) != sizeof(size)) return nullptr;
|
|
||||||
if (size > 0)
|
|
||||||
{
|
|
||||||
Array<char> buffer(size);
|
|
||||||
if (stream.Read(&buffer[0], size) != size) return nullptr;
|
|
||||||
if (auto image = GetCurrentController()->ImageService()->CreateImageFromMemory(&buffer[0], buffer.Count()))
|
|
||||||
{
|
|
||||||
auto imageItem = MakePtr<GuiResourceItem>();
|
|
||||||
imageItem->SetContent(L"Image", MakePtr<GuiImageData>(image, 0));
|
|
||||||
tempResource->AddItem(L"Image_" + itow(i), imageItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamReader streamReader(stream);
|
WString xmlText;
|
||||||
auto text = streamReader.ReadToEnd();
|
reader << xmlText;
|
||||||
List<GuiResourceError> errors;
|
List<GuiResourceError> errors;
|
||||||
|
|
||||||
auto parser = GetParserManager()->GetParser<XmlDocument>(L"XML");
|
auto parser = GetParserManager()->GetParser<XmlDocument>(L"XML");
|
||||||
auto xml = parser->Parse({}, text, errors);
|
auto xml = parser->Parse({}, xmlText, errors);
|
||||||
if (errors.Count() > 0) return nullptr;
|
if (errors.Count() > 0) return nullptr;
|
||||||
|
|
||||||
|
{
|
||||||
|
vint32_t count = 0;
|
||||||
|
reader << count;
|
||||||
|
for (vint i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
MemoryStream memoryStream;
|
||||||
|
reader << (IStream&)memoryStream;
|
||||||
|
if (auto image = GetCurrentController()->ImageService()->CreateImageFromStream(memoryStream))
|
||||||
|
{
|
||||||
|
auto imageItem = MakePtr<GuiResourceItem>();
|
||||||
|
imageItem->SetContent(L"Image", MakePtr<GuiImageData>(image, 0));
|
||||||
|
tempResource->AddItem(L"Image_" + itow(i), imageItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto document = DocumentModel::LoadFromXml(tempResourceItem, xml, tempResolver, errors);
|
auto document = DocumentModel::LoadFromXml(tempResourceItem, xml, tempResolver, errors);
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
@@ -32279,29 +32327,42 @@ namespace vl
|
|||||||
{
|
{
|
||||||
paragraph->Accept(&visitor);
|
paragraph->Accept(&visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal::ContextFreeWriter writer(stream);
|
||||||
|
{
|
||||||
|
WString title = L"WCF_Document";
|
||||||
|
vint32_t version = 1;
|
||||||
|
writer << title << version;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto xmlText = GenerateToStream([&](StreamWriter& streamWriter)
|
||||||
|
{
|
||||||
|
auto xml = model->SaveToXml();
|
||||||
|
XmlPrint(xml, streamWriter);
|
||||||
|
});
|
||||||
|
writer << xmlText;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
vint32_t count = (vint32_t)visitor.imageRuns.Count();
|
vint32_t count = (vint32_t)visitor.imageRuns.Count();
|
||||||
stream.Write(&count, sizeof(count));
|
writer << count;
|
||||||
|
|
||||||
FOREACH(Ptr<DocumentImageRun>, imageRun, visitor.imageRuns)
|
FOREACH(Ptr<DocumentImageRun>, imageRun, visitor.imageRuns)
|
||||||
{
|
{
|
||||||
stream::MemoryStream memoryStream;
|
MemoryStream memoryStream;
|
||||||
if (imageRun->image)
|
if (imageRun->image)
|
||||||
{
|
{
|
||||||
imageRun->image->SaveToStream(memoryStream);
|
auto format = imageRun->image->GetFormat();
|
||||||
|
if (format == INativeImage::Gif)
|
||||||
|
{
|
||||||
|
format = INativeImage::Png;
|
||||||
|
}
|
||||||
|
|
||||||
|
imageRun->image->SaveToStream(memoryStream, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
count = (vint32_t)memoryStream.Size();
|
writer << (IStream&)memoryStream;
|
||||||
stream.Write(&count, sizeof(count));
|
|
||||||
if (count > 0)
|
|
||||||
{
|
|
||||||
stream.Write(memoryStream.GetInternalBuffer(), count);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamWriter streamWriter(stream);
|
|
||||||
auto xml = model->SaveToXml();
|
|
||||||
XmlPrint(xml, streamWriter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32440,7 +32501,13 @@ namespace vl
|
|||||||
if (run->image)
|
if (run->image)
|
||||||
{
|
{
|
||||||
writer.WriteString(L"<img width=\"" + itow(run->size.x) + L"\" height=\"" + itow(run->size.y) + L"\" src=\"data:image/");
|
writer.WriteString(L"<img width=\"" + itow(run->size.x) + L"\" height=\"" + itow(run->size.y) + L"\" src=\"data:image/");
|
||||||
switch (run->image->GetFormat())
|
auto format = run->image->GetFormat();
|
||||||
|
if (format == INativeImage::Gif)
|
||||||
|
{
|
||||||
|
format = INativeImage::Png;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (format)
|
||||||
{
|
{
|
||||||
case INativeImage::Bmp: writer.WriteString(L"bmp;base64,"); break;
|
case INativeImage::Bmp: writer.WriteString(L"bmp;base64,"); break;
|
||||||
case INativeImage::Gif: writer.WriteString(L"gif;base64,"); break;
|
case INativeImage::Gif: writer.WriteString(L"gif;base64,"); break;
|
||||||
@@ -32453,7 +32520,7 @@ namespace vl
|
|||||||
}
|
}
|
||||||
|
|
||||||
MemoryStream memoryStream;
|
MemoryStream memoryStream;
|
||||||
run->image->SaveToStream(memoryStream);
|
run->image->SaveToStream(memoryStream, format);
|
||||||
memoryStream.SeekFromBegin(0);
|
memoryStream.SeekFromBegin(0);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|||||||
+63
-9
@@ -3277,11 +3277,42 @@ Predefined Events
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>Control signal.</summary>
|
||||||
|
enum class ControlSignal
|
||||||
|
{
|
||||||
|
/// <summary>Render target changed.</summary>
|
||||||
|
RenderTargetChanged,
|
||||||
|
/// <summary>Render target changed.</summary>
|
||||||
|
ParentLineChanged,
|
||||||
|
/// <summary>Service added changed.</summary>
|
||||||
|
ServiceAdded,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>Control signal event arguments.</summary>
|
||||||
|
struct GuiControlSignalEventArgs : public GuiEventArgs, public Description<GuiControlSignalEventArgs>
|
||||||
|
{
|
||||||
|
/// <summary>The event raiser composition.</summary>
|
||||||
|
ControlSignal controlSignal = ControlSignal::ParentLineChanged;
|
||||||
|
|
||||||
|
/// <summary>Create an event arguments with <see cref="compositionSource"/> and <see cref="eventSource"/> set to null.</summary>
|
||||||
|
GuiControlSignalEventArgs()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Create an event arguments with <see cref="compositionSource"/> and <see cref="eventSource"/> set to a specified value.</summary>
|
||||||
|
/// <param name="composition">The speciied value to set <see cref="compositionSource"/> and <see cref="eventSource"/>.</param>
|
||||||
|
GuiControlSignalEventArgs(GuiGraphicsComposition* composition)
|
||||||
|
:GuiEventArgs(composition)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
typedef GuiGraphicsEvent<GuiEventArgs> GuiNotifyEvent;
|
typedef GuiGraphicsEvent<GuiEventArgs> GuiNotifyEvent;
|
||||||
typedef GuiGraphicsEvent<GuiRequestEventArgs> GuiRequestEvent;
|
typedef GuiGraphicsEvent<GuiRequestEventArgs> GuiRequestEvent;
|
||||||
typedef GuiGraphicsEvent<GuiKeyEventArgs> GuiKeyEvent;
|
typedef GuiGraphicsEvent<GuiKeyEventArgs> GuiKeyEvent;
|
||||||
typedef GuiGraphicsEvent<GuiCharEventArgs> GuiCharEvent;
|
typedef GuiGraphicsEvent<GuiCharEventArgs> GuiCharEvent;
|
||||||
typedef GuiGraphicsEvent<GuiMouseEventArgs> GuiMouseEvent;
|
typedef GuiGraphicsEvent<GuiMouseEventArgs> GuiMouseEvent;
|
||||||
|
typedef GuiGraphicsEvent<GuiControlSignalEventArgs> GuiControlSignalEvent;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Predefined Item Events
|
Predefined Item Events
|
||||||
@@ -9516,6 +9547,26 @@ namespace vl
|
|||||||
|
|
||||||
namespace controls
|
namespace controls
|
||||||
{
|
{
|
||||||
|
template<typename T, typename Enabled = YesType>
|
||||||
|
struct QueryServiceHelper;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct QueryServiceHelper<T, typename RequiresConvertable<decltype(T::Identifier), const wchar_t* const>::YesNoType>
|
||||||
|
{
|
||||||
|
static WString GetIdentifier()
|
||||||
|
{
|
||||||
|
return WString(T::Identifier, false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct QueryServiceHelper<T, typename RequiresConvertable<decltype(T::GetIdentifier()), WString>::YesNoType>
|
||||||
|
{
|
||||||
|
static WString GetIdentifier()
|
||||||
|
{
|
||||||
|
return MoveValue<WString>(T::GetIdentifier());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Basic Construction
|
Basic Construction
|
||||||
@@ -9533,6 +9584,7 @@ Basic Construction
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
using ControlList = collections::List<GuiControl*>;
|
using ControlList = collections::List<GuiControl*>;
|
||||||
|
using ControlServiceMap = collections::Dictionary<WString, Ptr<IDescriptable>>;
|
||||||
using ControlTemplatePropertyType = TemplateProperty<templates::GuiControlTemplate>;
|
using ControlTemplatePropertyType = TemplateProperty<templates::GuiControlTemplate>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -9554,6 +9606,7 @@ Basic Construction
|
|||||||
FontProperties font;
|
FontProperties font;
|
||||||
description::Value context;
|
description::Value context;
|
||||||
compositions::IGuiAltActionHost* activatingAltHost = nullptr;
|
compositions::IGuiAltActionHost* activatingAltHost = nullptr;
|
||||||
|
ControlServiceMap controlServices;
|
||||||
|
|
||||||
GuiControl* parent = nullptr;
|
GuiControl* parent = nullptr;
|
||||||
ControlList children;
|
ControlList children;
|
||||||
@@ -9572,6 +9625,7 @@ Basic Construction
|
|||||||
virtual void OnChildRemoved(GuiControl* control);
|
virtual void OnChildRemoved(GuiControl* control);
|
||||||
virtual void OnParentChanged(GuiControl* oldParent, GuiControl* newParent);
|
virtual void OnParentChanged(GuiControl* oldParent, GuiControl* newParent);
|
||||||
virtual void OnParentLineChanged();
|
virtual void OnParentLineChanged();
|
||||||
|
virtual void OnServiceAdded();
|
||||||
virtual void OnRenderTargetChanged(elements::IGuiGraphicsRenderTarget* renderTarget);
|
virtual void OnRenderTargetChanged(elements::IGuiGraphicsRenderTarget* renderTarget);
|
||||||
virtual void OnBeforeReleaseGraphicsHost();
|
virtual void OnBeforeReleaseGraphicsHost();
|
||||||
virtual void UpdateVisuallyEnabled();
|
virtual void UpdateVisuallyEnabled();
|
||||||
@@ -9597,8 +9651,8 @@ Basic Construction
|
|||||||
compositions::GuiNotifyEvent ControlThemeNameChanged;
|
compositions::GuiNotifyEvent ControlThemeNameChanged;
|
||||||
/// <summary>Control template changed event. This event will be raised when the control template is changed.</summary>
|
/// <summary>Control template changed event. This event will be raised when the control template is changed.</summary>
|
||||||
compositions::GuiNotifyEvent ControlTemplateChanged;
|
compositions::GuiNotifyEvent ControlTemplateChanged;
|
||||||
/// <summary>Render target changed event. This event will be raised when the render target of the control is changed.</summary>
|
/// <summary>Control signal trigerred. This event will be raised because of multiple reason specified in the argument.</summary>
|
||||||
compositions::GuiNotifyEvent RenderTargetChanged;
|
compositions::GuiControlSignalEvent ControlSignalTrigerred;
|
||||||
/// <summary>Visible event. This event will be raised when the visibility state of the control is changed.</summary>
|
/// <summary>Visible event. This event will be raised when the visibility state of the control is changed.</summary>
|
||||||
compositions::GuiNotifyEvent VisibleChanged;
|
compositions::GuiNotifyEvent VisibleChanged;
|
||||||
/// <summary>Enabled event. This event will be raised when the enabling state of the control is changed.</summary>
|
/// <summary>Enabled event. This event will be raised when the enabling state of the control is changed.</summary>
|
||||||
@@ -9749,10 +9803,16 @@ Basic Construction
|
|||||||
/// <param name="identifier">The identifier.</param>
|
/// <param name="identifier">The identifier.</param>
|
||||||
virtual IDescriptable* QueryService(const WString& identifier);
|
virtual IDescriptable* QueryService(const WString& identifier);
|
||||||
|
|
||||||
|
/// <summary>Add a service to this control dynamically. The added service cannot override existing services.</summary>
|
||||||
|
/// <returns>Returns true if this operation succeeded.</returns>
|
||||||
|
/// <param name="identifier">The identifier. You are suggested to fill this parameter using the value from the interface's GetIdentifier function, or <see cref="QueryTypedService"/> will not work on this service.</param>
|
||||||
|
/// <param name="value">The service.</param>
|
||||||
|
bool AddService(const WString& identifier, Ptr<IDescriptable> value);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T* QueryTypedService()
|
T* QueryTypedService()
|
||||||
{
|
{
|
||||||
return dynamic_cast<T*>(QueryService(T::Identifier));
|
return dynamic_cast<T*>(QueryService(QueryServiceHelper<T>::GetIdentifier()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -18225,12 +18285,6 @@ External Functions
|
|||||||
extern void GuiTableComposition_SetRows(presentation::compositions::GuiTableComposition* thisObject, vint value);
|
extern void GuiTableComposition_SetRows(presentation::compositions::GuiTableComposition* thisObject, vint value);
|
||||||
extern void GuiTableComposition_SetColumns(presentation::compositions::GuiTableComposition* thisObject, vint value);
|
extern void GuiTableComposition_SetColumns(presentation::compositions::GuiTableComposition* thisObject, vint value);
|
||||||
extern void IGuiAltActionHost_CollectAltActions(presentation::compositions::IGuiAltActionHost* host, collections::List<presentation::compositions::IGuiAltAction*>& actions);
|
extern void IGuiAltActionHost_CollectAltActions(presentation::compositions::IGuiAltActionHost* host, collections::List<presentation::compositions::IGuiAltAction*>& actions);
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
WString Interface_GetIdentifier()
|
|
||||||
{
|
|
||||||
return T::Identifier;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -836,7 +836,7 @@ namespace vl
|
|||||||
#define _ ,
|
#define _ ,
|
||||||
|
|
||||||
#define INTERFACE_IDENTIFIER(INTERFACE)\
|
#define INTERFACE_IDENTIFIER(INTERFACE)\
|
||||||
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetIdentifier, NO_PARAMETER, WString(*)(), vl::reflection::description::Interface_GetIdentifier<::INTERFACE>)
|
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetIdentifier, NO_PARAMETER, WString(*)(), vl::presentation::controls::QueryServiceHelper<::INTERFACE>::GetIdentifier)
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Type Declaration (Extra)
|
Type Declaration (Extra)
|
||||||
@@ -1367,7 +1367,7 @@ namespace vl
|
|||||||
CLASS_MEMBER_PROPERTY_READONLY_FAST(ControlTemplateObject)\
|
CLASS_MEMBER_PROPERTY_READONLY_FAST(ControlTemplateObject)\
|
||||||
|
|
||||||
#define INTERFACE_IDENTIFIER(INTERFACE)\
|
#define INTERFACE_IDENTIFIER(INTERFACE)\
|
||||||
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetIdentifier, NO_PARAMETER, WString(*)(), vl::reflection::description::Interface_GetIdentifier<::INTERFACE>)
|
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetIdentifier, NO_PARAMETER, WString(*)(), vl::presentation::controls::QueryServiceHelper<::INTERFACE>::GetIdentifier)
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Type Declaration (Extra)
|
Type Declaration (Extra)
|
||||||
@@ -2030,7 +2030,7 @@ Type Declaration (Class)
|
|||||||
|
|
||||||
CLASS_MEMBER_EXTERNALMETHOD(SafeDelete, NO_PARAMETER, void(GuiControl::*)(), vl::presentation::compositions::SafeDeleteControl)
|
CLASS_MEMBER_EXTERNALMETHOD(SafeDelete, NO_PARAMETER, void(GuiControl::*)(), vl::presentation::compositions::SafeDeleteControl)
|
||||||
|
|
||||||
CLASS_MEMBER_GUIEVENT(RenderTargetChanged)
|
CLASS_MEMBER_GUIEVENT(ControlSignalTrigerred)
|
||||||
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(ControlThemeName)
|
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(ControlThemeName)
|
||||||
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(ControlTemplate)
|
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(ControlTemplate)
|
||||||
CLASS_MEMBER_PROPERTY_READONLY_FAST(BoundsComposition)
|
CLASS_MEMBER_PROPERTY_READONLY_FAST(BoundsComposition)
|
||||||
@@ -2058,7 +2058,8 @@ Type Declaration (Class)
|
|||||||
CLASS_MEMBER_METHOD(SetFocus, NO_PARAMETER)
|
CLASS_MEMBER_METHOD(SetFocus, NO_PARAMETER)
|
||||||
CLASS_MEMBER_METHOD(DisplayTooltip, {L"location"})
|
CLASS_MEMBER_METHOD(DisplayTooltip, {L"location"})
|
||||||
CLASS_MEMBER_METHOD(CloseTooltip, NO_PARAMETER)
|
CLASS_MEMBER_METHOD(CloseTooltip, NO_PARAMETER)
|
||||||
CLASS_MEMBER_METHOD_OVERLOAD(QueryService, {L"identifier"}, IDescriptable*(GuiControl::*)(const WString&))
|
CLASS_MEMBER_METHOD(QueryService, {L"identifier"})
|
||||||
|
CLASS_MEMBER_METHOD(AddService, { L"identifier" _ L"value" })
|
||||||
END_CLASS_MEMBER(GuiControl)
|
END_CLASS_MEMBER(GuiControl)
|
||||||
|
|
||||||
BEGIN_CLASS_MEMBER(GuiCustomControl)
|
BEGIN_CLASS_MEMBER(GuiCustomControl)
|
||||||
@@ -2318,7 +2319,6 @@ Type Declaration (Class)
|
|||||||
CONTROL_CONSTRUCTOR_CONTROLT_TEMPLATE_2(GuiMenu, GuiControl*, owner)
|
CONTROL_CONSTRUCTOR_CONTROLT_TEMPLATE_2(GuiMenu, GuiControl*, owner)
|
||||||
|
|
||||||
CLASS_MEMBER_METHOD(UpdateMenuService, NO_PARAMETER)
|
CLASS_MEMBER_METHOD(UpdateMenuService, NO_PARAMETER)
|
||||||
CLASS_MEMBER_METHOD(QueryService, {L"identifier"})
|
|
||||||
END_CLASS_MEMBER(GuiMenu)
|
END_CLASS_MEMBER(GuiMenu)
|
||||||
|
|
||||||
BEGIN_CLASS_MEMBER(GuiMenuBar)
|
BEGIN_CLASS_MEMBER(GuiMenuBar)
|
||||||
@@ -3164,6 +3164,18 @@ Type Declaration
|
|||||||
CLASS_MEMBER_FIELD(nonClient)
|
CLASS_MEMBER_FIELD(nonClient)
|
||||||
END_CLASS_MEMBER(GuiMouseEventArgs)
|
END_CLASS_MEMBER(GuiMouseEventArgs)
|
||||||
|
|
||||||
|
BEGIN_ENUM_ITEM(ControlSignal)
|
||||||
|
ENUM_CLASS_ITEM(RenderTargetChanged)
|
||||||
|
ENUM_CLASS_ITEM(ParentLineChanged)
|
||||||
|
ENUM_CLASS_ITEM(ServiceAdded)
|
||||||
|
END_ENUM_ITEM(ControlSignal)
|
||||||
|
|
||||||
|
BEGIN_CLASS_MEMBER(GuiControlSignalEventArgs)
|
||||||
|
CLASS_MEMBER_BASE(GuiEventArgs)
|
||||||
|
|
||||||
|
CLASS_MEMBER_FIELD(controlSignal)
|
||||||
|
END_CLASS_MEMBER(GuiControlSignalEventArgs)
|
||||||
|
|
||||||
BEGIN_CLASS_MEMBER(GuiItemEventArgs)
|
BEGIN_CLASS_MEMBER(GuiItemEventArgs)
|
||||||
CLASS_MEMBER_BASE(GuiEventArgs)
|
CLASS_MEMBER_BASE(GuiEventArgs)
|
||||||
EVENTARGS_CONSTRUCTOR(GuiItemEventArgs)
|
EVENTARGS_CONSTRUCTOR(GuiItemEventArgs)
|
||||||
|
|||||||
@@ -266,6 +266,8 @@ Type List (Events)
|
|||||||
F(presentation::compositions::GuiKeyEventArgs)\
|
F(presentation::compositions::GuiKeyEventArgs)\
|
||||||
F(presentation::compositions::GuiCharEventArgs)\
|
F(presentation::compositions::GuiCharEventArgs)\
|
||||||
F(presentation::compositions::GuiMouseEventArgs)\
|
F(presentation::compositions::GuiMouseEventArgs)\
|
||||||
|
F(presentation::compositions::ControlSignal)\
|
||||||
|
F(presentation::compositions::GuiControlSignalEventArgs)\
|
||||||
F(presentation::compositions::GuiItemEventArgs)\
|
F(presentation::compositions::GuiItemEventArgs)\
|
||||||
F(presentation::compositions::GuiItemMouseEventArgs)\
|
F(presentation::compositions::GuiItemMouseEventArgs)\
|
||||||
F(presentation::compositions::GuiNodeEventArgs)\
|
F(presentation::compositions::GuiNodeEventArgs)\
|
||||||
|
|||||||
+54
-26
@@ -13306,6 +13306,48 @@ WindowsImage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CopyMetadataBody(IWICMetadataQueryReader* reader, IWICMetadataQueryWriter* writer, const WString& prefix)
|
||||||
|
{
|
||||||
|
IEnumString* enumString = nullptr;
|
||||||
|
HRESULT hr = reader->GetEnumerator(&enumString);
|
||||||
|
if (enumString)
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
LPOLESTR metadataName = nullptr;
|
||||||
|
ULONG fetched = 0;
|
||||||
|
hr = enumString->Next(1, &metadataName, &fetched);
|
||||||
|
if (hr != S_OK) break;
|
||||||
|
if (fetched == 0) break;
|
||||||
|
|
||||||
|
PROPVARIANT metadataValue;
|
||||||
|
PropVariantInit(&metadataValue);
|
||||||
|
hr = reader->GetMetadataByName(metadataName, &metadataValue);
|
||||||
|
if (hr == S_OK)
|
||||||
|
{
|
||||||
|
if (metadataValue.vt == VT_UNKNOWN && metadataValue.punkVal)
|
||||||
|
{
|
||||||
|
IWICMetadataQueryReader* embeddedReader = nullptr;
|
||||||
|
hr = metadataValue.punkVal->QueryInterface<IWICMetadataQueryReader>(&embeddedReader);
|
||||||
|
if (embeddedReader)
|
||||||
|
{
|
||||||
|
CopyMetadataBody(embeddedReader, writer, prefix + metadataName);
|
||||||
|
embeddedReader->Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hr = writer->SetMetadataByName((prefix + metadataName).Buffer(), &metadataValue);
|
||||||
|
}
|
||||||
|
hr = PropVariantClear(&metadataValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoTaskMemFree(metadataName);
|
||||||
|
}
|
||||||
|
enumString->Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<typename TDecoder, typename TEncoder>
|
template<typename TDecoder, typename TEncoder>
|
||||||
void CopyMetadata(TDecoder* decoder, TEncoder* encoder)
|
void CopyMetadata(TDecoder* decoder, TEncoder* encoder)
|
||||||
{
|
{
|
||||||
@@ -13315,30 +13357,7 @@ WindowsImage
|
|||||||
hr = encoder->GetMetadataQueryWriter(&writer);
|
hr = encoder->GetMetadataQueryWriter(&writer);
|
||||||
if (reader && writer)
|
if (reader && writer)
|
||||||
{
|
{
|
||||||
IEnumString* enumString = nullptr;
|
CopyMetadataBody(reader, writer, WString::Empty);
|
||||||
hr = reader->GetEnumerator(&enumString);
|
|
||||||
if (enumString)
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
LPOLESTR metadataName = nullptr;
|
|
||||||
ULONG fetched = 0;
|
|
||||||
hr = enumString->Next(0, &metadataName, &fetched);
|
|
||||||
if (hr != S_OK) break;
|
|
||||||
if (fetched == 0) break;
|
|
||||||
|
|
||||||
PROPVARIANT metadataValue;
|
|
||||||
hr = reader->GetMetadataByName(metadataName, &metadataValue);
|
|
||||||
if (hr == S_OK)
|
|
||||||
{
|
|
||||||
hr = writer->SetMetadataByName(metadataName, &metadataValue);
|
|
||||||
hr = PropVariantClear(&metadataValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
CoTaskMemFree(metadataName);
|
|
||||||
}
|
|
||||||
enumString->Release();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (reader) reader->Release();
|
if (reader) reader->Release();
|
||||||
if (writer) writer->Release();
|
if (writer) writer->Release();
|
||||||
@@ -13386,6 +13405,8 @@ WindowsImage
|
|||||||
auto factory = GetWICImagingFactory();
|
auto factory = GetWICImagingFactory();
|
||||||
GUID formatGUID;
|
GUID formatGUID;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
bool sameFormat = formatType == INativeImage::Unknown || formatType == GetFormat();
|
||||||
if (formatType == INativeImage::Unknown)
|
if (formatType == INativeImage::Unknown)
|
||||||
{
|
{
|
||||||
hr = bitmapDecoder->GetContainerFormat(&formatGUID);
|
hr = bitmapDecoder->GetContainerFormat(&formatGUID);
|
||||||
@@ -13467,7 +13488,11 @@ WindowsImage
|
|||||||
source->Release();
|
source->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CopyMetadata(bitmapDecoder.Obj(), bitmapEncoder);
|
|
||||||
|
if (sameFormat)
|
||||||
|
{
|
||||||
|
CopyMetadata(bitmapDecoder.Obj(), bitmapEncoder);
|
||||||
|
}
|
||||||
|
|
||||||
UINT frameCount = 0;
|
UINT frameCount = 0;
|
||||||
bitmapDecoder->GetFrameCount(&frameCount);
|
bitmapDecoder->GetFrameCount(&frameCount);
|
||||||
@@ -13480,7 +13505,10 @@ WindowsImage
|
|||||||
if (frameDecode && frameEncode)
|
if (frameDecode && frameEncode)
|
||||||
{
|
{
|
||||||
hr = frameEncode->Initialize(NULL);
|
hr = frameEncode->Initialize(NULL);
|
||||||
CopyMetadata(frameDecode, frameEncode);
|
if (sameFormat)
|
||||||
|
{
|
||||||
|
CopyMetadata(frameDecode, frameEncode);
|
||||||
|
}
|
||||||
hr = frameEncode->WriteSource(frameDecode, NULL);
|
hr = frameEncode->WriteSource(frameDecode, NULL);
|
||||||
hr = frameEncode->Commit();
|
hr = frameEncode->Commit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5418,10 +5418,18 @@ WfTypeImpl
|
|||||||
{
|
{
|
||||||
FOREACH(Ptr<WfClass>, td, classes)
|
FOREACH(Ptr<WfClass>, td, classes)
|
||||||
{
|
{
|
||||||
|
if (td->GetBaseTypeDescriptorCount() == 0)
|
||||||
|
{
|
||||||
|
td->AddBaseType(description::GetTypeDescriptor<DescriptableObject>());
|
||||||
|
}
|
||||||
manager->SetTypeDescriptor(td->GetTypeName(), td);
|
manager->SetTypeDescriptor(td->GetTypeName(), td);
|
||||||
}
|
}
|
||||||
FOREACH(Ptr<WfInterface>, td, interfaces)
|
FOREACH(Ptr<WfInterface>, td, interfaces)
|
||||||
{
|
{
|
||||||
|
if (td->GetBaseTypeDescriptorCount() == 0)
|
||||||
|
{
|
||||||
|
td->AddBaseType(description::GetTypeDescriptor<IDescriptable>());
|
||||||
|
}
|
||||||
manager->SetTypeDescriptor(td->GetTypeName(), td);
|
manager->SetTypeDescriptor(td->GetTypeName(), td);
|
||||||
}
|
}
|
||||||
FOREACH(Ptr<WfStruct>, td, structs)
|
FOREACH(Ptr<WfStruct>, td, structs)
|
||||||
|
|||||||
@@ -730,7 +730,7 @@ Instance
|
|||||||
void InstallBaseObject(ITypeDescriptor* td, Value& value);
|
void InstallBaseObject(ITypeDescriptor* td, Value& value);
|
||||||
};
|
};
|
||||||
|
|
||||||
class WfInterfaceInstance : public Object, public reflection::Description<WfInterfaceInstance>
|
class WfInterfaceInstance : public Object, public reflection::IDescriptable, public reflection::Description<WfInterfaceInstance>
|
||||||
{
|
{
|
||||||
typedef reflection::description::ITypeDescriptor ITypeDescriptor;
|
typedef reflection::description::ITypeDescriptor ITypeDescriptor;
|
||||||
typedef reflection::description::IMethodInfo IMethodInfo;
|
typedef reflection::description::IMethodInfo IMethodInfo;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user