[chronojump] color on force_sensor_exercise



commit 84e165cd15d9d903edc795369d8390542ba7e4b8
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Aug 21 13:56:04 2020 +0100

    color on force_sensor_exercise

 glade/force_sensor_exercise.glade | 148 +++++++++++++++++++++++++++++---------
 src/gui/forceSensorExercise.cs    |  33 +++++++--
 2 files changed, 142 insertions(+), 39 deletions(-)
---
diff --git a/glade/force_sensor_exercise.glade b/glade/force_sensor_exercise.glade
index 427700c1..94a5d5c7 100644
--- a/glade/force_sensor_exercise.glade
+++ b/glade/force_sensor_exercise.glade
@@ -1153,53 +1153,135 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkNotebook" id="notebook_desc_examples">
+              <widget class="GtkVBox" id="vbox1">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <child>
-                  <widget class="GtkTextView" id="textview_description">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="border_width">8</property>
-                    <property name="editable">False</property>
-                    <property name="wrap_mode">word</property>
-                    <property name="cursor_visible">False</property>
-                  </widget>
-                </child>
+                <property name="can_focus">False</property>
                 <child>
-                  <widget class="GtkLabel" id="label_notebook_desc_examples_desc">
+                  <widget class="GtkHBox" id="hbox1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Description</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <widget class="GtkLabel" id="label_help">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Help:</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_desc_examples_desc">
+                        <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>
+                        <signal name="toggled" handler="on_radio_desc_examples_desc_toggled" swapped="no"/>
+                        <child>
+                          <widget class="GtkLabel" id="label_radio_desc_examples_desc">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Description</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_desc_examples_examples">
+                        <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_desc_examples_desc</property>
+                        <signal name="toggled" handler="on_radio_desc_examples_examples_toggled" 
swapped="no"/>
+                        <child>
+                          <widget class="GtkLabel" id="label_radio_desc_examples_examples">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Examples</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="tab_fill">False</property>
-                    <property name="type">tab</property>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkTextView" id="textview_examples">
+                  <widget class="GtkNotebook" id="notebook_desc_examples">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="border_width">8</property>
-                    <property name="editable">False</property>
-                    <property name="wrap_mode">word</property>
-                    <property name="cursor_visible">False</property>
-                  </widget>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label_notebook_desc_examples_examples">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Examples</property>
+                    <property name="show_tabs">False</property>
+                    <property name="show_border">False</property>
+                    <child>
+                      <widget class="GtkTextView" id="textview_description">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="border_width">8</property>
+                        <property name="editable">False</property>
+                        <property name="wrap_mode">word</property>
+                        <property name="cursor_visible">False</property>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label_notebook_desc_examples_desc_old">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Description</property>
+                      </widget>
+                      <packing>
+                        <property name="tab_fill">False</property>
+                        <property name="type">tab</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkTextView" id="textview_examples">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="border_width">8</property>
+                        <property name="editable">False</property>
+                        <property name="wrap_mode">word</property>
+                        <property name="cursor_visible">False</property>
+                      </widget>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label_notebook_desc_examples_examples_old">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Examples</property>
+                      </widget>
+                      <packing>
+                        <property name="position">1</property>
+                        <property name="tab_fill">False</property>
+                        <property name="type">tab</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
-                    <property name="tab_fill">False</property>
-                    <property name="type">tab</property>
                   </packing>
                 </child>
               </widget>
diff --git a/src/gui/forceSensorExercise.cs b/src/gui/forceSensorExercise.cs
index e8d5cec8..59ef6589 100644
--- a/src/gui/forceSensorExercise.cs
+++ b/src/gui/forceSensorExercise.cs
@@ -38,8 +38,11 @@ public class ForceSensorExerciseWindow
        [Widget] Gtk.Entry entry_name;
        [Widget] Gtk.Notebook notebook_main;
        [Widget] Gtk.Notebook notebook_desc_examples;
-       [Widget] Gtk.Label label_notebook_desc_examples_desc;
-       [Widget] Gtk.Label label_notebook_desc_examples_examples;
+       [Widget] Gtk.RadioButton radio_desc_examples_desc;
+       [Widget] Gtk.RadioButton radio_desc_examples_examples;
+       [Widget] Gtk.Label label_help;
+       [Widget] Gtk.Label label_radio_desc_examples_desc;
+       [Widget] Gtk.Label label_radio_desc_examples_examples;
        [Widget] Gtk.TextView textview_description;
        [Widget] Gtk.TextView textview_examples;
        [Widget] Gtk.Button button_back;
@@ -125,6 +128,11 @@ public class ForceSensorExerciseWindow
 
                //put an icon to window
                UtilGtk.IconWindow(force_sensor_exercise);
+               UtilGtk.WindowColor(force_sensor_exercise, Config.ColorBackground);
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, label_header);
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, label_help);
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, label_radio_desc_examples_desc);
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, 
label_radio_desc_examples_examples);
 
                force_sensor_exercise.Resizable = false;
                setTitle(title);
@@ -420,8 +428,8 @@ public class ForceSensorExerciseWindow
                else //if(o == Options.OTHER)
                        str = Catalog.GetString("Angle explanation");
 
-               label_notebook_desc_examples_desc.Text = str;
-               label_notebook_desc_examples_examples.Text = Catalog.GetString("Examples of:") + " " + str;
+               label_radio_desc_examples_desc.Text = str;
+               label_radio_desc_examples_examples.Text = Catalog.GetString("Examples of:") + " " + str;
        }
 
        private void managePage(int i)
@@ -439,6 +447,7 @@ public class ForceSensorExerciseWindow
                button_next.Visible = true;
                button_accept.Visible = false;
                button_back.Sensitive = true;
+               radio_desc_examples_examples.Show();
                notebook_desc_examples.GetNthPage(1).Show();
 
                if(p == Pages.FORCE)
@@ -524,7 +533,9 @@ public class ForceSensorExerciseWindow
                        ex = getExample(o);
                        set_notebook_desc_example_labels(o);
 
-                       notebook_desc_examples.CurrentPage = 0;
+                       radio_desc_examples_desc.Active = true;
+                       radio_desc_examples_examples.Hide();
+                       //notebook_desc_examples.CurrentPage = 0;
                        notebook_desc_examples.GetNthPage(1).Hide();
                }
                else // if(p == Pages.OTHER)
@@ -537,7 +548,9 @@ public class ForceSensorExerciseWindow
                        ex = getExample(Options.OTHER);
                        set_notebook_desc_example_labels(Options.OTHER);
 
-                       notebook_desc_examples.CurrentPage = 0;
+                       radio_desc_examples_desc.Active = true;
+                       radio_desc_examples_examples.Hide();
+                       //notebook_desc_examples.CurrentPage = 0;
                        notebook_desc_examples.GetNthPage(1).Hide();
                }
 
@@ -545,6 +558,14 @@ public class ForceSensorExerciseWindow
                textview_examples.Buffer.Text = ex;
        }
 
+       private void on_radio_desc_examples_desc_toggled (object o, EventArgs args)
+       {
+               notebook_desc_examples.CurrentPage = 0;
+       }
+       private void on_radio_desc_examples_examples_toggled (object o, EventArgs args)
+       {
+               notebook_desc_examples.CurrentPage = 1;
+       }
 
        private void on_button_next_clicked (object o, EventArgs args)
        {


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