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
+3
View File
@@ -18,4 +18,7 @@ call Codegen.bat
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.