Browse Source

Removed MessageBoxBuilder addin.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@834 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
2c78c8157f
  1. 13
      src/AddIns/Wizards/MessageBoxBuilder/Doc/CreationProcess.txt
  2. 39
      src/AddIns/Wizards/MessageBoxBuilder/Project/Configuration/AssemblyInfo.cs
  3. 72
      src/AddIns/Wizards/MessageBoxBuilder/Project/Resources/CodeGenerationPanel.xfrm
  4. 35
      src/AddIns/Wizards/MessageBoxBuilder/Project/Resources/MessageBoxBuilder.addin
  5. 162
      src/AddIns/Wizards/MessageBoxBuilder/Project/Resources/VisiblePropertiesPanel.xfrm
  6. 46
      src/AddIns/Wizards/MessageBoxBuilder/Project/Src/Command/NewClass1.cs
  7. 59
      src/AddIns/Wizards/MessageBoxBuilder/Project/Src/Command/WizardCommand.cs
  8. 79
      src/AddIns/Wizards/MessageBoxBuilder/Project/Src/DialogPanels/CodeGenerationPanel.cs
  9. 110
      src/AddIns/Wizards/MessageBoxBuilder/Project/Src/DialogPanels/ViewPropertyPanel.cs
  10. 246
      src/AddIns/Wizards/MessageBoxBuilder/Project/Src/Generator/MessageBoxGenerator.cs
  11. 35
      src/AddIns/Wizards/MessageBoxBuilder/Project/Src/Xml/MessageBoxBuilder.addin

13
src/AddIns/Wizards/MessageBoxBuilder/Doc/CreationProcess.txt

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
Kurzzussammenfassung :
+ Neues Projet Erstellen (Anstatt exe, bibliothek erstellen)
+ Referenzen setzen, auf bin\SharpDevelop.exe AddIns\SharpDevelop.Base.dll
+ Panels machen, dabei beachten das die panels moeglichst mit anchor & dock
+ veraenderbar in der Groesse sind. Einfach mit irgendeinem designer machen,
dann von AbstractOptionPanel aberben lassen anstatt von Form oder UserControl.
+ MessageBox Generator schreiben, um code zu generieren, er muss alle Optionen
der panels unterstuetzen. Wenn das zeug compiliert XML erstellen und
MessageBoxBuilder.dll und src/xml/MessageBoxBuilder.xml nach AddIns\Wizards kopieren.
Dann ausprobieren bis alles klappt.

39
src/AddIns/Wizards/MessageBoxBuilder/Project/Configuration/AssemblyInfo.cs

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("MessageBox Builder")]
[assembly: AssemblyDescription("A SharpDevelop wizard")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("2.0.0.1")]
// The following attributes specify the key for the sign of your assembly. See the
// .NET Framework documentation for more information about signing.
// This is not required, if you don't want signing let these attributes like they're.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]

72
src/AddIns/Wizards/MessageBoxBuilder/Project/Resources/CodeGenerationPanel.xfrm

@ -1,72 +0,0 @@ @@ -1,72 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="MyUserControl" />
<DockPadding value="" />
<ClientSize value="{Width=448, Height=328}" />
<Controls>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.CodeGenerationPanel.CodePreviewLabel}" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<ClientSize value="{Width=432, Height=23}" />
<Location value="{X=8,Y=128}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.RichTextBox>
<Name value="richTextBox" />
<Anchor value="Top, Bottom, Left, Right" />
<ReadOnly value="True" />
<ClientSize value="{Width=428, Height=164}" />
<Font value="[Font: Name=Courier New, Size=10, Units=3, GdiCharSet=1, GdiVerticalFont=False]" />
<Location value="{X=8,Y=152}" />
<Text value="" />
<TabIndex value="2" />
<WordWrap value="False" />
</System.Windows.Forms.RichTextBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox" />
<TabIndex value="0" />
<Location value="{X=8,Y=8}" />
<Anchor value="Top, Left, Right" />
<ClientSize value="{Width=432, Height=112}" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.CodeGenerationPanel.CodeGenerationGroupBox}" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="generateSwitchCaseCheckBox" />
<Location value="{X=8,Y=80}" />
<ClientSize value="{Width=416, Height=24}" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.CodeGenerationPanel.CodeGenerationGroupBox.GenerateSwitchCaseCheckBox}" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="3" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.TextBox>
<Name value="variableNameTextBox" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="2" />
<Location value="{X=152,Y=48}" />
<ClientSize value="{Width=268, Height=17}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.CodeGenerationPanel.CodeGenerationGroupBox.VariableNameLabel}" />
<TextAlign value="MiddleRight" />
<Anchor value="Bottom, Left" />
<TabIndex value="1" />
<ClientSize value="{Width=128, Height=23}" />
<Location value="{X=24,Y=48}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.CheckBox>
<Name value="generateReturnValueCheckBox" />
<Location value="{X=8,Y=24}" />
<ClientSize value="{Width=416, Height=24}" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.CodeGenerationPanel.CodeGenerationGroupBox.GenerateReturnValueCheckBox}" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.CheckBox>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

35
src/AddIns/Wizards/MessageBoxBuilder/Project/Resources/MessageBoxBuilder.addin

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
<AddIn name = "Message Box Builder Wizard"
author = "Mike Krueger"
copyright = "GPL"
url = "unknown"
description = "Creates a messagebox call"
version = "1.0.0">
<Runtime>
<Import assembly="MessageBoxBuilder.dll"/>
</Runtime>
<Path name = "Plugins/Wizards/MessageBoxBuilderWizard">
<DialogPanel id = "View"
label = "${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.PanelName}"
class = "Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel"/>
<DialogPanel id = "CodeGeneration"
label = "${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.CodeGenerationPanel.PanelName}"
class = "Plugins.Wizards.MessageBoxBuilder.DialogPanels.CodeGenerationPanel"/>
</Path>
<Path name = "/SharpDevelop/Workbench/MainMenu/Tools">
<ComplexCondition>
<Or>
<Condition name = "WindowActive" activewindow="ICSharpCode.SharpDevelop.FormDesigner.FormDesignerDisplayBindingWrapper"/>
<Condition name = "WindowActive" activewindow="ICSharpCode.SharpDevelop.FormDesigner.CSharpDesignerDisplayBindingWrapper"/>
<Condition name = "WindowActive" activewindow="ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.TextEditorDisplayBindingWrapper"/>
</Or>
<MenuItem id = "MessageBox Wizard"
insertafter = "Separator1" insertbefore = "Separator2"
label = "${res:Plugins.Wizards.MessageBoxBuilder.MessageBoxWizardMenuCommand}"
description = "${res:Plugins.Wizards.MessageBoxBuilder.MessageBoxWizardMenuCommand.Description}"
class = "Plugins.Wizards.MessageBoxBuilder.Command.WizardCommand"/>
</ComplexCondition>
</Path>
</AddIn>

162
src/AddIns/Wizards/MessageBoxBuilder/Project/Resources/VisiblePropertiesPanel.xfrm

@ -1,162 +0,0 @@ @@ -1,162 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="MyUserControl" />
<DockPadding value="" />
<ClientSize value="{Width=472, Height=312}" />
<Controls>
<System.Windows.Forms.Button>
<Name value="previewButton" />
<Location value="{X=264,Y=248}" />
<Size value="{Width=88, Height=23}" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.PreviewButton}" />
<TabIndex value="3" />
</System.Windows.Forms.Button>
<System.Windows.Forms.GroupBox>
<Name value="groupBox3" />
<TabIndex value="2" />
<Location value="{X=8,Y=240}" />
<Size value="{Width=248, Height=64}" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.IconsGroupBox}" />
<Controls>
<System.Windows.Forms.RadioButton>
<Name value="radioButton5" />
<Location value="{X=168,Y=24}" />
<Checked value="True" />
<Size value="{Width=72, Height=32}" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.IconsGroupBox.NoneRadioButton}" />
<TabStop value="True" />
<Anchor value="Bottom, Left" />
<CheckAlign value="BottomCenter" />
<TabIndex value="4" />
<TextAlign value="MiddleCenter" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="radioButton4" />
<Location value="{X=128,Y=24}" />
<Size value="{Width=32, Height=32}" />
<Anchor value="Bottom, Left" />
<CheckAlign value="BottomCenter" />
<TabIndex value="3" />
<TextAlign value="TopCenter" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="radioButton3" />
<Location value="{X=88,Y=24}" />
<Size value="{Width=32, Height=32}" />
<Anchor value="Bottom, Left" />
<CheckAlign value="BottomCenter" />
<TabIndex value="2" />
<TextAlign value="TopCenter" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="radioButton2" />
<Location value="{X=48,Y=24}" />
<Size value="{Width=32, Height=32}" />
<Anchor value="Bottom, Left" />
<CheckAlign value="BottomCenter" />
<TabIndex value="1" />
<TextAlign value="TopCenter" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="radioButton1" />
<Location value="{X=8,Y=24}" />
<Size value="{Width=32, Height=32}" />
<Anchor value="Bottom, Left" />
<CheckAlign value="BottomCenter" />
<TabIndex value="0" />
<TextAlign value="TopCenter" />
</System.Windows.Forms.RadioButton>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox2" />
<TabIndex value="1" />
<Location value="{X=8,Y=160}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=456, Height=72}" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.ButtonsGroupBox}" />
<Controls>
<System.Windows.Forms.ComboBox>
<Name value="defaultButtonComboBox" />
<Anchor value="Bottom, Right" />
<TabIndex value="3" />
<Location value="{X=240,Y=40}" />
<Size value="{Width=172, Height=21}" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label4" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.ButtonsGroupBox.DefaultButtonLabel}" />
<TextAlign value="BottomLeft" />
<Anchor value="Bottom, Right" />
<TabIndex value="2" />
<Size value="{Width=208, Height=16}" />
<Location value="{X=240,Y=24}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="buttonsComboBox" />
<Anchor value="Bottom, Left" />
<TabIndex value="1" />
<Location value="{X=8,Y=40}" />
<Size value="{Width=172, Height=21}" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label3" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.ButtonsGroupBox.ButtonsShownLabel}" />
<TextAlign value="BottomLeft" />
<Anchor value="Bottom, Left" />
<TabIndex value="0" />
<Size value="{Width=160, Height=16}" />
<Location value="{X=8,Y=24}" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox" />
<TabIndex value="0" />
<Location value="{X=8,Y=8}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=456, Height=144}" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.TextGroupBox}" />
<Controls>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.TextGroupBox.MessageLabel}" />
<TextAlign value="BottomLeft" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="2" />
<Size value="{Width=440, Height=16}" />
<Location value="{X=8,Y=64}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="captionTextBox" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="1" />
<Location value="{X=8,Y=32}" />
<Size value="{Width=440, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label" />
<Text value="${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.TextGroupBox.CaptionLabel}" />
<TextAlign value="BottomLeft" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="0" />
<Size value="{Width=440, Height=16}" />
<Location value="{X=8,Y=16}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="messageTextBox" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="3" />
<Location value="{X=8,Y=80}" />
<Size value="{Width=440, Height=55}" />
<Multiline value="True" />
<Text value="" />
</System.Windows.Forms.TextBox>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

46
src/AddIns/Wizards/MessageBoxBuilder/Project/Src/Command/NewClass1.cs

@ -1,46 +0,0 @@ @@ -1,46 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
/// <license>
/// // one line to give the library's name and an idea of what it does.
/// Copyright (C) year name of author
///
/// This library is free software; you can redistribute it and/or
/// modify it under the terms of the GNU Lesser General Public
/// License as published by the Free Software Foundation; either
/// version 2.1 of the License, or (at your option) any later version.
///
/// This library is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
/// Lesser General Public License for more details.
///
/// You should have received a copy of the GNU Lesser General Public
/// License along with this library; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///
/// </license>
namespace MessageBoxBuilder {
using System;
/// <summary>
/// TODO - Add class summary
/// </summary>
/// <remarks>
/// created by - Omnibrain
/// created on - 02.03.2002 15:26:39
/// </remarks>
public class NewClass : object {
/// <summary>
/// Default constructor - initializes all fields to default values
/// </summary>
public NewClass() {
}
}
}

59
src/AddIns/Wizards/MessageBoxBuilder/Project/Src/Command/WizardCommand.cs

@ -1,59 +0,0 @@ @@ -1,59 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Drawing;
using System.Collections;
using System.Diagnostics;
using System.ComponentModel;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.TextEditor;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop;
using ICSharpCode.Core;
namespace Plugins.Wizards.MessageBoxBuilder.Command {
public class WizardCommand : AbstractMenuCommand
{
const string WizardPath = "Plugins/Wizards/MessageBoxBuilderWizard";
public override void Run()
{
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
if (window == null || !(window.ViewContent is ITextEditorControlProvider)) {
return;
}
Properties customizer = new Properties();
Plugins.Wizards.MessageBoxBuilder.Generator.MessageBoxGenerator generator = new Plugins.Wizards.MessageBoxBuilder.Generator.MessageBoxGenerator();
customizer.Set("Generator", generator);
string name = window.ViewContent.IsUntitled ? window.ViewContent.UntitledName :window.ViewContent.FileName;
string language = Path.GetExtension(name).ToLower() == ".cs" ? "C#" : "VBNET";
customizer.Set("Language", language);
using (WizardDialog wizard = new WizardDialog("MessageBox Wizard", customizer, WizardPath)) {
if (wizard.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
TextEditorControl textarea = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl;
if (textarea == null) {
return;
}
string generatedText = generator.GenerateCode(language);
int startLine = textarea.ActiveTextAreaControl.TextArea.Caret.Line;
textarea.ActiveTextAreaControl.TextArea.InsertString(generatedText);
textarea.Document.FormattingStrategy.IndentLines(textarea.ActiveTextAreaControl.TextArea, startLine, textarea.ActiveTextAreaControl.TextArea.Caret.Line);
}
}
}
}
}

79
src/AddIns/Wizards/MessageBoxBuilder/Project/Src/DialogPanels/CodeGenerationPanel.cs

@ -1,79 +0,0 @@ @@ -1,79 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Drawing;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.ComponentModel;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using Plugins.Wizards.MessageBoxBuilder.Generator;
namespace Plugins.Wizards.MessageBoxBuilder.DialogPanels
{
/// <summary>
/// Summary description for Form3.
/// </summary>
public class CodeGenerationPanel : AbstractWizardPanel
{
MessageBoxGenerator generator = null;
Properties customizer = null;
string language = null;
public override object CustomizationObject {
get {
return customizer;
}
set {
this.customizer = (Properties)value;
generator = (MessageBoxGenerator)customizer.Get("Generator");
language = customizer.Get("Language").ToString();
generator.Changed += new EventHandler(OnGeneratorChanged);
}
}
void OnGeneratorChanged(object sender, EventArgs e)
{
ControlDictionary["richTextBox"].Text = generator.GenerateCode(language);
}
void ChangedEvent(object sender, EventArgs e)
{
generator.GenerateReturnValue = ((CheckBox)ControlDictionary["generateReturnValueCheckBox"]).Checked;
generator.VariableName = ControlDictionary["variableNameTextBox"].Text;
generator.GenerateSwitchCase = ((CheckBox)ControlDictionary["generateSwitchCaseCheckBox"]).Checked;
SetEnabledStatus(((CheckBox)ControlDictionary["generateReturnValueCheckBox"]).Checked, "variableNameTextBox", "generateSwitchCaseCheckBox");
}
public CodeGenerationPanel()
{
InitializeComponent();
}
void InitializeComponent()
{
SetupFromXmlStream(Assembly.GetCallingAssembly().GetManifestResourceStream("CodeGenerationPanel.xfrm"));
((CheckBox)ControlDictionary["generateReturnValueCheckBox"]).CheckedChanged += new EventHandler(ChangedEvent);
((CheckBox)ControlDictionary["generateSwitchCaseCheckBox"]).CheckedChanged += new EventHandler(ChangedEvent);
ControlDictionary["variableNameTextBox"].Text = "result";
((TextBox)ControlDictionary["variableNameTextBox"]).TextChanged += new EventHandler(ChangedEvent);
ControlDictionary["richTextBox"].Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
SetEnabledStatus(false, "variableNameTextBox", "generateSwitchCaseCheckBox");
}
}
}

110
src/AddIns/Wizards/MessageBoxBuilder/Project/Src/DialogPanels/ViewPropertyPanel.cs

@ -1,110 +0,0 @@ @@ -1,110 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Forms;
using System.Reflection;
using System.Resources;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using Plugins.Wizards.MessageBoxBuilder.Generator;
namespace Plugins.Wizards.MessageBoxBuilder.DialogPanels {
/// <summary>
/// Summary description for Form2.
/// </summary>
public class ViewPropertyPanel : AbstractWizardPanel
{
MessageBoxGenerator generator = null;
Properties customizer = null;
public override object CustomizationObject {
get {
return customizer;
}
set {
this.customizer = (Properties)value;
generator = (MessageBoxGenerator)customizer.Get("Generator");
}
}
void ChangedEvent(object sender, EventArgs e)
{
generator.Text = ControlDictionary["messageTextBox"].Text;
generator.Caption = ControlDictionary["captionTextBox"].Text;
generator.MessageBoxButtons = (MessageBoxButtons)Enum.Parse(typeof(MessageBoxButtons), ControlDictionary["buttonsComboBox"].Text);
generator.MessageBoxDefaultButton = (MessageBoxDefaultButton)Enum.Parse(typeof(MessageBoxDefaultButton), ControlDictionary["defaultButtonComboBox"].Text);
if (((RadioButton)ControlDictionary["radioButton1"]).Checked) {
generator.MessageBoxIcon = MessageBoxIcon.Error;
} else if (((RadioButton)ControlDictionary["radioButton2"]).Checked) {
generator.MessageBoxIcon = MessageBoxIcon.Question;
} else if (((RadioButton)ControlDictionary["radioButton3"]).Checked) {
generator.MessageBoxIcon = MessageBoxIcon.Information;
} else if (((RadioButton)ControlDictionary["radioButton4"]).Checked) {
generator.MessageBoxIcon = MessageBoxIcon.Exclamation;
} else {
generator.MessageBoxIcon = MessageBoxIcon.None;
}
}
void PreviewButton(object sender, EventArgs e)
{
generator.PreviewMessageBox();
}
public ViewPropertyPanel()
{
InitializeComponent();
}
void InitializeComponent()
{
SetupFromXmlStream(Assembly.GetCallingAssembly().GetManifestResourceStream("VisiblePropertiesPanel.xfrm"));
((TextBox)ControlDictionary["captionTextBox"]).TextChanged += new EventHandler(ChangedEvent);
((TextBox)ControlDictionary["messageTextBox"]).TextChanged += new EventHandler(ChangedEvent);
ControlDictionary["previewButton"].Click += new EventHandler(PreviewButton);
((ComboBox)ControlDictionary["buttonsComboBox"]).Items.AddRange(Enum.GetNames(typeof(MessageBoxButtons)));
((ComboBox)ControlDictionary["buttonsComboBox"]).SelectedIndex = 0;
((ComboBox)ControlDictionary["buttonsComboBox"]).SelectedIndexChanged += new EventHandler(ChangedEvent);
((ComboBox)ControlDictionary["defaultButtonComboBox"]).Items.AddRange(Enum.GetNames(typeof(MessageBoxDefaultButton)));
((ComboBox)ControlDictionary["defaultButtonComboBox"]).SelectedIndex = 0;
((ComboBox)ControlDictionary["defaultButtonComboBox"]).SelectedIndexChanged += new EventHandler(ChangedEvent);
((RadioButton)ControlDictionary["radioButton1"]).Image = new Bitmap(SystemIcons.Error.ToBitmap(), 16, 16);
((RadioButton)ControlDictionary["radioButton1"]).FlatStyle = FlatStyle.Standard;
((RadioButton)ControlDictionary["radioButton1"]).CheckedChanged += new EventHandler(ChangedEvent);
((RadioButton)ControlDictionary["radioButton2"]).Image = new Bitmap(SystemIcons.Question.ToBitmap(), 16, 16);
((RadioButton)ControlDictionary["radioButton2"]).FlatStyle = FlatStyle.Standard;
((RadioButton)ControlDictionary["radioButton2"]).CheckedChanged += new EventHandler(ChangedEvent);
((RadioButton)ControlDictionary["radioButton3"]).Image = new Bitmap(SystemIcons.Information.ToBitmap(), 16, 16);
((RadioButton)ControlDictionary["radioButton3"]).FlatStyle = FlatStyle.Standard;
((RadioButton)ControlDictionary["radioButton3"]).CheckedChanged += new EventHandler(ChangedEvent);
((RadioButton)ControlDictionary["radioButton4"]).Image = new Bitmap(SystemIcons.Exclamation.ToBitmap(), 16, 16);
((RadioButton)ControlDictionary["radioButton4"]).FlatStyle = FlatStyle.Standard;
((RadioButton)ControlDictionary["radioButton4"]).CheckedChanged += new EventHandler(ChangedEvent);
((RadioButton)ControlDictionary["radioButton5"]).FlatStyle = FlatStyle.Standard;
((RadioButton)ControlDictionary["radioButton5"]).CheckedChanged += new EventHandler(ChangedEvent);
}
}
}

246
src/AddIns/Wizards/MessageBoxBuilder/Project/Src/Generator/MessageBoxGenerator.cs

@ -1,246 +0,0 @@ @@ -1,246 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Drawing;
using System.Collections;
using System.Diagnostics;
using System.ComponentModel;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
namespace Plugins.Wizards.MessageBoxBuilder.Generator {
public class MessageBoxGenerator
{
MessageBoxButtons messageBoxButtons = MessageBoxButtons.OK;
MessageBoxIcon messageBoxIcon = MessageBoxIcon.None;
MessageBoxDefaultButton messageBoxDefaultButton = MessageBoxDefaultButton.Button1;
string text = String.Empty;
string caption = String.Empty;
bool generateReturnValue = false;
string variableName = String.Empty;
bool generateSwitchCase = false;
public MessageBoxButtons MessageBoxButtons {
get {
return messageBoxButtons;
}
set {
messageBoxButtons = value;
OnChanged(null);
}
}
public MessageBoxIcon MessageBoxIcon {
get {
return messageBoxIcon;
}
set {
messageBoxIcon = value;
OnChanged(null);
}
}
public MessageBoxDefaultButton MessageBoxDefaultButton {
get {
return messageBoxDefaultButton;
}
set {
messageBoxDefaultButton = value;
OnChanged(null);
}
}
public string Text {
get {
return text;
}
set {
text = value;
OnChanged(null);
}
}
public string Caption {
get {
return caption;
}
set {
caption = value;
OnChanged(null);
}
}
public bool GenerateReturnValue {
get {
return generateReturnValue;
}
set {
generateReturnValue = value;
OnChanged(null);
}
}
public string VariableName {
get {
return variableName;
}
set {
variableName = value;
OnChanged(null);
}
}
public bool GenerateSwitchCase {
get {
return generateSwitchCase;
}
set {
generateSwitchCase = value;
OnChanged(null);
}
}
public void PreviewMessageBox()
{
MessageBox.Show(text, caption, messageBoxButtons, messageBoxIcon, messageBoxDefaultButton);
}
public string GenerateCode(string language)
{
if (language == "C#") {
string code = "MessageBox.Show(\"" + text.Replace("\n", "\\n").Replace("\r","").Replace("\"", "\\\"") + "\", \"" +
caption + "\", MessageBoxButtons." +
messageBoxButtons + ", MessageBoxIcon." +
messageBoxIcon + ", MessageBoxDefaultButton." +
messageBoxDefaultButton +");";
if (generateReturnValue) {
code = "DialogResult " + variableName + " = " + code;
if (generateSwitchCase) {
code += "\nswitch(" + variableName +") {\n";
switch(messageBoxButtons) {
case MessageBoxButtons.AbortRetryIgnore:
code += "\tcase DialogResult.Abort:\n";
code += "\t\tbreak;\n";
code += "\tcase DialogResult.Retry:\n";
code += "\t\tbreak;\n";
code += "\tcase DialogResult.Ignore:\n";
code += "\t\tbreak;\n";
break;
case MessageBoxButtons.OK:
code += "\tcase DialogResult.OK:\n";
code += "\t\tbreak;\n";
break;
case MessageBoxButtons.OKCancel:
code += "\tcase DialogResult.OK:\n";
code += "\t\tbreak;\n";
code += "\tcase DialogResult.Cancel:\n";
code += "\t\tbreak;\n";
break;
case MessageBoxButtons.RetryCancel:
code += "\tcase DialogResult.Retry:\n";
code += "\t\tbreak;\n";
code += "\tcase DialogResult.Cancel:\n";
code += "\t\tbreak;\n";
break;
case MessageBoxButtons.YesNo:
code += "\tcase DialogResult.Yes:\n";
code += "\t\tbreak;\n";
code += "\tcase DialogResult.No:\n";
code += "\t\tbreak;\n";
code += "\tcase DialogResult.Ignore:\n";
code += "\t\tbreak;\n";
break;
case MessageBoxButtons.YesNoCancel:
code += "\tcase DialogResult.Yes:\n";
code += "\t\tbreak;\n";
code += "\tcase DialogResult.No:\n";
code += "\t\tbreak;\n";
code += "\tcase DialogResult.Cancel:\n";
code += "\t\tbreak;\n";
break;
}
code += "}";
}
}
return code;
} else if (language == "VBNET") {
string code = "MessageBox.Show(\"" + text.Replace("\n", "\\n").Replace("\r","") + "\", \"" +
caption + "\", MessageBoxButtons." +
messageBoxButtons + ", MessageBoxIcon." +
messageBoxIcon + ", MessageBoxDefaultButton." +
messageBoxDefaultButton +")";
if (generateReturnValue) {
code = "Dim " + variableName + " As DialogResult = " + code;
if (generateSwitchCase) {
code += "\nSelect " + variableName +"\n";
switch(messageBoxButtons) {
case MessageBoxButtons.AbortRetryIgnore:
code += "\tCase DialogResult.Abort\n";
code += "\t\t\n";
code += "\tCase DialogResult.Retry\n";
code += "\t\t\n";
code += "\tCase DialogResult.Ignore\n";
code += "\t\t\n";
break;
case MessageBoxButtons.OK:
code += "\tCase DialogResult.OK\n";
code += "\t\t\n";
break;
case MessageBoxButtons.OKCancel:
code += "\tCase DialogResult.OK\n";
code += "\t\t\n";
code += "\tCase DialogResult.Cancel\n";
code += "\t\t\n";
break;
case MessageBoxButtons.RetryCancel:
code += "\tCase DialogResult.Retry\n";
code += "\t\t\n";
code += "\tCase DialogResult.Cancel\n";
code += "\t\t\n";
break;
case MessageBoxButtons.YesNo:
code += "\tCase DialogResult.Yes\n";
code += "\t\t\n";
code += "\tCase DialogResult.No\n";
code += "\t\t\n";
code += "\tCase DialogResult.Ignore\n";
code += "\t\t\n";
break;
case MessageBoxButtons.YesNoCancel:
code += "\tCase DialogResult.Yes\n";
code += "\t\t\n";
code += "\tCase DialogResult.No\n";
code += "\t\t\n";
code += "\tCase DialogResult.Cancel\n";
code += "\t\t\n";
break;
}
code += "End Select";
}
}
return code;
} else {
throw new System.ArgumentException("Unknown language: " + language);
}
}
void OnChanged(EventArgs e)
{
if (Changed != null) {
Changed(this, e);
}
}
public event EventHandler Changed;
}
}

35
src/AddIns/Wizards/MessageBoxBuilder/Project/Src/Xml/MessageBoxBuilder.addin

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
<AddIn name = "Message Box Builder Wizard"
author = "Mike Krueger"
copyright = "GPL"
url = "unknown"
description = "Creates a messagebox call"
version = "1.0.0">
<Runtime>
<Import assembly="MessageBoxBuilder.dll"/>
</Runtime>
<Path name = "Plugins/Wizards/MessageBoxBuilderWizard">
<DialogPanel id = "View"
label = "${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel.PanelName}"
class = "Plugins.Wizards.MessageBoxBuilder.DialogPanels.ViewPropertyPanel"/>
<DialogPanel id = "CodeGeneration"
label = "${res:Plugins.Wizards.MessageBoxBuilder.DialogPanels.CodeGenerationPanel.PanelName}"
class = "Plugins.Wizards.MessageBoxBuilder.DialogPanels.CodeGenerationPanel"/>
</Path>
<Path name = "/SharpDevelop/Workbench/MainMenu/Tools">
<Condition>
<Or>
<Condition activewindow="ICSharpCode.SharpDevelop.FormDesigner.FormDesignerDisplayBindingWrapper"/>
<Condition activewindow="ICSharpCode.SharpDevelop.FormDesigner.CSharpDesignerDisplayBindingWrapper"/>
<Condition activewindow="ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.TextEditorDisplayBindingWrapper"/>
</Or>
<MenuItem id = "MessageBox Wizard"
insertafter = "Separator1" insertbefore = "Separator2"
label = "${res:Plugins.Wizards.MessageBoxBuilder.MessageBoxWizardMenuCommand}"
description = "${res:Plugins.Wizards.MessageBoxBuilder.MessageBoxWizardMenuCommand.Description}"
class = "Plugins.Wizards.MessageBoxBuilder.Command.WizardCommand"/>
</Condition>
</Path>
</AddIn>
Loading…
Cancel
Save