]> O.S.I.I.S - jp/crow.git/commitdiff
debug template loading
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 18 Dec 2018 06:31:53 +0000 (07:31 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 18 Dec 2018 06:31:53 +0000 (07:31 +0100)
17 files changed:
Crow/src/CompilerServices/CompilerServices.cs
Crow/src/GraphicObjects/TemplatedControl.cs
Crow/src/Instantiator.cs
Crow/src/Interface.cs
Crow/src/ItemTemplate.cs
CrowIDE/CrowIDE.csproj
CrowIDE/src/CrowIDE.cs
CrowIDE/src/Editors/ImlVisualEditor.cs
CrowIDE/src/Extensions.cs
CrowIDE/src/GraphicObjectDesignContainer.cs
CrowIDE/src/Project.cs
CrowIDE/src/ProjectTree/ProjectFile.cs
CrowIDE/src/ProjectTree/ProjectItem.cs
CrowIDE/src/ProjectTree/ProjectNodes.cs
CrowIDE/ui/editors/EditPaneItems.template
CrowIDE/ui/editors/IMLEdit.itemp
CrowIDE/ui/editors/SrcEdit.itemp

index 80e47e9d77c8c3a4caf5479809ead156869c3ae8..7b95c9d7bb5dbd34775a105746cff3681b1567a4 100644 (file)
@@ -97,6 +97,7 @@ namespace Crow.IML
                internal static EventInfo eiLogicalParentChanged = typeof(GraphicObject).GetEvent("LogicalParentChanged");
 
                internal static MethodInfo miIFaceLoad = typeof(Interface).GetMethod ("CreateInstance", BindingFlags.Instance | BindingFlags.Public);
+               internal static MethodInfo miIFaceCreateTemplateInst = typeof (Interface).GetMethod ("CreateTemplateInstance", BindingFlags.Instance | BindingFlags.Public);
                internal static MethodInfo miGetITemp = typeof(Interface).GetMethod ("GetItemTemplate", BindingFlags.Instance | BindingFlags.Public);
 
                internal static MethodInfo miAddITemp = typeof(Dictionary<string, ItemTemplate>).GetMethod ("set_Item", new Type[] { typeof(string), typeof(ItemTemplate) });
index 6ecdb496d4f3999c54376d8c2e1316d7e2467866..1f490f11742f39b258f31e395a782a97c5f8949e 100644 (file)
@@ -76,7 +76,7 @@ namespace Crow
                                if (string.IsNullOrEmpty(_template))
                                        loadTemplate ();
                                else
-                                       loadTemplate (IFace.CreateInstance (_template));
+                                       loadTemplate (IFace.CreateTemplateInstance (_template, this.GetType()));
                        }
                }
                /// <summary>
index be534d6c33c9d5edcaeb30a9084235c9efa2bc15..988520017363addd06301c03c6a7347f48d69fab 100644 (file)
@@ -336,8 +336,11 @@ namespace Crow.IML
                                        } else {
                                                ctx.il.Emit (OpCodes.Ldarg_1);//load currentInterface
                                                ctx.il.Emit (OpCodes.Ldstr, templatePath); //Load template path string
-                                               ctx.il.Emit (OpCodes.Callvirt,//call Interface.Load(path)
-                                                       CompilerServices.miIFaceLoad);
+                                               //get declaring type for search fallback assembly
+                                               ctx.il.Emit (OpCodes.Ldloc_0);
+                                               ctx.il.Emit (OpCodes.Call, CompilerServices.miGetType);
+                                               ctx.il.Emit (OpCodes.Callvirt,
+                                                       CompilerServices.miIFaceCreateTemplateInst);
                                        }
                                        ctx.il.Emit (OpCodes.Callvirt, CompilerServices.miLoadTmp);//load template
                                }
@@ -348,7 +351,7 @@ namespace Crow.IML
                                                if (iface.ItemTemplates.ContainsKey (itemTemplatePath)) {
                                                        itemTemplateIds.Add (new string [] { "default", itemTemplatePath, "" });
                                                } else {
-                                                       using (Stream stream = iface.GetStreamFromPath (itemTemplatePath)) {
+                                                       using (Stream stream = iface.GetTemplateStreamFromPath (itemTemplatePath, ctx.CurrentNodeType)) {
                                                                //itemtemplate files may have multiple root nodes
                                                                XmlReaderSettings itrSettings = new XmlReaderSettings { ConformanceLevel = ConformanceLevel.Fragment };
                                                                using (XmlReader itr = XmlReader.Create (stream, itrSettings)) {                                                                        
index 99e385c9f503c6991e6842c4d36ad0b744b1ea1c..0c4616131242f9c4c3dde6da490ed3a74707491d 100644 (file)
@@ -355,6 +355,7 @@ namespace Crow
                /// on the first instance creation of a IML item.
                /// </summary>
                public Dictionary<String, Instantiator> Instantiators = new Dictionary<string, Instantiator>();
+               public Dictionary<String, Instantiator> Templates = new Dictionary<string, Instantiator> ();
                /// <summary>
                /// default templates dic by metadata token
                /// </summary>
@@ -424,6 +425,28 @@ namespace Crow
 
 
                #region Load/Save
+               /// <summary>get template stream from path providing the declaring type for which
+               /// this template is loaded. If not found in entry assembly, the assembly where the type is defined
+               /// will be searched
+               /// </summary>
+               /// <returns>The template stream</returns>
+               public virtual Stream GetTemplateStreamFromPath (string path, Type declaringType)
+               {
+                       Stream s = null;
+                       if (path.StartsWith ("#", StringComparison.Ordinal)) {
+                               string resId = path.Substring (1);
+                               s = Assembly.GetEntryAssembly ().GetManifestResourceStream (resId);
+                               if (s == null)
+                                       s = Assembly.GetAssembly (declaringType).GetManifestResourceStream (resId);
+                               if (s == null)
+                                       throw new Exception ($"Template not found '{path}'");
+                       } else {
+                               if (!File.Exists (path))
+                                       throw new FileNotFoundException ("Template not found: ", path);
+                               s = new FileStream (path, FileMode.Open, FileAccess.Read);
+                       }
+                       return s;
+               }
                /// <summary>Open file or find a resource from path string</summary>
                /// <returns>A file or resource stream</returns>
                /// <param name="path">This could be a normal file path, or an embedded ressource ID
@@ -434,12 +457,11 @@ namespace Crow
 
                        if (path.StartsWith ("#", StringComparison.Ordinal)) {
                                string resId = path.Substring (1);
-                               //try/catch added to prevent nunit error
-                               try {                                   
-                                       stream = System.Reflection.Assembly.GetEntryAssembly ().GetManifestResourceStream (resId);
-                               } catch {}
-                               if (stream == null)//try to find ressource in Crow assembly
-                                       stream = System.Reflection.Assembly.GetExecutingAssembly ().GetManifestResourceStream (resId);
+                               string assemblyName = resId.Split ('.') [0];
+                               Assembly a = AppDomain.CurrentDomain.GetAssemblies ().FirstOrDefault (aa => aa.GetName ().Name == assemblyName);
+                               if (a == null)
+                                       throw new Exception ($"Assembly '{assemblyName}' not found for ressource '{path}'.");
+                               stream = a.GetManifestResourceStream (resId);
                                if (stream == null)
                                        throw new Exception ("Resource not found: " + path);
                        } else {
@@ -455,13 +477,16 @@ namespace Crow
 
                        if (path.StartsWith ("#", StringComparison.Ordinal)) {
                                string resId = path.Substring (1);
-                               //try/catch added to prevent nunit error
-                               stream = Assembly.GetEntryAssembly ().GetManifestResourceStream (resId);                                
-                               if (stream == null)//try to find ressource in Crow assembly
-                                       stream = Assembly.GetExecutingAssembly ().GetManifestResourceStream (resId);
-                if (stream == null)                
-                    throw new Exception("Resource not found: " + path);
-                               Console.WriteLine(Assembly.GetEntryAssembly ().GetName ());
+                               string assemblyName = resId.Split ('.') [0];
+                               Assembly a = AppDomain.CurrentDomain.GetAssemblies ().FirstOrDefault (aa => aa.GetName ().Name == assemblyName);
+                               if (a == null)
+                                       throw new Exception ($"Assembly '{assemblyName}' not found for ressource '{path}'.");
+                               stream = a.GetManifestResourceStream (resId);
+                               /*foreach (var s in a.GetManifestResourceNames()) {
+                                       Console.WriteLine (s);
+                               }*/
+                               if (stream == null)
+                                       throw new Exception ("Resource not found: " + path);
                        } else {
                                if (!File.Exists (path))
                                        throw new FileNotFoundException ("File not found: ", path);
@@ -516,6 +541,21 @@ namespace Crow
                        }
                }
                /// <summary>
+               /// Create an instance of a GraphicObject linked to this interface but not added to the GraphicTree
+               /// </summary>
+               /// <returns>new instance of graphic object created</returns>
+               /// <param name="path">path of the iml file to load</param>
+               public virtual GraphicObject CreateTemplateInstance (string path, Type declaringType)
+               {
+                       try {
+                               if (!Templates.ContainsKey (path))
+                                       Templates [path] = new Instantiator (this, GetTemplateStreamFromPath(path, declaringType), path);
+                               return Templates [path].CreateInstance ();
+                       } catch (Exception ex) {
+                               throw new Exception ("Error loading Template <" + path + ">:", ex);
+                       }
+               }
+               /// <summary>
                /// Fetch instantiator from cache or create it.
                /// </summary>
                /// <returns>new Instantiator</returns>
index a27ddeaf7c46520f13dc42a4101ead7f2d7ee6d4..1f41e5522d64d09085e79965f4f4e8060c9a9cb6 100644 (file)
@@ -96,24 +96,6 @@ namespace Crow
                string fetchMethodName;
                string dataTest;
 
-               static Stream getItemTemplateStream (string path, Type declaringType)
-               {
-                       Stream s = null;
-                       if (path.StartsWith ("#", StringComparison.Ordinal)) {
-                               string resId = path.Substring (1);
-                               s = Assembly.GetEntryAssembly ().GetManifestResourceStream (resId);
-                               if (s == null)
-                                       s = Assembly.GetAssembly (declaringType).GetManifestResourceStream (resId);
-                               if (s == null)
-                                       throw new Exception ($"Item Template not found '{path}'");
-                       } else {
-                               if (!File.Exists (path))
-                                       throw new FileNotFoundException ("Item Template not found: ", path);
-                               s = new FileStream (path, FileMode.Open, FileAccess.Read);
-                       }
-                       return s;
-               }
-
                #region CTOR
                /// <summary>
                /// Initializes a new instance of the <see cref="Crow.ItemTemplate"/> class by parsing the file passed as argument.
@@ -122,7 +104,7 @@ namespace Crow
                /// <param name="_dataType">type this item will be choosen for, or member of the data item</param>
                /// <param name="_fetchDataMethod">for hierarchical data, method to call for children fetching</param>
                public ItemTemplate (Interface _iface, string path, Type declaringType, string _dataTest = "TypeOf", string _dataType = "default", string _fetchDataMethod = null)
-                       : base(_iface, getItemTemplateStream(path, declaringType)) {
+                       : base(_iface, _iface.GetTemplateStreamFromPath (path, declaringType)) {
                        strDataType = _dataType;
                        fetchMethodName = _fetchDataMethod;
                        dataTest = _dataTest;
index 59b33cee9f608a38506acde8e486c05158682bc4..fd909ee797089995aa0a78c1127bebd2ef9f9636 100644 (file)
@@ -7,7 +7,7 @@
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{B6D911CD-1D09-42FC-B300-9187190F2AE1}</ProjectGuid>
     <OutputType>Exe</OutputType>
-    <RootNamespace>Crow.Coding</RootNamespace>
+    <RootNamespace>CrowIDE</RootNamespace>
     <AssemblyName>CrowIDE</AssemblyName>
     <OutputPath>$(SolutionDir)build/$(Configuration)</OutputPath>
     <IntermediateOutputPath>$(SolutionDir)build/obj/$(Configuration)</IntermediateOutputPath>
     <Folder Include="src\ProjectTree\msbuild\" />
   </ItemGroup>
   <ItemGroup>
-    <EmbeddedResource Include="images\save.svg" />
     <EmbeddedResource Include="IDE.style" />
+    <EmbeddedResource Include="icons\**\*.svg"/>
+
+    <EmbeddedResource Include="images\save.svg" />
     <EmbeddedResource Include="ui\MembersView.template">
       <LogicalName>Crow.Coding.MembersView.template</LogicalName>
     </EmbeddedResource>
     <EmbeddedResource Include="ui\DockWindows\winProperties.crow" />
     <EmbeddedResource Include="ui\DockWindows\winToolbox.crow" />
     <EmbeddedResource Include="ui\DockWindows\toolboxBut.template" />
-    <EmbeddedResource Include="icons\toolbox\bar-chart.svg" />
-    <EmbeddedResource Include="icons\toolbox\bar-menu.svg" />
-    <EmbeddedResource Include="icons\toolbox\bullets.svg" />
-    <EmbeddedResource Include="icons\toolbox\calendar.svg" />
-    <EmbeddedResource Include="icons\toolbox\check-square-1.svg" />
-    <EmbeddedResource Include="icons\toolbox\database.svg" />
-    <EmbeddedResource Include="icons\toolbox\ellipsis.svg" />
-    <EmbeddedResource Include="icons\toolbox\file-code.svg" />
-    <EmbeddedResource Include="icons\toolbox\grab.svg" />
-    <EmbeddedResource Include="icons\toolbox\hash.svg" />
-    <EmbeddedResource Include="icons\toolbox\line-list.svg" />
-    <EmbeddedResource Include="icons\toolbox\list.svg" />
-    <EmbeddedResource Include="icons\toolbox\package.svg" />
-    <EmbeddedResource Include="icons\toolbox\pointer.svg" />
-    <EmbeddedResource Include="icons\toolbox\puzzle-piece.svg" />
-    <EmbeddedResource Include="icons\toolbox\refresh-file.svg" />
-    <EmbeddedResource Include="icons\toolbox\sliders.svg" />
-    <EmbeddedResource Include="icons\toolbox\split-browser-1.svg" />
-    <EmbeddedResource Include="icons\toolbox\table.svg" />
-    <EmbeddedResource Include="icons\toolbox\tasks.svg" />
-    <EmbeddedResource Include="icons\toolbox\picture-file.svg" />
-    <EmbeddedResource Include="icons\toolbox\warning.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Button.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.TextBox.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Label.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.CheckBox.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Spinner.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Container.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Group.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.HorizontalStack.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.VerticalStack.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Splitter.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.ListBox.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.ComboBox.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.TreeView.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.TabView.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Docker.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Window.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Slider.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.ProgressBar.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Grid.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Image.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.TemplatedContainer.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.TemplatedGroup.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.IMLContainer.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Wrapper.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.ColorPicker.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Border.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.GroupBox.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.ScrollBar.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Menu.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.MenuItem.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Shape.svg" />
-    <EmbeddedResource Include="icons\toolbox\padding.svg" />
-    <EmbeddedResource Include="icons\toolbox\modal-list.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Scroller.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.FileDialog.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.TabItem.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.Expandable.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.DirectoryView.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.MessageBox.svg" />
-    <EmbeddedResource Include="icons\toolbox\options.svg" />
-    <EmbeddedResource Include="icons\toolbox\Crow.RadioButton.svg" />
-    <EmbeddedResource Include="icons\move-arrows.svg">
-      <LogicalName>icons.move-arrows.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\eraser.svg">
-      <LogicalName>icons.eraser.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\light-bulb.svg">
-      <LogicalName>icons.light-bulb.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\pin.svg">
-      <LogicalName>icons.pin.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\paint-brush.svg">
-      <LogicalName>icons.paint-brush.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\tools.svg">
-      <LogicalName>icons.tools.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\trash.svg">
-      <LogicalName>icons.trash.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\zoom-in.svg">
-      <LogicalName>icons.zoom-in.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\zoom-out.svg">
-      <LogicalName>icons.zoom-out.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\search.svg">
-      <LogicalName>icons.search.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\curly-brackets.svg">
-      <LogicalName>icons.curly-brackets.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\compile.svg">
-      <LogicalName>icons.compile.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\edit.svg">
-      <LogicalName>icons.edit.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\text-file.svg" />
-    <EmbeddedResource Include="icons\undo.svg">
-      <LogicalName>icons.undo.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\redo.svg">
-      <LogicalName>icons.redo.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\sign-out.svg">
-      <LogicalName>icons.sign-out.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\file.svg">
-      <LogicalName>icons.file.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\palette.svg">
-      <LogicalName>icons.palette.svg</LogicalName>
-    </EmbeddedResource>
     <EmbeddedResource Include="ui\editors\EditPane.template">
       <LogicalName>Crow.Coding.EditPane.template</LogicalName>
     </EmbeddedResource>
     <EmbeddedResource Include="ui\editors\SvgEdit.itemp" />
     <EmbeddedResource Include="ui\DockWindows\winGTExplorer.crow" />
     <EmbeddedResource Include="ui\DockWindows\GTreeExpITemp.crow" />
-    <EmbeddedResource Include="icons\copy-file.svg">
-      <LogicalName>icons.copy-file.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\paste-on-document.svg">
-      <LogicalName>icons.paste-on-document.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\scissors.svg">
-      <LogicalName>icons.scissors.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\question.svg">
-      <LogicalName>icons.question.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\blank-file.svg">
-      <LogicalName>icons.blank-file.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\cs-file.svg">
-      <LogicalName>icons.cs-file.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\xml-file.svg">
-      <LogicalName>icons.xml-file.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\save.svg">
-      <LogicalName>icons.save.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="icons\open.svg">
-      <LogicalName>icons.open.svg</LogicalName>
-    </EmbeddedResource>
     <EmbeddedResource Include="ui\NewFile.crow" />
     <EmbeddedResource Include="ui\DockWindows\winSchema.crow" />
     <EmbeddedResource Include="ui\DockWindows\WinSchemaItem.template" />
index 2a791493b65ab99cc15067292bd8b5ac9fd4608a..ca5a0440e7e4d20d71b1416211ed811a617fb3ff 100644 (file)
@@ -1,4 +1,4 @@
-//
+//
 //  HelloCube.cs
 //
 //  Author:
@@ -44,40 +44,40 @@ namespace Crow.Coding
                CMDCompile;
 
                void initCommands () {
-                       CMDNew = new Command(new Action(() => newFile())) { Caption = "New", Icon = new SvgPicture("#icons.blank-file.svg"), CanExecute = true};
-                       CMDOpen = new Command(new Action(() => openFileDialog())) { Caption = "Open...", Icon = new SvgPicture("#icons.open.svg") };
-                       CMDSave = new Command(new Action(() => saveFileDialog())) { Caption = "Save", Icon = new SvgPicture("#icons.save.svg"), CanExecute = false};
-                       CMDSaveAs = new Command(new Action(() => saveFileDialog())) { Caption = "Save As...", Icon = new SvgPicture("#icons.save.svg"), CanExecute = false};
-                       CMDQuit = new Command(new Action(() => app.running = false)) { Caption = "Quit", Icon = new SvgPicture("#icons.sign-out.svg") };
-                       CMDUndo = new Command(new Action(() => undo())) { Caption = "Undo", Icon = new SvgPicture("#icons.undo.svg"), CanExecute = false};
-                       CMDRedo = new Command(new Action(() => redo())) { Caption = "Redo", Icon = new SvgPicture("#icons.redo.svg"), CanExecute = false};
-            //CMDCut = new Command(new Action(() => Quit (null, null))) { Caption = "Cut", Icon = new SvgPicture("#icons.scissors.svg"), CanExecute = false};
-            //CMDCopy = new Command(new Action(() => Quit (null, null))) { Caption = "Copy", Icon = new SvgPicture("#icons.copy-file.svg"), CanExecute = false};
-            //CMDPaste = new Command(new Action(() => Quit (null, null))) { Caption = "Paste", Icon = new SvgPicture("#icons.paste-on-document.svg"), CanExecute = false};
-            CMDHelp = new Command(new Action(() => System.Diagnostics.Debug.WriteLine("help"))) { Caption = "Help", Icon = new SvgPicture("#icons.question.svg") };
-                       CMDOptions = new Command(new Action(() => loadWindow("#Crow.Coding.ui.Options.crow"))) { Caption = "Editor Options", Icon = new SvgPicture("#icons.tools.svg") };
+                       CMDNew = new Command(new Action(() => newFile())) { Caption = "New", Icon = new SvgPicture("#CrowIDE.icons.blank-file.svg"), CanExecute = true};
+                       CMDOpen = new Command(new Action(() => openFileDialog())) { Caption = "Open...", Icon = new SvgPicture("#CrowIDE.icons.open.svg") };
+                       CMDSave = new Command(new Action(() => saveFileDialog())) { Caption = "Save", Icon = new SvgPicture("#CrowIDE.icons.save.svg"), CanExecute = false};
+                       CMDSaveAs = new Command(new Action(() => saveFileDialog())) { Caption = "Save As...", Icon = new SvgPicture("#CrowIDE.icons.save.svg"), CanExecute = false};
+                       CMDQuit = new Command(new Action(() => app.running = false)) { Caption = "Quit", Icon = new SvgPicture("#CrowIDE.icons.sign-out.svg") };
+                       CMDUndo = new Command(new Action(() => undo())) { Caption = "Undo", Icon = new SvgPicture("#CrowIDE.icons.undo.svg"), CanExecute = false};
+                       CMDRedo = new Command(new Action(() => redo())) { Caption = "Redo", Icon = new SvgPicture("#CrowIDE.icons.redo.svg"), CanExecute = false};
+            //CMDCut = new Command(new Action(() => Quit (null, null))) { Caption = "Cut", Icon = new SvgPicture("#CrowIDE.icons.scissors.svg"), CanExecute = false};
+            //CMDCopy = new Command(new Action(() => Quit (null, null))) { Caption = "Copy", Icon = new SvgPicture("#CrowIDE.icons.copy-file.svg"), CanExecute = false};
+            //CMDPaste = new Command(new Action(() => Quit (null, null))) { Caption = "Paste", Icon = new SvgPicture("#CrowIDE.icons.paste-on-document.svg"), CanExecute = false};
+            CMDHelp = new Command(new Action(() => System.Diagnostics.Debug.WriteLine("help"))) { Caption = "Help", Icon = new SvgPicture("#CrowIDE.icons.question.svg") };
+                       CMDOptions = new Command(new Action(() => loadWindow("#CrowIDE.ui.Options.crow"))) { Caption = "Editor Options", Icon = new SvgPicture("#CrowIDE.icons.tools.svg") };
 
                        cmdCloseSolution = new Command(new Action(() => closeSolution()))
-                       { Caption = "Close Solution", Icon = new SvgPicture("#icons.paste-on-document.svg"), CanExecute = false};
+                       { Caption = "Close Solution", Icon = new SvgPicture("#CrowIDE.icons.paste-on-document.svg"), CanExecute = false};
 
-                       CMDViewErrors = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winErrors.crow",this)))
+                       CMDViewErrors = new Command(new Action(() => loadWindow ("#CrowIDE.ui.DockWindows.winErrors.crow",this)))
                        { Caption = "Errors pane"};
-                       CMDViewSolution = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winSolution.crow",this)))
+                       CMDViewSolution = new Command(new Action(() => loadWindow ("#CrowIDE.ui.DockWindows.winSolution.crow",this)))
                        { Caption = "Solution Tree", CanExecute = false};
-                       CMDViewEditor = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winEditor.crow",this)))
+                       CMDViewEditor = new Command(new Action(() => loadWindow ("#CrowIDE.ui.DockWindows.winEditor.crow",this)))
                        { Caption = "Editor Pane"};
-                       CMDViewProperties = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winProperties.crow",this)))
+                       CMDViewProperties = new Command(new Action(() => loadWindow ("#CrowIDE.ui.DockWindows.winProperties.crow",this)))
                        { Caption = "Properties"};
-                       CMDViewDesign = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winDesign.crow",this)))
+                       CMDViewDesign = new Command(new Action(() => loadWindow ("#CrowIDE.ui.DockWindows.winDesign.crow",this)))
                        { Caption = "Quick Design", CanExecute = true};
-                       CMDViewToolbox = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winToolbox.crow",this)))
+                       CMDViewToolbox = new Command(new Action(() => loadWindow ("#CrowIDE.ui.DockWindows.winToolbox.crow",this)))
                        { Caption = "Toolbox", CanExecute = false};
-                       CMDViewSchema = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winSchema.crow",this)))
+                       CMDViewSchema = new Command(new Action(() => loadWindow ("#CrowIDE.ui.DockWindows.winSchema.crow",this)))
                        { Caption = "IML Shematic View", CanExecute = true};
-                       CMDViewStyling = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winStyleView.crow",this)))
+                       CMDViewStyling = new Command(new Action(() => loadWindow ("#CrowIDE.ui.DockWindows.winStyleView.crow",this)))
                        { Caption = "Styling Explorer", CanExecute = true};
                                
-                       CMDViewGTExp = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winGTExplorer.crow",this)))
+                       CMDViewGTExp = new Command(new Action(() => loadWindow ("#CrowIDE.ui.DockWindows.winGTExplorer.crow",this)))
                        { Caption = "Graphic Tree Explorer", CanExecute = true};
                        CMDCompile = new Command(new Action(() => compileSolution()))
                        { Caption = "Compile", CanExecute = false};
@@ -159,7 +159,7 @@ namespace Crow.Coding
 
                        initCommands ();
 
-                       GraphicObject go = Load (@"#Crow.Coding.ui.CrowIDE.crow");
+                       GraphicObject go = Load (@"#CrowIDE.ui.CrowIDE.crow");
                        go.DataSource = this;
 
                        mainDock = go.FindByName ("mainDock") as DockStack;
@@ -173,13 +173,13 @@ namespace Crow.Coding
                        instFileDlg = Instantiator.CreateFromImlFragment
                                (MainIFace, "<FileDialog Caption='Open File' CurrentDirectory='{²CurrentDirectory}' SearchPattern='*.sln' OkClicked='onFileOpen'/>");
 
-                       /*DockWindow dw = loadWindow ("#Crow.Coding.ui.DockWindows.winEditor.crow", this) as DockWindow;
+                       /*DockWindow dw = loadWindow ("#CrowIDE.ui.DockWindows.winEditor.crow", this) as DockWindow;
                        dw.DockingPosition = Alignment.Center;
                        dw.Dock (mainDock);
-                       dw = loadWindow ("#Crow.Coding.ui.DockWindows.winSolution.crow", this) as DockWindow;
+                       dw = loadWindow ("#CrowIDE.ui.DockWindows.winSolution.crow", this) as DockWindow;
                        dw.DockingPosition = Alignment.Right;
                        dw.Dock (mainDock);
-                       dw = loadWindow ("#Crow.Coding.ui.DockWindows.winToolbox.crow", this) as DockWindow;
+                       dw = loadWindow ("#CrowIDE.ui.DockWindows.winToolbox.crow", this) as DockWindow;
                        dw.DockingPosition = Alignment.Left;
                        dw.Dock (mainDock);*/
 
@@ -187,7 +187,7 @@ namespace Crow.Coding
                }
 
                void loadProjProps () {
-                       loadWindow ("#Crow.Coding.ui.ProjectProperties.crow");
+                       loadWindow ("#CrowIDE.ui.ProjectProperties.crow");
                }
                void compileSolution () {
                        //ProjectItem pi = CurrentSolution.SelectedItem;
index 46becb62fd1a814a2fb0cd6cec21c15a97d6d381..a7ba8c67a912044759140a3b686486c6367725da 100644 (file)
@@ -67,15 +67,15 @@ namespace Crow.Coding
 
                void initCommands () {
                        cmdDelete = new Crow.Command (new Action (() => deleteObject (SelectedItem)))
-                               { Caption = "Delete", Icon = new SvgPicture ("#icons.save.svg"), CanExecute = true };
+                               { Caption = "Delete", Icon = new SvgPicture ("#CrowIDE.icons.save.svg"), CanExecute = true };
                        Commands = new List<Crow.Command> (new Crow.Command[] { cmdDelete });
                }
 
                void initIcons () {
-                       icoMove = new SvgPicture ("#icons.move-arrows.svg");
+                       icoMove = new SvgPicture ("#CrowIDE.icons.move-arrows.svg");
 
             //                 icoStyle = new SvgPicture ();
-            //                 icoStyle.Load (IFace, "#icons.palette.svg");
+            //                 icoStyle.Load (IFace, "#CrowIDE.icons.palette.svg");
         }
 
         [DefaultValue(true)]
index 45873d3ef2ede29d82d4f62a8dc367420a6e83aa..91084bc0ab23ce8d8df483f4c2b7d4a9785a896e 100644 (file)
@@ -26,7 +26,7 @@ namespace Crow
        public static partial class Extensions
        {
                public static string GetIcon(this GraphicObject go){
-                       return "#icons.toolbox." + go.GetType().FullName + ".svg";
+                       return "#CrowIDE.icons.toolbox." + go.GetType().FullName + ".svg";
                }
                public static List<GraphicObject> GetChildren(this GraphicObject go){
                        Type goType = go.GetType();
index d99b38cb339c1c432052d26dbb64ff213f5b89ae..a8aea097badf7bce3b1fa4b83ad83798528a6a6e 100644 (file)
@@ -41,7 +41,7 @@ namespace Crow.Coding
                public Type CrowType;
 
                public string IconPath {
-                       get { return "#icons.toolbox." + CrowType.FullName + ".svg"; }
+                       get { return "#CrowIDE.icons.toolbox." + CrowType.FullName + ".svg"; }
                }
                public string DisplayName {
                        get { return CrowType.Name; }
index 3b4063672fec39a2d6f35061739e7bba8d7b8bc8..a3ffa63671e99103a024a1da5f1c31bf8acf3fc0 100644 (file)
@@ -57,18 +57,18 @@ namespace Crow.Coding {
 
             solution = sol;
 
-            cmdSave = new Crow.Command (new Action (() => Save ())) { Caption = "Save", Icon = new SvgPicture ("#icons.save.svg"), CanExecute = true };
-            cmdOpen = new Crow.Command (new Action (() => Load ())) { Caption = "Open", Icon = new SvgPicture ("#icons.open.svg"), CanExecute = false };
+            cmdSave = new Crow.Command (new Action (() => Save ())) { Caption = "Save", Icon = new SvgPicture ("#CrowIDE.icons.save.svg"), CanExecute = true };
+            cmdOpen = new Crow.Command (new Action (() => Load ())) { Caption = "Open", Icon = new SvgPicture ("#CrowIDE.icons.open.svg"), CanExecute = false };
             cmdCompile = new Crow.Command (new Action (() => Compile ())) {
                 Caption = "Compile",
-                Icon = "#icons.compile.svg"
+                Icon = "#CrowIDE.icons.compile.svg"
             };
             cmdSetAsStartProj = new Crow.Command (new Action (() => setAsStartupProject ())) {
                 Caption = "Set as Startup Project"
             };
             cmdNewFile = new Crow.Command (new Action (() => AddNewFile ())) {
                 Caption = "Add New File",
-                Icon = new SvgPicture ("#icons.blank-file.svg"),
+                Icon = new SvgPicture ("#CrowIDE.icons.blank-file.svg"),
                 CanExecute = true
             };
 
@@ -256,7 +256,7 @@ namespace Crow.Coding {
 
 
         public void AddNewFile () {
-            Window.Show (CrowIDE.MainIFace, "#Crow.Coding.ui.NewFile.crow", true).DataSource = this;
+            Window.Show (CrowIDE.MainIFace, "#CrowIDE.ui.NewFile.crow", true).DataSource = this;
         }
 
         public void Load () {
index 8d803faa15b3cfa7cdc85670380443bed38d1965..294a28f55c954b6ee1abff1e1ea2c0542afe6b57 100644 (file)
@@ -49,17 +49,17 @@ namespace Crow.Coding {
 
                void initCommands (){
                        cmdSave = new Crow.Command (new Action (() => Save ()))
-                       { Caption = "Save", Icon = new SvgPicture ("#icons.save.svg"), CanExecute = false };
+                       { Caption = "Save", Icon = new SvgPicture ("#CrowIDE.icons.save.svg"), CanExecute = false };
                        cmdSaveAs = new Crow.Command (new Action (() => SaveAs ()))
-                       { Caption = "Save As ..", Icon = new SvgPicture ("#icons.save.svg"), CanExecute = false };
+                       { Caption = "Save As ..", Icon = new SvgPicture ("#CrowIDE.icons.save.svg"), CanExecute = false };
                        cmdOpen = new Crow.Command (new Action (() => Open ())) 
-                       { Caption = "Open", Icon = new SvgPicture ("#icons.open.svg"), CanExecute = true };
+                       { Caption = "Open", Icon = new SvgPicture ("#CrowIDE.icons.open.svg"), CanExecute = true };
                        cmdClose = new Crow.Command (new Action (() => OnQueryClose (this,null))) 
-                       { Caption = "Close", Icon = new SvgPicture ("#icons.open.svg"), CanExecute = false };
+                       { Caption = "Close", Icon = new SvgPicture ("#CrowIDE.icons.open.svg"), CanExecute = false };
                        cmdUndo = new Crow.Command (new Action (() => Undo (null))) 
-                       { Caption = "Undo", Icon = new SvgPicture ("#icons.undo.svg"), CanExecute = false };
+                       { Caption = "Undo", Icon = new SvgPicture ("#CrowIDE.icons.undo.svg"), CanExecute = false };
                        cmdRedo = new Crow.Command (new Action (() => Redo (null))) 
-                       { Caption = "Redo", Icon = new SvgPicture ("#icons.redo.svg"), CanExecute = false };
+                       { Caption = "Redo", Icon = new SvgPicture ("#CrowIDE.icons.redo.svg"), CanExecute = false };
 
                        Commands.Insert (0, cmdOpen);
                        Commands.Insert (1, cmdSave);
index 695e372bafc61d425d7a8e9789af0a6e56711e99..afa3e3edd92a76ca383d838bd8415545bddffeb9 100644 (file)
@@ -48,11 +48,11 @@ namespace Crow.Coding
                 switch (Extension)
                 {
                     case ".cs":
-                        return new SvgPicture("#icons.cs-file.svg");
+                        return new SvgPicture("#CrowIDE.icons.cs-file.svg");
                     case ".crow":                        
-                        return new SvgPicture("#icons.xml-file.svg");
+                        return new SvgPicture("#CrowIDE.icons.xml-file.svg");
                     case ".xml":
-                        return new SvgPicture("#icons.xml-file.svg");
+                        return new SvgPicture("#CrowIDE.icons.xml-file.svg");
                     default:
                         return base.Icon;
                 }
index 5f518ff77ecd3c60d494c2ba2ae7dfa41b2fcc2a..bafb9cbd30ffc17147089a23aabab027ac79987b 100644 (file)
@@ -95,7 +95,7 @@ namespace Crow.Coding
                                case ItemType.ProjectReference:
                                        return new SvgPicture("#Crow.Icons.projectRef.svg"); 
                                default:
-                                       return new SvgPicture("#icons.blank-file.svg"); 
+                                       return new SvgPicture("#CrowIDE.icons.blank-file.svg"); 
                                }
                        }
                }
index 16db55f62e46be097520d339e4d84775c4d31ed6..d9f253e1187c0adca3f3104388f128453ba0aa1a 100644 (file)
@@ -4,15 +4,15 @@
                <Label Text="Error" Background="Red"/>
        </TabItem>
 </ItemTemplate>
-<ItemTemplate Path="#Crow.Coding.ui.editors.SvgEdit.itemp" DataType=".svg"/>
-<ItemTemplate Path="#Crow.Coding.ui.editors.SrcEdit.itemp" DataType=".cs"/>
-<ItemTemplate Path="#Crow.Coding.ui.editors.SrcEdit.itemp" DataType=".style"/>
-<ItemTemplate Path="#Crow.Coding.ui.editors.IMLEdit.itemp" DataType=".crow"/>
-<ItemTemplate Path="#Crow.Coding.ui.editors.IMLEdit.itemp" DataType=".itemp"/>
-<ItemTemplate Path="#Crow.Coding.ui.editors.IMLEdit.itemp" DataType=".template"/>
+<ItemTemplate Path="#CrowIDE.ui.editors.SvgEdit.itemp" DataType=".svg"/>
+<ItemTemplate Path="#CrowIDE.ui.editors.SrcEdit.itemp" DataType=".cs"/>
+<ItemTemplate Path="#CrowIDE.ui.editors.SrcEdit.itemp" DataType=".style"/>
+<ItemTemplate Path="#CrowIDE.ui.editors.IMLEdit.itemp" DataType=".crow"/>
+<ItemTemplate Path="#CrowIDE.ui.editors.IMLEdit.itemp" DataType=".itemp"/>
+<ItemTemplate Path="#CrowIDE.ui.editors.IMLEdit.itemp" DataType=".template"/>
 <ItemTemplate DataType=".goml">
        <TabItem Caption="{DisplayName}" QueryClose="OnQueryClose">
-               <IMLContainer Path="#Crow.Coding.ui.editors.TextEditor.crow"/>
+               <IMLContainer Path="#CrowIDE.ui.editors.TextEditor.crow"/>
        </TabItem>
 </ItemTemplate>
 
index 77fe0449688f9e33f26481a37c78f745e044b602..4ee3aba9b146d068d61fc06ee6a100ba7b2c7fc3 100644 (file)
@@ -44,7 +44,7 @@
             </HorizontalStack>
         </VerticalStack>               
         <Splitter/>
-               <IMLContainer Path="#Crow.Coding.ui.editors.SourceEditor.crow"/>
+               <IMLContainer Path="#CrowIDE.ui.editors.SourceEditor.crow"/>
                <Splitter Visible="{../editor.HasError}"/>
                <Label DataSource="{../editor.Error}" Text="{}"
                        Visible="{../editor.HasError}"
index 1d29e8c1648421b668f2de77127672b5058434a9..330dac64d7a11737c944f20505780d3b9c4b8c0d 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <TabItem QueryClose="OnQueryClose" IsSelected="{²IsSelected}" Template="#Crow.Coding.EditTabItem.template">
-       <IMLContainer Path="#Crow.Coding.ui.editors.SourceEditor.crow"/>
+       <IMLContainer Path="#CrowIDE.ui.editors.SourceEditor.crow"/>
 </TabItem>
\ No newline at end of file