From 0b8fbc0c0d6a18cf1b90337dbd20639316af1fe7 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sat, 22 Feb 2025 14:25:55 +0100 Subject: Create a plugin skeleton for Python notebooks. --- configure.ac | 1 + plugins/Makefile.am | 3 +- plugins/pynb/Makefile.am | 75 ++++++++ plugins/pynb/core-ui-int.h | 56 ++++++ plugins/pynb/core-ui.c | 292 +++++++++++++++++++++++++++++ plugins/pynb/core-ui.h | 43 +++++ plugins/pynb/data/images/pynb-symbolic.svg | 144 ++++++++++++++ plugins/pynb/gresource.xml | 11 ++ plugins/pynb/panel-int.h | 56 ++++++ plugins/pynb/panel.c | 210 +++++++++++++++++++++ plugins/pynb/panel.h | 47 +++++ plugins/pynb/panel.ui | 21 +++ plugins/pynb/params-int.h | 50 +++++ plugins/pynb/params.c | 171 +++++++++++++++++ plugins/pynb/params.h | 41 ++++ plugins/pynb/params.ui | 52 +++++ plugins/pynb/prefs.ui | 38 ++++ 17 files changed, 1310 insertions(+), 1 deletion(-) create mode 100644 plugins/pynb/Makefile.am create mode 100644 plugins/pynb/core-ui-int.h create mode 100644 plugins/pynb/core-ui.c create mode 100644 plugins/pynb/core-ui.h create mode 100644 plugins/pynb/data/images/pynb-symbolic.svg create mode 100644 plugins/pynb/gresource.xml create mode 100644 plugins/pynb/panel-int.h create mode 100644 plugins/pynb/panel.c create mode 100644 plugins/pynb/panel.h create mode 100644 plugins/pynb/panel.ui create mode 100644 plugins/pynb/params-int.h create mode 100644 plugins/pynb/params.c create mode 100644 plugins/pynb/params.h create mode 100644 plugins/pynb/params.ui create mode 100644 plugins/pynb/prefs.ui diff --git a/configure.ac b/configure.ac index 63d1bb4..300c970 100644 --- a/configure.ac +++ b/configure.ac @@ -802,6 +802,7 @@ AC_CONFIG_FILES([Makefile plugins/pychrysalide/gui/panels/Makefile plugins/pychrysalide/mangling/Makefile plugins/pychrysalide/plugins/Makefile + plugins/pynb/Makefile plugins/python/Makefile plugins/python/abackup/Makefile plugins/python/apkfiles/Makefile diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 89a8e25..529f4fe 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -14,7 +14,8 @@ endif # androhelpers SUBDIRS = \ $(PYTHON3_SUBDIRS) \ - pe + pe \ + pynb # arm \ # bootimg \ diff --git a/plugins/pynb/Makefile.am b/plugins/pynb/Makefile.am new file mode 100644 index 0000000..a4a3423 --- /dev/null +++ b/plugins/pynb/Makefile.am @@ -0,0 +1,75 @@ + +BUILT_SOURCES = resources.h resources.c + + +lib_LTLIBRARIES = libpynbui.la + +libdir = $(pluginslibdir) + + +# if BUILD_PYTHON3_BINDINGS + +# PYTHON3_LIBADD = python/libpynbpython.la + +# if BUILD_DISCARD_LOCAL + +# PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \ +# -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so + +# else + +# PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \ +# -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so + +# endif + +# PYTHON3_SUBDIRS = python + +# endif + + +libpynbui_la_SOURCES = \ + core-ui-int.h \ + core-ui.h core-ui.c \ + panel-int.h \ + panel.h panel.c \ + params-int.h \ + params.h params.c \ + resources.h resources.c + +libpynbui_la_LIBADD = \ + $(PYTHON3_LIBADD) + +libpynbui_la_CFLAGS = $(LIBGTK4_CFLAGS) + +libpynbui_la_LDFLAGS = \ + $(LIBGTK4_LIBS) $(PYTHON3_LDFLAGS) + + +devdir = $(includedir)/chrysalide-$(subdir) + +dev_HEADERS = $(libpynbui_la_SOURCES:%c=) + + +RES_FILES = \ + panel.ui \ + params.ui \ + prefs.ui \ + data/images/pynb-symbolic.svg + + +resources.c: gresource.xml $(RES_FILES) + glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name plugins_pynb gresource.xml + +resources.h: gresource.xml + glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name plugins_pynb gresource.xml + + +CLEANFILES = resources.h resources.c + +EXTRA_DIST = gresource.xml $(RES_FILES) + + +AM_CPPFLAGS = -I$(top_srcdir)/src $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) + +SUBDIRS = $(PYTHON3_SUBDIRS) diff --git a/plugins/pynb/core-ui-int.h b/plugins/pynb/core-ui-int.h new file mode 100644 index 0000000..caf5713 --- /dev/null +++ b/plugins/pynb/core-ui-int.h @@ -0,0 +1,56 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * core-ui-int.h - prototypes internes pour le plugin présentant des notes avec code Python + * + * Copyright (C) 2025 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 Chrysalide. If not, see . + */ + + +#ifndef _PLUGINS_PYNB_CORE_UI_INT_H +#define _PLUGINS_PYNB_CORE_UI_INT_H + + +#include + + +#include "core-ui.h" + + + +/* Greffon natif pour la présentation de notes avec texte et code Python (instance) */ +struct _GPythonNotebookPluginUI +{ + GNativePlugin parent; /* A laisser en premier */ + +}; + + +/* Greffon natif pour la présentation de notes avec texte et code Python (classe) */ +struct _GPythonNotebookPluginUIClass +{ + GNativePluginClass parent; /* A laisser en premier */ + +}; + + +/* Met en place un module pour un module pour présentation. */ +bool g_python_notebook_plugin_ui_create(GPythonNotebookPluginUI *, GModule *); + + + +#endif /* _PLUGINS_PYNB_CORE_UI_INT_H */ diff --git a/plugins/pynb/core-ui.c b/plugins/pynb/core-ui.c new file mode 100644 index 0000000..1f89848 --- /dev/null +++ b/plugins/pynb/core-ui.c @@ -0,0 +1,292 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * core-ui.c - présentation de notes sous forme de texte et de code Python + * + * Copyright (C) 2025 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 Chrysalide. If not, see . + */ + + +#include "core-ui.h" + + +#include +#include +#include + + +#include "core-ui-int.h" +#include "panel.h" +#include "params.h" + + + +/* ---------------------- COMPOSITION DE NOUVEAU GREFFON NATIF ---------------------- */ + + +/* Initialise la classe des recherches et identifications. */ +static void g_python_notebook_plugin_ui_class_init(GPythonNotebookPluginUIClass *); + +/* Initialise une instance de recherches et identifications. */ +static void g_python_notebook_plugin_ui_init(GPythonNotebookPluginUI *); + +/* Supprime toutes les références externes. */ +static void g_python_notebook_plugin_ui_dispose(GObject *); + +/* Procède à la libération totale de la mémoire. */ +static void g_python_notebook_plugin_ui_finalize(GObject *); + + + +/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */ + + +/* Prend acte de l'activation du greffon. */ +static bool g_python_notebook_plugin_ui_enable(GPythonNotebookPluginUI *); + +/* Prend acte de la désactivation du greffon. */ +static bool g_python_notebook_plugin_ui_disable(GPythonNotebookPluginUI *); + + + +/* ---------------------------------------------------------------------------------- */ +/* COMPOSITION DE NOUVEAU GREFFON NATIF */ +/* ---------------------------------------------------------------------------------- */ + + +/* Indique le type défini pour un greffon de liaison Python */ +G_DEFINE_TYPE(GPythonNotebookPluginUI, g_python_notebook_plugin_ui, G_TYPE_NATIVE_PLUGIN); + + +NATIVE_PLUGIN_ENTRYPOINT(g_python_notebook_plugin_ui_new); + + +/****************************************************************************** +* * +* Paramètres : class = classe à initialiser. * +* * +* Description : Initialise la classe des recherches et identifications. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_python_notebook_plugin_ui_class_init(GPythonNotebookPluginUIClass *class) +{ + GObjectClass *object; /* Autre version de la classe */ + GPluginModuleClass *plugin; /* Version parente de la classe*/ + + object = G_OBJECT_CLASS(class); + + object->dispose = g_python_notebook_plugin_ui_dispose; + object->finalize = g_python_notebook_plugin_ui_finalize; + + plugin = G_PLUGIN_MODULE_CLASS(class); + + plugin->enable = (pg_management_fc)g_python_notebook_plugin_ui_enable; + plugin->disable = (pg_management_fc)g_python_notebook_plugin_ui_disable; + +} + + +/****************************************************************************** +* * +* Paramètres : plugin = instance à initialiser. * +* * +* Description : Initialise une instance de recherches et identifications. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_python_notebook_plugin_ui_init(GPythonNotebookPluginUI *plugin) +{ + STORE_PLUGIN_ABI(plugin); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_python_notebook_plugin_ui_dispose(GObject *object) +{ + G_OBJECT_CLASS(g_python_notebook_plugin_ui_parent_class)->dispose(object); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_python_notebook_plugin_ui_finalize(GObject *object) +{ + G_OBJECT_CLASS(g_python_notebook_plugin_ui_parent_class)->finalize(object); + +} + + +/****************************************************************************** +* * +* Paramètres : module = extension vue du système. * +* * +* Description : Crée un module pour présentation de notes. * +* * +* Retour : Adresse de la structure mise en place. * +* * +* Remarques : Le transfert de propriétée du module est total. * +* * +******************************************************************************/ + +GPluginModule *g_python_notebook_plugin_ui_new(GModule *module) +{ + GPythonNotebookPluginUI *result; /* Structure à retourner */ + + result = g_object_new(G_TYPE_PYTHON_NOTEBOOK_PLUGIN_UI, NULL); + + if (!g_python_notebook_plugin_ui_create(result, module)) + g_clear_object(&result); + + return G_PLUGIN_MODULE(result); + +} + + +/****************************************************************************** +* * +* Paramètres : plugin = instance à initialiser pleinement. * +* module = extension vue du système. * +* * +* Description : Met en place un module pour un module pour présentation. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : Le transfert de propriétée du module est total. * +* * +******************************************************************************/ + +bool g_python_notebook_plugin_ui_create(GPythonNotebookPluginUI *plugin, GModule *module) +{ + bool result; /* Bilan à retourner */ + +#ifdef INCLUDE_PYTHON3_BINDINGS +# define PG_REQ REQ_LIST("PyChrysalide") +#else +# define PG_REQ NO_REQ +#endif + + result = g_native_plugin_create(G_NATIVE_PLUGIN(plugin), + "PythonNotebook", + "Edit notebook with text and code to support binary analysis", + PACKAGE_VERSION, + CHRYSALIDE_WEBSITE("doc/plugins/pynb"), + PG_REQ, + module); + + return result; + +} + + + +/* ---------------------------------------------------------------------------------- */ +/* IMPLEMENTATION DES FONCTIONS DE CLASSE */ +/* ---------------------------------------------------------------------------------- */ + + +/****************************************************************************** +* * +* Paramètres : plugin = greffon à manipuler. * +* * +* Description : Prend acte de l'activation du greffon. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool g_python_notebook_plugin_ui_enable(GPythonNotebookPluginUI *plugin) +{ + bool result; /* Bilan à retourner */ + panel_info_t info; /* Infos d'enregistrement */ + + info.category = "Main"; + + info.image = "pynb-symbolic"; + info.title = _("Python notebook"); + info.desc = _("Edit notebook with text and code to support binary analysis"); + + info.personality = FPP_MAIN_PANEL; + + info.panel_type = GTK_TYPE_PYTHON_NOTEBOOK_PANEL; + info.params_type = GTK_TYPE_PYTHON_NOTEBOOK_PARAMETERS; + + result = register_framework_panel_definition(&info); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : plugin = greffon à manipuler. * +* * +* Description : Prend acte de la désactivation du greffon. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool g_python_notebook_plugin_ui_disable(GPythonNotebookPluginUI *plugin) +{ + bool result; /* Bilan à retourner */ + + + // TODO : unregister + + result = true; + + + return result; + +} diff --git a/plugins/pynb/core-ui.h b/plugins/pynb/core-ui.h new file mode 100644 index 0000000..8ab9dd9 --- /dev/null +++ b/plugins/pynb/core-ui.h @@ -0,0 +1,43 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * core-ui.h - prototypes pour la présentation de notes sous forme de texte et de code Python + * + * Copyright (C) 2025 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 Chrysalide. If not, see . + */ + + +#ifndef _PLUGINS_FIDO_CORE_UI_H +#define _PLUGINS_FIDO_CORE_UI_H + + +#include +#include + + + +#define G_TYPE_PYTHON_NOTEBOOK_PLUGIN_UI (g_python_notebook_plugin_ui_get_type()) + +DECLARE_GTYPE(GPythonNotebookPluginUI, g_python_notebook_plugin_ui, G, PYTHON_NOTEBOOK_PLUGIN_UI); + + +/* Crée un module pour présentation de notes. */ +GPluginModule *g_python_notebook_plugin_ui_new(GModule *); + + + +#endif /* _PLUGINS_FIDO_CORE_UI_H */ diff --git a/plugins/pynb/data/images/pynb-symbolic.svg b/plugins/pynb/data/images/pynb-symbolic.svg new file mode 100644 index 0000000..f8cae60 --- /dev/null +++ b/plugins/pynb/data/images/pynb-symbolic.svg @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/pynb/gresource.xml b/plugins/pynb/gresource.xml new file mode 100644 index 0000000..71eb8ed --- /dev/null +++ b/plugins/pynb/gresource.xml @@ -0,0 +1,11 @@ + + + + panel.ui + params.ui + prefs.ui + + + data/images/pynb-symbolic.svg + + diff --git a/plugins/pynb/panel-int.h b/plugins/pynb/panel-int.h new file mode 100644 index 0000000..23884c7 --- /dev/null +++ b/plugins/pynb/panel-int.h @@ -0,0 +1,56 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * panel-int.h - prototypes internes pour le panneau dédié à la présentation de notes + * + * Copyright (C) 2025 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef _PLUGINS_PYNB_PANEL_INT_H +#define _PLUGINS_PYNB_PANEL_INT_H + + +#include + + +#include "panel.h" + + + +/* Panneau de cartopgraphie des dispositions d'échantillons (instance) */ +struct _GtkPythonNotebookPanel +{ + GtkTiledPanel parent; /* A laisser en premier */ + +}; + +/* Panneau de cartopgraphie des dispositions d'échantillons (classe) */ +struct _GtkPythonNotebookPanelClass +{ + GtkTiledPanelClass parent; /* A laisser en premier */ + +}; + + +/* Met en place nouvelle instance de panneau de présentation. */ +bool gtk_python_notebook_panel_create(GtkPythonNotebookPanel *); + + + +#endif /* _PLUGINS_PYNB_PANEL_INT_H */ diff --git a/plugins/pynb/panel.c b/plugins/pynb/panel.c new file mode 100644 index 0000000..1b4b3e3 --- /dev/null +++ b/plugins/pynb/panel.c @@ -0,0 +1,210 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * panel.c - panneau dédié à la présentation de notes + * + * Copyright (C) 2025 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include "panel.h" + + +#include + + +#include "panel-int.h" + + + +/* ------------------------- COEUR D'UN PANNEAU D'AFFICHAGE ------------------------- */ + + +/* Initialise la classe des panneaux pour binaires. */ +static void gtk_python_notebook_panel_class_init(GtkPythonNotebookPanelClass *); + +/* Initialise une instance de panneau pour binaire. */ +static void gtk_python_notebook_panel_init(GtkPythonNotebookPanel *); + +/* Supprime toutes les références externes. */ +static void gtk_python_notebook_panel_dispose(GObject *); + +/* Procède à la libération totale de la mémoire. */ +static void gtk_python_notebook_panel_finalize(GObject *); + + + +/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */ + + +/* Fournit les composants adaptés pour la barre de titre. */ +//static GListStore *gtk_python_notebook_panel_get_title_widgets(GtkTiledPanel *, bool); + + + +/* ---------------------------------------------------------------------------------- */ +/* COEUR D'UN PANNEAU D'AFFICHAGE */ +/* ---------------------------------------------------------------------------------- */ + + +/* Indique le type défini pour un panneau d'accueil. */ +G_DEFINE_TYPE(GtkPythonNotebookPanel, gtk_python_notebook_panel, GTK_TYPE_TILED_PANEL); + + +/****************************************************************************** +* * +* Paramètres : class = classe à initialiser. * +* * +* Description : Initialise la classe des panneaux pour binaires. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_python_notebook_panel_class_init(GtkPythonNotebookPanelClass *class) +{ + GObjectClass *object; /* Autre version de la classe */ + GtkWidgetClass *widget; /* Classe de haut niveau */ + GtkTiledPanelClass *panel; /* Version parente de classe */ + + object = G_OBJECT_CLASS(class); + + object->dispose = gtk_python_notebook_panel_dispose; + object->finalize = gtk_python_notebook_panel_finalize; + + widget = GTK_WIDGET_CLASS(class); + + gtk_widget_class_set_template_from_resource(widget, "/re/chrysalide/framework/gui/panels/pynb-panel.ui"); + + //gtk_widget_class_bind_template_child(widget, GtkPythonNotebookPanel, summary); + + panel = GTK_TILED_PANEL_CLASS(class); + + //panel->get_widgets = (get_tiled_panel_widgets_cb)gtk_python_notebook_panel_get_title_widgets; + +} + + +/****************************************************************************** +* * +* Paramètres : panel = instance à initialiser. * +* * +* Description : Initialise une instance de panneau pour binaire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_python_notebook_panel_init(GtkPythonNotebookPanel *panel) +{ + gtk_widget_init_template(GTK_WIDGET(panel)); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_python_notebook_panel_dispose(GObject *object) +{ + gtk_widget_dispose_template(GTK_WIDGET(object), GTK_TYPE_PYTHON_NOTEBOOK_PANEL); + + G_OBJECT_CLASS(gtk_python_notebook_panel_parent_class)->dispose(object); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_python_notebook_panel_finalize(GObject *object) +{ + G_OBJECT_CLASS(gtk_python_notebook_panel_parent_class)->finalize(object); + +} + + +/****************************************************************************** +* * +* Paramètres : - * +* * +* Description : Crée une nouvelle instance de panneau de présentation. * +* * +* Retour : Composant GTK mis en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkTiledPanel *gtk_python_notebook_panel_new(void) +{ + GtkTiledPanel *result; /* Instance à retourner */ + + result = g_object_new(GTK_TYPE_PYTHON_NOTEBOOK_PANEL, NULL); + + if (!gtk_python_notebook_panel_create(GTK_PYTHON_NOTEBOOK_PANEL(result))) + g_clear_object(&result); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : panel = panneau de recherche et récupération à remplir. * +* * +* Description : Met en place nouvelle instance de panneau de présentation. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool gtk_python_notebook_panel_create(GtkPythonNotebookPanel *panel) +{ + bool result; /* Bilan à retourner */ + + result = true; + + return result; + +} diff --git a/plugins/pynb/panel.h b/plugins/pynb/panel.h new file mode 100644 index 0000000..f9f8016 --- /dev/null +++ b/plugins/pynb/panel.h @@ -0,0 +1,47 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * panel.h - prototypes pour le panneau dédié à la présentation de notes + * + * Copyright (C) 2025 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef _PLUGINS_PYNB_PANEL_H +#define _PLUGINS_PYNB_PANEL_H + + +#include + + +#include +#include + + + +#define GTK_TYPE_PYTHON_NOTEBOOK_PANEL (gtk_python_notebook_panel_get_type()) + +DECLARE_GTYPE(GtkPythonNotebookPanel, gtk_python_notebook_panel, GTK, PYTHON_NOTEBOOK_PANEL); + + +/* Crée une nouvelle instance de panneau de présentation. */ +GtkTiledPanel *gtk_python_notebook_panel_new(void); + + + +#endif /* _PLUGINS_PYNB_PANEL_H */ diff --git a/plugins/pynb/panel.ui b/plugins/pynb/panel.ui new file mode 100644 index 0000000..d16af80 --- /dev/null +++ b/plugins/pynb/panel.ui @@ -0,0 +1,21 @@ + + + + + + diff --git a/plugins/pynb/params-int.h b/plugins/pynb/params-int.h new file mode 100644 index 0000000..7f3bc8b --- /dev/null +++ b/plugins/pynb/params-int.h @@ -0,0 +1,50 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * params-int.h - définitions internes pour l'édition des paramètres initiaux d'une présentation de notes + * + * Copyright (C) 2025 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 Chrysalide. If not, see . + */ + + +#ifndef _PLUGINS_PYNB_PARAMS_INT_H +#define _PLUGINS_PYNB_PARAMS_INT_H + + +#include "params.h" + + + +/* Composant pour les paramètres de chargement d'un binaire (instance) */ +struct _GtkPythonNotebookParameters +{ + GtkGrid parent; /* A laisser en premier */ + + //GtkEntry *filename; /* CHemin d'un binaire */ + +}; + +/* Composant pour les paramètres de chargement d'un binaire (classe) */ +struct _GtkPythonNotebookParametersClass +{ + GtkGridClass parent; /* A laisser en premier */ + +}; + + + +#endif /* _PLUGINS_PYNB_PARAMS_INT_H */ diff --git a/plugins/pynb/params.c b/plugins/pynb/params.c new file mode 100644 index 0000000..3a6bf70 --- /dev/null +++ b/plugins/pynb/params.c @@ -0,0 +1,171 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * params.c - édition des paramètres initiaux d'une présentation de notes + * + * Copyright (C) 2025 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 Chrysalide. If not, see . + */ + + +#include "params.h" + + +#include "panel.h" +#include "params-int.h" +#include +#include + + + +/* Initialise la classe des composants d'édition de paramètres. */ +static void gtk_python_notebook_parameters_class_init(GtkPythonNotebookParametersClass *); + +/* Initialise une instance de composant d'édition de paramètres. */ +static void gtk_python_notebook_parameters_init(GtkPythonNotebookParameters *); + +/* Supprime toutes les références externes. */ +static void gtk_python_notebook_parameters_dispose(GObject *); + +/* Procède à la libération totale de la mémoire. */ +static void gtk_python_notebook_parameters_finalize(GObject *); + +/* Réagit à une demande de création de notes. */ +static void gtk_python_notebook_parameters_on_create_clicked(GtkButton *, GtkPythonNotebookParameters *); + + + +/* Détermine le type du composant d'édition des paramètres de chargement. */ +G_DEFINE_TYPE(GtkPythonNotebookParameters, gtk_python_notebook_parameters, GTK_TYPE_GRID); + + +/****************************************************************************** +* * +* Paramètres : class = classe GTK à initialiser. * +* * +* Description : Initialise la classe des composants d'édition de paramètres. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_python_notebook_parameters_class_init(GtkPythonNotebookParametersClass *class) +{ + GObjectClass *object; /* Plus haut niveau équivalent */ + GtkWidgetClass *widget; /* Classe de haut niveau */ + + object = G_OBJECT_CLASS(class); + + object->dispose = gtk_python_notebook_parameters_dispose; + object->finalize = gtk_python_notebook_parameters_finalize; + + widget = GTK_WIDGET_CLASS(class); + + gtk_widget_class_set_template_from_resource(widget, "/re/chrysalide/framework/gui/panels/pynb-params.ui"); + + gtk_widget_class_bind_template_callback_full(widget, BUILDER_CB(gtk_python_notebook_parameters_on_create_clicked)); + + //gtk_widget_class_bind_template_child(widget, GtkPythonNotebookParameters, filename); + +} + + +/****************************************************************************** +* * +* Paramètres : params = composant GTK à initialiser. * +* * +* Description : Initialise une instance de composant d'édition de paramètres.* +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_python_notebook_parameters_init(GtkPythonNotebookParameters *params) +{ + gtk_widget_init_template(GTK_WIDGET(params)); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_python_notebook_parameters_dispose(GObject *object) +{ + gtk_widget_dispose_template(GTK_WIDGET(object), GTK_TYPE_PYTHON_NOTEBOOK_PARAMETERS); + + G_OBJECT_CLASS(gtk_python_notebook_parameters_parent_class)->dispose(object); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_python_notebook_parameters_finalize(GObject *object) +{ + G_OBJECT_CLASS(gtk_python_notebook_parameters_parent_class)->finalize(object); + +} + + +/****************************************************************************** +* * +* Paramètres : button = bouton GTK concerné par l'appel. * +* params = paramètres du panneau à mettre en place. * +* * +* Description : Réagit à une demande de création de notes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_python_notebook_parameters_on_create_clicked(GtkButton *button, GtkPythonNotebookParameters *params) +{ + GtkRoot *root; /* Racine du composant */ + GtkTiledPanel *tiled; /* Panneau d'affichage complet */ + + root = gtk_widget_get_root(GTK_WIDGET(button)); + + tiled = gtk_python_notebook_panel_new(); + + gtk_framework_window_add(GTK_FRAMEWORK_WINDOW(root), tiled); + +} diff --git a/plugins/pynb/params.h b/plugins/pynb/params.h new file mode 100644 index 0000000..2d4b39b --- /dev/null +++ b/plugins/pynb/params.h @@ -0,0 +1,41 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * params.h - prototypes pour l'édition des paramètres initiaux d'une présentation de notes + * + * Copyright (C) 2025 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 Chrysalide. If not, see . + */ + + +#ifndef _PLUGINS_PYNB_PARAMS_H +#define _PLUGINS_PYNB_PARAMS_H + + +#include + + +#include + + + +#define GTK_TYPE_PYTHON_NOTEBOOK_PARAMETERS (gtk_python_notebook_parameters_get_type()) + +DECLARE_GTYPE(GtkPythonNotebookParameters, gtk_python_notebook_parameters, GTK, PYTHON_NOTEBOOK_PARAMETERS); + + + +#endif /* _PLUGINS_PYNB_PARAMS_H */ diff --git a/plugins/pynb/params.ui b/plugins/pynb/params.ui new file mode 100644 index 0000000..21a4788 --- /dev/null +++ b/plugins/pynb/params.ui @@ -0,0 +1,52 @@ + + + + + + diff --git a/plugins/pynb/prefs.ui b/plugins/pynb/prefs.ui new file mode 100644 index 0000000..a6e44be --- /dev/null +++ b/plugins/pynb/prefs.ui @@ -0,0 +1,38 @@ + + + + + -- cgit v0.11.2-87-g4458