[chronojump] Much better top align of menu_tiny using retarded Allocation



commit 546238deebbf57f3c27f91785f13666878082673
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Dec 31 16:42:49 2020 +0100

    Much better top align of menu_tiny using retarded Allocation

 glade/app1.glade          | 33 +++++++++++++++++++--------------
 src/gui/app1/menu_tiny.cs | 41 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 58 insertions(+), 16 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 5aea8c0f..cacdf921 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -34,7 +34,6 @@
                           <widget class="GtkAlignment" id="alignment_menu_tiny">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="top_padding">4</property>
                             <property name="bottom_padding">4</property>
                             <property name="left_padding">2</property>
                             <property name="right_padding">2</property>
@@ -5051,7 +5050,7 @@ EncoderInertialCapture</property>
                                         <property name="can_focus">False</property>
                                         <property name="spacing">4</property>
                                         <child>
-                                          <widget class="GtkHBox" id="hbox78">
+                                          <widget class="GtkHBox" id="hbox_top_contacts">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="spacing">50</property>
@@ -23590,6 +23589,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -28436,18 +28438,6 @@ 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>
@@ -28484,6 +28474,18 @@ 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>
@@ -36739,6 +36741,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/menu_tiny.cs b/src/gui/app1/menu_tiny.cs
index 1c783300..e80949fa 100644
--- a/src/gui/app1/menu_tiny.cs
+++ b/src/gui/app1/menu_tiny.cs
@@ -23,6 +23,7 @@
 using System;
 using Gtk;
 using Glade;
+//using System.Collections.Generic; //List
 
 public partial class ChronoJumpWindow
 {
@@ -61,7 +62,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_menu_guiTest1;
 
        [Widget] Gtk.Viewport viewport_image_logo_icon;
-
+       [Widget] Gtk.HBox hbox_top_contacts;
 
        private void menuTinyInitialize ()
        {
@@ -73,7 +74,19 @@ public partial class ChronoJumpWindow
                 * +4 is vbox_contacts spacing
                 * (same for encoder)
                 */
-               alignment_menu_tiny.TopPadding = (uint) scrolled_rest_time_contacts.SizeRequest().Height + 4 
+ 4;
+               /*
+               List <int> l = new List<int>();
+               l.Add(hbox_top_contacts.SizeRequest().Height);
+               l.Add(hbox_encoder_sup_capture_analyze.SizeRequest().Height);
+               int maxHeight = getMenuButtonsMaxWidthOrHeight(l);
+
+               alignment_menu_tiny.TopPadding = (uint) maxHeight + 4;
+               */
+
+               //doing with Allocation, but wait 1s to have correctly allocated widgets in order to vertical 
align menu
+               //of course it will be much better using a table, but I do not want to risk in moving all big 
notebooks to a table cell
+
+               GLib.Timeout.Add(200, new GLib.TimeoutHandler(menuTinyTopAlign));
 
                image_logo_contacts_transp.Visible = false;
                image_logo_contacts.Visible = false;
@@ -90,6 +103,30 @@ public partial class ChronoJumpWindow
                }
        }
 
+       private bool menuTinyTopAlign()
+       {
+               /*
+               sadly this is not a correct info on Chronojump starts: says 52 when it should be 48
+               but called in this Timeout it works as a charm
+
+               LogB.Information("notebook_capture_analyze.Allocation.Y = " + 
notebook_capture_analyze.Allocation.Y.ToString());
+               LogB.Information("hbox_top_contacts.Allocation.Y = " + 
hbox_top_contacts.Allocation.Y.ToString());
+               LogB.Information("hbox_top_contacts.Allocation.Height = " + 
hbox_top_contacts.Allocation.Height.ToString());
+               LogB.Information("button_show_modes_contacts.Allocation.Height = " + 
button_show_modes_contacts.Allocation.Height.ToString());
+               LogB.Information("hbox_contacts_sup_capture_analyze_two_buttons.Allocation.Height = " + 
hbox_contacts_sup_capture_analyze_two_buttons.Allocation.Height.ToString());
+               LogB.Information("hbox_top_person.Allocation.Height = " + 
hbox_top_person.Allocation.Height.ToString());
+               LogB.Information("hbox_other.Allocation.Height = " + hbox_other.Allocation.Height.ToString());
+               LogB.Information("hbox_top_contacts.Allocation.Height = " + 
hbox_top_contacts.Allocation.Height.ToString());
+
+               //LogB.Information("notebook_capture_analyze.Allocation.Y = " + 
notebook_capture_analyze.Allocation.Y.ToString());
+               //LogB.Information("notebook_encoder_sup.Allocation.Y = " + 
notebook_encoder_sup.Allocation.Y.ToString());
+               */
+
+               alignment_menu_tiny.TopPadding = (uint) notebook_capture_analyze.Allocation.Y;
+
+               return false; //do not call this again
+       }
+
        private void menuTinySetColors ()
        {
                if(! Config.UseSystemColor)


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