Przeglądaj źródła

add starter tool gui

mikymod 11 lat temu
rodzic
commit
878a156869

+ 13 - 0
tools/gui/starter/MainWindow.cs

@@ -3,6 +3,10 @@ using Gtk;
 
 public partial class MainWindow: Gtk.Window
 {
+	public string project_name;
+	public string source_path;
+	public string destination_path;
+
 	public MainWindow () : base (Gtk.WindowType.Toplevel)
 	{
 		Build ();
@@ -13,4 +17,13 @@ public partial class MainWindow: Gtk.Window
 		Application.Quit ();
 		a.RetVal = true;
 	}
+
+	protected void OnProjectButtonClicked (object sender, EventArgs e)
+	{
+		starter.ProjectDialog pd = new starter.ProjectDialog (this);
+		pd.Run ();
+		pd.Destroy ();
+
+		project_entry.Text = project_name;
+	}
 }

+ 54 - 0
tools/gui/starter/ProjectDialog.cs

@@ -0,0 +1,54 @@
+using System;
+using Gtk;
+
+namespace starter
+{
+	public partial class ProjectDialog : Gtk.Dialog
+	{
+		MainWindow win;
+
+		public ProjectDialog (MainWindow win)
+		{
+			this.Build ();
+			this.win = win;
+		}
+
+		protected void OnProjectDialogOkClicked (object sender, EventArgs e)
+		{
+			win.project_name = name_entry.Text;
+			win.source_path = source_entry.Text;
+			win.destination_path = destination_entry.Text;
+		}
+
+		protected void OnSourceButtonClicked (object sender, EventArgs e)
+		{
+			Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the file to open",
+				this.win,
+				FileChooserAction.SelectFolder,
+				"Cancel", ResponseType.Cancel,
+				"Open", ResponseType.Accept);
+			if (fc.Run () == (int)ResponseType.Accept) 
+			{
+				source_entry.Text = fc.Filename;
+			}
+
+			fc.Destroy ();
+		}
+
+		protected void OnDestinationButtonClicked (object sender, EventArgs e)
+		{
+			Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the file to open",
+				this,
+				FileChooserAction.SelectFolder,
+				"Cancel", ResponseType.Cancel,
+				"Open", ResponseType.Accept);
+			if (fc.Run () == (int)ResponseType.Accept) 
+			{
+				destination_entry.Text = fc.Filename;
+			}
+
+			fc.Destroy ();
+		}
+	}
+}
+

+ 13 - 1
tools/gui/starter/gtk-gui/MainWindow.cs

@@ -36,6 +36,8 @@ public partial class MainWindow
 	private global::Gtk.Button button6;
 	
 	private global::Gtk.Button run_button;
+	
+	private global::Gtk.Statusbar statusbar1;
 
 	protected virtual void Build ()
 	{
@@ -212,13 +214,23 @@ public partial class MainWindow
 		w16.Position = 1;
 		w16.Expand = false;
 		w16.Fill = false;
+		// Container child vbox4.Gtk.Box+BoxChild
+		this.statusbar1 = new global::Gtk.Statusbar ();
+		this.statusbar1.Name = "statusbar1";
+		this.statusbar1.Spacing = 6;
+		this.vbox4.Add (this.statusbar1);
+		global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.statusbar1]));
+		w17.Position = 2;
+		w17.Expand = false;
+		w17.Fill = false;
 		this.Add (this.vbox4);
 		if ((this.Child != null)) {
 			this.Child.ShowAll ();
 		}
 		this.DefaultWidth = 291;
-		this.DefaultHeight = 213;
+		this.DefaultHeight = 236;
 		this.Show ();
 		this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent);
+		this.project_button.Clicked += new global::System.EventHandler (this.OnProjectButtonClicked);
 	}
 }

+ 240 - 1
tools/gui/starter/gtk-gui/gui.stetic

@@ -7,7 +7,7 @@
     <widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <widget-library name="../bin/Debug/starter.exe" internal="true" />
   </import>
-  <widget class="Gtk.Window" id="MainWindow" design-size="291 213">
+  <widget class="Gtk.Window" id="MainWindow" design-size="291 236">
     <property name="MemberName" />
     <property name="Title" translatable="yes">Starter</property>
     <property name="WindowPosition">CenterOnParent</property>
@@ -110,6 +110,7 @@
                         <property name="Type">TextOnly</property>
                         <property name="Label" translatable="yes">...</property>
                         <property name="UseUnderline">True</property>
+                        <signal name="Clicked" handler="OnProjectButtonClicked" />
                       </widget>
                       <packing>
                         <property name="Position">1</property>
@@ -233,6 +234,244 @@ Release</property>
             <property name="Fill">False</property>
           </packing>
         </child>
+        <child>
+          <widget class="Gtk.Statusbar" id="statusbar1">
+            <property name="MemberName" />
+            <property name="Spacing">6</property>
+            <child>
+              <placeholder />
+            </child>
+            <child>
+              <placeholder />
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">2</property>
+            <property name="AutoSize">True</property>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="Gtk.Dialog" id="starter.ProjectDialog" design-size="318 165">
+    <property name="MemberName" />
+    <property name="WindowPosition">CenterOnParent</property>
+    <property name="BorderWidth">6</property>
+    <property name="Buttons">2</property>
+    <property name="HelpButton">False</property>
+    <child internal-child="VBox">
+      <widget class="Gtk.VBox" id="dialog1_VBox">
+        <property name="MemberName" />
+        <property name="BorderWidth">8</property>
+        <child>
+          <widget class="Gtk.HBox" id="hbox4">
+            <property name="MemberName" />
+            <property name="Spacing">6</property>
+            <child>
+              <widget class="Gtk.VBox" id="vbox3">
+                <property name="MemberName" />
+                <property name="Spacing">6</property>
+                <child>
+                  <widget class="Gtk.Label" id="name_label">
+                    <property name="MemberName" />
+                    <property name="Xalign">0</property>
+                    <property name="LabelProp" translatable="yes">Name:</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">0</property>
+                    <property name="AutoSize">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.Label" id="source_label">
+                    <property name="MemberName" />
+                    <property name="Xalign">0</property>
+                    <property name="LabelProp" translatable="yes">Source:</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">1</property>
+                    <property name="AutoSize">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.Label" id="bundle_label">
+                    <property name="MemberName" />
+                    <property name="Xalign">0</property>
+                    <property name="LabelProp" translatable="yes">Destination:</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">2</property>
+                    <property name="AutoSize">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="Position">0</property>
+                <property name="AutoSize">True</property>
+                <property name="Expand">False</property>
+                <property name="Fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.VBox" id="vbox4">
+                <property name="MemberName" />
+                <property name="Spacing">6</property>
+                <child>
+                  <widget class="Gtk.Entry" id="name_entry">
+                    <property name="MemberName" />
+                    <property name="CanFocus">True</property>
+                    <property name="IsEditable">True</property>
+                    <property name="InvisibleChar">●</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">0</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.HBox" id="hbox5">
+                    <property name="MemberName" />
+                    <property name="Spacing">6</property>
+                    <child>
+                      <widget class="Gtk.Entry" id="source_entry">
+                        <property name="MemberName" />
+                        <property name="CanFocus">True</property>
+                        <property name="IsEditable">True</property>
+                        <property name="InvisibleChar">●</property>
+                      </widget>
+                      <packing>
+                        <property name="Position">0</property>
+                        <property name="AutoSize">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="Gtk.Button" id="source_button">
+                        <property name="MemberName" />
+                        <property name="CanFocus">True</property>
+                        <property name="Type">TextOnly</property>
+                        <property name="Label" translatable="yes">...</property>
+                        <property name="UseUnderline">True</property>
+                        <signal name="Clicked" handler="OnSourceButtonClicked" />
+                      </widget>
+                      <packing>
+                        <property name="Position">1</property>
+                        <property name="AutoSize">True</property>
+                        <property name="Expand">False</property>
+                        <property name="Fill">False</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="Position">1</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.HBox" id="hbox6">
+                    <property name="MemberName" />
+                    <property name="Spacing">6</property>
+                    <child>
+                      <widget class="Gtk.Entry" id="destination_entry">
+                        <property name="MemberName" />
+                        <property name="CanFocus">True</property>
+                        <property name="IsEditable">True</property>
+                        <property name="InvisibleChar">●</property>
+                      </widget>
+                      <packing>
+                        <property name="Position">0</property>
+                        <property name="AutoSize">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="Gtk.Button" id="destination_button">
+                        <property name="MemberName" />
+                        <property name="CanFocus">True</property>
+                        <property name="Type">TextOnly</property>
+                        <property name="Label" translatable="yes">...</property>
+                        <property name="UseUnderline">True</property>
+                        <signal name="Clicked" handler="OnDestinationButtonClicked" />
+                      </widget>
+                      <packing>
+                        <property name="Position">1</property>
+                        <property name="AutoSize">True</property>
+                        <property name="Expand">False</property>
+                        <property name="Fill">False</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="Position">2</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="Position">1</property>
+                <property name="AutoSize">True</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">0</property>
+            <property name="AutoSize">True</property>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+    <child internal-child="ActionArea">
+      <widget class="Gtk.HButtonBox" id="dialog1_ActionArea">
+        <property name="MemberName" />
+        <property name="Spacing">10</property>
+        <property name="BorderWidth">5</property>
+        <property name="Size">2</property>
+        <property name="LayoutStyle">End</property>
+        <child>
+          <widget class="Gtk.Button" id="buttonCancel">
+            <property name="MemberName" />
+            <property name="CanDefault">True</property>
+            <property name="CanFocus">True</property>
+            <property name="UseStock">True</property>
+            <property name="Type">StockItem</property>
+            <property name="StockId">gtk-cancel</property>
+            <property name="ResponseId">-6</property>
+            <property name="label">gtk-cancel</property>
+          </widget>
+          <packing>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="Gtk.Button" id="buttonOk">
+            <property name="MemberName" />
+            <property name="CanDefault">True</property>
+            <property name="CanFocus">True</property>
+            <property name="UseStock">True</property>
+            <property name="Type">StockItem</property>
+            <property name="StockId">gtk-ok</property>
+            <property name="ResponseId">-5</property>
+            <signal name="Clicked" handler="OnProjectDialogOkClicked" />
+            <property name="label">gtk-ok</property>
+          </widget>
+          <packing>
+            <property name="Position">1</property>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
       </widget>
     </child>
   </widget>

+ 211 - 0
tools/gui/starter/gtk-gui/starter.ProjectDialog.cs

@@ -0,0 +1,211 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace starter
+{
+	public partial class ProjectDialog
+	{
+		private global::Gtk.HBox hbox4;
+		
+		private global::Gtk.VBox vbox3;
+		
+		private global::Gtk.Label name_label;
+		
+		private global::Gtk.Label source_label;
+		
+		private global::Gtk.Label bundle_label;
+		
+		private global::Gtk.VBox vbox4;
+		
+		private global::Gtk.Entry name_entry;
+		
+		private global::Gtk.HBox hbox5;
+		
+		private global::Gtk.Entry source_entry;
+		
+		private global::Gtk.Button source_button;
+		
+		private global::Gtk.HBox hbox6;
+		
+		private global::Gtk.Entry destination_entry;
+		
+		private global::Gtk.Button destination_button;
+		
+		private global::Gtk.Button buttonCancel;
+		
+		private global::Gtk.Button buttonOk;
+
+		protected virtual void Build ()
+		{
+			global::Stetic.Gui.Initialize (this);
+			// Widget starter.ProjectDialog
+			this.Name = "starter.ProjectDialog";
+			this.WindowPosition = ((global::Gtk.WindowPosition)(4));
+			this.BorderWidth = ((uint)(6));
+			// Internal child starter.ProjectDialog.VBox
+			global::Gtk.VBox w1 = this.VBox;
+			w1.Name = "dialog1_VBox";
+			w1.BorderWidth = ((uint)(8));
+			// Container child dialog1_VBox.Gtk.Box+BoxChild
+			this.hbox4 = new global::Gtk.HBox ();
+			this.hbox4.Name = "hbox4";
+			this.hbox4.Spacing = 6;
+			// Container child hbox4.Gtk.Box+BoxChild
+			this.vbox3 = new global::Gtk.VBox ();
+			this.vbox3.Name = "vbox3";
+			this.vbox3.Spacing = 6;
+			// Container child vbox3.Gtk.Box+BoxChild
+			this.name_label = new global::Gtk.Label ();
+			this.name_label.Name = "name_label";
+			this.name_label.Xalign = 0F;
+			this.name_label.LabelProp = global::Mono.Unix.Catalog.GetString ("Name:");
+			this.vbox3.Add (this.name_label);
+			global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.name_label]));
+			w2.Position = 0;
+			w2.Fill = false;
+			// Container child vbox3.Gtk.Box+BoxChild
+			this.source_label = new global::Gtk.Label ();
+			this.source_label.Name = "source_label";
+			this.source_label.Xalign = 0F;
+			this.source_label.LabelProp = global::Mono.Unix.Catalog.GetString ("Source:");
+			this.vbox3.Add (this.source_label);
+			global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.source_label]));
+			w3.Position = 1;
+			w3.Fill = false;
+			// Container child vbox3.Gtk.Box+BoxChild
+			this.bundle_label = new global::Gtk.Label ();
+			this.bundle_label.Name = "bundle_label";
+			this.bundle_label.Xalign = 0F;
+			this.bundle_label.LabelProp = global::Mono.Unix.Catalog.GetString ("Destination:");
+			this.vbox3.Add (this.bundle_label);
+			global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.bundle_label]));
+			w4.Position = 2;
+			w4.Fill = false;
+			this.hbox4.Add (this.vbox3);
+			global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.hbox4 [this.vbox3]));
+			w5.Position = 0;
+			w5.Expand = false;
+			w5.Fill = false;
+			// Container child hbox4.Gtk.Box+BoxChild
+			this.vbox4 = new global::Gtk.VBox ();
+			this.vbox4.Name = "vbox4";
+			this.vbox4.Spacing = 6;
+			// Container child vbox4.Gtk.Box+BoxChild
+			this.name_entry = new global::Gtk.Entry ();
+			this.name_entry.CanFocus = true;
+			this.name_entry.Name = "name_entry";
+			this.name_entry.IsEditable = true;
+			this.name_entry.InvisibleChar = '●';
+			this.vbox4.Add (this.name_entry);
+			global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.name_entry]));
+			w6.Position = 0;
+			w6.Expand = false;
+			w6.Fill = false;
+			// Container child vbox4.Gtk.Box+BoxChild
+			this.hbox5 = new global::Gtk.HBox ();
+			this.hbox5.Name = "hbox5";
+			this.hbox5.Spacing = 6;
+			// Container child hbox5.Gtk.Box+BoxChild
+			this.source_entry = new global::Gtk.Entry ();
+			this.source_entry.CanFocus = true;
+			this.source_entry.Name = "source_entry";
+			this.source_entry.IsEditable = true;
+			this.source_entry.InvisibleChar = '●';
+			this.hbox5.Add (this.source_entry);
+			global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hbox5 [this.source_entry]));
+			w7.Position = 0;
+			// Container child hbox5.Gtk.Box+BoxChild
+			this.source_button = new global::Gtk.Button ();
+			this.source_button.CanFocus = true;
+			this.source_button.Name = "source_button";
+			this.source_button.UseUnderline = true;
+			this.source_button.Label = global::Mono.Unix.Catalog.GetString ("...");
+			this.hbox5.Add (this.source_button);
+			global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox5 [this.source_button]));
+			w8.Position = 1;
+			w8.Expand = false;
+			w8.Fill = false;
+			this.vbox4.Add (this.hbox5);
+			global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.hbox5]));
+			w9.Position = 1;
+			w9.Expand = false;
+			w9.Fill = false;
+			// Container child vbox4.Gtk.Box+BoxChild
+			this.hbox6 = new global::Gtk.HBox ();
+			this.hbox6.Name = "hbox6";
+			this.hbox6.Spacing = 6;
+			// Container child hbox6.Gtk.Box+BoxChild
+			this.destination_entry = new global::Gtk.Entry ();
+			this.destination_entry.CanFocus = true;
+			this.destination_entry.Name = "destination_entry";
+			this.destination_entry.IsEditable = true;
+			this.destination_entry.InvisibleChar = '●';
+			this.hbox6.Add (this.destination_entry);
+			global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox6 [this.destination_entry]));
+			w10.Position = 0;
+			// Container child hbox6.Gtk.Box+BoxChild
+			this.destination_button = new global::Gtk.Button ();
+			this.destination_button.CanFocus = true;
+			this.destination_button.Name = "destination_button";
+			this.destination_button.UseUnderline = true;
+			this.destination_button.Label = global::Mono.Unix.Catalog.GetString ("...");
+			this.hbox6.Add (this.destination_button);
+			global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox6 [this.destination_button]));
+			w11.Position = 1;
+			w11.Expand = false;
+			w11.Fill = false;
+			this.vbox4.Add (this.hbox6);
+			global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.hbox6]));
+			w12.Position = 2;
+			w12.Expand = false;
+			w12.Fill = false;
+			this.hbox4.Add (this.vbox4);
+			global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox4 [this.vbox4]));
+			w13.Position = 1;
+			w1.Add (this.hbox4);
+			global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(w1 [this.hbox4]));
+			w14.Position = 0;
+			w14.Expand = false;
+			w14.Fill = false;
+			// Internal child starter.ProjectDialog.ActionArea
+			global::Gtk.HButtonBox w15 = this.ActionArea;
+			w15.Name = "dialog1_ActionArea";
+			w15.Spacing = 10;
+			w15.BorderWidth = ((uint)(5));
+			w15.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
+			// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+			this.buttonCancel = new global::Gtk.Button ();
+			this.buttonCancel.CanDefault = true;
+			this.buttonCancel.CanFocus = true;
+			this.buttonCancel.Name = "buttonCancel";
+			this.buttonCancel.UseStock = true;
+			this.buttonCancel.UseUnderline = true;
+			this.buttonCancel.Label = "gtk-cancel";
+			this.AddActionWidget (this.buttonCancel, -6);
+			global::Gtk.ButtonBox.ButtonBoxChild w16 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w15 [this.buttonCancel]));
+			w16.Expand = false;
+			w16.Fill = false;
+			// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+			this.buttonOk = new global::Gtk.Button ();
+			this.buttonOk.CanDefault = true;
+			this.buttonOk.CanFocus = true;
+			this.buttonOk.Name = "buttonOk";
+			this.buttonOk.UseStock = true;
+			this.buttonOk.UseUnderline = true;
+			this.buttonOk.Label = "gtk-ok";
+			this.AddActionWidget (this.buttonOk, -5);
+			global::Gtk.ButtonBox.ButtonBoxChild w17 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w15 [this.buttonOk]));
+			w17.Position = 1;
+			w17.Expand = false;
+			w17.Fill = false;
+			if ((this.Child != null)) {
+				this.Child.ShowAll ();
+			}
+			this.DefaultWidth = 318;
+			this.DefaultHeight = 165;
+			this.Show ();
+			this.source_button.Clicked += new global::System.EventHandler (this.OnSourceButtonClicked);
+			this.destination_button.Clicked += new global::System.EventHandler (this.OnDestinationButtonClicked);
+			this.buttonOk.Clicked += new global::System.EventHandler (this.OnProjectDialogOkClicked);
+		}
+	}
+}

+ 2 - 0
tools/gui/starter/starter.csproj

@@ -61,6 +61,8 @@
     <Compile Include="gtk-gui\MainWindow.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="ProjectDialog.cs" />
+    <Compile Include="gtk-gui\starter.ProjectDialog.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>