[Monodevelop-patches-list] r2667 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Gui/Pads/ProjectPad Gui/Pads/SolutionPad Gui/Workbench/Layouts Services/Project
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Mon Jul 18 13:09:51 EDT 2005
Author: lluis
Date: 2005-07-18 13:09:50 -0400 (Mon, 18 Jul 2005)
New Revision: 2667
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/CombineNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/FolderNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFileNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolderNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectSolutionPad.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/SolutionPad.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TypeNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs
Log:
2005-07-18 Lluis Sanchez Gual <lluis at novell.com>
* Services/Project/ProjectService.cs: Don't fire CurrentProjectChanged
when setting CurrentProject to the same current project. The same
for CurrentSelectedCombineChanged.
* Gui/Workbench/Layouts/SdiWorkspaceLayout.cs: Removed duplicate
event subscription to tabControl.SwitchPage.
* Gui/Workbench/Layouts/SdiWorkspaceWindow.cs: There is no need to
fire the ActiveMdiChanged event in SetTitleEvent, since the active
window is not changing.
* Gui/Pads/SolutionPad/TypeNodeBuilder.cs: New optional override:
GetParentObject().
* Gui/Pads/SolutionPad/TreeViewPad.cs: Added an GetNodeAtObject which
provides a way of locating a node in the tree, even if the parent nodes
have not been expanded and filled.
* Gui/Pads/SolutionPad/SolutionPad.cs: Removed old code.
* Gui/Pads/ProjectPad/CombineNodeBuilder.cs:
* Gui/Pads/ProjectPad/FolderNodeBuilder.cs:
* Gui/Pads/ProjectPad/ProjectFileNodeBuilder.cs:
* Gui/Pads/ProjectPad/ProjectNodeBuilder.cs:
* Gui/Pads/ProjectPad/ProjectFolder.cs:
* Gui/Pads/ProjectPad/ProjectFolderNodeBuilder.cs:
Implement GetParentObject().
* Gui/Pads/ProjectPad/ProjectSolutionPad.cs: Select the active file in
the tree.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-07-18 17:09:50 UTC (rev 2667)
@@ -1,3 +1,32 @@
+2005-07-18 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Services/Project/ProjectService.cs: Don't fire CurrentProjectChanged
+ when setting CurrentProject to the same current project. The same
+ for CurrentSelectedCombineChanged.
+ * Gui/Workbench/Layouts/SdiWorkspaceLayout.cs: Removed duplicate
+ event subscription to tabControl.SwitchPage.
+ * Gui/Workbench/Layouts/SdiWorkspaceWindow.cs: There is no need to
+ fire the ActiveMdiChanged event in SetTitleEvent, since the active
+ window is not changing.
+
+ * Gui/Pads/SolutionPad/TypeNodeBuilder.cs: New optional override:
+ GetParentObject().
+ * Gui/Pads/SolutionPad/TreeViewPad.cs: Added an GetNodeAtObject which
+ provides a way of locating a node in the tree, even if the parent nodes
+ have not been expanded and filled.
+ * Gui/Pads/SolutionPad/SolutionPad.cs: Removed old code.
+
+ * Gui/Pads/ProjectPad/CombineNodeBuilder.cs:
+ * Gui/Pads/ProjectPad/FolderNodeBuilder.cs:
+ * Gui/Pads/ProjectPad/ProjectFileNodeBuilder.cs:
+ * Gui/Pads/ProjectPad/ProjectNodeBuilder.cs:
+ * Gui/Pads/ProjectPad/ProjectFolder.cs:
+ * Gui/Pads/ProjectPad/ProjectFolderNodeBuilder.cs:
+ Implement GetParentObject().
+
+ * Gui/Pads/ProjectPad/ProjectSolutionPad.cs: Select the active file in
+ the tree.
+
2005-07-18 Lluis Sanchez Gual <lluis at novell.com>
* Internal/Project/Combine/Combine.cs: Make sure StartupEntry returns
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/CombineNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/CombineNodeBuilder.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/CombineNodeBuilder.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -101,6 +101,11 @@
return ((Combine) dataObject).Entries.Count > 0;
}
+ public override object GetParentObject (object dataObject)
+ {
+ return ((CombineEntry) dataObject).ParentCombine;
+ }
+
public override int CompareObjects (ITreeNavigator thisNode, ITreeNavigator otherNode)
{
if (otherNode.DataItem is Combine)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/FolderNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/FolderNodeBuilder.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/FolderNodeBuilder.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -61,7 +61,7 @@
builder.AddChild (file);
foreach (string folder in folders)
- builder.AddChild (new ProjectFolder (folder, project));
+ builder.AddChild (new ProjectFolder (folder, project, dataObject));
}
void GetFolderContent (Project project, string folder, out ProjectFileCollection files, out ArrayList folders)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFileNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFileNodeBuilder.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFileNodeBuilder.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -67,6 +67,16 @@
icon = Context.GetIcon (Runtime.Gui.Icons.GetImageForFile (file.FilePath));
}
+ public override object GetParentObject (object dataObject)
+ {
+ ProjectFile file = (ProjectFile) dataObject;
+ string dir = Path.GetDirectoryName (file.FilePath);
+ if (dir == file.Project.BaseDirectory)
+ return file.Project;
+ else
+ return new ProjectFolder (dir, file.Project, null);
+ }
+
public override int CompareObjects (ITreeNavigator thisNode, ITreeNavigator otherNode)
{
if (otherNode.DataItem is ProjectFolder)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolder.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolder.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -39,9 +39,15 @@
{
string absolutePath;
Project project;
+ object parent;
- public ProjectFolder (string absolutePath, Project project)
+ public ProjectFolder (string absolutePath, Project project): this (absolutePath, project, null)
{
+ }
+
+ public ProjectFolder (string absolutePath, Project project, object parent)
+ {
+ this.parent = parent;
this.project = project;
this.absolutePath = absolutePath;
Runtime.FileService.FileRenamed += new FileEventHandler (OnFileRenamed);
@@ -59,6 +65,21 @@
get { return project; }
}
+ public object Parent {
+ get {
+ if (parent != null)
+ return parent;
+ if (project == null)
+ return null;
+
+ string dir = System.IO.Path.GetDirectoryName (absolutePath);
+ if (dir == project.BaseDirectory)
+ return project;
+ else
+ return new ProjectFolder (dir, project, null);
+ }
+ }
+
public override bool Equals (object other)
{
ProjectFolder f = other as ProjectFolder;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolderNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolderNodeBuilder.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolderNodeBuilder.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -97,7 +97,7 @@
void OnFolderRenamed (object sender, FileEventArgs e)
{
ProjectFolder f = (ProjectFolder) sender;
- ITreeBuilder tb = Context.GetTreeBuilder (new ProjectFolder (e.SourceFile, f.Project));
+ ITreeBuilder tb = Context.GetTreeBuilder (new ProjectFolder (e.SourceFile, f.Project, null));
if (tb != null) tb.Update ();
}
@@ -121,6 +121,12 @@
icon = folderOpenIcon;
closedIcon = folderClosedIcon;
}
+
+ public override object GetParentObject (object dataObject)
+ {
+ ProjectFolder folder = (ProjectFolder) dataObject;
+ return folder.Parent;
+ }
}
public class ProjectFolderCommandHandler: FolderCommandHandler
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectNodeBuilder.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectNodeBuilder.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -125,6 +125,11 @@
return true;
}
+ public override object GetParentObject (object dataObject)
+ {
+ return ((CombineEntry) dataObject).ParentCombine;
+ }
+
void OnAddFile (object sender, ProjectFileEventArgs e)
{
AddFile (e.ProjectFile, e.Project);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectSolutionPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectSolutionPad.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectSolutionPad.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -37,6 +37,11 @@
{
public class ProjectSolutionPad: SolutionPad
{
+ public ProjectSolutionPad ()
+ {
+ Runtime.Gui.Workbench.ActiveWorkbenchWindowChanged += new EventHandler (OnWindowChanged);
+ }
+
protected override void OnSelectionChanged (object sender, EventArgs args)
{
base.OnSelectionChanged (sender, args);
@@ -55,6 +60,24 @@
Runtime.ProjectService.CurrentSelectedProject = null;
Runtime.ProjectService.CurrentSelectedCombine = null;
}
+
+ void OnWindowChanged (object ob, EventArgs args)
+ {
+ IWorkbenchWindow win = Runtime.Gui.Workbench.ActiveWorkbenchWindow;
+ if (win != null && win.ViewContent != null && win.ViewContent.Project != null) {
+ string file = win.ViewContent.ContentName;
+ if (file != null) {
+ ProjectFile pf = win.ViewContent.Project.ProjectFiles.GetFile (win.ViewContent.ContentName);
+ if (pf != null) {
+ ITreeNavigator nav = GetNodeAtObject (pf, true);
+ if (nav != null) {
+ nav.ExpandToNode ();
+ nav.Selected = true;
+ }
+ }
+ }
+ }
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/SolutionPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/SolutionPad.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/SolutionPad.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -41,7 +41,6 @@
{
Runtime.ProjectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnOpenCombine));
Runtime.ProjectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCloseCombine));
- WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += new EventHandler(ActiveWindowChanged);
Runtime.Properties.PropertyChanged += (PropertyEventHandler) Runtime.DispatchService.GuiDispatch (new PropertyEventHandler (TrackPropertyChange));
}
@@ -52,14 +51,6 @@
}
}
- void ActiveWindowChanged(object sender, EventArgs e)
- {
- if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
-// string fileName = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName;
- // TODO
- }
- }
-
protected virtual void OnOpenCombine (object sender, CombineEventArgs e)
{
LoadTree (e.Combine);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -367,8 +367,33 @@
public ITreeNavigator GetNodeAtObject (object dataObject)
{
+ return GetNodeAtObject (dataObject, false);
+ }
+
+ public ITreeNavigator GetNodeAtObject (object dataObject, bool createTreeBranch)
+ {
object it = nodeHash [dataObject];
- if (it == null) return null;
+ if (it == null) {
+ if (createTreeBranch) {
+ TypeNodeBuilder tnb = GetTypeNodeBuilder (dataObject.GetType());
+ if (tnb == null) return null;
+
+ object parent = tnb.GetParentObject (dataObject);
+ if (parent == null) return null;
+
+ ITreeNavigator pnav = GetNodeAtObject (parent, true);
+ if (pnav == null) return null;
+
+ pnav.MoveToFirstChild ();
+
+ // The child should be now in the tree. Try again.
+ it = nodeHash [dataObject];
+ if (it == null)
+ return null;
+ } else
+ return null;
+ }
+
if (it is Gtk.TreeIter[])
return new TreeNodeNavigator (this, ((Gtk.TreeIter[])it)[0]);
else
@@ -631,6 +656,13 @@
nav.RestoreState (state);
}
+ TypeNodeBuilder GetTypeNodeBuilder (Type type)
+ {
+ NodeBuilder[] chain = GetBuilderChain (type);
+ if (chain == null) return null;
+ return (TypeNodeBuilder) chain [0];
+ }
+
NodeBuilder[] GetBuilderChain (Type type)
{
NodeBuilder[] chain = builderChains [type] as NodeBuilder[];
@@ -1149,7 +1181,7 @@
return tree.Selection.IterIsSelected (currentIter);
}
set {
- if (value) {
+ if (value != Selected) {
Gtk.TreeIter parent = currentIter;
while (store.IterParent (out parent, parent)) {
Gtk.TreePath path = store.GetPath (parent);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TypeNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TypeNodeBuilder.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TypeNodeBuilder.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -40,6 +40,13 @@
public abstract string GetNodeName (ITreeNavigator thisNode, object dataObject);
+ // Optional override that should return the parent object of the given
+ // object.
+ public virtual object GetParentObject (object dataObject)
+ {
+ return null;
+ }
+
// Return -1 if thisDataObject is less than otherDataObject, 0 if equal, 1 if greater
// Return DefaultSort is sort is undefined or you want to use default sorting rules
// (by default, it compares the node name).
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -127,10 +127,6 @@
AddPad (content, content.DefaultPlacement);
}
- // FIXME: GTKize
- tabControl.SwitchPage += new SwitchPageHandler(ActiveMdiChanged);
- //tabControl.SelectionChanged += new EventHandler(ActiveMdiChanged);
-
CreateDefaultLayout();
//RedrawAllComponents();
wbWindow.Show ();
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -123,6 +123,7 @@
content.DirtyChanged += new EventHandler(SetTitleEvent);
content.BeforeSave += new EventHandler(BeforeSave);
content.ContentChanged += new EventHandler (OnContentChanged);
+
ShadowType = ShadowType.None;
Add (content.Control);
content.Control.Show ();
@@ -192,7 +193,6 @@
if (newTitle != Title) {
Title = newTitle;
}
- WorkbenchSingleton.Workbench.WorkbenchLayout.ActiveMdiChanged (null, null);
}
public void OnContentChanged (object o, EventArgs e)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs 2005-07-18 15:04:49 UTC (rev 2666)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs 2005-07-18 17:09:50 UTC (rev 2667)
@@ -59,9 +59,11 @@
return currentProject;
}
set {
- System.Diagnostics.Debug.Assert(openCombine != null);
- currentProject = value;
- OnCurrentProjectChanged(new ProjectEventArgs(currentProject));
+ if (value != currentProject) {
+ System.Diagnostics.Debug.Assert(openCombine != null);
+ currentProject = value;
+ OnCurrentProjectChanged(new ProjectEventArgs(currentProject));
+ }
}
}
@@ -70,9 +72,11 @@
return currentCombine;
}
set {
- System.Diagnostics.Debug.Assert(openCombine != null);
- currentCombine = value;
- OnCurrentSelectedCombineChanged(new CombineEventArgs(currentCombine));
+ if (value != currentCombine) {
+ System.Diagnostics.Debug.Assert(openCombine != null);
+ currentCombine = value;
+ OnCurrentSelectedCombineChanged(new CombineEventArgs(currentCombine));
+ }
}
}
More information about the Monodevelop-patches-list
mailing list