aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/CrowIDE/src/ProjectTree
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-05-13 10:09:01 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-05-13 10:09:01 +0200
commit74d1288c9990bb251b7097b225891bafdc6758af (patch)
tree8173afa55887a46e9ef44076498be725c5b33ad1 /Samples/CrowIDE/src/ProjectTree
parenta73c8383e6ea636672a3bdb07e084260538fc68a (diff)
removed splitted CrowIDE
Diffstat (limited to 'Samples/CrowIDE/src/ProjectTree')
-rw-r--r--Samples/CrowIDE/src/ProjectTree/CSProjectFile.cs72
-rw-r--r--Samples/CrowIDE/src/ProjectTree/ImlProjectItem.cs89
-rw-r--r--Samples/CrowIDE/src/ProjectTree/ProjectFile.cs323
-rw-r--r--Samples/CrowIDE/src/ProjectTree/ProjectItem.cs116
-rw-r--r--Samples/CrowIDE/src/ProjectTree/ProjectNodes.cs159
-rw-r--r--Samples/CrowIDE/src/ProjectTree/ProjectReference.cs51
-rw-r--r--Samples/CrowIDE/src/ProjectTree/StyleProjectItem.cs50
7 files changed, 0 insertions, 860 deletions
diff --git a/Samples/CrowIDE/src/ProjectTree/CSProjectFile.cs b/Samples/CrowIDE/src/ProjectTree/CSProjectFile.cs
deleted file mode 100644
index 586e2261..00000000
--- a/Samples/CrowIDE/src/ProjectTree/CSProjectFile.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// ProjectNodes.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.CodeAnalysis.CSharp.Syntax;
-
-namespace Crow.Coding
-{
- public class CSProjectFile : ProjectFile
- {
- CSharpSyntaxTree tree;
-
-
- #region CTOR
- public CSProjectFile (ProjectItem pi) : base (pi){
- }
- #endregion
-
- public override void UpdateSource(object sender, string newSrc)
- {
- base.UpdateSource(sender, newSrc);
-
- tree = (CSharpSyntaxTree)CSharpSyntaxTree.ParseText (Source, CSharpParseOptions.Default);
- }
-
- public override void Open () {
- base.Open ();
-
- tree = (CSharpSyntaxTree)CSharpSyntaxTree.ParseText (Source, CSharpParseOptions.Default);
-
- CompilationUnitSyntax root = (CompilationUnitSyntax)tree.GetRoot ();
- MemberDeclarationSyntax firstMember = root.Members [0];
-
- Console.WriteLine ( firstMember.GetType().FullName);
-
- SyntaxToken tok = root.GetFirstToken();
-
- while (tok.Value != null) {
- Console.Write (tok.Text);
- tok = tok.GetNextToken (true,true);
- }
- Console.Out.Flush ();
- }
-
-
- }
-}
-
diff --git a/Samples/CrowIDE/src/ProjectTree/ImlProjectItem.cs b/Samples/CrowIDE/src/ProjectTree/ImlProjectItem.cs
deleted file mode 100644
index 8487f838..00000000
--- a/Samples/CrowIDE/src/ProjectTree/ImlProjectItem.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// ProjectNodes.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml;
-using System.IO;
-using Crow;
-using System.Threading;
-
-namespace Crow.Coding
-{
- public class ImlProjectItem : ProjectFile
- {
- #region CTOR
- public ImlProjectItem (ProjectItem pi) : base (pi){
- }
- #endregion
-
- Widget instance;
- Measure designWidth, designHeight;
-
- /// <summary>
- /// instance created with an instantiator from the source by a DesignInterface,
- /// for now, the one in ImlVisualEditor
- /// </summary>
- public Widget Instance {
- get { return instance; }
- set {
- if (instance == value)
- return;
- instance = value;
- NotifyValueChanged ("Instance", instance);
- }
- }
-
- public Measure DesignWidth {
- get { return designWidth; }
- set {
- if (designWidth == value)
- return;
- designWidth = value;
- NotifyValueChanged ("DesignWidth", designWidth);
- }
- }
- public Measure DesignHeight {
- get { return designHeight; }
- set {
- if (designHeight == value)
- return;
- designHeight = value;
- NotifyValueChanged ("DesignHeight", designHeight);
- }
- }
-
-
- public List<Widget> GraphicTree {
- get { return new List<Widget> (new Widget[] {instance}); }
- }
-
- void GTView_SelectedItemChanged (object sender, SelectionChangeEventArgs e){
- SelectedItem = e.NewValue;
- }
- }
-}
-
diff --git a/Samples/CrowIDE/src/ProjectTree/ProjectFile.cs b/Samples/CrowIDE/src/ProjectTree/ProjectFile.cs
deleted file mode 100644
index 294a28f5..00000000
--- a/Samples/CrowIDE/src/ProjectTree/ProjectFile.cs
+++ /dev/null
@@ -1,323 +0,0 @@
-//
-// ProjectNodes.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Xml;
-
-namespace Crow.Coding {
- public class ProjectFile : ProjectItem {
- bool isOpened = false;
- DateTime accessTime;
- string source;
- string origSource;
- object selectedItem;
- int curLine, curColumn;
-
- internal ReaderWriterLockSlim srcEditMtx = new ReaderWriterLockSlim();
-
- public Dictionary<object, bool> RegisteredEditors = new Dictionary<object, bool>();
- List<String> undoStack = new List<string>();
- List<String> redoStack = new List<string>();
-
- public Crow.Command cmdSave, cmdSaveAs, cmdOpen, cmdClose, cmdUndo, cmdRedo;
-
- void initCommands (){
- cmdSave = new Crow.Command (new Action (() => Save ()))
- { Caption = "Save", Icon = new SvgPicture ("#CrowIDE.icons.save.svg"), CanExecute = false };
- cmdSaveAs = new Crow.Command (new Action (() => SaveAs ()))
- { Caption = "Save As ..", Icon = new SvgPicture ("#CrowIDE.icons.save.svg"), CanExecute = false };
- cmdOpen = new Crow.Command (new Action (() => Open ()))
- { 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 ("#CrowIDE.icons.open.svg"), CanExecute = false };
- cmdUndo = new Crow.Command (new Action (() => Undo (null)))
- { Caption = "Undo", Icon = new SvgPicture ("#CrowIDE.icons.undo.svg"), CanExecute = false };
- cmdRedo = new Crow.Command (new Action (() => Redo (null)))
- { Caption = "Redo", Icon = new SvgPicture ("#CrowIDE.icons.redo.svg"), CanExecute = false };
-
- Commands.Insert (0, cmdOpen);
- Commands.Insert (1, cmdSave);
- Commands.Insert (2, cmdSaveAs);
- Commands.Insert (3, cmdUndo);
- Commands.Insert (4, cmdRedo);
- Commands.Add (cmdClose);
- }
- public ProjectFile () {
- initCommands();
- }
- public ProjectFile (ProjectItem pi)
- : base (pi.Project, pi.node) {
- initCommands ();
- }
-
- public string ResourceID {
- get {
- return Type != ItemType.EmbeddedResource ? null :
- node.SelectSingleNode ("LogicalName") == null ?
- Project.Name + "." + Path.Replace ('/', '.') :
- LogicalName;
- }
- }
- public string LogicalName {
- get {
- return node.SelectSingleNode ("LogicalName")?.InnerText;
- }
- }
- public bool IsOpened {
- get { return isOpened; }
- set {
- if (isOpened == value)
- return;
- isOpened = value;
-
- cmdOpen.CanExecute = !isOpened;
- cmdClose.CanExecute = isOpened;
- cmdSave.CanExecute = isOpened && IsDirty;
-
- if (isOpened)
- Project.solution.OpenItem (this);
- else
- Project.solution.CloseItem (this);
-
- NotifyValueChanged ("IsOpened", isOpened);
- }
- }
-
- public void UnregisterEditor (object editor){
- lock(RegisteredEditors){
- RegisteredEditors.Remove (editor);
- }
- }
- public void RegisterEditor (object editor) {
- lock(RegisteredEditors){
- RegisteredEditors.Add (editor, false);
- }
- }
- public virtual void UpdateSource (object sender, string newSrc){
- System.Diagnostics.Debug.WriteLine ("update source by {0}", sender);
- Source = newSrc;
- signalOtherRegisteredEditors (sender);
- }
- public void SignalEditorOfType<T> (){
- lock (RegisteredEditors) {
- object[] keys = RegisteredEditors.Keys.ToArray ();
- foreach (object ed in keys) {
- T editor = (T)ed;
- if (editor == null)
- continue;
- RegisteredEditors [editor] = false;
- break;
- }
- }
- }
- protected void signalOtherRegisteredEditors (object sender) {
- lock (RegisteredEditors) {
- object[] keys = RegisteredEditors.Keys.ToArray ();
- foreach (object editor in keys) {
- if (editor != sender)
- RegisteredEditors [editor] = false;
- }
- }
- }
- public string Source {
- get {
- if (!IsOpened) {
- using (StreamReader sr = new StreamReader (AbsolutePath))
- source = sr.ReadToEnd ();
-
- } else {
- if (DateTime.Compare (
- accessTime,
- System.IO.File.GetLastWriteTime (AbsolutePath)) < 0)
- Console.WriteLine ("File has been modified outside CrowIDE");
- }
- return source;
- }
- set {
- if (source == value)
- return;
-
- srcEditMtx.EnterWriteLock ();
-
- undoStack.Add (source);
- cmdUndo.CanExecute = true;
- redoStack.Clear ();
- cmdRedo.CanExecute = false;
- source = value;
-
- NotifyValueChanged ("Source", source);
- NotifyValueChanged ("IsDirty", IsDirty);
-
- cmdSave.CanExecute = cmdSaveAs.CanExecute = IsDirty;
-
- srcEditMtx.ExitWriteLock ();
- }
- }
- public bool IsDirty {
- get { return source != origSource; }
- }
- public int CurrentColumn{
- get { return curColumn; }
- set {
- if (curColumn == value)
- return;
- curColumn = value;
- NotifyValueChanged ("CurrentColumn", curColumn);
- }
- }
- public int CurrentLine{
- get { return curLine; }
- set {
- if (curLine == value)
- return;
- curLine = value;
- NotifyValueChanged ("CurrentLine", curLine);
- }
- }
-
- public object SelectedItem {
- get { return selectedItem; }
- set {
- if (selectedItem == value)
- return;
- selectedItem= value;
- Project.solution.SelectedItemElement = value;
- NotifyValueChanged ("SelectedItem", selectedItem);
- }
- }
-
- public CopyToOutputState CopyToOutputDirectory {
- get {
- XmlNode xn = node.SelectSingleNode ("CopyToOutputDirectory");
- return xn == null ? CopyToOutputState.Never :
- (CopyToOutputState)Enum.Parse (typeof(CopyToOutputState), xn.InnerText, true);
- }
- }
-
- public virtual void Open () {
- accessTime = System.IO.File.GetLastWriteTime (AbsolutePath);
- using (StreamReader sr = new StreamReader (AbsolutePath)) {
- source = sr.ReadToEnd ();
- }
- origSource = source;
- IsOpened = true;
- NotifyValueChanged ("IsDirty", false);
- }
- public virtual void Save () {
- if (!IsDirty)
- return;
- using (StreamWriter sw = new StreamWriter (AbsolutePath)) {
- sw.Write (source);
- }
- origSource = source;
- NotifyValueChanged ("IsDirty", false);
- }
- public virtual void SaveAs () {
- if (!IsDirty)
- return;
- using (StreamWriter sw = new StreamWriter (AbsolutePath)) {
- sw.Write (source);
- }
- origSource = source;
- NotifyValueChanged ("IsDirty", false);
- }
- public void Close () {
- origSource = source = null;
- IsOpened = false;
- }
- public void Undo(object sender){
- undo();
- signalOtherRegisteredEditors (sender);
- }
- public void Redo(object sender){
- redo();
- signalOtherRegisteredEditors (sender);
- }
-
- void undo () {
- if (undoStack.Count == 0)
- return;
-
- srcEditMtx.EnterWriteLock ();
- string step = undoStack [undoStack.Count -1];
- redoStack.Add (source);
- cmdRedo.CanExecute = true;
- undoStack.RemoveAt(undoStack.Count -1);
-
- source = step;
-
- NotifyValueChanged ("Source", source);
- NotifyValueChanged ("IsDirty", IsDirty);
- cmdSave.CanExecute = IsDirty;
-
- if (undoStack.Count == 0)
- cmdUndo.CanExecute = false;
- srcEditMtx.ExitWriteLock ();
- }
-
- void redo () {
- if (redoStack.Count == 0)
- return;
- srcEditMtx.EnterWriteLock ();
- string step = redoStack [redoStack.Count -1];
- undoStack.Add (source);
- cmdUndo.CanExecute = true;
- redoStack.RemoveAt(redoStack.Count -1);
- source = step;
- NotifyValueChanged ("Source", source);
- NotifyValueChanged ("IsDirty", IsDirty);
- cmdSave.CanExecute = IsDirty;
-
- if (redoStack.Count == 0)
- cmdRedo.CanExecute = false;
- srcEditMtx.ExitWriteLock ();
-
- }
-
- public void onDoubleClick (object sender, MouseButtonEventArgs e){
- if (IsOpened)
- return;
- Open ();
- }
-
- public void onClick (object sender, MouseButtonEventArgs e){
- IsSelected = true;
- }
- public void OnQueryClose (object sender, EventArgs e){
- if (IsDirty) {
- MessageBox mb = MessageBox.ShowModal (CrowIDE.MainIFace,
- MessageBox.Type.YesNoCancel, $"{DisplayName} has unsaved changes.\nSave it now?");
- mb.Yes += (object _sender, EventArgs _e) => { Save (); Close (); };
- mb.No += (object _sender, EventArgs _e) => Close();
- } else
- Close ();
- }
- }
-}
-
diff --git a/Samples/CrowIDE/src/ProjectTree/ProjectItem.cs b/Samples/CrowIDE/src/ProjectTree/ProjectItem.cs
deleted file mode 100644
index afa3e3ed..00000000
--- a/Samples/CrowIDE/src/ProjectTree/ProjectItem.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// ProjectNodes.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml;
-using System.IO;
-using Crow;
-using System.Threading;
-
-namespace Crow.Coding
-{
- public class ProjectItem : ProjectNode {
- #region CTOR
- public ProjectItem() {}
- public ProjectItem (Project project, XmlNode _node) : base (project){
- node = _node;
- }
- #endregion
-
- public XmlNode node;
-
- public override Picture Icon {
- get {
- switch (Extension)
- {
- case ".cs":
- return new SvgPicture("#CrowIDE.icons.cs-file.svg");
- case ".crow":
- return new SvgPicture("#CrowIDE.icons.xml-file.svg");
- case ".xml":
- return new SvgPicture("#CrowIDE.icons.xml-file.svg");
- default:
- return base.Icon;
- }
- }
- }
-
- public string Extension {
- get { return System.IO.Path.GetExtension (Path); }
- }
- public string Path {
- get {
- return node.Attributes["Include"]?.Value.Replace('\\','/');
- }
- }
- public string AbsolutePath {
- get {
- return System.IO.Path.Combine (Project.RootDir, Path);
- }
- }
- public override ItemType Type {
- get {
- return (ItemType)Enum.Parse (typeof(ItemType), node.Name, true);
- }
- }
- public override string DisplayName {
- get {
- return Type == ItemType.Reference ?
- Path :
- Path.Split ('/').LastOrDefault();
- }
- }
- public string HintPath {
- get { return node.SelectSingleNode ("HintPath")?.InnerText; }
- }
-
- public override bool IsSelected {
- get {
- return isSelected;
- }
- set {
- if (value == isSelected)
- return;
-
- isSelected = value;
-
- NotifyValueChanged ("IsSelected", isSelected);
-
- if (isSelected) {
- Project.solution.SelectedItem = this;
- Project.IsExpanded = true;
- ProjectNode pn = Parent;
- while (pn != null) {
- pn.IsExpanded = true;
- pn = pn.Parent;
- }
- }
- }
- }
- }
-}
-
diff --git a/Samples/CrowIDE/src/ProjectTree/ProjectNodes.cs b/Samples/CrowIDE/src/ProjectTree/ProjectNodes.cs
deleted file mode 100644
index bafb9cbd..00000000
--- a/Samples/CrowIDE/src/ProjectTree/ProjectNodes.cs
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-// ProjectNodes.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml;
-using System.IO;
-using Crow;
-using System.Threading;
-
-namespace Crow.Coding
-{
- public enum ItemType {
- ReferenceGroup,
- Reference,
- ProjectReference,
- VirtualGroup,
- Folder,
- None,
- Compile,
- EmbeddedResource,
- }
- public enum CopyToOutputState {
- Never,
- Always,
- PreserveNewest
- }
- public class ProjectNode : IValueChange
- {
- #region IValueChange implementation
- public event EventHandler<ValueChangeEventArgs> ValueChanged;
- public virtual void NotifyValueChanged(string MemberName, object _value)
- {
- ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value));
- }
- #endregion
-
- #region CTOR
- public ProjectNode (Project project, ItemType _type, string _name) : this(project){
- type = _type;
- name = _name;
- initCommands ();
- }
- public ProjectNode (Project project){
- Project = project;
- initCommands ();
- }
- public ProjectNode (){
- initCommands ();
- }
- #endregion
-
- void initCommands () {
- Commands = new List<Crow.Command> ();
- }
-
- ProjectNode parent;
- bool isExpanded;
- protected bool isSelected;
- ItemType type;
- string name;
- List<ProjectNode> childNodes = new List<ProjectNode>();
-
- public Project Project;
- public List<Crow.Command> Commands;//list of command available for that node
-
- public virtual Crow.Picture Icon {
- get {
- switch (Type) {
- case ItemType.Reference:
- return new SvgPicture ("#Crow.Icons.assembly.svg");
- case ItemType.ProjectReference:
- return new SvgPicture("#Crow.Icons.projectRef.svg");
- default:
- return new SvgPicture("#CrowIDE.icons.blank-file.svg");
- }
- }
- }
- public ProjectNode Parent {
- get { return parent; }
- set { parent = value; }
- }
- public virtual ItemType Type {
- get { return type; }
- }
- public virtual string DisplayName {
- get { return name; }
- }
- public List<ProjectNode> ChildNodes {
- get { return childNodes; }
- }
- public void AddChild (ProjectNode pn) {
- childNodes.Add(pn);
- pn.Parent = this;
- }
- public void RemoveChild (ProjectNode pn){
- pn.Parent = null;
- childNodes.Remove (pn);
- }
- public void SortChilds () {
- foreach (ProjectNode pn in childNodes)
- pn.SortChilds ();
- childNodes = childNodes.OrderBy(c=>c.Type).ThenBy(cn=>cn.DisplayName).ToList();
- }
-
- public bool IsExpanded
- {
- get { return isExpanded; }
- set
- {
- if (value == isExpanded)
- return;
- isExpanded = value;
- NotifyValueChanged ("IsExpanded", isExpanded);
- }
- }
- public virtual bool IsSelected
- {
- get { return isSelected; }
- set
- {
- if (value == isSelected)
- return;
-
- isSelected = value;
-
- NotifyValueChanged ("IsSelected", isSelected);
- }
- }
- public override string ToString ()
- {
- return DisplayName;
- }
- }
-}
-
diff --git a/Samples/CrowIDE/src/ProjectTree/ProjectReference.cs b/Samples/CrowIDE/src/ProjectTree/ProjectReference.cs
deleted file mode 100644
index 84870746..00000000
--- a/Samples/CrowIDE/src/ProjectTree/ProjectReference.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// ProjectNodes.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml;
-using System.IO;
-using Crow;
-using System.Threading;
-
-namespace Crow.Coding
-{
- public class ProjectReference : ProjectItem {
- public ProjectReference (ProjectItem pi) : base (pi.Project, pi.node){
- }
- public string ProjectGUID {
- get {
- return node.SelectSingleNode ("Project")?.InnerText;
- }
- }
- public override string DisplayName {
- get {
- return node.SelectSingleNode ("Name").InnerText;
- }
- }
- }
-}
-
diff --git a/Samples/CrowIDE/src/ProjectTree/StyleProjectItem.cs b/Samples/CrowIDE/src/ProjectTree/StyleProjectItem.cs
deleted file mode 100644
index 1de77cd7..00000000
--- a/Samples/CrowIDE/src/ProjectTree/StyleProjectItem.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// ProjectNodes.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml;
-using System.IO;
-using Crow;
-using System.Threading;
-
-namespace Crow.Coding
-{
- public class StyleProjectItem : ProjectFile
- {
- #region CTOR
- public StyleProjectItem (ProjectItem pi) : base (pi){
- }
- #endregion
-
- public override void UpdateSource (object sender, string newSrc)
- {
- base.UpdateSource (sender, newSrc);
- Project.solution.ReloadStyling ();
- }
- }
-}
-