[chronojump] dialogMessage can have scrolledwin vertical bar. RunInspector uses it



commit 2d6b064a0f7390278326caa955e0de27139b1527
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Mar 20 17:20:15 2018 +0100

    dialogMessage can have scrolledwin vertical bar. RunInspector uses it

 glade/dialog_message.glade |   47 ++++++++++++++++++++++++++++++++-----------
 src/constants.cs           |    2 +-
 src/gui/chronojump.cs      |    4 ++-
 src/gui/dialogMessage.cs   |   43 +++++++++++++++++++++++++++++-----------
 4 files changed, 70 insertions(+), 26 deletions(-)
---
diff --git a/glade/dialog_message.glade b/glade/dialog_message.glade
index 74288cc..01a9640 100644
--- a/glade/dialog_message.glade
+++ b/glade/dialog_message.glade
@@ -23,7 +23,6 @@
             <property name="spacing">8</property>
             <child>
               <widget class="GtkImage" id="image_warning">
-                <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="stock">gtk-dialog-warning</property>
                 <property name="icon-size">6</property>
@@ -37,7 +36,6 @@
             </child>
             <child>
               <widget class="GtkImage" id="image_info">
-                <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="stock">gtk-dialog-info</property>
                 <property name="icon-size">6</property>
@@ -50,7 +48,6 @@
             </child>
             <child>
               <widget class="GtkImage" id="image_help">
-                <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="stock">gtk-help</property>
                 <property name="icon-size">6</property>
@@ -62,6 +59,18 @@
               </packing>
             </child>
             <child>
+              <widget class="GtkImage" id="image_inspect">
+                <property name="can_focus">False</property>
+                <property name="stock">gtk-missing-image</property>
+                <property name="icon-size">6</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
               <widget class="GtkVBox" id="vbox4">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -249,13 +258,27 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label_message">
+                  <widget class="GtkScrolledWindow" id="scrolledwindow">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="xalign">0</property>
-                    <property name="use_markup">True</property>
-                    <property name="wrap">True</property>
-                    <property name="selectable">True</property>
+                    <property name="hscrollbar_policy">never</property>
+                    <property name="vscrollbar_policy">never</property>
+                    <child>
+                      <widget class="GtkViewport" id="viewport1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <widget class="GtkLabel" id="label_message">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="xalign">0</property>
+                            <property name="use_markup">True</property>
+                            <property name="wrap">True</property>
+                            <property name="selectable">True</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
                   </widget>
                   <packing>
                     <property name="expand">True</property>
@@ -313,8 +336,8 @@
                     </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>
@@ -322,7 +345,7 @@
               <packing>
                 <property name="expand">True</property>
                 <property name="fill">True</property>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
           </widget>
@@ -357,7 +380,7 @@
           </widget>
           <packing>
             <property name="expand">False</property>
-            <property name="fill">True</property>
+            <property name="fill">False</property>
             <property name="position">1</property>
           </packing>
         </child>
diff --git a/src/constants.cs b/src/constants.cs
index b675140..a85ba69 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -649,7 +649,7 @@ public class Constants
 
        //for dialog windows
        public enum MessageTypes {
-               WARNING, INFO, HELP
+               WARNING, INFO, HELP, INSPECT
        }
 
        public static string No = Catalog.GetString("No");
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index d3f3c7c..ba4a764 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -5899,7 +5899,9 @@ LogB.Debug("X");
        private void on_button_inspect_last_test_clicked (object o, EventArgs args)
        {
                if(currentEventExecute != null)
-                       new DialogMessage(Constants.MessageTypes.INFO, 
currentEventExecute.GetInspectorMessages());
+                       new DialogMessage("Chronojump " + Catalog.GetString("Inspector"),
+                                       Constants.MessageTypes.INSPECT, 
currentEventExecute.GetInspectorMessages(),
+                                       true); //show scrolledwindow vertical bar
        }
 
        private void deleted_last_test_update_widgets() {
diff --git a/src/gui/dialogMessage.cs b/src/gui/dialogMessage.cs
index 17e4ac7..95c82b9 100644
--- a/src/gui/dialogMessage.cs
+++ b/src/gui/dialogMessage.cs
@@ -19,35 +19,42 @@
  */
 
 using System;
+using Gdk;
 using Gtk;
 using Glade;
 
 public class DialogMessage
 {
        [Widget] Gtk.Dialog dialog_message;
+       [Widget] Gtk.ScrolledWindow scrolledwindow;
        [Widget] Gtk.Label label_message;
 
        [Widget] Gtk.Image image_warning;
        [Widget] Gtk.Image image_info;
        [Widget] Gtk.Image image_help;
-               
+       [Widget] Gtk.Image image_inspect;
+
        [Widget] Gtk.Box hbox_stiffness_formula;
        [Widget] Gtk.Button button_go;
        public bool Visible;
        private string button_go_link = "";
 
+       public DialogMessage (Constants.MessageTypes type, string message)
+       {
+               initialize("", type, message, false);
+       }
        public DialogMessage (string title, Constants.MessageTypes type, string message)
        {
-               initialize(title, type, message);
+               initialize(title, type, message, false);
        }
-       public DialogMessage (Constants.MessageTypes type, string message)
+       public DialogMessage (string title, Constants.MessageTypes type, string message, bool 
showScrolledWinBar)
        {
-               initialize("", type, message);
+               initialize(title, type, message, showScrolledWinBar);
        }
        //special caller to show stiffness formula or others
        public DialogMessage (Constants.MessageTypes type, string message, string objectToShow)
        {
-               initialize("", type, message);
+               initialize("", type, message, false);
                if(objectToShow == "hbox_stiffness_formula")
                        hbox_stiffness_formula.Show();
                else if(objectToShow == "button_go_r_mac")
@@ -57,7 +64,7 @@ public class DialogMessage
                }
        }
 
-       private void initialize(string title, Constants.MessageTypes type, string message)
+       private void initialize(string title, Constants.MessageTypes type, string message, bool 
showScroledWinBar)
        {
                LogB.Information("Dialog message: " + message);
 
@@ -83,23 +90,35 @@ public class DialogMessage
                label_message.Text = message; 
                label_message.UseMarkup = true; 
 
+               image_warning.Hide();
+               image_info.Hide();
+               image_help.Hide();
+               image_inspect.Hide();
+
                switch (type) {
                        case Constants.MessageTypes.WARNING:
                                image_warning.Show();
-                               image_info.Hide();
-                               image_help.Hide();
                        break;
                        case Constants.MessageTypes.INFO:
-                               image_warning.Hide();
                                image_info.Show();
-                               image_help.Hide();
                        break;
                        case Constants.MessageTypes.HELP:
-                               image_warning.Hide();
-                               image_info.Hide();
                                image_help.Show();
                        break;
+                       case Constants.MessageTypes.INSPECT:
+                               Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
"image_test_inspect.png");
+                               image_inspect.Pixbuf = pixbuf;
+                               image_inspect.Show();
+                       break;
+               }
+
+               if(showScroledWinBar)
+               {
+                       dialog_message.HeightRequest = 600;
+                       scrolledwindow.SetPolicy(PolicyType.Never, PolicyType.Automatic);
                }
+               else
+                       scrolledwindow.SetPolicy(PolicyType.Never, PolicyType.Never);
 
                label_message.Show();   
                dialog_message.Show();  


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