summaryrefslogtreecommitdiff
path: root/src/gtkext
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-03-25 12:36:16 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-03-25 12:36:16 (GMT)
commita174ee784f5d9e554ed09181b8e6d8c0205f8ef5 (patch)
treef5ccfb4c41fcb1f237bc285e8e71bc188b7c8b57 /src/gtkext
parentbbad297e902022ecac9fab21c01dc109560db8eb (diff)
Scrolled to the selected symbol.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@241 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext')
-rw-r--r--src/gtkext/gtkbinview-int.h4
-rw-r--r--src/gtkext/gtkbufferview.c26
-rw-r--r--src/gtkext/gtkdockstation.c2
-rw-r--r--src/gtkext/gtkviewpanel-int.h4
-rw-r--r--src/gtkext/gtkviewpanel.c47
-rw-r--r--src/gtkext/gtkviewpanel.h3
6 files changed, 83 insertions, 3 deletions
diff --git a/src/gtkext/gtkbinview-int.h b/src/gtkext/gtkbinview-int.h
index d1acde0..94d406f 100644
--- a/src/gtkext/gtkbinview-int.h
+++ b/src/gtkext/gtkbinview-int.h
@@ -2,7 +2,7 @@
/* OpenIDA - Outil d'analyse de fichiers binaires
* gtkbinview-int.h - définitions internes propre à l'affichage d'un ou plusieurs morceaux de code
*
- * Copyright (C) 2009-2010 Cyrille Bagard
+ * Copyright (C) 2009-2012 Cyrille Bagard
*
* This file is part of OpenIDA.
*
@@ -41,7 +41,7 @@ typedef void (* set_rendering_lines_fc) (GtkBinView *, GRenderingLine *, GRender
typedef void (* define_main_address_fc) (GtkBinView *, vmpa_t);
/* Indique la position d'affichage d'une adresse donnée. */
-typedef bool (* get_addr_coordinates_fc) (const GtkBinView *, vmpa_t, gint *, gint *);
+//typedef bool (* get_addr_coordinates_fc) (const GtkBinView *, vmpa_t, gint *, gint *);
struct _GtkBinView
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c
index 186b53f..c3457e9 100644
--- a/src/gtkext/gtkbufferview.c
+++ b/src/gtkext/gtkbufferview.c
@@ -49,6 +49,9 @@ static void gtk_buffer_view_size_allocate(GtkWidget *, GtkAllocation *);
/* Met à jour l'affichage de la visualisation de code buffer. */
static gboolean gtk_buffer_view_expose(GtkWidget *, GdkEventExpose *);
+/* Indique la position d'affichage d'une adresse donnée. */
+static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *, vmpa_t, gint *, gint *);
+
/* Réagit à un défilement quelconque. */
static void gtk_buffer_view_scroll(GtkBufferView *);
@@ -106,6 +109,7 @@ static void gtk_buffer_view_init(GtkBufferView *view)
viewpanel = GTK_VIEW_PANEL(view);
+ viewpanel->get_coordinates = (get_addr_coordinates_fc)gtk_buffer_view_get_address_coordinates;
viewpanel->scroll = (scroll_fc)gtk_buffer_view_scroll;
}
@@ -339,6 +343,28 @@ static gboolean gtk_buffer_view_expose(GtkWidget *widget, GdkEventExpose *event)
/******************************************************************************
* *
+* Paramètres : view = composant GTK à consulter. *
+* addr = adresse à présenter à l'écran. *
+* x = position horizontale au sein du composant. [OUT] *
+* y = position verticale au sein du composant. [OUT] *
+* *
+* Description : Indique la position d'affichage d'une adresse donnée. *
+* *
+* Retour : true si l'adresse fait partie du composant, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *view, vmpa_t addr, gint *x, gint *y)
+{
+ return g_buffer_view_get_address_coordinates(view->buffer_view, addr, x, y);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : view = composant GTK à mettre à jour. *
* *
* Description : Réagit à un défilement quelconque. *
diff --git a/src/gtkext/gtkdockstation.c b/src/gtkext/gtkdockstation.c
index 3e33f2b..d85d11e 100644
--- a/src/gtkext/gtkdockstation.c
+++ b/src/gtkext/gtkdockstation.c
@@ -263,6 +263,8 @@ void gtk_dock_panel_change_active_widget(GtkDockStation *station, GtkWidget *wid
gtk_widget_unref(label);
+ gtk_notebook_set_current_page(station->notebook, index);
+
g_signal_connect(station->notebook, "switch-page",
G_CALLBACK(gtk_dock_station_switch_panel), station);
diff --git a/src/gtkext/gtkviewpanel-int.h b/src/gtkext/gtkviewpanel-int.h
index 79f6f4c..446d182 100644
--- a/src/gtkext/gtkviewpanel-int.h
+++ b/src/gtkext/gtkviewpanel-int.h
@@ -36,6 +36,9 @@
/* Prend acte de l'association d'un binaire chargé. */
typedef void (* attach_binary_fc) (GtkViewPanel *, GOpenidaBinary *, bool *, bool *);
+/* Indique la position d'affichage d'une adresse donnée. */
+typedef bool (* get_addr_coordinates_fc) (const GtkViewPanel *, vmpa_t, gint *, gint *);
+
/* Réagit à un défilement quelconque. */
typedef void (* scroll_fc) (GtkViewPanel *);
@@ -54,6 +57,7 @@ struct _GtkViewPanel
GOpenidaBinary *binary; /* Binaire à visualiser */
attach_binary_fc attach; /* Association avec un binaire */
+ get_addr_coordinates_fc get_coordinates;/* Conversion adresse <-> pos. */
scroll_fc scroll; /* Défilement du contenu */
bool *display_addr; /* Affichage des adresses ? */
diff --git a/src/gtkext/gtkviewpanel.c b/src/gtkext/gtkviewpanel.c
index 43ab569..35cfa5c 100644
--- a/src/gtkext/gtkviewpanel.c
+++ b/src/gtkext/gtkviewpanel.c
@@ -104,7 +104,7 @@ static void gtk_view_panel_class_init(GtkViewPanelClass *class)
static void gtk_view_panel_init(GtkViewPanel *panel)
{
- gtk_fixed_set_has_window(GTK_FIXED(panel), TRUE);
+ gtk_widget_set_has_window(GTK_WIDGET(panel), TRUE);
}
@@ -453,3 +453,48 @@ GOpenidaBinary *gtk_view_panel_get_binary(const GtkViewPanel *panel)
return panel->binary;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = composant GTK à manipuler. *
+* addr = adresse à présenter à l'écran. *
+* *
+* Description : S'assure qu'une adresse donnée est visible à l'écran. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_view_panel_scroll_to_address(const GtkViewPanel *panel, vmpa_t addr)
+{
+ gint x; /* Abscisse à garantir */
+ gint y; /* Ordonnée à garantir */
+ GtkAdjustment *adj; /* Défilement à mettre à jour */
+
+ /* TODO
+ if (panel->define_address != NULL)
+ panel->define_address(panel, addr);
+ */
+
+ if (panel->get_coordinates(panel, addr, &x, &y))
+ {
+ adj = panel->hadjustment;
+
+ if (x > (adj->upper - adj->page_size))
+ x = adj->upper - adj->page_size;
+
+ gtk_adjustment_set_value(adj, x);
+
+ adj = panel->vadjustment;
+
+ if (y > (adj->upper - adj->page_size))
+ y = adj->upper - adj->page_size;
+
+ gtk_adjustment_set_value(adj, y);
+
+ }
+
+}
diff --git a/src/gtkext/gtkviewpanel.h b/src/gtkext/gtkviewpanel.h
index 6edee69..ccac08b 100644
--- a/src/gtkext/gtkviewpanel.h
+++ b/src/gtkext/gtkviewpanel.h
@@ -68,6 +68,9 @@ void gtk_view_panel_set_code_display(const GtkViewPanel *, bool);
/* Fournit le binaire associé à la représentation. */
GOpenidaBinary *gtk_view_panel_get_binary(const GtkViewPanel *);
+/* S'assure qu'une adresse donnée est visible à l'écran. */
+void gtk_view_panel_scroll_to_address(const GtkViewPanel *, vmpa_t);
+
#endif /* _GTK_VIEWPANEL_H */