diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-11-12 20:03:12 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-11-12 20:03:12 (GMT) |
commit | 771f21b9d5dd2b394359304a660418bbc84befda (patch) | |
tree | 60d6a9350d388f2db7ad571e6edddf46a99444f2 /src/glibext | |
parent | de62d34d2dc6135b42af7f8a103c8c7af09fd54f (diff) |
Defined a new interface for displaying loaded contents.
Diffstat (limited to 'src/glibext')
-rw-r--r-- | src/glibext/Makefile.am | 2 | ||||
-rw-r--r-- | src/glibext/gloadedpanel-int.h | 51 | ||||
-rw-r--r-- | src/glibext/gloadedpanel.c | 81 | ||||
-rw-r--r-- | src/glibext/gloadedpanel.h | 56 | ||||
-rw-r--r-- | src/glibext/linegen.h | 2 |
5 files changed, 192 insertions, 0 deletions
diff --git a/src/glibext/Makefile.am b/src/glibext/Makefile.am index fe7565a..9fdc09b 100644 --- a/src/glibext/Makefile.am +++ b/src/glibext/Makefile.am @@ -12,6 +12,8 @@ libglibext_la_SOURCES = \ gbuffercache.h gbuffercache.c \ gbufferline.h gbufferline.c \ gbufferview.h gbufferview.c \ + gloadedpanel-int.h \ + gloadedpanel.h gloadedpanel.c \ gnhash.h gnhash.c \ gwidthtracker.h gwidthtracker.c \ linecolumn.h linecolumn.c \ diff --git a/src/glibext/gloadedpanel-int.h b/src/glibext/gloadedpanel-int.h new file mode 100644 index 0000000..8686d1b --- /dev/null +++ b/src/glibext/gloadedpanel-int.h @@ -0,0 +1,51 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * gloadedpanel-int.h - définitions internes propres à l'affichage de contenus chargés + * + * Copyright (C) 2017 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _GLIBEXT_GLOADEDPANEL_INT_H +#define _GLIBEXT_GLOADEDPANEL_INT_H + + +#include "gloadedpanel.h" + + + +/* Place en cache un rendu destiné à l'aperçu graphique rapide. */ +typedef void (* cache_loaded_glance_fc) (GLoadedPanel *, cairo_t *, const GtkAllocation *, double); + + +/* Intermédiaire pour la génération de lignes (interface) */ +struct _GLoadedPanelIface +{ + GTypeInterface base_iface; /* A laisser en premier */ + + cache_loaded_glance_fc cache_glance; /* Cache de la mignature */ + +}; + + +/* Redéfinition */ +typedef GLoadedPanelIface GLoadedPanelInterface; + + + +#endif /* _GLIBEXT_GLOADEDPANEL_INT_H */ diff --git a/src/glibext/gloadedpanel.c b/src/glibext/gloadedpanel.c new file mode 100644 index 0000000..fa12ec7 --- /dev/null +++ b/src/glibext/gloadedpanel.c @@ -0,0 +1,81 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * gloadedpanel.c - affichage de contenus chargés + * + * Copyright (C) 2017 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "gloadedpanel.h" + + +#include "gloadedpanel-int.h" + + + +/* Procède à l'initialisation de l'interface d'affichage. */ +static void g_loaded_panel_default_init(GLoadedPanelInterface *); + + + +/* Détermine le type du composant d'affichage basique. */ +G_DEFINE_INTERFACE(GLoadedPanel, g_loaded_panel, G_TYPE_OBJECT) + + +/****************************************************************************** +* * +* Paramètres : iface = interface GLib à initialiser. * +* * +* Description : Procède à l'initialisation de l'interface d'affichage. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_loaded_panel_default_init(GLoadedPanelInterface *iface) +{ + +} + + +/****************************************************************************** +* * +* 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 : - * +* * +******************************************************************************/ + +void g_loaded_panel_cache_glance(GLoadedPanel *panel, cairo_t *cairo, const GtkAllocation *area, double scale) +{ + GLoadedPanelIface *iface; /* Interface utilisée */ + + iface = G_LOADED_PANEL_GET_IFACE(panel); + + iface->cache_glance(panel, cairo, area, scale); + +} diff --git a/src/glibext/gloadedpanel.h b/src/glibext/gloadedpanel.h new file mode 100644 index 0000000..51f4f36 --- /dev/null +++ b/src/glibext/gloadedpanel.h @@ -0,0 +1,56 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * gloadedpanel.h - prototypes pour l'affichage de contenus chargés + * + * Copyright (C) 2017 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _GLIBEXT_LOADEDPANEL_H +#define _GLIBEXT_LOADEDPANEL_H + + +#include <glib-object.h> +#include <gtk/gtk.h> + + + +#define G_TYPE_LOADED_PANEL (g_loaded_panel_get_type()) +#define G_LOADED_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_LOADED_PANEL, GLoadedPanel)) +#define G_LOADED_PANEL_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST((vtable), G_TYPE_LOADED_PANEL, GLoadedPanelIface)) +#define GTK_IS_LOADED_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_LOADED_PANEL)) +#define GTK_IS_LOADED_PANEL_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE((vtable), G_TYPE_LOADED_PANEL)) +#define G_LOADED_PANEL_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), G_TYPE_LOADED_PANEL, GLoadedPanelIface)) + + +/* Composant d'affichage basique (coquille vide) */ +typedef struct _GLoadedPanel GLoadedPanel; + +/* Composant d'affichage basique (interface) */ +typedef struct _GLoadedPanelIface GLoadedPanelIface; + + +/* Détermine le type d'une interface pour la mise en place de lignes. */ +GType g_loaded_panel_get_type(void) G_GNUC_CONST; + +/* Place en cache un rendu destiné à l'aperçu graphique rapide. */ +void g_loaded_panel_cache_glance(GLoadedPanel *, cairo_t *, const GtkAllocation *, double); + + + +#endif /* _GLIBEXT_LOADEDPANEL_H */ diff --git a/src/glibext/linegen.h b/src/glibext/linegen.h index 2045cb8..22b964f 100644 --- a/src/glibext/linegen.h +++ b/src/glibext/linegen.h @@ -25,6 +25,8 @@ #define _GLIBEXT_LINEGEN_H +#include <glib-object.h> + #include "gbufferline.h" #include "../analysis/content.h" |