[Monodevelop-patches-list] r919 - in trunk/MonoDevelop: data/resources/glade src/Main/Base/Gui/Dialogs/OptionPanels
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sun Feb 15 13:47:16 EST 2004
Author: dkor
Date: 2004-02-15 13:47:16 -0500 (Sun, 15 Feb 2004)
New Revision: 919
Modified:
trunk/MonoDevelop/data/resources/glade/Base.glade
trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/ExternalToolPanel.cs
Log:
Glading of the ExternalToolPanel
Modified: trunk/MonoDevelop/data/resources/glade/Base.glade
===================================================================
--- trunk/MonoDevelop/data/resources/glade/Base.glade 2004-02-15 03:09:56 UTC (rev 918)
+++ trunk/MonoDevelop/data/resources/glade/Base.glade 2004-02-15 18:47:16 UTC (rev 919)
@@ -2413,4 +2413,536 @@
</child>
</widget>
+<widget class="GtkWindow" id="ExternalToolPanel">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">ExternalToolPanel</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox32">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox21">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_OUT</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="toolListBox">
+ <property name="width_request">200</property>
+ <property name="height_request">150</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="moveUpButton">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkButton" id="addButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-add</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="removeButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-remove</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label34">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="moveUpButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-go-up</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="moveDownButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-go-down</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label40">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table2">
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkEntry" id="titleTextBox">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="commandLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Command</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="titleLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Title</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">titleTextBox</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="argumentLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Arguments</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="workingDirLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Working Dir.</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table3">
+ <property name="visible">True</property>
+ <property name="n_rows">1</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">0</property>
+
+ <child>
+ <widget class="GtkEntry" id="argumentTextBox">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="argumentQuickInsertButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes"> > </property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table4">
+ <property name="visible">True</property>
+ <property name="n_rows">1</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">0</property>
+
+ <child>
+ <widget class="GtkEntry" id="workingDirTextBox">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="workingDirQuickInsertButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes"> > </property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table5">
+ <property name="visible">True</property>
+ <property name="n_rows">1</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">0</property>
+
+ <child>
+ <widget class="GtkEntry" id="commandTextBox">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="browseButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Browse</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox36">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="promptArgsCheckBox">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Prompt for Arguments</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="useOutputPadCheckBox">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Use _Output Window</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/ExternalToolPanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/ExternalToolPanel.cs 2004-02-15 03:09:56 UTC (rev 918)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/ExternalToolPanel.cs 2004-02-15 18:47:16 UTC (rev 919)
@@ -1,27 +1,50 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
+ // <file>
+ // <copyright see="prj:///doc/copyright.txt"/>
+ // <license see="prj:///doc/license.txt"/>
+ // <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+ // <version value="$version"/>
+ // </file>
-using System;
-using System.IO;
-using System.Collections;
-using Gtk;
+ using System;
+ using System.IO;
+ using System.Collections;
+ using Gtk;
+ using Gnome;
+ using MonoDevelop.Gui.Widgets;
-using ICSharpCode.SharpDevelop.Internal.ExternalTool;
-using ICSharpCode.Core.Properties;
-using ICSharpCode.Core.Services;
-using ICSharpCode.SharpDevelop.Services;
-using ICSharpCode.Core.AddIns.Codons;
+ using ICSharpCode.SharpDevelop.Internal.ExternalTool;
+ using ICSharpCode.Core.Properties;
+ using ICSharpCode.Core.Services;
+ using ICSharpCode.SharpDevelop.Services;
+ using ICSharpCode.Core.AddIns.Codons;
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels
-{
- public class ExternalToolPane : AbstractOptionPanel
- {
+ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels
+ {
+ public class ExternalToolPane: AbstractOptionPanel
+ {
+ ExternalToolPanelWidget widget;
- static string[,] argumentQuickInsertMenu = new string[,] {
+ public override void LoadPanelContents()
+ {
+ Console.WriteLine("Test0a");
+ widget = new ExternalToolPanelWidget ();
+ Console.WriteLine("Test0b");
+ Add (widget);
+ }
+
+ public override bool StorePanelContents()
+ {
+ Console.WriteLine("Entering StorePanelContents");
+ bool result = true;
+ Console.WriteLine("Entering StorePanelContents 2");
+ result = widget.Store();
+ Console.WriteLine("StorePanelContents {0}", result);
+ return result;
+ }
+
+ public class ExternalToolPanelWidget : GladeWidgetExtract
+ {
+ static string[,] argumentQuickInsertMenu = new string[,] {
{"${res:Dialog.Options.ExternalTool.QuickInsertMenu.FullItemPath}", "${ItemPath}"},
{"${res:Dialog.Options.ExternalTool.QuickInsertMenu.FullItemDirectory}", "${ItemDir}"},
{"${res:Dialog.Options.ExternalTool.QuickInsertMenu.ItemFileName}", "${ItemFileName}"},
@@ -44,7 +67,7 @@
{"-", ""},
{"${res:Dialog.Options.ExternalTool.QuickInsertMenu.SharpDevelopStartupPath}", "${StartupPath}"},
};
-
+
static string[,] workingDirInsertMenu = new string[,] {
{"${res:Dialog.Options.ExternalTool.QuickInsertMenu.FullItemDirectory}", "${ItemDir}"},
{"-", ""},
@@ -56,371 +79,367 @@
{"${res:Dialog.Options.ExternalTool.QuickInsertMenu.CombineDirectory}", "${CombineDir}"},
{"-", ""},
{"${res:Dialog.Options.ExternalTool.QuickInsertMenu.SharpDevelopStartupPath}", "${StartupPath}"},
- };
-
- // gtk controls
- ListStore toolListBoxStore;
- TreeView toolListBox;
- Entry titleTextBox;
- Entry commandTextBox;
- Entry argumentTextBox;
- Entry workingDirTextBox;
- CheckButton promptArgsCheckBox;
- CheckButton useOutputPadCheckBox;
- Label titleLabel;
- Label argumentLabel;
- Label commandLabel;
- Label workingDirLabel;
- Button browseButton;
- Button argumentQuickInsertButton;
- Button workingDirQuickInsertButton;
- Button moveUpButton;
- Button moveDownButton;
- Button addButton;
- Button removeButton;
-
- // these are the control names which are enabled/disabled depending if tool is selected
- Widget[] dependendControls;
-
- // needed for treeview listbox
- int toolListBoxItemCount = 0;
-
- // Services
- FileUtilityService FileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
- StringParserService StringParserService = (StringParserService)ServiceManager.Services.GetService (typeof (StringParserService));
- PropertyService PropertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
- MessageService MessageService = (MessageService)ServiceManager.Services.GetService(typeof(MessageService));
- MenuService MenuService = (MenuService)ServiceManager.Services.GetService(typeof(MenuService));
-
- public override void LoadPanelContents()
- {
- // set up the form controls instance
- SetupPanelInstance();
-
- // add each tool to the treeStore
- foreach (object o in ToolLoader.Tool) {
+ };
+ // Services
+ FileUtilityService FileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(
+ typeof(FileUtilityService));
+ StringParserService StringParserService = (StringParserService)ServiceManager.Services.GetService (
+ typeof (StringParserService));
+ PropertyService PropertyService = (PropertyService)ServiceManager.Services.GetService(
+ typeof(PropertyService));
+ MessageService MessageService = (MessageService)ServiceManager.Services.GetService(
+ typeof(MessageService));
+ MenuService MenuService = (MenuService)ServiceManager.Services.GetService(
+ typeof(MenuService));
+
+ // gtk controls
+ [Glade.Widget] ListStore toolListBoxStore;
+ [Glade.Widget] Gtk.TreeView toolListBox;
+ [Glade.Widget] Gtk.Entry titleTextBox;
+ [Glade.Widget] Gtk.Entry commandTextBox;
+ [Glade.Widget] Gtk.Entry argumentTextBox;
+ [Glade.Widget] Gtk.Entry workingDirTextBox;
+ [Glade.Widget] CheckButton promptArgsCheckBox;
+ [Glade.Widget] CheckButton useOutputPadCheckBox;
+ [Glade.Widget] Label titleLabel;
+ [Glade.Widget] Label argumentLabel;
+ [Glade.Widget] Label commandLabel;
+ [Glade.Widget] Label workingDirLabel;
+ [Glade.Widget] Button browseButton;
+ [Glade.Widget] Button argumentQuickInsertButton;
+ [Glade.Widget] Button workingDirQuickInsertButton;
+ [Glade.Widget] Button moveUpButton;
+ [Glade.Widget] Button moveDownButton;
+ [Glade.Widget] Button addButton;
+ [Glade.Widget] Button removeButton;
+
+ // these are the control names which are enabled/disabled depending if tool is selected
+ Widget[] dependendControls;
+
+ // needed for treeview listbox
+ int toolListBoxItemCount = 0;
+
+ public ExternalToolPanelWidget () : base ("Base.glade", "ExternalToolPanel")
+ {
+ Console.WriteLine("Test1");
+ // instantiate controls
+ toolListBoxStore = new ListStore(typeof(string), typeof(ExternalTool));
+ promptArgsCheckBox.Label = StringParserService.Parse(
+ "${res:Dialog.Options.ExternalTool.PromptForArgsCheckBox}");
+ useOutputPadCheckBox.Label = StringParserService.Parse(
+ "${res:Dialog.Options.ExternalTool.UseOutputWindow}");
+ titleLabel.TextWithMnemonic = StringParserService.Parse(
+ "${res:Dialog.Options.ExternalTool.TitleLabel}");
+ argumentLabel.TextWithMnemonic = StringParserService.Parse(
+ "${res:Dialog.Options.ExternalTool.ArgumentLabel}");
+ commandLabel.TextWithMnemonic = StringParserService.Parse(
+ "${res:Dialog.Options.ExternalTool.CommandLabel}");
+ workingDirLabel.TextWithMnemonic = StringParserService.Parse(
+ "${res:Dialog.Options.ExternalTool.WorkingDirLabel}");
+// moveUpButton.Label = StringParserService.Parse(
+// "${res:Dialog.Options.ExternalTool.MoveUpButton}");
+// moveUpButton.UseUnderline = true;
+// moveDownButton.Label = StringParserService.Parse(
+// "${res:Dialog.Options.ExternalTool.MoveDownButton}");
+// moveDownButton.UseUnderline = true;
+// removeButton.Label = StringParserService.Parse(
+// "${res:Global.RemoveButtonText}");
+// removeButton.UseUnderline = true;
+// addButton.Label = StringParserService.Parse(
+// "${res:Global.AddButtonText}");
+// addButton.UseUnderline = true;
+
+ dependendControls = new Widget[] {
+ titleTextBox, commandTextBox, argumentTextBox,
+ workingDirTextBox, promptArgsCheckBox, useOutputPadCheckBox,
+ titleLabel, argumentLabel, commandLabel,
+ workingDirLabel, browseButton, argumentQuickInsertButton,
+ workingDirQuickInsertButton, moveUpButton, moveDownButton};
+
+
+ foreach (object o in ToolLoader.Tool) {
toolListBoxStore.AppendValues(((ExternalTool)o).MenuCommand, (ExternalTool) o);
toolListBoxItemCount ++;
- }
-
- toolListBox.Reorderable = false;
- toolListBox.HeadersVisible = true;
- toolListBox.Selection.Mode = SelectionMode.Multiple;
- toolListBox.Model = toolListBoxStore;
-
- toolListBox.AppendColumn (
- StringParserService.Parse("${res:Dialog.Options.ExternalTool.ToolsLabel}"),
- new CellRendererText (),
- "text",
- 0);
-
-
- MenuService.CreateQuickInsertMenu(argumentTextBox,
- argumentQuickInsertButton,
- argumentQuickInsertMenu);
-
- MenuService.CreateQuickInsertMenu(workingDirTextBox,
- workingDirQuickInsertButton,
- workingDirInsertMenu);
-
- toolListBox.Selection.Changed += new EventHandler(selectEvent);
-
- removeButton.Clicked += new EventHandler(removeEvent);
- addButton.Clicked += new EventHandler(addEvent);
- moveUpButton.Clicked += new EventHandler(moveUpEvent);
- moveDownButton.Clicked += new EventHandler(moveDownEvent);
-
- browseButton.Clicked += new EventHandler(browseEvent);
-
- selectEvent(this, EventArgs.Empty);
- }
-
- public override bool StorePanelContents()
- {
- ArrayList newlist = new ArrayList();
- TreeIter first;
-
- if(toolListBox.Model.GetIterFirst(out first))
- {
- TreeIter current = first;
-
- do {
- // loop through items in the tree
-
- ExternalTool tool = toolListBox.Model.GetValue(current, 1) as ExternalTool;
- if (!FileUtilityService.IsValidFileName(tool.Command)) {
- MessageService.ShowError(String.Format("The command of tool \"{0}\" is invalid.", tool.MenuCommand));
- return false;
- }
- if ((tool.InitialDirectory != "") && (!FileUtilityService.IsValidFileName(tool.InitialDirectory))) {
- MessageService.ShowError(String.Format("The working directory of tool \"{0}\" is invalid.", tool.MenuCommand));
- return false;
- }
- newlist.Add(tool);
- } while(toolListBox.Model.IterNext(out current));
- }
- ToolLoader.Tool = newlist;
- ToolLoader.SaveTools();
- return true;
- }
-
- void SetupPanelInstance()
- {
- // instantiate controls
- toolListBoxStore = new ListStore(typeof(string), typeof(ExternalTool));
- toolListBox = new TreeView();
- toolListBox.SetSizeRequest(200, 150);
- titleTextBox = new Entry();
- commandTextBox = new Entry();
- argumentTextBox = new Entry();
- workingDirTextBox = new Entry();
- promptArgsCheckBox = new CheckButton(StringParserService.Parse("${res:Dialog.Options.ExternalTool.PromptForArgsCheckBox}"));
- useOutputPadCheckBox = new CheckButton(StringParserService.Parse("${res:Dialog.Options.ExternalTool.UseOutputWindow}"));
- titleLabel = new Label(StringParserService.Parse("${res:Dialog.Options.ExternalTool.TitleLabel}"));
- argumentLabel = new Label(StringParserService.Parse("${res:Dialog.Options.ExternalTool.ArgumentLabel}"));
- commandLabel = new Label(StringParserService.Parse("${res:Dialog.Options.ExternalTool.CommandLabel}"));
- workingDirLabel = new Label(StringParserService.Parse("${res:Dialog.Options.ExternalTool.WorkingDirLabel}"));
- browseButton = new Button("...");
- argumentQuickInsertButton = new Button(">");
- workingDirQuickInsertButton = new Button(">");
- moveUpButton = new Button(StringParserService.Parse("${res:Dialog.Options.ExternalTool.MoveUpButton}"));
- moveDownButton = new Button(StringParserService.Parse("${res:Dialog.Options.ExternalTool.MoveDownButton}"));
- removeButton = new Button(StringParserService.Parse("${res:Global.RemoveButtonText}"));
- addButton = new Button(StringParserService.Parse("${res:Global.AddButtonText}"));
-
- dependendControls = new Widget[] {
- titleTextBox, commandTextBox, argumentTextBox,
- workingDirTextBox, promptArgsCheckBox, useOutputPadCheckBox,
- titleLabel, argumentLabel, commandLabel,
- workingDirLabel, browseButton, argumentQuickInsertButton,
- workingDirQuickInsertButton, moveUpButton, moveDownButton
- };
-
- // pack all the controls
- VBox vBox1 = new VBox(false, 2);
- vBox1.PackStart(addButton, false, false, 2);
- vBox1.PackStart(removeButton, false, false, 2);
- vBox1.PackEnd(moveDownButton, false, false, 2);
- vBox1.PackEnd(moveUpButton, false, false, 2);
-
- HBox hBox1 = new HBox(false, 2);
- hBox1.PackStart(toolListBox, false, true, 4);
- hBox1.PackStart(vBox1, false, false, 2);
-
- Table table1 = new Table(4, 3, false);
- table1.Attach(titleLabel, 0, 1, 0, 1);
- table1.Attach(titleTextBox, 1, 3, 0, 1);
- table1.Attach(commandLabel, 0, 1, 1, 2);
- table1.Attach(commandTextBox, 1, 2, 1, 2);
- table1.Attach(browseButton, 2, 3, 1, 2);
- table1.Attach(argumentLabel, 0, 1, 2, 3);
- table1.Attach(argumentTextBox, 1, 2, 2, 3);
- table1.Attach(argumentQuickInsertButton, 2, 3, 2, 3);
- table1.Attach(workingDirLabel, 0, 1, 3, 4);
- table1.Attach(workingDirTextBox, 1, 2, 3, 4);
- table1.Attach(workingDirQuickInsertButton, 2, 3, 3, 4);
-
- VBox mainBox = new VBox(false, 2);
- mainBox.PackStart(hBox1, false, false, 2);
- mainBox.PackStart(table1, false, false, 2);
- mainBox.PackStart(promptArgsCheckBox, false, false, 2);
- mainBox.PackStart(useOutputPadCheckBox, false, false, 2);
- this.Add(mainBox);
- }
-
- void browseEvent(object sender, EventArgs e)
- {
- Gtk.FileSelection fs = new Gtk.FileSelection ("File to Open");
- int response = fs.Run ();
- string name = fs.Filename;
- fs.Destroy ();
- if (response == (int)Gtk.ResponseType.Ok) {
- commandTextBox.Text = name;
- }
- }
-
-
- void moveUpEvent(object sender, EventArgs e)
- {
- if(toolListBox.Selection.CountSelectedRows() == 1)
- {
- TreeIter selectedItem;
- TreeModel ls;
- ((ListStore)toolListBox.Model).GetIter(out selectedItem, (TreePath) toolListBox.Selection.GetSelectedRows(out ls)[0]);
- // we know we have a selected item so get it's index
- // use that to get the path of the item before it, and swap the two
- int index = GetSelectedIndex(toolListBox);
- // only swap if at the top
- if(index > 0)
- {
- TreeIter prev;
- if(toolListBox.Model.GetIterFromString(out prev, (index - 1).ToString()))
- {
- ((ListStore)ls).Swap(selectedItem, prev);
- }
}
- }
- }
- void moveDownEvent(object sender, EventArgs e)
- {
- if(toolListBox.Selection.CountSelectedRows() == 1)
- {
- TreeIter selectedItem;
- TreeModel ls;
- ((ListStore)toolListBox.Model).GetIter(out selectedItem, (TreePath) toolListBox.Selection.GetSelectedRows(out ls)[0]);
-
- // swap it with the next one
- TreeIter toSwap = selectedItem;
- if(ls.IterNext(out toSwap))
- {
- ((ListStore)ls).Swap(selectedItem, toSwap);
- }
- }
- }
-
- void setToolValues(object sender, EventArgs e)
- {
-
- ExternalTool selectedItem = null;
- if(toolListBox.Selection.CountSelectedRows() == 1)
- {
- TreeIter selectedIter;
- TreeModel lv;
- ((ListStore)toolListBox.Model).GetIter(out selectedIter, (TreePath) toolListBox.Selection.GetSelectedRows(out lv)[0]);
-
- // get the value as an external tool object
- selectedItem = lv.GetValue(selectedIter, 1) as ExternalTool;
-
-
- lv.SetValue(selectedIter, 0, titleTextBox.Text);
- selectedItem.MenuCommand = titleTextBox.Text;
- selectedItem.Command = commandTextBox.Text;
- selectedItem.Arguments = argumentTextBox.Text;
- selectedItem.InitialDirectory = workingDirTextBox.Text;
- selectedItem.PromptForArguments = promptArgsCheckBox.Active;
- selectedItem.UseOutputPad = useOutputPadCheckBox.Active;
- }
- }
-
- void selectEvent(object sender, EventArgs e)
- {
- SetEnabledStatus(toolListBox.Selection.CountSelectedRows() > 0, removeButton);
-
- titleTextBox.Changed -= new EventHandler(setToolValues);
- commandTextBox.Changed -= new EventHandler(setToolValues);
- argumentTextBox.Changed -= new EventHandler(setToolValues);
- workingDirTextBox.Changed -= new EventHandler(setToolValues);
- promptArgsCheckBox.Toggled -= new EventHandler(setToolValues);
- useOutputPadCheckBox.Toggled -= new EventHandler(setToolValues);
-
- if (toolListBox.Selection.CountSelectedRows() == 1) {
- TreeIter selectedIter;
- TreeModel ls;
- ((ListStore)toolListBox.Model).GetIter(out selectedIter, (TreePath) toolListBox.Selection.GetSelectedRows(out ls)[0]);
-
- // get the value as an external tool object
- ExternalTool selectedItem = (ExternalTool) toolListBox.Model.GetValue(selectedIter, 1);
-
- SetEnabledStatus(true, dependendControls);
- titleTextBox.Text = selectedItem.MenuCommand;
- commandTextBox.Text = selectedItem.Command;
- argumentTextBox.Text = selectedItem.Arguments;
- workingDirTextBox.Text = selectedItem.InitialDirectory;
- promptArgsCheckBox.Active = selectedItem.PromptForArguments;
- useOutputPadCheckBox.Active = selectedItem.UseOutputPad;
- } else {
- SetEnabledStatus(false, dependendControls);
-
- titleTextBox.Text = String.Empty;
- commandTextBox.Text = String.Empty;
- argumentTextBox.Text = String.Empty;
- workingDirTextBox.Text = String.Empty;
- promptArgsCheckBox.Active = false;
- useOutputPadCheckBox.Active = false;
- }
-
- titleTextBox.Changed += new EventHandler(setToolValues);
- commandTextBox.Changed += new EventHandler(setToolValues);
- argumentTextBox.Changed += new EventHandler(setToolValues);
- workingDirTextBox.Changed += new EventHandler(setToolValues);
- promptArgsCheckBox.Toggled += new EventHandler(setToolValues);
- useOutputPadCheckBox.Toggled += new EventHandler(setToolValues);
- }
-
- void removeEvent(object sender, EventArgs e)
- {
- int selectedItemCount = toolListBox.Selection.CountSelectedRows();
- if(selectedItemCount > 0) {
- int maxIndex = 0;
- // first copy the selected item paths into a temp array
- TreeIter[] selectedIters = new TreeIter[selectedItemCount];
- TreeModel lv;
- TreePath[] pathList = toolListBox.Selection.GetSelectedRows(out lv);
- for(int i = 0; i < selectedItemCount; i++) {
- ((ListStore)lv).GetIter(out selectedIters[i], pathList[i]);
- maxIndex = pathList[i].Indices[0];
- }
-
- // now delete each item in that list
- foreach(TreeIter toDelete in selectedIters) {
- TreeIter itr = toDelete;
- toolListBoxItemCount --;
- ((ListStore)lv).Remove(out itr);
- }
-
- if (toolListBoxItemCount == 0) {
- selectEvent(this, EventArgs.Empty);
- } else {
- SetSelectedIndex(toolListBox, Math.Min(maxIndex,toolListBoxItemCount - 1));
- }
- }
- }
-
- void addEvent(object sender, EventArgs e)
- {
- TreeIter itr = toolListBoxStore.AppendValues("New Tool", new ExternalTool());
- toolListBoxItemCount ++;
- toolListBox.Selection.UnselectAll();
- toolListBox.Selection.SelectIter(itr);
- }
-
- // added this event to get the last select row index from gtk TreeView
- int GetSelectedIndex(TreeView tv)
- {
- if(toolListBox.Selection.CountSelectedRows() == 1)
- {
- TreeIter selectedIter;
- TreeModel lv;
- ((ListStore)toolListBox.Model).GetIter(out selectedIter, (TreePath) toolListBox.Selection.GetSelectedRows(out lv)[0]);
-
- // return index of first level node (since only 1 level list model)
- return lv.GetPath(selectedIter).Indices[0];
- }
- else
- {
- return -1;
- }
- }
-
- // added this event to set a specific row as selected from index
- void SetSelectedIndex(TreeView tv, int index)
- {
- //convert index to a path
- TreePath path = new TreePath(index.ToString());
- tv.Selection.UnselectAll();
- tv.Selection.SelectPath(path);
- }
-
- // disables or enables (sets sensitivty) a specified array of widgets
- public void SetEnabledStatus(bool enabled, params Widget[] controls)
- {
- foreach (Widget control in controls) {
- if (control == null) {
- MessageService.ShowError("Control not found!");
- } else {
- control.Sensitive = enabled;
- }
- }
- }
- }
-}
+
+ toolListBox.Reorderable = false;
+ toolListBox.HeadersVisible = true;
+ toolListBox.Selection.Mode = SelectionMode.Multiple;
+ toolListBox.Model = toolListBoxStore;
+
+ toolListBox.AppendColumn (
+ StringParserService.Parse("${res:Dialog.Options.ExternalTool.ToolsLabel}"),
+ new CellRendererText (),
+ "text",
+ 0);
+ Console.WriteLine("Create Quick Menu");
+ MenuService.CreateQuickInsertMenu(argumentTextBox,
+ argumentQuickInsertButton,
+ argumentQuickInsertMenu);
+ Console.WriteLine("Create Quick Menu");
+ MenuService.CreateQuickInsertMenu(workingDirTextBox,
+ workingDirQuickInsertButton,
+ workingDirInsertMenu);
+
+ toolListBox.Selection.Changed += new EventHandler(selectEvent);
+ Console.WriteLine("Connecting");
+ removeButton.Clicked += new EventHandler(removeEvent);
+ addButton.Clicked += new EventHandler(addEvent);
+ moveUpButton.Clicked += new EventHandler(moveUpEvent);
+ moveDownButton.Clicked += new EventHandler(moveDownEvent);
+ browseButton.Clicked += new EventHandler(browseEvent);
+
+ selectEvent(this, EventArgs.Empty);
+
+ Console.WriteLine("Test3");
+
+ }
+ void browseEvent(object sender, EventArgs e)
+ {
+ Console.WriteLine("browseEvent");
+ Gtk.FileSelection fs = new Gtk.FileSelection ("File to Open");
+ int response = fs.Run ();
+ string name = fs.Filename;
+ fs.Destroy ();
+ if (response == (int)Gtk.ResponseType.Ok) {
+ commandTextBox.Text = name;
+ }
+ }
+
+
+ void moveUpEvent(object sender, EventArgs e)
+ {
+ Console.WriteLine("moveUpEvent");
+ if(toolListBox.Selection.CountSelectedRows() == 1)
+ {
+ TreeIter selectedItem;
+ TreeModel ls;
+ ((ListStore)toolListBox.Model).GetIter(
+ out selectedItem, (TreePath) toolListBox.Selection.GetSelectedRows(out ls)[0]);
+ // we know we have a selected item so get it's index
+ // use that to get the path of the item before it, and swap the two
+ int index = GetSelectedIndex(toolListBox);
+ // only swap if at the top
+ if(index > 0)
+ {
+ TreeIter prev;
+ if(toolListBox.Model.GetIterFromString(out prev, (index - 1).ToString()))
+ {
+ ((ListStore)ls).Swap(selectedItem, prev);
+ }
+ }
+ }
+ }
+
+ void moveDownEvent(object sender, EventArgs e)
+ {
+ Console.WriteLine("moveDownEvent");
+ if(toolListBox.Selection.CountSelectedRows() == 1)
+ {
+ TreeIter selectedItem;
+ TreeModel ls;
+ ((ListStore)toolListBox.Model).GetIter(
+ out selectedItem, (TreePath) toolListBox.Selection.GetSelectedRows(out ls)[0]);
+ // swap it with the next one
+ TreeIter toSwap = selectedItem;
+ if(ls.IterNext(out toSwap))
+ {
+ ((ListStore)ls).Swap(selectedItem, toSwap);
+ }
+ }
+ }
+
+ void setToolValues(object sender, EventArgs e)
+ {
+ Console.WriteLine("setToolValues");
+ ExternalTool selectedItem = null;
+ if(toolListBox.Selection.CountSelectedRows() == 1)
+ {
+ TreeIter selectedIter;
+ TreeModel lv;
+ ((ListStore)toolListBox.Model).GetIter(
+ out selectedIter, (TreePath) toolListBox.Selection.GetSelectedRows(out lv)[0]);
+
+ // get the value as an external tool object
+ selectedItem = lv.GetValue(selectedIter, 1) as ExternalTool;
+
+
+ lv.SetValue(selectedIter, 0, titleTextBox.Text);
+ selectedItem.MenuCommand = titleTextBox.Text;
+ selectedItem.Command = commandTextBox.Text;
+ selectedItem.Arguments = argumentTextBox.Text;
+ selectedItem.InitialDirectory = workingDirTextBox.Text;
+ selectedItem.PromptForArguments = promptArgsCheckBox.Active;
+ selectedItem.UseOutputPad = useOutputPadCheckBox.Active;
+ }
+ }
+
+ void selectEvent(object sender, EventArgs e)
+ {
+ Console.WriteLine("selectEvent");
+ SetEnabledStatus(toolListBox.Selection.CountSelectedRows() > 0, removeButton);
+
+ titleTextBox.Changed -= new EventHandler(setToolValues);
+ commandTextBox.Changed -= new EventHandler(setToolValues);
+ argumentTextBox.Changed -= new EventHandler(setToolValues);
+ workingDirTextBox.Changed -= new EventHandler(setToolValues);
+ promptArgsCheckBox.Toggled -= new EventHandler(setToolValues);
+ useOutputPadCheckBox.Toggled -= new EventHandler(setToolValues);
+
+ if (toolListBox.Selection.CountSelectedRows() == 1) {
+ TreeIter selectedIter;
+ TreeModel ls;
+ ((ListStore)toolListBox.Model).GetIter(
+ out selectedIter, (TreePath) toolListBox.Selection.GetSelectedRows(out ls)[0]);
+
+ // get the value as an external tool object
+ ExternalTool selectedItem = (ExternalTool) toolListBox.Model.GetValue(selectedIter, 1);
+
+ SetEnabledStatus(true, dependendControls);
+ titleTextBox.Text = selectedItem.MenuCommand;
+ commandTextBox.Text = selectedItem.Command;
+ argumentTextBox.Text = selectedItem.Arguments;
+ workingDirTextBox.Text = selectedItem.InitialDirectory;
+ promptArgsCheckBox.Active = selectedItem.PromptForArguments;
+ useOutputPadCheckBox.Active = selectedItem.UseOutputPad;
+ } else {
+ SetEnabledStatus(false, dependendControls);
+
+ titleTextBox.Text = String.Empty;
+ commandTextBox.Text = String.Empty;
+ argumentTextBox.Text = String.Empty;
+ workingDirTextBox.Text = String.Empty;
+ promptArgsCheckBox.Active = false;
+ useOutputPadCheckBox.Active = false;
+ }
+
+ titleTextBox.Changed += new EventHandler(setToolValues);
+ commandTextBox.Changed += new EventHandler(setToolValues);
+ argumentTextBox.Changed += new EventHandler(setToolValues);
+ workingDirTextBox.Changed += new EventHandler(setToolValues);
+ promptArgsCheckBox.Toggled += new EventHandler(setToolValues);
+ useOutputPadCheckBox.Toggled += new EventHandler(setToolValues);
+ }
+
+ void removeEvent(object sender, EventArgs e)
+ {
+ Console.WriteLine("removeEvent");
+ int selectedItemCount = toolListBox.Selection.CountSelectedRows();
+ if(selectedItemCount > 0) {
+ int maxIndex = 0;
+ // first copy the selected item paths into a temp array
+ TreeIter[] selectedIters = new TreeIter[selectedItemCount];
+ TreeModel lv;
+ TreePath[] pathList = toolListBox.Selection.GetSelectedRows(out lv);
+ for(int i = 0; i < selectedItemCount; i++) {
+ TreePath path = (TreePath) pathList[i];
+ ((ListStore)lv).GetIter(out selectedIters[i], path);
+ maxIndex = path.Indices[0];
+ }
+
+ // now delete each item in that list
+ foreach(TreeIter toDelete in selectedIters) {
+ TreeIter itr = toDelete;
+ toolListBoxItemCount --;
+ ((ListStore)lv).Remove(out itr);
+ }
+
+ if (toolListBoxItemCount == 0) {
+ selectEvent(this, EventArgs.Empty);
+ } else {
+ SetSelectedIndex(toolListBox, Math.Min(maxIndex,toolListBoxItemCount - 1));
+ }
+ }
+ }
+
+ void addEvent(object sender, EventArgs e)
+ {
+ Console.WriteLine("addEvent");
+ TreeIter itr = toolListBoxStore.AppendValues("New Tool", new ExternalTool());
+ toolListBoxItemCount ++;
+ toolListBox.Selection.UnselectAll();
+ toolListBox.Selection.SelectIter(itr);
+ }
+
+ // added this event to get the last select row index from gtk TreeView
+ int GetSelectedIndex(Gtk.TreeView tv)
+ {
+ Console.WriteLine("GetSelectedIndex");
+ if(toolListBox.Selection.CountSelectedRows() == 1)
+ {
+ TreeIter selectedIter;
+ TreeModel lv;
+ ((ListStore)toolListBox.Model).GetIter(
+ out selectedIter, (TreePath) toolListBox.Selection.GetSelectedRows(out lv)[0]);
+
+ // return index of first level node (since only 1 level list model)
+ return lv.GetPath(selectedIter).Indices[0];
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+ // added this event to set a specific row as selected from index
+ void SetSelectedIndex(Gtk.TreeView tv, int index)
+ {
+ Console.WriteLine("SetSelectedIndex");
+ //convert index to a path
+ TreePath path = new TreePath(index.ToString());
+ tv.Selection.UnselectAll();
+ tv.Selection.SelectPath(path);
+ }
+
+ // disables or enables (sets sensitivty) a specified array of widgets
+ public void SetEnabledStatus(bool enabled, params Widget[] controls)
+ {
+ Console.WriteLine("SetEnabledStatus");
+ foreach (Widget control in controls) {
+ if (control == null) {
+ MessageService.ShowError("Control not found!");
+ } else {
+ control.Sensitive = enabled;
+ }
+ }
+ }
+
+ public bool Store ()
+ {
+ Console.WriteLine("Entering Store");
+ ArrayList newlist = new ArrayList();
+ TreeIter first;
+ Console.WriteLine("Entering Store 1");
+ if(toolListBox.Model.GetIterFirst(out first))
+ {
+ Console.WriteLine("In loop");
+ TreeIter current = first;
+
+ do {
+ // loop through items in the tree
+
+ ExternalTool tool = toolListBox.Model.GetValue(current, 1) as ExternalTool;
+ if (!FileUtilityService.IsValidFileName(tool.Command)) {
+ MessageService.ShowError(String.Format(
+ "The command of tool \"{0}\" is invalid.",
+ tool.MenuCommand));
+ return false;
+ }
+ if ((tool.InitialDirectory != "") && (!FileUtilityService.IsValidFileName(tool.InitialDirectory))) {
+ MessageService.ShowError(String.Format("The working directory of tool \"{0}\" is invalid.",
+ tool.MenuCommand));
+ return false;
+ }
+ newlist.Add(tool);
+ } while(toolListBox.Model.IterNext(out current));
+ }
+ Console.WriteLine("Entering Store 2");
+ ToolLoader.Tool = newlist;
+ ToolLoader.SaveTools();
+ Console.WriteLine("Exiting");
+ return true;
+ }
+ }
+ }
+ }
+
More information about the Monodevelop-patches-list
mailing list