diff options
| -rw-r--r-- | src/gtkext/gtkgraphdisplay.c | 41 | ||||
| -rw-r--r-- | src/gui/menus/view.c | 16 | 
2 files changed, 20 insertions, 37 deletions
diff --git a/src/gtkext/gtkgraphdisplay.c b/src/gtkext/gtkgraphdisplay.c index fdd48ce..0aee486 100644 --- a/src/gtkext/gtkgraphdisplay.c +++ b/src/gtkext/gtkgraphdisplay.c @@ -93,9 +93,6 @@ static void gtk_graph_display_finalize(GtkGraphDisplay *);  /* S'adapte à la surface concédée par le composant parent. */  static void gtk_graph_display_size_allocate(GtkWidget *, GtkAllocation *); -/* Centre si possible le contenu du panneau d'affichage. */ -static void gtk_graph_display_update_support_margins(GtkGraphDisplay *, const GtkAllocation *); -  /* Indique les dimensions de travail du composant d'affichage. */  static void gtk_graph_display_compute_requested_size(GtkGraphDisplay *, gint *, gint *); @@ -298,36 +295,15 @@ static void gtk_graph_display_finalize(GtkGraphDisplay *display)  static void gtk_graph_display_size_allocate(GtkWidget *widget, GtkAllocation *allocation)  {      GtkGraphDisplay *display;                     /* Autre version du composant  */ - -    GTK_WIDGET_CLASS(gtk_graph_display_parent_class)->size_allocate(widget, allocation); - -    display = GTK_GRAPH_DISPLAY(widget); - -    gtk_graph_display_update_support_margins(display, allocation); - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : display    = panneau dont le contenu est à déplacer.         * -*                allocation = étendue accordée à la vue.                      * -*                                                                             * -*  Description : Centre si possible le contenu du panneau d'affichage.        * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void gtk_graph_display_update_support_margins(GtkGraphDisplay *display, const GtkAllocation *allocation) -{      gint width;                             /* Largeur totale du support   */      gint height;                            /* Hauteur totale du support   */      gint start;                             /* Bordure horizontale         */      gint top;                               /* Bordure verticale           */ +    GTK_WIDGET_CLASS(gtk_graph_display_parent_class)->size_allocate(widget, allocation); + +    display = GTK_GRAPH_DISPLAY(widget); +      gtk_graph_display_compute_requested_size(display, &width, &height);      if (width > allocation->width) @@ -632,7 +608,6 @@ static void gtk_graph_display_define_main_address(GtkGraphDisplay *display, cons      GBlockList *list;                       /* Liste de blocs basiques     */      gint right;                             /* Abscisse du coin droit      */      gint bottom;                            /* Ordonnée du coin inférieur  */ -    GtkAllocation allocation;               /* Espace alloué au panneau    */      GtkWidget *child;                       /* Composant sélectionné       */      if (display->routine == NULL) @@ -684,14 +659,6 @@ static void gtk_graph_display_define_main_address(GtkGraphDisplay *display, cons          gtk_fixed_move(GTK_FIXED(display->support), display->extender, right - 1, bottom - 1);          /** -         * Si possible, on centre le contenu obtenu. -         */ - -        gtk_widget_get_allocation(GTK_WIDGET(display), &allocation); - -        gtk_graph_display_update_support_margins(display, &allocation); - -        /**           * Première sélection...           */ diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c index 63b6371..059a598 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/gtkgraphdisplay.h" @@ -758,6 +759,8 @@ static void mcb_view_switch_to_prev_support(GtkRadioMenuItem *menuitem, gpointer  static void handle_loaded_panel_first_allocation(GtkWidget *widget, GdkRectangle *alloc, GLineCursor *cursor)  { +    GtkAllocation allocation;               /* Emplacement effectif        */ +      /* On ne réagit que la première fois */      g_signal_handlers_disconnect_by_func(widget, G_CALLBACK(handle_loaded_panel_first_allocation), cursor); @@ -765,6 +768,19 @@ static void handle_loaded_panel_first_allocation(GtkWidget *widget, GdkRectangle      g_object_unref(G_OBJECT(cursor)); +    /** +     * Pour les mêmes raisons que celles exposées dans change_current_view_support(), +     * l'affichage en vue graphique n'est pas centré initialement. +     * +     * On profite donc de ce crochet pour corriger le tir ! +     */ + +    if (GTK_IS_GRAPH_DISPLAY(widget)) +    { +        gtk_widget_get_allocation(widget, &allocation); +        gtk_widget_size_allocate(widget, &allocation); +    } +  }  | 
