]> O.S.I.I.S - jp/crow.git/commitdiff
first test with docker in CrowIDE
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 5 Mar 2018 07:46:03 +0000 (08:46 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 5 Mar 2018 07:46:03 +0000 (08:46 +0100)
12 files changed:
CrowIDE/CrowIDE.csproj
CrowIDE/src/CrowIDE.cs
CrowIDE/src/Solution.cs
CrowIDE/ui/CrowIDE.crow
CrowIDE/ui/DockWindows/winEditor.crow [new file with mode: 0644]
CrowIDE/ui/DockWindows/winErrors.crow [new file with mode: 0644]
CrowIDE/ui/DockWindows/winSolution.crow [new file with mode: 0644]
Default.style
Templates/DockWindow.template
src/GraphicObjects/DockStack.cs
src/GraphicObjects/Docker.cs
src/GraphicObjects/Splitter.cs

index 0a8150e4e71888477773ade73a9f9c75e19d262b..ba425c6eb1ea7673bbf905d3a4b5dde99557c5e2 100644 (file)
     <Folder Include="src\SourceEditor\" />
     <Folder Include="ui\ItemTemplates\" />
     <Folder Include="src\MemberView\" />
+    <Folder Include="ui\DockWindows\" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="images\save.svg" />
     <EmbeddedResource Include="ui\MembersItem.template" />
     <EmbeddedResource Include="ui\ItemTemplates\Enum.template" />
     <EmbeddedResource Include="ui\ItemTemplates\Fill.template" />
+    <EmbeddedResource Include="ui\DockWindows\winEditor.crow" />
+    <EmbeddedResource Include="ui\DockWindows\winErrors.crow" />
+    <EmbeddedResource Include="ui\DockWindows\winSolution.crow" />
   </ItemGroup>
   <ItemGroup>
     <None Include="ui\test.crow">
index 6f6e376ba817d1f3919cb7ebfac42106af41c203..9d2c3814c12a0d2cdb08828bcff12a0dfb30cd59 100644 (file)
@@ -41,7 +41,7 @@ namespace Crow.Coding
                public Command CMDNew, CMDOpen, CMDSave, CMDSaveAs, CMDQuit,
                CMDUndo, CMDRedo, CMDCut, CMDCopy, CMDPaste, CMDHelp,
                CMDAbout, CMDOptions,
-               CMDViewGTExp, CMDViewProps, CMDViewProj, CMDViewProjProps,
+               CMDViewGTExp, CMDViewProps, CMDViewProj, CMDViewProjProps, CMDViewErrors, CMDViewSolution,
                CMDCompile;
 
                void initCommands () {
@@ -58,6 +58,11 @@ namespace Crow.Coding
                        CMDHelp = new Command(new Action(() => System.Diagnostics.Debug.WriteLine("help"))) { Caption = "Help", Icon = new SvgPicture("#Crow.Coding.ui.icons.question.svg")};
                        CMDOptions = new Command(new Action(() => openOptionsDialog())) { Caption = "Editor Options", Icon = new SvgPicture("#Crow.Coding.ui.icons.tools.svg")};
 
+                       CMDViewErrors = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winErrors.crow")))
+                       { Caption = "Errors pane"};
+                       CMDViewSolution = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winSolution.crow")))
+                       { Caption = "Solution Tree"};
+
                        CMDViewGTExp = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.GTreeExplorer.crow"))) { Caption = "Graphic Tree Explorer"};
                        CMDViewProps = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.MemberView.crow"))) { Caption = "Properties View"};
                        CMDCompile = new Command(new Action(() => compileSolution())) { Caption = "Compile"};
@@ -89,6 +94,7 @@ namespace Crow.Coding
 
                Instantiator instFileDlg;
                Solution currentSolution;
+               Docker mainDock;
 
                public static Interface MainIFace;
 
@@ -107,13 +113,14 @@ namespace Crow.Coding
 
                        MainIFace = ifaceControl[0].CrowInterface;
 
+                       mainDock = go.FindByName ("mainDock") as Docker;
+
                        if (ReopenLastSolution && !string.IsNullOrEmpty (LastOpenSolution)) {
                                CurrentSolution = Solution.LoadSolution (LastOpenSolution);
                                //lock(MainIFace.UpdateMutex)
                                CurrentSolution.ReopenItemsSavedInUserConfig ();
                        }
 
-
                        instFileDlg = Instantiator.CreateFromImlFragment
                                (MainIFace, "<FileDialog Caption='Open File' CurrentDirectory='{²CurrentDirectory}' SearchPattern='*.sln' OkClicked='onFileOpen'/>");
                }
@@ -200,6 +207,21 @@ namespace Crow.Coding
 //                             loadWindow ("#Crow.Coding.ui.CSProjExplorer.crow");
 //                     }
                }
+               void loadDockWindow(string path){
+                       lock (MainIFace.UpdateMutex) {
+                               try {
+                                       GraphicObject g = MainIFace.FindByName (path);
+                                       if (g != null)
+                                               return;
+                                       g = MainIFace.Load (path);
+                                       mainDock.AddChild (g);
+                                       g.Name = path;
+                                       g.DataSource = CurrentSolution;
+                               } catch (Exception ex) {
+                                       System.Diagnostics.Debug.WriteLine (ex.ToString ());
+                               }
+                       }
+               }
                void loadWindow(string path, object dataSource = null){
                        try {
                                GraphicObject g = MainIFace.FindByName (path);
index b1ccedca8744dce74acf6b5cd8fda63289c86d0d..bd100dae19097a05528bed49247759b74fedfcb7 100644 (file)
@@ -187,7 +187,7 @@ namespace Crow.Coding{
                        saveOpenedItemsInUserConfig ();
                }
                public void CloseItem (ProjectItem pi) {
-                       Console.WriteLine ("CloseItem");
+                       Console.WriteLine ("CloseItem: " + pi.ToString());
                        openedItems.RemoveElement (pi);
                        saveOpenedItemsInUserConfig ();
                }
index 395503f5f701f10b829eb690893a39001df3d93f..e7d19afc1f250ee25bd2d903aef91775bcd315f7 100644 (file)
@@ -18,6 +18,8 @@
                                <MenuItem Command="{CMDOptions}"/>
                        </MenuItem>
                        <MenuItem Caption="View" Fit="true" PopWidth="150">
+                               <MenuItem Command="{CMDViewSolution}"/>
+                               <MenuItem Command="{CMDViewErrors}"/>
                                <MenuItem Command="{CMDViewGTExp}"/>
                                <MenuItem Command="{CMDViewProps}"/>
                                <MenuItem Command="{CMDViewProj}"/>
                                <MenuItem Command="{CMDHelp}"/>
                        </MenuItem>
                </Menu>
-               <VerticalStack DataSource="{CurrentSolution}">
-                       <Label Background="Gray" Text="{SelectedItem}" Width="Stretched" TextAlignment="Left"/>
-                       <HorizontalStack Height="80%">
+               <Docker Name="mainDock">
+                       <DockWindow DataSource="{CurrentSolution}" Name="winEditor" Caption="Edit View" Width="70%" Height="80%">
+                               <Template>
+                                       <Border BorderWidth="1" Foreground="Jet" CornerRadius="{./CornerRadius}"
+                                                                       Background="{./Background}"
+                                                                       MouseEnter="./onBorderMouseEnter"
+                                                                       MouseLeave="./onBorderMouseLeave">
+                                               <Container Name="Content" MinimumSize="50,50"/>
+                                       </Border>
+                               </Template>
                                <EditPane SelectedItem="{²SelectedItem}" SelectedItemElement="{²SelectedItemElement}" Data="{OpenedItems}" DataTest="Extension"
                                        ItemTemplate="#Crow.Coding.ui.EditPaneItems.template"/>
-                               <Splitter/>
-                               <VerticalStack Width="30%">
-                                       <TreeView Name="treeview" Height="50%" IsRoot="true"
-                                               Data="{Projects}" SelectedItemChanged="onSelectedItemChanged"
-                                               ItemTemplate="#Crow.Coding.ui.ProjectTree.template"/>
-                                       <Splitter/>
-                                       <MembersView ProjectNode="{SelectedItem}"
-                                               Instance="{SelectedItemElement}" DataTest="Type"
-                                               ItemTemplate="#Crow.Coding.ui.MembersItem.template"/>
-                               </VerticalStack>
-                       </HorizontalStack>
-                       <Splitter/>
-                       <ListBox Width="Stretched" Data="{CompilerErrors}">
-                               <ItemTemplate>
-                                       <HorizontalStack Height="Fit" Margin="0" Focusable="true" Spacing="10"
-                                                       MouseEnter="{Background=SteelBlue}"
-                                                       MouseLeave="{Background=Transparent}">                                          
-                                               <Image Width="10" Height="10" Path="#Crow.Icons.compiler_error.svg" SvgSub="{IsWarning}"/>
-                                               <Label Text="{Line}" Width="25" TextAlignment="Right"/>
-                                               <Label Text="{ErrorText}" Width="60%"/>
-                                               <Label Text="{FileName}" Width="Fit"/>
-                                       </HorizontalStack>
-                               </ItemTemplate>
-                       </ListBox>
-               </VerticalStack>
-               
+                       </DockWindow>
+               </Docker>
        </VerticalStack>
 </Window>
diff --git a/CrowIDE/ui/DockWindows/winEditor.crow b/CrowIDE/ui/DockWindows/winEditor.crow
new file mode 100644 (file)
index 0000000..f87d34f
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<DockWindow DataSource="{CurrentSolution}" Name="winEditor" Caption="Edit View" Width="70%" Height="80%">
+       <EditPane SelectedItem="{²SelectedItem}" SelectedItemElement="{²SelectedItemElement}" Data="{OpenedItems}" DataTest="Extension"
+               ItemTemplate="#Crow.Coding.ui.EditPaneItems.template"/>
+</DockWindow>
diff --git a/CrowIDE/ui/DockWindows/winErrors.crow b/CrowIDE/ui/DockWindows/winErrors.crow
new file mode 100644 (file)
index 0000000..ff7bafd
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<DockWindow DataSource="{CurrentSolution}" Name="winErrors" Caption="Errors" Width="70%" Height="20%">
+       <ListBox Width="Stretched" Data="{CompilerErrors}">
+               <ItemTemplate>
+                       <HorizontalStack Height="Fit" Margin="0" Focusable="true" Spacing="10"
+                                       MouseEnter="{Background=SteelBlue}"
+                                       MouseLeave="{Background=Transparent}">                                          
+                               <Image Width="10" Height="10" Path="#Crow.Icons.compiler_error.svg" SvgSub="{IsWarning}"/>
+                               <Label Text="{Line}" Width="25" TextAlignment="Right"/>
+                               <Label Text="{ErrorText}" Width="60%"/>
+                               <Label Text="{FileName}" Width="Fit"/>
+                       </HorizontalStack>
+               </ItemTemplate>
+       </ListBox>
+</DockWindow>
diff --git a/CrowIDE/ui/DockWindows/winSolution.crow b/CrowIDE/ui/DockWindows/winSolution.crow
new file mode 100644 (file)
index 0000000..c9de649
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<DockWindow DataSource="{CurrentSolution}" Name="winSolution" Caption="Solution" Width="30%" Height="80%">
+       <VerticalStack>
+               <TreeView Name="treeview" IsRoot="true" Height="50%"
+                       Data="{Projects}" SelectedItemChanged="onSelectedItemChanged"
+                       ItemTemplate="#Crow.Coding.ui.ProjectTree.template"/>
+               <Splitter/>
+               <MembersView ProjectNode="{SelectedItem}"
+                       Instance="{SelectedItemElement}" DataTest="Type"
+                       ItemTemplate="#Crow.Coding.ui.MembersItem.template"/>
+       </VerticalStack>
+</DockWindow>
index d4e7e4a7674994cb09ef4e0fc9be595cabf06f43..3911bafa8484bf5ab59ac8bf0f6de0130d201734 100644 (file)
@@ -73,7 +73,7 @@ Slider {
 }
 Splitter {
        Focusable = "true";
-       Margin = "2";
+       Margin = "1";
        Background = "Gray";
 }
 Spinner {
@@ -111,11 +111,11 @@ ToolWindow {
 }
 Docker {
        AllowDrop = "false";
-       Margin="1";
+       Margin="0";
        Focusable="true";
 }
 DockStack {
-       Margin="3";
+       Margin="1";
        AllowDrop = "true";
        Focusable="true";
        //DragEnter="{Background=Blue}";
@@ -125,6 +125,7 @@ DockStack {
 DockWindow {
        Focusable = "true";
        AllowDrag = "true";
+       Margin="0";
 }
 FileDialog {
        Template = "#Crow.FileDialog.template";
index 62facf06e304dcf72cf0365f8b73e5d5d709910a..3e5b499adecc306530e2fa2fd6afee1582c59cc6 100755 (executable)
@@ -6,17 +6,17 @@
                                MouseLeave="./onBorderMouseLeave">
        <VerticalStack Spacing="0">
                <HorizontalStack Background="vgradient|0:0.5,0.6,0.5,0.5|1:0.2,0.3,0.3,0.7"
-                               Name="hs" Margin="2" Spacing="0" Height="Fit">
+                               Name="hs" Margin="0" Spacing="0" Height="Fit">
                        <GraphicObject Width="5"/>
-                       <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
+                       <Image Margin="1" Width="10" Height="10" Path="{./Icon}"/>
                        <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Caption}" />
-                       <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
+                       <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="10" Width="10"
                                MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                                <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
                                         MouseClick="./butQuitPress"/>
                        </Border>
                        <GraphicObject Width="5"/>
                </HorizontalStack>
-               <Container Name="Content" MinimumSize="50,50" Background="0.5,0.5,0.5,0.5"/>
+               <Container Name="Content" MinimumSize="50,50"/>
        </VerticalStack>
 </Border>
index 79643b4758461404bf0f2f5d65f1f19bb4c7c72d..c06be42a58bbce86111667208138ee67dfea340d 100644 (file)
@@ -29,10 +29,8 @@ using Crow.IML;
 namespace Crow
 {
        public class DockStack : GenericStack
-       {
-               internal static Instantiator instStack, instSplit;//, instSpacer;
-
-               int dockingDiv = 5;
+       {               
+               int dockingDiv = 6;
                GraphicObject subStack = null;
 
                Docker rootDock { get { return LogicalParent as Docker; }}
@@ -47,14 +45,6 @@ namespace Crow
                public DockStack (Interface iface) : base (iface) {}
                #endregion
 
-               protected override void onInitialized (object sender, EventArgs e)
-               {
-                       base.onInitialized (sender, e);
-                       instStack = IFace.CreateITorFromIMLFragment (@"<DockStack/>");
-                       instSplit = IFace.CreateITorFromIMLFragment (@"<Splitter/>");
-                       //instSpacer = IFace.CreateITorFromIMLFragment (@"<GraphicObject Background='Transparent' IsEnabled='false'/>");
-               }
-
                public override void AddChild (GraphicObject g)
                {
                        base.AddChild (g);
@@ -236,8 +226,7 @@ namespace Crow
                        dsp.SubStack = SubStack;
                        return;
                }
-               public void Dock(DockWindow dw){
-                       Splitter splitter = instSplit.CreateInstance<Splitter> ();
+               public void Dock(DockWindow dw){                        
                        Rectangle r = ClientRectangle;
 
                        int vTreshold = r.Height / dockingDiv;
@@ -249,7 +238,7 @@ namespace Crow
                                activeStack = this;
                                Orientation = dw.DockingPosition.GetOrientation ();
                        }else if (dw.DockingPosition.GetOrientation() != Orientation) {                         
-                               activeStack = instStack.CreateInstance<DockStack> ();
+                               activeStack = new DockStack (IFace);
                                int ci = Children.IndexOf (rootDock.CenterDockedObj);
                                if (ci  <0 ){
                                        DockStack dsp = Parent as DockStack;
@@ -284,24 +273,24 @@ namespace Crow
                                dw.Height = vTreshold;
                                dw.Width = Measure.Stretched;
                                activeStack.InsertChild (0, dw);
-                               activeStack.InsertChild (1, splitter);
+                               activeStack.InsertChild (1, new Splitter(IFace));
                                break;
                        case Alignment.Bottom:
                                dw.Height = vTreshold;
                                dw.Width = Measure.Stretched;
-                               activeStack.AddChild (splitter);
+                               activeStack.AddChild (new Splitter(IFace));
                                activeStack.AddChild (dw);
                                break;
                        case Alignment.Left:
                                dw.Width = hTreshold;
                                dw.Height = Measure.Stretched;
                                activeStack.InsertChild (0, dw);
-                               activeStack.InsertChild (1, splitter);
+                               activeStack.InsertChild (1, new Splitter(IFace));
                                break;
                        case Alignment.Right:
                                dw.Width = hTreshold;
                                dw.Height = Measure.Stretched;
-                               activeStack.AddChild (splitter);
+                               activeStack.AddChild (new Splitter(IFace));
                                activeStack.AddChild (dw);
                                break;
                        case Alignment.Center:
index 3803d8dd4891081383d799ce42cf13856a84af99..6c55e34eae9645a7e42d3010d2c83f610789cbc1 100644 (file)
@@ -71,9 +71,9 @@ namespace Crow
                }
                public override void RemoveChild (GraphicObject child)
                {
-                       lock (IFace.UpdateMutex) {
-                               RegisterClip (ScreenCoordinates (LastPaintedSlot));
-                       }
+//                     lock (IFace.UpdateMutex) {
+//                             RegisterClip (ScreenCoordinates (LastPaintedSlot));
+//                     }
                        base.RemoveChild (child);
                }
 
index e8aa60f80fc5a2db46e566feeb29069c33d5f1d1..59a70d25d156e55527832fe8efefa8f1b47b9848 100644 (file)
@@ -43,7 +43,7 @@ namespace Crow
 
                int thickness;
 
-               [XmlAttributeAttribute][DefaultValue(1)]
+               [XmlAttributeAttribute][DefaultValue(3)]
                public virtual int Thickness {
                        get { return thickness; }
                        set {