diff --git a/Programs/GridProxyGUI/MainWindow.Persistance.cs b/Programs/GridProxyGUI/MainWindow.Persistance.cs index 07046d75..f6f7de93 100755 --- a/Programs/GridProxyGUI/MainWindow.Persistance.cs +++ b/Programs/GridProxyGUI/MainWindow.Persistance.cs @@ -87,6 +87,8 @@ public partial class MainWindow messages.Messages.AppendValues(session); } } + + SessionFileName = fileName; } } catch { } diff --git a/Programs/GridProxyGUI/MainWindow.cs b/Programs/GridProxyGUI/MainWindow.cs index 104cf48c..0c397166 100755 --- a/Programs/GridProxyGUI/MainWindow.cs +++ b/Programs/GridProxyGUI/MainWindow.cs @@ -442,6 +442,8 @@ public partial class MainWindow : Gtk.Window void SetVisibility() { + tabsMain.Page = 2; + var w1 = vboxInspector.Children.GetValue(0) as Widget; var w2 = vboxInspector.Children.GetValue(1) as Widget; diff --git a/Programs/GridProxyGUI/MessageScroller.cs b/Programs/GridProxyGUI/MessageScroller.cs index 635bf84e..c42341f9 100755 --- a/Programs/GridProxyGUI/MessageScroller.cs +++ b/Programs/GridProxyGUI/MessageScroller.cs @@ -32,6 +32,111 @@ namespace GridProxyGUI ShowAll(); } + protected void ShowContext() + { + var selected = Selection.GetSelectedRows(); + if (selected.Length < 1) return; + + Menu context = new Menu(); + + MenuItem item = new MenuItem("Remove"); + item.Activated += (sender, e) => + { + foreach (var p in selected) + { + TreeIter iter; + if (Messages.GetIter(out iter, p)) + { + Messages.Remove(ref iter); + } + } + Selection.UnselectAll(); + }; + context.Add(item); + + item = new MenuItem("Remove All"); + item.Activated += (sender, e) => + { + Selection.UnselectAll(); + Messages.Clear(); + }; + context.Add(item); + + context.Add(new SeparatorMenuItem()); + + item = new MenuItem("Select All"); + item.Activated += (sender, e) => + { + Selection.SelectAll(); + }; + context.Add(item); + + item = new MenuItem("Deselect"); + item.Activated += (sender, e) => + { + Selection.UnselectAll(); + }; + context.Add(item); + + context.Add(new SeparatorMenuItem()); + + item = new MenuItem("Copy"); + item.Activated += (sender, e) => + { + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + foreach (var p in selected) + { + TreeIter iter; + if (Messages.GetIter(out iter, p)) + { + var session = Messages.GetValue(iter, 0) as Session; + if (session != null) + { + sb.AppendLine(string.Join(" | ", session.Columns)); + } + } + + Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false)).Text = sb.ToString().TrimEnd(); + } + }; + context.Add(item); + + context.ShowAll(); + context.Popup(); + } + + protected override bool OnButtonPressEvent(Gdk.EventButton evnt) + { + if (evnt.Type == Gdk.EventType.ButtonPress && evnt.Button == 3) // right click press + { + TreePath path; + if (GetPathAtPos((int)evnt.X, (int)evnt.Y, out path)) + { + bool amISelected = false; + foreach (var p in Selection.GetSelectedRows()) + { + if (p.Compare(path) == 0) + { + amISelected = true; + break; + } + } + + if (!amISelected) + { + Selection.UnselectAll(); + Selection.SelectPath(path); + } + } + + ShowContext(); + + return true; + } + + return base.OnButtonPressEvent(evnt); + } + void CellDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { var item = model.GetValue(iter, 0) as Session; diff --git a/Programs/GridProxyGUI/gtk-gui/MainWindow.cs b/Programs/GridProxyGUI/gtk-gui/MainWindow.cs index 3e60e0e6..f4733a79 100755 --- a/Programs/GridProxyGUI/gtk-gui/MainWindow.cs +++ b/Programs/GridProxyGUI/gtk-gui/MainWindow.cs @@ -6,22 +6,11 @@ public partial class MainWindow private global::Gtk.UIManager UIManager; private global::Gtk.Action FileAction; private global::Gtk.Action ExitAction; - private global::Gtk.Action EditAction; private global::Gtk.Action HelpAction; private global::Gtk.Action AboutAction; - private global::Gtk.Action RemoveAction; - private global::Gtk.Action SelectAction; - private global::Gtk.Action AllAction; - private global::Gtk.Action AllAction1; - private global::Gtk.Action SelectedAction; - private global::Gtk.Action FindAction; private global::Gtk.Action OpenAction; private global::Gtk.Action SaveAction; private global::Gtk.Action SaveAsAction; - private global::Gtk.Action InvertAction; - private global::Gtk.Action NoneAction; - private global::Gtk.Action CopyAction; - private global::Gtk.Action UnselectedAction; private global::Gtk.VBox vboxMenuMain; private global::Gtk.HBox hboxMenu; private global::Gtk.Alignment alignment2; @@ -109,33 +98,12 @@ public partial class MainWindow this.ExitAction = new global::Gtk.Action ("ExitAction", global::Mono.Unix.Catalog.GetString ("Exit"), null, null); this.ExitAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Exit"); w1.Add (this.ExitAction, "q"); - 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.HelpAction = new global::Gtk.Action ("HelpAction", global::Mono.Unix.Catalog.GetString ("Help"), null, null); this.HelpAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Help"); w1.Add (this.HelpAction, null); this.AboutAction = new global::Gtk.Action ("AboutAction", global::Mono.Unix.Catalog.GetString ("About"), global::Mono.Unix.Catalog.GetString ("Shows the wonderful creator info"), null); this.AboutAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("About"); w1.Add (this.AboutAction, null); - this.RemoveAction = new global::Gtk.Action ("RemoveAction", global::Mono.Unix.Catalog.GetString ("Remove"), null, null); - this.RemoveAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Remove"); - w1.Add (this.RemoveAction, null); - this.SelectAction = new global::Gtk.Action ("SelectAction", global::Mono.Unix.Catalog.GetString ("Select"), null, null); - this.SelectAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Select"); - w1.Add (this.SelectAction, null); - this.AllAction = new global::Gtk.Action ("AllAction", global::Mono.Unix.Catalog.GetString ("All"), null, null); - this.AllAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("All"); - w1.Add (this.AllAction, null); - this.AllAction1 = new global::Gtk.Action ("AllAction1", global::Mono.Unix.Catalog.GetString ("All"), null, null); - this.AllAction1.ShortLabel = global::Mono.Unix.Catalog.GetString ("All"); - w1.Add (this.AllAction1, null); - this.SelectedAction = new global::Gtk.Action ("SelectedAction", global::Mono.Unix.Catalog.GetString ("Selected"), null, null); - this.SelectedAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Selected"); - w1.Add (this.SelectedAction, null); - this.FindAction = new global::Gtk.Action ("FindAction", global::Mono.Unix.Catalog.GetString ("Find"), null, null); - this.FindAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Find (Ctrl-F)"); - w1.Add (this.FindAction, "f"); this.OpenAction = new global::Gtk.Action ("OpenAction", global::Mono.Unix.Catalog.GetString ("Open.."), null, null); this.OpenAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Open Session..."); w1.Add (this.OpenAction, "o"); @@ -145,18 +113,6 @@ public partial class MainWindow this.SaveAsAction = new global::Gtk.Action ("SaveAsAction", global::Mono.Unix.Catalog.GetString ("Save As..."), null, null); this.SaveAsAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Save Session As..."); w1.Add (this.SaveAsAction, null); - this.InvertAction = new global::Gtk.Action ("InvertAction", global::Mono.Unix.Catalog.GetString ("Invert"), null, null); - this.InvertAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Invert"); - w1.Add (this.InvertAction, null); - this.NoneAction = new global::Gtk.Action ("NoneAction", global::Mono.Unix.Catalog.GetString ("None"), null, null); - this.NoneAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("None"); - w1.Add (this.NoneAction, null); - this.CopyAction = new global::Gtk.Action ("CopyAction", global::Mono.Unix.Catalog.GetString ("Copy"), null, null); - this.CopyAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Copy"); - w1.Add (this.CopyAction, "c"); - this.UnselectedAction = new global::Gtk.Action ("UnselectedAction", global::Mono.Unix.Catalog.GetString ("Unselected"), null, null); - this.UnselectedAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Unselected"); - w1.Add (this.UnselectedAction, null); this.UIManager.InsertActionGroup (w1, 0); this.AddAccelGroup (this.UIManager.AccelGroup); this.Name = "MainWindow"; @@ -177,7 +133,7 @@ public partial class MainWindow this.alignment2 = new global::Gtk.Alignment (0.5F, 0.5F, 1F, 1F); this.alignment2.Name = "alignment2"; // Container child alignment2.Gtk.Container+ContainerChild - this.UIManager.AddUiFromString (@""); + this.UIManager.AddUiFromString (@""); this.menuMain = ((global::Gtk.MenuBar)(this.UIManager.GetWidget ("/menuMain"))); this.menuMain.Name = "menuMain"; this.alignment2.Add (this.menuMain); @@ -279,7 +235,7 @@ public partial class MainWindow this.mainSplit = new global::Gtk.HPaned (); this.mainSplit.CanFocus = true; this.mainSplit.Name = "mainSplit"; - this.mainSplit.Position = 400; + this.mainSplit.Position = 1; // Container child mainSplit.Gtk.Paned+PanedChild this.vboxSessions = new global::Gtk.VBox (); this.vboxSessions.Name = "vboxSessions"; @@ -725,16 +681,9 @@ public partial class MainWindow this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent); this.ExitAction.Activated += new global::System.EventHandler (this.OnExitActionActivated); this.AboutAction.Activated += new global::System.EventHandler (this.OnAboutActionActivated); - this.AllAction.Activated += new global::System.EventHandler (this.OnAllActionActivated); - this.AllAction1.Activated += new global::System.EventHandler (this.OnAllAction1Activated); - this.SelectedAction.Activated += new global::System.EventHandler (this.OnSelectedActionActivated); this.OpenAction.Activated += new global::System.EventHandler (this.OnOpenActionActivated); this.SaveAction.Activated += new global::System.EventHandler (this.OnSaveActionActivated); this.SaveAsAction.Activated += new global::System.EventHandler (this.OnSaveAsActionActivated); - this.InvertAction.Activated += new global::System.EventHandler (this.OnInvertActionActivated); - this.NoneAction.Activated += new global::System.EventHandler (this.OnNoneActionActivated); - this.CopyAction.Activated += new global::System.EventHandler (this.OnCopyActionActivated); - this.UnselectedAction.Activated += new global::System.EventHandler (this.OnUnselectedActionActivated); this.btnStart.Clicked += new global::System.EventHandler (this.OnBtnStartClicked); this.cbAutoScroll.Toggled += new global::System.EventHandler (this.OnCbAutoScrollToggled); this.cbSelectAllUDP.Toggled += new global::System.EventHandler (this.OnCbSelectAllUDPToggled); diff --git a/Programs/GridProxyGUI/gtk-gui/gui.stetic b/Programs/GridProxyGUI/gtk-gui/gui.stetic index 181f592f..f4669de3 100644 --- a/Programs/GridProxyGUI/gtk-gui/gui.stetic +++ b/Programs/GridProxyGUI/gtk-gui/gui.stetic @@ -22,11 +22,6 @@ Exit - - Action - Edit - Edit - Action Help @@ -39,40 +34,6 @@ Shows the wonderful creator info - - Action - Remove - Remove - - - Action - Select - Select - - - Action - All - All - - - - Action - All - All - - - - Action - Selected - Selected - - - - Action - <Control>f - Find - Find (Ctrl-F) - Action <Control>o @@ -93,31 +54,6 @@ Save Session As... - - Action - Invert - Invert - - - - Action - None - None - - - - Action - <Primary>c - Copy - Copy - - - - Action - Unselected - Unselected - - Grid Proxy @@ -148,20 +84,6 @@ - - - - - - - - - - - - - -