[longomatch] Add UI to configure tags hotkeys
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add UI to configure tags hotkeys
- Date: Sat, 22 Nov 2014 10:55:47 +0000 (UTC)
commit 0930b2bb0692e3bc7dd8af2843996b20400df84d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Nov 21 17:09:00 2014 +0100
Add UI to configure tags hotkeys
LongoMatch.GUI/Gui/Dialog/EventTypeTagsEditor.cs | 32 ++++++++++++++++----
.../LongoMatch.Gui.Dialog.EventTypeTagsEditor.cs | 27 ++++++++++-------
LongoMatch.GUI/gtk-gui/gui.stetic | 25 ++++++++++-----
3 files changed, 58 insertions(+), 26 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Dialog/EventTypeTagsEditor.cs
b/LongoMatch.GUI/Gui/Dialog/EventTypeTagsEditor.cs
index 61215ec..4c381d3 100644
--- a/LongoMatch.GUI/Gui/Dialog/EventTypeTagsEditor.cs
+++ b/LongoMatch.GUI/Gui/Dialog/EventTypeTagsEditor.cs
@@ -22,6 +22,7 @@ using LongoMatch.Core.Store;
using Mono.Unix;
using Misc = LongoMatch.Gui.Helpers.Misc;
using System.Collections.Generic;
+using LongoMatch.Core.Common;
namespace LongoMatch.Gui.Dialog
{
@@ -142,7 +143,7 @@ namespace LongoMatch.Gui.Dialog
HBox box = new HBox (false, 5);
Label l = new Label ();
Entry entry = new Entry (name);
- Button b = RemoveButton ();
+ Button b = Button ("gtk-remove");
l.Markup = Catalog.GetString ("<b>Group name:</b>");
g.nameEntry = entry;
@@ -164,27 +165,46 @@ namespace LongoMatch.Gui.Dialog
{
HBox box = new HBox (false, 2);
Entry tagEntry = new Entry (tag.Value);
- Button b = RemoveButton ();
+ Label hotkeyLabel = new Label (tag.HotKey.ToString ());
+ Button editHK = Button ("gtk-edit");
+ Button b = Button ("gtk-remove");
b.Clicked += (sender, e) => {
RemoveTag (tag, g);
};
+ editHK.Clicked += (sender, e) => {
+ HotKey hotkey = Config.GUIToolkit.SelectHotkey (tag.HotKey);
+ if (hotkey != null) {
+ try {
+ if (EventType.Tags.Select (tt => tt.HotKey).Contains
(hotkey)) {
+ throw new HotkeyAlreadyInUse (hotkey);
+ }
+ tag.HotKey = hotkey;
+ hotkeyLabel.Text = hotkey.ToString ();
+ } catch (HotkeyAlreadyInUse ex) {
+ Config.GUIToolkit.ErrorMessage (ex.Message, this);
+ }
+ }
+ };
+
tagEntry.Changed += (o, e) => {
tag.Value = tagEntry.Text;
};
focusEntry = tagEntry;
- box.PackStart (tagEntry, true, true, 0);
+ box.PackStart (tagEntry, false, false, 0);
+ box.PackStart (hotkeyLabel, false, false, 0);
+ box.PackStart (editHK, false, false, 0);
box.PackStart (b, false, false, 0);
InsertInTable (t, box, i);
}
- Button RemoveButton ()
+ Button Button (string name)
{
Button b = new Button ();
Alignment a = new Alignment (0.5F, 0.5F, 0F, 0F);
- Gtk.Image i = new Image (Misc.LoadIcon ("gtk-remove", 24));
+ Gtk.Image i = new Gtk.Image (Misc.LoadIcon (name, 24));
a.Add (i);
b.Add (a);
return b;
@@ -193,7 +213,7 @@ namespace LongoMatch.Gui.Dialog
Button CreateButton (string s, int size)
{
Button b = new Button ();
- Gtk.Image i = new Image (Misc.LoadIcon ("gtk-add", size));
+ Gtk.Image i = new Gtk.Image (Misc.LoadIcon ("gtk-add", size));
Label l = new Label (s);
HBox box = new HBox ();
box.PackStart (i, false, false, 5);
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.EventTypeTagsEditor.cs
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.EventTypeTagsEditor.cs
index 7f87028..beab0e0 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.EventTypeTagsEditor.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.EventTypeTagsEditor.cs
@@ -5,6 +5,7 @@ namespace LongoMatch.Gui.Dialog
public partial class EventTypeTagsEditor
{
private global::Gtk.ScrolledWindow scrolledwindow2;
+ private global::Gtk.Alignment alignment1;
private global::Gtk.VBox mainvbox;
private global::Gtk.Button buttonOk;
@@ -34,20 +35,24 @@ namespace LongoMatch.Gui.Dialog
global::Gtk.Viewport w2 = new global::Gtk.Viewport ();
w2.ShadowType = ((global::Gtk.ShadowType)(0));
// Container child GtkViewport.Gtk.Container+ContainerChild
+ this.alignment1 = new global::Gtk.Alignment (0.5F, 0F, 1F, 0F);
+ this.alignment1.Name = "alignment1";
+ // Container child alignment1.Gtk.Container+ContainerChild
this.mainvbox = new global::Gtk.VBox ();
this.mainvbox.Name = "mainvbox";
this.mainvbox.Spacing = 6;
- w2.Add (this.mainvbox);
+ this.alignment1.Add (this.mainvbox);
+ w2.Add (this.alignment1);
this.scrolledwindow2.Add (w2);
w1.Add (this.scrolledwindow2);
- global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(w1 [this.scrolledwindow2]));
- w5.Position = 0;
+ global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(w1 [this.scrolledwindow2]));
+ w6.Position = 0;
// Internal child LongoMatch.Gui.Dialog.EventTypeTagsEditor.ActionArea
- global::Gtk.HButtonBox w6 = this.ActionArea;
- w6.Name = "dialog1_ActionArea";
- w6.Spacing = 10;
- w6.BorderWidth = ((uint)(5));
- w6.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
+ global::Gtk.HButtonBox w7 = this.ActionArea;
+ w7.Name = "dialog1_ActionArea";
+ w7.Spacing = 10;
+ w7.BorderWidth = ((uint)(5));
+ w7.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonOk = new global::Gtk.Button ();
this.buttonOk.CanDefault = true;
@@ -57,9 +62,9 @@ namespace LongoMatch.Gui.Dialog
this.buttonOk.UseUnderline = true;
this.buttonOk.Label = "gtk-ok";
this.AddActionWidget (this.buttonOk, -5);
- global::Gtk.ButtonBox.ButtonBoxChild w7 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w6
[this.buttonOk]));
- w7.Expand = false;
- w7.Fill = false;
+ global::Gtk.ButtonBox.ButtonBoxChild w8 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w7
[this.buttonOk]));
+ w8.Expand = false;
+ w8.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index 7a90f48..c0baa57 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -10256,17 +10256,24 @@ You can continue with the current capture, cancel it or save your project.
<property name="MemberName" />
<property name="ShadowType">None</property>
<child>
- <widget class="Gtk.VBox" id="mainvbox">
+ <widget class="Gtk.Alignment" id="alignment1">
<property name="MemberName" />
- <property name="Spacing">6</property>
- <child>
- <placeholder />
- </child>
- <child>
- <placeholder />
- </child>
+ <property name="Yscale">0</property>
+ <property name="Yalign">0</property>
<child>
- <placeholder />
+ <widget class="Gtk.VBox" id="mainvbox">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ </widget>
</child>
</widget>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]