demo: moved help stuff on its own dialog
authorNicola Fontana <ntd@entidi.it>
Tue, 19 Mar 2013 22:06:59 +0000 (19 23:06 +0100)
committerNicola Fontana <ntd@entidi.it>
Tue, 19 Mar 2013 22:06:59 +0000 (19 23:06 +0100)
This will clean the main interface and decrease the window height so the
whole window can be seen on 1024x768 monitors with high menu panels.

demo/adg-demo.c
demo/adg-demo.ui.in

index a017911..195655e 100644 (file)
@@ -1048,6 +1048,18 @@ _adg_part_destroy(DemoPart *part)
 }
 
 static GtkWidget *
+_adg_help_window(GtkBuilder *builder)
+{
+    GtkWidget *window;
+
+    window = (GtkWidget *) gtk_builder_get_object(builder, "wndHelp");
+    g_assert(GTK_IS_MESSAGE_DIALOG(window));
+    g_signal_connect(window, "response", G_CALLBACK(gtk_widget_hide), NULL);
+
+    return window;
+}
+
+static GtkWidget *
 _adg_about_window(GtkBuilder *builder)
 {
     GtkWidget *window;
@@ -1135,7 +1147,7 @@ _adg_main_window(GtkBuilder *builder)
     DemoPart *part;
     AdgCanvas *canvas;
     GtkWidget *button_edit, *button_save_as, *button_print;
-    GtkWidget *button_about, *button_quit;
+    GtkWidget *button_help, *button_about, *button_quit;
 
     if (is_installed) {
 #ifdef G_OS_WIN32
@@ -1157,6 +1169,10 @@ _adg_main_window(GtkBuilder *builder)
     adg_gtk_area_set_canvas(part->area, canvas);
     adg_canvas_autoscale(canvas);
 
+    button_help = (GtkWidget *) gtk_builder_get_object(builder, "mainHelp");
+    g_assert(GTK_IS_BUTTON(button_help));
+    button_about = (GtkWidget *) gtk_builder_get_object(builder, "mainAbout");
+    g_assert(GTK_IS_BUTTON(button_about));
     g_assert(GTK_IS_WINDOW(window));
     button_edit = (GtkWidget *) gtk_builder_get_object(builder, "mainEdit");
     g_assert(GTK_IS_BUTTON(button_edit));
@@ -1164,11 +1180,12 @@ _adg_main_window(GtkBuilder *builder)
     g_assert(GTK_IS_BUTTON(button_save_as));
     button_print = (GtkWidget *) gtk_builder_get_object(builder, "mainPrint");
     g_assert(GTK_IS_BUTTON(button_print));
-    button_about = (GtkWidget *) gtk_builder_get_object(builder, "mainAbout");
-    g_assert(GTK_IS_BUTTON(button_about));
     button_quit = (GtkWidget *) gtk_builder_get_object(builder, "mainQuit");
     g_assert(GTK_IS_BUTTON(button_quit));
 
+    g_signal_connect_swapped(button_help, "clicked",
+                             G_CALLBACK(gtk_dialog_run),
+                             _adg_help_window(builder));
     g_signal_connect_swapped(button_about, "clicked",
                              G_CALLBACK(gtk_dialog_run),
                              _adg_about_window(builder));
index 8a21d2e..8edb861 100644 (file)
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="noteLabel">
-            <property name="xalign">0</property>
-            <property name="xpad">6</property>
-            <property name="width-chars">-1</property>
-            <property name="label" translatable="yes">
-Rotate the mouse wheel to zoom in and out, drag the mouse with the wheel pressed to pan.
-Keep the shift key pressed while zooming and panning with the mouse to do the same in global space.
-Left click to restore paper zoom and position, right click to autoscale and center the drawing.
-            </property>
-          </object>
-          <packing>
-            <property name="fill">True</property>
-            <property name="expand">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkHButtonBox" id="mainButtons">
             <property name="visible">True</property>
             <property name="border_width">6</property>
             <property name="spacing">12</property>
             <property name="layout_style">end</property>
             <child>
+              <object class="GtkButton" id="mainHelp">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkButton" id="mainAbout">
                 <property name="label">gtk-about</property>
                 <property name="visible">True</property>
@@ -59,7 +57,7 @@ Left click to restore paper zoom and position, right click to autoscale and cent
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
                 <property name="secondary">True</property>
               </packing>
             </child>
@@ -74,7 +72,7 @@ Left click to restore paper zoom and position, right click to autoscale and cent
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
@@ -88,7 +86,7 @@ Left click to restore paper zoom and position, right click to autoscale and cent
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
@@ -102,7 +100,7 @@ Left click to restore paper zoom and position, right click to autoscale and cent
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
             <child>
@@ -117,13 +115,14 @@ Left click to restore paper zoom and position, right click to autoscale and cent
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="pack_type">end</property>
-                <property name="position">4</property>
+                <property name="position">5</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="expand">False</property>
-            <property name="position">2</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
@@ -1146,6 +1145,62 @@ Boston, MA  02110-1301, USA.</property>
       <action-widget response="-4">btnClose</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkMessageDialog" id="wndHelp">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Help on adg-demo</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="skip_pager_hint">True</property>
+    <property name="text" translatable="yes">How to use adg-demo</property>
+    <property name="secondary_text" translatable="yes">This demo is just a sample of what can be accomplished by using the ADG library. It is by no means intended to be the only kind of application possible.
+
+To better see the differences between local and global space, some mouse interaction is needed: &lt;b&gt;rotate&lt;/b&gt; the mouse wheel to zoom in and out in local space, &lt;b&gt;drag it&lt;/b&gt; with the wheel pressed to pan and keep the &lt;b&gt;shift pressed&lt;/b&gt; while zooming and panning to do the same in global space.
+
+A &lt;b&gt;left click&lt;/b&gt; on the drawing area will restore the paper zoom and position, a &lt;b&gt;right click&lt;/b&gt; will autoscale and center the drawing.</property>
+    <property name="secondary_use_markup">True</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="messagedialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="messagedialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <object class="GtkButton" id="btnClos">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">btnClos</action-widget>
+    </action-widgets>
+  </object>
   <object class="GtkFileChooserDialog" id="wndSaveAs">
     <property name="border_width">6</property>
     <property name="title" translatable="yes">Save current drawing</property>