Demo: Controls/DocumentEditor

This commit is contained in:
Zihan Chen
2017-06-22 02:25:54 -07:00
parent 5ed328afae
commit c2b8ea624b
44 changed files with 8422 additions and 846 deletions
+1394 -801
View File
File diff suppressed because it is too large Load Diff
+102 -37
View File
@@ -4231,6 +4231,15 @@ Rich Content Document (run)
class DocumentHyperlinkRun : public DocumentStyleApplicationRun, public Description<DocumentHyperlinkRun>
{
public:
class Package : public Object, public Description<Package>
{
public:
collections::List<Ptr<DocumentHyperlinkRun>> hyperlinks;
vint row = -1;
vint start = -1;
vint end = -1;
};
/// <summary>Style name for normal state.</summary>
WString normalStyleName;
/// <summary>Style name for active state.</summary>
@@ -4320,44 +4329,44 @@ Rich Content Document (model)
typedef collections::Dictionary<WString, Ptr<DocumentStyle>> StyleMap;
public:
/// <summary>All paragraphs.</summary>
ParagraphList paragraphs;
ParagraphList paragraphs;
/// <summary>All available styles. These will not be persistant.</summary>
StyleMap styles;
StyleMap styles;
DocumentModel();
static void MergeStyle(Ptr<DocumentStyleProperties> style, Ptr<DocumentStyleProperties> parent);
void MergeBaselineStyle(Ptr<DocumentStyleProperties> style, const WString& styleName);
void MergeBaselineStyle(Ptr<DocumentModel> baselineDocument, const WString& styleName);
void MergeBaselineStyles(Ptr<DocumentModel> baselineDocument);
void MergeDefaultFont(const FontProperties& defaultFont);
ResolvedStyle GetStyle(Ptr<DocumentStyleProperties> sp, const ResolvedStyle& context);
ResolvedStyle GetStyle(const WString& styleName, const ResolvedStyle& context);
static void MergeStyle(Ptr<DocumentStyleProperties> style, Ptr<DocumentStyleProperties> parent);
void MergeBaselineStyle(Ptr<DocumentStyleProperties> style, const WString& styleName);
void MergeBaselineStyle(Ptr<DocumentModel> baselineDocument, const WString& styleName);
void MergeBaselineStyles(Ptr<DocumentModel> baselineDocument);
void MergeDefaultFont(const FontProperties& defaultFont);
ResolvedStyle GetStyle(Ptr<DocumentStyleProperties> sp, const ResolvedStyle& context);
ResolvedStyle GetStyle(const WString& styleName, const ResolvedStyle& context);
WString GetText(bool skipNonTextContent);
void GetText(stream::TextWriter& writer, bool skipNonTextContent);
WString GetText(bool skipNonTextContent);
void GetText(stream::TextWriter& writer, bool skipNonTextContent);
bool CheckEditRange(TextPos begin, TextPos end, RunRangeMap& relatedRanges);
Ptr<DocumentModel> CopyDocument(TextPos begin, TextPos end, bool deepCopy);
Ptr<DocumentModel> CopyDocument();
bool CutParagraph(TextPos position);
bool CutEditRange(TextPos begin, TextPos end);
bool EditContainer(TextPos begin, TextPos end, const Func<void(DocumentParagraphRun*, RunRangeMap&, vint, vint)>& editor);
bool CheckEditRange(TextPos begin, TextPos end, RunRangeMap& relatedRanges);
Ptr<DocumentModel> CopyDocument(TextPos begin, TextPos end, bool deepCopy);
Ptr<DocumentModel> CopyDocument();
bool CutParagraph(TextPos position);
bool CutEditRange(TextPos begin, TextPos end);
bool EditContainer(TextPos begin, TextPos end, const Func<void(DocumentParagraphRun*, RunRangeMap&, vint, vint)>& editor);
vint EditRun(TextPos begin, TextPos end, Ptr<DocumentModel> replaceToModel, bool copy);
vint EditRunNoCopy(TextPos begin, TextPos end, const collections::Array<Ptr<DocumentParagraphRun>>& runs);
vint EditText(TextPos begin, TextPos end, bool frontSide, const collections::Array<WString>& text);
bool EditStyle(TextPos begin, TextPos end, Ptr<DocumentStyleProperties> style);
Ptr<DocumentImageRun> EditImage(TextPos begin, TextPos end, Ptr<GuiImageData> image);
bool EditHyperlink(vint paragraphIndex, vint begin, vint end, const WString& reference, const WString& normalStyleName=NormalLinkStyleName, const WString& activeStyleName=ActiveLinkStyleName);
bool RemoveHyperlink(vint paragraphIndex, vint begin, vint end);
Ptr<DocumentHyperlinkRun> GetHyperlink(vint paragraphIndex, vint begin, vint end);
bool EditStyleName(TextPos begin, TextPos end, const WString& styleName);
bool RemoveStyleName(TextPos begin, TextPos end);
bool RenameStyle(const WString& oldStyleName, const WString& newStyleName);
bool ClearStyle(TextPos begin, TextPos end);
Ptr<DocumentStyleProperties> SummarizeStyle(TextPos begin, TextPos end);
Nullable<Alignment> SummarizeParagraphAlignment(TextPos begin, TextPos end);
vint EditRun(TextPos begin, TextPos end, Ptr<DocumentModel> replaceToModel, bool copy);
vint EditRunNoCopy(TextPos begin, TextPos end, const collections::Array<Ptr<DocumentParagraphRun>>& runs);
vint EditText(TextPos begin, TextPos end, bool frontSide, const collections::Array<WString>& text);
bool EditStyle(TextPos begin, TextPos end, Ptr<DocumentStyleProperties> style);
Ptr<DocumentImageRun> EditImage(TextPos begin, TextPos end, Ptr<GuiImageData> image);
bool EditHyperlink(vint paragraphIndex, vint begin, vint end, const WString& reference, const WString& normalStyleName=NormalLinkStyleName, const WString& activeStyleName=ActiveLinkStyleName);
bool RemoveHyperlink(vint paragraphIndex, vint begin, vint end);
Ptr<DocumentHyperlinkRun::Package> GetHyperlink(vint paragraphIndex, vint begin, vint end);
bool EditStyleName(TextPos begin, TextPos end, const WString& styleName);
bool RemoveStyleName(TextPos begin, TextPos end);
bool RenameStyle(const WString& oldStyleName, const WString& newStyleName);
bool ClearStyle(TextPos begin, TextPos end);
Ptr<DocumentStyleProperties> SummarizeStyle(TextPos begin, TextPos end);
Nullable<Alignment> SummarizeParagraphAlignment(TextPos begin, TextPos end);
/// <summary>Load a document model from an xml.</summary>
/// <returns>The loaded document model.</returns>
@@ -5704,7 +5713,7 @@ Rich Content Document (element)
void Render(Rect bounds)override;
void OnElementStateChanged()override;
void NotifyParagraphUpdated(vint index, vint oldCount, vint newCount, bool updatedText);
Ptr<DocumentHyperlinkRun> GetHyperlinkFromPoint(Point point);
Ptr<DocumentHyperlinkRun::Package> GetHyperlinkFromPoint(Point point);
void OpenCaret(TextPos caret, Color color, bool frontSide);
void CloseCaret(TextPos caret);
@@ -5876,7 +5885,7 @@ Rich Content Document (element)
/// <summary>Get hyperlink from point.</summary>
/// <returns>Corressponding hyperlink id. Returns -1 indicates that the point is not in a hyperlink.</returns>
/// <param name="point">The point to get the hyperlink id.</param>
Ptr<DocumentHyperlinkRun> GetHyperlinkFromPoint(Point point);
Ptr<DocumentHyperlinkRun::Package> GetHyperlinkFromPoint(Point point);
};
}
}
@@ -9815,6 +9824,8 @@ Window
/// <summary>Move the window to the center of the screen. If multiple screens exist, the window move to the screen that contains the biggest part of the window.</summary>
void MoveToScreenCenter();
/// <summary>Move the window to the center of the specified screen.</summary>
void MoveToScreenCenter(INativeScreen* screen);
/// <summary>
/// Test is the maximize box visible.
@@ -14883,8 +14894,7 @@ GuiDocumentCommonInterface
GuiControl* documentControl;
elements::GuiDocumentElement* documentElement;
compositions::GuiBoundsComposition* documentComposition;
Ptr<DocumentHyperlinkRun> activeHyperlink;
vint activeHyperlinkParagraph;
Ptr<DocumentHyperlinkRun::Package> activeHyperlinks;
bool dragging;
EditMode editMode;
@@ -14898,7 +14908,7 @@ GuiDocumentCommonInterface
void Move(TextPos caret, bool shift, bool frontSide);
bool ProcessKey(vint code, bool shift, bool ctrl);
void InstallDocumentViewer(GuiControl* _sender, compositions::GuiGraphicsComposition* _container);
void SetActiveHyperlink(Ptr<DocumentHyperlinkRun> hyperlink, vint paragraphIndex=-1);
void SetActiveHyperlink(Ptr<DocumentHyperlinkRun::Package> package);
void ActivateActiveHyperlink(bool activate);
void AddShortcutCommand(vint key, const Func<void()>& eventHandler);
void EditTextInternal(TextPos begin, TextPos end, const Func<void(TextPos, TextPos, vint&, vint&)>& editor);
@@ -15060,7 +15070,12 @@ GuiDocumentCommonInterface
/// <param name="begin">The begin position of the range.</param>
/// <param name="end">The end position of the range.</param>
/// <param name="alignments">The alignment for each paragraph.</param>
void SetParagraphAlignment(TextPos begin, TextPos end, const collections::Array<Nullable<Alignment>>& alignments);
void SetParagraphAlignments(TextPos begin, TextPos end, const collections::Array<Nullable<Alignment>>& alignments);
/// <summary>Set the alignment of paragraphs in a specified range.</summary>
/// <param name="begin">The begin position of the range.</param>
/// <param name="end">The end position of the range.</param>
/// <param name="alignment">The alignment for each paragraph.</param>
void SetParagraphAlignment(TextPos begin, TextPos end, Nullable<Alignment> alignment);
/// <summary>Summarize the text alignment in a specified range.</summary>
/// <returns>The text alignment summary.</returns>
/// <param name="begin">The begin position of the range.</param>
@@ -21812,6 +21827,56 @@ GuiGrammarColorizer
#endif
/***********************************************************************
RESOURCES\GUIDOCUMENTEDITOR.H
***********************************************************************/
/***********************************************************************
Vczh Library++ 3.0
Developer: Zihan Chen(vczh)
GacUI::Resource
Interfaces:
***********************************************************************/
#ifndef VCZH_PRESENTATION_RESOURCES_GUIDOCUMENTEDITOR
#define VCZH_PRESENTATION_RESOURCES_GUIDOCUMENTEDITOR
namespace vl
{
namespace presentation
{
typedef DocumentModel::RunRange RunRange;
typedef DocumentModel::RunRangeMap RunRangeMap;
namespace document_editor
{
extern void GetRunRange(DocumentParagraphRun* run, RunRangeMap& runRanges);
extern void LocateStyle(DocumentParagraphRun* run, RunRangeMap& runRanges, vint position, bool frontSide, collections::List<DocumentContainerRun*>& locatedRuns);
extern Ptr<DocumentHyperlinkRun::Package> LocateHyperlink(DocumentParagraphRun* run, RunRangeMap& runRanges, vint row, vint start, vint end);
extern Ptr<DocumentStyleProperties> CopyStyle(Ptr<DocumentStyleProperties> style);
extern Ptr<DocumentRun> CopyRun(DocumentRun* run);
extern Ptr<DocumentRun> CopyStyledText(collections::List<DocumentContainerRun*>& styleRuns, const WString& text);
extern Ptr<DocumentRun> CopyRunRecursively(DocumentParagraphRun* run, RunRangeMap& runRanges, vint start, vint end, bool deepCopy);
extern void CollectStyleName(DocumentParagraphRun* run, collections::List<WString>& styleNames);
extern void ReplaceStyleName(DocumentParagraphRun* run, const WString& oldStyleName, const WString& newStyleName);
extern void RemoveRun(DocumentParagraphRun* run, RunRangeMap& runRanges, vint start, vint end);
extern void CutRun(DocumentParagraphRun* run, RunRangeMap& runRanges, vint position, Ptr<DocumentRun>& leftRun, Ptr<DocumentRun>& rightRun);
extern void ClearUnnecessaryRun(DocumentParagraphRun* run, DocumentModel* model);
extern void AddStyle(DocumentParagraphRun* run, RunRangeMap& runRanges, vint start, vint end, Ptr<DocumentStyleProperties> style);
extern void AddHyperlink(DocumentParagraphRun* run, RunRangeMap& runRanges, vint start, vint end, const WString& reference, const WString& normalStyleName, const WString& activeStyleName);
extern void AddStyleName(DocumentParagraphRun* run, RunRangeMap& runRanges, vint start, vint end, const WString& styleName);
extern void RemoveHyperlink(DocumentParagraphRun* run, RunRangeMap& runRanges, vint start, vint end);
extern void RemoveStyleName(DocumentParagraphRun* run, RunRangeMap& runRanges, vint start, vint end);
extern void ClearStyle(DocumentParagraphRun* run, RunRangeMap& runRanges, vint start, vint end);
extern Ptr<DocumentStyleProperties> SummerizeStyle(DocumentParagraphRun* run, RunRangeMap& runRanges, DocumentModel* model, vint start, vint end);
extern void AggregateStyle(Ptr<DocumentStyleProperties>& dst, Ptr<DocumentStyleProperties> src);
}
}
}
#endif
/***********************************************************************
GACUI.H
***********************************************************************/
+14 -4
View File
@@ -505,7 +505,7 @@ Type Declaration
END_ENUM_ITEM(INativeDialogService::FileDialogOptions)
BEGIN_INTERFACE_MEMBER_NOPROXY(INativeController)
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetCurrentController, NO_PARAMETER, INativeController*(*)(), vl::reflection::description::GetCurrentController)
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetCurrentController, NO_PARAMETER, INativeController*(*)(), vl::presentation::GetCurrentController)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ExecutablePath)
@@ -616,6 +616,13 @@ Type Declaration
CLASS_MEMBER_FIELD(styleName)
END_CLASS_MEMBER(DocumentStyleApplicationRun)
BEGIN_CLASS_MEMBER(DocumentHyperlinkRun::Package)
CLASS_MEMBER_FIELD(hyperlinks)
CLASS_MEMBER_FIELD(row)
CLASS_MEMBER_FIELD(start)
CLASS_MEMBER_FIELD(end)
END_CLASS_MEMBER(DocumentHyperlinkRun::Package)
BEGIN_CLASS_MEMBER(DocumentHyperlinkRun)
CLASS_MEMBER_BASE(DocumentStyleApplicationRun)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DocumentHyperlinkRun>(), NO_PARAMETER)
@@ -1629,6 +1636,7 @@ Type Declaration
CLASS_MEMBER_PROPERTY_FAST(Bounds)
CLASS_MEMBER_PROPERTY_FAST(ShortcutKeyManager)
CLASS_MEMBER_PROPERTY_READONLY_FAST(AnimationManager)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedScreen)
CLASS_MEMBER_METHOD(ForceCalculateSizeImmediately, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetFocused, NO_PARAMETER)
@@ -1658,7 +1666,8 @@ Type Declaration
CLASS_MEMBER_PROPERTY_FAST(IconVisible)
CLASS_MEMBER_PROPERTY_FAST(TitleBar)
CLASS_MEMBER_METHOD(MoveToScreenCenter, NO_PARAMETER)
CLASS_MEMBER_METHOD_OVERLOAD(MoveToScreenCenter, NO_PARAMETER, void(GuiWindow::*)())
CLASS_MEMBER_METHOD_OVERLOAD(MoveToScreenCenter, { L"screen" }, void(GuiWindow::*)(INativeScreen*))
CLASS_MEMBER_METHOD(ShowModal, { L"owner" _ L"callback" })
CLASS_MEMBER_METHOD(ShowModalAndDelete, { L"owner" _ L"callback" })
CLASS_MEMBER_METHOD(ShowModalAsync, { L"owner" })
@@ -2297,14 +2306,15 @@ Type Declaration
CLASS_MEMBER_METHOD(EditText, {L"begin" _ L"end" _ L"frontSide" _ L"text"})
CLASS_MEMBER_METHOD(EditStyle, {L"begin" _ L"end" _ L"style"})
CLASS_MEMBER_METHOD(EditImage, {L"begin" _ L"end" _ L"image"})
CLASS_MEMBER_METHOD(EditImage, {L"paragraphIndex" _ L"begin" _ L"end" _ L"reference" _ L"normalStyleName" _ L"activeStyleName"})
CLASS_MEMBER_METHOD(EditHyperlink, {L"paragraphIndex" _ L"begin" _ L"end" _ L"reference" _ L"normalStyleName" _ L"activeStyleName"})
CLASS_MEMBER_METHOD(RemoveHyperlink, {L"paragraphIndex" _ L"begin" _ L"end"})
CLASS_MEMBER_METHOD(EditStyleName, {L"begin" _ L"end" _ L"styleName"})
CLASS_MEMBER_METHOD(RemoveStyleName, {L"begin" _ L"end" _ L"image"})
CLASS_MEMBER_METHOD(RenameStyle, {L"oldStyleName" _ L"newStyleName"})
CLASS_MEMBER_METHOD(ClearStyle, {L"begin" _ L"end"})
CLASS_MEMBER_METHOD(SummarizeStyle, {L"begin" _ L"end"})
CLASS_MEMBER_METHOD(SetParagraphAlignment, {L"begin" _ L"end" _ L"alignments"})
CLASS_MEMBER_METHOD(SetParagraphAlignments, { L"begin" _ L"end" _ L"alignments" })
CLASS_MEMBER_METHOD(SetParagraphAlignment, { L"begin" _ L"end" _ L"alignment" })
CLASS_MEMBER_METHOD(SummarizeParagraphAlignment, { L"begin" _ L"end" })
CLASS_MEMBER_METHOD(SelectAll, NO_PARAMETER)
CLASS_MEMBER_METHOD(CanCut, NO_PARAMETER)
+1
View File
@@ -89,6 +89,7 @@ Type List (Basic)
F(presentation::DocumentEmbeddedObjectRun)\
F(presentation::DocumentStylePropertiesRun)\
F(presentation::DocumentStyleApplicationRun)\
F(presentation::DocumentHyperlinkRun::Package)\
F(presentation::DocumentHyperlinkRun)\
F(presentation::DocumentParagraphRun)\
F(presentation::DocumentStyle)\
BIN
View File
Binary file not shown.
+3
View File
@@ -19,3 +19,6 @@ popd
pushd DataGrid\UI
call Codegen.bat
popd
pushd DocumentEditor\UI
call Codegen.bat
popd
@@ -162,6 +162,10 @@
<Project>{96c559ca-9718-4bec-a053-28a0ab6a8ca2}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Xml Include="UI\DataGridComponents.xml" />
<Xml Include="UI\Resource.xml" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
@@ -33,4 +33,12 @@
<Filter>UI</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Xml Include="UI\DataGridComponents.xml">
<Filter>Resource Files</Filter>
</Xml>
<Xml Include="UI\Resource.xml">
<Filter>Resource Files</Filter>
</Xml>
</ItemGroup>
</Project>
@@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{DB0EEADE-E377-4A35-A432-96982EFC6AF6}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DocumentEditor</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Main.cpp" />
<ClCompile Include="UI\Source\DemoPartialClasses.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="UI\Source\Demo.h" />
<ClInclude Include="UI\Source\DemoPartialClasses.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Lib\GacUILite\GacUILite.vcxproj">
<Project>{96c559ca-9718-4bec-a053-28a0ab6a8ca2}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="UI">
<UniqueIdentifier>{69bac203-e424-45f8-9ee9-02339dc0166c}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UI\Source\DemoPartialClasses.cpp">
<Filter>UI</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="UI\Source\DemoPartialClasses.h">
<Filter>UI</Filter>
</ClInclude>
<ClInclude Include="UI\Source\Demo.h">
<Filter>UI</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -0,0 +1,25 @@
#define GAC_HEADER_USE_NAMESPACE
#include "UI/Source/Demo.h"
#include <Windows.h>
using namespace vl::collections;
using namespace vl::stream;
using namespace vl::reflection::description;
using namespace demo;
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int CmdShow)
{
return SetupWindowsDirect2DRenderer();
}
void GuiMain()
{
{
FileStream fileStream(L"../UIRes/DocumentEditor.bin", FileStream::ReadOnly);
auto resource = GuiResource::LoadPrecompiledBinary(fileStream);
GetResourceManager()->SetResource(L"Resource", resource);
}
demo::MainWindow window;
window.MoveToScreenCenter();
GetApplication()->Run(&window);
}
@@ -0,0 +1 @@
..\..\..\..\Tools\GacGen.exe Resource.xml
@@ -0,0 +1,65 @@
<Folder>
<Instance name="HyperlinkWindowResource">
<Instance ref.CodeBehind="false" ref.Class="demo::HyperlinkWindow">
<ref.Members>
<![CDATA[
prop Url : string? = null {}
]]>
</ref.Members>
<Window ref.Name="self" Text="Hyperlink" ClientSize="x:320 y:80" SizeBox="false" MinimizedBox="false" MaximizedBox="false" ShowInTaskBar="false">
<att.BoundsComposition-set PreferredMinSize="x:320 y:80"/>
<Table CellPadding="5" BorderVisible="true" AlignmentToParent="left:0 top:0 right:0 bottom:0">
<att.Rows>
<_>composeType:MinSize</_>
<_>composeType:Percentage percentage:1.0</_>
<_>composeType:MinSize</_>
</att.Rows>
<att.Columns>
<_>composeType:MinSize</_>
<_>composeType:Percentage percentage:1.0</_>
<_>composeType:MinSize</_>
<_>composeType:MinSize</_>
</att.Columns>
<Cell Site="row:0 column:0">
<SolidLabel Text="Url: " HorizontalAlignment="Center"/>
</Cell>
<Cell Site="row:0 column:1 columnSpan:3">
<SinglelineTextBox ref.Name="textUrl">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</SinglelineTextBox>
</Cell>
<Cell Site="row:2 column:2">
<Button Text="OK">
<att.BoundsComposition-set PreferredMinSize="x:100"/>
<ev.Clicked-eval>
<![CDATA[
{
self.Url = textUrl.Text;
self.Close();
}
]]>
</ev.Clicked-eval>
</Button>
</Cell>
<Cell Site="row:2 column:3">
<Button Text="Cancel">
<att.BoundsComposition-set PreferredMinSize="x:100"/>
<ev.Clicked-eval>
<![CDATA[
{
self.Url = null;
self.Close();
}
]]>
</ev.Clicked-eval>
</Button>
</Cell>
</Table>
</Window>
</Instance>
</Instance>
</Folder>
@@ -0,0 +1,497 @@
<Resource>
<Folder name="GacGenConfig">
<Folder name="Cpp">
<Text name="SourceFolder">Source</Text>
<Text name="Resource">..\..\UIRes\DocumentEditor.bin</Text>
<Text name="NormalInclude">GacUI.h</Text>
<Text name="ReflectionInclude">GacUIReflection.h</Text>
<Text name="Name">Demo</Text>
</Folder>
</Folder>
<Instance name="MainWindowResource">
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow" xmlns:demo="demo::*">
<ref.Members>
<![CDATA[
@cpp:Private
func SetEditMode(editMode: DocumentCommonInterface::EditMode) : void
{
var command =
editMode == DocumentCommonInterface::EditMode::ViewOnly ? commandViewOnly :
editMode == DocumentCommonInterface::EditMode::Selectable ? commandSelectable :
commandEditable;
document.EditMode = editMode;
commandViewOnly.Selected = (command == commandViewOnly);
commandSelectable.Selected = (command == commandSelectable);
commandEditable.Selected = (command == commandEditable);
buttonView.Image = command.Image;
self.UpdateSubscriptions();
}
@cpp:Private
func SelectAlignmentCommand() : ToolstripCommand*
{
var alignment = document.SummarizeParagraphAlignment(document.CaretBegin, document.CaretEnd);
return
alignment == Alignment::Left ? commandAlignLeft :
alignment == Alignment::Center ? commandAlignCenter :
alignment == Alignment::Right ? commandAlignRight :
commandAlignDefault;
}
@cpp:Private
func SetAlignment(alignment : Alignment?) : void
{
document.SetParagraphAlignment(document.CaretBegin, document.CaretEnd, alignment);
self.UpdateSubscriptions();
}
@cpp:Private
prop HasEditableSelection : bool = false {}
@cpp:Private
prop HasEditableSelectionInSingleParagraph : bool = false {}
@cpp:Private
func HasEditableCursor() : bool
{
return document.EditMode == DocumentCommonInterface::EditMode::Editable;
}
@cpp:Private
func HasEditableHyperlink(forEdit : bool) : bool
{
var a = document.CaretBegin;
var b = document.CaretEnd;
return a.row == b.row and a.column != b.column;
}
]]>
</ref.Members>
<ref.Ctor>
<![CDATA[
{
SetEditMode(Editable);
}
]]>
</ref.Ctor>
<Window ref.Name="self" Text="DocumentEditor" ClientSize="x:640 y:480">
<att.BoundsComposition-set PreferredMinSize="x:640 y:480"/>
<att.HasEditableSelection-bind>document.observe as _(_.CanCut() on _.SelectionChanged)</att.HasEditableSelection-bind>
<MessageDialog ref.Name="dialogMessage" Title="You Clicked a Hyperlink!"/>
<OpenFileDialog ref.Name="dialogOpen" Title="Select an Image" Filter="Image Files (*.jpg;*.png;*.bmp)|*.jpg;*.png;*.bmp" EnabledPreview="true" Options="FileDialogFileMustExist|FileDialogDereferenceLinks"/>
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0">
<att.Rows>
<_>composeType:MinSize</_>
<_>composeType:MinSize</_>
<_>composeType:Percentage percentage:1.0</_>
</att.Rows>
<att.Columns>
<_>composeType:Percentage percentage:1.0</_>
</att.Columns>
<Cell Site="row:0 column:0">
<ToolstripMenuBar>
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<MenuBarButton Text="Edit" Alt="E">
<att.SubMenu-set>
<MenuItemButton Command-ref="commandUndo" Alt="U"/>
<MenuItemButton Command-ref="commandRedo" Alt="R"/>
<MenuSplitter/>
<MenuItemButton Command-ref="commandCopy" Alt="C"/>
<MenuItemButton Command-ref="commandCut" Alt="X"/>
<MenuItemButton Command-ref="commandPaste" Alt="P"/>
<MenuSplitter/>
<MenuItemButton Command-ref="commandDelete" Alt="D"/>
<MenuSplitter/>
<MenuItemButton Command-ref="commandSelect" Alt="A"/>
<MenuItemButton Text="Object" Alt="O">
<att.SubMenu-set>
<MenuItemButton Command-ref="commandInsertImage" Alt="I"/>
<MenuItemButton Command-ref="commandEditHyperlink" Alt="L"/>
<MenuItemButton Command-ref="commandRemoveHyperlink" Alt="R"/>
</att.SubMenu-set>
</MenuItemButton>
<MenuItemButton Text="Paragram Alignment" Alt="P">
<att.SubMenu-set>
<MenuItemButton Command-ref="commandAlignDefault" Alt="D"/>
<MenuItemButton Command-ref="commandAlignLeft" Alt="L"/>
<MenuItemButton Command-ref="commandAlignCenter" Alt="C"/>
<MenuItemButton Command-ref="commandAlignRight" Alt="R"/>
</att.SubMenu-set>
</MenuItemButton>
</att.SubMenu-set>
</MenuBarButton>
<MenuBarButton Text="View" Alt="V">
<att.SubMenu-set>
<MenuItemButton Command-ref="commandViewOnly" Alt="V"/>
<MenuItemButton Command-ref="commandSelectable" Alt="S"/>
<MenuItemButton Command-ref="commandEditable" Alt="E"/>
</att.SubMenu-set>
</MenuBarButton>
</ToolstripMenuBar>
</Cell>
<Cell Site="row:1 column:0">
<ToolstripToolBar>
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<ToolstripDropdownButton ref.Name="buttonView" Alt="V">
<att.SubMenu-set>
<MenuItemButton Command-ref="commandViewOnly" Alt="V"/>
<MenuItemButton Command-ref="commandSelectable" Alt="S"/>
<MenuItemButton Command-ref="commandEditable" Alt="E"/>
</att.SubMenu-set>
</ToolstripDropdownButton>
<ToolstripDropdownButton ref.Name="buttonAlignment" Alt="P">
<att.Image-bind>document.observe as _(self.SelectAlignmentCommand().Image on _.SelectionChanged)</att.Image-bind>
<att.SubMenu-set>
<MenuItemButton Command-ref="commandAlignDefault" Alt="D"/>
<MenuItemButton Command-ref="commandAlignLeft" Alt="L"/>
<MenuItemButton Command-ref="commandAlignCenter" Alt="C"/>
<MenuItemButton Command-ref="commandAlignRight" Alt="R"/>
</att.SubMenu-set>
</ToolstripDropdownButton>
<ToolstripSplitter/>
<ToolstripButton Command-ref="commandUndo" Alt="U"/>
<ToolstripButton Command-ref="commandRedo" Alt="R"/>
<ToolstripSplitter/>
<ToolstripButton Command-ref="commandCopy" Alt="C"/>
<ToolstripButton Command-ref="commandCut" Alt="X"/>
<ToolstripButton Command-ref="commandPaste" Alt="P"/>
<ToolstripSplitter/>
<ToolstripButton Command-ref="commandDelete" Alt="D"/>
<ToolstripSplitter/>
<ToolstripSplitButton Command-ref="commandInsertImage" Alt="I">
<att.SubMenu-set>
<MenuItemButton Command-ref="commandInsertImage" Alt="I"/>
<MenuItemButton Command-ref="commandEditHyperlink" Alt="L"/>
<MenuItemButton Command-ref="commandRemoveHyperlink" Alt="R"/>
</att.SubMenu-set>
</ToolstripSplitButton>
<ToolstripButton Command-ref="commandBold" Alt="B"/>
<ToolstripButton Command-ref="commandItalic" Alt="I"/>
<ToolstripButton Command-ref="commandUnderline" Alt="U"/>
<ToolstripButton Command-ref="commandStrike" Alt="S"/>
<ToolstripButton Command-ref="commandFont" Alt="F"/>
<ToolstripButton Command-ref="commandColor" Alt="C"/>
<ToolstripButton Command-ref="commandBackColor" Alt="K"/>
</ToolstripToolBar>
</Cell>
<Cell Site="row:2 column:0">
<DocumentViewer ref.Name="document" EditMode="Editable">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<ev.ActiveHyperlinkExecuted-eval>
<![CDATA[
{
dialogMessage.Text = document.ActiveHyperlinkReference;
dialogMessage.ShowDialog();
}
]]>
</ev.ActiveHyperlinkExecuted-eval>
</DocumentViewer>
</Cell>
</Table>
<ToolstripCommand ref.Name="commandUndo" Text="Undo" Image-uri="res://ToolbarImages/Undo" ShortcutBuilder="Ctrl+Z">
<att.Enabled-bind>document.observe as _(_.CanUndo() on _.UndoRedoChanged)</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[document.Undo();]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandRedo" Text="Redo" Image-uri="res://ToolbarImages/Redo" ShortcutBuilder="Ctrl+Y">
<att.Enabled-bind>document.observe as _(_.CanRedo() on _.UndoRedoChanged)</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[document.Redo();]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandCopy" Text="Copy" Image-uri="res://ToolbarImages/Copy" ShortcutBuilder="Ctrl+C">
<att.Enabled-bind>document.observe as _(_.CanCopy() on _.SelectionChanged)</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[document.Copy();]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandCut" Text="Cut" Image-uri="res://ToolbarImages/Cut" ShortcutBuilder="Ctrl+X">
<att.Enabled-bind>self.HasEditableSelection</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[document.Cut();]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandPaste" Text="Paste" Image-uri="res://ToolbarImages/Paste" ShortcutBuilder="Ctrl+V">
<att.Enabled-bind>self.observe as _(document.CanPaste() on _.BoundsComposition.clipboardNotify)</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[document.Paste();]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandDelete" Text="Delete" Image-uri="res://ToolbarImages/Delete">
<att.Enabled-bind>self.HasEditableSelection</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[document.SetSelectionText("");]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandSelect" Text="Select All" ShortcutBuilder="Ctrl+A">
<ev.Executed-eval>
<![CDATA[document.SelectAll();]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandInsertImage" Text="Insert Image ..." Image-uri="res://ToolbarImages/Image">
<att.Enabled-bind>self.HasEditableCursor()</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[
{
if (dialogOpen.ShowDialog())
{
var imageService = INativeController::GetCurrentController().ImageService();
var image = imageService.CreateImageFromFile(dialogOpen.FileName);
var imageData = new ImageData^(image, 0);
document.EditImage(document.CaretBegin, document.CaretEnd, imageData);
}
}
]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandEditHyperlink" Text="Edit Hyperlink ..." Image-uri="res://ToolbarImages/Link">
<att.Enabled-bind>document.observe as _(self.HasEditableHyperlink(true) on _.SelectionChanged)</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[
$Async{
var mainWindow = self.RelatedControlHost as controls::GuiWindow*;
var window = new HyperlinkWindow*();
window.MoveToScreenCenter(mainWindow.RelatedScreen);
$Await window.ShowModalAsync(mainWindow);
if (window.Url is not null)
{
var row = document.CaretBegin.row;
var begin = document.CaretBegin.column;
var end = document.CaretEnd.column;
document.EditHyperlink(row, begin, end, cast string window.Url, "#NormalLink", "#ActiveLink");
}
delete window;
}
]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandRemoveHyperlink" Text="Remove Hyperlink" Image-uri="res://ToolbarImages/RemoveLink">
<att.Enabled-bind>document.observe as _(self.HasEditableHyperlink(false) on _.SelectionChanged)</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[
{
var row = document.CaretBegin.row;
var begin = document.CaretBegin.column;
var end = document.CaretEnd.column;
document.RemoveHyperlink(row, begin, end);
}
]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandBold" Text="Bold" Image-uri="res://ToolbarImages/Bold">
<att.Enabled-bind>self.HasEditableSelection</att.Enabled-bind>
<att.Selected-bind>document.observe as _(_.SummarizeStyle(_.CaretBegin, _.CaretEnd).bold == true on _.SelectionChanged, _.ModifiedChanged)</att.Selected-bind>
<ev.Executed-eval>
<![CDATA[
{
var style = new DocumentStyleProperties^();
style.bold = not commandBold.Selected;
document.EditStyle(document.CaretBegin, document.CaretEnd, style);
}
]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandItalic" Text="Italic" Image-uri="res://ToolbarImages/Italic">
<att.Enabled-bind>self.HasEditableSelection</att.Enabled-bind>
<att.Selected-bind>document.observe as _(_.SummarizeStyle(_.CaretBegin, _.CaretEnd).italic == true on _.SelectionChanged, _.ModifiedChanged)</att.Selected-bind>
<ev.Executed-eval>
<![CDATA[
{
var style = new DocumentStyleProperties^();
style.italic = not commandItalic.Selected;
document.EditStyle(document.CaretBegin, document.CaretEnd, style);
}
]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandUnderline" Text="Underline" Image-uri="res://ToolbarImages/Underline">
<att.Enabled-bind>self.HasEditableSelection</att.Enabled-bind>
<att.Selected-bind>document.observe as _(_.SummarizeStyle(_.CaretBegin, _.CaretEnd).underline == true on _.SelectionChanged, _.ModifiedChanged)</att.Selected-bind>
<ev.Executed-eval>
<![CDATA[
{
var style = new DocumentStyleProperties^();
style.underline = not commandUnderline.Selected;
document.EditStyle(document.CaretBegin, document.CaretEnd, style);
}
]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandStrike" Text="Strike" Image-uri="res://ToolbarImages/Strike">
<att.Enabled-bind>self.HasEditableSelection</att.Enabled-bind>
<att.Selected-bind>document.observe as _(_.SummarizeStyle(_.CaretBegin, _.CaretEnd).strikeline == true on _.SelectionChanged, _.ModifiedChanged)</att.Selected-bind>
<ev.Executed-eval>
<![CDATA[
{
var style = new DocumentStyleProperties^();
style.strikeline = not commandStrike.Selected;
document.EditStyle(document.CaretBegin, document.CaretEnd, style);
}
]]>
</ev.Executed-eval>
</ToolstripCommand>
<ColorDialog ref.Name="dialogColor" EnabledCustomColor="false"/>
<FontDialog ref.Name="dialogFont" ShowEffect="false" ShowSelection="true" ForceFontExist="true"/>
<ToolstripCommand ref.Name="commandFont" Text="Set Font ..." Image-uri="res://ToolbarImages/Font">
<att.Enabled-bind>self.HasEditableSelection</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[
{
var begin = document.CaretBegin;
var end = document.CaretEnd;
var style = document.SummarizeStyle(begin, end);
var baselineFont = document.Font;
dialogFont.SelectedFont =
{
fontFamily: ( style.face is null ? baselineFont.fontFamily : cast string style.face )
size: ( style.size is null ? baselineFont.size : cast int style.size.size )
};
if (dialogFont.ShowDialog())
{
style = new DocumentStyleProperties^();
var selectedFont = dialogFont.SelectedFont;
style.face = selectedFont.fontFamily;
style.size = {size:selectedFont.size relative:false};
document.EditStyle(begin, end, style);
}
}
]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandColor" Text="Text Color ..." Image-uri="res://ToolbarImages/Color">
<att.Enabled-bind>self.HasEditableSelection</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[
{
var begin = document.CaretBegin;
var end = document.CaretEnd;
var selectedColor = document.SummarizeStyle(begin, end).color;
if (selectedColor is null)
{
dialogColor.SelectedColor = cast Color "#000000";
}
else
{
dialogColor.SelectedColor = cast Color selectedColor;
}
if (dialogColor.ShowDialog())
{
var style = new DocumentStyleProperties^();
style.color = dialogColor.SelectedColor;
document.EditStyle(begin, end, style);
}
}
]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandBackColor" Text="Background Color ..." Image-uri="res://ToolbarImages/BackColor">
<att.Enabled-bind>self.HasEditableSelection</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[
{
var begin = document.CaretBegin;
var end = document.CaretEnd;
var selectedColor = document.SummarizeStyle(begin, end).backgroundColor;
if (selectedColor is null)
{
dialogColor.SelectedColor = cast Color "#000000";
}
else
{
dialogColor.SelectedColor = cast Color selectedColor;
}
if (dialogColor.ShowDialog())
{
var style = new DocumentStyleProperties^();
style.backgroundColor = dialogColor.SelectedColor;
document.EditStyle(begin, end, style);
}
}
]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandViewOnly" Text="Preview" Image-uri="res://ToolbarImages/ViewOnly">
<ev.Executed-eval>
<![CDATA[self.SetEditMode(ViewOnly);]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandSelectable" Text="Selectable" Image-uri="res://ToolbarImages/Selectable">
<ev.Executed-eval>
<![CDATA[self.SetEditMode(Selectable);]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandEditable" Text="Editable" Image-uri="res://ToolbarImages/Editable">
<ev.Executed-eval>
<![CDATA[self.SetEditMode(Editable);]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandAlignDefault" Text="Set Alignment to Default (Left)" Image-uri="res://ToolbarImages/TextAlign">
<att.Enabled-bind>self.HasEditableCursor()</att.Enabled-bind>
<ev.Executed-eval>
<![CDATA[self.SetAlignment(null);]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandAlignLeft" Text="Set Alignment to Left" Image-uri="res://ToolbarImages/TextAlignLeft">
<att.Enabled-bind>self.HasEditableCursor()</att.Enabled-bind>
<att.Selected-bind>document.observe as _(self.SelectAlignmentCommand() == commandAlignLeft on _.SelectionChanged)</att.Selected-bind>
<ev.Executed-eval>
<![CDATA[self.SetAlignment(Left);]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandAlignCenter" Text="Set Alignment to Center" Image-uri="res://ToolbarImages/TextAlignCenter">
<att.Enabled-bind>self.HasEditableCursor()</att.Enabled-bind>
<att.Selected-bind>document.observe as _(self.SelectAlignmentCommand() == commandAlignCenter on _.SelectionChanged)</att.Selected-bind>
<ev.Executed-eval>
<![CDATA[self.SetAlignment(Center);]]>
</ev.Executed-eval>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandAlignRight" Text="Set Alignment to Right" Image-uri="res://ToolbarImages/TextAlignRight">
<att.Enabled-bind>self.HasEditableCursor()</att.Enabled-bind>
<att.Selected-bind>document.observe as _(self.SelectAlignmentCommand() == commandAlignRight on _.SelectionChanged)</att.Selected-bind>
<ev.Executed-eval>
<![CDATA[self.SetAlignment(Right);]]>
</ev.Executed-eval>
</ToolstripCommand>
</Window>
</Instance>
</Instance>
<Folder name="DocumentComponents" content="Link">DocumentComponents.xml</Folder>
<Folder name="ToolbarImages" content="Link">ToolbarImages/Images.xml</Folder>
</Resource>
@@ -0,0 +1,37 @@
/***********************************************************************
!!!!!! DO NOT MODIFY !!!!!!
GacGen.exe Resource.xml
This file is generated by Workflow compiler
https://github.com/vczh-libraries
***********************************************************************/
#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_DEMO
#define VCZH_WORKFLOW_COMPILER_GENERATED_DEMO
#include "DemoPartialClasses.h"
/***********************************************************************
Reflection
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION
DECL_TYPE_INFO(::demo::HyperlinkWindow)
DECL_TYPE_INFO(::demo::HyperlinkWindowConstructor)
DECL_TYPE_INFO(::demo::MainWindow)
DECL_TYPE_INFO(::demo::MainWindowConstructor)
#endif
extern bool LoadDemoTypes();
}
}
}
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,25 @@
<Folder>
<Image name="Undo" content="File">_Undo.png</Image>
<Image name="Redo" content="File">_Redo.png</Image>
<Image name="Copy" content="File">_Copy.png</Image>
<Image name="Cut" content="File">_Cut.png</Image>
<Image name="Paste" content="File">_Paste.png</Image>
<Image name="Delete" content="File">_Delete.png</Image>
<Image name="Image" content="File">e_Image.png</Image>
<Image name="Link" content="File">e_Link.png</Image>
<Image name="RemoveLink" content="File">e_RemoveLink.png</Image>
<Image name="Bold" content="File">s_Bold.png</Image>
<Image name="Italic" content="File">s_Italic.png</Image>
<Image name="Underline" content="File">s_Underline.png</Image>
<Image name="Strike" content="File">s_Strike.png</Image>
<Image name="Color" content="File">s_Color.png</Image>
<Image name="BackColor" content="File">s_BackColor.png</Image>
<Image name="Font" content="File">s_Font.png</Image>
<Image name="ViewOnly" content="File">m_ViewOnly.png</Image>
<Image name="Selectable" content="File">m_Selectable.png</Image>
<Image name="Editable" content="File">m_Editable.png</Image>
<Image name="TextAlignLeft" content="File">a_TextAlignLeft.png</Image>
<Image name="TextAlignCenter" content="File">a_TextAlignCenter.png</Image>
<Image name="TextAlignRight" content="File">a_TextAlignRight.png</Image>
<Image name="TextAlign" content="File">a_Align.png</Image>
</Folder>
Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

@@ -21,6 +21,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ListControls", "ListControl
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DataGrid", "DataGrid\DataGrid.vcxproj", "{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocumentEditor", "DocumentEditor\DocumentEditor.vcxproj", "{DB0EEADE-E377-4A35-A432-96982EFC6AF6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -83,6 +85,14 @@ Global
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Release|Win32.Build.0 = Release|Win32
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Release|x64.ActiveCfg = Release|x64
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Release|x64.Build.0 = Release|x64
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Debug|Win32.ActiveCfg = Debug|Win32
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Debug|Win32.Build.0 = Debug|Win32
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Debug|x64.ActiveCfg = Debug|x64
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Debug|x64.Build.0 = Debug|x64
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Release|Win32.ActiveCfg = Release|Win32
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Release|Win32.Build.0 = Release|Win32
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Release|x64.ActiveCfg = Release|x64
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Binary file not shown.
Binary file not shown.