summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am10
-rw-r--r--src/analysis/scan/patterns/backends/Makefile.am8
-rw-r--r--src/app.c2
-rw-r--r--src/common/sort.h3
-rw-r--r--src/common/szbin.h16
-rw-r--r--src/data/images/Makefile.am1
-rw-r--r--src/data/images/gresource.xml3
-rw-r--r--src/glibext/widthtracker.c8
-rw-r--r--src/gtkext/area.c2
-rw-r--r--src/gtkext/dockstation.c51
-rw-r--r--src/gtkext/dockstation.h4
-rw-r--r--src/gtkext/grid.c29
-rw-r--r--src/gtkext/grid.h3
-rw-r--r--src/gtkext/hexview.c287
-rw-r--r--src/gtkext/hexview.h6
-rw-r--r--src/gtkext/hexview.ui52
-rw-r--r--src/gtkext/panel-int.h4
-rw-r--r--src/gtkext/panel.c26
-rw-r--r--src/gtkext/panel.h2
-rw-r--r--src/gtkext/statusstack-int.h6
-rw-r--r--src/gtkext/statusstack.c138
-rw-r--r--src/gtkext/statusstack.h10
-rw-r--r--src/gtkext/statusstack.ui9
-rw-r--r--src/gui/core/panels.c37
-rw-r--r--src/gui/core/panels.h3
-rw-r--r--src/gui/dialogs/Makefile.am2
-rw-r--r--src/gui/dialogs/about-int.h14
-rw-r--r--src/gui/dialogs/about.c57
-rw-r--r--src/gui/dialogs/about.css9
-rw-r--r--src/gui/dialogs/about.ui80
-rw-r--r--src/gui/dialogs/gresource.xml16
-rw-r--r--src/gui/panels/logs.c8
-rw-r--r--src/gui/style.css6
-rw-r--r--src/gui/window-int.h3
-rw-r--r--src/gui/window.c82
-rw-r--r--src/gui/window.h8
-rw-r--r--src/rost.c10
37 files changed, 724 insertions, 291 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6013bd5..7411287 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -59,7 +59,7 @@ libchrysacore_la_LDFLAGS = \
-avoid-version -ldl -lm \
$(TOOLKIT_LIBS) $(LIBXML_LIBS) \
$(LIBSQLITE_LIBS) $(LIBARCHIVE_LIBS) \
- $(LIBSSL_LIBS) $(LIBHS_LIBS)
+ $(LIBSSL_LIBS)
if BUILD_CURL_SUPPORT
@@ -73,6 +73,12 @@ libchrysacore_la_LDFLAGS += $(LIBMAGIC_LIBS)
endif
+if BUILD_HS_SUPPORT
+
+libchrysacore_la_LDFLAGS += $(LIBHS_LIBS)
+
+endif
+
libchrysacore4_la_SOURCES =
@@ -190,4 +196,4 @@ rost_LDFLAGS = $(LIBGOBJ_LIBS) -L.libs -lchrysacore
#SUBDIRS = core glibext $(GTKEXT_SUBDIR) analysis arch format common debug $(GUI_SUBDIR) mangling plugins schemas
-SUBDIRS = analysis arch common core data format glibext gtkext gui plugins
+SUBDIRS = analysis arch common core data format glibext gtkext gui plugins schemas
diff --git a/src/analysis/scan/patterns/backends/Makefile.am b/src/analysis/scan/patterns/backends/Makefile.am
index 23b0163..84711a7 100644
--- a/src/analysis/scan/patterns/backends/Makefile.am
+++ b/src/analysis/scan/patterns/backends/Makefile.am
@@ -6,10 +6,16 @@ libanalysisscanpatternsbackends_la_SOURCES = \
acism-int.h \
acism.h acism.c \
bitap-int.h \
- bitap.h bitap.c \
+ bitap.h bitap.c
+
+if BUILD_HS_SUPPORT
+
+libanalysisscanpatternsbackends_la_SOURCES += \
hyperscan-int.h \
hyperscan.h hyperscan.c
+endif
+
# Cf. https://www.gnu.org/software/automake/manual/html_node/Per_002dObject-Flags.html
AM_CFLAGS = $(LIBGOBJ_CFLAGS) $(LIBHS_CFLAGS)
diff --git a/src/app.c b/src/app.c
index 8c1a3e4..ef62135 100644
--- a/src/app.c
+++ b/src/app.c
@@ -399,7 +399,7 @@ static void ensure_wm_icon_and_name(void)
filename = get_xdg_data_dir("icons/hicolor/scalable/apps/chrysalide-logo.svg", true);
- fd = open(filename, O_WRONLY | O_CREAT);
+ fd = open(filename, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
if (fd == -1)
LOG_ERROR_N("open");
diff --git a/src/common/sort.h b/src/common/sort.h
index 39a6f33..27e3739 100644
--- a/src/common/sort.h
+++ b/src/common/sort.h
@@ -37,6 +37,9 @@ int sort_boolean(bool, bool);
/* Compare une valeur avec une autre. */
int sort_unsigned_long(unsigned long, unsigned long);
+#define sort_size(v1, v2) \
+ sort_unsigned_long(v1, v2)
+
/* Compare une valeur avec une autre. */
int sort_signed_long_long(signed long long, signed long long);
diff --git a/src/common/szbin.h b/src/common/szbin.h
index 182739a..8524ae3 100644
--- a/src/common/szbin.h
+++ b/src/common/szbin.h
@@ -143,15 +143,13 @@ typedef struct _sized_binary_t
while (0)
-#define memcmp_sized_binary(s1, s2) \
- ({ \
- int __ret; \
- size_t __n; \
- __n = (s1)->size < (s2)->size ? (s1)->size : (s2)->size; \
- __ret = memcmp((s1)->data, (s2)->data, __n); \
- if (__ret == 0) \
- __ret = sort_unsigned_long_long((s1)->size, (s2)->size);\
- __ret; \
+#define memcmp_sized_binary(s1, s2) \
+ ({ \
+ int __ret; \
+ __ret = sort_size((s1)->size, (s2)->size); \
+ if (__ret == 0) \
+ __ret = memcmp((s1)->data, (s2)->data, (s1)->size); \
+ __ret; \
})
diff --git a/src/data/images/Makefile.am b/src/data/images/Makefile.am
index 068e43f..d5ec84f 100644
--- a/src/data/images/Makefile.am
+++ b/src/data/images/Makefile.am
@@ -4,6 +4,7 @@ BUILT_SOURCES = resources.h resources.c
noinst_LTLIBRARIES = libdataimages.la
RES_FILES = \
+ about-bg.png \
dock-station-left-symbolic.svg \
dock-station-right-symbolic.svg \
dock-station-bottom-symbolic.svg \
diff --git a/src/data/images/gresource.xml b/src/data/images/gresource.xml
index 7659da3..25c8274 100644
--- a/src/data/images/gresource.xml
+++ b/src/data/images/gresource.xml
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
+ <gresource prefix="/re/chrysalide/framework/gui/dialogs/about">
+ <file compressed="true" alias="bg.png">about-bg.png</file>
+ </gresource>
<gresource prefix="/re/chrysalide/framework/gui/icons/scalable/actions">
<file compressed="true">dock-station-left-symbolic.svg</file>
<file compressed="true">dock-station-right-symbolic.svg</file>
diff --git a/src/glibext/widthtracker.c b/src/glibext/widthtracker.c
index 7e06578..0a3dbe6 100644
--- a/src/glibext/widthtracker.c
+++ b/src/glibext/widthtracker.c
@@ -330,13 +330,17 @@ void g_width_tracker_set_column_min_width(GWidthTracker *tracker, size_t col, in
void g_width_tracker_compute_width(const GWidthTracker *tracker, int *width)
{
+ size_t col_count; /* Nombre maximum de colonnes */
size_t i; /* Boucle de parcours */
*width = 0;
- // FIX access to col_count
- for (i = 0; i < tracker->col_count; i++)
+
+ col_count = tracker->opt_count + tracker->reg_count;
+
+
+ for (i = 0; i < col_count; i++)
*width += tracker->min_widths[i];
}
diff --git a/src/gtkext/area.c b/src/gtkext/area.c
index 3c59a59..3c573b2 100644
--- a/src/gtkext/area.c
+++ b/src/gtkext/area.c
@@ -85,6 +85,8 @@ static void gtk_composing_area_class_init(GtkComposingAreaClass *class)
widget = GTK_WIDGET_CLASS(class);
+ gtk_widget_class_set_css_name(widget, "comparea");
+
widget->snapshot = gtk_composing_area_snapshot;
}
diff --git a/src/gtkext/dockstation.c b/src/gtkext/dockstation.c
index 359e3a1..80bae75 100644
--- a/src/gtkext/dockstation.c
+++ b/src/gtkext/dockstation.c
@@ -259,7 +259,7 @@ GtkWidget *gtk_dock_station_new(void)
/******************************************************************************
* *
-* Paramètres : station = station d'accueil pour panneau à compléter. *
+* Paramètres : station = station d'accueil pour panneaux à compléter. *
* panel = nouveau panneau à afficher. *
* *
* Description : Ajoute un panneau à un groupe de tuiles. *
@@ -293,7 +293,7 @@ void gtk_dock_station_add_panel(GtkDockStation *station, GtkTiledPanel *panel)
/******************************************************************************
* *
-* Paramètres : station = station d'accueil pour panneau à compléter. *
+* Paramètres : station = station d'accueil pour panneaux à compléter. *
* panel = nouveau panneau à afficher. *
* *
* Description : Ajoute un panneau à conserver à un groupe de tuiles. *
@@ -332,7 +332,7 @@ void gtk_dock_station_keep_panel(GtkDockStation *station, GtkTiledPanel *panel)
/******************************************************************************
* *
-* Paramètres : station = station d'accueil pour panneau à consulter. *
+* Paramètres : station = station d'accueil pour panneaux à consulter. *
* *
* Description : Indique si la station d'accueil contient au moins un panneau.*
* *
@@ -361,6 +361,51 @@ bool gtk_dock_station_is_empty(const GtkDockStation *station)
}
+/******************************************************************************
+* *
+* Paramètres : station = station d'accueil pour panneaux à manipuler. *
+* main = panneau principal visé par l'opération. *
+* activated = nature du changement de statut : ajout, retrait ?*
+* *
+* Description : Note un ajout ou un retrait de panneau principal. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_dock_station_notify_new_main_panel_state(const GtkDockStation *station, GtkTiledPanel *main, bool activated)
+{
+ GListModel *list; /* Liste de pages à parcourir */
+ guint count; /* Nombre de pages */
+ guint i; /* Boucle de parcours */
+ GtkStackPage *page; /* Page à consulter */
+ GtkWidget *panel; /* Panneau intégré */
+
+ list = G_LIST_MODEL(gtk_stack_get_pages(station->stack));
+
+ count = g_list_model_get_n_items(list);
+
+ for (i = 0; i < count; i++)
+ {
+ page = GTK_STACK_PAGE(g_list_model_get_object(list, i));
+ if (page == NULL) continue;
+
+ panel = gtk_stack_page_get_child(page);
+
+ gtk_tiled_panel_notify_new_main_panel_state(GTK_TILED_PANEL(panel), main, activated);
+
+ unref_object(page);
+
+ }
+
+ unref_object(list);
+
+}
+
+
+
/* ---------------------------------------------------------------------------------- */
/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
/* ---------------------------------------------------------------------------------- */
diff --git a/src/gtkext/dockstation.h b/src/gtkext/dockstation.h
index 3106dae..e4c849f 100644
--- a/src/gtkext/dockstation.h
+++ b/src/gtkext/dockstation.h
@@ -50,6 +50,10 @@ void gtk_dock_station_keep_panel(GtkDockStation *, GtkTiledPanel *);
/* Indique si la station d'accueil contient au moins un panneau. */
bool gtk_dock_station_is_empty(const GtkDockStation *);
+/* Note un ajout ou un retrait de panneau principal. */
+void gtk_dock_station_notify_new_main_panel_state(const GtkDockStation *, GtkTiledPanel *, bool);
+
+
#if 0
diff --git a/src/gtkext/grid.c b/src/gtkext/grid.c
index afc74b7..eb3cdf9 100644
--- a/src/gtkext/grid.c
+++ b/src/gtkext/grid.c
@@ -544,6 +544,35 @@ void gtk_tiling_grid_add_panel(GtkTilingGrid *grid, GtkTiledPanel *panel, bool k
/******************************************************************************
* *
+* Paramètres : grid = zone d'affichage en tuiles à manipuler. *
+* main = panneau principal visé par l'opération. *
+* activated = nature du changement de statut : ajout, retrait ?*
+* *
+* Description : Note un ajout ou un retrait de panneau principal. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_tiling_grid_notify_new_main_panel_state(const GtkTilingGrid *grid, GtkTiledPanel *main, bool activated)
+{
+ gtk_dock_station_notify_new_main_panel_state(grid->top_station, main, activated);
+
+ gtk_dock_station_notify_new_main_panel_state(grid->left_station, main, activated);
+
+ gtk_dock_station_notify_new_main_panel_state(grid->main_station, main, activated);
+
+ gtk_dock_station_notify_new_main_panel_state(grid->right_station, main, activated);
+
+ gtk_dock_station_notify_new_main_panel_state(grid->bottom_station, main, activated);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : station = plateforme GTK ayant connu un changement. *
* widget = nouvel élément à intégrer. *
* grid = gestionnaire de placement en tuile concerné. *
diff --git a/src/gtkext/grid.h b/src/gtkext/grid.h
index f02cf38..fd98035 100644
--- a/src/gtkext/grid.h
+++ b/src/gtkext/grid.h
@@ -66,6 +66,9 @@ bool gtk_tiling_grid_get_visible(GtkTilingGrid *, TilingGridBorder);
/* Ajoute un panneau à un conteneur en tuiles. */
void gtk_tiling_grid_add_panel(GtkTilingGrid *, GtkTiledPanel *, bool);
+/* Note un ajout ou un retrait de panneau principal. */
+void gtk_tiling_grid_notify_new_main_panel_state(const GtkTilingGrid *, GtkTiledPanel *, bool);
+
/* --------------------- FORME GENERIQUE DE MISE EN DISPOSITION --------------------- */
diff --git a/src/gtkext/hexview.c b/src/gtkext/hexview.c
index 5a8dd04..95b592e 100644
--- a/src/gtkext/hexview.c
+++ b/src/gtkext/hexview.c
@@ -37,6 +37,22 @@
/* ------------------------- BASES D'UN COMPOSANT GRAPHIQUE ------------------------- */
+/* Liste des propriétés */
+
+typedef enum _HexViewProperty {
+
+ PROP_0, /* Réservé */
+
+ PROP_SHOW_OFFSETS, /* Affichage des positions */
+ PROP_CONTENT, /* Contenu binaire affiché */
+
+ N_PROPERTIES
+
+} HexViewProperty;
+
+static GParamSpec *_hex_view_properties[N_PROPERTIES] = { NULL, };
+
+
/* Initialise la classe des afficheurs de tampons bruts. */
static void gtk_hex_view_class_init(GtkHexViewClass *);
@@ -44,10 +60,10 @@ static void gtk_hex_view_class_init(GtkHexViewClass *);
static void gtk_hex_view_init(GtkHexView *);
/* Supprime toutes les références externes. */
-static void gtk_hex_view_dispose(GtkHexView *);
+static void gtk_hex_view_dispose(GObject *);
/* Procède à la libération totale de la mémoire. */
-static void gtk_hex_view_finalize(GtkHexView *);
+static void gtk_hex_view_finalize(GObject *);
/* Procède à l'actualisation de l'affichage d'un sous-composant. */
static void gtk_hex_view_dispatch_sub_snapshot(GtkWidget *, GtkSnapshot *, GtkWidget *);
@@ -57,14 +73,14 @@ static void gtk_hex_view_populate_cache(GtkHexView *);
-void demo_snapshot (GtkWidget *widget, GtkSnapshot *snapshot, GtkWidget *parent);
-
-
-
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
-/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+/* Met à jour une propriété d'instance GObject. */
+static void gtk_hex_view_set_property(GObject *, guint, const GValue *, GParamSpec *);
+/* Fournit la valeur d'une propriété d'instance GObject. */
+static void gtk_hex_view_get_property(GObject *, guint, GValue *, GParamSpec *);
/* Prend acte de la taille allouée au composant d'affichage. */
static void gtk_hex_view_size_allocate(GtkWidget *, int, int, int);
@@ -105,12 +121,26 @@ static void gtk_hex_view_class_init(GtkHexViewClass *class)
object = G_OBJECT_CLASS(class);
- object->dispose = (GObjectFinalizeFunc/* ! */)gtk_hex_view_dispose;
- object->finalize = (GObjectFinalizeFunc)gtk_hex_view_finalize;
+ object->dispose = gtk_hex_view_dispose;
+ object->finalize = gtk_hex_view_finalize;
+ object->set_property = gtk_hex_view_set_property;
+ object->get_property = gtk_hex_view_get_property;
+
+ _hex_view_properties[PROP_SHOW_OFFSETS] =
+ g_param_spec_boolean("show-offsets", NULL, NULL,
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+ _hex_view_properties[PROP_CONTENT] =
+ g_param_spec_object("content", NULL, NULL,
+ G_TYPE_BIN_CONTENT,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
+
+ g_object_class_install_properties(object, N_PROPERTIES, _hex_view_properties);
widget = GTK_WIDGET_CLASS(class);
- // REMME gtk_widget_class_set_css_name(widget, "GtkHexView");
+ gtk_widget_class_set_css_name(widget, "hexview");
g_type_ensure(GTK_TYPE_COMPOSING_AREA);
@@ -167,12 +197,14 @@ static void gtk_hex_view_init(GtkHexView *view)
view->generator = NULL;
+ gtk_hex_view_create(view, NULL);
+
}
/******************************************************************************
* *
-* Paramètres : view = instance d'objet GLib à traiter. *
+* Paramètres : object = instance d'objet GLib à traiter. *
* *
* Description : Supprime toutes les références externes. *
* *
@@ -182,20 +214,24 @@ static void gtk_hex_view_init(GtkHexView *view)
* *
******************************************************************************/
-static void gtk_hex_view_dispose(GtkHexView *view)
+static void gtk_hex_view_dispose(GObject *object)
{
- gtk_widget_dispose_template(GTK_WIDGET(view), GTK_TYPE_HEX_VIEW);
+ GtkHexView *view; /* Version spécialisée */
+
+ gtk_widget_dispose_template(GTK_WIDGET(object), GTK_TYPE_HEX_VIEW);
+
+ view = GTK_HEX_VIEW(object);
g_clear_object(&view->generator);
- G_OBJECT_CLASS(gtk_hex_view_parent_class)->dispose(G_OBJECT(view));
+ G_OBJECT_CLASS(gtk_hex_view_parent_class)->dispose(object);
}
/******************************************************************************
* *
-* Paramètres : view = instance d'objet GLib à traiter. *
+* Paramètres : object = instance d'objet GLib à traiter. *
* *
* Description : Procède à la libération totale de la mémoire. *
* *
@@ -205,9 +241,9 @@ static void gtk_hex_view_dispose(GtkHexView *view)
* *
******************************************************************************/
-static void gtk_hex_view_finalize(GtkHexView *view)
+static void gtk_hex_view_finalize(GObject *object)
{
- G_OBJECT_CLASS(gtk_hex_view_parent_class)->finalize(G_OBJECT(view));
+ G_OBJECT_CLASS(gtk_hex_view_parent_class)->finalize(object);
}
@@ -263,13 +299,43 @@ bool gtk_hex_view_create(GtkHexView *view, GBinContent *content)
parent = GTK_BUFFER_VIEW(view);
- cache = g_buffer_cache_new(1, 2);
+ cache = g_buffer_cache_new(1 /* opt_count */, 2 /* reg_count */);
parent->view = g_buffer_view_new(cache, parent->style);
unref_object(cache);
- view->generator = g_hex_generator_new(content);
+
+
+ gtk_hex_view_set_content(view, content);
+
+
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : view = composant d'affichage à consulter. *
+* *
+* Description : Fournit le contenu associé au composant d'affichage. *
+* *
+* Retour : Contenu dans lequel puise le générateur pour les lignes. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GBinContent *gtk_hex_view_get_content(const GtkHexView *view)
+{
+ GBinContent *result; /* Référence à retourner */
+
+ if (view->generator != NULL)
+ result = g_hex_generator_get_content(view->generator);
+ else
+ result = NULL;
return result;
@@ -278,6 +344,61 @@ bool gtk_hex_view_create(GtkHexView *view, GBinContent *content)
/******************************************************************************
* *
+* Paramètres : view = composant d'affichage à modifier. *
+* content = nouveau contenu pour source de génération. *
+* *
+* Description : Définit le contenu associé au composant d'affichage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_hex_view_set_content(GtkHexView *view, GBinContent *content)
+{
+ GBinContent *old; /* Ancienne valeur */
+ GBufferCache *cache; /* Tampon à représenter */
+
+ old = gtk_hex_view_get_content(view);
+
+ assert((old == NULL && view->generator == NULL) || (old != NULL && view->generator != NULL));
+
+ if (old != content)
+ {
+ if (view->generator != NULL)
+ {
+ cache = g_buffer_view_get_cache(GTK_BUFFER_VIEW(view)->view);
+
+ g_buffer_cache_wlock(cache);
+
+ g_buffer_cache_truncate(cache, 0);
+
+ g_buffer_cache_wunlock(cache);
+
+ unref_object(cache);
+
+ g_clear_object(&view->generator);
+
+ }
+
+ if (content != NULL)
+ view->generator = g_hex_generator_new(content);
+
+ g_object_notify_by_pspec(G_OBJECT(view), _hex_view_properties[PROP_CONTENT]);
+
+ assert(content != NULL);
+ gtk_widget_queue_resize(GTK_WIDGET(view));
+
+ }
+
+ g_clear_object(&old);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : widget = composant GTK à redessiner. *
* snapshot = gestionnaire de noeuds de rendu à solliciter. *
* parent = composant GTK parent et cadre de l'appel. *
@@ -380,60 +501,101 @@ static void gtk_hex_view_populate_cache(GtkHexView *view)
/* Mise à jour de l'affichage ? */
+ /*
if (needed != count)
gtk_widget_queue_resize(GTK_WIDGET(view));
+ */
}
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+/******************************************************************************
+* *
+* Paramètres : object = instance d'objet GLib à mamnipuler. *
+* prop_id = identifiant de la propriété visée. *
+* value = valeur à prendre en compte. *
+* pspec = définition de la propriété. *
+* *
+* Description : Met à jour une propriété d'instance GObject. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
-
-void demo_snapshot (GtkWidget *widget, GtkSnapshot *snapshot, GtkWidget *parent)
+static void gtk_hex_view_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
- GdkRGBA red, green, yellow, blue;
- float w, h;
-
- gdk_rgba_parse (&red, "red");
- gdk_rgba_parse (&green, "green");
- gdk_rgba_parse (&yellow, "yellow");
- gdk_rgba_parse (&blue, "blue");
+ GtkHexView *view; /* Version spécialisée */
+ GObject *content; /* Contenu sous forme simple */
- w = gtk_widget_get_width (widget) / 2.0;
- h = gtk_widget_get_height (widget) / 2.0;
+ view = GTK_HEX_VIEW(object);
- h /= 2.0;
+ switch (prop_id)
+ {
+ case PROP_SHOW_OFFSETS:
+ g_display_options_set(GTK_CONTENT_VIEW(view)->options, HCO_OFFSET, g_value_get_boolean(value));
+ gtk_widget_set_visible(view->offsets, g_value_get_boolean(value));
+ break;
- gtk_snapshot_append_color (snapshot, &red,
- &GRAPHENE_RECT_INIT(0, 0, w, h));
- gtk_snapshot_append_color (snapshot, &green,
- &GRAPHENE_RECT_INIT(w, 0, w, h));
- gtk_snapshot_append_color (snapshot, &yellow,
- &GRAPHENE_RECT_INIT(0, h, w, h));
- gtk_snapshot_append_color (snapshot, &blue,
- &GRAPHENE_RECT_INIT(w, h, w, h));
+ case PROP_CONTENT:
+ content = g_value_get_object(value);
+ gtk_hex_view_set_content(view, G_BIN_CONTENT(content));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
}
+/******************************************************************************
+* *
+* Paramètres : object = instance d'objet GLib à mamnipuler. *
+* prop_id = identifiant de la propriété visée. *
+* value = valeur à transmettre. [OUT] *
+* pspec = définition de la propriété. *
+* *
+* Description : Fournit la valeur d'une propriété d'instance GObject. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+static void gtk_hex_view_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ GtkHexView *view; /* Version spécialisée */
+ view = GTK_HEX_VIEW(object);
+ switch (prop_id)
+ {
+ case PROP_SHOW_OFFSETS:
+ g_value_set_boolean(value, gtk_widget_get_visible(view->offsets));
+ break;
+ case PROP_CONTENT:
+ g_value_take_object(value, gtk_hex_view_get_content(view));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
-
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
-/* ---------------------------------------------------------------------------------- */
+}
/******************************************************************************
@@ -467,7 +629,13 @@ static void gtk_hex_view_size_allocate(GtkWidget *widget, int width, int height,
final_widths = alloca(_CHILDREN_COUNT * sizeof(int));
for (i = 0; i < _CHILDREN_COUNT; i++)
- gtk_widget_measure(view->children[i], GTK_ORIENTATION_HORIZONTAL, -1, &min_widths[i], NULL, NULL, NULL);
+ {
+ if (!gtk_widget_get_visible(view->children[i]))
+ min_widths[i] = 0;
+ else
+ gtk_widget_measure(view->children[i], GTK_ORIENTATION_HORIZONTAL, -1, &min_widths[i], NULL, NULL, NULL);
+
+ }
/* Passe 1 : tentative sans défilement vertical */
@@ -491,7 +659,10 @@ static void gtk_hex_view_size_allocate(GtkWidget *widget, int width, int height,
for (i = 0; i < _CHILDREN_COUNT; i++)
{
- final_widths[i] += min_widths[i];
+ if (!gtk_widget_get_visible(view->children[i]))
+ final_widths[i] = 0;
+ else
+ final_widths[i] += min_widths[i];
g_width_tracker_set_column_min_width(tracker, i, final_widths[i]);
@@ -531,17 +702,6 @@ static GtkSizeRequestMode gtk_hex_view_get_request_mode(GtkWidget *widget)
}
-
-
-
-
-
-
-
-
-
-
-
/******************************************************************************
* *
* Paramètres : widget = composant GTK à examiner. *
@@ -580,8 +740,12 @@ static void gtk_hex_view_measure(GtkWidget *widget, GtkOrientation orientation,
for (i = 0; i < _CHILDREN_COUNT; i++)
{
+ if (!gtk_widget_get_visible(view->children[i]))
+ continue;
+
gtk_widget_measure(view->children[i], GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);
requested += min;
+
}
for_size -= requested;
@@ -593,11 +757,14 @@ static void gtk_hex_view_measure(GtkWidget *widget, GtkOrientation orientation,
GTK_BUFFER_VIEW(view)->style,
for_size);
- if (minimum != NULL) *minimum = 0;
+ if (minimum != NULL) *minimum = requested;
if (natural != NULL) *natural = requested;
for (i = 0; i < _CHILDREN_COUNT; i++)
{
+ if (!gtk_widget_get_visible(view->children[i]))
+ continue;
+
gtk_widget_measure(view->children[i], GTK_ORIENTATION_VERTICAL, -1, &min, &nat, NULL, NULL);
if (minimum != NULL && min > *minimum)
diff --git a/src/gtkext/hexview.h b/src/gtkext/hexview.h
index 2199786..0d2cd5a 100644
--- a/src/gtkext/hexview.h
+++ b/src/gtkext/hexview.h
@@ -41,6 +41,12 @@ DECLARE_GTYPE(GtkHexView, gtk_hex_view, GTK, HEX_VIEW);
/* Crée un composant d'affichage d'octets bruts et imprimables. */
GtkHexView *gtk_hex_view_new(GBinContent *);
+/* Fournit le contenu associé au composant d'affichage. */
+GBinContent *gtk_hex_view_get_content(const GtkHexView *);
+
+/* Définit le contenu associé au composant d'affichage. */
+void gtk_hex_view_set_content(GtkHexView *, GBinContent *);
+
#endif /* _GTKEXT_HEXVIEW_H */
diff --git a/src/gtkext/hexview.ui b/src/gtkext/hexview.ui
index ae4586c..9b42936 100644
--- a/src/gtkext/hexview.ui
+++ b/src/gtkext/hexview.ui
@@ -1,27 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="GtkHexView" parent="GtkBufferView">
- <property name="css-name">GtkHexView</property>
- <child>
- <object class="GtkComposingArea" id="offsets">
- <style>
- <class name="gutter"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkComposingArea" id="hex">
- <property name="hexpand">true</property>
- <style>
- <class name="custom-view"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkComposingArea" id="ascii">
- <style>
- <class name="custom-view"/>
- </style>
- </object>
- </child>
- </template>
+
+ <template class="GtkHexView" parent="GtkBufferView">
+ <child>
+ <object class="GtkComposingArea" id="offsets">
+ <style>
+ <class name="gutter"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkComposingArea" id="hex">
+ <property name="hexpand">true</property>
+ <style>
+ <class name="custom-view"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkComposingArea" id="ascii">
+ <style>
+ <class name="custom-view"/>
+ </style>
+ </object>
+ </child>
+ </template>
+
</interface>
diff --git a/src/gtkext/panel-int.h b/src/gtkext/panel-int.h
index cb210d9..5398e51 100644
--- a/src/gtkext/panel-int.h
+++ b/src/gtkext/panel-int.h
@@ -36,6 +36,8 @@ typedef char * (* get_tiled_panel_path) (const GtkTiledPanel *);
/* Fournit les composants adaptés pour la barre de titre. */
typedef GListStore * (* get_tiled_panel_widgets_cb) (const GtkTiledPanel *, bool);
+/* Note un ajout ou un retrait de panneau principal. */
+typedef void (* notify_tiled_panel_state_cb) (GtkTiledPanel *, GtkTiledPanel *, bool);
/* Elément réactif pour panneaux de l'éditeur (instance) */
@@ -53,6 +55,8 @@ struct _GtkTiledPanelClass
get_tiled_panel_path get_default_path; /* Localisation de l'affichage */
get_tiled_panel_widgets_cb get_widgets; /* Récupération de composants */
+ notify_tiled_panel_state_cb notify; /* Note d'un ajout ou retrait */
+
};
diff --git a/src/gtkext/panel.c b/src/gtkext/panel.c
index 48019dc..f63cfa1 100644
--- a/src/gtkext/panel.c
+++ b/src/gtkext/panel.c
@@ -193,6 +193,32 @@ GListStore *gtk_tiled_panel_get_title_widgets(const GtkTiledPanel *panel, bool l
}
+/******************************************************************************
+* *
+* Paramètres : panel = panneau graphique à manipuler. *
+* main = panneau principal visé par l'opération. *
+* activated = nature du changement de statut : ajout, retrait ?*
+* *
+* Description : Note un ajout ou un retrait de panneau principal. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_tiled_panel_notify_new_main_panel_state(GtkTiledPanel *panel, GtkTiledPanel *main, bool activated)
+{
+ GtkTiledPanelClass *class; /* Classe à actionner */
+
+ class = GTK_TILED_PANEL_GET_CLASS(panel);
+
+ if (class->notify != NULL)
+ class->notify(panel, main, activated);
+
+}
+
+
diff --git a/src/gtkext/panel.h b/src/gtkext/panel.h
index 3b0361e..9b00657 100644
--- a/src/gtkext/panel.h
+++ b/src/gtkext/panel.h
@@ -44,6 +44,8 @@ char *gtk_tiled_panel_get_path(const GtkTiledPanel *);
/* Fournit les composants adaptés pour la barre de titre. */
GListStore *gtk_tiled_panel_get_title_widgets(const GtkTiledPanel *, bool);
+/* Note un ajout ou un retrait de panneau principal. */
+void gtk_tiled_panel_notify_new_main_panel_state(GtkTiledPanel *, GtkTiledPanel *, bool);
diff --git a/src/gtkext/statusstack-int.h b/src/gtkext/statusstack-int.h
index df9db35..721b982 100644
--- a/src/gtkext/statusstack-int.h
+++ b/src/gtkext/statusstack-int.h
@@ -50,6 +50,12 @@ struct _GtkStatusStack
GSourceFunc def_source; /* Appel en fin d'activité */
+ /* Message simple par défaut */
+
+ GtkLabel *def_label; /* Afficheur de message */
+
+ char *msg; /* Contenu associé */
+
/* Navigation */
GtkLabel *nav_segment; /* Désignation du segment */
diff --git a/src/gtkext/statusstack.c b/src/gtkext/statusstack.c
index 492d888..92c296a 100644
--- a/src/gtkext/statusstack.c
+++ b/src/gtkext/statusstack.c
@@ -56,6 +56,10 @@ typedef enum _StatusStackProperty {
static GParamSpec *_status_stack_properties[N_PROPERTIES] = { NULL, };
+/* Source d'affichage par défaut */
+#define gtk_status_stack_default_source gtk_status_stack_show_simple_message
+
+
/* Initialise la classe des barres de statut améliorées. */
static void gtk_status_stack_class_init(GtkStatusStackClass *);
@@ -87,6 +91,14 @@ static void gtk_status_stack_get_property(GObject *, guint, GValue *, GParamSpec
+/* ----------------------- MISE EN AVANT DES MESSAGES SIMPLES ----------------------- */
+
+
+/* S'assure de l'affichage à jour de la partie "default". */
+static gboolean gtk_status_stack_show_simple_message(gpointer);
+
+
+
/* -------------------- STATUT DES INFORMATIONS DE DESASSEMBLAGE -------------------- */
@@ -115,7 +127,7 @@ static void init_navigation_info(navigation_info_t *);
static void fini_navigation_info(navigation_info_t *);
/* S'assure de l'affichage à jour de la partie "navigation". */
-static gboolean gtk_status_stack_show_current_location(GtkStatusStack *);
+static gboolean gtk_status_stack_show_current_location(gpointer);
/* Réagit à un clic sur l'icône de zoom. */
static void gtk_status_stack_on_zoom_icon_press(GtkEntry *, GtkEntryIconPosition, GtkStatusStack *);
@@ -165,7 +177,7 @@ static void fini_activity_info(activity_info_t *);
static activity_status_t *find_activity_status_by_id(activity_info_t *, activity_id_t);
/* S'assure de l'affichage à jour de la partie "activité". */
-static gboolean gtk_status_stack_show_current_activity(GtkStatusStack *);
+static gboolean gtk_status_stack_show_current_activity(gpointer);
@@ -217,6 +229,8 @@ static void gtk_status_stack_class_init(GtkStatusStackClass *class)
gtk_widget_class_bind_template_child(widget, GtkStatusStack, main);
+ gtk_widget_class_bind_template_child(widget, GtkStatusStack, def_label);
+
gtk_widget_class_bind_template_child(widget, GtkStatusStack, nav_segment);
gtk_widget_class_bind_template_child(widget, GtkStatusStack, nav_phys);
gtk_widget_class_bind_template_child(widget, GtkStatusStack, nav_virt);
@@ -254,7 +268,9 @@ static void gtk_status_stack_init(GtkStatusStack *stack)
{
gtk_widget_init_template(GTK_WIDGET(stack));
- stack->def_source = NULL;
+ stack->def_source = gtk_status_stack_default_source;
+
+ stack->msg = NULL;
stack->nav_info = calloc(1, sizeof(navigation_info_t));
init_navigation_info(stack->nav_info);
@@ -278,6 +294,10 @@ static void gtk_status_stack_init(GtkStatusStack *stack)
stack->network_update_tag = g_timeout_add(NETWORK_UPDATE_INTERVAL,
G_SOURCE_FUNC(gtk_status_stack_update_network_stats), stack);
+ /* Premier affichage... */
+
+ gtk_status_stack_reset_to_default(stack);
+
}
@@ -324,6 +344,9 @@ static void gtk_status_stack_dispose(GtkStatusStack *stack)
static void gtk_status_stack_finalize(GtkStatusStack *stack)
{
+ if (stack->msg != NULL)
+ free(stack->msg);
+
fini_navigation_info(stack->nav_info);
free(stack->nav_info);
@@ -370,11 +393,15 @@ GtkStatusStack *gtk_status_stack_new(void)
* *
******************************************************************************/
-void gtk_status_stack_reset(GtkStatusStack *stack)
+void gtk_status_stack_reset_to_default(GtkStatusStack *stack)
{
- gtk_stack_set_visible_child_name(stack->main, "default");
+ /**
+ * Une amélioration possible serait de passer à g_idle_add_once(),
+ * et de s'affranchir des retours G_SOURCE_REMOVE systématiques,
+ * mais la fonction n'est disponible qu'à partir de la GLib 2.74.
+ */
- stack->def_source = NULL;
+ g_idle_add(stack->def_source, stack);
}
@@ -614,6 +641,69 @@ static void gtk_status_stack_get_property(GObject *object, guint prop_id, GValue
/* ---------------------------------------------------------------------------------- */
+/* MISE EN AVANT DES MESSAGES SIMPLES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : stack = barre de statut à actualiser. *
+* msg = simple message à faire paraître. *
+* *
+* Description : Inscrit un message simple dans la barre de statut. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_status_stack_display_message(GtkStatusStack *stack, const char *msg)
+{
+ if (stack->msg != NULL)
+ free(stack->msg);
+
+ if (msg != NULL)
+ stack->msg = strdup(msg);
+ else
+ stack->msg = NULL;
+
+ gtk_status_stack_show_simple_message(stack);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = pile de statuts à manipuler. *
+* *
+* Description : S'assure de l'affichage à jour de la partie "default". *
+* *
+* Retour : G_SOURCE_REMOVE pour une exécution unique. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static gboolean gtk_status_stack_show_simple_message(gpointer data)
+{
+ GtkStatusStack *stack; /* Version spécialisée */
+
+ stack = GTK_STATUS_STACK(data);
+
+ stack->def_source = gtk_status_stack_show_simple_message;
+
+ gtk_label_set_text(stack->def_label, stack->msg != NULL ? stack->msg : "");
+
+ gtk_stack_set_visible_child_name(stack->main, "default");
+
+ return G_SOURCE_REMOVE;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
/* STATUT DES INFORMATIONS DE DESASSEMBLAGE */
/* ---------------------------------------------------------------------------------- */
@@ -744,7 +834,7 @@ void gtk_status_stack_update_current_location(GtkStatusStack *stack, const mrang
/******************************************************************************
* *
-* Paramètres : stack = pile de statuts à manipuler. *
+* Paramètres : data = pile de statuts à manipuler. *
* *
* Description : S'assure de l'affichage à jour de la partie "navigation". *
* *
@@ -754,14 +844,15 @@ void gtk_status_stack_update_current_location(GtkStatusStack *stack, const mrang
* *
******************************************************************************/
-static gboolean gtk_status_stack_show_current_location(GtkStatusStack *stack)
+static gboolean gtk_status_stack_show_current_location(gpointer data)
{
+ GtkStatusStack *stack; /* Version spécialisée */
navigation_info_t *info; /* Informations à constituer */
char raw_pos[6 + VMPA_MAX_LEN + 1]; /* Formatage final en direct */
- stack->def_source = (GSourceFunc)gtk_status_stack_show_current_location;
+ stack = GTK_STATUS_STACK(data);
- gtk_stack_set_visible_child_name(stack->main, "navigation");
+ stack->def_source = gtk_status_stack_show_current_location;
info = stack->nav_info;
@@ -785,6 +876,10 @@ static gboolean gtk_status_stack_show_current_location(GtkStatusStack *stack)
gtk_label_set_text(stack->nav_details, info->details != NULL ? info->details : "");
+ /* Conclusion */
+
+ gtk_stack_set_visible_child_name(stack->main, "navigation");
+
return G_SOURCE_REMOVE;
}
@@ -985,7 +1080,7 @@ activity_id_t gtk_status_stack_add_activity(GtkStatusStack *stack, const char *m
if (info->tag != 0)
g_source_remove(info->tag);
- info->tag = g_idle_add((GSourceFunc)gtk_status_stack_show_current_activity, stack);
+ info->tag = g_idle_add(gtk_status_stack_show_current_activity, stack);
g_mutex_unlock(&info->access);
@@ -1052,7 +1147,7 @@ void gtk_status_stack_update_activity_message(GtkStatusStack *stack, activity_id
if (info->tag != 0)
g_source_remove(info->tag);
- info->tag = g_idle_add((GSourceFunc)gtk_status_stack_show_current_activity, stack);
+ info->tag = g_idle_add(gtk_status_stack_show_current_activity, stack);
}
@@ -1109,7 +1204,7 @@ void gtk_status_stack_update_activity_value(GtkStatusStack *stack, activity_id_t
if (info->tag != 0)
g_source_remove(info->tag);
- info->tag = g_idle_add((GSourceFunc)gtk_status_stack_show_current_activity, stack);
+ info->tag = g_idle_add(gtk_status_stack_show_current_activity, stack);
}
@@ -1161,7 +1256,7 @@ void gtk_status_stack_extend_activity_max(GtkStatusStack *stack, activity_id_t i
if (info->tag != 0)
g_source_remove(info->tag);
- info->tag = g_idle_add((GSourceFunc)gtk_status_stack_show_current_activity, stack);
+ info->tag = g_idle_add(gtk_status_stack_show_current_activity, stack);
}
@@ -1227,10 +1322,10 @@ void gtk_status_stack_remove_activity(GtkStatusStack *stack, activity_id_t id)
if (info->count == 0)
{
info->tag = 0;
- g_idle_add(stack->def_source, stack);
+ gtk_status_stack_reset_to_default(stack);
}
else if (is_last)
- info->tag = g_idle_add((GSourceFunc)gtk_status_stack_show_current_activity, stack);
+ info->tag = g_idle_add(gtk_status_stack_show_current_activity, stack);
exit:
@@ -1241,7 +1336,7 @@ void gtk_status_stack_remove_activity(GtkStatusStack *stack, activity_id_t id)
/******************************************************************************
* *
-* Paramètres : stack = pile de statuts à manipuler. *
+* Paramètres : data = pile de statuts à manipuler. *
* *
* Description : S'assure de l'affichage à jour de la partie "activité". *
* *
@@ -1251,11 +1346,14 @@ void gtk_status_stack_remove_activity(GtkStatusStack *stack, activity_id_t id)
* *
******************************************************************************/
-static gboolean gtk_status_stack_show_current_activity(GtkStatusStack *stack)
+static gboolean gtk_status_stack_show_current_activity(gpointer data)
{
+ GtkStatusStack *stack; /* Version spécialisée */
activity_info_t *info; /* Informations à consulter */
activity_status_t *last; /* Dernier statut à traiter */
+ stack = GTK_STATUS_STACK(data);
+
info = stack->activity_info;
g_mutex_lock(&info->access);
@@ -1264,14 +1362,14 @@ static gboolean gtk_status_stack_show_current_activity(GtkStatusStack *stack)
{
if (info->count > 0)
{
- gtk_stack_set_visible_child_name(stack->main, "activity");
-
last = &info->statuses[info->count - 1];
gtk_label_set_text(stack->activity_message, last->message);
gtk_progress_bar_set_fraction(stack->activity_progress, (last->current * 1.0) / last->max);
+ gtk_stack_set_visible_child_name(stack->main, "activity");
+
}
info->tag = 0;
diff --git a/src/gtkext/statusstack.h b/src/gtkext/statusstack.h
index 66ad6db..96d008c 100644
--- a/src/gtkext/statusstack.h
+++ b/src/gtkext/statusstack.h
@@ -45,7 +45,15 @@ DECLARE_GTYPE(GtkStatusStack, gtk_status_stack, GTK, STATUS_STACK);
GtkStatusStack *gtk_status_stack_new(void);
/* Réinitialise la barre de statut à son stade par défaut. */
-void gtk_status_stack_reset(GtkStatusStack *);
+void gtk_status_stack_reset_to_default(GtkStatusStack *);
+
+
+
+/* ----------------------- MISE EN AVANT DES MESSAGES SIMPLES ----------------------- */
+
+
+/* Inscrit un message simple dans la barre de statut. */
+void gtk_status_stack_display_message(GtkStatusStack *, const char *);
diff --git a/src/gtkext/statusstack.ui b/src/gtkext/statusstack.ui
index 2a6e256..0b7cd6d 100644
--- a/src/gtkext/statusstack.ui
+++ b/src/gtkext/statusstack.ui
@@ -12,16 +12,19 @@
<!-- Vide par défaut -->
<child>
- <object class="GtkStackPage" id="stack">
+ <object class="GtkStackPage">
<property name="name">default</property>
<property name="child">
- <object class="GtkLabel">
+ <object class="GtkLabel" id="def_label">
<property name="hexpand">true</property>
<property name="halign">fill</property>
- <property name="valign">center</property>
+ <property name="valign">baseline</property>
<property name="xalign">0</property>
<property name="label"></property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
</property>
diff --git a/src/gui/core/panels.c b/src/gui/core/panels.c
index 3232e0c..9fca411 100644
--- a/src/gui/core/panels.c
+++ b/src/gui/core/panels.c
@@ -299,6 +299,43 @@ bool register_framework_panel_definition(const panel_info_t *info)
* *
* Paramètres : target = type de définition de panneau recherchée. *
* *
+* Description : Récupère les particularités d'un panneau graphique. *
+* *
+* Retour : Détails du comportement associé au panneau visé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+FrameworkPanelPersonality get_framework_panel_personality(GType target)
+{
+ FrameworkPanelPersonality result; /* Propriétées à retourner */
+ size_t i; /* Boucle de parcours */
+ ext_panel_info_t *info; /* Informations conservées */
+
+ result = FPP_NONE;
+
+ for (i = 0; i < _panels_count; i++)
+ {
+ info = _panels_list[i];
+
+ if (info->panel_type == target)
+ {
+ result = info->personality;
+ break;
+ }
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : target = type de définition de panneau recherchée. *
+* *
* Description : Met en place (au besoin) un panneau graphique unique. *
* *
* Retour : Instance de définition identifiée ou NULL en cas d'échec. *
diff --git a/src/gui/core/panels.h b/src/gui/core/panels.h
index 4d0ce41..e17ef8a 100644
--- a/src/gui/core/panels.h
+++ b/src/gui/core/panels.h
@@ -71,6 +71,9 @@ void unload_all_framework_panel_definitions(void);
/* Enregistre la définition d'un panneau graphique. */
bool register_framework_panel_definition(const panel_info_t *);
+/* Récupère les particularités d'un panneau graphique. */
+FrameworkPanelPersonality get_framework_panel_personality(GType);
+
/* Met en place (au besoin) un panneau graphique unique. */
GtkTiledPanel *get_framework_panel_singleton(GType);
diff --git a/src/gui/dialogs/Makefile.am b/src/gui/dialogs/Makefile.am
index e910c96..3492f63 100644
--- a/src/gui/dialogs/Makefile.am
+++ b/src/gui/dialogs/Makefile.am
@@ -3,7 +3,9 @@ BUILT_SOURCES = resources.h resources.c
noinst_LTLIBRARIES = libguidialogs.la
+
UI_FILES = \
+ about.css \
about.ui \
preferences.ui
# bookmark.ui \
diff --git a/src/gui/dialogs/about-int.h b/src/gui/dialogs/about-int.h
index 616c73f..96a470e 100644
--- a/src/gui/dialogs/about-int.h
+++ b/src/gui/dialogs/about-int.h
@@ -37,20 +37,6 @@ struct _GtkAppAboutDialog
{
GtkWindow parent; /* A laisser en premier */
- union
- {
- struct
- {
- GtkPicture *revision_0; /* Numéro #0 */
- GtkPicture *revision_1; /* Numéro #1 */
- GtkPicture *revision_2; /* Numéro #2 */
- GtkPicture *revision_3; /* Numéro #3 */
- GtkPicture *revision_4; /* Numéro #4 */
- GtkPicture *revision_5; /* Numéro #5 */
- };
- GtkPicture *revisions[6]; /* Tous les numéros d'un coup */
- };
-
};
/* Boîte "A propos de" dédiée à l'application (classe) */
diff --git a/src/gui/dialogs/about.c b/src/gui/dialogs/about.c
index 956918b..1dca752 100644
--- a/src/gui/dialogs/about.c
+++ b/src/gui/dialogs/about.c
@@ -44,10 +44,10 @@ static void gtk_app_about_dialog_class_init(GtkAppAboutDialogClass *);
static void gtk_app_about_dialog_init(GtkAppAboutDialog *);
/* Supprime toutes les références externes. */
-static void gtk_app_about_dialog_dispose(GtkAppAboutDialog *);
+static void gtk_app_about_dialog_dispose(GObject *);
/* Procède à la libération totale de la mémoire. */
-static void gtk_app_about_dialog_finalize(GtkAppAboutDialog *);
+static void gtk_app_about_dialog_finalize(GObject *);
@@ -74,22 +74,17 @@ static void gtk_app_about_dialog_class_init(GtkAppAboutDialogClass *class)
object = G_OBJECT_CLASS(class);
- object->dispose = (GObjectFinalizeFunc/* ! */)gtk_app_about_dialog_dispose;
- object->finalize = (GObjectFinalizeFunc)gtk_app_about_dialog_finalize;
+ object->dispose = gtk_app_about_dialog_dispose;
+ object->finalize = gtk_app_about_dialog_finalize;
widget = GTK_WIDGET_CLASS(class);
+ gtk_widget_class_set_css_name(widget, "aboutdialog");
+
gtk_widget_class_add_binding_action(widget, GDK_KEY_Escape, 0, "window.close", NULL);
gtk_widget_class_set_template_from_resource(widget, "/re/chrysalide/framework/gui/dialogs/about.ui");
- gtk_widget_class_bind_template_child(widget, GtkAppAboutDialog, revision_0);
- gtk_widget_class_bind_template_child(widget, GtkAppAboutDialog, revision_1);
- gtk_widget_class_bind_template_child(widget, GtkAppAboutDialog, revision_2);
- gtk_widget_class_bind_template_child(widget, GtkAppAboutDialog, revision_3);
- gtk_widget_class_bind_template_child(widget, GtkAppAboutDialog, revision_4);
- gtk_widget_class_bind_template_child(widget, GtkAppAboutDialog, revision_5);
-
}
@@ -107,40 +102,14 @@ static void gtk_app_about_dialog_class_init(GtkAppAboutDialogClass *class)
static void gtk_app_about_dialog_init(GtkAppAboutDialog *dialog)
{
- unsigned int revision; /* Numéro de révision */
- unsigned int max; /* Nbre. de boucles à effectuer*/
- unsigned int i; /* Boucle de parcours */
- unsigned int level; /* Unité la plus importante */
- char buffer[64]; /* Nom d'image à forger */
-
gtk_widget_init_template(GTK_WIDGET(dialog));
- revision = REVISION;
- max = log(revision) / log(10);
-
- assert(max <= 6);
-
- for (i = 0; i <= max; i++)
- {
- level = pow(10, max - i);
-
- snprintf(buffer, 64, "/org/chrysalide/gui/dialogs/about/revision_%u.png", revision / level);
-
- gtk_picture_set_resource(dialog->revisions[i], buffer);
-
- revision %= level;
-
- }
-
- for (; i < 6; i++)
- gtk_widget_set_visible(GTK_WIDGET(dialog->revisions[i]), FALSE);
-
}
/******************************************************************************
* *
-* Paramètres : dialog = instance d'objet GLib à traiter. *
+* Paramètres : object = instance d'objet GLib à traiter. *
* *
* Description : Supprime toutes les références externes. *
* *
@@ -150,18 +119,18 @@ static void gtk_app_about_dialog_init(GtkAppAboutDialog *dialog)
* *
******************************************************************************/
-static void gtk_app_about_dialog_dispose(GtkAppAboutDialog *dialog)
+static void gtk_app_about_dialog_dispose(GObject *object)
{
- gtk_widget_dispose_template(GTK_WIDGET(dialog), GTK_TYPE_APP_ABOUT_DIALOG);
+ gtk_widget_dispose_template(GTK_WIDGET(object), GTK_TYPE_APP_ABOUT_DIALOG);
- G_OBJECT_CLASS(gtk_app_about_dialog_parent_class)->dispose(G_OBJECT(dialog));
+ G_OBJECT_CLASS(gtk_app_about_dialog_parent_class)->dispose(object);
}
/******************************************************************************
* *
-* Paramètres : dialog = instance d'objet GLib à traiter. *
+* Paramètres : object = instance d'objet GLib à traiter. *
* *
* Description : Procède à la libération totale de la mémoire. *
* *
@@ -171,9 +140,9 @@ static void gtk_app_about_dialog_dispose(GtkAppAboutDialog *dialog)
* *
******************************************************************************/
-static void gtk_app_about_dialog_finalize(GtkAppAboutDialog *dialog)
+static void gtk_app_about_dialog_finalize(GObject *object)
{
- G_OBJECT_CLASS(gtk_app_about_dialog_parent_class)->finalize(G_OBJECT(dialog));
+ G_OBJECT_CLASS(gtk_app_about_dialog_parent_class)->finalize(object);
}
diff --git a/src/gui/dialogs/about.css b/src/gui/dialogs/about.css
new file mode 100644
index 0000000..af3fa97
--- /dev/null
+++ b/src/gui/dialogs/about.css
@@ -0,0 +1,9 @@
+
+aboutdialog > box {
+
+ background-color: black;
+
+ background-image: url('resource:///re/chrysalide/framework/gui/dialogs/about/bg.png');
+ background-repeat: no-repeat;
+
+}
diff --git a/src/gui/dialogs/about.ui b/src/gui/dialogs/about.ui
index 989e53b..7b519d2 100644
--- a/src/gui/dialogs/about.ui
+++ b/src/gui/dialogs/about.ui
@@ -8,91 +8,13 @@
<property name="modal">true</property>
<property name="resizable">false</property>
- <style>
- <class name="black-bg"/>
- </style>
-
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
- <child>
- <object class="GtkPicture" id="logo">
- <property name="margin-top">10</property>
- <property name="file">resource://org/chrysalide/gui/dialogs/about/chrysalide-full.png</property>
- </object>
- </child>
-
- <!--
- Etage intermédiaire pour ne pas que l'image se voie allouer la largeur entière
- de la fenêtre. Sinon des marges sont placées autour du rendu lors que l'image
- n'est pas étendue pour couvrir cette largeur entière.
- -->
- <child>
- <object class="GtkBox">
- <property name="orientation">horizontal</property>
- <property name="halign">center</property>
- <property name="margin-top">14</property>
- <child>
- <object class="GtkPicture" id="text">
- <property name="width-request">253</property>
- <property name="file">resource:///org/chrysalide/gui/dialogs/about/chrysalide_text.png</property>
- </object>
- </child>
- </object>
- </child>
-
- <child>
- <object class="GtkBox">
- <property name="orientation">horizontal</property>
- <property name="margin-start">149</property>
- <child>
- <object class="GtkPicture" id="revision">
- <property name="width-request">14</property>
- <property name="file">resource:///org/chrysalide/gui/dialogs/about/revision.png</property>
- </object>
- </child>
- <child>
- <object class="GtkPicture" id="revision_0">
- <property name="width-request">14</property>
- <property name="file">resource:///org/chrysalide/gui/dialogs/about/revision.png</property>
- </object>
- </child>
- <child>
- <object class="GtkPicture" id="revision_1">
- <property name="width-request">14</property>
- <property name="file">resource:///org/chrysalide/gui/dialogs/about/revision.png</property>
- </object>
- </child>
- <child>
- <object class="GtkPicture" id="revision_2">
- <property name="width-request">14</property>
- <property name="file">resource:///org/chrysalide/gui/dialogs/about/revision.png</property>
- </object>
- </child>
- <child>
- <object class="GtkPicture" id="revision_3">
- <property name="width-request">14</property>
- <property name="file">resource:///org/chrysalide/gui/dialogs/about/revision.png</property>
- </object>
- </child>
- <child>
- <object class="GtkPicture" id="revision_4">
- <property name="width-request">14</property>
- <property name="file">resource:///org/chrysalide/gui/dialogs/about/revision.png</property>
- </object>
- </child>
- <child>
- <object class="GtkPicture" id="revision_5">
- <property name="width-request">14</property>
- <property name="file">resource:///org/chrysalide/gui/dialogs/about/revision.png</property>
- </object>
- </child>
- </object>
- </child>
<child>
<object class="GtkLabel">
- <property name="margin-top">22</property>
+ <property name="margin-top">368</property>
<property name="margin-bottom">10</property>
<property name="label" translatable="yes">&lt;span fgcolor='white'&gt;Copyright (C) 2008-2025 Cyrille Bagard&lt;/span&gt;</property>
<property name="use-markup">True</property>
diff --git a/src/gui/dialogs/gresource.xml b/src/gui/dialogs/gresource.xml
index 169f440..966d9c8 100644
--- a/src/gui/dialogs/gresource.xml
+++ b/src/gui/dialogs/gresource.xml
@@ -1,22 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/re/chrysalide/framework/gui/dialogs">
+ <file compressed="true">about.css</file>
<file compressed="true">about.ui</file>
<file compressed="true">preferences.ui</file>
</gresource>
- <gresource prefix="/org/chrysalide/gui/dialogs/about">
- <file compressed="true" alias="chrysalide-full.png">../../../pixmaps/chrysalide-full.png</file>
- <file compressed="true" alias="chrysalide_text.png">../../../pixmaps/chrysalide_text.png</file>
- <file compressed="true" alias="revision.png">../../../pixmaps/revision.png</file>
- <file compressed="true" alias="revision_0.png">../../../pixmaps/revision_0.png</file>
- <file compressed="true" alias="revision_1.png">../../../pixmaps/revision_1.png</file>
- <file compressed="true" alias="revision_2.png">../../../pixmaps/revision_2.png</file>
- <file compressed="true" alias="revision_3.png">../../../pixmaps/revision_3.png</file>
- <file compressed="true" alias="revision_4.png">../../../pixmaps/revision_4.png</file>
- <file compressed="true" alias="revision_5.png">../../../pixmaps/revision_5.png</file>
- <file compressed="true" alias="revision_6.png">../../../pixmaps/revision_6.png</file>
- <file compressed="true" alias="revision_7.png">../../../pixmaps/revision_7.png</file>
- <file compressed="true" alias="revision_8.png">../../../pixmaps/revision_8.png</file>
- <file compressed="true" alias="revision_9.png">../../../pixmaps/revision_9.png</file>
- </gresource>
</gresources>
diff --git a/src/gui/panels/logs.c b/src/gui/panels/logs.c
index 729a62b..399c4c0 100644
--- a/src/gui/panels/logs.c
+++ b/src/gui/panels/logs.c
@@ -37,10 +37,10 @@
/* ------------------------- COEUR D'UN PANNEAU D'AFFICHAGE ------------------------- */
-/* Initialise la classe des panneaux d'accueil par défaut. */
+/* Initialise la classe des panneaux d'affichage des journaux. */
static void gtk_logs_panel_class_init(GtkLogsPanelClass *);
-/* Initialise une instance de panneau d'accueil par défaut. */
+/* Initialise une instance de panneau d'affichage des journaux. */
static void gtk_logs_panel_init(GtkLogsPanel *);
/* Supprime toutes les références externes. */
@@ -72,7 +72,7 @@ G_DEFINE_TYPE(GtkLogsPanel, gtk_logs_panel, GTK_TYPE_TILED_PANEL);
* *
* Paramètres : class = classe à initialiser. *
* *
-* Description : Initialise la classe des panneaux d'accueil par défaut. *
+* Description : Initialise la classe des panneaux d'affichage des journaux. *
* *
* Retour : - *
* *
@@ -113,7 +113,7 @@ static void gtk_logs_panel_class_init(GtkLogsPanelClass *class)
* *
* Paramètres : panel = instance à initialiser. *
* *
-* Description : Initialise une instance de panneau d'accueil par défaut. *
+* Description : Initialise une instance de panneau d'affichage des journaux. *
* *
* Retour : - *
* *
diff --git a/src/gui/style.css b/src/gui/style.css
index e21d931..dce41fa 100644
--- a/src/gui/style.css
+++ b/src/gui/style.css
@@ -36,11 +36,7 @@ list.boxed-list, list.boxed-list > row:last-child {
/* about.css */
-.black-bg {
-
- background-color: black;
-
-}
+@import url('resource:///re/chrysalide/framework/gui/dialogs/about.css');
/* welcome.css */
diff --git a/src/gui/window-int.h b/src/gui/window-int.h
index b72a499..4f3dd57 100644
--- a/src/gui/window-int.h
+++ b/src/gui/window-int.h
@@ -38,6 +38,9 @@ struct _GtkFrameworkWindow
GSettings *settings; /* Paramètres globaux */
GtkTilingGrid *grid; /* Réceptacle de panneaux */
+ GtkStatusStack *status; /* Barre de statut */
+
+ GtkTiledPanel *main; /* Panneau principal courant */
};
diff --git a/src/gui/window.c b/src/gui/window.c
index dbe7e87..e14ecf7 100644
--- a/src/gui/window.c
+++ b/src/gui/window.c
@@ -33,7 +33,6 @@
#include "panels/welcome.h"
#include "../gtkext/grid.h"
#include "../gtkext/helpers.h"
-#include "../gtkext/statusstack.h"
@@ -106,6 +105,7 @@ static void gtk_framework_window_class_init(GtkFrameworkWindowClass *class)
gtk_widget_class_set_template_from_resource(widget, "/re/chrysalide/framework/gui/window.ui");
gtk_widget_class_bind_template_child(widget, GtkFrameworkWindow, grid);
+ gtk_widget_class_bind_template_child(widget, GtkFrameworkWindow, status);
/* Active une action native (cf. https://docs.gtk.org/gtk4/class.Window.html#actions) */
gtk_widget_class_add_binding_action(widget, GDK_KEY_Q, GDK_CONTROL_MASK, "window.close", NULL);
@@ -148,6 +148,8 @@ static void gtk_framework_window_init(GtkFrameworkWindow *window)
g_settings_bind(window->settings, "window-height", G_OBJECT(window), "default-height", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(window->settings, "window-maximized", G_OBJECT(window), "maximized", G_SETTINGS_BIND_DEFAULT);
+ window->main = NULL;
+
g_action_map_add_action_entries(G_ACTION_MAP(window),
app_entries, G_N_ELEMENTS(app_entries),
window);
@@ -206,6 +208,8 @@ static void gtk_framework_window_dispose(GObject *object)
g_clear_object(&window->settings);
+ g_clear_object(&window->main);
+
G_OBJECT_CLASS(gtk_framework_window_parent_class)->dispose(object);
}
@@ -488,6 +492,31 @@ static void gtk_framework_window_activate_about(GSimpleAction *action, GVariant
/******************************************************************************
* *
+* Paramètres : window = instance de fenêtre principale à consulter. *
+* *
+* Description : Fournit une référence à la barre de statut intégrée. *
+* *
+* Retour : Composant GTK en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkStatusStack *gtk_framework_window_get_status_stack(const GtkFrameworkWindow *window)
+{
+ GtkStatusStack *result; /* Instance à retourner */
+
+ result = window->status;
+ ref_object(result);
+
+ return result;
+
+}
+
+
+
+/******************************************************************************
+* *
* Paramètres : window = instance de fenêtre principale à remplir. *
* panel = nouveau panneau à afficher. *
* *
@@ -506,6 +535,7 @@ void gtk_framework_window_add(GtkFrameworkWindow *window, /* __steal */GtkTiledP
guint count; /* Nombre d'élements présents */
guint i; /* Boucle de parcours */
GtkWidget *widget; /* Composant à intégrer */
+ FrameworkPanelPersonality personality; /* Propriétés du panneau */
@@ -538,4 +568,54 @@ void gtk_framework_window_add(GtkFrameworkWindow *window, /* __steal */GtkTiledP
}
+ /* Mise à jour des liens vers un panneau principal */
+
+ personality = get_framework_panel_personality(G_OBJECT_TYPE(panel));
+
+ if (personality & FPP_MAIN_PANEL)
+ gtk_framework_window_notify_new_main_panel_state(window, panel, true);
+
+ else
+ {
+ if (window->main != NULL)
+ gtk_tiled_panel_notify_new_main_panel_state(panel, window->main, true);
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : window = instance de fenêtre principale à manipuler. *
+* main = panneau principal visé par l'opération. *
+* activated = nature du changement de statut : ajout, retrait ?*
+* *
+* Description : Note un ajout ou un retrait de panneau principal. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_framework_window_notify_new_main_panel_state(GtkFrameworkWindow *window, GtkTiledPanel *main, bool activated)
+{
+ if (activated)
+ {
+ g_clear_object(&window->main);
+
+ window->main = main;
+ ref_object(main);
+
+ }
+
+ else
+ {
+ if (main == window->main)
+ g_clear_object(&window->main);
+
+ }
+
+ gtk_tiling_grid_notify_new_main_panel_state(window->grid, main, activated);
+
}
diff --git a/src/gui/window.h b/src/gui/window.h
index 56c56ec..077d51a 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -30,6 +30,7 @@
#include "../glibext/helpers.h"
#include "../gtkext/panel.h"
+#include "../gtkext/statusstack.h"
@@ -43,13 +44,18 @@
DECLARE_GTYPE(GtkFrameworkWindow, gtk_framework_window, GTK, FRAMEWORK_WINDOW);
-
/* Crée une nouvelle application principale pour Chrysalide. */
GtkApplicationWindow *gtk_framework_window_new(GtkApplication *);
+/* Fournit une référence à la barre de statut intégrée. */
+GtkStatusStack *gtk_framework_window_get_status_stack(const GtkFrameworkWindow *);
+
/* Ajoute un panneau à la fenêtre principale de Chrysalide. */
void gtk_framework_window_add(GtkFrameworkWindow *, GtkTiledPanel *);
+/* Note un ajout ou un retrait de panneau principal. */
+void gtk_framework_window_notify_new_main_panel_state(GtkFrameworkWindow *, GtkTiledPanel *, bool);
+
#endif /* _GUI_WINDOW_H */
diff --git a/src/rost.c b/src/rost.c
index 4a052c3..b94b367 100644
--- a/src/rost.c
+++ b/src/rost.c
@@ -41,7 +41,9 @@
#include "analysis/scan/scanner.h"
#include "analysis/scan/patterns/backends/acism.h"
#include "analysis/scan/patterns/backends/bitap.h"
-#include "analysis/scan/patterns/backends/hyperscan.h"
+#ifdef INCLUDE_HS_SUPPORT
+# include "analysis/scan/patterns/backends/hyperscan.h"
+#endif
#include "core/core.h"
#include "core/global.h"
#include "core/logs.h"
@@ -93,7 +95,11 @@ static void show_rost_help(const char *name)
printf("\n");
+#ifdef INCLUDE_HS_SUPPORT
printf("\t-A --algorithm=NAME\tSelect one of the available algorithms for data: acism, bitmap, hyperscan (default: acsim).\n");
+#else
+ printf("\t-A --algorithm=NAME\tSelect one of the available algorithms for data: acism, bitmap (default: acsim).\n");
+#endif
printf("\t-C --check-only\t\tValidate the rule syntax without performing a scan (discard the file/dir argument).\n");
printf("\t-j --print-json\t\tPrint matching strings in JSON format instead of simple text.\n");
printf("\t-s --print-strings\tPrint matching strings (default text format only).\n");
@@ -303,8 +309,10 @@ int main(int argc, char **argv)
g_scan_options_set_backend_for_data(options, G_TYPE_ACISM_BACKEND);
else if (strcmp(optarg, "bitmap") == 0)
g_scan_options_set_backend_for_data(options, G_TYPE_BITAP_BACKEND);
+#ifdef INCLUDE_HS_SUPPORT
else if (strcmp(optarg, "hyperscan") == 0)
g_scan_options_set_backend_for_data(options, G_TYPE_HYPERSCAN_BACKEND);
+#endif
else
g_scan_options_set_backend_for_data(options, G_TYPE_INVALID);
break;