summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/menus/menubar.c2
-rw-r--r--src/gui/menus/view.c93
-rw-r--r--src/gui/menus/view.h2
3 files changed, 92 insertions, 5 deletions
diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c
index aa89a13..d386362 100644
--- a/src/gui/menus/menubar.c
+++ b/src/gui/menus/menubar.c
@@ -309,7 +309,7 @@ static void change_menubar_current_view(GMenuBar *bar, GLoadedPanel *old, GLoade
rebuild_menu_view_for_view(bar->view, new);
- update_access_for_view_in_menu_view(G_EDITOR_ITEM(bar)->ref, new);
+ update_access_for_view_in_menu_view(new);
update_access_for_view_in_menu_binary(new);
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index 255f1d9..018cfbf 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -40,6 +40,7 @@
#include "../core/panels.h"
#include "../../analysis/loaded.h"
#include "../../gtkext/easygtk.h"
+#include "../../gtkext/gtkdisplaypanel.h"
#include "../../gtkext/gtkgraphdisplay.h"
@@ -65,6 +66,9 @@ static void handle_loaded_panel_first_allocation(GtkWidget *, GdkRectangle *, GL
/* Effectue la bascule d'un panneau de chargement à un autre. */
static void change_current_view_support(unsigned int);
+/* Réagit avec le menu "Affichage -> Zoom *". */
+static void mcb_view_zoom(GtkCheckMenuItem *, gpointer );
+
/* Réagit avec le menu "Affichage -> (colonne xxx)". */
static void mcb_view_display_column(GtkCheckMenuItem *, gpointer);
@@ -126,6 +130,28 @@ GtkWidget *build_menu_view(GObject *ref, GMenuBar *bar)
/* Séparation */
submenuitem = qck_create_menu_separator();
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
+ /* Zooms */
+
+ submenuitem = qck_create_menu_item(ref, "mnu_view_zoom_in", _("Zoom in"),
+ G_CALLBACK(mcb_view_zoom), GINT_TO_POINTER(0));
+ add_accelerator_to_widget(submenuitem, "<Ctrl>plus");
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
+ submenuitem = qck_create_menu_item(ref, "mnu_view_zoom_out", _("Zoom out"),
+ G_CALLBACK(mcb_view_zoom), GINT_TO_POINTER(1));
+ add_accelerator_to_widget(submenuitem, "<Ctrl>minus");
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
+ submenuitem = qck_create_menu_item(ref, "mnu_view_zoom_reset", _("Reset zoom"),
+ G_CALLBACK(mcb_view_zoom), GINT_TO_POINTER(2));
+ add_accelerator_to_widget(submenuitem, "<Ctrl>0");
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
+ /* Séparation */
+
+ submenuitem = qck_create_menu_separator();
g_object_set_data(ref, "mnu_view_start_options", submenuitem);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -399,8 +425,7 @@ void rebuild_menu_view_for_view(GtkWidget *widget, GLoadedPanel *new)
/******************************************************************************
* *
-* Paramètres : ref = espace de référencements à consulter. *
-* panel = panneau d'affichage actif ou NULL si aucun. *
+* Paramètres : new = nouvelle vue du contenu chargé analysé. *
* *
* Description : Met à jour les accès du menu "Affichage" selon le contenu. *
* *
@@ -410,12 +435,31 @@ void rebuild_menu_view_for_view(GtkWidget *widget, GLoadedPanel *new)
* *
******************************************************************************/
-void update_access_for_view_in_menu_view(GObject *ref, GLoadedPanel *panel)
+void update_access_for_view_in_menu_view(GLoadedPanel *new)
{
+ GObject *ref; /* Espace de référencements */
+ gboolean access; /* Accès à déterminer */
+ GtkWidget *item; /* Elément de menu à traiter */
+
+ ref = get_global_ref();
+
/* Bascules */
update_switch_access_in_menu_view();
+ /* Zooms */
+
+ access = GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_zoom_in"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_zoom_out"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_zoom_reset"));
+ gtk_widget_set_sensitive(item, access);
+
}
@@ -843,6 +887,49 @@ static void change_current_view_support(unsigned int wanted)
/******************************************************************************
* *
+* Paramètres : menuitem = élément de menu sélectionné. *
+* data = données indiquant la nature du zoom. *
+* *
+* Description : Réagit avec le menu "Affichage -> Zoom *". *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void mcb_view_zoom(GtkCheckMenuItem *menuitem, gpointer data)
+{
+ GtkDisplayPanel *panel; /* Afficheur effectif de code */
+ double scale; /* Echelle à appliquer */
+
+ panel = GTK_DISPLAY_PANEL(get_current_view());
+
+ scale = gtk_display_panel_get_scale(panel);
+
+ switch (GPOINTER_TO_INT(data))
+ {
+ case 0:
+ scale /= 1.25;
+ break;
+
+ case 1:
+ scale *= 1.25;
+ break;
+
+ case 2:
+ scale = 1.0;
+ break;
+
+ }
+
+ gtk_display_panel_set_scale(panel, scale);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : menuitem = élément de menu ayant basculé. *
* unused = adresse non utilisée ici. *
* *
diff --git a/src/gui/menus/view.h b/src/gui/menus/view.h
index 2271d4c..d3d70ab 100644
--- a/src/gui/menus/view.h
+++ b/src/gui/menus/view.h
@@ -44,7 +44,7 @@ void rebuild_menu_view_for_content(GtkWidget *, GLoadedContent *);
void rebuild_menu_view_for_view(GtkWidget *, GLoadedPanel *);
/* Met à jour les accès du menu "Affichage" selon le contenu. */
-void update_access_for_view_in_menu_view(GObject *, GLoadedPanel *);
+void update_access_for_view_in_menu_view(GLoadedPanel *);
/* Réagit avec le menu "Affichage -> Panneaux latéraux". */
void mcb_view_update_side_panels_list(GtkMenuItem *, GMenuBar *);