]> git.tdb.fi Git - ext/subsurface.git/blobdiff - gtk-gui.c
Merge branch 'master' into freediving-tweaks
[ext/subsurface.git] / gtk-gui.c
index 4e5b9edfb8b00405508727176bbabd6b564d8874..f25fbaa53f6588a7968219784190d0cdcf4fff26 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -21,7 +21,10 @@ GtkWidget *main_vbox;
 GtkWidget *error_info_bar;
 GtkWidget *error_label;
 GtkWidget *vpane, *hpane;
+GtkWidget *notebook;
+
 int        error_count;
+extern char zoomed_plot;
 
 const char *divelist_font;
 
@@ -662,10 +665,21 @@ static void view_info(GtkWidget *w, gpointer data)
 static void view_three(GtkWidget *w, gpointer data)
 {
        GtkAllocation alloc;
+       GtkRequisition requisition;
+
        gtk_widget_get_allocation(hpane, &alloc);
        gtk_paned_set_position(GTK_PANED(hpane), alloc.width/2);
        gtk_widget_get_allocation(vpane, &alloc);
-       gtk_paned_set_position(GTK_PANED(vpane), alloc.height/2);
+       gtk_widget_size_request(notebook, &requisition);
+       /* pick the requested size for the notebook plus 6 pixels for frame */
+       gtk_paned_set_position(GTK_PANED(vpane), requisition.height + 6);
+}
+
+static void toggle_zoom(GtkWidget *w, gpointer data)
+{
+       zoomed_plot = (zoomed_plot)?0 : 1;
+       /*Update dive*/
+       repaint_dive();
 }
 
 static GtkActionEntry menu_items[] = {
@@ -688,7 +702,8 @@ static GtkActionEntry menu_items[] = {
        { "ViewList",       NULL, "List",  CTRLCHAR "1", NULL, G_CALLBACK(view_list) },
        { "ViewProfile",    NULL, "Profile", CTRLCHAR "2", NULL, G_CALLBACK(view_profile) },
        { "ViewInfo",       NULL, "Info", CTRLCHAR "3", NULL, G_CALLBACK(view_info) },
-       { "ViewThree",       NULL, "Three", CTRLCHAR "4", NULL, G_CALLBACK(view_three) },
+       { "ViewThree",      NULL, "Three", CTRLCHAR "4", NULL, G_CALLBACK(view_three) },
+       { "ToggleZoom",     NULL, "Toggle Zoom", CTRLCHAR "0", NULL, G_CALLBACK(toggle_zoom) },
 };
 static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
 
@@ -710,6 +725,7 @@ static const gchar* ui_string = " \
                                <menuitem name=\"Add Dive\" action=\"AddDive\" /> \
                                <separator name=\"Separator\"/> \
                                <menuitem name=\"Renumber\" action=\"Renumber\" /> \
+                               <menuitem name=\"Toggle Zoom\" action=\"ToggleZoom\" /> \
                                <menu name=\"View\" action=\"ViewMenuAction\"> \
                                        <menuitem name=\"List\" action=\"ViewList\" /> \
                                        <menuitem name=\"Profile\" action=\"ViewProfile\" /> \
@@ -750,7 +766,6 @@ static void switch_page(GtkNotebook *notebook, gint arg1, gpointer user_data)
 void init_ui(int *argcp, char ***argvp)
 {
        GtkWidget *win;
-       GtkWidget *notebook;
        GtkWidget *nb_page;
        GtkWidget *dive_list;
        GtkWidget *menubar;