mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-19 19:05:38 +08:00
Update release (TextEditor and BlackSkin breaks)
This commit is contained in:
+249
-25
File diff suppressed because it is too large
Load Diff
+136
-35
@@ -3649,6 +3649,8 @@ Resource Type Resolver
|
||||
/// <summary>Provide a context for resource precompiling</summary>
|
||||
struct GuiResourcePrecompileContext
|
||||
{
|
||||
typedef collections::Dictionary<Ptr<DescriptableObject>, Ptr<DescriptableObject>> PropertyMap;
|
||||
|
||||
/// <summary>The folder to contain compiled objects.</summary>
|
||||
Ptr<GuiResourceFolder> targetFolder;
|
||||
/// <summary>The root resource object.</summary>
|
||||
@@ -3657,27 +3659,71 @@ Resource Type Resolver
|
||||
vint passIndex;
|
||||
/// <summary>The path resolver. This is only for delay load resource.</summary>
|
||||
Ptr<GuiResourcePathResolver> resolver;
|
||||
/// <summary>Additional properties for resource item contents</summary>
|
||||
PropertyMap additionalProperties;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Represents a precompiler for resources of a specified type.
|
||||
/// Current resources that needs precompiling:
|
||||
/// Pass 0: Script (collect workflow scripts)
|
||||
/// Pass 1: Script (compile view model scripts)
|
||||
/// Pass 2: Script (compile shared scripts)
|
||||
/// Pass 3: Instance
|
||||
/// <Workflow>
|
||||
/// Pass 0: Collect workflow scripts
|
||||
/// Pass 1: Compile ViewModel scripts
|
||||
/// Pass 2: Compile Shared scripts
|
||||
/// <Instance>
|
||||
/// Pass 3: Collect instance types
|
||||
/// Pass 4: Validate instance dependency
|
||||
/// Pass 5: Generate TemporaryClass scripts, ClassNameRecord
|
||||
/// Pass 6: Compile TemporaryClass scripts
|
||||
/// Pass 7: Generate InstanceCtor scripts
|
||||
/// Pass 8: Compile InstanceCtor scripts
|
||||
/// Pass 9: Unload InstanceCtor, Delete TemporaryClass, Generate InstanceClass scripts
|
||||
/// Pass 10: Compile InstanceClass scripts
|
||||
/// </summary>
|
||||
class IGuiResourceTypeResolver_Precompile : public virtual IDescriptable, public Description<IGuiResourceTypeResolver_Precompile>
|
||||
{
|
||||
public:
|
||||
enum PassNames
|
||||
{
|
||||
Workflow_Collect = 0,
|
||||
Workflow_CompileViewModel = 1,
|
||||
Workflow_CompileShared = 2,
|
||||
Workflow_Max = Workflow_CompileShared,
|
||||
|
||||
Instance_CollectInstanceTypes = 3,
|
||||
Instance_ValidateDependency = 4,
|
||||
Instance_GenerateTemporaryClass = 5,
|
||||
Instance_CompileTemporaryClass = 6,
|
||||
Instance_GenerateInstanceCtor = 7,
|
||||
Instance_CompileInstanceCtor = 8,
|
||||
Instance_GenerateInstanceClass = 9,
|
||||
Instance_CompileInstanceClass = 10,
|
||||
Instance_Max = Instance_CompileInstanceClass,
|
||||
};
|
||||
|
||||
enum PassSupport
|
||||
{
|
||||
NotSupported,
|
||||
PerResource,
|
||||
PerPass,
|
||||
};
|
||||
|
||||
/// <summary>Get the maximum pass index that the precompiler needs.</summary>
|
||||
/// <returns>Returns the maximum pass index. The precompiler doesn't not need to response to every pass.</returns>
|
||||
virtual vint GetMaxPassIndex() = 0;
|
||||
/// <summary>Get how this resolver supports precompiling.</summary>
|
||||
/// <param name="passIndex">The pass index.</param>
|
||||
/// <returns>Returns how this resolver supports precompiling.</returns>
|
||||
virtual PassSupport GetPassSupport(vint passIndex) = 0;
|
||||
/// <summary>Precompile the resource item.</summary>
|
||||
/// <param name="resource">The resource to precompile.</param>
|
||||
/// <param name="context">The context for precompiling.</param>
|
||||
/// <param name="errors">All collected errors during loading a resource.</param>
|
||||
virtual void Precompile(Ptr<GuiResourceItem> resource, GuiResourcePrecompileContext& context, collections::List<WString>& errors) = 0;
|
||||
virtual void PerResourcePrecompile(Ptr<GuiResourceItem> resource, GuiResourcePrecompileContext& context, collections::List<WString>& errors) = 0;
|
||||
/// <summary>Precompile for a pass.</summary>
|
||||
/// <param name="context">The context for precompiling.</param>
|
||||
/// <param name="errors">All collected errors during loading a resource.</param>
|
||||
virtual void PerPassPrecompile(GuiResourcePrecompileContext& context, collections::List<WString>& errors) = 0;
|
||||
};
|
||||
|
||||
/// <summary>Provide a context for resource initializing</summary>
|
||||
@@ -3691,7 +3737,7 @@ Resource Type Resolver
|
||||
/// Current resources that needs precompiling:
|
||||
/// Pass 0: Script (initialize view model scripts)
|
||||
/// Pass 1: Script (initialize shared scripts)
|
||||
/// Pass 3: Script (initialize instance scripts)
|
||||
/// Pass 2: Script (initialize instance scripts)
|
||||
/// </summary>
|
||||
class IGuiResourceTypeResolver_Initialize : public virtual IDescriptable, public Description<IGuiResourceTypeResolver_Precompile>
|
||||
{
|
||||
@@ -3797,6 +3843,14 @@ Resource Resolver Manager
|
||||
/// <summary>Get the maximum initializing pass index.</summary>
|
||||
/// <returns>The maximum initializing pass index.</returns>
|
||||
virtual vint GetMaxInitializePassIndex() = 0;
|
||||
/// <summary>Get names of all per resource resolvers for a pass.</summary>
|
||||
/// <param name="passIndex">The pass index.</param>
|
||||
/// <param name="resolvers">Names of resolvers</param>
|
||||
virtual void GetPerResourceResolverNames(vint passIndex, collections::List<WString>& names) = 0;
|
||||
/// <summary>Get names of all per pass resolvers for a pass.</summary>
|
||||
/// <param name="passIndex">The pass index.</param>
|
||||
/// <param name="resolvers">Names of resolvers</param>
|
||||
virtual void GetPerPassResolverNames(vint passIndex, collections::List<WString>& names) = 0;
|
||||
};
|
||||
|
||||
extern IGuiResourceResolverManager* GetResourceResolverManager();
|
||||
@@ -8148,8 +8202,6 @@ Basic Construction
|
||||
collections::SortedList<GuiComponent*> components;
|
||||
SubscriptionList subscriptions;
|
||||
|
||||
void ClearSubscriptions();
|
||||
void ClearComponents();
|
||||
void FinalizeInstance();
|
||||
public:
|
||||
GuiInstanceRootObject();
|
||||
@@ -8167,6 +8219,8 @@ Basic Construction
|
||||
/// <returns>Returns true if the window contains the subscription.</returns>
|
||||
/// <param name="subscription">The subscription to test.</param>
|
||||
bool ContainsSubscription(Ptr<description::IValueSubscription> subscription);
|
||||
/// <summary>Clear all subscriptions.</summary>
|
||||
void ClearSubscriptions();
|
||||
|
||||
/// <summary>Add a component. When this control host is disposing, all attached components will be deleted.</summary>
|
||||
/// <returns>Returns true if this operation succeeded.</returns>
|
||||
@@ -8185,10 +8239,12 @@ Basic Construction
|
||||
/// <returns>Returns true if the window contains the component.</returns>
|
||||
/// <param name="component">The component to test.</param>
|
||||
bool ContainsComponent(GuiComponent* component);
|
||||
/// <summary>Clear all components.</summary>
|
||||
void ClearComponents();
|
||||
};
|
||||
|
||||
/// <summary>Represnets a user customizable control.</summary>
|
||||
class GuiCustomControl : public GuiControl, public GuiInstanceRootObject, public Description<GuiCustomControl>
|
||||
class GuiCustomControl : public GuiControl, public GuiInstanceRootObject, public AggregatableDescription<GuiCustomControl>
|
||||
{
|
||||
public:
|
||||
/// <summary>Create a control with a specified style controller.</summary>
|
||||
@@ -9278,7 +9334,7 @@ Window
|
||||
/// <summary>
|
||||
/// Represents a normal window.
|
||||
/// </summary>
|
||||
class GuiWindow : public GuiControlHost, protected compositions::IGuiAltActionHost, public Description<GuiWindow>
|
||||
class GuiWindow : public GuiControlHost, protected compositions::IGuiAltActionHost, public AggregatableDescription<GuiWindow>
|
||||
{
|
||||
friend class GuiApplication;
|
||||
public:
|
||||
@@ -17772,7 +17828,7 @@ namespace vl
|
||||
Control Template
|
||||
***********************************************************************/
|
||||
|
||||
class GuiControlTemplate : public GuiTemplate, public Description<GuiControlTemplate>
|
||||
class GuiControlTemplate : public GuiTemplate, public AggregatableDescription<GuiControlTemplate>
|
||||
{
|
||||
public:
|
||||
GuiControlTemplate();
|
||||
@@ -17786,7 +17842,7 @@ Control Template
|
||||
GuiControlTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiLabelTemplate :public GuiControlTemplate, public Description<GuiLabelTemplate>
|
||||
class GuiLabelTemplate :public GuiControlTemplate, public AggregatableDescription<GuiLabelTemplate>
|
||||
{
|
||||
public:
|
||||
GuiLabelTemplate();
|
||||
@@ -17799,7 +17855,7 @@ Control Template
|
||||
GuiLabelTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiSinglelineTextBoxTemplate : public GuiControlTemplate, public Description<GuiSinglelineTextBoxTemplate>
|
||||
class GuiSinglelineTextBoxTemplate : public GuiControlTemplate, public AggregatableDescription<GuiSinglelineTextBoxTemplate>
|
||||
{
|
||||
public:
|
||||
GuiSinglelineTextBoxTemplate();
|
||||
@@ -17812,7 +17868,7 @@ Control Template
|
||||
GuiSinglelineTextBoxTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiDocumentLabelTemplate : public GuiControlTemplate, public Description<GuiDocumentLabelTemplate>
|
||||
class GuiDocumentLabelTemplate : public GuiControlTemplate, public AggregatableDescription<GuiDocumentLabelTemplate>
|
||||
{
|
||||
public:
|
||||
GuiDocumentLabelTemplate();
|
||||
@@ -17824,7 +17880,7 @@ Control Template
|
||||
GuiDocumentLabelTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiMenuTemplate : public GuiControlTemplate, public Description<GuiMenuTemplate>
|
||||
class GuiMenuTemplate : public GuiControlTemplate, public AggregatableDescription<GuiMenuTemplate>
|
||||
{
|
||||
public:
|
||||
GuiMenuTemplate();
|
||||
@@ -17838,7 +17894,7 @@ Control Template
|
||||
Customizable,
|
||||
};
|
||||
|
||||
class GuiWindowTemplate : public GuiControlTemplate, public Description<GuiWindowTemplate>
|
||||
class GuiWindowTemplate : public GuiControlTemplate, public AggregatableDescription<GuiWindowTemplate>
|
||||
{
|
||||
public:
|
||||
GuiWindowTemplate();
|
||||
@@ -17865,7 +17921,7 @@ Control Template
|
||||
GuiWindowTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiButtonTemplate : public GuiControlTemplate, public Description<GuiButtonTemplate>
|
||||
class GuiButtonTemplate : public GuiControlTemplate, public AggregatableDescription<GuiButtonTemplate>
|
||||
{
|
||||
public:
|
||||
GuiButtonTemplate();
|
||||
@@ -17877,7 +17933,7 @@ Control Template
|
||||
GuiButtonTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiSelectableButtonTemplate : public GuiButtonTemplate, public Description<GuiSelectableButtonTemplate>
|
||||
class GuiSelectableButtonTemplate : public GuiButtonTemplate, public AggregatableDescription<GuiSelectableButtonTemplate>
|
||||
{
|
||||
public:
|
||||
GuiSelectableButtonTemplate();
|
||||
@@ -17889,7 +17945,7 @@ Control Template
|
||||
GuiSelectableButtonTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiToolstripButtonTemplate : public GuiSelectableButtonTemplate, public Description<GuiToolstripButtonTemplate>
|
||||
class GuiToolstripButtonTemplate : public GuiSelectableButtonTemplate, public AggregatableDescription<GuiToolstripButtonTemplate>
|
||||
{
|
||||
public:
|
||||
GuiToolstripButtonTemplate();
|
||||
@@ -17906,7 +17962,7 @@ Control Template
|
||||
GuiToolstripButtonTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiListViewColumnHeaderTemplate :public GuiToolstripButtonTemplate, public Description<GuiListViewColumnHeaderTemplate>
|
||||
class GuiListViewColumnHeaderTemplate :public GuiToolstripButtonTemplate, public AggregatableDescription<GuiListViewColumnHeaderTemplate>
|
||||
{
|
||||
public:
|
||||
GuiListViewColumnHeaderTemplate();
|
||||
@@ -17918,7 +17974,7 @@ Control Template
|
||||
GuiListViewColumnHeaderTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiComboBoxTemplate : public GuiToolstripButtonTemplate, public Description<GuiComboBoxTemplate>
|
||||
class GuiComboBoxTemplate : public GuiToolstripButtonTemplate, public AggregatableDescription<GuiComboBoxTemplate>
|
||||
{
|
||||
public:
|
||||
GuiComboBoxTemplate();
|
||||
@@ -17930,7 +17986,7 @@ Control Template
|
||||
GuiComboBoxTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiDatePickerTemplate : public GuiControlTemplate, public Description<GuiDatePickerTemplate>
|
||||
class GuiDatePickerTemplate : public GuiControlTemplate, public AggregatableDescription<GuiDatePickerTemplate>
|
||||
{
|
||||
public:
|
||||
GuiDatePickerTemplate();
|
||||
@@ -17947,7 +18003,7 @@ Control Template
|
||||
GuiDatePickerTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiDateComboBoxTemplate : public GuiComboBoxTemplate, public Description<GuiDateComboBoxTemplate>
|
||||
class GuiDateComboBoxTemplate : public GuiComboBoxTemplate, public AggregatableDescription<GuiDateComboBoxTemplate>
|
||||
{
|
||||
public:
|
||||
GuiDateComboBoxTemplate();
|
||||
@@ -17959,7 +18015,7 @@ Control Template
|
||||
GuiDateComboBoxTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiScrollTemplate : public GuiControlTemplate, public Description<GuiScrollTemplate>
|
||||
class GuiScrollTemplate : public GuiControlTemplate, public AggregatableDescription<GuiScrollTemplate>
|
||||
{
|
||||
public:
|
||||
GuiScrollTemplate();
|
||||
@@ -17974,7 +18030,7 @@ Control Template
|
||||
GuiScrollTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiScrollViewTemplate : public GuiControlTemplate, public Description<GuiScrollViewTemplate>
|
||||
class GuiScrollViewTemplate : public GuiControlTemplate, public AggregatableDescription<GuiScrollViewTemplate>
|
||||
{
|
||||
public:
|
||||
GuiScrollViewTemplate();
|
||||
@@ -17988,7 +18044,7 @@ Control Template
|
||||
GuiScrollViewTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiMultilineTextBoxTemplate : public GuiScrollViewTemplate, public Description<GuiMultilineTextBoxTemplate>
|
||||
class GuiMultilineTextBoxTemplate : public GuiScrollViewTemplate, public AggregatableDescription<GuiMultilineTextBoxTemplate>
|
||||
{
|
||||
public:
|
||||
GuiMultilineTextBoxTemplate();
|
||||
@@ -18001,7 +18057,7 @@ Control Template
|
||||
GuiMultilineTextBoxTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiDocumentViewerTemplate : public GuiScrollViewTemplate, public Description<GuiDocumentViewerTemplate>
|
||||
class GuiDocumentViewerTemplate : public GuiScrollViewTemplate, public AggregatableDescription<GuiDocumentViewerTemplate>
|
||||
{
|
||||
public:
|
||||
GuiDocumentViewerTemplate();
|
||||
@@ -18013,7 +18069,7 @@ Control Template
|
||||
GuiDocumentViewerTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiTextListTemplate : public GuiScrollViewTemplate, public Description<GuiTextListTemplate>
|
||||
class GuiTextListTemplate : public GuiScrollViewTemplate, public AggregatableDescription<GuiTextListTemplate>
|
||||
{
|
||||
public:
|
||||
GuiTextListTemplate();
|
||||
@@ -18027,7 +18083,7 @@ Control Template
|
||||
GuiTextListTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiListViewTemplate : public GuiScrollViewTemplate, public Description<GuiListViewTemplate>
|
||||
class GuiListViewTemplate : public GuiScrollViewTemplate, public AggregatableDescription<GuiListViewTemplate>
|
||||
{
|
||||
public:
|
||||
GuiListViewTemplate();
|
||||
@@ -18043,7 +18099,7 @@ Control Template
|
||||
GuiListViewTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiTreeViewTemplate : public GuiScrollViewTemplate, public Description<GuiTreeViewTemplate>
|
||||
class GuiTreeViewTemplate : public GuiScrollViewTemplate, public AggregatableDescription<GuiTreeViewTemplate>
|
||||
{
|
||||
public:
|
||||
GuiTreeViewTemplate();
|
||||
@@ -18057,7 +18113,7 @@ Control Template
|
||||
GuiTreeViewTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiTabTemplate : public GuiControlTemplate, public Description<GuiTabTemplate>
|
||||
class GuiTabTemplate : public GuiControlTemplate, public AggregatableDescription<GuiTabTemplate>
|
||||
{
|
||||
public:
|
||||
GuiTabTemplate();
|
||||
@@ -18078,7 +18134,7 @@ Control Template
|
||||
Item Template
|
||||
***********************************************************************/
|
||||
|
||||
class GuiListItemTemplate : public GuiTemplate, public Description<GuiListItemTemplate>
|
||||
class GuiListItemTemplate : public GuiTemplate, public AggregatableDescription<GuiListItemTemplate>
|
||||
{
|
||||
public:
|
||||
GuiListItemTemplate();
|
||||
@@ -18091,7 +18147,7 @@ Item Template
|
||||
GuiListItemTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiTreeItemTemplate : public GuiListItemTemplate, public Description<GuiTreeItemTemplate>
|
||||
class GuiTreeItemTemplate : public GuiListItemTemplate, public AggregatableDescription<GuiTreeItemTemplate>
|
||||
{
|
||||
public:
|
||||
GuiTreeItemTemplate();
|
||||
@@ -18103,7 +18159,7 @@ Item Template
|
||||
GuiTreeItemTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiGridVisualizerTemplate : public GuiControlTemplate , public Description<GuiGridVisualizerTemplate>
|
||||
class GuiGridVisualizerTemplate : public GuiControlTemplate , public AggregatableDescription<GuiGridVisualizerTemplate>
|
||||
{
|
||||
public:
|
||||
GuiGridVisualizerTemplate();
|
||||
@@ -18117,7 +18173,7 @@ Item Template
|
||||
GuiGridVisualizerTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)
|
||||
};
|
||||
|
||||
class GuiGridEditorTemplate : public GuiControlTemplate , public Description<GuiGridEditorTemplate>
|
||||
class GuiGridEditorTemplate : public GuiControlTemplate , public AggregatableDescription<GuiGridEditorTemplate>
|
||||
{
|
||||
public:
|
||||
GuiGridEditorTemplate();
|
||||
@@ -18801,6 +18857,51 @@ Helper Functions
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
RESOURCES\GUIRESOURCEMANAGER.H
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
GacUI Reflection: Instance Loader
|
||||
|
||||
Interfaces:
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef VCZH_PRESENTATION_REFLECTION_GUIRESOURCEMANAGER
|
||||
#define VCZH_PRESENTATION_REFLECTION_GUIRESOURCEMANAGER
|
||||
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace presentation
|
||||
{
|
||||
using namespace reflection;
|
||||
|
||||
/***********************************************************************
|
||||
IGuiResourceManager
|
||||
***********************************************************************/
|
||||
|
||||
class GuiResourceClassNameRecord : public Object, public Description<GuiResourceClassNameRecord>
|
||||
{
|
||||
public:
|
||||
collections::List<WString> classNames;
|
||||
};
|
||||
|
||||
class IGuiResourceManager : public IDescriptable, public Description<IGuiResourceManager>
|
||||
{
|
||||
public:
|
||||
virtual bool SetResource(const WString& name, Ptr<GuiResource> resource, GuiResourceUsage usage = GuiResourceUsage::Application) = 0;
|
||||
virtual Ptr<GuiResource> GetResource(const WString& name) = 0;
|
||||
virtual Ptr<GuiResource> GetResourceFromClassName(const WString& classFullName) = 0;
|
||||
};
|
||||
|
||||
extern IGuiResourceManager* GetResourceManager();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
CONTROLS\TEXTEDITORPACKAGE\LANGUAGESERVICE\GUILANGUAGEOPERATIONS.H
|
||||
***********************************************************************/
|
||||
|
||||
+1564
-229
File diff suppressed because it is too large
Load Diff
+113
-59
@@ -306,6 +306,7 @@ Instance Namespace
|
||||
public:
|
||||
GlobalStringKey name;
|
||||
WString typeName;
|
||||
WString value;
|
||||
bool readonly = false;
|
||||
};
|
||||
|
||||
@@ -519,17 +520,18 @@ Instance Loader
|
||||
|
||||
typedef collections::Group<GlobalStringKey, ArgumentInfo> ArgumentMap;
|
||||
|
||||
virtual GlobalStringKey GetTypeName() = 0;
|
||||
virtual GlobalStringKey GetTypeName() = 0;
|
||||
|
||||
virtual void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames);
|
||||
virtual void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames);
|
||||
virtual void GetPairedProperties(const PropertyInfo& propertyInfo, collections::List<GlobalStringKey>& propertyNames);
|
||||
virtual Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo);
|
||||
virtual void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames);
|
||||
virtual void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames);
|
||||
virtual void GetPairedProperties(const PropertyInfo& propertyInfo, collections::List<GlobalStringKey>& propertyNames);
|
||||
virtual Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo);
|
||||
|
||||
virtual bool CanCreate(const TypeInfo& typeInfo);
|
||||
virtual Ptr<workflow::WfStatement> CreateInstance(const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfStatement> AssignParameters(const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfExpression> GetParameter(const PropertyInfo& propertyInfo, GlobalStringKey variableName, collections::List<WString>& errors);
|
||||
virtual bool CanCreate(const TypeInfo& typeInfo);
|
||||
virtual Ptr<workflow::WfBaseConstructorCall> CreateRootInstance(const TypeInfo& typeInfo, Ptr<workflow::WfExpression> controlTemplate, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfStatement> CreateInstance(const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfStatement> AssignParameters(const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfExpression> GetParameter(const PropertyInfo& propertyInfo, GlobalStringKey variableName, collections::List<WString>& errors);
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
@@ -542,6 +544,7 @@ Instance Binder
|
||||
virtual GlobalStringKey GetBindingName() = 0;
|
||||
virtual bool ApplicableToConstructorArgument() = 0;
|
||||
virtual bool RequirePropertyExist() = 0;
|
||||
virtual Ptr<workflow::WfExpression> GenerateConstructorArgument(IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, const WString& code, collections::List<WString>& errors) = 0;
|
||||
virtual Ptr<workflow::WfStatement> GenerateInstallStatement(GlobalStringKey variableName, description::IPropertyInfo* propertyInfo, IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, const WString& code, collections::List<WString>& errors) = 0;
|
||||
};
|
||||
|
||||
@@ -572,39 +575,7 @@ Instance Loader Manager
|
||||
virtual GlobalStringKey GetParentTypeForVirtualType(GlobalStringKey virtualType) = 0;
|
||||
};
|
||||
|
||||
struct InstanceLoadingSource
|
||||
{
|
||||
IGuiInstanceLoader* loader;
|
||||
GlobalStringKey typeName;
|
||||
Ptr<GuiResourceItem> item;
|
||||
Ptr<GuiInstanceContext> context;
|
||||
|
||||
InstanceLoadingSource()
|
||||
:loader(0)
|
||||
{
|
||||
}
|
||||
|
||||
InstanceLoadingSource(IGuiInstanceLoader* _loader, GlobalStringKey _typeName)
|
||||
:loader(_loader)
|
||||
, typeName(_typeName)
|
||||
{
|
||||
}
|
||||
|
||||
InstanceLoadingSource(Ptr<GuiResourceItem> _item)
|
||||
:loader(0)
|
||||
, item(_item)
|
||||
, context(item->GetContent().Cast<GuiInstanceContext>())
|
||||
{
|
||||
}
|
||||
|
||||
operator bool()const
|
||||
{
|
||||
return loader != 0 || context;
|
||||
}
|
||||
};
|
||||
|
||||
extern IGuiInstanceLoaderManager* GetInstanceLoaderManager();
|
||||
extern InstanceLoadingSource FindInstanceLoadingSource(Ptr<GuiInstanceContext> context, GuiConstructorRepr* ctor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -788,8 +759,23 @@ namespace vl
|
||||
typedef collections::Dictionary<GuiValueRepr*, PropertyResolving> PropertyResolvingMap;
|
||||
typedef collections::List<WString> ErrorList;
|
||||
|
||||
struct ResolvingResult
|
||||
struct InstanceBaseRecord : public Object, public Description<InstanceBaseRecord>
|
||||
{
|
||||
typedef GlobalStringKey Key;
|
||||
typedef IGuiInstanceLoader::TypeInfo Value;
|
||||
collections::Dictionary<Key, Value> instanceBases;
|
||||
};
|
||||
|
||||
struct ResolvingResult : public Object, public Description<ResolvingResult>
|
||||
{
|
||||
Ptr<workflow::WfModule> moduleForValidate;
|
||||
Ptr<workflow::WfBlockStatement> moduleContent;
|
||||
|
||||
collections::List<GlobalStringKey> referenceNames;
|
||||
IGuiInstanceLoader::ArgumentMap rootCtorArguments;
|
||||
IGuiInstanceLoader* rootLoader = nullptr;
|
||||
IGuiInstanceLoader::TypeInfo rootTypeInfo;
|
||||
|
||||
VariableTypeInfoMap typeInfos;
|
||||
TypeOverrideMap typeOverrides;
|
||||
PropertyResolvingMap propertyResolvings;
|
||||
@@ -814,20 +800,55 @@ WorkflowCompiler (Installation)
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallBindProperty(GlobalStringKey variableName, description::IPropertyInfo* propertyInfo, Ptr<workflow::WfExpression> bindExpression);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallEvalProperty(GlobalStringKey variableName, IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, Ptr<workflow::WfExpression> evalExpression, collections::List<WString>& errors);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallEvent(GlobalStringKey variableName, description::IEventInfo* eventInfo, const WString& handlerName);
|
||||
extern Ptr<workflow::WfFunctionDeclaration> Workflow_GenerateEventHandler(description::IEventInfo* eventInfo);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallEvalEvent(GlobalStringKey variableName, description::IEventInfo* eventInfo, Ptr<workflow::WfStatement> evalStatement);
|
||||
|
||||
/***********************************************************************
|
||||
WorkflowCompiler (Compile)
|
||||
***********************************************************************/
|
||||
|
||||
extern Ptr<workflow::WfModule> Workflow_CreateEmptyModule(Ptr<GuiInstanceContext> context);
|
||||
extern Ptr<workflow::WfModule> Workflow_CreateModuleWithInitFunction(Ptr<GuiInstanceContext> context, types::ResolvingResult& resolvingResult, description::ITypeDescriptor* rootTypeDescriptor, Ptr<workflow::WfStatement> functionBody);
|
||||
extern Ptr<workflow::WfModule> Workflow_CreateModuleWithUsings(Ptr<GuiInstanceContext> context);
|
||||
extern Ptr<workflow::WfClassDeclaration> Workflow_InstallClass(const WString& className, Ptr<workflow::WfModule> module);
|
||||
extern Ptr<workflow::WfBlockStatement> Workflow_InstallCtorClass(Ptr<GuiInstanceContext> context, types::ResolvingResult& resolvingResult, description::ITypeDescriptor* rootTypeDescriptor, Ptr<workflow::WfModule> module);
|
||||
|
||||
extern void Workflow_CreatePointerVariable(Ptr<workflow::WfModule> module, GlobalStringKey name, description::ITypeDescriptor* type, description::ITypeInfo* typeOverride);
|
||||
extern void Workflow_CreateVariablesForReferenceValues(Ptr<workflow::WfModule> module, types::ResolvingResult& resolvingResult);
|
||||
extern void Workflow_CreatePointerVariable(Ptr<workflow::WfClassDeclaration> ctorClass, GlobalStringKey name, description::ITypeDescriptor* type, description::ITypeInfo* typeOverride);
|
||||
extern void Workflow_CreateVariablesForReferenceValues(Ptr<workflow::WfClassDeclaration> ctorClass, types::ResolvingResult& resolvingResult);
|
||||
|
||||
struct InstanceLoadingSource
|
||||
{
|
||||
IGuiInstanceLoader* loader;
|
||||
GlobalStringKey typeName;
|
||||
Ptr<GuiResourceItem> item;
|
||||
Ptr<GuiInstanceContext> context;
|
||||
|
||||
InstanceLoadingSource()
|
||||
:loader(0)
|
||||
{
|
||||
}
|
||||
|
||||
InstanceLoadingSource(IGuiInstanceLoader* _loader, GlobalStringKey _typeName)
|
||||
:loader(_loader)
|
||||
, typeName(_typeName)
|
||||
{
|
||||
}
|
||||
|
||||
InstanceLoadingSource(Ptr<GuiResourceItem> _item)
|
||||
:loader(0)
|
||||
, item(_item)
|
||||
, context(item->GetContent().Cast<GuiInstanceContext>())
|
||||
{
|
||||
}
|
||||
|
||||
operator bool()const
|
||||
{
|
||||
return loader != 0 || context;
|
||||
}
|
||||
};
|
||||
|
||||
extern InstanceLoadingSource FindInstanceLoadingSource(Ptr<GuiInstanceContext> context, GuiConstructorRepr* ctor, Ptr<types::InstanceBaseRecord> ibRecord = nullptr);
|
||||
extern bool Workflow_ValidateStatement(Ptr<GuiInstanceContext> context, types::ResolvingResult& resolvingResult, description::ITypeDescriptor* rootTypeDescriptor, types::ErrorList& errors, const WString& code, Ptr<workflow::WfStatement> statement);
|
||||
extern Ptr<workflow::runtime::WfAssembly> Workflow_PrecompileInstanceContext(Ptr<GuiInstanceContext> context, types::ErrorList& errors);
|
||||
extern Ptr<workflow::WfModule> Workflow_PrecompileInstanceContext(Ptr<GuiInstanceContext> context, types::ResolvingResult& resolvingResult, types::ErrorList& errors);
|
||||
extern Ptr<workflow::WfModule> Workflow_GenerateInstanceClass(Ptr<GuiInstanceContext> context, Ptr<types::InstanceBaseRecord> ibRecord, types::ResolvingResult& resolvingResult, types::ErrorList& errors, bool beforePrecompile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1216,19 +1237,11 @@ GuiVrtualTypeInstanceLoader
|
||||
return typeName == typeInfo.typeName;
|
||||
}
|
||||
|
||||
Ptr<workflow::WfStatement> CreateInstance(const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors)override
|
||||
Ptr<workflow::WfExpression> CreateInstance_ControlTemplate(const TypeInfo& typeInfo, Ptr<workflow::WfExpression> controlTemplate, collections::List<WString>& errors)
|
||||
{
|
||||
CHECK_ERROR(typeName == typeInfo.typeName, L"GuiTemplateControlInstanceLoader::CreateInstance# Wrong type info is provided.");
|
||||
vint indexControlTemplate = arguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
|
||||
|
||||
Ptr<WfExpression> createStyleExpr;
|
||||
if (indexControlTemplate == -1)
|
||||
if (controlTemplate)
|
||||
{
|
||||
createStyleExpr = CreateIThemeCall(styleMethod);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (auto controlTemplateTd = GetControlTemplateType(arguments.GetByIndex(indexControlTemplate)[0].expression, typeInfo, errors))
|
||||
if (auto controlTemplateTd = GetControlTemplateType(controlTemplate, typeInfo, errors))
|
||||
{
|
||||
auto styleType = TypeInfoRetriver<TControlStyle*>::CreateTypeInfo();
|
||||
|
||||
@@ -1236,13 +1249,54 @@ GuiVrtualTypeInstanceLoader
|
||||
auto createStyle = MakePtr<WfNewClassExpression>();
|
||||
createStyle->type = GetTypeFromTypeInfo(styleType.Obj());
|
||||
createStyle->arguments.Add(refFactory);
|
||||
createStyleExpr = createStyle;
|
||||
|
||||
return createStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return CreateIThemeCall(styleMethod);
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<workflow::WfBaseConstructorCall> CreateRootInstance(const TypeInfo& typeInfo, Ptr<workflow::WfExpression> controlTemplate, collections::List<WString>& errors)override
|
||||
{
|
||||
auto controlType = TypeInfoRetriver<TControl>::CreateTypeInfo();
|
||||
|
||||
if (auto createStyleExpr = CreateInstance_ControlTemplate(typeInfo, controlTemplate, errors))
|
||||
{
|
||||
auto createControl = MakePtr<WfBaseConstructorCall>();
|
||||
createControl->type = GetTypeFromTypeInfo(controlType.Obj());
|
||||
createControl->arguments.Add(createStyleExpr);
|
||||
return createControl;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<workflow::WfStatement> CreateInstance(const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors)override
|
||||
{
|
||||
CHECK_ERROR(typeName == typeInfo.typeName, L"GuiTemplateControlInstanceLoader::CreateInstance# Wrong type info is provided.");
|
||||
vint indexControlTemplate = arguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
|
||||
|
||||
Ptr<WfExpression> createStyleExpr;
|
||||
{
|
||||
Ptr<WfExpression> controlTemplate;
|
||||
if (indexControlTemplate != -1)
|
||||
{
|
||||
controlTemplate = arguments.GetByIndex(indexControlTemplate)[0].expression;
|
||||
}
|
||||
if (!(createStyleExpr = CreateInstance_ControlTemplate(typeInfo, controlTemplate, errors)))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
auto block = MakePtr<WfBlockStatement>();
|
||||
{
|
||||
|
||||
+44
-135
@@ -64,7 +64,7 @@ Compiled Workflow Type Resolver (Workflow)
|
||||
|
||||
vint GetMaxPassIndex()override
|
||||
{
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
void Initialize(Ptr<GuiResourceItem> resource, GuiResourceInitializeContext& context)override
|
||||
@@ -78,7 +78,7 @@ Compiled Workflow Type Resolver (Workflow)
|
||||
{
|
||||
if (context.usage == GuiResourceUsage::DevelopmentTool)
|
||||
{
|
||||
compiled->Initialize(false);
|
||||
compiled->Initialize(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -89,9 +89,19 @@ Compiled Workflow Type Resolver (Workflow)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (compiled->type == GuiInstanceCompiledWorkflow::InstanceCtor && compiled->type != GuiInstanceCompiledWorkflow::InstanceClass)
|
||||
if (compiled->type == GuiInstanceCompiledWorkflow::InstanceCtor)
|
||||
{
|
||||
compiled->Initialize(false);
|
||||
if (context.usage == GuiResourceUsage::Application)
|
||||
{
|
||||
compiled->Initialize(true);
|
||||
}
|
||||
}
|
||||
else if (compiled->type == GuiInstanceCompiledWorkflow::InstanceClass)
|
||||
{
|
||||
if (context.usage == GuiResourceUsage::DevelopmentTool)
|
||||
{
|
||||
compiled->Initialize(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -115,25 +125,32 @@ Compiled Workflow Type Resolver (Workflow)
|
||||
internal::ContextFreeWriter writer(stream);
|
||||
|
||||
vint type = (vint)obj->type;
|
||||
writer << type << obj->classFullName;
|
||||
writer << type;
|
||||
|
||||
MemoryStream memoryStream;
|
||||
obj->assembly->Serialize(memoryStream);
|
||||
writer << (IStream&)memoryStream;
|
||||
if (obj->type != GuiInstanceCompiledWorkflow::TemporaryClass)
|
||||
{
|
||||
MemoryStream memoryStream;
|
||||
obj->assembly->Serialize(memoryStream);
|
||||
writer << (IStream&)memoryStream;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<DescriptableObject> ResolveResourcePrecompiled(stream::IStream& stream, collections::List<WString>& errors)override
|
||||
{
|
||||
internal::ContextFreeReader reader(stream);
|
||||
auto obj = MakePtr<GuiInstanceCompiledWorkflow>();
|
||||
|
||||
vint type;
|
||||
auto memoryStream = MakePtr<MemoryStream>();;
|
||||
reader << type << obj->classFullName << (IStream&)*memoryStream.Obj();
|
||||
|
||||
reader << type;
|
||||
|
||||
auto obj = MakePtr<GuiInstanceCompiledWorkflow>();
|
||||
obj->type = (GuiInstanceCompiledWorkflow::AssemblyType)type;
|
||||
obj->binaryToLoad = memoryStream;
|
||||
if (obj->type != GuiInstanceCompiledWorkflow::TemporaryClass)
|
||||
{
|
||||
auto memoryStream = MakePtr<MemoryStream>();
|
||||
reader << (IStream&)*memoryStream.Obj();
|
||||
obj->binaryToLoad = memoryStream;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
@@ -167,128 +184,6 @@ Plugin
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
GUIINSTANCEPARTIALCLASS.CPP
|
||||
***********************************************************************/
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace presentation
|
||||
{
|
||||
using namespace collections;
|
||||
using namespace reflection::description;
|
||||
using namespace workflow::runtime;
|
||||
using namespace controls;
|
||||
|
||||
/***********************************************************************
|
||||
Workflow_RunPrecompiledScript
|
||||
***********************************************************************/
|
||||
|
||||
Ptr<workflow::runtime::WfRuntimeGlobalContext> Workflow_RunPrecompiledScript(Ptr<GuiResource> resource, Ptr<GuiResourceItem> resourceItem, description::Value rootInstance)
|
||||
{
|
||||
auto compiled = resourceItem->GetContent().Cast<GuiInstanceCompiledWorkflow>();
|
||||
auto globalContext = MakePtr<WfRuntimeGlobalContext>(compiled->assembly);
|
||||
|
||||
LoadFunction<void()>(globalContext, L"<initialize>")();
|
||||
auto resolver = MakePtr<GuiResourcePathResolver>(resource, resource->GetWorkingDirectory());
|
||||
LoadFunction<void(Value, Ptr<GuiResourcePathResolver>)>(globalContext, L"<initialize-instance>")(rootInstance, resolver);
|
||||
|
||||
return globalContext;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
IGuiInstanceResourceManager
|
||||
***********************************************************************/
|
||||
|
||||
IGuiInstanceResourceManager* instanceResourceManager = 0;
|
||||
|
||||
IGuiInstanceResourceManager* GetInstanceResourceManager()
|
||||
{
|
||||
return instanceResourceManager;
|
||||
}
|
||||
|
||||
class GuiInstanceResourceManager : public Object, public IGuiInstanceResourceManager, public IGuiPlugin
|
||||
{
|
||||
protected:
|
||||
typedef Dictionary<WString, Ptr<GuiResource>> ResourceMap;
|
||||
typedef Pair<Ptr<GuiResource>, Ptr<GuiResourceItem>> ResourceItemPair;
|
||||
typedef Dictionary<WString, ResourceItemPair> ResourceItemMap;
|
||||
|
||||
ResourceMap resources;
|
||||
ResourceItemMap instanceCtors;
|
||||
|
||||
void GetClassesInResource(Ptr<GuiResource> resource, Ptr<GuiResourceFolder> folder)
|
||||
{
|
||||
FOREACH(Ptr<GuiResourceItem>, item, folder->GetItems())
|
||||
{
|
||||
if (auto compiled = item->GetContent().Cast<GuiInstanceCompiledWorkflow>())
|
||||
{
|
||||
if (compiled->type == GuiInstanceCompiledWorkflow::InstanceCtor)
|
||||
{
|
||||
if (!instanceCtors.Keys().Contains(compiled->classFullName))
|
||||
{
|
||||
instanceCtors.Add(compiled->classFullName, ResourceItemPair(resource, item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FOREACH(Ptr<GuiResourceFolder>, subFolder, folder->GetFolders())
|
||||
{
|
||||
GetClassesInResource(resource, subFolder);
|
||||
}
|
||||
}
|
||||
public:
|
||||
GuiInstanceResourceManager()
|
||||
{
|
||||
}
|
||||
|
||||
void Load()override
|
||||
{
|
||||
instanceResourceManager = this;
|
||||
}
|
||||
|
||||
void AfterLoad()override
|
||||
{
|
||||
}
|
||||
|
||||
void Unload()override
|
||||
{
|
||||
instanceResourceManager = nullptr;
|
||||
}
|
||||
|
||||
bool SetResource(const WString& name, Ptr<GuiResource> resource, GuiResourceUsage usage)override
|
||||
{
|
||||
vint index = resources.Keys().IndexOf(name);
|
||||
if (index != -1) return false;
|
||||
|
||||
resource->Initialize(usage);
|
||||
resources.Add(name, resource);
|
||||
GetClassesInResource(resource, resource);
|
||||
return true;
|
||||
}
|
||||
|
||||
Ptr<GuiResource> GetResource(const WString& name)override
|
||||
{
|
||||
vint index = resources.Keys().IndexOf(name);
|
||||
return index == -1 ? nullptr : resources.Values()[index];
|
||||
}
|
||||
|
||||
Ptr<GuiInstanceConstructorResult> RunInstanceConstructor(const WString& classFullName, description::Value instance)override
|
||||
{
|
||||
vint index = instanceCtors.Keys().IndexOf(classFullName);
|
||||
if (index == -1) return nullptr;
|
||||
|
||||
auto pair = instanceCtors.Values()[index];
|
||||
auto context = Workflow_RunPrecompiledScript(pair.key, pair.value, instance);
|
||||
auto result = MakePtr<GuiInstanceConstructorResult>();
|
||||
result->context = context;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
GUI_REGISTER_PLUGIN(GuiInstanceResourceManager)
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
TYPEDESCRIPTORS\GUIREFLECTIONBASIC.CPP
|
||||
***********************************************************************/
|
||||
@@ -907,6 +802,18 @@ Type Declaration
|
||||
CLASS_MEMBER_METHOD(ResolveResource, {L"protocol" _ L"path"})
|
||||
END_CLASS_MEMBER(GuiResourcePathResolver)
|
||||
|
||||
BEGIN_ENUM_ITEM(GuiResourceUsage)
|
||||
ENUM_CLASS_ITEM(DevelopmentTool)
|
||||
ENUM_CLASS_ITEM(Application)
|
||||
END_ENUM_ITEM(GuiResourceUsage)
|
||||
|
||||
BEGIN_INTERFACE_MEMBER_NOPROXY(IGuiResourceManager)
|
||||
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetResourceManager, NO_PARAMETER, IGuiResourceManager*(*)(), &GetResourceManager)
|
||||
CLASS_MEMBER_METHOD(SetResource, { L"name" _ L"resource" _ L"usage" })
|
||||
CLASS_MEMBER_METHOD(GetResource, { L"name" })
|
||||
CLASS_MEMBER_METHOD(GetResourceFromClassName, { L"name" })
|
||||
END_INTERFACE_MEMBER(IGuiResourceManager)
|
||||
|
||||
BEGIN_INTERFACE_MEMBER_NOPROXY(IGuiGraphicsElement)
|
||||
END_INTERFACE_MEMBER(IGuiGraphicsElement)
|
||||
|
||||
@@ -1646,11 +1553,13 @@ Type Declaration
|
||||
CLASS_MEMBER_METHOD(AddSubscription, {L"subscription"})
|
||||
CLASS_MEMBER_METHOD(RemoveSubscription, {L"subscription"})
|
||||
CLASS_MEMBER_METHOD(ContainsSubscription, {L"subscription"})
|
||||
CLASS_MEMBER_METHOD(ClearSubscriptions, NO_PARAMETER)
|
||||
|
||||
CLASS_MEMBER_METHOD(AddComponent, {L"component"})
|
||||
CLASS_MEMBER_METHOD(AddControlHostComponent, {L"controlHost"})
|
||||
CLASS_MEMBER_METHOD(RemoveComponent, {L"component"})
|
||||
CLASS_MEMBER_METHOD(ContainsComponent, {L"component"})
|
||||
CLASS_MEMBER_METHOD(ClearComponents, NO_PARAMETER)
|
||||
END_CLASS_MEMBER(GuiInstanceRootObject)
|
||||
|
||||
BEGIN_CLASS_MEMBER(GuiDialogBase)
|
||||
|
||||
+31
-42
@@ -92,6 +92,8 @@ Type List
|
||||
F(presentation::GuiResourceFolder)\
|
||||
F(presentation::GuiResource)\
|
||||
F(presentation::GuiResourcePathResolver)\
|
||||
F(presentation::GuiResourceUsage)\
|
||||
F(presentation::IGuiResourceManager)\
|
||||
F(presentation::elements::IGuiGraphicsElement)\
|
||||
F(presentation::compositions::GuiGraphicsComposition)\
|
||||
F(presentation::compositions::GuiGraphicsComposition::MinSizeLimitation)\
|
||||
@@ -2063,6 +2065,11 @@ Interfaces:
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace workflow
|
||||
{
|
||||
class WfModule;
|
||||
}
|
||||
|
||||
namespace presentation
|
||||
{
|
||||
class GuiInstanceCompiledWorkflow : public Object, public Description<GuiInstanceCompiledWorkflow>
|
||||
@@ -2074,13 +2081,14 @@ namespace vl
|
||||
Shared,
|
||||
InstanceCtor,
|
||||
InstanceClass,
|
||||
TemporaryClass,
|
||||
};
|
||||
|
||||
collections::List<WString> codes;
|
||||
collections::List<Ptr<workflow::WfModule>> modules;
|
||||
Ptr<stream::MemoryStream> binaryToLoad;
|
||||
|
||||
AssemblyType type = AssemblyType::Shared;
|
||||
WString classFullName;
|
||||
Ptr<workflow::runtime::WfAssembly> assembly;
|
||||
Ptr<workflow::runtime::WfRuntimeGlobalContext> context;
|
||||
|
||||
@@ -2244,7 +2252,7 @@ Macros
|
||||
this,\
|
||||
L ## #EVENTNAME,\
|
||||
[](DescriptableObject* thisObject, bool addEventHandler){\
|
||||
return &dynamic_cast<ClassType*>(thisObject)->EVENTNAME;\
|
||||
return &thisObject->SafeAggregationCast<ClassType>()->EVENTNAME;\
|
||||
}\
|
||||
)\
|
||||
);\
|
||||
@@ -2255,7 +2263,7 @@ Macros
|
||||
this,\
|
||||
L ## #EVENTNAME,\
|
||||
[](DescriptableObject* thisObject, bool addEventHandler){\
|
||||
GuiGraphicsComposition* composition=dynamic_cast<GuiGraphicsComposition*>(thisObject);\
|
||||
GuiGraphicsComposition* composition=thisObject->SafeAggregationCast<GuiGraphicsComposition>();\
|
||||
if(!addEventHandler && !composition->HasEventReceiver())\
|
||||
{\
|
||||
return (GuiGraphicsEvent<GuiEventArgumentTypeRetriver<decltype(&GuiGraphicsEventReceiver::EVENTNAME)>::Type>*)0;\
|
||||
@@ -2319,26 +2327,6 @@ namespace vl
|
||||
{
|
||||
using namespace reflection;
|
||||
|
||||
/***********************************************************************
|
||||
Resource
|
||||
***********************************************************************/
|
||||
|
||||
class GuiInstanceConstructorResult : public Object
|
||||
{
|
||||
public:
|
||||
Ptr<workflow::runtime::WfRuntimeGlobalContext> context;
|
||||
};
|
||||
|
||||
class IGuiInstanceResourceManager : public IDescriptable, public Description<IGuiInstanceResourceManager>
|
||||
{
|
||||
public:
|
||||
virtual bool SetResource(const WString& name, Ptr<GuiResource> resource, GuiResourceUsage usage = GuiResourceUsage::Application) = 0;
|
||||
virtual Ptr<GuiResource> GetResource(const WString& name) = 0;
|
||||
virtual Ptr<GuiInstanceConstructorResult> RunInstanceConstructor(const WString& classFullName, description::Value instance) = 0;
|
||||
};
|
||||
|
||||
extern IGuiInstanceResourceManager* GetInstanceResourceManager();
|
||||
|
||||
/***********************************************************************
|
||||
PartialClass
|
||||
***********************************************************************/
|
||||
@@ -2346,20 +2334,33 @@ PartialClass
|
||||
template<typename T>
|
||||
class GuiInstancePartialClass
|
||||
{
|
||||
typedef reflection::description::Value Value;
|
||||
private:
|
||||
WString className;
|
||||
Ptr<workflow::runtime::WfRuntimeGlobalContext> context;
|
||||
Value ctorInstance;
|
||||
|
||||
protected:
|
||||
bool InitializeFromResource()
|
||||
{
|
||||
if (!context)
|
||||
if (ctorInstance.IsNull())
|
||||
{
|
||||
auto value = description::Value::From(dynamic_cast<T*>(this));
|
||||
if (auto result = GetInstanceResourceManager()->RunInstanceConstructor(className, value))
|
||||
auto rootInstance = Value::From(dynamic_cast<T*>(this));
|
||||
auto resource = GetResourceManager()->GetResourceFromClassName(className);
|
||||
auto ctorFullName = className + L"<Ctor>";
|
||||
auto td = description::GetTypeDescriptor(ctorFullName);
|
||||
if (!td) return false;
|
||||
|
||||
auto ctor = td->GetConstructorGroup()->GetMethod(0);
|
||||
collections::Array<Value> arguments;
|
||||
ctorInstance = ctor->Invoke(Value(), arguments);
|
||||
|
||||
auto initialize = td->GetMethodGroupByName(L"<initialize-instance>", false)->GetMethod(0);
|
||||
{
|
||||
context = result->context;
|
||||
return true;
|
||||
arguments.Resize(2);
|
||||
auto resolver = MakePtr<GuiResourcePathResolver>(resource, resource->GetWorkingDirectory());
|
||||
arguments[0] = rootInstance;
|
||||
arguments[1] = Value::From(resolver.Obj());
|
||||
initialize->Invoke(ctorInstance, arguments);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -2368,19 +2369,7 @@ PartialClass
|
||||
template<typename TControl>
|
||||
void LoadInstanceReference(const WString& name, TControl*& reference)
|
||||
{
|
||||
reference = 0;
|
||||
vint index = context->assembly->variableNames.IndexOf(name);
|
||||
CHECK_ERROR(index != -1, L"GuiInstancePartialClass<T>::LoadInstanceReference<TControl>(const WString&, TControl*&)#Failed to find instance reference.");
|
||||
|
||||
auto value = context->globalVariables->variables[index];
|
||||
auto td = description::GetTypeDescriptor<TControl>();
|
||||
if (!value.GetTypeDescriptor() || !value.GetTypeDescriptor()->CanConvertTo(td))
|
||||
{
|
||||
CHECK_ERROR(index != -1, L"GuiInstancePartialClass<T>::LoadInstanceReference<TControl>(const WString&, TControl*&)#Wrong instance reference type.");
|
||||
return;
|
||||
}
|
||||
|
||||
reference = description::UnboxValue<TControl*>(value);
|
||||
reference = ctorInstance.GetProperty(name).GetRawPtr()->template SafeAggregationCast<TControl>();
|
||||
}
|
||||
public:
|
||||
GuiInstancePartialClass(const WString& _className)
|
||||
|
||||
+58
-6
@@ -13635,7 +13635,7 @@ ParsingMultiplePrintNodeRecorder
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
ParsingEmptyPrintNodeRecorder
|
||||
ParsingOriginalLocationRecorder
|
||||
***********************************************************************/
|
||||
|
||||
ParsingOriginalLocationRecorder::ParsingOriginalLocationRecorder(Ptr<IParsingPrintNodeRecorder> _recorder)
|
||||
@@ -13655,7 +13655,7 @@ ParsingEmptyPrintNodeRecorder
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
ParsingEmptyPrintNodeRecorder
|
||||
ParsingGeneratedLocationRecorder
|
||||
***********************************************************************/
|
||||
|
||||
ParsingGeneratedLocationRecorder::ParsingGeneratedLocationRecorder(RangeMap& _rangeMap)
|
||||
@@ -13672,6 +13672,23 @@ ParsingEmptyPrintNodeRecorder
|
||||
rangeMap.Add(node, range);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
ParsingUpdateLocationRecorder
|
||||
***********************************************************************/
|
||||
|
||||
ParsingUpdateLocationRecorder::ParsingUpdateLocationRecorder()
|
||||
{
|
||||
}
|
||||
|
||||
ParsingUpdateLocationRecorder::~ParsingUpdateLocationRecorder()
|
||||
{
|
||||
}
|
||||
|
||||
void ParsingUpdateLocationRecorder::Record(ParsingTreeCustomBase* node, const ParsingTextRange& range)
|
||||
{
|
||||
node->codeRange = range;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
ParsingWriter
|
||||
***********************************************************************/
|
||||
@@ -15582,6 +15599,7 @@ DescriptableObject
|
||||
InitializeAggregation(0);
|
||||
}
|
||||
aggregationInfo[aggregationSize] = value;
|
||||
aggregationInfo[aggregationSize + 1] = value;
|
||||
for (vint i = 0; i < aggregationSize; i++)
|
||||
{
|
||||
if (aggregationInfo[i])
|
||||
@@ -15629,8 +15647,32 @@ DescriptableObject
|
||||
CHECK_ERROR(!IsAggregated(), L"vl::reflection::DescriptableObject::InitializeAggregation(vint)#This function should not be called on aggregated objects.");
|
||||
CHECK_ERROR(size >= 0, L"vl::reflection::DescriptableObject::InitializeAggregation(vint)#Size shout not be negative.");
|
||||
aggregationSize = size;
|
||||
aggregationInfo = new DescriptableObject*[size + 1];
|
||||
memset(aggregationInfo, 0, sizeof(*aggregationInfo) * (size + 1));
|
||||
aggregationInfo = new DescriptableObject*[size + 2];
|
||||
memset(aggregationInfo, 0, sizeof(*aggregationInfo) * (size + 2));
|
||||
}
|
||||
|
||||
void DescriptableObject::FinalizeAggregation()
|
||||
{
|
||||
if (IsAggregated())
|
||||
{
|
||||
if (auto root = GetAggregationRoot())
|
||||
{
|
||||
if (aggregationInfo[aggregationSize + 1] == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
aggregationInfo[aggregationSize + 1] = nullptr;
|
||||
}
|
||||
|
||||
if (!root->destructing)
|
||||
{
|
||||
destructing = true;
|
||||
delete root;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DescriptableObject::DescriptableObject()
|
||||
@@ -15651,9 +15693,9 @@ DescriptableObject
|
||||
{
|
||||
if (auto root = GetAggregationRoot())
|
||||
{
|
||||
if (!root->destructing)
|
||||
if (aggregationInfo[aggregationSize + 1] != nullptr)
|
||||
{
|
||||
delete root;
|
||||
CHECK_ERROR(!IsAggregated(), L"vl::reflection::DescriptableObject::~DescriptableObject0()#FinalizeAggregation function should be called.");
|
||||
}
|
||||
}
|
||||
for (vint i = 0; i < aggregationSize; i++)
|
||||
@@ -17434,6 +17476,11 @@ TypeDescriptorImpl
|
||||
return typeDescriptorFlags;
|
||||
}
|
||||
|
||||
bool TypeDescriptorImpl::IsAggregatable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const WString& TypeDescriptorImpl::GetTypeName()
|
||||
{
|
||||
return typeName;
|
||||
@@ -17736,6 +17783,11 @@ SerializableTypeDescriptorBase
|
||||
return typeDescriptorFlags;
|
||||
}
|
||||
|
||||
bool SerializableTypeDescriptorBase::IsAggregatable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const WString& SerializableTypeDescriptorBase::GetTypeName()
|
||||
{
|
||||
return typeName;
|
||||
|
||||
+40
-2
@@ -8172,6 +8172,7 @@ Attribute
|
||||
void SetAggregationParent(vint index, DescriptableObject* value);
|
||||
void SetAggregationParent(vint index, Ptr<DescriptableObject>& value);
|
||||
void InitializeAggregation(vint size);
|
||||
void FinalizeAggregation();
|
||||
|
||||
template<typename T>
|
||||
void SafeAggregationCast(T*& result)
|
||||
@@ -8233,6 +8234,15 @@ Attribute
|
||||
/// ...
|
||||
/// };
|
||||
///
|
||||
/// If you want YourClass to be inheritable in scripts, instead of using Description, you should use AggregatableDescription, like this:
|
||||
/// class YourClass : public AggregatableDescription<YourClass>
|
||||
/// {
|
||||
/// ~YourClass()
|
||||
/// {
|
||||
/// FinalizeAggregation();
|
||||
/// }
|
||||
/// };
|
||||
///
|
||||
/// After you have complete your type, use the following macros and functions to register your class into the global type table. Everything should be defined in vl::reflection::description namespaces.
|
||||
/// Some of the predefined type has already been registered, if your types depend on these types, you should load those types by calling some or all of them:
|
||||
/// [F:vl.reflection.description.LoadPredefinedTypes]
|
||||
@@ -8486,6 +8496,11 @@ Attribute
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class AggregatableDescription : public Description<T>
|
||||
{
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
description::ITypeDescriptor* Description<T>::associatedTypeDescriptor=0;
|
||||
|
||||
@@ -8792,6 +8807,8 @@ ITypeDescriptor
|
||||
{
|
||||
public:
|
||||
virtual TypeDescriptorFlags GetTypeDescriptorFlags() = 0;
|
||||
virtual bool IsAggregatable() = 0;
|
||||
|
||||
virtual const WString& GetTypeName() = 0;
|
||||
virtual const WString& GetCppFullTypeName() = 0;
|
||||
virtual IValueSerializer* GetValueSerializer() = 0;
|
||||
@@ -8988,6 +9005,11 @@ Interface Implementation Proxy (Implement)
|
||||
template<typename TInterface, typename ...TBaseInterfaces>
|
||||
class ValueInterfaceImpl : public virtual ValueInterfaceRoot, public virtual TInterface, public ValueInterfaceProxy<TBaseInterfaces>...
|
||||
{
|
||||
public:
|
||||
~ValueInterfaceImpl()
|
||||
{
|
||||
FinalizeAggregation();
|
||||
}
|
||||
};
|
||||
#pragma warning(pop)
|
||||
|
||||
@@ -9688,6 +9710,15 @@ Logging
|
||||
void Record(ParsingTreeCustomBase* node, const ParsingTextRange& range)override;
|
||||
};
|
||||
|
||||
class ParsingUpdateLocationRecorder : public Object, public virtual IParsingPrintNodeRecorder
|
||||
{
|
||||
public:
|
||||
ParsingUpdateLocationRecorder();
|
||||
~ParsingUpdateLocationRecorder();
|
||||
|
||||
void Record(ParsingTreeCustomBase* node, const ParsingTextRange& range)override;
|
||||
};
|
||||
|
||||
class ParsingWriter : public stream::TextWriter
|
||||
{
|
||||
typedef collections::Pair<ParsingTreeCustomBase*, ParsingTextPos> NodePosPair;
|
||||
@@ -10962,6 +10993,7 @@ SerializableTypeDescriptor
|
||||
~SerializableTypeDescriptorBase();
|
||||
|
||||
TypeDescriptorFlags GetTypeDescriptorFlags()override;
|
||||
bool IsAggregatable()override;
|
||||
const WString& GetTypeName()override;
|
||||
const WString& GetCppFullTypeName()override;
|
||||
IValueSerializer* GetValueSerializer()override;
|
||||
@@ -11505,6 +11537,8 @@ TypeDescriptorImpl
|
||||
~TypeDescriptorImpl();
|
||||
|
||||
TypeDescriptorFlags GetTypeDescriptorFlags()override;
|
||||
bool IsAggregatable()override;
|
||||
|
||||
const WString& GetTypeName()override;
|
||||
const WString& GetCppFullTypeName()override;
|
||||
IValueSerializer* GetValueSerializer()override;
|
||||
@@ -13875,7 +13909,7 @@ InterfaceProxy
|
||||
|
||||
#define BEGIN_INTERFACE_PROXY_NOPARENT_HEADER(INTERFACE)\
|
||||
template<>\
|
||||
class ValueInterfaceProxy<INTERFACE> : ValueInterfaceImpl<INTERFACE>\
|
||||
class ValueInterfaceProxy<INTERFACE> : public ValueInterfaceImpl<INTERFACE>\
|
||||
{\
|
||||
typedef INTERFACE _interface_proxy_InterfaceType;\
|
||||
public:\
|
||||
@@ -13890,7 +13924,7 @@ InterfaceProxy
|
||||
|
||||
#define BEGIN_INTERFACE_PROXY_HEADER(INTERFACE, ...)\
|
||||
template<>\
|
||||
class ValueInterfaceProxy<INTERFACE> : ValueInterfaceImpl<INTERFACE, __VA_ARGS__>\
|
||||
class ValueInterfaceProxy<INTERFACE> : public ValueInterfaceImpl<INTERFACE, __VA_ARGS__>\
|
||||
{\
|
||||
typedef INTERFACE _interface_proxy_InterfaceType;\
|
||||
public:\
|
||||
@@ -14038,6 +14072,10 @@ Class
|
||||
Description<TYPENAME>::SetAssociatedTypeDescroptor(0);\
|
||||
}\
|
||||
protected:\
|
||||
bool IsAggregatable()override\
|
||||
{\
|
||||
return AcceptValue<typename RequiresConvertable<TYPENAME, AggregatableDescription<TYPENAME>>::YesNoType>::Result;\
|
||||
}\
|
||||
void LoadInternal()override\
|
||||
{
|
||||
|
||||
|
||||
+36
-23
@@ -1586,11 +1586,13 @@ Serialization (TypeImpl)
|
||||
|
||||
static void IOClass(WfReader& reader, WfClass* td)
|
||||
{
|
||||
reader << td->destructorFunctionIndex;
|
||||
IOCustomType(reader, td, true);
|
||||
}
|
||||
|
||||
static void IOClass(WfWriter& writer, WfClass* td)
|
||||
{
|
||||
writer << td->destructorFunctionIndex;
|
||||
IOCustomType(writer, td, true);
|
||||
}
|
||||
|
||||
@@ -3405,15 +3407,14 @@ WfRuntimeThreadContext
|
||||
if (OPERATOR_OpConvertToType(result, converted, ins))
|
||||
{
|
||||
PushValue(converted);
|
||||
return WfRuntimeExecutionAction::ExecuteInstruction;
|
||||
}
|
||||
else
|
||||
{
|
||||
WString from = result.IsNull() ? L"<null>" : L"<" + result.GetText() + L"> of " + result.GetTypeDescriptor()->GetTypeName();
|
||||
WString to = ins.typeDescriptorParameter->GetTypeName();
|
||||
RaiseException(L"Failed to convert from \"" + from + L"\" to \"" + to + L"\".", false);
|
||||
return WfRuntimeExecutionAction::Nop;
|
||||
}
|
||||
return WfRuntimeExecutionAction::ExecuteInstruction;
|
||||
}
|
||||
case WfInsCode::TryConvertToType:
|
||||
{
|
||||
@@ -4459,38 +4460,41 @@ WfInterfaceConstructor
|
||||
for (vint i = 0; i < baseTypes.Count(); i++)
|
||||
{
|
||||
auto td = baseTypes[i];
|
||||
if (auto group = td->GetConstructorGroup())
|
||||
if (td != description::GetTypeDescriptor<IDescriptable>())
|
||||
{
|
||||
vint count = group->GetMethodCount();
|
||||
IMethodInfo* selectedCtor = nullptr;
|
||||
|
||||
for (vint j = 0; j < count; j++)
|
||||
if (auto group = td->GetConstructorGroup())
|
||||
{
|
||||
auto ctor = group->GetMethod(j);
|
||||
if (ctor->GetParameterCount() == 1)
|
||||
vint count = group->GetMethodCount();
|
||||
IMethodInfo* selectedCtor = nullptr;
|
||||
|
||||
for (vint j = 0; j < count; j++)
|
||||
{
|
||||
auto type = ctor->GetParameter(0)->GetType();
|
||||
if (type->GetDecorator() == ITypeInfo::SharedPtr && type->GetTypeDescriptor() == description::GetTypeDescriptor<IValueInterfaceProxy>())
|
||||
auto ctor = group->GetMethod(j);
|
||||
if (ctor->GetParameterCount() == 1)
|
||||
{
|
||||
selectedCtor = ctor;
|
||||
break;
|
||||
auto type = ctor->GetParameter(0)->GetType();
|
||||
if (type->GetDecorator() == ITypeInfo::SharedPtr && type->GetTypeDescriptor() == description::GetTypeDescriptor<IValueInterfaceProxy>())
|
||||
{
|
||||
selectedCtor = ctor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedCtor)
|
||||
{
|
||||
baseCtors.Add(selectedCtor);
|
||||
if (selectedCtor)
|
||||
{
|
||||
baseCtors.Add(selectedCtor);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ArgumentCountMismtatchException(group);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ArgumentCountMismtatchException(group);
|
||||
throw ConstructorNotExistsException(td);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ConstructorNotExistsException(td);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4831,12 +4835,21 @@ WfClassInstance
|
||||
WfClassInstance::WfClassInstance(ITypeDescriptor* _typeDescriptor)
|
||||
:Description<WfClassInstance>(_typeDescriptor)
|
||||
{
|
||||
classType = dynamic_cast<WfCustomType*>(_typeDescriptor);
|
||||
classType = dynamic_cast<WfClass*>(_typeDescriptor);
|
||||
InitializeAggregation(classType->GetExpandedBaseTypes().Count());
|
||||
}
|
||||
|
||||
WfClassInstance::~WfClassInstance()
|
||||
{
|
||||
if (classType->destructorFunctionIndex != -1)
|
||||
{
|
||||
auto capturedVariables = MakePtr<WfRuntimeVariableContext>();
|
||||
capturedVariables->variables.Resize(1);
|
||||
capturedVariables->variables[0] = Value::From(this);
|
||||
|
||||
auto argumentArray = IValueList::Create();
|
||||
WfRuntimeLambda::Invoke(classType->GetGlobalContext(), capturedVariables, classType->destructorFunctionIndex, argumentArray);
|
||||
}
|
||||
}
|
||||
|
||||
void WfClassInstance::InstallBaseObject(ITypeDescriptor* td, Value& value)
|
||||
|
||||
@@ -561,6 +561,8 @@ Custom Type
|
||||
{
|
||||
friend class WfTypeImpl;
|
||||
public:
|
||||
vint destructorFunctionIndex = -1;
|
||||
|
||||
WfClass(const WString& typeName);
|
||||
~WfClass();
|
||||
};
|
||||
@@ -582,7 +584,7 @@ Instance
|
||||
typedef reflection::description::ITypeDescriptor ITypeDescriptor;
|
||||
typedef reflection::description::Value Value;
|
||||
protected:
|
||||
WfCustomType* classType = nullptr;
|
||||
WfClass* classType = nullptr;
|
||||
|
||||
public:
|
||||
WfClassInstance(ITypeDescriptor* _typeDescriptor);
|
||||
|
||||
+404
-158
File diff suppressed because one or more lines are too long
@@ -195,6 +195,7 @@ namespace vl
|
||||
class WfNewInterfaceExpression;
|
||||
class WfBaseConstructorCall;
|
||||
class WfConstructorDeclaration;
|
||||
class WfDestructorDeclaration;
|
||||
class WfClassDeclaration;
|
||||
class WfModuleUsingFragment;
|
||||
class WfModuleUsingNameFragment;
|
||||
@@ -980,6 +981,7 @@ namespace vl
|
||||
virtual void Visit(WfEventDeclaration* node)=0;
|
||||
virtual void Visit(WfPropertyDeclaration* node)=0;
|
||||
virtual void Visit(WfConstructorDeclaration* node)=0;
|
||||
virtual void Visit(WfDestructorDeclaration* node)=0;
|
||||
virtual void Visit(WfClassDeclaration* node)=0;
|
||||
};
|
||||
|
||||
@@ -1153,6 +1155,16 @@ namespace vl
|
||||
static vl::Ptr<WfConstructorDeclaration> Convert(vl::Ptr<vl::parsing::ParsingTreeNode> node, const vl::collections::List<vl::regex::RegexToken>& tokens);
|
||||
};
|
||||
|
||||
class WfDestructorDeclaration : public WfDeclaration, vl::reflection::Description<WfDestructorDeclaration>
|
||||
{
|
||||
public:
|
||||
vl::Ptr<WfStatement> statement;
|
||||
|
||||
void Accept(WfDeclaration::IVisitor* visitor)override;
|
||||
|
||||
static vl::Ptr<WfDestructorDeclaration> Convert(vl::Ptr<vl::parsing::ParsingTreeNode> node, const vl::collections::List<vl::regex::RegexToken>& tokens);
|
||||
};
|
||||
|
||||
class WfClassDeclaration : public WfDeclaration, vl::reflection::Description<WfClassDeclaration>
|
||||
{
|
||||
public:
|
||||
@@ -1355,6 +1367,7 @@ namespace vl
|
||||
DECL_TYPE_INFO(vl::workflow::WfConstructorType)
|
||||
DECL_TYPE_INFO(vl::workflow::WfBaseConstructorCall)
|
||||
DECL_TYPE_INFO(vl::workflow::WfConstructorDeclaration)
|
||||
DECL_TYPE_INFO(vl::workflow::WfDestructorDeclaration)
|
||||
DECL_TYPE_INFO(vl::workflow::WfClassDeclaration)
|
||||
DECL_TYPE_INFO(vl::workflow::WfModuleUsingFragment)
|
||||
DECL_TYPE_INFO(vl::workflow::WfModuleUsingNameFragment)
|
||||
@@ -1684,6 +1697,11 @@ namespace vl
|
||||
INVOKE_INTERFACE_PROXY(Visit, node);
|
||||
}
|
||||
|
||||
void Visit(vl::workflow::WfDestructorDeclaration* node)override
|
||||
{
|
||||
INVOKE_INTERFACE_PROXY(Visit, node);
|
||||
}
|
||||
|
||||
void Visit(vl::workflow::WfClassDeclaration* node)override
|
||||
{
|
||||
INVOKE_INTERFACE_PROXY(Visit, node);
|
||||
@@ -2202,6 +2220,7 @@ Code Generation
|
||||
{
|
||||
typedef collections::Dictionary<WfLexicalSymbol*, vint> SymbolIndexMap;
|
||||
typedef collections::Dictionary<WfConstructorDeclaration*, vint> ConstructorIndexMap;
|
||||
typedef collections::Dictionary<WfDestructorDeclaration*, vint> DestructorIndexMap;
|
||||
typedef collections::Dictionary<parsing::ParsingTreeCustomBase*, parsing::ParsingTextRange> NodePositionMap;
|
||||
typedef collections::Dictionary<Ptr<WfLexicalFunctionConfig>, vint> ThisStackCountMap;
|
||||
public:
|
||||
@@ -2210,6 +2229,7 @@ Code Generation
|
||||
SymbolIndexMap globalVariables;
|
||||
SymbolIndexMap globalFunctions;
|
||||
ConstructorIndexMap constructors;
|
||||
DestructorIndexMap destructors;
|
||||
SymbolIndexMap closureFunctions;
|
||||
Ptr<WfCodegenFunctionContext> functionContext;
|
||||
NodePositionMap nodePositionsBeforeCodegen;
|
||||
@@ -2344,6 +2364,7 @@ Error Messages
|
||||
static Ptr<parsing::ParsingError> WrongDeclaration(WfEventDeclaration* node);
|
||||
static Ptr<parsing::ParsingError> WrongDeclaration(WfPropertyDeclaration* node);
|
||||
static Ptr<parsing::ParsingError> WrongDeclaration(WfConstructorDeclaration* node);
|
||||
static Ptr<parsing::ParsingError> WrongDeclaration(WfDestructorDeclaration* node);
|
||||
static Ptr<parsing::ParsingError> WrongDeclarationInInterfaceConstructor(WfDeclaration* node);
|
||||
|
||||
// E: Module error
|
||||
@@ -2379,6 +2400,7 @@ Error Messages
|
||||
static Ptr<parsing::ParsingError> DuplicatedBaseInterface(WfClassDeclaration* node, reflection::description::ITypeDescriptor* type);
|
||||
static Ptr<parsing::ParsingError> WrongBaseConstructorCall(WfBaseConstructorCall* node, reflection::description::ITypeDescriptor* type);
|
||||
static Ptr<parsing::ParsingError> DuplicatedBaseConstructorCall(WfBaseConstructorCall* node, reflection::description::ITypeDescriptor* type);
|
||||
static Ptr<parsing::ParsingError> TooManyDestructor(WfDestructorDeclaration* node, WfClassDeclaration* classDecl);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -17,7 +17,7 @@ void GuiMain()
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/BlackSkin.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
GetInstanceResourceManager()->SetResource(L"Resource", resource);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window;
|
||||
window.MoveToScreenCenter();
|
||||
|
||||
@@ -15,7 +15,7 @@ void GuiMain()
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/ContainersAndButtons.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
GetInstanceResourceManager()->SetResource(L"Resource", resource);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window;
|
||||
window.MoveToScreenCenter();
|
||||
|
||||
@@ -17,7 +17,7 @@ void GuiMain()
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/TextEditor.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
GetInstanceResourceManager()->SetResource(L"Resource", resource);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window;
|
||||
window.MoveToScreenCenter();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -15,7 +15,7 @@ void GuiMain()
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/CppXml.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
GetInstanceResourceManager()->SetResource(L"Resource", resource);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
helloworld::MainWindow window;
|
||||
window.MoveToScreenCenter();
|
||||
|
||||
@@ -80,7 +80,7 @@ void GuiMain()
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/MVVM.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
GetInstanceResourceManager()->SetResource(L"Resource", resource);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
auto viewModel = MakePtr<ViewModel>();
|
||||
auto window = new helloworld::MainWindow(viewModel);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -15,7 +15,7 @@ void GuiMain()
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/Alignment.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
GetInstanceResourceManager()->SetResource(L"Resource", resource);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window;
|
||||
window.MoveToScreenCenter();
|
||||
|
||||
@@ -15,7 +15,7 @@ void GuiMain()
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/Flow.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
GetInstanceResourceManager()->SetResource(L"Resource", resource);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window;
|
||||
window.MoveToScreenCenter();
|
||||
|
||||
@@ -24,7 +24,7 @@ void GuiMain()
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/RichTextEmbedding.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
GetInstanceResourceManager()->SetResource(L"Resource", resource);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window(new ViewModel);
|
||||
window.MoveToScreenCenter();
|
||||
|
||||
@@ -15,7 +15,7 @@ void GuiMain()
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/Stack.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
GetInstanceResourceManager()->SetResource(L"Resource", resource);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window;
|
||||
window.MoveToScreenCenter();
|
||||
|
||||
@@ -15,7 +15,7 @@ void GuiMain()
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/Table.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
GetInstanceResourceManager()->SetResource(L"Resource", resource);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window;
|
||||
window.MoveToScreenCenter();
|
||||
|
||||
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