소스 검색

add ip:port form

mikymod 11 년 전
부모
커밋
5cadcd3382
3개의 변경된 파일155개의 추가작업 그리고 28개의 파일을 삭제
  1. 9 5
      tools/gui/console/MainWindow.cs
  2. 76 13
      tools/gui/console/gtk-gui/MainWindow.cs
  3. 70 10
      tools/gui/console/gtk-gui/gui.stetic

+ 9 - 5
tools/gui/console/MainWindow.cs

@@ -342,6 +342,10 @@ public partial class MainWindow: Gtk.Window
 			// Try to connect
 			m_sock = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
 
+			// TODO: Input check
+			m_server_ip = ip_entry.Text;
+			m_server_port = Convert.ToInt16(port_entry.Text);
+
 			// Define the Server address and port
 			IPEndPoint epServer = new IPEndPoint(IPAddress.Parse(m_server_ip), m_server_port);
 
@@ -511,11 +515,6 @@ public partial class MainWindow: Gtk.Window
 		Send (json);
 	}
 
-	protected void OnConnectActivated (object sender, EventArgs e)
-	{
-		Connect ();
-	}
-
 	protected void OnEntryActivated (object sender, EventArgs e)
 	{
 		string text = entry1.Text;
@@ -586,4 +585,9 @@ public partial class MainWindow: Gtk.Window
 
 		args.RetVal = true;
 	}
+
+	protected void OnConnectClicked (object sender, EventArgs e)
+	{
+		Connect ();
+	}
 }

+ 76 - 13
tools/gui/console/gtk-gui/MainWindow.cs

@@ -4,12 +4,29 @@
 public partial class MainWindow
 {
 	private global::Gtk.UIManager UIManager;
+	
 	private global::Gtk.Action FileAction;
-	private global::Gtk.Action ConnectAction;
+	
+	private global::Gtk.Action FileAction1;
+	
+	private global::Gtk.Action EditAction;
+	
 	private global::Gtk.VBox vbox1;
+	
 	private global::Gtk.MenuBar menubar1;
+	
+	private global::Gtk.HBox hbox1;
+	
+	private global::Gtk.Entry ip_entry;
+	
+	private global::Gtk.Entry port_entry;
+	
+	private global::Gtk.Button connect_button;
+	
 	private global::Gtk.ScrolledWindow scrolledwindow1;
+	
 	private global::Gtk.TextView textview1;
+	
 	private global::Gtk.Entry entry1;
 
 	protected virtual void Build ()
@@ -21,9 +38,12 @@ public partial class MainWindow
 		this.FileAction = new global::Gtk.Action ("FileAction", global::Mono.Unix.Catalog.GetString ("File"), null, null);
 		this.FileAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("File");
 		w1.Add (this.FileAction, null);
-		this.ConnectAction = new global::Gtk.Action ("ConnectAction", global::Mono.Unix.Catalog.GetString ("Connect"), null, null);
-		this.ConnectAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Connect");
-		w1.Add (this.ConnectAction, null);
+		this.FileAction1 = new global::Gtk.Action ("FileAction1", global::Mono.Unix.Catalog.GetString ("File"), null, null);
+		this.FileAction1.ShortLabel = global::Mono.Unix.Catalog.GetString ("File");
+		w1.Add (this.FileAction1, null);
+		this.EditAction = new global::Gtk.Action ("EditAction", global::Mono.Unix.Catalog.GetString ("Edit"), null, null);
+		this.EditAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Edit");
+		w1.Add (this.EditAction, null);
 		this.UIManager.InsertActionGroup (w1, 0);
 		this.AddAccelGroup (this.UIManager.AccelGroup);
 		this.Name = "MainWindow";
@@ -34,7 +54,7 @@ public partial class MainWindow
 		this.vbox1.Name = "vbox1";
 		this.vbox1.Spacing = 6;
 		// Container child vbox1.Gtk.Box+BoxChild
-		this.UIManager.AddUiFromString ("<ui><menubar name='menubar1'><menu name='FileAction' action='FileAction'><menuitem name='ConnectAction' action='ConnectAction'/></menu></menubar></ui>");
+		this.UIManager.AddUiFromString ("<ui><menubar name='menubar1'><menu name='FileAction1' action='FileAction1'/><menu name='EditAction' action='EditAction'/></menubar></ui>");
 		this.menubar1 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget ("/menubar1")));
 		this.menubar1.Name = "menubar1";
 		this.vbox1.Add (this.menubar1);
@@ -43,6 +63,49 @@ public partial class MainWindow
 		w2.Expand = false;
 		w2.Fill = false;
 		// Container child vbox1.Gtk.Box+BoxChild
+		this.hbox1 = new global::Gtk.HBox ();
+		this.hbox1.Name = "hbox1";
+		this.hbox1.Spacing = 6;
+		// Container child hbox1.Gtk.Box+BoxChild
+		this.ip_entry = new global::Gtk.Entry ();
+		this.ip_entry.WidthRequest = 261;
+		this.ip_entry.CanFocus = true;
+		this.ip_entry.Name = "ip_entry";
+		this.ip_entry.Text = global::Mono.Unix.Catalog.GetString ("Ip");
+		this.ip_entry.IsEditable = true;
+		this.ip_entry.InvisibleChar = '●';
+		this.hbox1.Add (this.ip_entry);
+		global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.ip_entry]));
+		w3.Position = 0;
+		w3.Expand = false;
+		// Container child hbox1.Gtk.Box+BoxChild
+		this.port_entry = new global::Gtk.Entry ();
+		this.port_entry.CanFocus = true;
+		this.port_entry.Name = "port_entry";
+		this.port_entry.Text = global::Mono.Unix.Catalog.GetString ("Port");
+		this.port_entry.IsEditable = true;
+		this.port_entry.InvisibleChar = '●';
+		this.hbox1.Add (this.port_entry);
+		global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.port_entry]));
+		w4.Position = 1;
+		w4.Expand = false;
+		// Container child hbox1.Gtk.Box+BoxChild
+		this.connect_button = new global::Gtk.Button ();
+		this.connect_button.CanFocus = true;
+		this.connect_button.Name = "connect_button";
+		this.connect_button.UseUnderline = true;
+		this.connect_button.Label = global::Mono.Unix.Catalog.GetString ("Connect");
+		this.hbox1.Add (this.connect_button);
+		global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.connect_button]));
+		w5.Position = 2;
+		w5.Expand = false;
+		w5.Fill = false;
+		this.vbox1.Add (this.hbox1);
+		global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox1]));
+		w6.Position = 1;
+		w6.Expand = false;
+		w6.Fill = false;
+		// Container child vbox1.Gtk.Box+BoxChild
 		this.scrolledwindow1 = new global::Gtk.ScrolledWindow ();
 		this.scrolledwindow1.CanFocus = true;
 		this.scrolledwindow1.Name = "scrolledwindow1";
@@ -54,8 +117,8 @@ public partial class MainWindow
 		this.textview1.Editable = false;
 		this.scrolledwindow1.Add (this.textview1);
 		this.vbox1.Add (this.scrolledwindow1);
-		global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.scrolledwindow1]));
-		w4.Position = 1;
+		global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.scrolledwindow1]));
+		w8.Position = 2;
 		// Container child vbox1.Gtk.Box+BoxChild
 		this.entry1 = new global::Gtk.Entry ();
 		this.entry1.CanFocus = true;
@@ -63,11 +126,11 @@ public partial class MainWindow
 		this.entry1.IsEditable = true;
 		this.entry1.InvisibleChar = '●';
 		this.vbox1.Add (this.entry1);
-		global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.entry1]));
-		w5.PackType = ((global::Gtk.PackType)(1));
-		w5.Position = 2;
-		w5.Expand = false;
-		w5.Fill = false;
+		global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.entry1]));
+		w9.PackType = ((global::Gtk.PackType)(1));
+		w9.Position = 3;
+		w9.Expand = false;
+		w9.Fill = false;
 		this.Add (this.vbox1);
 		if ((this.Child != null)) {
 			this.Child.ShowAll ();
@@ -76,7 +139,7 @@ public partial class MainWindow
 		this.DefaultHeight = 474;
 		this.Show ();
 		this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent);
-		this.ConnectAction.Activated += new global::System.EventHandler (this.OnConnectActivated);
+		this.connect_button.Clicked += new global::System.EventHandler (this.OnConnectClicked);
 		this.entry1.Activated += new global::System.EventHandler (this.OnEntryActivated);
 		this.entry1.KeyPressEvent += new global::Gtk.KeyPressEventHandler (this.OnEntryKeyPressed);
 	}

+ 70 - 10
tools/gui/console/gtk-gui/gui.stetic

@@ -14,11 +14,15 @@
         <property name="Label" translatable="yes">File</property>
         <property name="ShortLabel" translatable="yes">File</property>
       </action>
-      <action id="ConnectAction">
+      <action id="FileAction1">
         <property name="Type">Action</property>
-        <property name="Label" translatable="yes">Connect</property>
-        <property name="ShortLabel" translatable="yes">Connect</property>
-        <signal name="Activated" handler="OnConnectActivated" />
+        <property name="Label" translatable="yes">File</property>
+        <property name="ShortLabel" translatable="yes">File</property>
+      </action>
+      <action id="EditAction">
+        <property name="Type">Action</property>
+        <property name="Label" translatable="yes">Edit</property>
+        <property name="ShortLabel" translatable="yes">Edit</property>
       </action>
     </action-group>
     <property name="MemberName" />
@@ -32,10 +36,9 @@
         <child>
           <widget class="Gtk.MenuBar" id="menubar1">
             <property name="MemberName" />
-            <node name="__gtksharp_99_Stetic_Editor_ActionMenuBar" type="Menubar">
-              <node type="Menu" action="FileAction">
-                <node type="Menuitem" action="ConnectAction" />
-              </node>
+            <node name="__gtksharp_125_Stetic_Editor_ActionMenuBar" type="Menubar">
+              <node type="Menu" action="FileAction1" />
+              <node type="Menu" action="EditAction" />
             </node>
           </widget>
           <packing>
@@ -45,6 +48,63 @@
             <property name="Fill">False</property>
           </packing>
         </child>
+        <child>
+          <widget class="Gtk.HBox" id="hbox1">
+            <property name="MemberName" />
+            <property name="Spacing">6</property>
+            <child>
+              <widget class="Gtk.Entry" id="ip_entry">
+                <property name="MemberName" />
+                <property name="WidthRequest">261</property>
+                <property name="CanFocus">True</property>
+                <property name="Text" translatable="yes">Ip</property>
+                <property name="IsEditable">True</property>
+                <property name="InvisibleChar">●</property>
+              </widget>
+              <packing>
+                <property name="Position">0</property>
+                <property name="AutoSize">False</property>
+                <property name="Expand">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.Entry" id="port_entry">
+                <property name="MemberName" />
+                <property name="CanFocus">True</property>
+                <property name="Text" translatable="yes">Port</property>
+                <property name="IsEditable">True</property>
+                <property name="InvisibleChar">●</property>
+              </widget>
+              <packing>
+                <property name="Position">1</property>
+                <property name="AutoSize">False</property>
+                <property name="Expand">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.Button" id="connect_button">
+                <property name="MemberName" />
+                <property name="CanFocus">True</property>
+                <property name="Type">TextOnly</property>
+                <property name="Label" translatable="yes">Connect</property>
+                <property name="UseUnderline">True</property>
+                <signal name="Clicked" handler="OnConnectClicked" />
+              </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>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
         <child>
           <widget class="Gtk.ScrolledWindow" id="scrolledwindow1">
             <property name="MemberName" />
@@ -60,7 +120,7 @@
             </child>
           </widget>
           <packing>
-            <property name="Position">1</property>
+            <property name="Position">2</property>
             <property name="AutoSize">True</property>
           </packing>
         </child>
@@ -75,7 +135,7 @@
           </widget>
           <packing>
             <property name="PackType">End</property>
-            <property name="Position">2</property>
+            <property name="Position">3</property>
             <property name="AutoSize">True</property>
             <property name="Expand">False</property>
             <property name="Fill">False</property>