[Monodevelop-patches-list] r459 - in trunk/MonoDevelop/src/Main/Base: Commands Gui/CompletionDatabaseWizard Gui/Dialogs/Wizard
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sun Jan 11 20:36:44 EST 2004
Author: jluke
Date: 2004-01-11 20:36:44 -0500 (Sun, 11 Jan 2004)
New Revision: 459
Modified:
trunk/MonoDevelop/src/Main/Base/Commands/AutostartCommands.cs
trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/CreationFinishedPanel.cs
trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs
trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/Wizard/WizardDialog.cs
Log:
make the Wizard emit a reponse, and change the Opening
Wizard to close on a Cancel, or Close response
port UseExistingFilePanel
Modified: trunk/MonoDevelop/src/Main/Base/Commands/AutostartCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/AutostartCommands.cs 2004-01-12 01:32:04 UTC (rev 458)
+++ trunk/MonoDevelop/src/Main/Base/Commands/AutostartCommands.cs 2004-01-12 01:36:44 UTC (rev 459)
@@ -78,7 +78,10 @@
WizardDialog wizard = new WizardDialog("Initialize Code Completion Database", customizer, "/SharpDevelop/CompletionDatabaseWizard");
propertyService.SetProperty("SharpDevelop.CodeCompletion.DataDirectory", customizer.GetProperty("SharpDevelop.CodeCompletion.DataDirectory", String.Empty));
- wizard.ShowAll ();
+ int response = wizard.Run ();
+ if (response == (int) Gtk.ResponseType.Cancel || response == (int) Gtk.ResponseType.Close)
+ wizard.Hide ();
+
Gtk.Application.Run ();
// restart & exit
Console.WriteLine ("generated, exiting");
Modified: trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/CreationFinishedPanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/CreationFinishedPanel.cs 2004-01-12 01:32:04 UTC (rev 458)
+++ trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/CreationFinishedPanel.cs 2004-01-12 01:36:44 UTC (rev 459)
@@ -1,41 +1,41 @@
-// <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 Gtk;
-
-using ICSharpCode.SharpDevelop.Internal.Project;
-using ICSharpCode.Core.Properties;
-using ICSharpCode.Core.Services;
-using ICSharpCode.SharpDevelop.Services;
-
-using ICSharpCode.Core.AddIns.Codons;
-
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
-{
- public class CreationFinishedPanel : AbstractWizardPanel
- {
- static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-
- public override bool ReceiveDialogMessage(DialogMessage message)
- {
- return true;
- }
-
- static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
- public CreationFinishedPanel() : base()
- {
- EnableFinish = true;
- EnableNext = false;
- EnablePrevious = false;
- EnableCancel = false;
+using Gtk;
+
+using ICSharpCode.SharpDevelop.Internal.Project;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+
+using ICSharpCode.Core.AddIns.Codons;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
+{
+ public class CreationFinishedPanel : AbstractWizardPanel
+ {
+ static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+
+ public override bool ReceiveDialogMessage(DialogMessage message)
+ {
+ return true;
+ }
+
+ static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
+ public CreationFinishedPanel() : base()
+ {
+ EnableFinish = true;
+ EnableNext = false;
+ EnablePrevious = false;
+ EnableCancel = false;
IsLastPanel = true;
- this.Add (new Label ("Creation Finished"));
- }
- }
-}
+ this.Add (new Label ("Creation Finished"));
+ }
+ }
+}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs 2004-01-12 01:32:04 UTC (rev 458)
+++ trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs 2004-01-12 01:36:44 UTC (rev 459)
@@ -1,93 +1,98 @@
-// <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 Gtk;
-
-using ICSharpCode.SharpDevelop.Internal.Project;
-using ICSharpCode.Core.Properties;
-using ICSharpCode.Core.Services;
+// <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 MonoDevelop.Gui;
-using ICSharpCode.Core.AddIns.Codons;
-
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
-{
- public class UseExistingFilePanel : AbstractWizardPanel
- {
- static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+using System;
+using System.IO;
+using Gtk;
+
+using ICSharpCode.SharpDevelop.Internal.Project;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.Services;
+
+using MonoDevelop.Gui;
+using ICSharpCode.Core.AddIns.Codons;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
+{
+ public class UseExistingFilePanel : AbstractWizardPanel
+ {
+ static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
IProperties properties;
- Entry locationTextBox;
-
- public override bool ReceiveDialogMessage(DialogMessage message)
- {
- switch (message) {
- case DialogMessage.Activated:
- SetFinishedState(this, EventArgs.Empty);
- break;
- case DialogMessage.Prev:
- EnableFinish = false;
- break;
- }
- return true;
- }
-
- void SetFinishedState(object sender, EventArgs e)
- {
- FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
- string path = locationTextBox.Text;
- EnableFinish = fileUtilityService.IsValidFileName(path) &&
- Directory.Exists(path) &&
- File.Exists(fileUtilityService.GetDirectoryNameWithSeparator(path) + "CodeCompletionProxyDataV02.bin");
- if (EnableFinish) {
- properties.SetProperty("SharpDevelop.CodeCompletion.DataDirectory",
- path);
- }
- }
-
- void SetValues(object sender, EventArgs e)
- {
- properties = (IProperties)CustomizationObject;
- }
-
- void BrowseLocationEvent(object sender, EventArgs e)
- {
+ Entry locationTextBox;
+
+ public override bool ReceiveDialogMessage(DialogMessage message)
+ {
+ switch (message) {
+ case DialogMessage.Activated:
+ SetFinishedState(this, EventArgs.Empty);
+ break;
+ case DialogMessage.Prev:
+ EnableFinish = false;
+ break;
+ }
+ return true;
+ }
+
+ void SetFinishedState(object sender, EventArgs e)
+ {
+ FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+ string path = locationTextBox.Text;
+ EnableFinish = fileUtilityService.IsValidFileName(path) &&
+ Directory.Exists(path) &&
+ File.Exists(fileUtilityService.GetDirectoryNameWithSeparator(path) + "CodeCompletionProxyDataV02.bin");
+ if (EnableFinish) {
+ properties.SetProperty("SharpDevelop.CodeCompletion.DataDirectory",
+ path);
+ }
+ }
+
+ void SetValues(object sender, EventArgs e)
+ {
+ properties = (IProperties)CustomizationObject;
+ }
+
+ void BrowseLocationEvent(object sender, EventArgs e)
+ {
FolderDialog fd = new FolderDialog ("choose the location in which you want the code completion files to be generated");
int response = fd.Run ();
fd.Hide ();
-
- if (response == (int) ResponseType.Ok) {
- locationTextBox.Text = fd.Filename;
- }
- }
-
- static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
- public UseExistingFilePanel()
- {
- IsLastPanel = true;
+
+ if (response == (int) ResponseType.Ok) {
+ locationTextBox.Text = fd.Filename;
+ }
+ }
+
+ static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
+ public UseExistingFilePanel()
+ {
+ IsLastPanel = true;
ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
VBox mainVBox = new VBox (false, 0);
-
- //textBox.Lines = resourceService.GetString ("Dialog.Wizards.CodeCompletionDatabaseWizard.UseExistingFilePanel.PanelDescription").Split('\n');
- locationTextBox = new Entry ();
+ TextView textBox = new TextView ();
+ textBox.WrapMode = WrapMode.Word;
+ textBox.Buffer.Text = resourceService.GetString ("Dialog.Wizards.CodeCompletionDatabaseWizard.UseExistingFilePanel.PanelDescription");
+ mainVBox.PackStart (textBox, false, true, 0);
+ mainVBox.PackStart (new Label ("Specify location of existing code completion database."));
+
+ locationTextBox = new Entry ();
+ locationTextBox.WidthChars = 50;
locationTextBox.Changed += new EventHandler(SetFinishedState);
- Button browseButton = new Button ("...");
- browseButton.Clicked += new EventHandler(BrowseLocationEvent);
+ Button browseButton = new Button ("...");
+ browseButton.Clicked += new EventHandler(BrowseLocationEvent);
HBox hbox = new HBox (false, 0);
hbox.PackStart (locationTextBox, false, true, 0);
- hbox.PackStart (browseButton, false, true, 0);
- SetFinishedState(this, EventArgs.Empty);
- CustomizationObjectChanged += new EventHandler(SetValues);
+ hbox.PackStart (browseButton, false, true, 0);
+ SetFinishedState(this, EventArgs.Empty);
+ CustomizationObjectChanged += new EventHandler(SetValues);
- mainVBox.PackStart (hbox, false, true, 0);
- this.Add (mainVBox);
- }
- }
-}
+ mainVBox.PackStart (hbox, false, true, 6);
+ this.Add (mainVBox);
+ }
+ }
+}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/Wizard/WizardDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/Wizard/WizardDialog.cs 2004-01-12 01:32:04 UTC (rev 458)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/Wizard/WizardDialog.cs 2004-01-12 01:36:44 UTC (rev 459)
@@ -1,334 +1,328 @@
-// <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.Drawing;
-using System.Diagnostics;
-using System.Collections;
-using System.Xml;
-
-using ICSharpCode.Core.Services;
-using ICSharpCode.Core.AddIns;
-
-using ICSharpCode.Core.Properties;
-using ICSharpCode.Core.AddIns.Codons;
-using Gtk;
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs
-{
- /// <summary>
- /// TreeView options are used, when more options will be edited (for something like
- /// IDE Options + Plugin Options)
- /// </summary>
- public class WizardDialog : Dialog
- {
- StatusPanel statusPanel = null;
- //CurrentPanelPanel curPanel = null;
-
- Gtk.Frame dialogPanel = new Gtk.Frame();
-
- DialogMessage DialogMessage;
-
- /// <remarks>
- /// On this stack the indices of the previous active wizard panels. This
- /// is used to restore the path the user gone. (for the back button)
- /// </remarks>
- Stack idStack = new Stack();
-
- ArrayList wizardPanels = new ArrayList();
- int activePanelNumber = 0;
-
- EventHandler enableNextChangedHandler;
- EventHandler enableCancelChangedHandler;
- EventHandler nextWizardPanelIDChangedHandler;
- EventHandler finishPanelHandler;
-
- public ArrayList WizardPanels {
- get {
- return wizardPanels;
- }
- }
-
- public int ActivePanelNumber {
- get {
- return activePanelNumber;
- }
- }
-
- public IWizardPanel CurrentWizardPane {
- get {
- return (IWizardPanel)((IDialogPanelDescriptor)wizardPanels[activePanelNumber]).DialogPanel;
- }
- }
-
- int GetPanelNumber(string id)
- {
- for (int i = 0; i < wizardPanels.Count; ++i) {
- IDialogPanelDescriptor descriptor = (IDialogPanelDescriptor)wizardPanels[i];
- if (descriptor.ID == id) {
- return i;
- }
- }
- return -1;
- }
-
- public int GetSuccessorNumber(int curNr)
- {
- IWizardPanel panel = (IWizardPanel)((IDialogPanelDescriptor)wizardPanels[curNr]).DialogPanel;
-
- if (panel.IsLastPanel) {
- return wizardPanels.Count + 1;
- }
-
- int nextID = GetPanelNumber(panel.NextWizardPanelID);
- if (nextID < 0) {
- return curNr + 1;
- }
- return nextID;
- }
-
- /// <value> returns true, if all dialog panels could be finished</value>
- bool CanFinish {
- get {
- int currentNr = 0;
- while (currentNr < wizardPanels.Count) {
- IDialogPanelDescriptor descriptor = (IDialogPanelDescriptor)wizardPanels[currentNr];
- if (!descriptor.DialogPanel.EnableFinish) {
- return false;
- }
- currentNr = GetSuccessorNumber(currentNr);
- }
- return true;
- }
- }
-
- Gtk.Label label1;
-
- Gtk.Button backButton;
- Gtk.Button nextButton;
- Gtk.Button finishButton;
- Gtk.Button cancelButton;
- Gtk.Button helpButton;
-
- void CheckFinishedState(object sender, EventArgs e)
- {
- finishButton.Sensitive = CanFinish;
- }
-
- void AddNodes(object customizer, ArrayList dialogPanelDescriptors)
- {
- foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) {
-
- if (descriptor.DialogPanel != null) { // may be null, if it is only a "path"
- descriptor.DialogPanel.EnableFinishChanged += new EventHandler(CheckFinishedState);
- descriptor.DialogPanel.CustomizationObject = customizer;
- wizardPanels.Add(descriptor);
- }
-
- if (descriptor.DialogPanelDescriptors != null) {
- AddNodes(customizer, descriptor.DialogPanelDescriptors);
- }
- }
- }
-
- void EnableCancelChanged(object sender, EventArgs e)
- {
- cancelButton.Sensitive = CurrentWizardPane.EnableCancel;
- }
-
- void EnableNextChanged(object sender, EventArgs e)
- {
- nextButton.Sensitive = CurrentWizardPane.EnableNext && GetSuccessorNumber(activePanelNumber) < wizardPanels.Count;
- backButton.Sensitive = CurrentWizardPane.EnablePrevious && idStack.Count > 0;
- }
-
- void NextWizardPanelIDChanged(object sender, EventArgs e)
- {
- EnableNextChanged(null, null);
- finishButton.Sensitive = CanFinish;
- statusPanel.QueueDraw ();
- }
-
- void ActivatePanel(int number)
- {
- // take out old event handlers
- if (CurrentWizardPane != null) {
- CurrentWizardPane.EnableNextChanged -= enableNextChangedHandler;
- CurrentWizardPane.EnableCancelChanged -= enableCancelChangedHandler;
- CurrentWizardPane.EnablePreviousChanged -= enableNextChangedHandler;
- CurrentWizardPane.NextWizardPanelIDChanged -= nextWizardPanelIDChangedHandler;
- CurrentWizardPane.IsLastPanelChanged -= nextWizardPanelIDChangedHandler;
- CurrentWizardPane.FinishPanelRequested -= finishPanelHandler;
-
- }
-
- // set new active panel
- activePanelNumber = number;
-
- // insert new event handlers
- if (CurrentWizardPane != null) {
- CurrentWizardPane.EnableNextChanged += enableNextChangedHandler;
- CurrentWizardPane.EnableCancelChanged += enableCancelChangedHandler;
- CurrentWizardPane.EnablePreviousChanged += enableNextChangedHandler;
- CurrentWizardPane.NextWizardPanelIDChanged += nextWizardPanelIDChangedHandler;
- CurrentWizardPane.IsLastPanelChanged += nextWizardPanelIDChangedHandler;
- CurrentWizardPane.FinishPanelRequested += finishPanelHandler;
- }
-
- // initialize panel status
- EnableNextChanged(null, null);
- NextWizardPanelIDChanged(null, null);
- EnableCancelChanged(null, null);
-
- // take out panel control & show new one
- if (dialogPanel.Child != null) {
- statusPanel.GdkWindow.InvalidateRect (new Rectangle (0, 0, 400, 400), true);
- dialogPanel.Remove (dialogPanel.Child);
- }
- //curPanel.Refresh();
-
- //Control panelControl = CurrentWizardPane.Control;
- //panelControl.Dock = DockStyle.Fill;
- dialogPanel.Add(CurrentWizardPane.Control);
-
- this.ShowAll ();
-
- }
-
- public WizardDialog (string title, object customizer, string treePath)
- {
- IAddInTreeNode node = AddInTreeSingleton.AddInTree.GetTreeNode(treePath);
+using System.Drawing;
+using System.Diagnostics;
+using System.Collections;
+using System.Xml;
+
+using ICSharpCode.Core.Services;
+using ICSharpCode.Core.AddIns;
+
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.AddIns.Codons;
+using Gtk;
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs
+{
+ /// <summary>
+ /// TreeView options are used, when more options will be edited (for something like
+ /// IDE Options + Plugin Options)
+ /// </summary>
+ public class WizardDialog : Dialog
+ {
+ StatusPanel statusPanel = null;
+ //CurrentPanelPanel curPanel = null;
+
+ Gtk.Frame dialogPanel = new Gtk.Frame();
+
+ DialogMessage DialogMessage;
+
+ /// <remarks>
+ /// On this stack the indices of the previous active wizard panels. This
+ /// is used to restore the path the user gone. (for the back button)
+ /// </remarks>
+ Stack idStack = new Stack();
+
+ ArrayList wizardPanels = new ArrayList();
+ int activePanelNumber = 0;
+
+ EventHandler enableNextChangedHandler;
+ EventHandler enableCancelChangedHandler;
+ EventHandler nextWizardPanelIDChangedHandler;
+ EventHandler finishPanelHandler;
+
+ public ArrayList WizardPanels {
+ get {
+ return wizardPanels;
+ }
+ }
+
+ public int ActivePanelNumber {
+ get {
+ return activePanelNumber;
+ }
+ }
+
+ public IWizardPanel CurrentWizardPane {
+ get {
+ return (IWizardPanel)((IDialogPanelDescriptor)wizardPanels[activePanelNumber]).DialogPanel;
+ }
+ }
+
+ int GetPanelNumber(string id)
+ {
+ for (int i = 0; i < wizardPanels.Count; ++i) {
+ IDialogPanelDescriptor descriptor = (IDialogPanelDescriptor)wizardPanels[i];
+ if (descriptor.ID == id) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int GetSuccessorNumber(int curNr)
+ {
+ IWizardPanel panel = (IWizardPanel)((IDialogPanelDescriptor)wizardPanels[curNr]).DialogPanel;
+
+ if (panel.IsLastPanel) {
+ return wizardPanels.Count + 1;
+ }
+
+ int nextID = GetPanelNumber(panel.NextWizardPanelID);
+ if (nextID < 0) {
+ return curNr + 1;
+ }
+ return nextID;
+ }
+
+ /// <value> returns true, if all dialog panels could be finished</value>
+ bool CanFinish {
+ get {
+ int currentNr = 0;
+ while (currentNr < wizardPanels.Count) {
+ IDialogPanelDescriptor descriptor = (IDialogPanelDescriptor)wizardPanels[currentNr];
+ if (!descriptor.DialogPanel.EnableFinish) {
+ return false;
+ }
+ currentNr = GetSuccessorNumber(currentNr);
+ }
+ return true;
+ }
+ }
+
+ Gtk.Label label1;
+
+ Gtk.Button backButton;
+ Gtk.Button nextButton;
+ Gtk.Button finishButton;
+ Gtk.Button cancelButton;
+ Gtk.Button helpButton;
+
+ void CheckFinishedState(object sender, EventArgs e)
+ {
+ finishButton.Sensitive = CanFinish;
+ }
+
+ void AddNodes(object customizer, ArrayList dialogPanelDescriptors)
+ {
+ foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) {
+
+ if (descriptor.DialogPanel != null) { // may be null, if it is only a "path"
+ descriptor.DialogPanel.EnableFinishChanged += new EventHandler(CheckFinishedState);
+ descriptor.DialogPanel.CustomizationObject = customizer;
+ wizardPanels.Add(descriptor);
+ }
+
+ if (descriptor.DialogPanelDescriptors != null) {
+ AddNodes(customizer, descriptor.DialogPanelDescriptors);
+ }
+ }
+ }
+
+ void EnableCancelChanged(object sender, EventArgs e)
+ {
+ cancelButton.Sensitive = CurrentWizardPane.EnableCancel;
+ }
+
+ void EnableNextChanged(object sender, EventArgs e)
+ {
+ nextButton.Sensitive = CurrentWizardPane.EnableNext && GetSuccessorNumber(activePanelNumber) < wizardPanels.Count;
+ backButton.Sensitive = CurrentWizardPane.EnablePrevious && idStack.Count > 0;
+ }
+
+ void NextWizardPanelIDChanged(object sender, EventArgs e)
+ {
+ EnableNextChanged(null, null);
+ finishButton.Sensitive = CanFinish;
+ statusPanel.QueueDraw ();
+ }
+
+ void ActivatePanel(int number)
+ {
+ // take out old event handlers
+ if (CurrentWizardPane != null) {
+ CurrentWizardPane.EnableNextChanged -= enableNextChangedHandler;
+ CurrentWizardPane.EnableCancelChanged -= enableCancelChangedHandler;
+ CurrentWizardPane.EnablePreviousChanged -= enableNextChangedHandler;
+ CurrentWizardPane.NextWizardPanelIDChanged -= nextWizardPanelIDChangedHandler;
+ CurrentWizardPane.IsLastPanelChanged -= nextWizardPanelIDChangedHandler;
+ CurrentWizardPane.FinishPanelRequested -= finishPanelHandler;
+
+ }
+
+ // set new active panel
+ activePanelNumber = number;
+
+ // insert new event handlers
+ if (CurrentWizardPane != null) {
+ CurrentWizardPane.EnableNextChanged += enableNextChangedHandler;
+ CurrentWizardPane.EnableCancelChanged += enableCancelChangedHandler;
+ CurrentWizardPane.EnablePreviousChanged += enableNextChangedHandler;
+ CurrentWizardPane.NextWizardPanelIDChanged += nextWizardPanelIDChangedHandler;
+ CurrentWizardPane.IsLastPanelChanged += nextWizardPanelIDChangedHandler;
+ CurrentWizardPane.FinishPanelRequested += finishPanelHandler;
+ }
+
+ // initialize panel status
+ EnableNextChanged(null, null);
+ NextWizardPanelIDChanged(null, null);
+ EnableCancelChanged(null, null);
+
+ // take out panel control & show new one
+ if (dialogPanel.Child != null) {
+ statusPanel.GdkWindow.InvalidateRect (new Rectangle (0, 0, 400, 400), true);
+ dialogPanel.Remove (dialogPanel.Child);
+ }
+ //curPanel.Refresh();
+
+ //Control panelControl = CurrentWizardPane.Control;
+ //panelControl.Dock = DockStyle.Fill;
+ dialogPanel.Add(CurrentWizardPane.Control);
+
+ this.ShowAll ();
+
+ }
+
+ public WizardDialog (string title, object customizer, string treePath)
+ {
+ IAddInTreeNode node = AddInTreeSingleton.AddInTree.GetTreeNode(treePath);
this.Title = title;
this.BorderWidth = 6;
- this.HasSeparator = false;
-
- if (node != null) {
- AddNodes(customizer, node.BuildChildItems(this));
- }
- InitializeComponents();
-
- enableNextChangedHandler = new EventHandler(EnableNextChanged);
- nextWizardPanelIDChangedHandler = new EventHandler(NextWizardPanelIDChanged);
- enableCancelChangedHandler = new EventHandler(EnableCancelChanged);
- finishPanelHandler = new EventHandler(FinishPanelEvent);
- ActivatePanel(0);
- }
-
- void FinishPanelEvent(object sender, EventArgs e)
- {
- AbstractWizardPanel panel = (AbstractWizardPanel)CurrentWizardPane;
- bool isLast = panel.IsLastPanel;
- panel.IsLastPanel = false;
- ShowNextPanelEvent(sender, e);
- panel.IsLastPanel = isLast;
+ this.HasSeparator = false;
+
+ if (node != null) {
+ AddNodes(customizer, node.BuildChildItems(this));
+ }
+ InitializeComponents();
+
+ enableNextChangedHandler = new EventHandler(EnableNextChanged);
+ nextWizardPanelIDChangedHandler = new EventHandler(NextWizardPanelIDChanged);
+ enableCancelChangedHandler = new EventHandler(EnableCancelChanged);
+ finishPanelHandler = new EventHandler(FinishPanelEvent);
+ ActivatePanel(0);
+ }
+
+ void FinishPanelEvent(object sender, EventArgs e)
+ {
+ AbstractWizardPanel panel = (AbstractWizardPanel)CurrentWizardPane;
+ bool isLast = panel.IsLastPanel;
+ panel.IsLastPanel = false;
+ ShowNextPanelEvent(sender, e);
+ panel.IsLastPanel = isLast;
this.Hide ();
- //ShowMustRestart ();
- //Application.Quit ();
-
- }
-
- void ShowNextPanelEvent(object sender, EventArgs e)
- {
- int nextID = GetSuccessorNumber(this.ActivePanelNumber);
- Debug.Assert(nextID < wizardPanels.Count && nextID >= 0);
-
- //Console.WriteLine ("Inside ShowNextPanelEvent");
- if (!CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Next)) {
- return;
- }
- CurrentWizardPane.ReceiveDialogMessage (DialogMessage.Next);
- Console.WriteLine ("Past ReceiveDialogMessage call");
- idStack.Push(activePanelNumber);
+ //ShowMustRestart ();
+ //Application.Quit ();
+
+ }
+
+ void ShowNextPanelEvent(object sender, EventArgs e)
+ {
+ int nextID = GetSuccessorNumber(this.ActivePanelNumber);
+ Debug.Assert(nextID < wizardPanels.Count && nextID >= 0);
+
+ //Console.WriteLine ("Inside ShowNextPanelEvent");
+ if (!CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Next)) {
+ return;
+ }
+ CurrentWizardPane.ReceiveDialogMessage (DialogMessage.Next);
+ Console.WriteLine ("Past ReceiveDialogMessage call");
+ idStack.Push(activePanelNumber);
ActivatePanel(nextID);
- Console.WriteLine ("Activating panel" + nextID);
- CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Activated);
- }
-
- void ShowPrevPanelEvent(object sender, EventArgs e)
- {
- Debug.Assert(idStack.Count > 0);
- if (!CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Prev)) {
- return;
- }
- ActivatePanel((int)idStack.Pop());
- }
-
- void FinishEvent(object sender, EventArgs e)
- {
- foreach (IDialogPanelDescriptor descriptor in wizardPanels) {
- if (!descriptor.DialogPanel.ReceiveDialogMessage(DialogMessage.Finish)) {
- return;
- }
- }
+ Console.WriteLine ("Activating panel" + nextID);
+ CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Activated);
+ }
+
+ void ShowPrevPanelEvent(object sender, EventArgs e)
+ {
+ Debug.Assert(idStack.Count > 0);
+ if (!CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Prev)) {
+ return;
+ }
+ ActivatePanel((int)idStack.Pop());
+ }
+
+ void FinishEvent(object sender, EventArgs e)
+ {
+ foreach (IDialogPanelDescriptor descriptor in wizardPanels) {
+ if (!descriptor.DialogPanel.ReceiveDialogMessage(DialogMessage.Finish)) {
+ return;
+ }
+ }
DialogMessage = DialogMessage.OK;
- //ShowMustRestart ();
- //Application.Quit ();
- }
-
- void CancelEvent(object sender, EventArgs e)
- {
- foreach (IDialogPanelDescriptor descriptor in wizardPanels) {
- if (!descriptor.DialogPanel.ReceiveDialogMessage(DialogMessage.Cancel)) {
- return;
- }
- }
+ this.Respond ((int) ResponseType.Close);
+ }
+
+ void CancelEvent(object sender, EventArgs e)
+ {
+ foreach (IDialogPanelDescriptor descriptor in wizardPanels) {
+ if (!descriptor.DialogPanel.ReceiveDialogMessage(DialogMessage.Cancel)) {
+ return;
+ }
+ }
DialogMessage = DialogMessage.Cancel;
- //ShowMustRestart ();
- //Application.Quit ();
- }
-
- void HelpEvent(object sender, EventArgs e)
- {
- CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Help);
- }
-
-
- void InitializeComponents()
- {
- PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
- ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
-
- dialogPanel.Shadow = Gtk.ShadowType.None;
+ this.Respond ((int) ResponseType.Cancel);
+ }
+ void HelpEvent(object sender, EventArgs e)
+ {
+ CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Help);
+ }
+
+
+ void InitializeComponents()
+ {
+ PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
+ ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
+
+ dialogPanel.Shadow = Gtk.ShadowType.None;
+
//this.GdkWindow.SkipPagerHint = true;
//this.GdkWindow.SkipTaskbarHint = true;
- this.WindowPosition = WindowPosition.Center;
- this.SetDefaultSize (640, 440);
-
- //backButton = new Gtk.Button (resourceService.GetString ("Global.BackButtonText"));
- backButton = new ImageButton(Gtk.Stock.GoBack,resourceService.GetString ("Global.BackButtonText"));
- backButton.Clicked += new EventHandler(ShowPrevPanelEvent);
-
- //nextButton = new Gtk.Button (resourceService.GetString("Global.NextButtonText"));
- nextButton = new ImageButton(Gtk.Stock.GoForward,resourceService.GetString("Global.NextButtonText"));
- nextButton.Clicked += new EventHandler(ShowNextPanelEvent);
-
- //finishButton = new Gtk.Button (resourceService.GetString("Dialog.WizardDialog.FinishButton"));
- finishButton = new ImageButton(Gtk.Stock.Apply,resourceService.GetString("Dialog.WizardDialog.FinishButton"));
- finishButton.Clicked += new EventHandler(FinishEvent);
-
- //cancelButton = new Gtk.Button (resourceService.GetString("Global.CancelButtonText"));
- cancelButton = new ImageButton(Gtk.Stock.Cancel,resourceService.GetString("Global.CancelButtonText"));
- cancelButton.Clicked += new EventHandler(CancelEvent);
-
- this.ActionArea.PackStart (backButton);
- this.ActionArea.PackStart (nextButton);
- this.ActionArea.PackStart (finishButton);
- this.ActionArea.PackStart (cancelButton);
-
-// helpButton.Text = resourceService.GetString("Global.HelpButtonText");
-// helpButton.Clicked += new EventHandler (HelpEvent);
-// this.ActionArea.Add(helpButton);
-
- Gtk.HBox topbox = new Gtk.HBox (false, 2);
- statusPanel = new StatusPanel(this);
- topbox.PackStart (statusPanel, false, false, 2);
- topbox.PackStart (dialogPanel);
-
- this.VBox.PackStart (topbox);
+ this.WindowPosition = WindowPosition.Center;
+ this.SetDefaultSize (640, 440);
+
+ backButton = new ImageButton(Gtk.Stock.GoBack,resourceService.GetString ("Global.BackButtonText"));
+ backButton.Clicked += new EventHandler(ShowPrevPanelEvent);
+
+ nextButton = new ImageButton(Gtk.Stock.GoForward,resourceService.GetString("Global.NextButtonText"));
+ nextButton.Clicked += new EventHandler(ShowNextPanelEvent);
+
+ finishButton = new ImageButton(Gtk.Stock.Apply,resourceService.GetString("Dialog.WizardDialog.FinishButton"));
+ finishButton.Clicked += new EventHandler(FinishEvent);
+
+ cancelButton = new Button (Stock.Cancel);
+ cancelButton.Clicked += new EventHandler(CancelEvent);
+
+ this.AddActionWidget (backButton, 1);
+ this.AddActionWidget (nextButton, 2);
+ this.AddActionWidget (finishButton, 3);
+ this.AddActionWidget (cancelButton, (int) ResponseType.Cancel);
+
+// helpButton.Text = resourceService.GetString("Global.HelpButtonText");
+// helpButton.Clicked += new EventHandler (HelpEvent);
+// this.ActionArea.Add(helpButton);
+
+ Gtk.HBox topbox = new Gtk.HBox (false, 2);
+ statusPanel = new StatusPanel(this);
+ topbox.PackStart (statusPanel, false, false, 2);
+ topbox.PackStart (dialogPanel);
+
+ this.VBox.PackStart (topbox);
}
private void ShowMustRestart ()
@@ -336,6 +330,6 @@
MessageDialog md = new MessageDialog (this, DialogFlags.Modal | DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Ok, "You must restart MonoDevelop now.");
md.Run ();
md.Hide ();
- }
- }
-}
+ }
+ }
+}
More information about the Monodevelop-patches-list
mailing list