[chronojump] Generic window with title



commit ca908eb0f71218c128043b32d0ada167bda6c419
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Feb 7 13:08:04 2018 +0100

    Generic window with title

 src/gui/encoder.cs                  |    9 +++++----
 src/gui/encoderSelectRepetitions.cs |    6 +++---
 src/gui/genericWindow.cs            |   29 +++++++++++++++++++----------
 src/gui/person.cs                   |   10 +++++++---
 src/gui/report.cs                   |    4 +++-
 src/gui/session.cs                  |    4 +++-
 6 files changed, 40 insertions(+), 22 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index f335c3e..e4e0caf 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1073,7 +1073,7 @@ public partial class ChronoJumpWindow
                a3.Add(Constants.GenericWindowShow.BUTTONMIDDLE); a3.Add(true); a3.Add("");
                bigArray.Add(a3);
        
-               genericWin = GenericWindow.Show(false,  //don't show now
+               genericWin = GenericWindow.Show("1RM", false,   //don't show now
                                string.Format(Catalog.GetString("Saved 1RM values of athlete {0} in {1} 
exercise."), 
                                        currentPerson.Name, 
UtilGtk.ComboGetActive(combo_encoder_exercise_capture)) + "\n" + 
                                Catalog.GetString("If you want to delete a row, right click on it.") + "\n" + 
@@ -1551,7 +1551,7 @@ public partial class ChronoJumpWindow
                a2.Add(Constants.GenericWindowShow.COMBO); a2.Add(true); a2.Add("");
                bigArray.Add(a2);
                
-               genericWin = GenericWindow.Show(false,  //don't show now
+               genericWin = GenericWindow.Show(Catalog.GetString("Load set"), false,   //don't show now
                                string.Format(Catalog.GetString("Select set of athlete {0} on this 
session."), 
                                        currentPerson.Name) + "\n" + 
                                Catalog.GetString("If you want to edit or delete a row, right click on it."), 
bigArray);
@@ -4123,7 +4123,8 @@ public partial class ChronoJumpWindow
                bigArray.Add(a5);
                
                
-               genericWin = GenericWindow.Show(false, Catalog.GetString("Encoder exercise name:"), bigArray);
+               genericWin = GenericWindow.Show(Catalog.GetString("Exercise"),
+                               false, Catalog.GetString("Encoder exercise name:"), bigArray);
                genericWin.LabelSpinInt = Catalog.GetString("Displaced body weight") + " (%)";
                
                //genericWin.SetSpinRange(ex.percentBodyWeight, ex.percentBodyWeight); //done this because 
IsEditable does not affect the cursors
@@ -4181,7 +4182,7 @@ public partial class ChronoJumpWindow
                bigArray.Add(a5);
                
                
-               genericWin = GenericWindow.Show(false,  //don't show now
+               genericWin = GenericWindow.Show(Catalog.GetString("Exercise"), false,   //don't show now
                                Catalog.GetString("Write the name of the encoder exercise:"), bigArray);
                genericWin.LabelSpinInt = Catalog.GetString("Displaced body weight") + " (%)";
                genericWin.SetSpinRange(0, 100);
diff --git a/src/gui/encoderSelectRepetitions.cs b/src/gui/encoderSelectRepetitions.cs
index b0c05d0..fa984ba 100644
--- a/src/gui/encoderSelectRepetitions.cs
+++ b/src/gui/encoderSelectRepetitions.cs
@@ -251,7 +251,7 @@ public class EncoderSelectRepetitionsIndividualCurrentSession : EncoderSelectRep
                }
                */
                
-               genericWinESR = GenericWindow.Show(false,       //don't show now
+               genericWinESR = GenericWindow.Show(Catalog.GetString("Repetitions"), false,     //don't show 
now
                                string.Format(Catalog.GetString("Saved repetitions of athlete {0} on this 
session."), 
                                        currentPerson.Name) + "\n" + 
                                Catalog.GetString("Activate the repetitions you want to use clicking on first 
column.") + "\n" +
@@ -504,7 +504,7 @@ public class EncoderSelectRepetitionsIndividualAllSessions : EncoderSelectRepeti
        
        protected override void createGenericWindow() 
        {
-               genericWinESR = GenericWindow.Show(false,  //don't show now     //TODO: change message
+               genericWinESR = GenericWindow.Show(Catalog.GetString("Repetitions"), false,  //don't show now 
  //TODO: change message
                                string.Format(Catalog.GetString("Compare repetitions between the following 
sessions"),
                                        currentPerson.Name), bigArray);
 
@@ -675,7 +675,7 @@ public class EncoderSelectRepetitionsGroupalCurrentSession : EncoderSelectRepeti
        
        protected override void createGenericWindow() 
        {
-               genericWinESR = GenericWindow.Show(false,       //don't show now
+               genericWinESR = GenericWindow.Show(Catalog.GetString("Persons compare"), false, //don't show 
now
                                Catalog.GetString("Select persons to compare"), bigArray);
 
                genericWinESR.SetTreeview(columnsString, true, data, nonSensitiveRows, 
Constants.ContextMenu.NONE, false);
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index c27e2ce..98d126b 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -118,8 +118,7 @@ public class GenericWindow
        //used to decide if a genericWin has to be recreated
        public Types Type;
 
-
-       public GenericWindow (string textHeader)
+       public GenericWindow (string title, string textHeader)
        {
                Glade.XML gladeXML;
                gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "generic_window.glade", 
"generic_window", "chronojump");
@@ -129,6 +128,7 @@ public class GenericWindow
                UtilGtk.IconWindow(generic_window);
                
                generic_window.Resizable = false;
+               setTitle(title);
                label_header.Text = textHeader;
                
                HideOnAccept = true;
@@ -136,12 +136,14 @@ public class GenericWindow
        }
 
        //for an array of widgets
-       static public GenericWindow Show (bool showNow, string textHeader, ArrayList array)
+       static public GenericWindow Show (string title, bool showNow, string textHeader, ArrayList array)
        {
                if (GenericWindowBox == null) {
-                       GenericWindowBox = new GenericWindow(textHeader);
-               } else
+                       GenericWindowBox = new GenericWindow(title, textHeader);
+               } else {
+                       GenericWindowBox.setTitle(title);
                        GenericWindowBox.label_header.Text = textHeader;
+               }
 
                GenericWindowBox.Type = Types.UNDEFINED;
 
@@ -160,12 +162,14 @@ public class GenericWindow
        }
 
        //for only one widget
-       static public GenericWindow Show (string textHeader, Constants.GenericWindowShow stuff)
+       static public GenericWindow Show (string title, string textHeader, Constants.GenericWindowShow stuff)
        {
                if (GenericWindowBox == null) {
-                       GenericWindowBox = new GenericWindow(textHeader);
-               } else
+                       GenericWindowBox = new GenericWindow(title, textHeader);
+               } else {
+                       GenericWindowBox.setTitle(title);
                        GenericWindowBox.label_header.Text = textHeader;
+               }
 
                GenericWindowBox.Type = Types.UNDEFINED;
 
@@ -185,8 +189,13 @@ public class GenericWindow
 
                GenericWindowBox.generic_window.Show ();
        }
-       
-       
+
+       private void setTitle(string title)
+       {
+               if(title != "")
+                       generic_window.Title = "Chronojump - " + title;
+       }
+
        void hideWidgets() {
                hbox_error.Hide();
                entry.Hide();
diff --git a/src/gui/person.cs b/src/gui/person.cs
index 3f939e8..8f889ea 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -1427,7 +1427,7 @@ public class PersonAddModifyWindow
        
        void on_button_height_metric_clicked(object obj, EventArgs args) 
        {
-               genericWin = GenericWindow.Show(Catalog.GetString("Select your height"), 
Constants.GenericWindowShow.HEIGHTMETRIC);
+               genericWin = GenericWindow.Show(Catalog.GetString("Height"), Catalog.GetString("Select your 
height"), Constants.GenericWindowShow.HEIGHTMETRIC);
                genericWin.Button_accept.Clicked += new EventHandler(on_button_height_metric_accepted);
        }
        void on_button_height_metric_accepted (object obj, EventArgs args)
@@ -1443,7 +1443,9 @@ public class PersonAddModifyWindow
        
        void on_button_weight_metric_clicked(object obj, EventArgs args) 
        {
-               genericWin = GenericWindow.Show(Catalog.GetString("Select your weight in pounds"), 
Constants.GenericWindowShow.SPINDOUBLE);
+               genericWin = GenericWindow.Show(Catalog.GetString("Weight"),
+                               Catalog.GetString("Select your weight in pounds"),
+                               Constants.GenericWindowShow.SPINDOUBLE);
                genericWin.Button_accept.Clicked += new EventHandler(on_button_weight_metric_accepted);
        }
        void on_button_weight_metric_accepted (object obj, EventArgs args)
@@ -1589,7 +1591,9 @@ public class PersonAddModifyWindow
        void on_button_sport_add_clicked (object o, EventArgs args)
        {
                LogB.Information("sport add clicked");
-               genericWin = GenericWindow.Show(Catalog.GetString("Add new sport to database"), 
Constants.GenericWindowShow.ENTRY);
+               genericWin = GenericWindow.Show(Catalog.GetString("Add sport"),
+                               Catalog.GetString("Add new sport to database"),
+                               Constants.GenericWindowShow.ENTRY);
                genericWin.Button_accept.Clicked += new EventHandler(on_sport_add_accepted);
        }
 
diff --git a/src/gui/report.cs b/src/gui/report.cs
index 297c67b..cc82c83 100644
--- a/src/gui/report.cs
+++ b/src/gui/report.cs
@@ -350,7 +350,9 @@ public class ReportWindow {
                                comment = statRow[8];
                        }
                        
-                       genericWin = GenericWindow.Show(Catalog.GetString("Comment this statistic"), 
Constants.GenericWindowShow.TEXTVIEW);
+                       genericWin = GenericWindow.Show(Catalog.GetString("Add comment"),
+                                       Catalog.GetString("Comment this statistic"),
+                                       Constants.GenericWindowShow.TEXTVIEW);
                        genericWin.SetTextview(comment);
                        genericWin.Button_accept.Clicked += new EventHandler(on_comment_add_accepted);
                }
diff --git a/src/gui/session.cs b/src/gui/session.cs
index 1d3c5cc..e6871de 100644
--- a/src/gui/session.cs
+++ b/src/gui/session.cs
@@ -546,7 +546,9 @@ public class SessionAddEditWindow {
        void on_button_sport_add_clicked (object o, EventArgs args)
        {
                LogB.Information("sport add clicked");
-               genericWin = GenericWindow.Show(Catalog.GetString("Add new sport to database"), 
Constants.GenericWindowShow.ENTRY);
+               genericWin = GenericWindow.Show(Catalog.GetString("Add sport"),
+                               Catalog.GetString("Add new sport to database"),
+                               Constants.GenericWindowShow.ENTRY);
                genericWin.Button_accept.Clicked += new EventHandler(on_sport_add_accepted);
        }
 


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