diff options
Diffstat (limited to 'src/gtkext/gtkdisplaypanel.c')
-rw-r--r-- | src/gtkext/gtkdisplaypanel.c | 175 |
1 files changed, 96 insertions, 79 deletions
diff --git a/src/gtkext/gtkdisplaypanel.c b/src/gtkext/gtkdisplaypanel.c index 003ac5f..620a1b1 100644 --- a/src/gtkext/gtkdisplaypanel.c +++ b/src/gtkext/gtkdisplaypanel.c @@ -87,6 +87,17 @@ static void gtk_display_panel_adjustment_value_changed(GtkAdjustment *, GtkDispl /* Réagit à un changement des règles d'affichage. */ static void on_view_panel_binary_display_change(GLoadedBinary *, BinaryView, BufferLineColumn, GtkDisplayPanel *); + + +/* ----------------------- INTERFACE DE PANNEAU DE CHARGEMENT ----------------------- */ + + +/* Associe à un panneau d'affichage un binaire chargé. */ +static void gtk_display_panel_set_content(GtkDisplayPanel *, GLoadedContent *); + +/* Fournit le contenu associé à un panneau de chargement. */ +static GLoadedContent *gtk_display_panel_get_content(const GtkDisplayPanel *); + /* Place en cache un rendu destiné à l'aperçu graphique rapide. */ static void gtk_display_panel_cache_glance(GtkDisplayPanel *, cairo_t *, const GtkAllocation *, double); @@ -190,6 +201,9 @@ static void gtk_display_panel_init(GtkDisplayPanel *panel) static void gtk_display_panel_loaded_interface_init(GLoadedPanelInterface *iface) { + iface->set_content = (set_loaded_panel_content_fc)gtk_display_panel_set_content; + iface->get_content = (get_loaded_panel_content_fc)gtk_display_panel_get_content; + iface->cache_glance = (cache_loaded_glance_fc)gtk_display_panel_cache_glance; } @@ -677,25 +691,6 @@ static void gtk_display_panel_adjustment_value_changed(GtkAdjustment *adj, GtkDi /****************************************************************************** * * -* Paramètres : panel = composant GTK à consulter. * -* * -* Description : Indique le type de contenu représenté par le composant. * -* * -* Retour : Identifiant d'un type de représentation de contenu. * -* * -* Remarques : - * -* * -******************************************************************************/ - -BinaryView gtk_display_panel_describe_content(const GtkDisplayPanel *panel) -{ - return panel->content; - -} - - -/****************************************************************************** -* * * Paramètres : panel = composant GTK à mettre à jour. * * show = état de l'affichage auquel parvenir. * * * @@ -814,36 +809,6 @@ void gtk_display_panel_draw_border(GtkDisplayPanel *panel, cairo_t *cr) /****************************************************************************** * * -* Paramètres : panel = composant GTK à mettre à jour. * -* binary = binaire associé à intégrer. * -* view = aspect du binaire à présenter. * -* * -* Description : Associe à un panneau d'affichage un binaire chargé. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void gtk_display_panel_attach_binary(GtkDisplayPanel *panel, GLoadedBinary *binary, BinaryView view) -{ - g_object_ref(G_OBJECT(binary)); - panel->binary = binary; - - panel->content = view; - panel->display = g_loaded_binary_get_column_display(binary, view); - - if (GTK_DISPLAY_PANEL_GET_CLASS(panel)->attach != NULL) /* REMME */ - GTK_DISPLAY_PANEL_GET_CLASS(panel)->attach(panel, binary); - - g_signal_connect(binary, "display-changed", G_CALLBACK(on_view_panel_binary_display_change), panel); - -} - - -/****************************************************************************** -* * * Paramètres : binary = bianire dont les consignes d'affichage ont évolué. * * view = type d'affichage à considérer. * * col = colonne dont le statut a changé. * @@ -859,7 +824,7 @@ void gtk_display_panel_attach_binary(GtkDisplayPanel *panel, GLoadedBinary *bina static void on_view_panel_binary_display_change(GLoadedBinary *binary, BinaryView view, BufferLineColumn col, GtkDisplayPanel *panel) { - if (panel->content == view) + if (panel->view_index == view) { gtk_widget_queue_resize(gtk_widget_get_parent(GTK_WIDGET(panel))); gtk_widget_queue_resize(GTK_WIDGET(panel)); @@ -1067,35 +1032,6 @@ bool gtk_display_panel_get_position(const GtkDisplayPanel *panel, GBufferLine ** /****************************************************************************** * * -* Paramètres : panel = composant GTK à manipuler. * -* cairo = assistant pour la création de rendus. * -* area = taille de la surface réduite à disposition. * -* scale = échelle vis à vis de la taille réelle. * -* * -* Description : Place en cache un rendu destiné à l'aperçu graphique rapide. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void gtk_display_panel_cache_glance(GtkDisplayPanel *panel, cairo_t *cairo, const GtkAllocation *area, double scale) -{ - if (GTK_DISPLAY_PANEL_GET_CLASS(panel)->cache_glance != NULL) - GTK_DISPLAY_PANEL_GET_CLASS(panel)->cache_glance(panel, cairo, area, scale); - -} - - - -/* ---------------------------------------------------------------------------------- */ -/* CONVERSIONS DE COORDONNEES */ -/* ---------------------------------------------------------------------------------- */ - - -/****************************************************************************** -* * * Paramètres : panel = composant GTK à consulter. * * event = informations liées à l'événement. * * * @@ -1165,3 +1101,84 @@ void gtk_display_panel_compute_relative_coords(GtkDisplayPanel *panel, gint *x, *y -= gtk_adjustment_get_value(panel->vadjustment); } + + + +/* ---------------------------------------------------------------------------------- */ +/* INTERFACE DE PANNEAU DE CHARGEMENT */ +/* ---------------------------------------------------------------------------------- */ + + +/****************************************************************************** +* * +* Paramètres : panel = composant GTK à mettre à jour. * +* content = binaire associé à intégrer. * +* * +* Description : Associe à un panneau d'affichage un binaire chargé. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_display_panel_set_content(GtkDisplayPanel *panel, GLoadedContent *content) +{ + panel->view_index = g_loaded_content_get_view_index(content, GTK_WIDGET(panel)); + + panel->display_options = g_loaded_content_get_all_display_options(content, panel->view_index); + + panel->binary = G_LOADED_BINARY(content); + + if (GTK_DISPLAY_PANEL_GET_CLASS(panel)->attach != NULL) /* REMME */ + GTK_DISPLAY_PANEL_GET_CLASS(panel)->attach(panel, panel->binary); + + g_signal_connect(content, "display-changed", G_CALLBACK(on_view_panel_binary_display_change), panel); + +} + + +/****************************************************************************** +* * +* Paramètres : panel = composant GTK à consulter. * +* * +* Description : Fournit le contenu associé à un panneau de chargement. * +* * +* Retour : Contenu quelconque chargé en mémoire. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static GLoadedContent *gtk_display_panel_get_content(const GtkDisplayPanel *panel) +{ + GLoadedContent *result; /* Contenu à retourner */ + + result = G_LOADED_CONTENT(panel->binary); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : panel = composant GTK à manipuler. * +* cairo = assistant pour la création de rendus. * +* area = taille de la surface réduite à disposition. * +* scale = échelle vis à vis de la taille réelle. * +* * +* Description : Place en cache un rendu destiné à l'aperçu graphique rapide. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_display_panel_cache_glance(GtkDisplayPanel *panel, cairo_t *cairo, const GtkAllocation *area, double scale) +{ + if (GTK_DISPLAY_PANEL_GET_CLASS(panel)->cache_glance != NULL) + GTK_DISPLAY_PANEL_GET_CLASS(panel)->cache_glance(panel, cairo, area, scale); + +} |