diff --git a/Import/GacUI.cpp b/Import/GacUI.cpp index 754a94d6..5c8c11cb 100644 --- a/Import/GacUI.cpp +++ b/Import/GacUI.cpp @@ -33540,6 +33540,7 @@ GuiTableComposition void GuiTableComposition::SetRowOption(vint _row, GuiCellOption option) { rowOptions[_row] = option; + UpdateCellBounds(); InvokeOnCompositionStateChanged(); ConfigChanged.Execute(GuiEventArgs(this)); } @@ -33552,6 +33553,7 @@ GuiTableComposition void GuiTableComposition::SetColumnOption(vint _column, GuiCellOption option) { columnOptions[_column] = option; + UpdateCellBounds(); InvokeOnCompositionStateChanged(); ConfigChanged.Execute(GuiEventArgs(this)); } @@ -33565,6 +33567,7 @@ GuiTableComposition { if (value < 0) value = 0; cellPadding = value; + UpdateCellBounds(); InvokeOnCompositionStateChanged(); } @@ -43570,6 +43573,7 @@ GuiResource } GuiResourcePrecompileContext context; + context.compilerCallback = callback ? callback->GetCompilerCallback() : nullptr; context.rootResource = this; context.resolver = new GuiResourcePathResolver(this, workingDirectory); context.targetFolder = new GuiResourceFolder; diff --git a/Import/GacUI.h b/Import/GacUI.h index 5c50340f..e08745c1 100644 --- a/Import/GacUI.h +++ b/Import/GacUI.h @@ -3256,6 +3256,11 @@ Interfaces: namespace vl { + namespace workflow + { + class IWfCompilerCallback; + } + namespace presentation { using namespace reflection; @@ -3782,12 +3787,14 @@ Resource Type Resolver { typedef collections::Dictionary, Ptr> PropertyMap; + /// Progress callback. + workflow::IWfCompilerCallback* compilerCallback = nullptr; /// The folder to contain compiled objects. Ptr targetFolder; /// The root resource object. - GuiResource* rootResource; + GuiResource* rootResource = nullptr; /// Indicate the pass index of this precompiling pass. - vint passIndex; + vint passIndex = -1; /// The path resolver. This is only for delay load resource. Ptr resolver; /// Additional properties for resource item contents @@ -3857,6 +3864,7 @@ Resource Type Resolver class IGuiResourcePrecompileCallback : public virtual IDescriptable, public Description { public: + virtual workflow::IWfCompilerCallback* GetCompilerCallback() = 0; virtual void OnPerPass(vint passIndex) = 0; virtual void OnPerResource(vint passIndex, Ptr resource) = 0; }; diff --git a/Import/GacUICompiler.cpp b/Import/GacUICompiler.cpp index 7963565e..a1f86a3e 100644 --- a/Import/GacUICompiler.cpp +++ b/Import/GacUICompiler.cpp @@ -2273,7 +2273,7 @@ namespace vl } } - void Workflow_GenerateAssembly(GuiResourcePrecompileContext& context, const WString& path, GuiResourceError::List& errors, bool keepMetadata) + void Workflow_GenerateAssembly(GuiResourcePrecompileContext& context, const WString& path, GuiResourceError::List& errors, bool keepMetadata, IWfCompilerCallback* compilerCallback) { auto compiled = Workflow_GetModule(context, path); if (!compiled) @@ -2310,12 +2310,12 @@ namespace vl if (manager->errors.Count() == 0) { - manager->Rebuild(true); + manager->Rebuild(true, compilerCallback); } if (manager->errors.Count() == 0) { - compiled->assembly = GenerateAssembly(manager); + compiled->assembly = GenerateAssembly(manager, compilerCallback); compiled->Initialize(true); } else @@ -2431,7 +2431,7 @@ Shared Script Type Resolver (Script) switch (context.passIndex) { case Workflow_Compile: - Workflow_GenerateAssembly(context, Path_Shared, errors, false); + Workflow_GenerateAssembly(context, Path_Shared, errors, false, context.compilerCallback); break; } } @@ -2577,7 +2577,7 @@ Instance Type Resolver (Instance) types::ResolvingResult resolvingResult; resolvingResult.resource = resource; resolvingResult.context = obj; - if (auto module = Workflow_GenerateInstanceClass(context, resolvingResult, errors, context.passIndex)) + if (auto module = Workflow_GenerateInstanceClass(context, L"" + obj->className, resolvingResult, errors, context.passIndex)) { Workflow_AddModule(context, Path_TemporaryClass, module, GuiInstanceCompiledWorkflow::TemporaryClass, obj->tagPosition); } @@ -2609,9 +2609,9 @@ Instance Type Resolver (Instance) if (errors.Count() == previousErrorCount) { - if (auto ctorModule = Workflow_PrecompileInstanceContext(context, resolvingResult, errors)) + if (auto ctorModule = Workflow_PrecompileInstanceContext(context, L"" + obj->className, resolvingResult, errors)) { - if (auto instanceModule = Workflow_GenerateInstanceClass(context, resolvingResult, errors, context.passIndex)) + if (auto instanceModule = Workflow_GenerateInstanceClass(context, L"" + obj->className, resolvingResult, errors, context.passIndex)) { Workflow_AddModule(context, Path_InstanceClass, ctorModule, GuiInstanceCompiledWorkflow::InstanceClass, obj->tagPosition); Workflow_AddModule(context, Path_InstanceClass, instanceModule, GuiInstanceCompiledWorkflow::InstanceClass, obj->tagPosition); @@ -2663,14 +2663,14 @@ Instance Type Resolver (Instance) switch (context.passIndex) { case Instance_CompileInstanceTypes: - Workflow_GenerateAssembly(context, path, errors, false); + Workflow_GenerateAssembly(context, path, errors, false, context.compilerCallback); compiled->modules.Clear(); break; case Instance_CompileEventHandlers: - Workflow_GenerateAssembly(context, path, errors, false); + Workflow_GenerateAssembly(context, path, errors, false, context.compilerCallback); break; case Instance_CompileInstanceClass: - Workflow_GenerateAssembly(context, path, errors, true); + Workflow_GenerateAssembly(context, path, errors, true, context.compilerCallback); break; default:; } @@ -6639,9 +6639,9 @@ FindInstanceLoadingSource Workflow_PrecompileInstanceContext ***********************************************************************/ - Ptr Workflow_PrecompileInstanceContext(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors) + Ptr Workflow_PrecompileInstanceContext(GuiResourcePrecompileContext& precompileContext, const WString& moduleName, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors) { - auto module = Workflow_CreateModuleWithUsings(resolvingResult.context); + auto module = Workflow_CreateModuleWithUsings(resolvingResult.context, moduleName); { auto block = Workflow_InstallCtorClass(resolvingResult, module); Workflow_GenerateCreating(precompileContext, resolvingResult, block, errors); @@ -6922,7 +6922,7 @@ Workflow_GenerateInstanceClass } }; - Ptr Workflow_GenerateInstanceClass(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors, vint passIndex) + Ptr Workflow_GenerateInstanceClass(GuiResourcePrecompileContext& precompileContext, const WString& moduleName, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors, vint passIndex) { bool beforePrecompile = false; bool needEventHandler = false; @@ -6961,7 +6961,7 @@ Workflow_GenerateInstanceClass // Instance Class /////////////////////////////////////////////////////////////// - auto module = Workflow_CreateModuleWithUsings(context); + auto module = Workflow_CreateModuleWithUsings(context, moduleName); auto instanceClass = Workflow_InstallClass(context->className, module); { auto typeInfo = MakePtr(baseType->GetTypeDescriptor(), TypeInfoHint::Normal); @@ -9302,10 +9302,10 @@ namespace vl Workflow_CreateModuleWithUsings ***********************************************************************/ - Ptr Workflow_CreateModuleWithUsings(Ptr context) + Ptr Workflow_CreateModuleWithUsings(Ptr context, const WString& moduleName) { auto module = MakePtr(); - module->name.value = L""; + module->name.value = moduleName; vint index = context->namespaces.Keys().IndexOf(GlobalStringKey()); if (index != -1) diff --git a/Import/GacUICompiler.h b/Import/GacUICompiler.h index d3eaccde..e33683b8 100644 --- a/Import/GacUICompiler.h +++ b/Import/GacUICompiler.h @@ -799,7 +799,7 @@ WorkflowCompiler (Installation) WorkflowCompiler (Compile) ***********************************************************************/ - extern Ptr Workflow_CreateModuleWithUsings(Ptr context); + extern Ptr Workflow_CreateModuleWithUsings(Ptr context, const WString& moduleName); extern Ptr Workflow_InstallClass(const WString& className, Ptr module); extern Ptr Workflow_InstallCtorClass(types::ResolvingResult& resolvingResult, Ptr module); @@ -844,8 +844,8 @@ WorkflowCompiler (Compile) extern InstanceLoadingSource FindInstanceLoadingSource(Ptr context, GlobalStringKey namespaceName, const WString& typeName); extern InstanceLoadingSource FindInstanceLoadingSource(Ptr context, GuiConstructorRepr* ctor); - extern Ptr Workflow_PrecompileInstanceContext(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors); - extern Ptr Workflow_GenerateInstanceClass(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors, vint passIndex); + extern Ptr Workflow_PrecompileInstanceContext(GuiResourcePrecompileContext& precompileContext, const WString& moduleName, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors); + extern Ptr Workflow_GenerateInstanceClass(GuiResourcePrecompileContext& precompileContext, const WString& moduleName, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors, vint passIndex); #define WORKFLOW_ENVIRONMENT_VARIABLE_ADD\ FOREACH_INDEXER(GlobalStringKey, envVar, index, repr->environmentVariables.Keys())\ diff --git a/Import/VlppWorkflowCompiler.cpp b/Import/VlppWorkflowCompiler.cpp index 8eb6689c..285b7c8b 100644 --- a/Import/VlppWorkflowCompiler.cpp +++ b/Import/VlppWorkflowCompiler.cpp @@ -463,8 +463,11 @@ WfLexicalScopeManager baseConstructorCallResolvings.Clear(); } - void WfLexicalScopeManager::Rebuild(bool keepTypeDescriptorNames) +#define CALLBACK(EXPR) if (callback) callback->EXPR + + void WfLexicalScopeManager::Rebuild(bool keepTypeDescriptorNames, IWfCompilerCallback* callback) { + CALLBACK(OnLoadEnvironment()); Clear(keepTypeDescriptorNames, false); if (!globalName) { @@ -472,6 +475,7 @@ WfLexicalScopeManager BuildGlobalNameFromTypeDescriptors(this); } + CALLBACK(OnInitialize(this)); vint errorCount = errors.Count(); #define EXIT_IF_ERRORS_EXIST\ @@ -507,12 +511,15 @@ WfLexicalScopeManager EXIT_IF_ERRORS_EXIST; FOREACH(Ptr, module, modules) { + CALLBACK(OnValidateModule(module)); ValidateModuleSemantic(this, module); } #undef EXIT_IF_ERRORS_EXIST } +#undef CALLBACK + bool WfLexicalScopeManager::ResolveMember(ITypeDescriptor* typeDescriptor, const WString& name, bool preferStatic, collections::SortedList& searchedTypes, collections::List& results) { if (searchedTypes.Contains(typeDescriptor)) @@ -20661,8 +20668,11 @@ GenerateTypeCastInstructions GenerateAssembly ***********************************************************************/ - Ptr GenerateAssembly(analyzer::WfLexicalScopeManager* manager) +#define CALLBACK(EXPR) if (callback) callback->EXPR + + Ptr GenerateAssembly(analyzer::WfLexicalScopeManager* manager, IWfCompilerCallback* callback) { + CALLBACK(OnGenerateMetadata()); auto assembly = MakePtr(); assembly->insBeforeCodegen = new WfInstructionDebugInfo; assembly->insAfterCodegen = new WfInstructionDebugInfo; @@ -20757,16 +20767,19 @@ GenerateAssembly FOREACH(Ptr, module, manager->GetModules()) { + CALLBACK(OnGenerateCode(module)); FOREACH(Ptr, decl, module->declarations) { GenerateDeclarationInstructions(context, decl); } } + CALLBACK(OnGenerateDebugInfo()); assembly->Initialize(); return assembly; } +#undef CALLBACK #undef INSTRUCTION /*********************************************************************** diff --git a/Import/VlppWorkflowCompiler.h b/Import/VlppWorkflowCompiler.h index c81c02b8..9f6e719d 100644 --- a/Import/VlppWorkflowCompiler.h +++ b/Import/VlppWorkflowCompiler.h @@ -3296,12 +3296,30 @@ namespace vl { namespace analyzer { - class WfLexicalSymbol; class WfLexicalScope; class WfLexicalScopeManager; + } /*********************************************************************** +Callback +***********************************************************************/ + + class IWfCompilerCallback : public Interface + { + public: + virtual void OnLoadEnvironment() = 0; + virtual void OnInitialize(analyzer::WfLexicalScopeManager* manager) = 0; + virtual void OnValidateModule(Ptr module) = 0; + + virtual void OnGenerateMetadata() = 0; + virtual void OnGenerateCode(Ptr module) = 0; + virtual void OnGenerateDebugInfo() = 0; + }; + + namespace analyzer + { +/*********************************************************************** Scope ***********************************************************************/ @@ -3492,7 +3510,7 @@ Scope Manager void Clear(bool keepTypeDescriptorNames, bool deleteModules); /// Compile. /// Set to false to delete all cache of reflectable C++ types before compiling. - void Rebuild(bool keepTypeDescriptorNames); + void Rebuild(bool keepTypeDescriptorNames, IWfCompilerCallback* callback = nullptr); bool ResolveMember(ITypeDescriptor* typeDescriptor, const WString& name, bool preferStatic, collections::SortedList& searchedTypes, collections::List& results); bool ResolveName(WfLexicalScope* scope, const WString& name, collections::List& results); @@ -3955,7 +3973,7 @@ Code Generation /// Generate an assembly from a compiler. [M:vl.workflow.analyzer.WfLexicalScopeManager.Rebuild] should be called before using this function. /// The generated assembly. /// The Workflow compiler. - extern Ptr GenerateAssembly(analyzer::WfLexicalScopeManager* manager); + extern Ptr GenerateAssembly(analyzer::WfLexicalScopeManager* manager, IWfCompilerCallback* callback = nullptr); /// Compile a Workflow program. /// The generated assembly. diff --git a/Tools/GacGen.exe b/Tools/GacGen.exe index 040fed14..7042c5b5 100644 Binary files a/Tools/GacGen.exe and b/Tools/GacGen.exe differ diff --git a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin index bc462327..c3566ed5 100644 Binary files a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin and b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin differ