[chronojump] person accels work. menu accelerators help



commit 0bcb25a3a108bdfa69ecc812071e1a09c801623d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 24 04:05:01 2011 +0100

    person accels work. menu accelerators help

 glade/chronojump.glade   |  131 ++++++++++++++++++++++++++++++---------------
 src/gui/chronojump.cs    |   46 ++++++++++++++++
 src/gui/dialogMessage.cs |   12 ++++
 src/treeViewPerson.cs    |    3 +-
 4 files changed, 147 insertions(+), 45 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 9d3b7d2..f7af36f 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -15699,6 +15699,15 @@ by you</property>
                       </widget>
                     </child>
                     <child>
+                      <widget class="GtkMenuItem" id="menuitem_accelerators">
+                        <property name="visible">True</property>
+                        <property name="tooltip" translatable="yes">Use Chronojump faster</property>
+                        <property name="label" translatable="yes">_Accelerators</property>
+                        <property name="use_underline">True</property>
+                        <signal name="activate" handler="on_menuitem_accelerators_activate"/>
+                      </widget>
+                    </child>
+                    <child>
                       <widget class="GtkSeparatorMenuItem" id="separator2">
                         <property name="visible">True</property>
                       </widget>
@@ -15842,48 +15851,10 @@ by you</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkButton" id="button_recuperate_persons_from_session1">
-                                        <property name="can_focus">True</property>
-                                        <property name="can_default">True</property>
-                                        <property name="receives_default">True</property>
-                                        <property name="has_tooltip">True</property>
-                                        <property name="tooltip" translatable="yes">Load persons from other session</property>
-                                        <signal name="clicked" handler="on_treeview_persons_up"/>
-                                        <accelerator key="Up" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
-                                        <child>
-                                          <widget class="GtkImage" id="image_persons_open_plus1">
-                                            <property name="visible">True</property>
-                                            <property name="stock">gtk-go-up</property>
-                                          </widget>
-                                        </child>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">4</property>
-                                      </packing>
+                                      <placeholder/>
                                     </child>
                                     <child>
-                                      <widget class="GtkButton" id="button_recuperate_persons_from_session2">
-                                        <property name="can_focus">True</property>
-                                        <property name="can_default">True</property>
-                                        <property name="receives_default">True</property>
-                                        <property name="has_tooltip">True</property>
-                                        <property name="tooltip" translatable="yes">Load persons from other session</property>
-                                        <signal name="clicked" handler="on_treeview_persons_down"/>
-                                        <accelerator key="Down" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
-                                        <child>
-                                          <widget class="GtkImage" id="image_persons_open_plus2">
-                                            <property name="visible">True</property>
-                                            <property name="stock">gtk-go-down</property>
-                                          </widget>
-                                        </child>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">5</property>
-                                      </packing>
+                                      <placeholder/>
                                     </child>
                                   </widget>
                                   <packing>
@@ -15919,11 +15890,83 @@ by you</property>
                                       <widget class="GtkVBox" id="vbox13">
                                         <property name="visible">True</property>
                                         <child>
-                                          <widget class="GtkLabel" id="label18">
+                                          <widget class="GtkHBox" id="hbox35">
                                             <property name="visible">True</property>
-                                            <property name="xalign">0</property>
-                                            <property name="label" translatable="yes">Current person</property>
-                                            <property name="use_markup">True</property>
+                                            <child>
+                                              <widget class="GtkLabel" id="label18">
+                                                <property name="visible">True</property>
+                                                <property name="xalign">0</property>
+                                                <property name="label" translatable="yes">Current person</property>
+                                                <property name="use_markup">True</property>
+                                              </widget>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <widget class="GtkAlignment" id="alignment9">
+                                                <property name="visible">True</property>
+                                                <child>
+                                                  <widget class="GtkHBox" id="hbox36">
+                                                    <property name="visible">True</property>
+                                                    <child>
+                                                      <widget class="GtkButton" id="button_persons_up">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">True</property>
+                                                        <property name="can_default">True</property>
+                                                        <property name="receives_default">True</property>
+                                                        <property name="relief">half</property>
+                                                        <signal name="clicked" handler="on_treeview_persons_up"/>
+                                                        <accelerator key="Up" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
+                                                        <child>
+                                                          <widget class="GtkImage" id="image_persons_up">
+                                                            <property name="visible">True</property>
+                                                            <property name="stock">gtk-go-up</property>
+                                                            <property name="icon-size">2</property>
+                                                          </widget>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkButton" id="button_persons_down">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">True</property>
+                                                        <property name="can_default">True</property>
+                                                        <property name="receives_default">True</property>
+                                                        <property name="relief">half</property>
+                                                        <signal name="clicked" handler="on_treeview_persons_down"/>
+                                                        <accelerator key="Down" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
+                                                        <child>
+                                                          <widget class="GtkImage" id="image_persons_down">
+                                                            <property name="visible">True</property>
+                                                            <property name="stock">gtk-go-down</property>
+                                                            <property name="icon-size">2</property>
+                                                          </widget>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="pack_type">end</property>
+                                                        <property name="position">1</property>
+                                                      </packing>
+                                                    </child>
+                                                  </widget>
+                                                </child>
+                                              </widget>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">False</property>
+                                                <property name="pack_type">end</property>
+                                                <property name="position">1</property>
+                                              </packing>
+                                            </child>
                                           </widget>
                                           <packing>
                                             <property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index d740320..b133361 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -272,6 +272,8 @@ public partial class ChronoJumpWindow
 	//persons
 	private TreeStore treeview_persons_store;
 	private TreeViewPersons myTreeViewPersons;
+	private Gtk.Button fakeButtonPersonUp;
+	private Gtk.Button fakeButtonPersonDown;
 	//normal jumps
 	private TreeStore treeview_jumps_store;
 	private TreeViewJumps myTreeViewJumps;
@@ -442,6 +444,25 @@ public partial class ChronoJumpWindow
 		loadPreferences ();
 
 		createTreeView_persons (treeview_persons);
+
+		/*
+		fakeButtonPersonUp = new Gtk.Button();
+		fakeButtonPersonDown = new Gtk.Button();
+
+		
+		AccelGroup accelGroup = new AccelGroup();
+		app1.AddAccelGroup(accelGroup);
+
+		fakeButtonPersonUp.Clicked += new EventHandler(upClicked);
+
+		AccelKey accelKey = new AccelKey(Gdk.Key.Up, Gdk.ModifierType.ControlMask, AccelFlags.Visible);
+
+		fakeButtonPersonUp.AddAccelerator("clicked", accelGroup, accelKey);
+
+//		Gtk.AccelGroup accelGroup = Accel.GroupsFromObject(app1);
+//		fakeButtonPersonUp.AddAccelerator("Clicked", accelGroup, "<CTRL>Up");
+		*/
+
 		createTreeView_jumps (treeview_jumps);
 		createTreeView_jumps_rj (treeview_jumps_rj);
 		createTreeView_runs (treeview_runs);
@@ -492,6 +513,12 @@ public partial class ChronoJumpWindow
 		
 	}
 	
+	private void upClicked(object o, EventArgs args) {
+		Log.WriteLine("upClicked!!!");
+	}
+	private void up2Clicked(object o, EventArgs args) {
+		Log.WriteLine("up2Clicked!!!");
+	}
 	private void on_extra_window_runs_test_changed(object o, EventArgs args) {
 	}
 	private void on_extra_window_runs_more(object o, EventArgs args) {
@@ -5090,6 +5117,25 @@ Console.WriteLine("X");
 		new DialogMessage(Constants.MessageTypes.INFO, "Here there will be bibliographic information about formulas and some notes.\n\nProbably this will be a window and not a dialog\n\nNote text is selectable");
 	}
 
+	private void on_menuitem_accelerators_activate (object o, EventArgs args) {
+		new DialogMessage(
+				Catalog.GetString("Accelerators help"),
+				Constants.MessageTypes.INFO, 
+				Catalog.GetString("Use these keys in order to work faster.") + "\n\n" +
+				"- " + Catalog.GetString("On execute test tab:") + "\n\n" +
+				"<tt><b>p</b></tt> " + Catalog.GetString("Edit selected person") + "\n" +
+				"<tt><b>CTRL+" + Catalog.GetString("CURSOR_UP") + "</b></tt> " + Catalog.GetString("Select previous person in list") + "\n" +
+				"<tt><b>CTRL+" + Catalog.GetString("CURSOR_DOWN") + "</b></tt> " + Catalog.GetString("Select next person in list") + "\n" +
+				"<tt><b>(space)</b></tt> " + Catalog.GetString("Execute test") + "\n" +
+				"\n" + "- " + Catalog.GetString("On results tab:") + "\n\n" +
+				"<tt><b>z</b></tt> " + Catalog.GetString("Zoom change") + "\n" +
+				"<tt><b>v</b></tt> " + Catalog.GetString("Play video of selected test") + " " + Catalog.GetString("(if available)")+ "\n" +
+				"<tt><b>e</b></tt> " + Catalog.GetString("Edit selected test") + "\n" +
+				"<tt><b>d</b></tt> " + Catalog.GetString("Delete selected test") + "\n" +
+				"<tt><b>r</b></tt> " + Catalog.GetString("Repair selected test") + " " + Catalog.GetString("(if available)")
+				);
+	}
+
 	private void on_about1_activate (object o, EventArgs args) {
 		string translator_credits = Catalog.GetString ("translator-credits");
 		//only print if exist (don't print 'translator-credits' word
diff --git a/src/gui/dialogMessage.cs b/src/gui/dialogMessage.cs
index 649c5ea..0527a56 100644
--- a/src/gui/dialogMessage.cs
+++ b/src/gui/dialogMessage.cs
@@ -31,8 +31,17 @@ public class DialogMessage
 	[Widget] Gtk.Image image_info;
 	[Widget] Gtk.Image image_help;
 
+	public DialogMessage (string title, Constants.MessageTypes type, string message)
+	{
+		initialize(title, type, message);
+	}
 	public DialogMessage (Constants.MessageTypes type, string message)
 	{
+		initialize("", type, message);
+	}
+
+	private void initialize(string title, Constants.MessageTypes type, string message)
+	{
 		Glade.XML gladeXML;
 		gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "dialog_message", null);
 		gladeXML.Autoconnect(this);
@@ -44,6 +53,9 @@ public class DialogMessage
 		//if uncommented, then does weird bug in windows not showing dialog as its correct size until window is moves
 		//dialog_message.Hide();	
 
+		if(title != "")
+			dialog_message.Title = title;
+
 		label_message.Text = message; 
 		label_message.UseMarkup = true; 
 
diff --git a/src/treeViewPerson.cs b/src/treeViewPerson.cs
index a41c0e9..2fc890b 100644
--- a/src/treeViewPerson.cs
+++ b/src/treeViewPerson.cs
@@ -125,7 +125,8 @@ public class TreeViewPersons
 		}
 		return found;
 	}
-	
+
+		
 	public void SelectNextRow(int personID)
 	{
 		SelectRow(FindRow(personID) +1);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]