summaryrefslogtreecommitdiff
path: root/src/gtkext/gtkdisplaypanel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext/gtkdisplaypanel.c')
-rw-r--r--src/gtkext/gtkdisplaypanel.c213
1 files changed, 91 insertions, 122 deletions
diff --git a/src/gtkext/gtkdisplaypanel.c b/src/gtkext/gtkdisplaypanel.c
index 15d257f..24436ca 100644
--- a/src/gtkext/gtkdisplaypanel.c
+++ b/src/gtkext/gtkdisplaypanel.c
@@ -105,6 +105,9 @@ static GLineCursor *gtk_display_panel_get_cursor(const GtkDisplayPanel *);
/* Définit le position courante dans un panneau de chargement. */
static void gtk_display_panel_set_cursor(GtkDisplayPanel *, const GLineCursor *);
+/* S'assure qu'un emplacement donné est visible à l'écran. */
+static void gtk_display_panel_scroll_to_cursor(GtkDisplayPanel *, const GLineCursor *, ScrollPositionTweak, bool);
+
/* Place en cache un rendu destiné à l'aperçu graphique rapide. */
static void gtk_display_panel_cache_glance(GtkDisplayPanel *, cairo_t *, const GtkAllocation *, double);
@@ -155,14 +158,6 @@ static void gtk_display_panel_class_init(GtkDisplayPanelClass *class)
panel_class->compute_inc = gtk_display_panel_compute_scroll_inc;
- g_signal_new("caret-moved",
- GTK_TYPE_DISPLAY_PANEL,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(GtkDisplayPanelClass, caret_moved),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
}
@@ -205,6 +200,7 @@ static void gtk_display_panel_loaded_interface_init(GLoadedPanelInterface *iface
iface->get_cursor = (get_loaded_cursor_fc)gtk_display_panel_get_cursor;
iface->set_cursor = (set_loaded_cursor_fc)gtk_display_panel_set_cursor;
+ iface->scroll = (scroll_loaded_to_cursor_fc)gtk_display_panel_scroll_to_cursor;
iface->cache_glance = (cache_loaded_glance_fc)gtk_display_panel_cache_glance;
@@ -843,36 +839,6 @@ static void on_view_panel_binary_display_change(GLoadedBinary *binary, BinaryVie
* *
* Paramètres : panel = composant GTK à consulter. *
* *
-* Description : Fournit le binaire associé à la représentation. *
-* *
-* Retour : Représentation de contenu binaire. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GLoadedBinary *gtk_display_panel_get_binary(const GtkDisplayPanel *panel)
-{
- g_object_ref(G_OBJECT(panel->binary));
-
- return panel->binary;
-
-}
-
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : panel = composant GTK à consulter. *
-* *
* Description : Indique la position courante du curseur. *
* *
* Retour : Emplacement courant du curseur ou NULL si aucun. *
@@ -924,90 +890,6 @@ GObject *gtk_display_panel_get_active_object(const GtkDisplayPanel *panel)
/******************************************************************************
* *
-* Paramètres : panel = composant GTK à manipuler. *
-* cursor = emplacement à présenter à l'écran. *
-* tweak = adaptation finale à effectuer. *
-* move = doit-on déplacer le curseur à l'adresse indiquée ? *
-* *
-* Description : S'assure qu'une adresse donnée est visible à l'écran. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void _gtk_display_panel_scroll_to_cursor(GtkDisplayPanel *panel, const GLineCursor *cursor, ScrollPositionTweak tweak, bool move)
-{
- GtkWidget *parent; /* Support parent à valider */
- gint x; /* Abscisse à garantir */
- gint y; /* Ordonnée à garantir */
- GtkWidget *viewport; /* Parent avec défilement */
- GtkAdjustment *adj; /* Défilement à mettre à jour */
- gdouble step_inc; /* Valeur d'un petit pas */
- gdouble page_size; /* Taille de l'affichage */
- double value; /* Valeur courante */
-
- /**
- * Si une vue partielle se déplace via cette fonction, il faut potentiellement
- * rediriger l'appel vers la vue en graphiques parente.
- */
-
- parent = gtk_widget_get_parent(GTK_WIDGET(panel));
- parent = gtk_widget_get_parent(GTK_WIDGET(parent));
-
- if (GTK_IS_DISPLAY_PANEL(parent))
- panel = GTK_DISPLAY_PANEL(parent);
-
- /*
- if (GTK_DISPLAY_PANEL_GET_CLASS(panel)->define != NULL)
- GTK_DISPLAY_PANEL_GET_CLASS(panel)->define(panel, addr);
- */
-
- if (GTK_DISPLAY_PANEL_GET_CLASS(panel)->get_coordinates(panel, cursor, &x, &y, tweak))
- {
- viewport = gtk_widget_get_parent(GTK_WIDGET(panel));
-
- /* Eventuel défilement horizontal */
-
- g_object_get(G_OBJECT(viewport), "hadjustment", &adj, NULL);
-
- step_inc = gtk_adjustment_get_step_increment(adj);
- page_size = gtk_adjustment_get_page_size(adj);
- value = gtk_adjustment_get_value(adj);
-
- if (x < value)
- gtk_adjustment_set_value(adj, x);
-
- else if ((x + step_inc) > (value + page_size))
- gtk_adjustment_set_value(adj, x + step_inc - page_size);
-
- /* Eventuel défilement vertical */
-
- g_object_get(G_OBJECT(viewport), "vadjustment", &adj, NULL);
-
- step_inc = gtk_adjustment_get_step_increment(adj);
- page_size = gtk_adjustment_get_page_size(adj);
- value = gtk_adjustment_get_value(adj);
-
- if (y < value || tweak != SPT_RAW)
- gtk_adjustment_set_value(adj, y);
-
- else if ((y + step_inc) > (value + page_size))
- gtk_adjustment_set_value(adj, y + step_inc - page_size);
-
- /* Déplacement du curseur */
-
- if (move && GTK_DISPLAY_PANEL_GET_CLASS(panel)->get_coordinates(panel, cursor, &x, &y, SPT_RAW))
- GTK_DISPLAY_PANEL_GET_CLASS(panel)->move_caret_to(panel, x, y);
-
- }
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : panel = composant GTK à manipuler. *
* addr = adresse à présenter à l'écran. *
* *
@@ -1159,6 +1041,9 @@ static GLoadedContent *gtk_display_panel_get_content(const GtkDisplayPanel *pane
result = G_LOADED_CONTENT(panel->binary);
+ if (result != NULL)
+ g_object_ref(G_OBJECT(result));
+
return result;
}
@@ -1209,6 +1094,90 @@ static void gtk_display_panel_set_cursor(GtkDisplayPanel *panel, const GLineCurs
/******************************************************************************
* *
+* Paramètres : panel = composant GTK à manipuler. *
+* cursor = emplacement à présenter à l'écran. *
+* tweak = adaptation finale à effectuer. *
+* move = doit-on déplacer le curseur à l'adresse indiquée ? *
+* *
+* Description : S'assure qu'un emplacement donné est visible à l'écran. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_display_panel_scroll_to_cursor(GtkDisplayPanel *panel, const GLineCursor *cursor, ScrollPositionTweak tweak, bool move)
+{
+ GtkWidget *parent; /* Support parent à valider */
+ gint x; /* Abscisse à garantir */
+ gint y; /* Ordonnée à garantir */
+ GtkWidget *viewport; /* Parent avec défilement */
+ GtkAdjustment *adj; /* Défilement à mettre à jour */
+ gdouble step_inc; /* Valeur d'un petit pas */
+ gdouble page_size; /* Taille de l'affichage */
+ double value; /* Valeur courante */
+
+ /**
+ * Si une vue partielle se déplace via cette fonction, il faut potentiellement
+ * rediriger l'appel vers la vue en graphiques parente.
+ */
+
+ parent = gtk_widget_get_parent(GTK_WIDGET(panel));
+ parent = gtk_widget_get_parent(GTK_WIDGET(parent));
+
+ if (GTK_IS_DISPLAY_PANEL(parent))
+ panel = GTK_DISPLAY_PANEL(parent);
+
+ /*
+ if (GTK_DISPLAY_PANEL_GET_CLASS(panel)->define != NULL)
+ GTK_DISPLAY_PANEL_GET_CLASS(panel)->define(panel, addr);
+ */
+
+ if (GTK_DISPLAY_PANEL_GET_CLASS(panel)->get_coordinates(panel, cursor, &x, &y, tweak))
+ {
+ viewport = gtk_widget_get_parent(GTK_WIDGET(panel));
+
+ /* Eventuel défilement horizontal */
+
+ g_object_get(G_OBJECT(viewport), "hadjustment", &adj, NULL);
+
+ step_inc = gtk_adjustment_get_step_increment(adj);
+ page_size = gtk_adjustment_get_page_size(adj);
+ value = gtk_adjustment_get_value(adj);
+
+ if (x < value)
+ gtk_adjustment_set_value(adj, x);
+
+ else if ((x + step_inc) > (value + page_size))
+ gtk_adjustment_set_value(adj, x + step_inc - page_size);
+
+ /* Eventuel défilement vertical */
+
+ g_object_get(G_OBJECT(viewport), "vadjustment", &adj, NULL);
+
+ step_inc = gtk_adjustment_get_step_increment(adj);
+ page_size = gtk_adjustment_get_page_size(adj);
+ value = gtk_adjustment_get_value(adj);
+
+ if (y < value || tweak != SPT_RAW)
+ gtk_adjustment_set_value(adj, y);
+
+ else if ((y + step_inc) > (value + page_size))
+ gtk_adjustment_set_value(adj, y + step_inc - page_size);
+
+ /* Déplacement du curseur */
+
+ if (move && GTK_DISPLAY_PANEL_GET_CLASS(panel)->get_coordinates(panel, cursor, &x, &y, SPT_RAW))
+ GTK_DISPLAY_PANEL_GET_CLASS(panel)->move_caret_to(panel, x, y);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : panel = composant GTK à manipuler. *
* cairo = assistant pour la création de rendus. *
* area = taille de la surface réduite à disposition. *