[Monodevelop-patches-list] r1104 - in trunk/MonoDevelop: . data/resources/glade src/Main/Base/Gui/Dialogs
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Thu Mar 4 01:29:05 EST 2004
Author: jba
Date: 2004-03-04 01:29:05 -0500 (Thu, 04 Mar 2004)
New Revision: 1104
Modified:
trunk/MonoDevelop/ChangeLog
trunk/MonoDevelop/data/resources/glade/Base.glade
trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ProjectOptionsDialog.cs
trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/TreeViewOptions.cs
Log:
added project configuration context menu - only rename doesn't work
Modified: trunk/MonoDevelop/ChangeLog
===================================================================
--- trunk/MonoDevelop/ChangeLog 2004-03-04 05:30:41 UTC (rev 1103)
+++ trunk/MonoDevelop/ChangeLog 2004-03-04 06:29:05 UTC (rev 1104)
@@ -1,3 +1,8 @@
+2004-03-04 John BouAntoun <jba-mono at optusnet.com.au>
+ * src/Main/Base/Gui/Dialogs/ProjectOptionsDialog.cs : enabled context menu's for project configurations
+ * src/Main/Base/Gui/Dialogs/TreeViewOptions.cs : made SelectNode virtual so ProjectOptionsDialog could override
+ * data/resources/glade/Base.glade : fiddled with TreeviewOptions Dialog
+
2004-03-04 Daniel Kornhauser <dkor at alum.mit.edu>
* data/resources/glade/CSharp.glade : created glade file with CodeGenerationPanel UI
Modified: trunk/MonoDevelop/data/resources/glade/Base.glade
===================================================================
--- trunk/MonoDevelop/data/resources/glade/Base.glade 2004-03-04 05:30:41 UTC (rev 1103)
+++ trunk/MonoDevelop/data/resources/glade/Base.glade 2004-03-04 06:29:05 UTC (rev 1104)
@@ -68,7 +68,7 @@
<property name="spacing">7</property>
<child>
- <widget class="GtkVBox" id="vbox31">
+ <widget class="GtkVBox" id="TreeViewContainer">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
@@ -96,7 +96,7 @@
</child>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow3">
+ <widget class="GtkScrolledWindow" id="TreeViewScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@@ -113,6 +113,7 @@
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
+ <signal name="button_release_event" handler="OnButtonRelease" last_modification_time="Thu, 04 Mar 2004 06:11:16 GMT"/>
</widget>
</child>
</widget>
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ProjectOptionsDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ProjectOptionsDialog.cs 2004-03-04 05:30:41 UTC (rev 1103)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ProjectOptionsDialog.cs 2004-03-04 06:29:05 UTC (rev 1104)
@@ -52,6 +52,8 @@
//
AddConfigurationNodes();
+ //TreeView.ButtonReleaseEvent += new EventHandler (OnButtonRelease);
+
SelectFirstNode ();
}
@@ -109,13 +111,11 @@
// add the child nodes to this new config
AddNodes(properties, newNode, configurationNode.BuildChildItems(newConfig));
- SelectSpecificNode(newNode);
-
- // FIXME: how to set the new nodes Label as editable ?
- /*
- ((TreeView)ControlDictionary["optionsTreeView"]).SelectedNode = newNode;
- ((TreeView)ControlDictionary["optionsTreeView"]).LabelEdit = true;
- */
+ // select the new config's first child
+ Gtk.TreeIter newChild;
+ if (treeStore.IterNthChild(out newChild, newNode, 0)) {
+ SelectSpecificNode(newChild);
+ }
}
public void RemoveProjectConfiguration()
@@ -203,25 +203,60 @@
static string configNodeMenu = "/SharpDevelop/Workbench/ProjectOptions/ConfigNodeMenu";
static string selectConfigNodeMenu = "/SharpDevelop/Workbench/ProjectOptions/SelectedConfigMenu";
- /*void TreeViewMouseUp(object sender, MouseEventArgs e)
+ #region context menu presentation methods
+
+ // override select node to allow config and config child nodes (braches) to be selected
+ protected override void SelectNode(object sender, EventArgs e)
{
- TreeNode clickedNode = ((TreeView)ControlDictionary["optionsTreeView"]).GetNodeAt(e.X, e.Y);
-
- if (e.Button == MouseButtons.Right) {
- MenuService menuService = (MenuService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(MenuService));
- if (clickedNode == configurationTreeNode) {
- b = false;
- ((TreeView)ControlDictionary["optionsTreeView"]).SelectedNode = clickedNode;
- b = true;
- menuService.ShowContextMenu(this, configNodeMenu, this, e.X, e.Y);
+ Gtk.TreeModel mdl;
+ Gtk.TreeIter iter;
+ if (TreeView.Selection.GetSelected (out mdl, out iter)) {
+ if (treeStore.IterHasChild (iter)) {
+ // only interested if a row has been selected
+ Gtk.TreePath path = TreeView.Model.GetPath(iter);
+ Gtk.TreePath configPath = TreeView.Model.GetPath(configurationTreeNode);
+ // see if the itter is a config iter or it's direct child
+ // if so don't force focus onto child node just yet
+ if (!iter.Equals(configurationTreeNode) &&
+ !((path.Indices[0] == configPath.Indices[0]) && (path.Depth - configPath.Depth) == 1)) {
+ Gtk.TreeIter new_iter;
+ treeStore.IterChildren (out new_iter, iter);
+ Gtk.TreePath new_path = treeStore.GetPath (new_iter);
+ TreeView.ExpandToPath (new_path);
+ TreeView.Selection.SelectPath (new_path);
+ }
+ } else {
+ SetOptionPanelTo ((IDialogPanelDescriptor)treeStore.GetValue (iter, 1));
}
- if (clickedNode.Parent == configurationTreeNode) {
- b = false;
- ((TreeView)ControlDictionary["optionsTreeView"]).SelectedNode = clickedNode;
- b = true;
- menuService.ShowContextMenu(this, selectConfigNodeMenu, this, e.X, e.Y);
+ }
+ }
+
+ protected virtual void OnButtonRelease(object sender, Gtk.ButtonReleaseEventArgs e)
+ {
+ // only interested in right mouse button click
+ if (e.Event.Button == 3) {
+
+ // only interested if a row has been selected
+ Gtk.TreeModel mdl;
+ Gtk.TreeIter iter;
+ Gtk.TreePath configPath = TreeView.Model.GetPath(configurationTreeNode);
+ if (TreeView.Selection.GetSelected (out mdl, out iter)) {
+ Gtk.TreePath path = TreeView.Model.GetPath(iter);
+
+ // now see if the iter is the configuration root node iter
+ if (iter.Equals(configurationTreeNode)) {
+ MenuService menuService = (MenuService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(MenuService));
+ menuService.ShowContextMenu(this, configNodeMenu, TreeView);
+ } else if (path.Indices[0] == configPath.Indices[0] && (path.Depth - configPath.Depth) == 1) {
+ // now see if it's a specific configuration node (i.e. the configuration root node is it's parent
+ MenuService menuService = (MenuService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(MenuService));
+ menuService.ShowContextMenu(this, selectConfigNodeMenu, TreeView);
+ }
+
}
}
- }*/
+ }
+
+ #endregion
}
}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/TreeViewOptions.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/TreeViewOptions.cs 2004-03-04 05:30:41 UTC (rev 1103)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/TreeViewOptions.cs 2004-03-04 06:29:05 UTC (rev 1104)
@@ -15,6 +15,8 @@
using ICSharpCode.Core.AddIns.Codons;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
+using ICSharpCode.SharpDevelop.Services;
+
namespace ICSharpCode.SharpDevelop.Gui.Dialogs {
/// <summary>
@@ -29,6 +31,8 @@
protected Gtk.TreeStore treeStore;
[Glade.Widget] protected Gtk.TreeView TreeView;
+ [Glade.Widget] protected Gtk.ScrolledWindow TreeViewScrolledWindow;
+ [Glade.Widget] protected Gtk.VBox TreeViewContainer;
[Glade.Widget] Gtk.Label optionTitle;
[Glade.Widget] Gtk.Notebook mainBook;
[Glade.Widget] Gtk.Image panelImage;
@@ -106,7 +110,7 @@
}
}
- protected void SelectNode(object sender, EventArgs e)
+ protected virtual void SelectNode(object sender, EventArgs e)
{
Gtk.TreeModel mdl;
Gtk.TreeIter iter;
@@ -130,7 +134,10 @@
Gtk.TreePath new_path = treeStore.GetPath (iter);
TreeView.ExpandToPath (new_path);
TreeView.Selection.SelectPath (new_path);
- SetOptionPanelTo ((IDialogPanelDescriptor)treeStore.GetValue (iter, 1));
+ IDialogPanelDescriptor descriptor = treeStore.GetValue (iter, 1) as IDialogPanelDescriptor;
+ if (descriptor != null) {
+ SetOptionPanelTo (descriptor);
+ }
}
public TreeViewOptions (IProperties properties, IAddInTreeNode node)
@@ -172,5 +179,6 @@
{
TreeViewOptionDialog.Hide ();
}
+
}
}
More information about the Monodevelop-patches-list
mailing list