From 0d4fbe3fd39ceedfbc26575c0176eaf161abfb73 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Tue, 19 Mar 2013 23:06:59 +0100 Subject: [PATCH] demo: moved help stuff on its own dialog 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 | 23 ++++++++++-- demo/adg-demo.ui.in | 101 ++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 98 insertions(+), 26 deletions(-) diff --git a/demo/adg-demo.c b/demo/adg-demo.c index a0179117..195655e4 100644 --- a/demo/adg-demo.c +++ b/demo/adg-demo.c @@ -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)); diff --git a/demo/adg-demo.ui.in b/demo/adg-demo.ui.in index 8a21d2ea..8edb8610 100644 --- a/demo/adg-demo.ui.in +++ b/demo/adg-demo.ui.in @@ -26,29 +26,27 @@ - - 0 - 6 - -1 - -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. - - - - True - False - 1 - - - True 6 12 end + + gtk-help + True + True + True + True + + + False + False + 0 + True + + + gtk-about True @@ -59,7 +57,7 @@ Left click to restore paper zoom and position, right click to autoscale and cent False False - 0 + 1 True @@ -74,7 +72,7 @@ Left click to restore paper zoom and position, right click to autoscale and cent False False - 1 + 2 @@ -88,7 +86,7 @@ Left click to restore paper zoom and position, right click to autoscale and cent False False - 2 + 3 @@ -102,7 +100,7 @@ Left click to restore paper zoom and position, right click to autoscale and cent False False - 3 + 4 @@ -117,13 +115,14 @@ Left click to restore paper zoom and position, right click to autoscale and cent False False end - 4 + 5 False - 2 + True + 1 @@ -1146,6 +1145,62 @@ Boston, MA 02110-1301, USA. btnClose + + False + 5 + Help on adg-demo + True + center-on-parent + dialog + True + True + How to use adg-demo + 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: <b>rotate</b> the mouse wheel to zoom in and out in local space, <b>drag it</b> with the wheel pressed to pan and keep the <b>shift pressed</b> while zooming and panning to do the same in global space. + +A <b>left click</b> on the drawing area will restore the paper zoom and position, a <b>right click</b> will autoscale and center the drawing. + True + + + False + vertical + 2 + + + False + end + + + + + + gtk-close + True + True + True + True + + + False + True + 1 + + + + + False + True + end + 0 + + + + + + btnClos + + 6 Save current drawing -- 2.11.4.GIT