[chronojump] Encoder restTime with buttons (dinamically visible) on personsOnTop



commit 6cf0c63a835597a551f12d0ff32494c3621caf1b
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Apr 7 12:25:22 2020 +0200

    Encoder restTime with buttons (dinamically visible) on personsOnTop

 glade/app1.glade           | 273 ++++++++++++++++++++++++++++-----------------
 src/gui/app1/chronojump.cs |   3 +-
 src/gui/app1/menu_tiny.cs  |   1 +
 src/gui/restTime.cs        |  47 +++++++-
 4 files changed, 219 insertions(+), 105 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 595e5cc2..2fe849c7 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -24831,6 +24831,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -25631,176 +25634,237 @@ Concentric</property>
                                                         <property name="label" translatable="yes">Please, 
wait!</property>
                                                       </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">3</property>
                                                       </packing>
                                                     </child>
                                                     <child>
-                                                      <widget class="GtkTable" id="table_rest_times_encoder">
+                                                      <widget class="GtkHBox" id="hbox402">
                                                         <property name="visible">True</property>
                                                         <property name="can_focus">False</property>
-                                                        <property name="n_rows">2</property>
-                                                        <property name="n_columns">6</property>
-                                                        <property name="column_spacing">8</property>
+                                                        <property name="spacing">2</property>
                                                         <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_rest_time_1_name">
-                                                            <property name="visible">True</property>
+                                                          <widget class="GtkHBox" 
id="hbox_encoder_rest_time">
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_encoder_rest_time_dark_blue">
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_encoder_rest_time_clear_yellow">
                                                             <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
                                                           </widget>
                                                           <packing>
-                                                            <property name="left_attach">1</property>
-                                                            <property name="right_attach">2</property>
-                                                            <property name="x_options">GTK_FILL</property>
-                                                            <property name="y_options"/>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
                                                           </packing>
                                                         </child>
                                                         <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_rest_time_2_name">
+                                                          <widget class="GtkButton" 
id="button_scrolled_rest_times_encoder_left">
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_scrolled_rest_times_encoder_left" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkArrow" id="arrow22">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="arrow_type">left</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="GtkScrolledWindow" 
id="scrolled_rest_times_encoder">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="hscrollbar_policy">never</property>
+                                                            <property 
name="vscrollbar_policy">never</property>
+                                                            <child>
+                                                            <widget class="GtkViewport" 
id="viewport_rest_times_encoder">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkTable" 
id="table_rest_times_encoder">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="n_rows">2</property>
+                                                            <property name="n_columns">5</property>
+                                                            <property name="column_spacing">8</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_encoder_rest_time_1_name">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="x_options">GTK_FILL</property>
+                                                            <property name="y_options"/>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_encoder_rest_time_2_name">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="left_attach">1</property>
+                                                            <property name="right_attach">2</property>
+                                                            <property name="x_options">GTK_FILL</property>
+                                                            <property name="y_options"/>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_encoder_rest_time_3_name">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="left_attach">2</property>
                                                             <property name="right_attach">3</property>
                                                             <property name="x_options">GTK_FILL</property>
                                                             <property name="y_options"/>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_rest_time_3_name">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_encoder_rest_time_4_name">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="left_attach">3</property>
                                                             <property name="right_attach">4</property>
                                                             <property name="x_options">GTK_FILL</property>
                                                             <property name="y_options"/>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_rest_time_4_name">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_encoder_rest_time_5_name">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="left_attach">4</property>
                                                             <property name="right_attach">5</property>
                                                             <property name="x_options">GTK_FILL</property>
                                                             <property name="y_options"/>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_rest_time_5_name">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_encoder_rest_time_1_time">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                          </widget>
-                                                          <packing>
-                                                            <property name="left_attach">5</property>
-                                                            <property name="right_attach">6</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="top_attach">1</property>
+                                                            <property name="bottom_attach">2</property>
                                                             <property name="x_options">GTK_FILL</property>
                                                             <property name="y_options"/>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_rest_time_1_time">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_encoder_rest_time_2_time">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="left_attach">1</property>
                                                             <property name="right_attach">2</property>
                                                             <property name="top_attach">1</property>
                                                             <property name="bottom_attach">2</property>
                                                             <property name="x_options">GTK_FILL</property>
                                                             <property name="y_options"/>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_rest_time_2_time">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_encoder_rest_time_3_time">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="left_attach">2</property>
                                                             <property name="right_attach">3</property>
                                                             <property name="top_attach">1</property>
                                                             <property name="bottom_attach">2</property>
                                                             <property name="x_options">GTK_FILL</property>
                                                             <property name="y_options"/>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_rest_time_3_time">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_encoder_rest_time_4_time">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="left_attach">3</property>
                                                             <property name="right_attach">4</property>
                                                             <property name="top_attach">1</property>
                                                             <property name="bottom_attach">2</property>
                                                             <property name="x_options">GTK_FILL</property>
                                                             <property name="y_options"/>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_rest_time_4_time">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_encoder_rest_time_5_time">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="left_attach">4</property>
                                                             <property name="right_attach">5</property>
                                                             <property name="top_attach">1</property>
                                                             <property name="bottom_attach">2</property>
                                                             <property name="x_options">GTK_FILL</property>
                                                             <property name="y_options"/>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_rest_time_5_time">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
                                                           </widget>
                                                           <packing>
-                                                            <property name="left_attach">5</property>
-                                                            <property name="right_attach">6</property>
-                                                            <property name="top_attach">1</property>
-                                                            <property name="bottom_attach">2</property>
-                                                            <property name="x_options">GTK_FILL</property>
-                                                            <property name="y_options"/>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">2</property>
                                                           </packing>
                                                         </child>
                                                         <child>
-                                                          <widget class="GtkHBox" 
id="hbox_encoder_rest_time">
-                                                            <property name="can_focus">False</property>
-                                                            <child>
-                                                            <widget class="GtkImage" 
id="image_encoder_rest_time_dark_blue">
-                                                            <property name="can_focus">False</property>
-                                                            <property 
name="stock">gtk-missing-image</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">True</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
+                                                          <widget class="GtkButton" 
id="button_scrolled_rest_times_encoder_right">
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_scrolled_rest_times_encoder_right" swapped="no"/>
                                                             <child>
-                                                            <widget class="GtkImage" 
id="image_encoder_rest_time_clear_yellow">
+                                                            <widget class="GtkArrow" id="arrow21">
+                                                            <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property 
name="stock">gtk-missing-image</property>
                                                             </widget>
-                                                            <packing>
-                                                            <property name="expand">True</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">1</property>
-                                                            </packing>
                                                             </child>
                                                           </widget>
                                                           <packing>
-                                                            <property name="bottom_attach">2</property>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">3</property>
                                                           </packing>
                                                         </child>
                                                       </widget>
@@ -25813,7 +25877,7 @@ Concentric</property>
                                                   </widget>
                                                   <packing>
                                                     <property name="expand">True</property>
-                                                    <property name="fill">False</property>
+                                                    <property name="fill">True</property>
                                                     <property name="padding">30</property>
                                                     <property name="position">1</property>
                                                   </packing>
@@ -27130,6 +27194,18 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -27166,18 +27242,6 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -34902,6 +34966,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 70db6e8a..ae9aa433 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -750,11 +750,12 @@ public partial class ChronoJumpWindow
                {
                        UtilGtk.ContrastLabelsHBox (viewport_hpaned_contacts_main, hbox_top_person);
                        UtilGtk.ContrastLabelsHBox (viewport_hpaned_contacts_main, hbox_top_person_encoder);
+                       UtilGtk.ContrastLabelsTable (viewport_rest_times_encoder, table_rest_times_encoder);
                }
 
                UtilGtk.ContrastLabelsNotebook (viewport_hpaned_contacts_main, app1s_notebook);
 
-               if(UtilGtk.ColorIsDark(viewport_hpaned_contacts_main.Style.Background(StateType.Normal)))
+               if(UtilGtk.ColorIsDark(viewport_rest_times_encoder.Style.Background(StateType.Normal)))
                {
                        image_encoder_rest_time_dark_blue.Visible = false;
                        image_encoder_rest_time_clear_yellow.Visible = true;
diff --git a/src/gui/app1/menu_tiny.cs b/src/gui/app1/menu_tiny.cs
index 9cb1fdc8..36803bb3 100644
--- a/src/gui/app1/menu_tiny.cs
+++ b/src/gui/app1/menu_tiny.cs
@@ -79,6 +79,7 @@ public partial class ChronoJumpWindow
                Gdk.Color color = UtilGtk.ColorParse(preferences.colorBackgroundString);
 
                UtilGtk.ViewportColor(viewport_hpaned_contacts_main, color);
+               UtilGtk.ViewportColor(viewport_rest_times_encoder, color);
 
                UtilGtk.EventBoxColorBackgroundActive (eventbox_button_show_modes1, UtilGtk.YELLOW);
                UtilGtk.EventBoxColorBackgroundActive (eventbox_check_menu_session1, UtilGtk.YELLOW);
diff --git a/src/gui/restTime.cs b/src/gui/restTime.cs
index f287fdf8..6ee7c4c9 100644
--- a/src/gui/restTime.cs
+++ b/src/gui/restTime.cs
@@ -18,6 +18,7 @@
  * Copyright (C) 2017   Xavier de Blas <xaviblas gmail com> 
  */
 
+using System;
 using Gtk;
 using Glade;
 using System.Collections.Generic; //List
@@ -29,6 +30,9 @@ using System.Collections.Generic; //List
 
 public partial class ChronoJumpWindow 
 {
+       [Widget] Gtk.ScrolledWindow scrolled_rest_times_encoder;
+       [Widget] Gtk.Button button_scrolled_rest_times_encoder_left;
+       [Widget] Gtk.Button button_scrolled_rest_times_encoder_right;
        [Widget] Gtk.HBox hbox_encoder_rest_time;
        [Widget] Gtk.Image image_encoder_rest_time_dark_blue;
        [Widget] Gtk.Image image_encoder_rest_time_clear_yellow;
@@ -45,6 +49,8 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Label label_contacts_rest_time_4_time;
        [Widget] Gtk.Label label_contacts_rest_time_5_time;
 
+       [Widget] Gtk.Viewport viewport_rest_times_encoder;
+       [Widget] Gtk.Table table_rest_times_encoder;
        [Widget] Gtk.Label label_encoder_rest_time_1_name;
        [Widget] Gtk.Label label_encoder_rest_time_2_name;
        [Widget] Gtk.Label label_encoder_rest_time_3_name;
@@ -128,7 +134,7 @@ public partial class ChronoJumpWindow
        {
                labels_rest_time_encoder_clean();
                List<LastTestTime> listLastMin = restTime.LastMinList();
-               hbox_encoder_rest_time.Visible = (listLastMin.Count > 0);
+               //hbox_encoder_rest_time.Visible = (listLastMin.Count > 0);
                int count = 0;
                foreach(LastTestTime ltt in listLastMin)
                {
@@ -139,6 +145,45 @@ public partial class ChronoJumpWindow
                                count ++;
                        }
                }
+
+               //as scrollbar is not usable on tactile screens, and this top rest time are thought for 
tactile screens
+               //show left/right buttons if content is bigger than scrollbar
+               if(scrolled_rest_times_encoder.Hadjustment.Upper > 
scrolled_rest_times_encoder.Hadjustment.PageSize)
+               {
+                       button_scrolled_rest_times_encoder_left.Visible = true;
+                       button_scrolled_rest_times_encoder_right.Visible = true;
+
+                       //make left arrow sensitive if we are not on totally left
+                       button_scrolled_rest_times_encoder_left.Sensitive =
+                               (scrolled_rest_times_encoder.Hadjustment.Value > 
scrolled_rest_times_encoder.Hadjustment.Lower);
+
+                       //make right arrow sensitive if we are not on totally right
+                       button_scrolled_rest_times_encoder_right.Sensitive =
+                               //(scrolled_rest_times_encoder.Hadjustment.Value < 
scrolled_rest_times_encoder.Hadjustment.Upper);
+                               ( scrolled_rest_times_encoder.Hadjustment.Value <
+                                 (scrolled_rest_times_encoder.Hadjustment.Upper - 
scrolled_rest_times_encoder.Hadjustment.PageSize) );
+
+                       hbox_encoder_rest_time.Visible = false;
+
+               } else {
+                       button_scrolled_rest_times_encoder_left.Visible = false;
+                       button_scrolled_rest_times_encoder_right.Visible = false;
+
+                       hbox_encoder_rest_time.Visible = (listLastMin.Count > 0);
+               }
+       }
+
+       private void on_scrolled_rest_times_encoder_right (object o, EventArgs args)
+       {
+               //scrolled_rest_times_encoder.Hadjustment.Value = 
scrolled_rest_times_encoder.Hadjustment.Upper; //go to the end
+               scrolled_rest_times_encoder.Hadjustment.Value += 
scrolled_rest_times_encoder.Hadjustment.PageSize; //one page to the right
+               updateTopRestTimesEncoder(); //make the update because if not it looks weird
+       }
+       private void on_scrolled_rest_times_encoder_left (object o, EventArgs args)
+       {
+               //scrolled_rest_times_encoder.Hadjustment.Value = 
scrolled_rest_times_encoder.Hadjustment.Lower; //go to the beginning
+               scrolled_rest_times_encoder.Hadjustment.Value -= 
scrolled_rest_times_encoder.Hadjustment.PageSize; //one page to the right
+               updateTopRestTimesEncoder(); //make the update because if not it looks weird
        }
 }
 



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