]> O.S.I.I.S - jp/crowedit.git/commitdiff
simple editor with TextBox control
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 15 Feb 2021 13:55:01 +0000 (14:55 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 15 Feb 2021 13:55:01 +0000 (14:55 +0100)
Crow.Coding/Crow.Coding.csproj
CrowEdit.csproj
CrowEdit.sln
OpenTK.dll.config [deleted file]
clean.sh [new file with mode: 0644]
packages.config [deleted file]
src/CrowEdit.cs
src/Extensions.cs [new file with mode: 0644]
ui/EditorOptions.crow
ui/main.crow

index 5057a88abedf00803f492d3a6fe65d2b7f0a9528..11bb5deda8df68386941ea2c439891686eba5d66 100644 (file)
                <Compile Include="Properties\AssemblyInfo.cs" />
        </ItemGroup>
        <ItemGroup>
-<!--     <PackageReference Include="Crow" Version="0.9.0-beta" />-->
+         <PackageReference Include="Crow" Version="0.9.3-beta" />
        </ItemGroup>
-       <ItemGroup>
-         <ProjectReference Include="..\..\crow\Crow\Crow.csproj" />
-       </ItemGroup>
-
 </Project>
\ No newline at end of file
index 5f3d623ad6f645a26d83c36e55f1d229841c1a01..afab4451af38ea83863b970d4698a70df762649a 100644 (file)
@@ -1,21 +1,22 @@
 <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
-               <TargetFramework>netcoreapp3.1</TargetFramework>                
+               <TargetFramework>netcoreapp3.1</TargetFramework>
                <OutputType>WinExe</OutputType>
                <EnableDefaultItems>false</EnableDefaultItems>
-               
+
        </PropertyGroup>
-       
+
        <ItemGroup>
                <Compile Include="src\**\*.cs" />
                <EmbeddedResource Include="ui\**\*.*" />
        </ItemGroup>
        <ItemGroup>
-         <ProjectReference Include="Crow.Coding\Crow.Coding.csproj" />
-         <ProjectReference Include="..\crow\Crow\Crow.csproj" />
+               <ProjectReference Include="Crow.Coding\Crow.Coding.csproj" />
+               <PackageReference Include="Crow" Version="0.9.4-beta" />
        </ItemGroup>
-       
+
+
        <ItemGroup>
-         <Compile Remove="Properties\AssemblyInfo.cs" />
+               <Compile Remove="Properties\AssemblyInfo.cs" />
        </ItemGroup>
 </Project>
\ No newline at end of file
index 2c7ab7705fa3c5302eb4a85b6da81cae11672263..7c1fa371cad2fc4c58bd7b4bbb661bf567fe8ea2 100644 (file)
@@ -1,29 +1,37 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowEdit", "CrowEdit.csproj", "{AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}"
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30711.63
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CrowEdit", "CrowEdit.csproj", "{AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow.Coding", "Crow.Coding\Crow.Coding.csproj", "{78842EE4-8A2F-4C75-AEC6-C95F15AD3994}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crow.Coding", "Crow.Coding\Crow.Coding.csproj", "{78842EE4-8A2F-4C75-AEC6-C95F15AD3994}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow", "..\crow\Crow\Crow.csproj", "{0D18388D-8DDB-43DE-A608-0C65F0AEC4E0}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Global", "Global", "{3118E6C1-2180-4364-9A17-511D546E18CD}"
+       ProjectSection(SolutionItems) = preProject
+               Directory.Build.props = Directory.Build.props
+               README.md = README.md
+       EndProjectSection
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
-               Release|Any CPU = Release|Any CPU
                Debug|Any CPU = Debug|Any CPU
+               Release|Any CPU = Release|Any CPU
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Release|Any CPU.Build.0 = Release|Any CPU
                {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Release|Any CPU.Build.0 = Release|Any CPU
-               {0D18388D-8DDB-43DE-A608-0C65F0AEC4E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {0D18388D-8DDB-43DE-A608-0C65F0AEC4E0}.Release|Any CPU.Build.0 = Release|Any CPU
-               {0D18388D-8DDB-43DE-A608-0C65F0AEC4E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {0D18388D-8DDB-43DE-A608-0C65F0AEC4E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Release|Any CPU.Build.0 = Release|Any CPU
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+       GlobalSection(ExtensibilityGlobals) = postSolution
+               SolutionGuid = {121E26CF-4A0F-4E74-BC0F-82BABEFDE8BF}
        EndGlobalSection
 EndGlobal
diff --git a/OpenTK.dll.config b/OpenTK.dll.config
deleted file mode 100644 (file)
index 7098d39..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<configuration>
-  <dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
-  <dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
-  <dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
-  <dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
-  <dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
-  <dllmap os="linux" dll="libX11" target="libX11.so.6"/>
-  <dllmap os="linux" dll="libXi" target="libXi.so.6"/>
-  <dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/>
-  <dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
-  <dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
-  <dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
-  <dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
-  <dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
-  <dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
-  <dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
-  <dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
-  <!-- XQuartz compatibility (X11 on Mac) -->
-  <dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
-  <dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
-  <dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
-  <dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
-  <dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
-  <dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
-</configuration>
diff --git a/clean.sh b/clean.sh
new file mode 100644 (file)
index 0000000..08b3c61
--- /dev/null
+++ b/clean.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+rm -fr build && find . -iname bin -o -iname obj -o -iname packages -o -iname build | xargs rm -rf
diff --git a/packages.config b/packages.config
deleted file mode 100644 (file)
index 26caf83..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="Crow.OpenTK" version="0.6.0" targetFramework="net45" />
-  <package id="OpenTK" version="2.0.0" targetFramework="net45" />
-</packages>
\ No newline at end of file
index 970aa4bac94f6bf8c8d43e7fd2853b3e769065ea..734b6474a33db553c0f0d59535b03ce1e23ed7d9 100644 (file)
@@ -6,6 +6,7 @@ using System;
 using Crow;
 using System.IO;
 using System.Collections.Generic;
+using Crow.Text;
 
 namespace CrowEdit
 {
@@ -15,30 +16,59 @@ namespace CrowEdit
                        CMDUndo, CMDRedo, CMDCut, CMDCopy, CMDPaste, CMDHelp, CMDAbout, CMDOptions;
 
                const string _defaultFileName = "unnamed.txt";
-               string _text = "", _origText="";
-               bool isDirty = false;
-               public new bool IsDirty { get { return _text != _origText; } }
-
-               List<string> undoStack = new List<string>();
-               List<string> redoStack = new List<string>();
-
-               public string Text {
-                       get { return _text; }
+               string source = "";
+               int dirtyUndoLevel;//
+               public new bool IsDirty { get { return undoStack.Count != dirtyUndoLevel; } }
+               public string Source {
+                       get => source;
                        set {
-                               if (_text == value)
+                               if (source == value)
                                        return;
-                               undoStack.Add (_text);
+                               source = value;
+                               NotifyValueChanged (source);
+                       }
+               }
+               public CommandGroup EditorCommands => new CommandGroup (CMDUndo, CMDRedo, CMDCut, CMDCopy, CMDPaste, CMDSave, CMDSaveAs);
+
+               Stack<TextChange> undoStack = new Stack<TextChange> ();
+               Stack<TextChange> redoStack = new Stack<TextChange> ();
+               
+               void undo () {
+                       if (undoStack.TryPop (out TextChange tch)) {
+                               redoStack.Push (tch.Inverse (source));
+                               CMDRedo.CanExecute = true;
+                               apply (tch);
+                               editor.SetCursorPosition (tch.End + tch.ChangedText.Length);
+                       }
+                       if (undoStack.Count == 0)
+                               CMDUndo.CanExecute = false;
+               }
+               void redo () {
+                       if (redoStack.TryPop (out TextChange tch)) {
+                               undoStack.Push (tch.Inverse (source));
                                CMDUndo.CanExecute = true;
-                               redoStack.Clear ();
-                               CMDRedo.CanExecute = false;
-                               _text = value;
-                               NotifyValueChanged (_text);
-                               NotifyValueChanged ("IsDirty", IsDirty);
+                               apply (tch);
+                               editor.SetCursorPosition (tch.End + tch.ChangedText.Length);
                        }
+                       if (redoStack.Count == 0)
+                               CMDRedo.CanExecute = false;
+               }
+               bool disableTextChangedEvent = false;
+               void apply (TextChange change) {
+                       Span<char> tmp = stackalloc char[source.Length + (change.ChangedText.Length - change.Length)];
+                       ReadOnlySpan<char> src = source.AsSpan ();
+                       src.Slice (0, change.Start).CopyTo (tmp);
+                       if (!string.IsNullOrEmpty(change.ChangedText))
+                               change.ChangedText.AsSpan ().CopyTo (tmp.Slice (change.Start));
+                       src.Slice (change.End).CopyTo (tmp.Slice (change.Start + change.ChangedText.Length));
+                       disableTextChangedEvent = true;
+                       Source = tmp.ToString ();
+                       disableTextChangedEvent = false;
+                       NotifyValueChanged ("IsDirty", IsDirty);
                }
 
                public string CurrentDir {
-                       get { return Configuration.Global.Get<string>("CurrentDir"); }
+                       get => Configuration.Global.Get<string>("CurrentDir");
                        set {
                                if (CurrentDir == value)
                                        return;
@@ -47,13 +77,12 @@ namespace CrowEdit
                        }
                }
                public string CurrentFilePath {
-                       get { return Configuration.Global.Get<string> ("CurrentFilePath"); }
+                       get => Configuration.Global.Get<string> ("CurrentFilePath");
                        set {
                                if (CurrentFilePath == value)
                                        return;
                                Configuration.Global.Set ("CurrentFilePath", value);
                                NotifyValueChanged (CurrentFilePath);
-
                        }
                }
                public string CurFileName {
@@ -62,9 +91,8 @@ namespace CrowEdit
                public string CurFileDir {
                        get => string.IsNullOrEmpty (CurrentFilePath) ? CurrentDir : Path.GetDirectoryName (CurrentFilePath);
                }
-
                public bool ShowLeftPane {
-                       get { return Configuration.Global.Get<bool> ("ShowLeftPane"); }
+                       get => Configuration.Global.Get<bool> ("ShowLeftPane");
                        set {
                                if (ShowLeftPane == value)
                                        return;
@@ -72,8 +100,17 @@ namespace CrowEdit
                                NotifyValueChanged (ShowLeftPane);
                        }
                }
+               public bool ReopenLastFile {
+                       get => Configuration.Global.Get<bool> ("ReopenLastFile");
+                       set {
+                               if (ReopenLastFile == value)
+                                       return;
+                               Configuration.Global.Set ("ReopenLastFile", value);
+                               NotifyValueChanged (ReopenLastFile);
+                       }
+               }
 
-               void initCommands(){
+               void initCommands (){
                        CMDNew = new Command(new Action(() => onNewFile())) { Caption = "New", Icon = new SvgPicture("#CrowEdit.ui.icons.blank-file.svg")};
                        CMDOpen = new Command(new Action(() => openFileDialog())) { Caption = "Open...", Icon = new SvgPicture("#CrowEdit.ui.icons.outbox.svg")};
                        CMDSave = new Command(new Action(() => saveFileDialog())) { Caption = "Save", Icon = new SvgPicture("#CrowEdit.ui.icons.inbox.svg"), CanExecute = false};
@@ -94,43 +131,10 @@ namespace CrowEdit
                                mb.Yes += (sender, e) => newFile();
                        } else
                                newFile ();
-               }
-               void undo(){
-                       string step = undoStack [undoStack.Count -1];
-                       redoStack.Add (_text);
-                       CMDRedo.CanExecute = true;
-                       undoStack.RemoveAt(undoStack.Count -1);
-
-                       _text = step;
-
-                       NotifyValueChanged ("Text", (object)_text);
-                       NotifyValueChanged ("IsDirty", IsDirty);
-
-                       if (undoStack.Count == 0)
-                               CMDUndo.CanExecute = false;
-               }
-               void redo(){
-                       string step = redoStack [redoStack.Count -1];
-                       undoStack.Add (_text);
-                       CMDUndo.CanExecute = true;
-                       redoStack.RemoveAt(redoStack.Count -1);
-                       _text = step;
-                       NotifyValueChanged ("Text", (object)_text);
-                       NotifyValueChanged ("IsDirty", IsDirty);
-
-                       if (redoStack.Count == 0)
-                               CMDRedo.CanExecute = false;
-               }
-               void openOptionsDialog(){
-                       Widget ed = this.FindByName("editor");
-                       Load ("#CrowEdit.ui.EditorOptions.crow").DataSource = ed;
-               }
-               void openFileDialog(){
-                       Load ("#CrowEdit.ui.openFile.crow").DataSource = this;
-               }
-               void saveFileDialog(){
-                       Load ("#CrowEdit.ui.saveFile.crow").DataSource = this;
-               }
+               }               
+               void openOptionsDialog() =>     Load ("#CrowEdit.ui.EditorOptions.crow").DataSource = this;
+               void openFileDialog() => Load ("#CrowEdit.ui.openFile.crow").DataSource = this;
+               void saveFileDialog() => Load ("#CrowEdit.ui.saveFile.crow").DataSource = this;
                void openFileDialog_OkClicked (object sender, EventArgs e)
                {
                        FileDialog fd = sender as FileDialog;
@@ -141,22 +145,19 @@ namespace CrowEdit
                void saveFileDialog_OkClicked (object sender, EventArgs e)
                {
                        FileDialog fd = sender as FileDialog;
-
                        if (string.IsNullOrEmpty (fd.SelectedFile))
-                               return;
-                       CurrentFilePath = Path.Combine (fd.SelectedDirectory, fd.SelectedFile);
-
-//                     using (StreamWriter sr = new StreamWriter (fd.SelectedFile)) {
-//                             sr.Write(_text);
-//                     }
-                       _origText = _text;
-
-                       NotifyValueChanged ("IsDirty", false);
-               }
+                               return;                 
+                       save (fd.SelectedFile, fd.SelectedDirectory);
+               }               
                void onTextChanged (object sender, TextChangeEventArgs e)
                {
-                       //System.Diagnostics.Debug.WriteLine ("text changed");
-                       NotifyValueChanged ("IsDirty", IsDirty);
+                       if (disableTextChangedEvent)
+                               return;
+                       undoStack.Push (e.Change.Inverse(source));
+                       redoStack.Clear ();
+                       CMDUndo.CanExecute = true;
+                       CMDRedo.CanExecute = false;
+                       apply (e.Change);
                }
 
                void goUpDirClick (object sender, MouseButtonEventArgs e) {
@@ -185,90 +186,74 @@ namespace CrowEdit
                }
                void newFile () {
                        CurrentFilePath = Path.Combine (CurFileDir, _defaultFileName);
-                       _origText = _text = "";
-                       NotifyValueChanged ("Text", (object)_text);
-                       NotifyValueChanged ("IsDirty", false);
-                       redoStack.Clear ();
-                       undoStack.Clear ();
-                       CMDRedo.CanExecute = false;
-                       CMDUndo.CanExecute = false;
+                       disableTextChangedEvent = true;
+                       Source = "";
+                       disableTextChangedEvent = false;
+                       resetUndoRedo ();
                }
                void openFile (string filePath, string directory) {
                        CurrentFilePath = Path.Combine(directory, filePath);
-                       //reloadFromFile ();
-                       
-                       redoStack.Clear ();
-                       undoStack.Clear ();
-                       CMDRedo.CanExecute = false;
-                       CMDUndo.CanExecute = false;
+                       reloadFromFile ();
+                       resetUndoRedo ();
                }
-               /***temp***/
-               string source;
-               public string Source {
-                       get => source;
-                       set {
-                               if (source == value)
-                                       return;
-                               source = value;
-                               NotifyValueChanged (source);
+               void save (string filePath, string directory) {
+                       CurrentFilePath = Path.Combine (directory, filePath);
+                       using (StreamWriter sr = new StreamWriter (CurrentFilePath)) {
+                               sr.Write (source);
                        }
+                       dirtyUndoLevel = undoStack.Count;
+
+                       NotifyValueChanged ("IsDirty", IsDirty);
                }
+
                void reloadFromFile () {
+                       disableTextChangedEvent = true;
                        if (File.Exists (CurrentFilePath)) {
                                using (Stream s = new FileStream (CurrentFilePath, FileMode.Open)) {
                                        using (StreamReader sr = new StreamReader (s))
                                                Source = sr.ReadToEnd ();
                                }
                        }
+                       disableTextChangedEvent = false;
+                       resetUndoRedo ();
                }
-               /********************************/
-               [STAThread]
+               void resetUndoRedo () {
+                       undoStack.Clear ();
+                       redoStack.Clear ();
+                       CMDUndo.CanExecute = false;
+                       CMDRedo.CanExecute = false;
+                       dirtyUndoLevel = 0;
+               }                               
                static void Main ()
                {
                        using (CrowEdit win = new CrowEdit ()) 
                                win.Run ();
                }
-               public CrowEdit ()
-                       : base(800, 600)
-               {}
+               public CrowEdit () : base(800, 600)     {}
 
                protected override void OnInitialized () {
                        base.OnInitialized ();
 
                        if (CurrentDir == null)
                                CurrentDir = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
-
-                       this.ValueChanged += CrowEdit_ValueChanged;
+                       
                        initCommands ();
                        Load ("#CrowEdit.ui.main.crow").DataSource = this;
-               }
+                       editor = FindByName ("tb") as TextBox;
 
-               /*void textView_KeyDown (object sender, Crow.KeyEventArgs e)
-               {
-                       if (e.Control) {
-                               if (e.Key == Key.W) {
-                                       if (e.Shift)
-                                               CMDRedo.Execute ();
-                                       else
-                                               CMDUndo.Execute ();
-                               }
-                       }
-               }*/
+                       if (ReopenLastFile)
+                               reloadFromFile ();
+               }
+               TextBox editor;
+               void textView_KeyDown (object sender, Crow.KeyEventArgs e) {
+                       if (Ctrl && e.Key == Glfw.Key.W) {
+                               if (Shift)
+                                       CMDRedo.Execute ();
+                               else
+                                       CMDUndo.Execute ();
 
-               void CrowEdit_ValueChanged (object sender, ValueChangeEventArgs e)
-               {
-                       if (e.MemberName == "IsDirty" && isDirty != (bool)e.NewValue) {
-                               isDirty = (bool)e.NewValue;
-                               if (isDirty) {
-                                       CMDSave.CanExecute = true;
-                                       CMDSaveAs.CanExecute = true;
-                               }else{
-                                       CMDSave.CanExecute = false;
-                                       CMDSaveAs.CanExecute = false;
-                               }
                        }
                }
-
        }
 }
 
diff --git a/src/Extensions.cs b/src/Extensions.cs
new file mode 100644 (file)
index 0000000..6cd0e85
--- /dev/null
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Crow.Text;
+
+namespace CrowEdit
+{
+    public static class Extensions
+    {
+        public static TextChange Inverse (this TextChange tch, string src)
+            => new TextChange (tch.Start, string.IsNullOrEmpty (tch.ChangedText) ? 0 : tch.ChangedText.Length,
+                tch.Length == 0 ? "" : src.AsSpan (tch.Start, tch.Length).ToString());
+    }
+}
index 81e529bb73a0072144dce26b8fc62c586e0a29ac..96869c9f2d29f1e8f2aeeba22efa6dfa59b2986f 100644 (file)
@@ -2,5 +2,6 @@
 <Window AlwaysOnTop="true" Caption="Editor Options" Width="60%" Height="80%" Background="Jet">
        <VerticalStack>
                <CheckBox Caption="Print line number" IsChecked="{²PrintLineNumbers}"/>
+               <CheckBox Caption="Reopen last file" IsChecked="{²ReopenLastFile}"/>
        </VerticalStack>
 </Window>
\ No newline at end of file
index 1695b3ffd966876384898423ffc6ae31c79a15f4..ee1fe966677dea14a66a81ffe5a5442b9d102916 100755 (executable)
                </VerticalStack>
                <Splitter Width="6" Visible="{ShowLeftPane}"/>
                <VerticalStack>
-                       <HorizontalStack Height="Stretched" >
-                               <!--<TextBox VerticalAlignment="Top" Height="Stretched" Width="Stretched"
-                                               Text="{Source}" Multiline="true" TextAlignment="TopLeft"
-                                               Font="mono 10"/>-->
+                       <!--<HorizontalStack Height="Stretched" >
                                <SourceEditor Focusable="true" Name="editor" Font="consolas, 12" VerticalAlignment="Top" FilePath="{CurrentFilePath}"
                                                Foreground="Jet" Background="White" Width="Stretched" Height="Stretched" KeyDown="textView_KeyDown"/>
                                <ScrollBar Name="scrollbarY" Value="{²../editor.ScrollY}"
                        <ScrollBar Style="HScrollBar" Name="scrollbarX" Value="{²../editor.ScrollX}"
                                        Maximum="{../editor.MaxScrollX}" Height="14"
                                        LargeIncrement="{../editor.VisibleColumns}"
-                                       CursorSize="{../editor.ChildWidthRatio}"/>
+                                       CursorSize="{../editor.ChildWidthRatio}"/>-->
+                       <HorizontalStack>
+                               <TextBox Name="tb" Text="{Source}" Multiline="true" Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched"
+                                                ContextCommands="{EditorCommands}"
+                                                TextChanged="onTextChanged" KeyDown="textView_KeyDown"/>
+                               <ScrollBar Value="{²../tb.ScrollY}"
+                                               LargeIncrement="{../tb.PageHeight}" SmallIncrement="1"
+                                               CursorRatio="{../tb.ChildHeightRatio}" Maximum="{../tb.MaxScrollY}" />
+                       </HorizontalStack>
+                       <ScrollBar Style="HScrollBar" Value="{²../tb.ScrollX}"
+                                       LargeIncrement="{../tb.PageWidth}" SmallIncrement="1"
+                                       CursorRatio="{../tb.ChildWidthRatio}" Maximum="{../tb.MaxScrollX}" />                   
                        <HorizontalStack Height="Fit">
-                               <Label Text="{../../editor.HoverError}" Width="Stretched"/>
-                               <Widget Background="Red" Width="5" Height="5" Visible="{../../editor.IsDirty}"/>
-                               <Label Text="Hover Line:" Foreground="Black"/>
-                               <Label Text="{../../editor.HoverLine}"/>
-                               <Widget Height="5" Width="10"/>
-                               <Label Text="Line:" Foreground="Black"/>
-                               <Label Text="{../../editor.CurrentLine}"/>
-                               <Widget Height="5" Width="10"/>
-                               <Label Text="column:" Foreground="Black"/>
-                               <Label Text="{../../editor.CurrentColumn}"/>
+                               <Widget Width="Stretched"/>
                                <Widget Height="5" Width="10"/>
-                               <Label Text="ScrollX:" Foreground="Black"/>
-                               <Label Text="{../../editor.ScrollX}"/>
+                               <Label Text="Line:" Foreground="Grey"/>
+                               <Label Text="{../../tb.CurrentLine}" Margin="3"/>                               
+                               <Label Text="col:" Foreground="Grey"/>
+                               <Label Text="{../../tb.CurrentColumn}" Margin="3"/>                             
                        </HorizontalStack>
                </VerticalStack>
        </HorizontalStack>