<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">Linux_x86</Platform>\r
+ <!-- <Platform Condition=" '$(Platform)' == '' ">Linux_x86</Platform>-->\r
<ProjectGuid>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</ProjectGuid>\r
<OutputType>Library</OutputType>\r
<AppDesignerFolder>Properties</AppDesignerFolder>\r
<ProductVersion>8.0.30703</ProductVersion>\r
<SchemaVersion>2.0</SchemaVersion>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">\r
<DebugSymbols>true</DebugSymbols>\r
- <DefineConstants>TRACE;DEBUG</DefineConstants>\r
+ <DefineConstants>TRACE;DEBUG;__linux__</DefineConstants>\r
<Optimize>False</Optimize>\r
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>\r
<DebugType>Full</DebugType>\r
<DebugType>None</DebugType>\r
<BaseAddress>4194304</BaseAddress>\r
</PropertyGroup>\r
- <PropertyGroup Condition=" '$(Platform)' == 'Linux_x86' ">\r
+ <!-- <PropertyGroup Condition=" '$(Platform)' == 'Linux_x86' ">\r
<DefineConstants>__linux__</DefineConstants>\r
<PlatformTarget>x86</PlatformTarget>\r
<BaseAddress>4194304</BaseAddress>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$$(Platform)' == 'Win_x86' ">\r
<DefineConstants>_WIN32</DefineConstants>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Linux_x86' ">\r
- <DefineConstants>__linux__;DEBUG;TRACE</DefineConstants>\r
+ </PropertyGroup>-->\r
+ <!-- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Linux_x86' ">\r
+ <DefineConstants>DEBUG;__linux__;DEBUG;TRACE</DefineConstants>\r
<PlatformTarget>anycpu</PlatformTarget>\r
- </PropertyGroup>\r
+ </PropertyGroup>-->\r
<ItemGroup>\r
- <Compile Include="src\EventSource.cs" />\r
- <Compile Include="src\Colors.cs" />\r
- <Compile Include="src\Point.cs" />\r
- <Compile Include="Properties\AssemblyInfo.cs" />\r
- <Compile Include="src\Rectangle.cs" />\r
- <Compile Include="src\Rectangles.cs" />\r
- <Compile Include="src\Size.cs" />\r
- <Compile Include="src\OpenTKGameWindow.cs" />\r
- <Compile Include="src\GraphicObjects\GraphicObject.cs" />\r
- <Compile Include="src\GraphicObjects\Container.cs" />\r
- <Compile Include="src\GraphicObjects\Group.cs" />\r
- <Compile Include="src\GraphicObjects\GroupBox.cs" />\r
- <Compile Include="src\GraphicObjects\HorizontalStack.cs" />\r
- <Compile Include="src\GraphicObjects\Image.cs" />\r
- <Compile Include="src\GraphicObjects\Label.cs" />\r
- <Compile Include="src\GraphicObjects\TextBox.cs" />\r
- <Compile Include="src\GraphicObjects\ProgressBar.cs" />\r
- <Compile Include="src\GraphicObjects\VerticalStack.cs" />\r
- <Compile Include="src\Cairo\CairoHelpers.cs" />\r
- <Compile Include="src\win32\Win32.cs" />\r
- <Compile Include="src\win32\winApi.cs" />\r
- <Compile Include="src\GraphicObjects\Button.cs" />\r
- <Compile Include="src\GraphicObjects\GraduatedSlider.cs" />\r
- <Compile Include="src\GraphicObjects\Slider.cs" />\r
- <Compile Include="src\ValueChangeEventArgs.cs" />\r
- <Compile Include="src\GraphicObjects\NumericControl.cs" />\r
- <Compile Include="src\GraphicObjects\Scroller.cs" />\r
- <Compile Include="src\GraphicObjects\ILayoutable.cs" />\r
- <Compile Include="src\Enums.cs" />\r
- <Compile Include="src\GraphicObjects\GenericStack.cs" />\r
- <Compile Include="src\CompilerServices\CompilerServices.cs" />\r
- <Compile Include="src\GraphicObjects\AnalogMeter.cs" />\r
- <Compile Include="src\GraphicObjects\Border.cs" />\r
- <Compile Include="src\GraphicObjects\Checkbox.cs" />\r
- <Compile Include="src\Font.cs" />\r
- <Compile Include="src\TextChangeEventArgs.cs" />\r
- <Compile Include="src\OpenGL\QuadVAO.cs" />\r
- <Compile Include="src\OpenGL\Shader.cs" />\r
- <Compile Include="src\OpenGL\TexturedShader.cs" />\r
- <Compile Include="src\OpenGL\VertexArrayObject.cs" />\r
- <Compile Include="src\GraphicObjects\Window.cs" />\r
- <Compile Include="src\GraphicObjects\IGOLibHost.cs" />\r
+ <Compile Include="src\EventSource.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\Colors.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\Point.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="Properties\AssemblyInfo.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\Rectangle.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\Rectangles.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\Size.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\OpenTKGameWindow.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\GraphicObject.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\Container.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\Group.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\GroupBox.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\HorizontalStack.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\Image.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\Label.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\TextBox.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\ProgressBar.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\VerticalStack.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\Cairo\CairoHelpers.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\win32\Win32.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\win32\winApi.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\Button.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\GraduatedSlider.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\Slider.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\ValueChangeEventArgs.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\NumericControl.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\Scroller.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\ILayoutable.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\Enums.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\GenericStack.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\CompilerServices\CompilerServices.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\AnalogMeter.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\Border.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\Checkbox.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\Font.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\TextChangeEventArgs.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\OpenGL\QuadVAO.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\OpenGL\Shader.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\OpenGL\TexturedShader.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\OpenGL\VertexArrayObject.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\Window.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
+ <Compile Include="src\GraphicObjects\IGOLibHost.cs">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Compile>\r
</ItemGroup>\r
<ItemGroup>\r
<Reference Include="System" />\r
<Reference Include="System.Drawing" />\r
<Reference Include="System.Windows.Forms" />\r
<Reference Include="System.Xml" />\r
- <Reference Include="OpenTK.Compatibility, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4">\r
- <HintPath>dependencies\OpenTK.Compatibility.dll</HintPath>\r
- </Reference>\r
- <Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4">\r
- <HintPath>dependencies\OpenTK.dll</HintPath>\r
- </Reference>\r
<Reference Include="rsvg2-sharp, Version=2.18.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">\r
<Package>rsvg2-sharp-2.0</Package>\r
</Reference>\r
</Reference>\r
<Reference Include="Microsoft.CSharp" />\r
<Reference Include="Mono.Cairo" />\r
+ <Reference Include="OpenTK">\r
+ <HintPath>..\..\src\opentk-git\Binaries\OpenTK\Release\OpenTK.dll</HintPath>\r
+ </Reference>\r
</ItemGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
-->\r
<ItemGroup />\r
<ItemGroup>\r
- <Folder Include="src\GraphicObjects\" />\r
- <Folder Include="src\Cairo\" />\r
- <Folder Include="src\win32\" />\r
- <Folder Include="Images\" />\r
- <Folder Include="Images\Icons\" />\r
- <Folder Include="src\CompilerServices\" />\r
- <Folder Include="src\OpenGL\" />\r
+ <Folder Include="src\GraphicObjects\">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Folder>\r
+ <Folder Include="src\Cairo\">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Folder>\r
+ <Folder Include="src\win32\">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Folder>\r
+ <Folder Include="Images\">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Folder>\r
+ <Folder Include="Images\Icons\">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Folder>\r
+ <Folder Include="src\CompilerServices\">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Folder>\r
+ <Folder Include="src\OpenGL\">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </Folder>\r
</ItemGroup>\r
<ItemGroup>\r
- <None Include="Images\Icons\icon_alert.gif" />\r
+ <None Include="Images\Icons\icon_alert.gif">\r
+ <LogicalName>\r
+ </LogicalName>\r
+ </None>\r
</ItemGroup>\r
<ItemGroup>\r
<EmbeddedResource Include="Images\Icons\question_mark.svg">\r
EndGlobalSection\r
GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
{232716B4-D19D-4FD7-B310-94A98FD926F0}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU\r
- {232716B4-D19D-4FD7-B310-94A98FD926F0}.Debug|Linux_x86.Build.0 = Debug|Any CPU\r
{232716B4-D19D-4FD7-B310-94A98FD926F0}.Release|Linux_x86.ActiveCfg = Release|Linux_x86\r
{232716B4-D19D-4FD7-B310-94A98FD926F0}.Release|Linux_x86.Build.0 = Release|Linux_x86\r
- {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Linux_x86.ActiveCfg = Debug|Linux_x86\r
- {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Linux_x86.Build.0 = Debug|Linux_x86\r
+ {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU\r
+ {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Linux_x86.Build.0 = Debug|Any CPU\r
{74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Linux_x86.ActiveCfg = Release|Linux_x86\r
{74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Linux_x86.Build.0 = Release|Linux_x86\r
- {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Linux_x86.ActiveCfg = Debug|Linux_x86\r
- {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Linux_x86.Build.0 = Debug|Linux_x86\r
+ {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU\r
+ {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Linux_x86.Build.0 = Debug|Any CPU\r
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Linux_x86.ActiveCfg = Release|Linux_x86\r
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Linux_x86.Build.0 = Release|Linux_x86\r
{E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU\r
- {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Debug|Linux_x86.Build.0 = Debug|Any CPU\r
{E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Release|Linux_x86.ActiveCfg = Release|Any CPU\r
{E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Release|Linux_x86.Build.0 = Release|Any CPU\r
EndGlobalSection\r
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
+ <CustomCommands>
+ <CustomCommands>
+ <Command type="Execute" command="/usr/local/lib/monodevelop/bin/MonoDevelop.exe" workingdir="/usr/local/lib/monodevelop/bin/" />
+ </CustomCommands>
+ </CustomCommands>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
+ <CustomCommands>
+ <CustomCommands>
+ <Command type="Execute" command="/usr/local/lib/monodevelop/bin/MonoDevelop.exe" workingdir="/usr/local/lib/monodevelop/bin/" />
+ </CustomCommands>
+ </CustomCommands>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</Reference>
</ItemGroup>
<ItemGroup>
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Properties\AddinInfo.cs" />
- <Compile Include="src\DisplayBinding.cs" />
- <Compile Include="src\GOLibView.cs" />
- <Compile Include="src\GOLibNodeExtension.cs" />
- <Compile Include="src\GOLibGtkHost.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
+ <Compile Include="Properties\AddinInfo.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
+ <Compile Include="src\DisplayBinding.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
+ <Compile Include="src\GOLibView.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
+ <Compile Include="src\GOLibNodeExtension.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
+ <Compile Include="src\GOLibGtkHost.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
- <Folder Include="src\" />
+ <Folder Include="src\">
+ <LogicalName>
+ </LogicalName>
+ </Folder>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MonoDevelop.GOLib.addin.xml" />
protected override void OnLoad (EventArgs e)\r
{\r
base.OnLoad (e);\r
- LoadInterface("Interfaces/test0.xml", out g);\r
+ LoadInterface("Interfaces/test0.goml", out g);\r
\r
}\r
protected override void OnRenderFrame (FrameEventArgs e)\r
protected override void OnLoad (EventArgs e)\r
{\r
base.OnLoad (e);\r
- LoadInterface("Interfaces/test1.xml", out g);\r
+ LoadInterface("Interfaces/test1.goml", out g);\r
\r
}\r
protected override void OnRenderFrame (FrameEventArgs e)\r
\r
namespace test\r
{\r
- class GOLIBTest_1 : OpenTKGameWindow\r
+ class GOLIBTest_2 : OpenTKGameWindow\r
{\r
- public GOLIBTest_1 ()\r
+ public GOLIBTest_2 ()\r
: base(1024, 600,"test")\r
{}\r
\r
protected override void OnLoad (EventArgs e)\r
{\r
base.OnLoad (e);\r
- LoadInterface("Interfaces/test1.goml", out g);\r
+ LoadInterface("Interfaces/test2.goml", out g);\r
\r
}\r
protected override void OnRenderFrame (FrameEventArgs e)\r
{\r
Console.WriteLine ("starting example");\r
\r
- using (GOLIBTest_1 win = new GOLIBTest_1( )) {\r
+ using (GOLIBTest_2 win = new GOLIBTest_2( )) {\r
win.Run (30.0);\r
}\r
}\r
protected override void OnLoad (EventArgs e)\r
{\r
base.OnLoad (e);\r
- g = LoadInterface<Container>("Interfaces/test3.xml");\r
+ g = LoadInterface<Container>("Interfaces/test3.goml");\r
\r
}\r
protected override void OnRenderFrame (FrameEventArgs e)\r
{\r
base.OnLoad (e);\r
\r
- LoadInterface("Interfaces/test4.xml", out c);\r
+ LoadInterface("Interfaces/test4.goml", out c);\r
//LoadInterface("golibtests/test4.xml", out c2);\r
//c2.HorizontalAlignment = HorizontalAlignment.Left;\r
//c2.VerticalAlignment = VerticalAlignment.Top;\r
{\r
base.OnLoad (e);\r
\r
- LoadInterface("Interfaces/test5.xml", out c);\r
+ LoadInterface("Interfaces/test5.goml", out c);\r
gl.Add (c.FindByName ("g0"));\r
ll.Add (c.FindByName ("lab0")as Label);\r
}\r
<?xml version="1.0"?>\r
-<Container\r
- HorizontalAlignment="Left" VerticalAlignment="Center"\r
+<Container HorizontalAlignment="Center" VerticalAlignment="Bottom"\r
Margin="10" Focusable="True" Fit="True" Background="Green">\r
- <Group Background="White" >\r
- <Image Name="PhaseOverlay" Width="40" Height="40"\r
- Path="image/u.svg" Background="Red"/>\r
+ <Group Fit="True">\r
+ <GraphicObject Width="400" Height="40" Background="Blue"/>\r
+ <GraphicObject Width="40" Height="40" Background="Red"\r
+ HorizontalAlignment="Right"/> \r
</Group>\r
</Container>
\ No newline at end of file
Width="100" Height="10"\r
Value="30"/>\r
</HorizontalStack>\r
- <HorizontalStack Name="hsFocus">\r
+ <HorizontalStack Name="hsFocus" HorizontalAlignment="Left">\r
<Label Text="Focused:"/>\r
<Label Name="labFocus" Width="200"/>\r
</HorizontalStack>\r
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">Linux_x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{74289092-9F70-4941-AFCB-DFD7BE2140B6}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Tests</RootNamespace>
<AssemblyName>Tests</AssemblyName>
- <StartupObject>test.GOLIBTest_0</StartupObject>
+ <StartupObject>test.GOLIBTest_3</StartupObject>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<OutputPath>..\bin\$(configuration)</OutputPath>
<IntermediateOutputPath>obj\$(configuration)</IntermediateOutputPath>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\bin\Debug</OutputPath>
<WarningLevel>0</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
- <PropertyGroup Condition=" '$(Platform)' == 'Linux_x86' ">
- <DefineConstants>__linux__</DefineConstants>
- <PlatformTarget>x86</PlatformTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$$(Platform)' == 'Win_x86' ">
- <DefineConstants>_WIN32</DefineConstants>
- </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Reference Include="System" />
</Reference>
</ItemGroup>
<ItemGroup>
- <Compile Include="GOLIBTest_5.cs" />
- <Compile Include="GOLIBTest_0.cs" />
- <Compile Include="GOLIBTest_4.cs" />
- <Compile Include="GOLIBTest_3.cs" />
- <Compile Include="GOLIBTest_1.cs" />
+ <Compile Include="GOLIBTest_5.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
+ <Compile Include="GOLIBTest_0.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
+ <Compile Include="GOLIBTest_4.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
+ <Compile Include="GOLIBTest_3.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
+ <Compile Include="GOLIBTest_1.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
+ <Compile Include="GOLIBTest_2.cs">
+ <LogicalName>
+ </LogicalName>
+ </Compile>
</ItemGroup>
<ItemGroup>
<None Include="image\u.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <LogicalName>
+ </LogicalName>
</None>
<None Include="Interfaces\test1.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <LogicalName>
+ </LogicalName>
</None>
<None Include="Interfaces\test3.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <LogicalName>
+ </LogicalName>
</None>
<None Include="Interfaces\test4.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <LogicalName>
+ </LogicalName>
</None>
<None Include="Interfaces\test5.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <LogicalName>
+ </LogicalName>
</None>
<None Include="Interfaces\test0.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <LogicalName>
+ </LogicalName>
+ </None>
+ <None Include="Interfaces\test2.goml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <LogicalName>
+ </LogicalName>
</None>
</ItemGroup>
<ItemGroup>
- <Folder Include="Interfaces\" />
- <Folder Include="image\" />
+ <Folder Include="Interfaces\">
+ <LogicalName>
+ </LogicalName>
+ </Folder>
+ <Folder Include="image\">
+ <LogicalName>
+ </LogicalName>
+ </Folder>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GOLib.csproj">
bool yIsValid = false;\r
#endregion\r
\r
+ public static int TabSize = 4;\r
+ public static string LineBreak = "\r\n";\r
+ public static bool ReplaceTabsWithSpace = false;\r
public static bool DesignerMode = false;\r
\r
#region public fields\r
\r
foreach (GraphicObject c in Children) {\r
if (raw.Width < 0) {\r
- if (c.XIsValid & c.WIsValid)\r
+ if (c.WIsValid)\r
tmp.Width = Math.Max (tmp.Width, c.Slot.Right);\r
else\r
return raw;\r
}\r
if (raw.Height < 0) {\r
- if (c.YIsValid & c.HIsValid)\r
+ if (c.HIsValid)\r
tmp.Height = Math.Max (tmp.Height, c.Slot.Bottom);\r
else\r
return raw;\r
if (c.LayoutIsValid)\r
continue;\r
\r
- if (Width < 0 && c.Width != 0) {\r
+ if (Width < 0 && c.WIsValid) {\r
if (!atLeastOneChildHasWNotDependingOnParent && !(this is GenericStack))\r
c.XIsValid = true;\r
atLeastOneChildHasWNotDependingOnParent = true;\r
}\r
- if (Height < 0 && c.Height != 0) {\r
+ if (Height < 0 && c.HIsValid) {\r
if (!atLeastOneChildHasHNotDependingOnParent && !(this is GenericStack))\r
c.YIsValid = true;\r
atLeastOneChildHasHNotDependingOnParent = true;\r
c.UpdateLayout ();\r
}\r
\r
- if (Width < 0 && !atLeastOneChildHasWNotDependingOnParent)\r
- Debug.WriteLine ("ERROR: no child has fixed width and parent width is set to content!");\r
- if (Height < 0 && !atLeastOneChildHasHNotDependingOnParent)\r
- Debug.WriteLine ("ERROR: no child has fixed height and parent height is set to content!");\r
+// if (Width < 0 && !atLeastOneChildHasWNotDependingOnParent)\r
+// Debug.WriteLine ("ERROR: no child has fixed width and parent width is set to content!");\r
+// if (Height < 0 && !atLeastOneChildHasHNotDependingOnParent)\r
+// Debug.WriteLine ("ERROR: no child has fixed height and parent height is set to content!");\r
\r
base.UpdateLayout ();\r
}\r
using System.Text.RegularExpressions;\r
using System.Xml.Serialization;\r
using System.ComponentModel;\r
+using OpenTK.Input;\r
\r
namespace go\r
{\r
Alignment _textAlignment = Alignment.LeftCenter; \r
Font _font;\r
bool _multiline = false;\r
+ Color selColor;\r
+ Color selFontColor;\r
+ Point mouseLocalPos; //mouse coord in widget space, filled only when clicked \r
+ int _currentCol; //0 based cursor position in string\r
+ int _currentLine;\r
+ double textCursorPos; //cursor position in cairo units in widget client coord.\r
+ double SelStartCursorPos = -1;\r
+ double SelEndCursorPos = -1;\r
+ bool SelectionInProgress = false;\r
\r
protected Rectangle rText;\r
protected float widthRatio = 1f;\r
protected TextExtents te;\r
#endregion\r
\r
- //public string FontFace = "MagicMedieval";\r
+ [XmlAttributeAttribute()][DefaultValue("SkyBlue")]\r
+ public virtual Color SelectionBackground {\r
+ get { return selColor; }\r
+ set {\r
+ selColor = value;\r
+ registerForGraphicUpdate ();\r
+ }\r
+ }\r
+ [XmlAttributeAttribute()][DefaultValue("Black")]\r
+ public virtual Color SelectionForeground {\r
+ get { return selFontColor; }\r
+ set {\r
+ selFontColor = value;\r
+ registerForGraphicUpdate ();\r
+ }\r
+ }\r
\r
[XmlAttributeAttribute()][DefaultValue(Alignment.LeftCenter)]\r
public Alignment TextAlignment\r
[XmlAttributeAttribute()][DefaultValue("label")]\r
public string Text\r
{\r
- get { return _text; }\r
+ get { \r
+ return lines == null ? \r
+ _text : lines.Aggregate((i, j) => i + GraphicObject.LineBreak + j);\r
+ }\r
set\r
{\r
if (_text == value)\r
return;\r
-\r
- \r
+ \r
registerForGraphicUpdate();\r
InvalidateLayout();\r
\r
_text = value;\r
+\r
+ if (string.IsNullOrEmpty(_text))\r
+ _text = "";\r
+\r
+ lines = getLines;\r
}\r
}\r
[XmlAttributeAttribute()][DefaultValue("droid,10")]\r
registerForGraphicUpdate();\r
}\r
}\r
- \r
- string[] getLines {\r
- get {\r
+ [XmlIgnore]public int currentCol{\r
+ get { return _currentCol; }\r
+ set { \r
+ if (value < 0)\r
+ _currentCol = 0;\r
+ else if (value > lines [_currentLine].Count ())\r
+ _currentCol = lines [_currentLine].Count ();\r
+ else\r
+ _currentCol = value; \r
+ }\r
+ }\r
+ [XmlIgnore]public int currentLine{\r
+ get { return _currentLine; }\r
+ set { \r
+ if (value > lines.Count)\r
+ _currentLine = lines.Count; \r
+ else if (value < 0)\r
+ _currentLine = 0;\r
+ else\r
+ _currentLine = value; \r
+ }\r
+ }\r
+ [XmlIgnore]protected Point selBegin;\r
+ [XmlIgnore]protected Point selRelease;\r
+ [XmlIgnore]protected Point selectionStart //ordered selection start and end positions\r
+ {\r
+ get { \r
+ return selRelease < 0 || selBegin.Y < selRelease.Y ? selBegin : \r
+ selBegin.Y > selRelease.Y ? selRelease :\r
+ selBegin.X < selRelease.X ? selBegin : selRelease;\r
+ }\r
+ }\r
+ [XmlIgnore]public Point selectionEnd\r
+ { \r
+ get { \r
+ return selRelease < 0 || selBegin.Y > selRelease.Y ? selBegin : \r
+ selBegin.Y < selRelease.Y ? selRelease :\r
+ selBegin.X > selRelease.X ? selBegin : selRelease;\r
+ } \r
+ }\r
+ [XmlIgnore]public string selectedText\r
+ { \r
+ get { \r
+ return null; \r
+ //selectionEnd < 0 ? null : \r
+ //Text.Substring(selectionStart, selectionEnd - selectionStart); \r
+ } \r
+ }\r
+ [XmlIgnore]public bool selectionIsEmpty\r
+ { get { return selRelease < 0; } }\r
+\r
+ List<string> lines;\r
+ List<string> getLines {\r
+ get { \r
return _multiline ?\r
- Regex.Split (_text, "\r\n|\r|\n") :\r
- new string[] { _text };\r
+ Regex.Split (_text, "\r\n|\r|\n").ToList() :\r
+ new List<string>(new string[] { _text });\r
}\r
}\r
\r
+ public void DeleteChar()\r
+ {\r
+ if (selectionIsEmpty) { \r
+ if (currentCol == 0) {\r
+ if (currentLine == 0)\r
+ return;\r
+ currentLine--;\r
+ currentCol = lines [currentLine].Count ();\r
+ lines [currentLine] += lines [currentLine + 1];\r
+ lines.RemoveAt (currentLine + 1);\r
+ return;\r
+ }\r
+ currentCol--;\r
+ lines [currentLine] = lines [currentLine].Remove (currentCol, 1);\r
+ } else {\r
+ Debug.WriteLine (selectionEnd.ToString());\r
+ int linesToRemove = selectionEnd.Y - selectionStart.Y;\r
+ int l = selectionStart.Y;\r
+\r
+ if (linesToRemove > 0) {\r
+ lines [l] = lines [l].Remove (selectionStart.X, lines [l].Length - selectionStart.X) +\r
+ lines [selectionEnd.Y].Substring (selectionEnd.X, lines [selectionEnd.Y].Length - selectionEnd.X);\r
+ l++;\r
+ for (int c = 0; c < linesToRemove-1; c++)\r
+ lines.RemoveAt (l); \r
+ } else \r
+ lines [l] = lines [l].Remove (selectionStart.X, selectionEnd.X - selectionStart.X);\r
+ currentCol = selectionStart.X;\r
+ selBegin = -1;\r
+ selRelease = -1;\r
+ }\r
+ }\r
+ /// <summary>\r
+ /// Insert new string at caret position, should be sure no line break is inside.\r
+ /// </summary>\r
+ /// <param name="str">String.</param>\r
+ protected void Insert(string str)\r
+ {\r
+ lines [currentLine] = lines [currentLine].Insert (currentCol, str);\r
+ currentCol += str.Length;\r
+ }\r
+\r
#region GraphicObject overrides\r
[XmlAttributeAttribute()][DefaultValue(-1)]\r
public override int Width {\r
\r
protected override Size measureRawSize()\r
{\r
- Size s;\r
-\r
+ Size size;\r
\r
- if (string.IsNullOrEmpty(_text))\r
- _text = "";\r
- \r
- string[] lines = getLines;\r
+ if (lines == null)\r
+ lines = getLines;\r
\r
using (ImageSurface img = new ImageSurface (Format.Argb32, 10, 10)) {\r
using (Context gr = new Context (img)) {\r
\r
te = new TextExtents();\r
\r
- foreach (string str in lines) {\r
+ foreach (string s in lines) {\r
+ string l = s.Replace("\t", new String (' ', GraphicObject.TabSize));\r
+\r
#if _WIN32 || _WIN64\r
- TextExtents tmp = gr.TextExtents(str.ToUtf8());\r
+ TextExtents tmp = gr.TextExtents(str.ToUtf8());\r
#elif __linux__\r
- TextExtents tmp = gr.TextExtents (str);\r
+ TextExtents tmp = gr.TextExtents (l);\r
#endif\r
if (tmp.XAdvance > te.XAdvance)\r
te = tmp;\r
}\r
fe = gr.FontExtents;\r
- s = new Size ((int)Math.Ceiling (te.XAdvance) + Margin * 2, (int)Math.Ceiling (fe.Height) * lines.Length + Margin*2);\r
+ size = new Size ((int)Math.Ceiling (te.XAdvance) + Margin * 2, (int)(fe.Height * lines.Count) + Margin*2);\r
}\r
}\r
- return s;// +borderWidth;\r
+ return size;// +borderWidth;\r
}\r
protected override void onDraw (Context gr)\r
{\r
base.onDraw (gr);\r
- string[] lines = getLines;\r
\r
gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);\r
gr.SetFontSize (Font.Size);\r
//gr.FontOptions.Antialias = Antialias.Subpixel;\r
//gr.FontOptions.HintMetrics = HintMetrics.On;\r
\r
- rText = new Rectangle(new Point(0, 0),new Size((int)te.Width,(int)fe.Height * lines.Length));\r
+ rText = ClientRectangle;\r
\r
widthRatio = 1f;\r
heightRatio = 1f;\r
}\r
}\r
\r
- gr.Color = Foreground;\r
+ #region draw text cursor\r
+ if (mouseLocalPos > 0)\r
+ {\r
+ computeTextCursor(gr);\r
+\r
+ if (SelectionInProgress)\r
+ {\r
+ selRelease = new Point(currentCol, currentLine);\r
+ SelEndCursorPos = textCursorPos;\r
+ }\r
+ else if (selBegin < 0)\r
+ {\r
+ selBegin = new Point(currentCol, currentLine);\r
+ SelStartCursorPos = textCursorPos;\r
+ selRelease = -1;\r
+ }\r
+ else\r
+ computeTextCursorPosition(gr);\r
+ }\r
+ else\r
+ computeTextCursorPosition(gr);\r
+\r
+ if (HasFocus)\r
+ {\r
+ //TODO:\r
+ gr.Color = Color.White;\r
+ gr.LineWidth = 1.5;\r
+ gr.MoveTo(new PointD(textCursorPos + rText.X, rText.Y + currentLine * fe.Height));\r
+ gr.LineTo(new PointD(textCursorPos + rText.X, rText.Y + (currentLine + 1) * fe.Height));\r
+ gr.Stroke();\r
+ }\r
+ #endregion\r
+ \r
+// gr.Color = Color.Green;\r
+// Rectangle R = new Rectangle(\r
+// rText.X + (int)SelEndCursorPos-10,\r
+// rText.Y + (int)(selRelease.Y * fe.Height), \r
+// 20, \r
+// (int)fe.Height);\r
+// gr.Rectangle(R);\r
+// gr.Fill();\r
+// gr.Color = Color.UnmellowYellow;\r
+// R = new Rectangle(\r
+// rText.X + (int)SelStartCursorPos-10,\r
+// rText.Y + (int)(selBegin.Y * fe.Height), \r
+// 20, \r
+// (int)fe.Height);\r
+// gr.Rectangle(R);\r
+// gr.Fill();\r
\r
gr.FontMatrix = new Matrix(widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0);\r
\r
- for (int i = 0; i < lines.Length; i++) {\r
- gr.MoveTo(rText.X, rText.Y + fe.Ascent + fe.Height * i);\r
+ for (int i = 0; i < lines.Count; i++) { \r
+ string l = lines [i].Replace ("\t", new String (' ', GraphicObject.TabSize));\r
+ if (selRelease >= 0 && i >= selectionStart.Y && i <= selectionEnd.Y) { \r
+ gr.Color = selColor;\r
+ int lineLength = (int)gr.TextExtents (l).XAdvance;\r
+ Rectangle selRect = new Rectangle (\r
+ rText.X,\r
+ rText.Y + (int)(i * fe.Height), \r
+ lineLength, \r
+ (int)fe.Height);\r
+\r
+ int cpStart = (int)SelStartCursorPos,\r
+ cpEnd = (int)SelEndCursorPos;\r
+\r
+ if (selBegin.Y > selRelease.Y) {\r
+ cpStart = cpEnd;\r
+ cpEnd = (int)SelStartCursorPos;\r
+ }\r
+\r
+ if (i == selectionStart.Y) {\r
+ selRect.Width -= cpStart;\r
+ selRect.Left += cpStart;\r
+ }\r
+ if (i == selectionEnd.Y) \r
+ selRect.Width -= (lineLength - cpEnd); \r
+\r
+ gr.Rectangle (selRect);\r
+ gr.Fill ();\r
+ } \r
+\r
+ if (string.IsNullOrWhiteSpace (l))\r
+ continue;\r
+ \r
+ gr.Color = Foreground; \r
+ gr.MoveTo (rText.X, rText.Y + fe.Ascent + fe.Height * i);\r
+\r
#if _WIN32 || _WIN64\r
- gr.ShowText(lines[i].ToUtf8());\r
+ gr.ShowText(l.ToUtf8());\r
#elif __linux__\r
- gr.ShowText(lines[i]);\r
+ gr.ShowText (l);\r
#endif\r
+ gr.Fill ();\r
+\r
} \r
- gr.Fill();\r
}\r
#endregion\r
+\r
+ #region Mouse handling\r
+ public override void onMouseEnter (object sender, MouseMoveEventArgs e)\r
+ {\r
+ // SelectionInProgress = true; \r
+ // mouseLocalPos = e.Position - ScreenCoordBounds.TopLeft - rText.TopLeft;\r
+ // registerForGraphicUpdate();\r
+\r
+ base.onMouseEnter (sender, e);\r
+ }\r
+ public override void onMouseLeave (object sender, MouseMoveEventArgs e)\r
+ {\r
+ base.onMouseLeave (sender, e);\r
+ }\r
+ public override void onMouseMove (object sender, MouseMoveEventArgs e)\r
+ {\r
+ base.onMouseMove (sender, e);\r
+\r
+ if ((sender as OpenTKGameWindow).activeWidget != this)\r
+ return;\r
+\r
+ SelectionInProgress = true;\r
+ mouseLocalPos = e.Position - ScreenCoordinates(ClientRectangle).TopLeft;\r
+ registerForGraphicUpdate();\r
+\r
+ }\r
+ public override void onMouseButtonDown (object sender, MouseButtonEventArgs e)\r
+ {\r
+ if (this.HasFocus){\r
+ mouseLocalPos = e.Position - ScreenCoordinates(ClientRectangle).TopLeft;\r
+ selBegin = -1;\r
+ selRelease = -1;\r
+ }else{\r
+// selBeginPos = 0;\r
+// selReleasePos = new Point(lines[lines.Count].Length-1, lines.Count-1);\r
+ } \r
+\r
+ //done at the end to set 'hasFocus' value after testing it\r
+ base.onMouseButtonDown (sender, e);\r
+\r
+ registerForGraphicUpdate();\r
+ }\r
+ public override void onMouseButtonUp (object sender, MouseButtonEventArgs e)\r
+ {\r
+ base.onMouseButtonUp (sender, e);\r
+ SelectionInProgress = false;\r
+ }\r
+ #endregion\r
+\r
+\r
+ void computeTextCursor(Context gr)\r
+ {\r
+ //FontExtents fe = gr.FontExtents;\r
+ TextExtents te;\r
+\r
+ double cPos = 0f;\r
+\r
+ currentLine = (int)(mouseLocalPos.Y / fe.Height);\r
+\r
+ for (int i = 0; i < lines[currentLine].Length; i++)\r
+ {\r
+ string c = lines [currentLine].Substring (i, 1);\r
+ if (c == "\t")\r
+ c = new string (' ', GraphicObject.TabSize);\r
+ \r
+ #if _WIN32 || _WIN64\r
+ byte[] c = System.Text.UTF8Encoding.UTF8.GetBytes(Text.Substring(i, 1));\r
+ te = gr.TextExtents(c);\r
+ #elif __linux__\r
+ te = gr.TextExtents(c);\r
+ #endif\r
+ double halfWidth = te.XAdvance / 2;\r
+\r
+ if (mouseLocalPos.X <= cPos + halfWidth)\r
+ {\r
+ currentCol = i;\r
+ textCursorPos = cPos;\r
+ mouseLocalPos = -1;\r
+ return;\r
+ }\r
+\r
+ cPos += te.XAdvance;\r
+ }\r
+ currentCol = lines[currentLine].Length;\r
+ textCursorPos = cPos;\r
+\r
+ //reset mouseLocalPos\r
+ mouseLocalPos = -1;\r
+ }\r
+ void computeTextCursorPosition(Context gr)\r
+ { \r
+ TextExtents te;\r
+\r
+ double cPos = 0f;\r
+\r
+ int limit = currentCol;\r
+\r
+ if (selectionEnd > 0)\r
+ limit = Math.Max(currentCol, selectionEnd.X);\r
+\r
+ for (int i = 0; i <= limit; i++)\r
+ {\r
+ if (i == currentCol)\r
+ textCursorPos = cPos;\r
+ if (i == selectionStart.X)\r
+ SelStartCursorPos = cPos;\r
+ if (i == selectionEnd.X)\r
+ SelEndCursorPos = cPos;\r
+\r
+ if (i < lines[currentLine].Length)\r
+ {\r
+ string c = lines [currentLine].Substring (i, 1);\r
+ if (c == "\t")\r
+ c = new string (' ', GraphicObject.TabSize);\r
+ #if _WIN32 || _WIN64\r
+ byte[] c = System.Text.UTF8Encoding.UTF8.GetBytes(Text.Substring(i, 1));\r
+ te = gr.TextExtents(c);\r
+ #elif __linux__\r
+ te = gr.TextExtents(c);\r
+ #endif\r
+ cPos += te.XAdvance;\r
+ }\r
+ }\r
+\r
+ } \r
}\r
}\r
\r
#region Mouse handling\r
public override bool MouseIsIn (Point m)\r
- {\r
- //Debug.WriteLine ("scroller mouse is in");\r
+ { \r
return Visible ? base.ScreenCoordinates(Slot).ContainsOrIsEqual (m) : false; \r
}\r
public override void onMouseMove (object sender, MouseMoveEventArgs e)\r
\r
if (VerticalScrolling )\r
{\r
- Debug.WriteLine ("scroll");\r
//add redraw call with old bounds to errase old position\r
registerForRedraw();\r
\r
using System.Xml.Serialization;\r
using System.Globalization;\r
using System.ComponentModel;\r
+using System.Runtime.InteropServices;\r
\r
namespace go\r
{\r
set { _capitalOn = value; }\r
}\r
\r
- #region private fields\r
- Color selColor;\r
- Color selFontColor;\r
- Point mouseLocalPos; //mouse coord in widget space, filled only when clicked \r
- int _currentPos; //0 based cursor position in string\r
- double textCursorPos; //cursor position in cairo units in widget client coord.\r
- double SelStartCursorPos = -1;\r
- double SelEndCursorPos = -1;\r
- bool SelectionInProgress = false;\r
- #endregion\r
-\r
- [XmlAttributeAttribute()][DefaultValue("SkyBlue")]\r
- public virtual Color SelectionBackground {\r
- get { return selColor; }\r
- set {\r
- selColor = value;\r
- registerForGraphicUpdate ();\r
- }\r
- }\r
- [XmlAttributeAttribute()][DefaultValue("Black")]\r
- public virtual Color SelectionForeground {\r
- get { return selFontColor; }\r
- set {\r
- selFontColor = value;\r
- registerForGraphicUpdate ();\r
- }\r
- }\r
\r
#region GraphicObject overrides\r
[XmlIgnore]public override bool HasFocus //trigger update when lost focus to errase text beam\r
set { base.Focusable = value; }\r
}\r
[XmlAttributeAttribute()][DefaultValue("White")]\r
- public virtual Color Background {\r
+ public override Color Background {\r
get { return base.Background; }\r
set { base.Background = value; }\r
}\r
[XmlAttributeAttribute()][DefaultValue("Black")]\r
- public virtual Color Foreground {\r
+ public override Color Foreground {\r
get { return base.Foreground; }\r
set { base.Foreground = value; }\r
}\r
base.onDraw (gr);\r
// gr.FontOptions.Antialias = Antialias.Subpixel;\r
// gr.FontOptions.HintMetrics = HintMetrics.On;\r
- gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);\r
- gr.SetFontSize (Font.Size);\r
+// gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);\r
+// gr.SetFontSize (Font.Size);\r
\r
FontExtents fe = gr.FontExtents;\r
\r
- #region draw text cursor\r
- if (mouseLocalPos > 0)\r
- {\r
- computeTextCursor(gr);\r
-\r
- if (SelectionInProgress)\r
- {\r
- selReleasePos = currentPos;\r
- SelEndCursorPos = textCursorPos;\r
- }\r
- else if (selBeginPos < 0)\r
- {\r
- selBeginPos = currentPos;\r
- SelStartCursorPos = textCursorPos;\r
- selReleasePos = -1;\r
- }\r
- else\r
- computeTextCursorPosition(gr);\r
-\r
- }\r
- else\r
- computeTextCursorPosition(gr);\r
-\r
- if (HasFocus)\r
- {\r
- //TODO:\r
- gr.Color = Foreground;\r
- gr.LineWidth = 2;\r
- gr.MoveTo(new PointD(textCursorPos + rText.X, rText.Y ));\r
- gr.LineTo(new PointD(textCursorPos + rText.X, rText.Y + fe.Height));\r
- gr.Stroke();\r
- }\r
-\r
- #endregion\r
-\r
- if (selReleasePos >= 0)\r
- {\r
- gr.Color = selColor;\r
- Rectangle selRect =\r
- new Rectangle((int)SelStartCursorPos + rText.X, (int)(rText.Y), (int)(SelEndCursorPos - SelStartCursorPos), (int)fe.Height);\r
- gr.Rectangle(selRect);\r
- gr.Fill();\r
\r
- gr.Color = selFontColor;\r
- }\r
- else\r
- gr.Color = Foreground;\r
\r
- gr.MoveTo(rText.X, rText.Y + fe.Ascent);\r
- #if _WIN32 || _WIN64\r
- gr.ShowText(txt);\r
- #elif __linux__\r
- gr.ShowText(Text);\r
- #endif\r
- gr.Fill();\r
+// gr.MoveTo(rText.X, rText.Y + fe.Ascent);\r
+// #if _WIN32 || _WIN64\r
+// gr.ShowText(txt);\r
+// #elif __linux__\r
+// gr.ShowText(Text);\r
+// #endif\r
+// gr.Fill();\r
\r
}\r
#endregion\r
{\r
TextChanged (this, e);\r
}\r
-\r
-\r
- [XmlIgnore]public int currentPos{\r
- get { return _currentPos; }\r
- set { _currentPos = value; }\r
- }\r
- [XmlIgnore]public int selBeginPos;\r
- [XmlIgnore]public int selReleasePos;\r
- [XmlIgnore]public int selectionStart //ordered selection start and end positions\r
- {\r
- get { return selReleasePos < 0 ? selBeginPos : Math.Min(selBeginPos, selReleasePos); }\r
- }\r
- [XmlIgnore]public int selectionEnd\r
- { get { return selReleasePos < 0 ? selReleasePos : Math.Max(selBeginPos, selReleasePos); } }\r
- [XmlIgnore]public string selectedText\r
- { get { return selectionEnd < 0 ? null : Text.Substring(selectionStart, selectionEnd - selectionStart); } }\r
- [XmlIgnore]public bool selectionIsEmpty\r
- { get { return string.IsNullOrEmpty(selectedText); } }\r
-\r
-\r
\r
#region Keyboard handling\r
public override void onKeyDown (object sender, KeyboardKeyEventArgs e)\r
case Key.Back:\r
if (!selectionIsEmpty)\r
{\r
- Text = Text.Remove(selectionStart, selectionEnd - selectionStart);\r
- selReleasePos = -1;\r
- currentPos = selBeginPos;\r
- }\r
- else if (currentPos > 0)\r
- {\r
- currentPos--;\r
- Text = Text.Remove(currentPos, 1);\r
+// Text = Text.Remove(selectionStart, selectionEnd - selectionStart);\r
+// selReleasePos = -1;\r
+// currentCol = selBeginPos;\r
}\r
+ else \r
+ this.DeleteChar();\r
break;\r
case Key.Clear:\r
break;\r
case Key.Delete:\r
- if (!selectionIsEmpty)\r
- {\r
- Text = Text.Remove(selectionStart, selectionEnd - selectionStart);\r
- selReleasePos = -1;\r
- currentPos = selBeginPos;\r
- }\r
- else if (currentPos < Text.Length)\r
- Text = Text.Remove(currentPos, 1);\r
- break;\r
- case Key.Down:\r
- break;\r
- case Key.End:\r
- currentPos = Text.Length;\r
+ if (selectionIsEmpty)\r
+ currentCol++;\r
+ this.DeleteChar ();\r
break;\r
case Key.Enter:\r
case Key.KeypadEnter:\r
break;\r
case Key.Escape:\r
Text = "";\r
- currentPos = 0;\r
- selReleasePos = -1;\r
+ currentCol = 0;\r
+ selRelease = -1;\r
break;\r
case Key.Home:\r
- currentPos = 0;\r
+ //TODO\r
+ if (e.Control)\r
+ currentLine = 0;\r
+ currentCol = 0;\r
+ break;\r
+ case Key.End:\r
+ if (e.Control)\r
+ currentLine = int.MaxValue;\r
+ currentCol = int.MaxValue;\r
break;\r
case Key.Insert:\r
break;\r
- case Key.Left:\r
- if (currentPos > 0)\r
- currentPos--;\r
+ case Key.Left: \r
+ currentCol--;\r
+ break;\r
+ case Key.Right: \r
+ currentCol++;\r
+ break;\r
+ case Key.Up:\r
+ currentLine--;\r
+ break;\r
+ case Key.Down:\r
+ currentLine++;\r
break;\r
case Key.Menu:\r
break;\r
break;\r
case Key.RWin:\r
break;\r
- case Key.Right:\r
- if (currentPos < Text.Length)\r
- currentPos++;\r
- break;\r
case Key.Tab:\r
- Text = Text.Insert(currentPos, "\t");\r
- currentPos++;\r
- break;\r
- case Key.Up:\r
+ this.Insert("\t");\r
break;\r
case Key.KeypadDecimal:\r
- Text = Text.Insert(currentPos, new string(new char[] \r
- { Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator) }));\r
- currentPos++;\r
+ this.Insert ("."); \r
break;\r
case Key.Space:\r
- Text = Text.Insert(currentPos, " ");\r
- currentPos++;\r
+ this.Insert(" ");\r
break;\r
case Key.KeypadDivide:\r
case Key.Slash:\r
- Text = Text.Insert(currentPos, "/");\r
- currentPos++;\r
+ this.Insert("/");\r
break;\r
case Key.KeypadMultiply:\r
- Text = Text.Insert(currentPos, "*");\r
- currentPos++;\r
+ this.Insert("*");\r
break;\r
case Key.KeypadMinus:\r
case Key.Minus:\r
- Text = Text.Insert(currentPos, "-");\r
- currentPos++;\r
+ this.Insert("-");\r
break;\r
case Key.KeypadPlus:\r
case Key.Plus:\r
- Text = Text.Insert(currentPos, "+");\r
- currentPos++;\r
+ this.Insert("+");\r
+ break;\r
+ case Key.ShiftLeft:\r
+ case Key.ShiftRight:\r
+ case Key.AltLeft:\r
+ case Key.AltRight:\r
+ break;\r
+ case Key.Semicolon:\r
+ this.Insert(";");\r
break;\r
default:\r
if (!selectionIsEmpty)\r
{\r
- Text = Text.Remove(selectionStart, selectionEnd - selectionStart);\r
- currentPos = selBeginPos;\r
+// Text = Text.Remove(selectionStart, selectionEnd - selectionStart);\r
+// currentCol = selBeginPos;\r
}\r
\r
string k = "?";\r
k = ((int)key - 67).ToString();\r
else if ((char)key >= 109 && (char)key <= 118)\r
k = ((int)key - 109).ToString();\r
- else if (capitalOn)\r
+ else if (e.Shift)\r
k = key.ToString();\r
else\r
k = key.ToString().ToLower();\r
\r
- Text = Text.Insert(currentPos, k);\r
- currentPos++;\r
+ this.Insert (k);\r
\r
- selReleasePos = -1;\r
- selBeginPos = currentPos;\r
+ selRelease = -1;\r
+ selBegin.X = currentCol;\r
\r
break;\r
}\r
registerForGraphicUpdate();\r
}\r
#endregion\r
-\r
- #region Mouse handling\r
- public override void onMouseEnter (object sender, MouseMoveEventArgs e)\r
- {\r
-// SelectionInProgress = true; \r
-// mouseLocalPos = e.Position - ScreenCoordBounds.TopLeft - rText.TopLeft;\r
-// registerForGraphicUpdate();\r
-\r
- base.onMouseEnter (sender, e);\r
- }\r
- public override void onMouseLeave (object sender, MouseMoveEventArgs e)\r
- {\r
- base.onMouseLeave (sender, e);\r
- }\r
- public override void onMouseMove (object sender, MouseMoveEventArgs e)\r
- {\r
- base.onMouseMove (sender, e);\r
-\r
- if ((sender as OpenTKGameWindow).activeWidget != this)\r
- return;\r
-\r
- SelectionInProgress = true;\r
- mouseLocalPos = e.Position - ScreenCoordinates(rText).TopLeft;\r
- registerForGraphicUpdate();\r
- \r
- }\r
- public override void onMouseButtonDown (object sender, MouseButtonEventArgs e)\r
- {\r
- if (this.HasFocus){\r
- mouseLocalPos = e.Position - ScreenCoordinates(rText).TopLeft - rText.TopLeft;\r
- selBeginPos = -1;\r
- selReleasePos = -1;\r
- }else{\r
- selBeginPos = 0;\r
- selReleasePos = Text.Length;\r
- } \r
-\r
- //done at the end to set 'hasFocus' value after testing it\r
- base.onMouseButtonDown (sender, e);\r
-\r
- registerForGraphicUpdate();\r
- }\r
- public override void onMouseButtonUp (object sender, MouseButtonEventArgs e)\r
- {\r
- base.onMouseButtonUp (sender, e);\r
- SelectionInProgress = false;\r
- }\r
- #endregion\r
-\r
- void computeTextCursor(Context gr)\r
- {\r
- FontExtents fe = gr.FontExtents;\r
- TextExtents te;\r
-\r
- double cPos = 0f;\r
- for (int i = 0; i < _text.Length; i++)\r
- {\r
-#if _WIN32 || _WIN64\r
- byte[] c = System.Text.UTF8Encoding.UTF8.GetBytes(Text.Substring(i, 1));\r
- te = gr.TextExtents(c);\r
-#elif __linux__\r
- te = gr.TextExtents(Text.Substring(i, 1));\r
-#endif\r
- double halfWidth = te.XAdvance / 2;\r
-\r
- if (mouseLocalPos.X <= cPos + halfWidth)\r
- {\r
- currentPos = i;\r
- textCursorPos = cPos;\r
- mouseLocalPos = -1;\r
- return;\r
- }\r
-\r
- cPos += te.XAdvance;\r
- }\r
- currentPos = _text.Length;\r
- textCursorPos = cPos;\r
-\r
- //reset mouseLocalPos\r
- mouseLocalPos = -1;\r
- }\r
- void computeTextCursorPosition(Context gr)\r
- {\r
- FontExtents fe = gr.FontExtents;\r
- TextExtents te;\r
-\r
- double cPos = 0f;\r
-\r
- int limit = currentPos;\r
-\r
- if (selectionEnd > 0)\r
- limit = Math.Max(currentPos, selectionEnd);\r
-\r
- for (int i = 0; i <= limit; i++)\r
- {\r
- if (i == currentPos)\r
- textCursorPos = cPos;\r
- if (i == selectionStart)\r
- SelStartCursorPos = cPos;\r
- if (i == selectionEnd)\r
- SelEndCursorPos = cPos;\r
-\r
- if (i < Text.Length)\r
- {\r
-#if _WIN32 || _WIN64\r
- byte[] c = System.Text.UTF8Encoding.UTF8.GetBytes(Text.Substring(i, 1));\r
- te = gr.TextExtents(c);\r
-#elif __linux__\r
- te = gr.TextExtents(Text.Substring(i,1));\r
-#endif\r
- cPos += te.XAdvance;\r
- }\r
- }\r
-\r
- } \r
} \r
}\r