[chronojump] color on dialog_threshold and other optimizations



commit f54b530335f97483cb74f7a5b7c69759e745d5ba
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sat Aug 22 11:05:17 2020 +0100

    color on dialog_threshold and other optimizations

 glade/dialog_threshold.glade | 265 ++++++++++++++++++++++++++++++-------------
 src/gui/dialogThreshold.cs   |  42 ++++++-
 2 files changed, 221 insertions(+), 86 deletions(-)
---
diff --git a/glade/dialog_threshold.glade b/glade/dialog_threshold.glade
index d651a97e..fba284ae 100644
--- a/glade/dialog_threshold.glade
+++ b/glade/dialog_threshold.glade
@@ -15,7 +15,7 @@
       <widget class="GtkVBox" id="vbox151">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="spacing">16</property>
+        <property name="spacing">12</property>
         <child internal-child="action_area">
           <widget class="GtkHButtonBox" id="hbuttonbox44">
             <property name="visible">True</property>
@@ -51,6 +51,7 @@
           <widget class="GtkVBox" id="vbox152">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="border_width">4</property>
             <property name="spacing">16</property>
             <child>
               <widget class="GtkAlignment" id="alignment1">
@@ -106,32 +107,31 @@
                 </child>
               </widget>
               <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
                 <property name="position">0</property>
               </packing>
             </child>
             <child>
               <widget class="GtkFrame" id="frame2">
+                <property name="height_request">175</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
-                <property name="label_yalign">0.69999998807907104</property>
-                <property name="shadow_type">out</property>
+                <property name="label_yalign">1</property>
+                <property name="shadow_type">in</property>
                 <child>
-                  <widget class="GtkAlignment" id="alignment2">
+                  <widget class="GtkViewport" id="viewport2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="top_padding">10</property>
-                    <property name="bottom_padding">10</property>
-                    <property name="left_padding">10</property>
-                    <property name="right_padding">10</property>
+                    <property name="border_width">4</property>
                     <child>
                       <widget class="GtkScrolledWindow" id="scrolledwindow5">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="border_width">4</property>
                         <property name="hscrollbar_policy">automatic</property>
-                        <property name="vscrollbar_policy">never</property>
+                        <property name="vscrollbar_policy">automatic</property>
                         <child>
                           <widget class="GtkTextView" id="textview_about">
                             <property name="visible">True</property>
@@ -146,7 +146,7 @@
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label23">
+                  <widget class="GtkLabel" id="label_about">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="label" translatable="yes">About threshold</property>
@@ -164,105 +164,206 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkNotebook" id="notebook">
+              <widget class="GtkFrame" id="frame1">
+                <property name="height_request">175</property>
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="label_yalign">1</property>
+                <property name="shadow_type">in</property>
                 <child>
-                  <widget class="GtkScrolledWindow" id="scrolledwindow6">
+                  <widget class="GtkViewport" id="viewport1">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="border_width">6</property>
-                    <property name="hscrollbar_policy">automatic</property>
-                    <property name="vscrollbar_policy">never</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">4</property>
                     <child>
-                      <widget class="GtkTextView" id="textview_jumps">
+                      <widget class="GtkNotebook" id="notebook">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="editable">False</property>
-                        <property name="cursor_visible">False</property>
+                        <property name="border_width">4</property>
+                        <property name="show_tabs">False</property>
+                        <property name="show_border">False</property>
+                        <child>
+                          <widget class="GtkScrolledWindow" id="scrolledwindow6">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="border_width">6</property>
+                            <property name="hscrollbar_policy">never</property>
+                            <property name="vscrollbar_policy">automatic</property>
+                            <child>
+                              <widget class="GtkTextView" id="textview_jumps">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="editable">False</property>
+                                <property name="wrap_mode">word</property>
+                                <property name="cursor_visible">False</property>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label21">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Jumps</property>
+                          </widget>
+                          <packing>
+                            <property name="tab_fill">False</property>
+                            <property name="type">tab</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkScrolledWindow" id="scrolledwindow7">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="border_width">6</property>
+                            <property name="hscrollbar_policy">never</property>
+                            <property name="vscrollbar_policy">automatic</property>
+                            <child>
+                              <widget class="GtkTextView" id="textview_races">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="editable">False</property>
+                                <property name="wrap_mode">word</property>
+                                <property name="cursor_visible">False</property>
+                              </widget>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label26">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Races</property>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                            <property name="tab_fill">False</property>
+                            <property name="type">tab</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkScrolledWindow" id="scrolledwindow8">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="border_width">6</property>
+                            <property name="hscrollbar_policy">never</property>
+                            <property name="vscrollbar_policy">automatic</property>
+                            <child>
+                              <widget class="GtkTextView" id="textview_other">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="editable">False</property>
+                                <property name="wrap_mode">word</property>
+                                <property name="cursor_visible">False</property>
+                              </widget>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label29">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Other tests</property>
+                          </widget>
+                          <packing>
+                            <property name="position">2</property>
+                            <property name="tab_fill">False</property>
+                            <property name="type">tab</property>
+                          </packing>
+                        </child>
                       </widget>
                     </child>
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label21">
+                  <widget class="GtkHBox" id="hbox2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Jumps</property>
-                  </widget>
-                  <packing>
-                    <property name="tab_fill">False</property>
-                    <property name="type">tab</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkScrolledWindow" id="scrolledwindow7">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="border_width">6</property>
-                    <property name="hscrollbar_policy">automatic</property>
-                    <property name="vscrollbar_policy">never</property>
+                    <property name="spacing">12</property>
                     <child>
-                      <widget class="GtkTextView" id="textview_races">
+                      <widget class="GtkRadioButton" id="radio_jumps">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="editable">False</property>
-                        <property name="cursor_visible">False</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="on_radio_jumps_toggled" swapped="no"/>
+                        <child>
+                          <widget class="GtkLabel" id="label_radio_jumps">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Jumps</property>
+                          </widget>
+                        </child>
                       </widget>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
                     </child>
-                  </widget>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label26">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Races</property>
-                  </widget>
-                  <packing>
-                    <property name="position">1</property>
-                    <property name="tab_fill">False</property>
-                    <property name="type">tab</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkScrolledWindow" id="scrolledwindow8">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="border_width">6</property>
-                    <property name="hscrollbar_policy">automatic</property>
-                    <property name="vscrollbar_policy">never</property>
                     <child>
-                      <widget class="GtkTextView" id="textview_other">
+                      <widget class="GtkRadioButton" id="radio_races">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="editable">False</property>
-                        <property name="cursor_visible">False</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radio_jumps</property>
+                        <signal name="toggled" handler="on_radio_races_toggled" swapped="no"/>
+                        <child>
+                          <widget class="GtkLabel" id="label_radio_races">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Races</property>
+                          </widget>
+                        </child>
                       </widget>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_other">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radio_jumps</property>
+                        <signal name="toggled" handler="on_radio_other_toggled" swapped="no"/>
+                        <child>
+                          <widget class="GtkLabel" id="label_radio_other">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Other tests</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
                     </child>
                   </widget>
                   <packing>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label29">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Other tests</property>
-                  </widget>
-                  <packing>
-                    <property name="position">2</property>
-                    <property name="tab_fill">False</property>
-                    <property name="type">tab</property>
+                    <property name="type">label_item</property>
                   </packing>
                 </child>
               </widget>
               <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
                 <property name="position">2</property>
               </packing>
             </child>
diff --git a/src/gui/dialogThreshold.cs b/src/gui/dialogThreshold.cs
index de86d13f..6d978ec7 100644
--- a/src/gui/dialogThreshold.cs
+++ b/src/gui/dialogThreshold.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2016-2017   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2016-2020   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -33,11 +33,20 @@ public class DialogThreshold
        [Widget] Gtk.TextView textview_jumps;
        [Widget] Gtk.TextView textview_races;
        [Widget] Gtk.TextView textview_other;
+       [Widget] Gtk.RadioButton radio_jumps;
+       [Widget] Gtk.RadioButton radio_races;
+       [Widget] Gtk.RadioButton radio_other;
 
        [Widget] Gtk.Label label_threshold_name;
        [Widget] Gtk.Label label_threshold_value;
        [Widget] Gtk.HScale hscale_threshold;
 
+       //just for the colors
+       [Widget] Gtk.Label label_about;
+       [Widget] Gtk.Label label_radio_jumps;
+       [Widget] Gtk.Label label_radio_races;
+       [Widget] Gtk.Label label_radio_other;
+
        private int thresholdCurrent;
        public Button FakeButtonClose;
 
@@ -49,6 +58,13 @@ public class DialogThreshold
                
                //put an icon to window
                UtilGtk.IconWindow(dialog_threshold);
+               UtilGtk.DialogColor(dialog_threshold, Config.ColorBackground);
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, label_threshold_name);
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, label_threshold_value);
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, label_about);
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, label_radio_jumps);
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, label_radio_races);
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, label_radio_other);
 
                FakeButtonClose = new Gtk.Button();
 
@@ -61,17 +77,17 @@ public class DialogThreshold
                if(m == Constants.Menuitem_modes.JUMPSSIMPLE || m == Constants.Menuitem_modes.JUMPSREACTIVE)
                {
                        label_threshold_name.Text = "<b>" + Catalog.GetString("Threshold for jumps") + "</b>";
-                       notebook.CurrentPage = 0;
+                       radio_jumps.Active = true;
                }
                 else if(m == Constants.Menuitem_modes.RUNSSIMPLE || m == 
Constants.Menuitem_modes.RUNSINTERVALLIC)
                {
                        label_threshold_name.Text = "<b>" + Catalog.GetString("Threshold for runs") + "</b>";
-                       notebook.CurrentPage = 1;
+                       radio_races.Active = true;
                }
                else    //other
                {
                        label_threshold_name.Text = "<b>" + Catalog.GetString("Threshold for other tests") + 
"</b>";
-                       notebook.CurrentPage = 2;
+                       radio_other.Active = true;
                }
 
                label_threshold_name.UseMarkup = true;
@@ -117,6 +133,24 @@ public class DialogThreshold
                textview_other.Buffer = tb_other;
        }
 
+       private void on_radio_jumps_toggled (object o, EventArgs args)
+       {
+               if(radio_jumps.Active)
+                       notebook.CurrentPage = 0;
+       }
+
+       private void on_radio_races_toggled (object o, EventArgs args)
+       {
+               if(radio_races.Active)
+                       notebook.CurrentPage = 1;
+       }
+
+       private void on_radio_other_toggled (object o, EventArgs args)
+       {
+               if(radio_other.Active)
+                       notebook.CurrentPage = 2;
+       }
+
        public void on_button_close_clicked (object obj, EventArgs args)
        {
                FakeButtonClose.Click(); //this will call DestroyDialog() later


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