From bd9262e92258ef028a9f9f74c4de6bcb947c32a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Thu, 15 Mar 2018 00:25:23 +0100 Subject: [PATCH] remove docker, floating dockingwin should be added to iface --- Crow.csproj | 1 - CrowIDE/src/CrowIDE.cs | 72 +++++++++--------- CrowIDE/src/Editors/ImlVisualEditor.cs | 21 ++++-- CrowIDE/ui/CrowIDE.crow | 6 +- CrowIDE/ui/DockWindows/winEditor.crow | 4 +- CrowIDE/ui/DockWindows/winProperties.crow | 4 +- CrowIDE/ui/DockWindows/winSolution.crow | 4 +- CrowIDE/ui/editors/IMLEdit.itemp | 3 +- Default.style | 1 + Templates/FileDialog.template | 10 +-- Tests/BasicTests.cs | 10 ++- Tests/Interfaces/Experimental/testDock.crow | 15 +--- src/GraphicObjects/DockStack.cs | 9 ++- src/GraphicObjects/DockWindow.cs | 7 +- src/GraphicObjects/Docker.cs | 84 --------------------- src/GraphicObjects/Image.cs | 4 +- 16 files changed, 90 insertions(+), 165 deletions(-) delete mode 100644 src/GraphicObjects/Docker.cs diff --git a/Crow.csproj b/Crow.csproj index db3da7bb..1b5b3406 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -218,7 +218,6 @@ - diff --git a/CrowIDE/src/CrowIDE.cs b/CrowIDE/src/CrowIDE.cs index 3850a865..46a926e3 100644 --- a/CrowIDE/src/CrowIDE.cs +++ b/CrowIDE/src/CrowIDE.cs @@ -62,24 +62,24 @@ namespace Crow.Coding cmdCloseSolution = new Command(new Action(() => closeSolution())) { Caption = "Close Solution", Icon = new SvgPicture("#Crow.Coding.ui.icons.paste-on-document.svg"), CanExecute = false}; - CMDViewErrors = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winErrors.crow"))) + CMDViewErrors = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winErrors.crow",this))) { Caption = "Errors pane"}; - CMDViewSolution = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winSolution.crow"))) + CMDViewSolution = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winSolution.crow",this))) { Caption = "Solution Tree", CanExecute = false}; - CMDViewEditor = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winEditor.crow"))) + CMDViewEditor = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winEditor.crow",this))) { Caption = "Editor Pane"}; - CMDViewProperties = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winProperties.crow"))) + CMDViewProperties = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winProperties.crow",this))) { Caption = "Properties"}; - CMDViewDesign = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winDesign.crow"))) + CMDViewDesign = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winDesign.crow",this))) { Caption = "Quick Design", CanExecute = true}; - CMDViewToolbox = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winToolbox.crow"))) + CMDViewToolbox = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winToolbox.crow",this))) { Caption = "Toolbox", CanExecute = false}; - CMDViewSchema = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winSchema.crow"))) + CMDViewSchema = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winSchema.crow",this))) { Caption = "IML Shematic View", CanExecute = true}; - CMDViewStyling = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winStyleView.crow"))) + CMDViewStyling = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winStyleView.crow",this))) { Caption = "Styling Explorer", CanExecute = true}; - CMDViewGTExp = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winGTExplorer.crow"))) + CMDViewGTExp = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winGTExplorer.crow"))) { Caption = "Graphic Tree Explorer", CanExecute = false}; CMDCompile = new Command(new Action(() => compileSolution())) { Caption = "Compile", CanExecute = false}; @@ -119,7 +119,7 @@ namespace Crow.Coding Instantiator instFileDlg; Solution currentSolution; Project currentProject; - Docker mainDock; + DockStack mainDock; public static Interface MainIFace; public static CrowIDE MainWin; @@ -139,7 +139,7 @@ namespace Crow.Coding MainIFace = ifaceControl[0].CrowInterface; - mainDock = go.FindByName ("mainDock") as Docker; + mainDock = go.FindByName ("mainDock") as DockStack; if (ReopenLastSolution && !string.IsNullOrEmpty (LastOpenSolution)) { CurrentSolution = Solution.LoadSolution (LastOpenSolution); @@ -150,15 +150,15 @@ namespace Crow.Coding instFileDlg = Instantiator.CreateFromImlFragment (MainIFace, ""); - DockWindow dw = loadDockWindow ("#Crow.Coding.ui.DockWindows.winEditor.crow"); + DockWindow dw = loadWindow ("#Crow.Coding.ui.DockWindows.winEditor.crow", this) as DockWindow; dw.DockingPosition = Alignment.Center; - dw.Dock (mainDock.Children [0] as DockStack); - dw = loadDockWindow ("#Crow.Coding.ui.DockWindows.winSolution.crow"); + dw.Dock (mainDock); + dw = loadWindow ("#Crow.Coding.ui.DockWindows.winSolution.crow", this) as DockWindow; dw.DockingPosition = Alignment.Right; - dw.Dock (mainDock.Children [0] as DockStack); - dw = loadDockWindow ("#Crow.Coding.ui.DockWindows.winToolbox.crow"); + dw.Dock (mainDock); + dw = loadWindow ("#Crow.Coding.ui.DockWindows.winToolbox.crow", this) as DockWindow; dw.DockingPosition = Alignment.Left; - dw.Dock (mainDock.Children [0] as DockStack); + dw.Dock (mainDock); } @@ -267,33 +267,35 @@ namespace Crow.Coding // loadWindow ("#Crow.Coding.ui.CSProjExplorer.crow"); // } } - DockWindow loadDockWindow(string path){ - lock (MainIFace.UpdateMutex) { - GraphicObject g = MainIFace.FindByName (path); - if (g == null){ - try { - g = MainIFace.Load (path); - mainDock.AddChild (g); - g.Name = path; - g.DataSource = CurrentSolution; - } catch (Exception ex) { - System.Diagnostics.Debug.WriteLine (ex.ToString ()); - } - } - return g as DockWindow; - } - } - void loadWindow(string path, object dataSource = null){ +// DockWindow loadDockWindow(string path){ +// lock (MainIFace.UpdateMutex) { +// GraphicObject g = MainIFace.FindByName (path); +// if (g == null){ +// try { +// g = MainIFace.Load (path); +// mainDock.AddChild (g); +// g.Name = path; +// g.DataSource = CurrentSolution; +// } catch (Exception ex) { +// System.Diagnostics.Debug.WriteLine (ex.ToString ()); +// } +// } +// return g as DockWindow; +// } +// } + Window loadWindow(string path, object dataSource = null){ try { GraphicObject g = MainIFace.FindByName (path); if (g != null) - return; + return g as Window; g = MainIFace.AddWidget (path); g.Name = path; g.DataSource = dataSource; + return g as Window; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine (ex.ToString ()); } + return null; } void closeWindow (string path){ GraphicObject g = MainIFace.FindByName (path); diff --git a/CrowIDE/src/Editors/ImlVisualEditor.cs b/CrowIDE/src/Editors/ImlVisualEditor.cs index 3ccf6278..66ee3431 100644 --- a/CrowIDE/src/Editors/ImlVisualEditor.cs +++ b/CrowIDE/src/Editors/ImlVisualEditor.cs @@ -60,7 +60,7 @@ namespace Crow.Coding Picture icoMove, icoStyle; Rectangle rIcons = default(Rectangle); - Size iconSize = new Size(10,10); + Size iconSize = new Size(11,11); public List Commands; Crow.Command cmdDelete; @@ -375,10 +375,10 @@ namespace Crow.Coding } SelectedItem = HoverWidget; - if (SelectedItem != null && projFile != null) { - projFile.CurrentLine = SelectedItem.design_line; - projFile.CurrentColumn = SelectedItem.design_column; - } +// if (SelectedItem != null && projFile != null) { +// projFile.CurrentLine = SelectedItem.design_line; +// projFile.CurrentColumn = SelectedItem.design_column; +// } } @@ -430,7 +430,14 @@ namespace Crow.Coding } else { gr.SetSourceColor (Color.LavenderBlush); gr.Rectangle (cb, 2.0 / z); - drawCenteredTextLine(gr, cb.Center, Error.InnerException?.Message); + string[] lerrs = Error.ToString ().Split ('\n'); + Point p = cb.Center; + p.Y -= lerrs.Length * 20; + foreach (string le in lerrs) { + drawCenteredTextLine(gr, p, le); + p.Y += 20; + + } } gr.Stroke (); @@ -558,6 +565,8 @@ namespace Crow.Coding drawCenteredTextLine (gr, new PointD(center.X,center.Y), txt); } void drawCenteredTextLine (Context gr, PointD center, string txt){ + if (string.IsNullOrEmpty(txt)) + return; FontExtents fe = gr.FontExtents; TextExtents te = gr.TextExtents (txt); diff --git a/CrowIDE/ui/CrowIDE.crow b/CrowIDE/ui/CrowIDE.crow index 7fe511f1..d721ac36 100644 --- a/CrowIDE/ui/CrowIDE.crow +++ b/CrowIDE/ui/CrowIDE.crow @@ -39,8 +39,8 @@ - - + + - + diff --git a/CrowIDE/ui/DockWindows/winEditor.crow b/CrowIDE/ui/DockWindows/winEditor.crow index 8ba392d4..eb757b61 100644 --- a/CrowIDE/ui/DockWindows/winEditor.crow +++ b/CrowIDE/ui/DockWindows/winEditor.crow @@ -1,5 +1,5 @@  - - + diff --git a/CrowIDE/ui/DockWindows/winProperties.crow b/CrowIDE/ui/DockWindows/winProperties.crow index f4d7450e..25d073b6 100644 --- a/CrowIDE/ui/DockWindows/winProperties.crow +++ b/CrowIDE/ui/DockWindows/winProperties.crow @@ -1,6 +1,6 @@  - - + diff --git a/CrowIDE/ui/DockWindows/winSolution.crow b/CrowIDE/ui/DockWindows/winSolution.crow index af4f717b..06ca58ba 100644 --- a/CrowIDE/ui/DockWindows/winSolution.crow +++ b/CrowIDE/ui/DockWindows/winSolution.crow @@ -1,6 +1,6 @@  - - + diff --git a/CrowIDE/ui/editors/IMLEdit.itemp b/CrowIDE/ui/editors/IMLEdit.itemp index 85944b8e..84f391cf 100644 --- a/CrowIDE/ui/editors/IMLEdit.itemp +++ b/CrowIDE/ui/editors/IMLEdit.itemp @@ -22,8 +22,7 @@