| 0: | // ExternalToolPanel.cs | |
| 1: | // Copyright (C) 2000 Mike Krueger | |
| 2: | // | |
| 3: | // This program is free software; you can redistribute it and/or modify | |
| 4: | // it under the terms of the GNU General Public License as published by | |
| 5: | // the Free Software Foundation; either version 2 of the License, or | |
| 6: | // (at your option) any later version. | |
| 7: | // | |
| 8: | // This program is distributed in the hope that it will be useful, | |
| 9: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 10: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 11: | // GNU General Public License for more details. | |
| 12: | // | |
| 13: | // You should have received a copy of the GNU General Public License | |
| 14: | // along with this program; if not, write to the Free Software | |
| 15: | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 16: | ||
| 17: | using System; | |
| 18: | using System.Collections; | |
| 19: | using System.Windows.Forms; | |
| 20: | ||
| 21: | using SharpDevelop.Internal.ExternalTool; | |
| 22: | using SharpDevelop.Tool.Data; | |
| 23: | ||
| 24: | namespace SharpDevelop.Gui.Dialogs.OptionPanels { | |
| 25: | ||
| 26: | public class ExternalToolPane : AbstractOptionPanel | |
| 27: | { | |
| 28: | private System.ComponentModel.Container components; | |
| 29: | // private System.Windows.Forms.Button helpButton; | |
| 30: | private System.Windows.Forms.Button removeButton; | |
| 31: | private System.Windows.Forms.Button addButton; | |
| 32: | ||
| 33: | // private System.Windows.Forms.Button okButton; | |
| 34: | // private System.Windows.Forms.Button cancelButton = new Button(); | |
| 35: | private System.Windows.Forms.PropertyGrid toolPropertyGrid; | |
| 36: | private System.Windows.Forms.Label label1; | |
| 37: | private System.Windows.Forms.ListBox toolListBox; | |
| 38: | ||
| 39: | public override void Accept() | |
| 40: | { | |
| 41: | ArrayList newlist = new ArrayList(); | |
| 42: | foreach (object o in toolListBox.Items) { | |
| 43: | if (o != null) | |
| 44: | newlist.Add(o); | |
| 45: | } | |
| 46: | ToolLoader.Tool = newlist; | |
| 47: | } | |
| 48: | ||
| 49: | void selectEvent(object sender, EventArgs e) | |
| 50: | { | |
| 51: | toolPropertyGrid.SelectedObject = toolListBox.SelectedItem; | |
| 52: | } | |
| 53: | ||
| 54: | void removeEvent(object sender, EventArgs e) | |
| 55: | { | |
| 56: | Console.WriteLine("remove"); | |
| 57: | if (toolListBox.SelectedIndex != -1) { | |
| 58: | toolListBox.Items.Remove(toolListBox.Items[toolListBox.SelectedIndex]); | |
| 59: | } | |
| 60: | } | |
| 61: | ||
| 62: | void addEvent(object sender, EventArgs e) | |
| 63: | { | |
| 64: | toolListBox.Items.Add(new ExternalTool()); | |
| 65: | } | |
| 66: | ||
| 67: | public ExternalToolPane() : base(Resource.GetString("Dialog.Options.ExternalToolsText")) | |
| 68: | { | |
| 69: | InitializeComponents(); | |
| 70: | } | |
| 71: | ||
| 72: | /// <summary> | |
| 73: | /// Clean up any resources being used. | |
| 74: | /// </summary> | |
| 75: | protected override void Dispose(bool disposing) | |
| 76: | { | |
| 77: | if (disposing) { | |
| 78: | if (components != null){ | |
| 79: | components.Dispose(); | |
| 80: | } | |
| 81: | } | |
| 82: | base.Dispose(disposing); | |
| 83: | } | |
| 84: | ||
| 85: | ||
| 86: | /// <summary> | |
| 87: | /// Required method for Designer support - do not modify | |
| 88: | /// the contents of this method with an editor | |
| 89: | /// </summary> | |
| 90: | void InitializeComponents() | |
| 91: | { | |
| 92: | this.components = new System.ComponentModel.Container(); | |
| 93: | // this.helpButton = new System.Windows.Forms.Button(); | |
| 94: | this.removeButton = new System.Windows.Forms.Button(); | |
| 95: | this.label1 = new System.Windows.Forms.Label(); | |
| 96: | this.addButton = new System.Windows.Forms.Button(); | |
| 97: | // this.okButton = new System.Windows.Forms.Button(); | |
| 98: | this.toolListBox = new System.Windows.Forms.ListBox(); | |
| 99: | this.toolPropertyGrid = new System.Windows.Forms.PropertyGrid(); | |
| 100: | ||
| 101: | removeButton.Location = new System.Drawing.Point(90, 248); | |
| 102: | removeButton.Size = new System.Drawing.Size(74, 24); | |
| 103: | removeButton.TabIndex = 6; | |
| 104: | removeButton.Text = Resource.GetString("Global.RemoveButtonText"); | |
| 105: | removeButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; | |
| 106: | removeButton.Click += new EventHandler(removeEvent); | |
| 107: | ||
| 108: | label1.Location = new System.Drawing.Point(8, 8); | |
| 109: | label1.Text = Resource.GetString("Dialog.Options.ExternalTool.ToolsLabel"); | |
| 110: | ||
| 111: | label1.Size = new System.Drawing.Size(100, 16); | |
| 112: | label1.TabIndex = 1; | |
| 113: | ||
| 114: | // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | |
| 115: | //@design this.TrayLargeIcon = true; | |
| 116: | //@design this.TrayHeight = 0; | |
| 117: | this.ClientSize = new System.Drawing.Size(368 + 60, 277); | |
| 118: | ||
| 119: | addButton.Location = new System.Drawing.Point(8, 248); | |
| 120: | addButton.Size = new System.Drawing.Size(74, 24); | |
| 121: | addButton.TabIndex = 5; | |
| 122: | addButton.Text = Resource.GetString("Global.AddButtonText"); | |
| 123: | addButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; | |
| 124: | ||
| 125: | toolListBox.Location = new System.Drawing.Point(8, 24); | |
| 126: | toolListBox.Size = new System.Drawing.Size(144, 212); | |
| 127: | toolListBox.TabIndex = 0; | |
| 128: | toolListBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; | |
| 129: | ||
| 130: | toolPropertyGrid.Location = new System.Drawing.Point(168, 8); | |
| 131: | toolPropertyGrid.Text = "PropertyGrid"; | |
| 132: | toolPropertyGrid.LineColor = System.Drawing.SystemColors.ScrollBar; | |
| 133: | // toolPropertyGrid.OutlineColor = System.Drawing.SystemColors.GrayText; | |
| 134: | // toolPropertyGrid.TextColor = System.Drawing.SystemColors.WindowText; | |
| 135: | toolPropertyGrid.Size = new System.Drawing.Size(184 + 60, 232); | |
| 136: | toolPropertyGrid.LargeButtons = false; | |
| 137: | // toolPropertyGrid.ActiveDocument = null; | |
| 138: | toolPropertyGrid.TabIndex = 2; | |
| 139: | toolPropertyGrid.CommandsVisibleIfAvailable = true; | |
| 140: | toolPropertyGrid.Anchor = AnchorStyles.Top | AnchorStyles.Bottom| AnchorStyles.Right |AnchorStyles.Left; | |
| 141: | ||
| 142: | // this.Controls.Add(helpButton); | |
| 143: | this.Controls.Add(removeButton); | |
| 144: | this.Controls.Add(addButton); | |
| 145: | // this.Controls.Add(okButton); | |
| 146: | // this.Controls.Add(cancelButton); | |
| 147: | this.Controls.Add(toolPropertyGrid); | |
| 148: | this.Controls.Add(label1); | |
| 149: | this.Controls.Add(toolListBox); | |
| 150: | ||
| 151: | // Required for Win Form Designer support | |
| 152: | // CancelButton = cancelButton; | |
| 153: | // AcceptButton = okButton; | |
| 154: | foreach (object o in ToolLoader.Tool) | |
| 155: | toolListBox.Items.Add(o); | |
| 156: | toolListBox.SelectedIndexChanged += new EventHandler(selectEvent); | |
| 157: | // okButton.Click += new EventHandler(closeEvent); | |
| 158: | removeButton.Click+=new EventHandler(removeEvent); | |
| 159: | addButton.Click += new EventHandler(addEvent); | |
| 160: | // MaximizeBox = MinimizeBox = false; | |
| 161: | ||
| 162: | } | |
| 163: | } | |
| 164: | } |
This page was automatically generated by SharpDevelop.