diff options
Diffstat (limited to 'src/gui/panels')
| -rw-r--r-- | src/gui/panels/bookmarks.c | 51 | ||||
| -rw-r--r-- | src/gui/panels/bookmarks.h | 5 | ||||
| -rw-r--r-- | src/gui/panels/glance.c | 45 | ||||
| -rw-r--r-- | src/gui/panels/glance.h | 5 | ||||
| -rw-r--r-- | src/gui/panels/history.c | 51 | ||||
| -rw-r--r-- | src/gui/panels/history.h | 5 | ||||
| -rw-r--r-- | src/gui/panels/log.c | 54 | ||||
| -rw-r--r-- | src/gui/panels/log.h | 5 | ||||
| -rw-r--r-- | src/gui/panels/panel-int.h | 57 | ||||
| -rw-r--r-- | src/gui/panels/panel.c | 1030 | ||||
| -rw-r--r-- | src/gui/panels/panel.h | 40 | ||||
| -rw-r--r-- | src/gui/panels/regedit.c | 51 | ||||
| -rw-r--r-- | src/gui/panels/regedit.h | 5 | ||||
| -rw-r--r-- | src/gui/panels/strings.c | 51 | ||||
| -rw-r--r-- | src/gui/panels/strings.h | 5 | ||||
| -rw-r--r-- | src/gui/panels/symbols.c | 51 | ||||
| -rw-r--r-- | src/gui/panels/symbols.h | 5 | 
17 files changed, 176 insertions, 1340 deletions
| diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c index 9eaa1df..87789b6 100644 --- a/src/gui/panels/bookmarks.c +++ b/src/gui/panels/bookmarks.c @@ -245,8 +245,20 @@ static void g_bookmarks_panel_init(GBookmarksPanel *panel)      GtkTreeSortable *sortable;              /* Autre vision de la liste    */      GtkTreeSelection *select;               /* Sélection dans la liste     */ +    /* Eléments de base */ +      base = G_EDITOR_ITEM(panel); +    base->name = PANEL_BOOKMARKS_ID; + +    pitem = G_PANEL_ITEM(panel); + +    pitem->personality = PIP_SINGLETON; +    pitem->lname = _("Bookmarks"); +    pitem->path = "SE"; + +    /* Représentation graphique */ +      base->widget = gtk_scrolled_window_new(NULL, NULL);      gtk_widget_show(base->widget); @@ -256,10 +268,6 @@ static void g_bookmarks_panel_init(GBookmarksPanel *panel)      ref = G_OBJECT(base->widget);      g_object_set_data(ref, "panel", panel); -    pitem = G_PANEL_ITEM(panel); - -    pitem->personality = PIP_SINGLETON; -      /* Partie signets */      store = gtk_tree_store_new(BMC_COUNT, G_TYPE_OBJECT, @@ -409,7 +417,7 @@ static void g_bookmarks_panel_finalize(GBookmarksPanel *panel)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * +*  Paramètres  : -                                                            *  *                                                                             *  *  Description : Crée un panneau d'affichage des paramètres de configuration. *  *                                                                             * @@ -419,15 +427,12 @@ static void g_bookmarks_panel_finalize(GBookmarksPanel *panel)  *                                                                             *  ******************************************************************************/ -GEditorItem *g_bookmarks_panel_new(GObject *ref) +GPanelItem *g_bookmarks_panel_new(void)  { -    GEditorItem *result;                    /* Structure à retourner       */ +    GPanelItem *result;                     /* Structure à retourner       */      result = g_object_new(G_TYPE_BOOKMARKS_PANEL, NULL); -    g_panel_item_init_ext(G_PANEL_ITEM(result), ref, PANEL_BOOKMARKS_ID, -                          _("Bookmarks"), G_EDITOR_ITEM(result)->widget, "SE"); -      //reload_config_into_treeview(G_BOOKMARKS_PANEL(result), get_main_configuration()); @@ -441,32 +446,6 @@ GEditorItem *g_bookmarks_panel_new(GObject *ref)  } -/****************************************************************************** -*                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * -*                                                                             * -*  Description : Construit le panneau d'affichage des signets courants.       * -*                                                                             * -*  Retour      : Adresse du panneau mis en place.                             * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -GPanelItem *create_bookmarks_panel(GObject *ref) -{ -    GEditorItem *result;                    /* Elément réactif à renvoyer  */ - -    result = g_bookmarks_panel_new(ref); - -    /* Enregistre correctement le tout */ -    register_editor_item(result); - -    return G_PANEL_ITEM(result); - -} - -  /* ---------------------------------------------------------------------------------- */  /*                           AFFICHAGE A L'AIDE D'UNE LISTE                           */ diff --git a/src/gui/panels/bookmarks.h b/src/gui/panels/bookmarks.h index 507cc09..7b65730 100644 --- a/src/gui/panels/bookmarks.h +++ b/src/gui/panels/bookmarks.h @@ -55,10 +55,7 @@ typedef struct _GBookmarksPanelClass GBookmarksPanelClass;  GType g_bookmarks_panel_get_type(void);  /* Crée un panneau d'affichage des paramètres de configuration. */ -GEditorItem *g_bookmarks_panel_new(GObject *); - -/* Construit le panneau d'affichage des signets courants. */ -GPanelItem *create_bookmarks_panel(GObject *); +GPanelItem *g_bookmarks_panel_new(void); diff --git a/src/gui/panels/glance.c b/src/gui/panels/glance.c index 6373edd..1dab8b4 100644 --- a/src/gui/panels/glance.c +++ b/src/gui/panels/glance.c @@ -176,18 +176,22 @@ static void g_glance_panel_init(GGlancePanel *panel)      GPanelItem *pitem;                      /* Version parente du panneau  */      GtkWidget *area;                        /* Surface de dessin réelle    */ -    base = G_EDITOR_ITEM(panel); +    /* Eléments de base */ -    base->name = _("Glance"); +    base = G_EDITOR_ITEM(panel); -    base->widget = gtk_event_box_new(); +    base->name = PANEL_GLANCE_ID;      pitem = G_PANEL_ITEM(panel);      pitem->personality = PIP_SINGLETON; +    pitem->lname = _("Glance"); +    pitem->path = "es";      /* Support de dessin */ +    base->widget = gtk_event_box_new(); +      area = gtk_drawing_area_new();      gtk_widget_show(area); @@ -252,7 +256,7 @@ static void g_glance_panel_finalize(GGlancePanel *panel)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * +*  Paramètres  : -                                                            *  *                                                                             *  *  Description : Crée un panneau d'aperçu rapide.                             *  *                                                                             * @@ -262,15 +266,12 @@ static void g_glance_panel_finalize(GGlancePanel *panel)  *                                                                             *  ******************************************************************************/ -GEditorItem *g_glance_panel_new(GObject *ref) +GPanelItem *g_glance_panel_new(void)  { -    GEditorItem *result;                    /* Structure à retourner       */ +    GPanelItem *result;                     /* Structure à retourner       */      result = g_object_new(G_TYPE_GLANCE_PANEL, NULL); -    g_panel_item_init_ext(G_PANEL_ITEM(result), ref, PANEL_GLANCE_ID, -                          _("Glance"), G_EDITOR_ITEM(result)->widget, "es"); -      return result;  } @@ -278,32 +279,6 @@ GEditorItem *g_glance_panel_new(GObject *ref)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * -*                                                                             * -*  Description : Construit et intègre un panneau d'affichage des symboles.    * -*                                                                             * -*  Retour      : Adresse du panneau mis en place.                             * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -GPanelItem *create_glance_panel(GObject *ref) -{ -    GEditorItem *result;                    /* Elément réactif à renvoyer  */ - -    result = g_glance_panel_new(ref); - -    /* Enregistre correctement le tout */ -    register_editor_item(result); - -    return G_PANEL_ITEM(result); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : panel = panneau à actualiser.                                *  *                view  = nouveau panneau d'affichage actif.                   *  *                                                                             * diff --git a/src/gui/panels/glance.h b/src/gui/panels/glance.h index 9a98bdb..b61b485 100644 --- a/src/gui/panels/glance.h +++ b/src/gui/panels/glance.h @@ -57,10 +57,7 @@ typedef struct _GGlancePanelClass GGlancePanelClass;  GType g_glance_panel_get_type(void);  /* Crée un panneau d'aperçu rapide. */ -GEditorItem *g_glance_panel_new(GObject *); - -/* Construit et intègre un panneau d'aperçu rapide. */ -GPanelItem *create_glance_panel(GObject *); +GPanelItem *g_glance_panel_new(void); diff --git a/src/gui/panels/history.c b/src/gui/panels/history.c index 4d4be0c..526a775 100644 --- a/src/gui/panels/history.c +++ b/src/gui/panels/history.c @@ -166,18 +166,26 @@ static void g_history_panel_init(GHistoryPanel *panel)      GtkWidget *button;                      /* Bouton de cette même barre  */      GtkTreeSelection *select;               /* Sélection dans la liste     */ +    /* Eléments de base */ +      base = G_EDITOR_ITEM(panel); +    base->name = PANEL_HISTORY_ID; + +    pitem = G_PANEL_ITEM(panel); + +    pitem->personality = PIP_SINGLETON; +    pitem->lname = _("Change history"); +    pitem->path = "eN"; + +    /* Représentation graphique */ +      base->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);      gtk_container_set_border_width(GTK_CONTAINER(base->widget), 8);      gtk_widget_show(base->widget);      ref = G_OBJECT(panel); -    pitem = G_PANEL_ITEM(panel); - -    pitem->personality = PIP_SINGLETON; -      /* Liste des éléments d'évolution */      scrollwnd = gtk_scrolled_window_new(NULL, NULL); @@ -293,7 +301,7 @@ static void g_history_panel_finalize(GHistoryPanel *panel)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * +*  Paramètres  : -                                                            *  *                                                                             *  *  Description : Crée un panneau d'affichage des symboles.                    *  *                                                                             * @@ -303,15 +311,12 @@ static void g_history_panel_finalize(GHistoryPanel *panel)  *                                                                             *  ******************************************************************************/ -GEditorItem *g_history_panel_new(GObject *ref) +GPanelItem *g_history_panel_new(void)  { -    GEditorItem *result;                    /* Structure à retourner       */ +    GPanelItem *result;                     /* Structure à retourner       */      result = g_object_new(G_TYPE_HISTORY_PANEL, NULL); -    g_panel_item_init_ext(G_PANEL_ITEM(result), ref, PANEL_HISTORY_ID, -                          _("Change history"), G_EDITOR_ITEM(result)->widget, "eN"); -      return result;  } @@ -319,32 +324,6 @@ GEditorItem *g_history_panel_new(GObject *ref)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * -*                                                                             * -*  Description : Construit et intègre un panneau d'affichage des symboles.    * -*                                                                             * -*  Retour      : Adresse du panneau mis en place.                             * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -GPanelItem *create_history_panel(GObject *ref) -{ -    GEditorItem *result;                    /* Elément réactif à renvoyer  */ - -    result = g_history_panel_new(ref); - -    /* Enregistre correctement le tout */ -    register_editor_item(result); - -    return G_PANEL_ITEM(result); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : panel  = panneau à mettre à jour.                            *  *                binary = nouvelle instance de binaire analysé.               *  *                                                                             * diff --git a/src/gui/panels/history.h b/src/gui/panels/history.h index 5b5b83b..f4c112e 100644 --- a/src/gui/panels/history.h +++ b/src/gui/panels/history.h @@ -55,10 +55,7 @@ typedef struct _GHistoryPanelClass GHistoryPanelClass;  GType g_history_panel_get_type(void);  /* Crée un panneau d'affichage des symboles. */ -GEditorItem *g_history_panel_new(GObject *); - -/* Construit et intègre un panneau d'affichage des symboles. */ -GPanelItem *create_history_panel(GObject *); +GPanelItem *g_history_panel_new(void); diff --git a/src/gui/panels/log.c b/src/gui/panels/log.c index 7893666..1b8c6bc 100644 --- a/src/gui/panels/log.c +++ b/src/gui/panels/log.c @@ -33,6 +33,7 @@  #include "panel-int.h" +#include "../core/panels.h" @@ -157,16 +158,24 @@ static void g_log_panel_init(GLogPanel *panel)      GtkCellRenderer *renderer;              /* Moteur de rendu de colonne  */      GtkTreeViewColumn *column;              /* Colonne de la liste         */ -    base = G_EDITOR_ITEM(panel); +    /* Eléments de base */ -    scrolled = gtk_scrolled_window_new(NULL, NULL); -    gtk_widget_show(scrolled); +    base = G_EDITOR_ITEM(panel); -    base->widget = scrolled; +    base->name = PANEL_LOG_ID;      pitem = G_PANEL_ITEM(panel);      pitem->personality = PIP_SINGLETON; +    pitem->lname = _("Misc information"); +    pitem->path = "S"; + +    /* Représentation graphique */ + +    scrolled = gtk_scrolled_window_new(NULL, NULL); +    gtk_widget_show(scrolled); + +    base->widget = scrolled;      /* Construction graphique */ @@ -244,7 +253,7 @@ static void g_log_panel_finalize(GLogPanel *panel)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * +*  Paramètres  : -                                                            *  *                                                                             *  *  Description : Crée un panneau d'affichage des messages système.            *  *                                                                             * @@ -254,15 +263,12 @@ static void g_log_panel_finalize(GLogPanel *panel)  *                                                                             *  ******************************************************************************/ -GEditorItem *g_log_panel_new(GObject *ref) +GPanelItem *g_log_panel_new(void)  { -    GEditorItem *result;                    /* Structure à retourner       */ +    GPanelItem *result;                     /* Structure à retourner       */      result = g_object_new(G_TYPE_LOG_PANEL, NULL); -    g_panel_item_init_ext(G_PANEL_ITEM(result), ref, PANEL_LOG_ID, -                          _("Misc information"), G_EDITOR_ITEM(result)->widget, "S"); -      return result;  } @@ -270,32 +276,6 @@ GEditorItem *g_log_panel_new(GObject *ref)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * -*                                                                             * -*  Description : Construit le panneau d'affichage des messages système.       * -*                                                                             * -*  Retour      : Adresse du panneau mis en place.                             * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -GPanelItem *create_log_panel(GObject *ref) -{ -    GEditorItem *result;                    /* Elément réactif à renvoyer  */ - -    result = g_log_panel_new(ref); - -    /* Enregistre correctement le tout */ -    register_editor_item(result); - -    return G_PANEL_ITEM(result); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : type = espèce du message à ajouter.                          *  *                msg  = message à faire apparaître à l'écran.                 *  *                                                                             * @@ -332,7 +312,7 @@ static void _log_simple_message(LogMessageType type, char *msg)      GPanelItem *item;                       /* Intermédiaire mis en place  */      log_data *data;                         /* Paramètres à joindre        */ -    item = g_panel_item_get(PANEL_LOG_ID); +    item = get_panel_item_by_name(PANEL_LOG_ID);      data = (log_data *)calloc(1, sizeof(log_data)); diff --git a/src/gui/panels/log.h b/src/gui/panels/log.h index ebd3579..3957b56 100644 --- a/src/gui/panels/log.h +++ b/src/gui/panels/log.h @@ -73,10 +73,7 @@ typedef enum _LogMessageType  GType g_log_panel_get_type(void);  /* Crée un panneau d'affichage des messages système. */ -GEditorItem *g_log_panel_new(GObject *); - -/* Construit le panneau d'affichage des messages système. */ -GPanelItem *create_log_panel(GObject *); +GPanelItem *g_log_panel_new(void);  /* Affiche un message dans le journal des messages système. */  void log_simple_message(LogMessageType, const char *); diff --git a/src/gui/panels/panel-int.h b/src/gui/panels/panel-int.h index e902722..5e906f0 100644 --- a/src/gui/panels/panel-int.h +++ b/src/gui/panels/panel-int.h @@ -54,52 +54,6 @@ struct _GPanelItem  }; - -/* Elément de la hiérarchie des panneaux */ -typedef struct _panel_node -{ -    struct _panel_node *parent;             /* Noeud parent                */ - -    union -    { -        GtkWidget *widget;                  /* Accès généraliste           */ -        GtkWidget *station;                 /* Station d'accueil simple    */ -        GtkWidget *paned;                   /* Station d'accueil composée  */ - -    }; - -    union -    { -        /* Version simple */ -        struct -        { -            char *path;                     /* Chemin du nom courant       */ -        }; - -        /* Version composée */ -        struct -        { -            struct _panel_node *first;      /* Premier sous élément        */ -            struct _panel_node *second;     /* Second sous élément         */ -        }; - -    }; - -} panel_node; - - - -#define IS_SIMPLE_NODE(nd)                              \ -    ({                                                  \ -        bool __result;                                  \ -        __result = GTK_IS_DOCK_STATION(nd->station);    \ -        assert(__result || GTK_IS_PANED(nd->paned));    \ -        __result;                                       \ -    }) - - - -  /* Elément réactif pour panneaux de l'éditeur (classe) */  struct _GPanelItemClass  { @@ -108,7 +62,12 @@ struct _GPanelItemClass      bool unique;                            /* Panneau instanciable ?      */      const char *bindings;                   /* Raccourci clavier éventuel  */ -    GtkBin *first;                          /* Elément racine              */ +    //GtkBin *first;                          /* Elément racine              */ + +    /* Signaux */ + +    void (* dock_request) (GPanelItem); +    void (* undock_request) (GPanelItem);  }; @@ -117,9 +76,5 @@ struct _GPanelItemClass  #define panels_list_for_each(pos, head) dl_list_for_each(pos, head, GPanelItem, link)  -/* Initialise dynamique les propriétés de l'instance. */ -void g_panel_item_init_ext(GPanelItem *, GObject *, const char *, const char *, GtkWidget *, const char *); - -  #endif  /* _GUI_PANELS_PANEL_INT_H */ diff --git a/src/gui/panels/panel.c b/src/gui/panels/panel.c index 8af8672..00a4eea 100644 --- a/src/gui/panels/panel.c +++ b/src/gui/panels/panel.c @@ -1,6 +1,6 @@  /* Chrysalide - Outil d'analyse de fichiers binaires - * panel.c - prototypes pour la gestion des éléments réactifs spécifiques aux panneaux + * panel.c - gestion des éléments réactifs spécifiques aux panneaux   *   * Copyright (C) 2012-2014 Cyrille Bagard   * @@ -26,38 +26,13 @@  #include <assert.h> -#include <ctype.h> -#include <string.h> -#include <sys/param.h> -#include "bookmarks.h" -#include "glance.h" -#include "history.h" -#include "log.h"  #include "panel-int.h" -#include "regedit.h" -#include "strings.h" -#include "symbols.h" -#include "../../common/extstr.h" -#include "../../gtkext/easygtk.h"  #include "../../gtkext/gtkdockable-int.h" -#include "../../gtkext/gtkdockstation.h" -/* Support de fond pour les composants. */ -static GtkWidget *_support; -static panel_node *_nodes = NULL; - -/* Procédure à appeler lors des changements de panneaux. */ -static GCallback _handler; -static gpointer _data; - -/* Liste des panneaux en place. */ -static GPanelItem *_panels_list = NULL; - -  /* Initialise la classe des éléments réactifs de l'éditeur. */  static void g_panel_item_class_init(GPanelItemClass *); @@ -78,51 +53,6 @@ static GtkWidget *gtk_panel_item_get_widget(GPanelItem *); -/* ---------------------- MECANISMES DE PLACEMENT DES PANNEAUX ---------------------- */ - - -/* Crée un nouveau noeud pour un panneau particulier. */ -//static panel_node *create_simple_panel_node_for_item(GPanelItem *, const char *, size_t); - -/* Prépare une nouvelle sous-division pour deux panneaux. */ -static void switch_panel_node_into_paned(panel_node *, bool, bool); - -/* Met en place un nouveau noeud dans une division. */ -static void attach_panel_node_to_paned(panel_node *, panel_node *, bool); - - - - -/* Crée un nouveau noeud pour un panneau particulier. */ -static panel_node *create_simple_panel_node_for_item(GPanelItem *, const char *); - - - - -/* Obtient la désignation d'un élément hiérarchie des noeuds. */ -static char *get_panel_node_path(const panel_node *); - -/* Détermine la plus grande longueur commune entre éléments. */ -static size_t compute_path_common_length(const panel_node *, const char *); - -/* Détermine la plus grande profondeur d'un noeud de panneaux. */ -static unsigned int compute_deepest_depth(const panel_node *); - -/* Place au bon endroit un panneau donné. */ -static void insert_item_as_panel_node(GPanelItem *, panel_node *, const char *, size_t); - -/* Tente de mettre la main sur une station d'accueil. */ -static panel_node *find_node_for_station(panel_node *, GtkWidget *); - -/* Efface de l'organisation un noeud donné en place. */ -static void delete_panel_node(panel_node *); - - - - - - -  /* Indique le type défini pour un élément destiné à un panneau. */  G_DEFINE_TYPE_WITH_CODE(GPanelItem, g_panel_item, G_TYPE_EDITOR_ITEM,                          G_IMPLEMENT_INTERFACE(GTK_TYPE_DOCKABLE, g_panel_item_dockable_interface_init)) @@ -142,6 +72,21 @@ G_DEFINE_TYPE_WITH_CODE(GPanelItem, g_panel_item, G_TYPE_EDITOR_ITEM,  static void g_panel_item_class_init(GPanelItemClass *klass)  { +    g_signal_new("dock-request", +                 G_TYPE_PANEL_ITEM, +                 G_SIGNAL_RUN_LAST, +                 G_STRUCT_OFFSET(GPanelItemClass, dock_request), +                 NULL, NULL, +                 g_cclosure_marshal_VOID__VOID, +                 G_TYPE_NONE, 0); + +    g_signal_new("undock-request", +                 G_TYPE_PANEL_ITEM, +                 G_SIGNAL_RUN_LAST, +                 G_STRUCT_OFFSET(GPanelItemClass, undock_request), +                 NULL, NULL, +                 g_cclosure_marshal_VOID__VOID, +                 G_TYPE_NONE, 0);  } @@ -194,50 +139,7 @@ static void g_panel_item_dockable_interface_init(GtkDockableInterface *iface)  /******************************************************************************  *                                                                             * -*  Paramètres  : item   = composant à présenter à l'affichage.                * -*                ref    = espace de référencement global.                     * -*                name   = nom associé à l'élément.                            * -*                lname  = description longue du panneau.                      * -*                widget = composant à présenter à l'affichage.                * -*                path   = chemin vers la place idéale pour le futur panneau.  * -*                                                                             * -*  Description : Initialise dynamique les propriétés de l'instance.           * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -void g_panel_item_init_ext(GPanelItem *item, GObject *ref, const char *name, const char *lname, GtkWidget *widget, const char *path) -{ -    GEditorItem *parent;                    /* Autre version de l'élément  */ - -    parent = G_EDITOR_ITEM(item); - -    g_object_ref(ref); -    parent->ref = ref; - -    parent->name = name; -    item->lname = lname; - -    g_object_ref(widget); -    parent->widget = widget; -    g_object_set_data(G_OBJECT(widget), "pitem", item); - -    item->path = path; - -    panels_list_add_tail(item, &_panels_list); - -    gtk_dockable_setup_dnd(GTK_DOCKABLE(item)); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : personality = nature du panneau à mettre en place.           * -*                ref    = espace de référencement global.                     *  *                name   = nom associé à l'élément.                            *  *                lname  = description longue du panneau.                      *  *                widget = composant à présenter à l'affichage.                * @@ -251,18 +153,26 @@ void g_panel_item_init_ext(GPanelItem *item, GObject *ref, const char *name, con  *                                                                             *  ******************************************************************************/ -GEditorItem *g_panel_item_new(PanelItemPersonality personality, GObject *ref, const char *name, const char *lname, GtkWidget *widget, const char *path) +GPanelItem *g_panel_item_new(PanelItemPersonality personality, const char *name, const char *lname, GtkWidget *widget, const char *path)  {      GPanelItem *result;                     /* Structure à retourner       */ +    GEditorItem *parent;                    /* Autre version de l'élément  */      result = g_object_new(G_TYPE_PANEL_ITEM, NULL); +    parent = G_EDITOR_ITEM(result); + +    parent->name = name; +    parent->widget = widget; +      assert(personality > PIP_INVALID && personality < PIP_COUNT);      result->personality = personality; -    g_panel_item_init_ext(result, ref, name, lname, widget, path); +    result->lname = lname; + +    result->path = path; -    return G_EDITOR_ITEM(result); +    return result;  } @@ -345,48 +255,38 @@ PanelItemPersonality gtk_panel_item_get_personality(const GPanelItem *item)  /******************************************************************************  *                                                                             * -*  Paramètres  : item = instance GTK dont l'interface est à consulter.        * +*  Paramètres  : item = instance GTK à consulter.                             *  *                                                                             * -*  Description : Indique la définition d'un éventuel raccourci clavier.       * +*  Description : Fournit le chemin d'accès à utiliser pour les encapsulations.*  *                                                                             * -*  Retour      : Description d'un raccourci ou NULL si aucun de défini.       * +*  Retour      : Chemin d'accès défini.                                       *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -const char *gtk_panel_item_get_key_bindings(const GPanelItem *item) +const char *gtk_panel_item_get_path(const GPanelItem *item)  { -    return G_PANEL_ITEM_GET_CLASS(item)->bindings; +    return item->path;  }  /******************************************************************************  *                                                                             * -*  Paramètres  : name = désignation courte servant de clef.                   * +*  Paramètres  : item = instance GTK dont l'interface est à consulter.        *  *                                                                             * -*  Description : Recherche un panneau à partir de son nom court.              * +*  Description : Indique la définition d'un éventuel raccourci clavier.       *  *                                                                             * -*  Retour      : Panneau trouvé ou NULL si aucun.                             * +*  Retour      : Description d'un raccourci ou NULL si aucun de défini.       *  *                                                                             * -*  Remarques   : Le parcours peut se faire aussi depuis la classe parente,    * -*                mais il est plus rapide par ici.                             * +*  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -GPanelItem *g_panel_item_get(const char *name) +const char *gtk_panel_item_get_key_bindings(const GPanelItem *item)  { -    GPanelItem *iter;                       /* Boucle de parcours          */ - -    panels_list_for_each(iter, _panels_list) -    { -        if (strcmp(G_EDITOR_ITEM(iter)->name, name) == 0) -            return iter; - -    } - -    return NULL; +    return G_PANEL_ITEM_GET_CLASS(item)->bindings;  } @@ -403,103 +303,21 @@ GPanelItem *g_panel_item_get(const char *name)  *                                                                             *  ******************************************************************************/ -static void dump_tree(GtkWidget *root, unsigned int level) -{ -    unsigned int i; -    GList *list; -    GList *iter; - -    if (strcmp(G_OBJECT_TYPE_NAME(G_OBJECT(root)), "GtkButton") == 0) -        return; - -    for (i = 0; i < level; i++) -        fprintf(stderr, "  "); - -    fprintf(stderr, "%s (%p)\n", G_OBJECT_TYPE_NAME(G_OBJECT(root)), root); - -    if (GTK_IS_CONTAINER(root)) -    { -        list = gtk_container_get_children(GTK_CONTAINER(root)); - -        for (iter = list; iter != NULL; iter = g_list_next(iter)) -            dump_tree(GTK_WIDGET(iter->data), level + 1); - -    } - -} - - -void dump_node(panel_node *node, unsigned int level) -{ -    unsigned i; - -    for (i = 0; i < level; i++) -        fprintf(stderr, "  "); - -    fprintf(stderr, "%p %p -- widget %p -- '%s'\n", node->parent, node, node->station, -            IS_SIMPLE_NODE(node) ? node->path : "-"); - -    if (!IS_SIMPLE_NODE(node)) -    { -        dump_node(node->first, level + 1); -        dump_node(node->second, level + 1); -    } - - -} - - -  void g_panel_item_dock(GPanelItem *item)  {      assert(!item->docked); -    fprintf(stderr, "\n---------\n\n"); - -    /* Tout est à faire... */ -    if (_nodes == NULL) -    { -        _nodes = create_simple_panel_node_for_item(item, item->path); -        gtk_container_add(GTK_CONTAINER(_support), _nodes->widget); -    } -    else insert_item_as_panel_node(item, _nodes, item->path, 0); - -    item->docked = true; - - - -    dump_tree(_support, 0); -    fprintf(stderr, "\n"); -    dump_node(_nodes, 0); - +    g_signal_emit_by_name(item, "dock-request");  }  /******************************************************************************  *                                                                             * -*  Paramètres  : item = composant d'affichage à consulter.                    * +*  Paramètres  : item = composant d'affichage à mettre à jour.                * +*                status = nouvel état d'encapsulation.                        *  *                                                                             * -*  Description : Indique si le composant repose sur un support de l'éditeur.  * -*                                                                             * -*  Retour      : true si le composant est bien incrusté quelque part.         * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -bool g_panel_item_is_docked(const GPanelItem *item) -{ -    return item->docked; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : item = composant à retirer de l'affichage.                   * -*                                                                             * -*  Description : Supprime un panneau de l'ensemble affiché.                   * +*  Description : Définit si le composant repose sur un support de l'éditeur.  *  *                                                                             *  *  Retour      : -                                                            *  *                                                                             * @@ -507,742 +325,37 @@ bool g_panel_item_is_docked(const GPanelItem *item)  *                                                                             *  ******************************************************************************/ -void g_panel_item_undock(GPanelItem *item) +void g_panel_item_set_dock_status(GPanelItem *item, bool status)  { -    GtkWidget *station;                     /* Support courant             */ -    panel_node *node;                       /* Noeud à supprimer           */ - -    assert(item->docked); - -    gtk_dockable_decompose(GTK_DOCKABLE(item), &station); - -    gtk_dock_station_remove_dockable(GTK_DOCK_STATION(station), GTK_DOCKABLE(item)); - -    if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(station)) == 0) -    { -        node = find_node_for_station(_nodes, station); -        assert(node != NULL); - -        delete_panel_node(node); - -    } - -    item->docked = false; - -} - - - -/* ---------------------------------------------------------------------------------- */ -/*                         PLACEMENTS DES DIFFERENTS PANNEAUX                         */ -/* ---------------------------------------------------------------------------------- */ - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : handler = procédure à réveiller en cas de changements.       * -*                data    = donnée à faire suivre.                             * -*                                                                             * -*  Description : Prépare le terrain pour l'affichage central.                 * -*                                                                             * -*  Retour      : Composant de support sur lequel tout va se placer.           * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -GtkWidget *init_panels2(GCallback handler, gpointer data) -{ -    GtkWidget *result;                      /* Support à retourner         */ - -    result = gtk_event_box_new(); -    gtk_widget_show(result); - -    //g_signal_connect(result, "size-allocate", G_CALLBACK(auto_resize_panels), NULL); - -    _support = result; -    _handler = handler; -    _data = data; - -    return result; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * -*                                                                             * -*  Description : Charge les principaux panneaux de l'éditeur.                 * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -void load_main_panels(GObject *ref) -{ -    GPanelItem *item;                       /* Panneau de base à charger   */ - -    item = create_log_panel(ref); -    g_panel_item_dock(item); - -    item = create_regedit_panel(ref); -    g_panel_item_dock(item); - -    item = create_symbols_panel(ref); -    g_panel_item_dock(item); - -    item = create_history_panel(ref); -    g_panel_item_dock(item); - -    item = create_strings_panel(ref); -    g_panel_item_dock(item); - -    item = create_glance_panel(ref); -    g_panel_item_dock(item); - -    item = create_bookmarks_panel(ref); -    g_panel_item_dock(item); - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : handle = routine à appeler pour chaque panneau.              * -*                data   = données fournies pour accompagner cet appel.        * -*                                                                             * -*  Description : Effectue le parcours de tous les panneaux chargés.           * -*                                                                             * -*  Retour      : true si le parcours a été total, false sinon.                * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -bool browse_all_item_panels(handle_panel_item_fc handle, void *data) -{ -    bool result;                            /* Résultat à renvoyer         */ -    GPanelItem *iter;                       /* Boucle de parcours          */ - -    result = true; - -    panels_list_for_each(iter, _panels_list) -    { -        result = handle(iter, data); - -        if (!result) break; - -    } - -    return result; - -} - - - -/* ---------------------------------------------------------------------------------- */ -/*                        MECANISMES DE PLACEMENT DES PANNEAUX                        */ -/* ---------------------------------------------------------------------------------- */ - - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : node  = noeud à diviser.                                     * -*                horiz = indique le type d'orientation désiré.                * -*                first = indication sur l'emplacement à utiliser.             * -*                                                                             * -*  Description : Prépare une nouvelle sous-division pour deux panneaux.       * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void switch_panel_node_into_paned(panel_node *node, bool horiz, bool first) -{ -    GtkWidget *widget;                      /* Composant à traiter         */ -    panel_node *parent;                     /* Lien de parenté à conserver */ -    panel_node *moved;                      /* Noeud descendu d'un étage   */ - -    /* Décroche graphiquement le support */ - -    widget = node->widget; - -    g_object_ref(G_OBJECT(widget)); -    gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(widget)), widget); - -    /* Descend l'élément actuel */ - -    parent = node->parent; - -    moved = (panel_node *)calloc(1, sizeof(panel_node)); - -    memcpy(moved, node, sizeof(panel_node)); - -    if (!IS_SIMPLE_NODE(moved)) -    { -        moved->first->parent = moved; -        moved->second->parent = moved; -    } - -    /* Création du nouveau niveau intermédiaire */ - -    if (horiz) -        node->paned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL); -    else -        node->paned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); - -    gtk_widget_show(node->paned); - -    if (parent == NULL) -        attach_panel_node_to_paned(parent, node, true); -    else -        attach_panel_node_to_paned(parent, node, parent->first == node); - - - - -    /* Premier ajustement */ - -    void split_paned_support(GtkWidget *support, GdkRectangle *alloc, gpointer data) -    { -        GtkOrientation orientation; -        gint position; - -        orientation = gtk_orientable_get_orientation(GTK_ORIENTABLE(support)); - -        if (orientation == GTK_ORIENTATION_HORIZONTAL) -            position = alloc->width / 2; -        else -            position = alloc->height / 2; - -        /* -        if (position < 50) -        position *= 2; -        */ - -        gtk_paned_set_position(GTK_PANED(support), position); - -        fprintf(stderr, "widget size is currently %dx%d\n", alloc->width, alloc->height); - - -        fprintf(stderr, "position = %d\n", position); - -        fprintf(stderr, "---\n"); - - -        g_signal_handlers_disconnect_by_func(support, G_CALLBACK(split_paned_support), NULL); - -    } - -    //g_signal_connect(current->paned, "size-allocate", G_CALLBACK(split_paned_support), NULL); - -    static int __counter = 0; - - - -    if (++__counter == 4) -        gtk_paned_set_position(GTK_PANED(node->paned), 100); - - - - -    /* Replace le composant d'origine */ - -    attach_panel_node_to_paned(node, moved, first); +    item->docked = status;  }  /******************************************************************************  *                                                                             * -*  Paramètres  : parent = noeud d'accueil pour le nouveau noeud.              * -*                node   = nouveau noeud à intégrer dans l'ensemble.           * -*                first  = indication sur l'emplacement à utiliser.            * -*                                                                             * -*  Description : Met en place un nouveau noeud dans une division.             * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void attach_panel_node_to_paned(panel_node *parent, panel_node *node, bool first) -{ -    node->parent = parent; - -    /* On se trouve à la racine... */ - -    if (parent == NULL) -        gtk_container_add(GTK_CONTAINER(_support), node->widget); - -    else -    { -        /* Raccordement hiérarchique */ - -        if (first) -            parent->first = node; -        else -            parent->second = node; - -        /* Raccordement graphique */ - -        assert(!IS_SIMPLE_NODE(parent)); - -        if (first) -            gtk_paned_pack1(GTK_PANED(parent->paned), node->widget, TRUE, FALSE); -        else -            gtk_paned_pack2(GTK_PANED(parent->paned), node->widget, TRUE, FALSE); - -    } - -} - - - - - - -////////////////////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : item = composant à présenter à l'affichage.                  * -*                path = partie du chemin représentée ici.                     * -*                                                                             * -*  Description : Crée un nouveau noeud pour un panneau particulier.           * -*                                                                             * -*  Retour      : Structure d'accueil mise en place.                           * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static panel_node *create_simple_panel_node_for_item(GPanelItem *item, const char *path) -{ -    panel_node *result;                     /* Structure à retourner       */ -    GtkWidget *station;                     /* Premier support concentré   */ - -    /* Partie graphique */ - -    station = gtk_dock_station_new(); -    g_signal_connect(station, "switch-widget", _handler, _data); -    gtk_widget_show(station); - -    gtk_dock_station_add_dockable(GTK_DOCK_STATION(station), GTK_DOCKABLE(item)); - -    /* Partie invisible */ - -    result = (panel_node *)calloc(1, sizeof(panel_node)); - -    result->station = station; - -    result->path = strdup(path); - -    return result; - -} - - - - - - - - - - - - - - - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : node = noeud dont la désignation est à obtenir.              * -*                                                                             * -*  Description : Obtient la désignation d'un élément hiérarchie des noeuds.   * -*                                                                             * -*  Retour      : Chaîne construite à libérer de la mémoire après usage.       * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static char *get_panel_node_path(const panel_node *node) -{ -    char *result;                           /* Valeur à retourner          */ -    char *extra;                            /* Complément à ajouter        */ - -    if (IS_SIMPLE_NODE(node)) -        result = strdup(node->path); - -    else -    { -        result = get_panel_node_path(node->first); - -        extra = get_panel_node_path(node->second); -        result = stradd(result, "-"); -        result = stradd(result, extra); -        free(extra); - -        result = strprep(result, "("); -        result = stradd(result, ")"); - - -    } - -    return result; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : node   = noeud d'où lancer les recherches.                   * -*                target = identifiant de la position visée.                   * -*                                                                             * -*  Description : Détermine la plus grande longueur commune entre éléments.    * -*                                                                             * -*  Retour      : Bilan de l'évaluation.                                       * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static size_t compute_path_common_length(const panel_node *node, const char *target) -{ -    size_t result;                          /* Taille à retourner          */ -    size_t len;                             /* Longueur de comparaison     */ -    size_t common1;                         /* Tron common avec le côté #1 */ -    size_t common2;                         /* Tron common avec le côté #2 */ - -    if (IS_SIMPLE_NODE(node)) -    { -        len = MIN(strlen(node->path), strlen(target)); - -        /** -         * Il n'y a pas forcément de base commune entre deux branches, -         * donc on parcourt les chemins depuis leur base respective. -         */ -        for (result = 0; result < len; result++) -            if (node->path[result] != target[result]) -                break; - -    } - -    else -    { -        common1 = compute_path_common_length(node->first, target); -        common2 = compute_path_common_length(node->second, target); - -        result = MAX(common1, common2); - -    } - -    return result; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : node = noeud d'où lancer les mesures.                        * -*                                                                             * -*  Description : Détermine la plus grande profondeur d'un noeud de panneaux.  * -*                                                                             * -*  Retour      : Valeur strictement positive.                                 * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static unsigned int compute_deepest_depth(const panel_node *node) -{ -    unsigned int result;                    /* Profondeur à renvoyer       */ -    unsigned int depth1;                    /* Profondeur du côté #1       */ -    unsigned int depth2;                    /* Profondeur du côté #2       */ - -    if (IS_SIMPLE_NODE(node)) -        result = 1; - -    else -    { -        depth1 = compute_deepest_depth(node->first); -        depth2 = compute_deepest_depth(node->second); - -        result = MAX(depth1, depth2); - -    } - -    return result; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : item     = composant à présenter à l'affichage.              * -*                node     = point d'insertion courant.                        * -*                path     = partie du chemin représentée ici.                 * -*                consumed = profondeur du chemin utilisé.                     * -*                                                                             * -*  Description : Place au bon endroit un panneau donné.                       * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void insert_item_as_panel_node(GPanelItem *item, panel_node *node, const char *path, size_t consumed) -{ -    char div;                               /* Division demandée           */ -    bool horiz;                             /* Traduction en composant     */ -    bool first;                             /* Point d'insertion           */ -    panel_node *new;                        /* Nouveau noeud créé          */ -    size_t common1;                         /* Tron common avec le côté #1 */ -    size_t common2;                         /* Tron common avec le côté #2 */ - - -    fprintf(stderr, "=== INSERTING '%s' (%zu)... -> '%s'\n", path, consumed, -            IS_SIMPLE_NODE(node) ? node->path : "-"); - - - -    if (IS_SIMPLE_NODE(node)) -    { -        /* Le parcours s'arrête ici ! */ -        if (strcmp(node->path, path) == 0) -            gtk_dock_station_add_dockable(GTK_DOCK_STATION(node->station), GTK_DOCKABLE(item)); - -        /* On ne peut aller plus loin, on doit diviser... */ -        else -        { -            div = toupper(path[consumed]); -            first = (div == 'W' || div == 'N'); -            horiz = (div == 'W' || div == 'E'); - -            fprintf(stderr, "---%%<--- first=%d horiz=%d\n", first, horiz); - -            fprintf(stderr, "--- cutting %p\n", node->station); - -            switch_panel_node_into_paned(node, horiz, !first); - -            new = create_simple_panel_node_for_item(item, path); - -            attach_panel_node_to_paned(node, new, first); - - -            fprintf(stderr, "1# [%p] widget = %p --- split :: %p // %p\n", -                    node, node->station, node->first, node->second); - -        } - -    } - -    /* On regarde des autres côtés... */ - -    else -    { -        common1 = compute_path_common_length(node->first, path); -        common2 = compute_path_common_length(node->second, path); - - -        fprintf(stderr, " - L1 :: %zu <-> '%s'\n", common1, get_panel_node_path(node->first)); -        fprintf(stderr, " - L2 :: %zu <-> '%s'\n", common2, get_panel_node_path(node->second)); - - -        /* Si une descente est possible... */ -        if (common1 > 0 || common2 > 0) -        { -            if (common1 > common2) -                insert_item_as_panel_node(item, node->first, path, common1); - -            else -                insert_item_as_panel_node(item, node->second, path, common2); - -        } - -        /* Sinon, on doit diviser qqch... */ -        else -        { -            div = toupper(path[consumed]); -            first = (div == 'W' || div == 'N'); -            horiz = (div == 'W' || div == 'E'); - -            fprintf(stderr, "---%%<--- first=%d horiz=%d\n", first, horiz); - -            switch_panel_node_into_paned(node, horiz, !first); - -            new = create_simple_panel_node_for_item(item, path); - -            attach_panel_node_to_paned(node, new, first); - - -                fprintf(stderr, "2# [%p] split :: %p-%p // %p-%p\n", node, -                        node->first, node->first->widget, -                        node->second, node->second->widget); - -        } - -    } - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : node = point de départ des recherches locales.               * -*                                                                             * -*  Description : Tente de mettre la main sur une station d'accueil.           * -*                                                                             * -*  Retour      : Eventuel noeud trouvé ou NULL.                               * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static panel_node *find_node_for_station(panel_node *node, GtkWidget *station) -{ -    panel_node *result;                     /* Bilan à remonter            */ - -    if (IS_SIMPLE_NODE(node)) -        result = (node->station == station ? node : NULL); - -    else -    { -        result = find_node_for_station(node->first, station); - -        if (result == NULL) -            result = find_node_for_station(node->second, station); - -    } - -    return result; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : node = noeud à supprimer de l'arbre des noeuds.              * +*  Paramètres  : item = composant d'affichage à consulter.                    *  *                                                                             * -*  Description : Efface de l'organisation un noeud donné en place.            * +*  Description : Indique si le composant repose sur un support de l'éditeur.  *  *                                                                             * -*  Retour      : -                                                            * +*  Retour      : true si le composant est bien incrusté quelque part.         *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -static void delete_panel_node(panel_node *node) +bool g_panel_item_is_docked(const GPanelItem *item)  { -    panel_node *parent;                     /* Noeud parent à transformer  */ -    GtkWidget *widget;                      /* Composant à traiter         */ -    panel_node *grandparent;                /* Noeud supérieur au parent   */ -    panel_node *remaining;                  /* Noeud restant               */ - -    assert(IS_SIMPLE_NODE(node)); - -    parent = node->parent; - -    /* Destruction du noeud */ - -    widget = node->station; -    gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(widget)), widget); - -    free(node->path); - -    free(node); - -    /* Suppression du niveau intermédiaire */ - -    if (parent != NULL) -    { -        remaining = (node == parent->first ? parent->second : parent->first); - -        /* Décroche graphiquement le support */ - -        widget = remaining->widget; - -        g_object_ref(G_OBJECT(widget)); -        gtk_container_remove(GTK_CONTAINER(parent->paned), widget); - -        /* Supprime le composant graphique intermédiaire */ - -        gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(parent->paned)), parent->paned); - -        /* Réinsère la partie restante */ - -        grandparent = parent->parent; - -        memcpy(parent, remaining, sizeof(panel_node)); - -        if (!IS_SIMPLE_NODE(parent)) -        { -            parent->first->parent = parent; -            parent->second->parent = parent; -        } - -        free(remaining); - -        if (grandparent == NULL) -            attach_panel_node_to_paned(grandparent, parent, true); -        else -            attach_panel_node_to_paned(grandparent, parent, grandparent->first == parent); - -    } +    return item->docked;  } - - - - - - - - - - - - -#if 1 - - -#include "../../core/params.h" - - -  /******************************************************************************  *                                                                             * -*  Paramètres  : current = point de départ de la réorganisation graphique.    * +*  Paramètres  : item = composant à retirer de l'affichage.                   *  *                                                                             * -*  Description : Met à jour l'affichage suite à un changement hiérarchique.   * +*  Description : Supprime un panneau de l'ensemble affiché.                   *  *                                                                             *  *  Retour      : -                                                            *  *                                                                             * @@ -1250,45 +363,10 @@ static void delete_panel_node(panel_node *node)  *                                                                             *  ******************************************************************************/ -void save_panel_nodes(void) +void g_panel_item_undock(GPanelItem *item)  { +    assert(item->docked); - -    fprintf(stderr, "Passage avec %p\n", _nodes); - -    return; -    void store_handle_position(panel_node *node, GGenConfig *config) -    { - -        size_t i; - -        for (i = 0; i < 0/*node->depth*/; i++) -            fprintf(stderr, "  "); - - -        ///fprintf(stderr, "[%s] %s\n", node->path, node->simple ? "[+]" : ">>"); - - -        if (0/*!node->simple*/) -        { -            store_handle_position(node->first, config); -            store_handle_position(node->second, config); -        } - - -    } - - -    //get_main_configuration() - - -    store_handle_position(_nodes, NULL); - -    fflush(NULL); - +    g_signal_emit_by_name(item, "undock-request");  } - -#endif - - diff --git a/src/gui/panels/panel.h b/src/gui/panels/panel.h index baf5fe7..bb46c5a 100644 --- a/src/gui/panels/panel.h +++ b/src/gui/panels/panel.h @@ -66,20 +66,23 @@ typedef enum _PanelItemPersonality  GType g_panel_item_get_type(void);  /* Crée un élément de panneau réactif. */ -GEditorItem *g_panel_item_new(PanelItemPersonality, GObject *, const char *, const char *, GtkWidget *, const char *); +GPanelItem *g_panel_item_new(PanelItemPersonality, const char *, const char *, GtkWidget *, const char *);  /* Fournit une indication sur la personnalité du panneau. */  PanelItemPersonality gtk_panel_item_get_personality(const GPanelItem *); +/* Fournit le chemin d'accès à utiliser pour les encapsulations. */ +const char *gtk_panel_item_get_path(const GPanelItem *); +  /* Indique la définition d'un éventuel raccourci clavier. */  const char *gtk_panel_item_get_key_bindings(const GPanelItem *); -/* Recherche un panneau à partir de son nom court. */ -GPanelItem *g_panel_item_get(const char *); -  /* Place un panneau dans l'ensemble affiché. */  void g_panel_item_dock(GPanelItem *); +/* Définit si le composant repose sur un support de l'éditeur. */ +void g_panel_item_set_dock_status(GPanelItem *, bool); +  /* Indique si le composant repose sur un support de l'éditeur. */  bool g_panel_item_is_docked(const GPanelItem *); @@ -88,33 +91,4 @@ void g_panel_item_undock(GPanelItem *); - - - - -void save_panel_nodes(void); - - - - - - -/* ----------------------- PLACEMENTS DES DIFFERENTS PANNEAUX ----------------------- */ - - -/* Prépare le terrain pour l'affichage central. */ -GtkWidget *init_panels2(GCallback, gpointer); - -/* Charge les principaux panneaux de l'éditeur. */ -void load_main_panels(GObject *); - - -/* Réalise un traitement sur un panneau de l'éditeur. */ -typedef bool (* handle_panel_item_fc) (GPanelItem *, void *); - -/* Effectue le parcours de tous les panneaux chargés. */ -bool browse_all_item_panels(handle_panel_item_fc, void *); - - -  #endif  /* _GUI_PANELS_PANEL_H */ diff --git a/src/gui/panels/regedit.c b/src/gui/panels/regedit.c index cb4fe85..a62f824 100644 --- a/src/gui/panels/regedit.c +++ b/src/gui/panels/regedit.c @@ -215,8 +215,20 @@ static void g_regedit_panel_init(GRegeditPanel *panel)      GtkTreeViewColumn *column;              /* Colonne de la liste         */      GtkTreeSortable *sortable;              /* Autre vision de la liste    */ +    /* Eléments de base */ +      base = G_EDITOR_ITEM(panel); +    base->name = PANEL_REGEDIT_ID; + +    pitem = G_PANEL_ITEM(panel); + +    pitem->personality = PIP_SINGLETON; +    pitem->lname = _("Configuration parameters"); +    pitem->path = "N"; + +    /* Représentation graphique */ +      base->widget = gtk_grid_new();      gtk_widget_show(base->widget); @@ -225,10 +237,6 @@ static void g_regedit_panel_init(GRegeditPanel *panel)      ref = G_OBJECT(base->widget);      g_object_set_data(ref, "panel", panel); -    pitem = G_PANEL_ITEM(panel); - -    pitem->personality = PIP_SINGLETON; -      /* Partie recherche */      label = qck_create_label(NULL, NULL, _("Look for:")); @@ -374,7 +382,7 @@ static void g_regedit_panel_finalize(GRegeditPanel *panel)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * +*  Paramètres  : -                                                            *  *                                                                             *  *  Description : Crée un panneau d'affichage des paramètres de configuration. *  *                                                                             * @@ -384,15 +392,12 @@ static void g_regedit_panel_finalize(GRegeditPanel *panel)  *                                                                             *  ******************************************************************************/ -GEditorItem *g_regedit_panel_new(GObject *ref) +GPanelItem *g_regedit_panel_new(void)  { -    GEditorItem *result;                    /* Structure à retourner       */ +    GPanelItem *result;                     /* Structure à retourner       */      result = g_object_new(G_TYPE_REGEDIT_PANEL, NULL); -    g_panel_item_init_ext(G_PANEL_ITEM(result), ref, PANEL_REGEDIT_ID, -                          _("Configuration parameters"), G_EDITOR_ITEM(result)->widget, "N"); -      reload_config_into_treeview(G_REGEDIT_PANEL(result), get_main_configuration());      return result; @@ -400,32 +405,6 @@ GEditorItem *g_regedit_panel_new(GObject *ref)  } -/****************************************************************************** -*                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * -*                                                                             * -*  Description : Construit le panneau d'affichage des messages système.       * -*                                                                             * -*  Retour      : Adresse du panneau mis en place.                             * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -GPanelItem *create_regedit_panel(GObject *ref) -{ -    GEditorItem *result;                    /* Elément réactif à renvoyer  */ - -    result = g_regedit_panel_new(ref); - -    /* Enregistre correctement le tout */ -    register_editor_item(result); - -    return G_PANEL_ITEM(result); - -} - -  /* ---------------------------------------------------------------------------------- */  /*                           AFFICHAGE A L'AIDE D'UNE LISTE                           */ diff --git a/src/gui/panels/regedit.h b/src/gui/panels/regedit.h index 7166168..1cf5842 100644 --- a/src/gui/panels/regedit.h +++ b/src/gui/panels/regedit.h @@ -55,10 +55,7 @@ typedef struct _GRegeditPanelClass GRegeditPanelClass;  GType g_regedit_panel_get_type(void);  /* Crée un panneau d'affichage des paramètres de configuration. */ -GEditorItem *g_regedit_panel_new(GObject *); - -/* Construit le panneau d'affichage des messages système. */ -GPanelItem *create_regedit_panel(GObject *); +GPanelItem *g_regedit_panel_new(void); diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c index 9759e71..0c39b4b 100644 --- a/src/gui/panels/strings.c +++ b/src/gui/panels/strings.c @@ -223,8 +223,20 @@ static void g_strings_panel_init(GStringsPanel *panel)      GtkTreeSelection *select;               /* Sélection dans la liste     */      bool display;                           /* Affichage si sélection ?    */ +    /* Eléments de base */ +      base = G_EDITOR_ITEM(panel); +    base->name = PANEL_STRINGS_ID; + +    pitem = G_PANEL_ITEM(panel); + +    pitem->personality = PIP_SINGLETON; +    pitem->lname = _("Strings"); +    pitem->path = "SE"; + +    /* Représentation graphique */ +      base->widget = gtk_scrolled_window_new(NULL, NULL);      gtk_widget_show(base->widget); @@ -234,10 +246,6 @@ static void g_strings_panel_init(GStringsPanel *panel)      ref = G_OBJECT(base->widget);      g_object_set_data(ref, "panel", panel); -    pitem = G_PANEL_ITEM(panel); - -    pitem->personality = PIP_SINGLETON; -      /* Partie chaînes */      store = gtk_tree_store_new(STC_COUNT, G_TYPE_OBJECT, @@ -408,7 +416,7 @@ static void g_strings_panel_finalize(GStringsPanel *panel)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * +*  Paramètres  : -                                                            *  *                                                                             *  *  Description : Crée un panneau d'affichage des chaînes.                     *  *                                                                             * @@ -418,46 +426,17 @@ static void g_strings_panel_finalize(GStringsPanel *panel)  *                                                                             *  ******************************************************************************/ -GEditorItem *g_strings_panel_new(GObject *ref) +GPanelItem *g_strings_panel_new(void)  { -    GEditorItem *result;                    /* Structure à retourner       */ +    GPanelItem *result;                     /* Structure à retourner       */      result = g_object_new(G_TYPE_STRINGS_PANEL, NULL); -    g_panel_item_init_ext(G_PANEL_ITEM(result), ref, PANEL_STRINGS_ID, -                          _("Strings"), G_EDITOR_ITEM(result)->widget, "SE"); -      return result;  } -/****************************************************************************** -*                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * -*                                                                             * -*  Description : Construit et intègre un panneau d'affichage des chaînes.     * -*                                                                             * -*  Retour      : Adresse du panneau mis en place.                             * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -GPanelItem *create_strings_panel(GObject *ref) -{ -    GEditorItem *result;                    /* Elément réactif à renvoyer  */ - -    result = g_strings_panel_new(ref); - -    /* Enregistre correctement le tout */ -    register_editor_item(result); - -    return G_PANEL_ITEM(result); - -} - -  /* ---------------------------------------------------------------------------------- */  /*                           AFFICHAGE A L'AIDE D'UNE LISTE                           */ diff --git a/src/gui/panels/strings.h b/src/gui/panels/strings.h index 556dcbe..4655cf7 100644 --- a/src/gui/panels/strings.h +++ b/src/gui/panels/strings.h @@ -55,10 +55,7 @@ typedef struct _GStringsPanelClass GStringsPanelClass;  GType g_strings_panel_get_type(void);  /* Crée un panneau d'affichage des chaînes. */ -GEditorItem *g_strings_panel_new(GObject *); - -/* Construit et intègre un panneau d'affichage des chaînes. */ -GPanelItem *create_strings_panel(GObject *); +GPanelItem *g_strings_panel_new(void); diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c index eebfc4c..1b7453b 100644 --- a/src/gui/panels/symbols.c +++ b/src/gui/panels/symbols.c @@ -249,18 +249,26 @@ static void g_symbols_panel_init(GSymbolsPanel *panel)      GtkTreeViewColumn *column;              /* Colonne de la liste         */      GtkTreeSelection *select;               /* Sélection dans la liste     */ +    /* Eléments de base */ +      base = G_EDITOR_ITEM(panel); +    base->name = PANEL_SYMBOLS_ID; + +    pitem = G_PANEL_ITEM(panel); + +    pitem->personality = PIP_SINGLETON; +    pitem->lname = _("Binary symbols"); +    pitem->path = "eN"; + +    /* Représentation graphique */ +      base->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);      gtk_widget_show(base->widget);      ref = G_OBJECT(base->widget);      g_object_set_data(ref, "panel", panel); -    pitem = G_PANEL_ITEM(panel); - -    pitem->personality = PIP_SINGLETON; -      /* Barre d'outils supérieure */      box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); @@ -429,7 +437,7 @@ static void g_symbols_panel_finalize(GSymbolsPanel *panel)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * +*  Paramètres  : -                                                            *  *                                                                             *  *  Description : Crée un panneau d'affichage des symboles.                    *  *                                                                             * @@ -439,15 +447,12 @@ static void g_symbols_panel_finalize(GSymbolsPanel *panel)  *                                                                             *  ******************************************************************************/ -GEditorItem *g_symbols_panel_new(GObject *ref) +GPanelItem *g_symbols_panel_new(void)  { -    GEditorItem *result;                    /* Structure à retourner       */ +    GPanelItem *result;                     /* Structure à retourner       */      result = g_object_new(G_TYPE_SYMBOLS_PANEL, NULL); -    g_panel_item_init_ext(G_PANEL_ITEM(result), ref, PANEL_SYMBOLS_ID, -                          _("Binary symbols"), G_EDITOR_ITEM(result)->widget, "eN"); -      return result;  } @@ -455,32 +460,6 @@ GEditorItem *g_symbols_panel_new(GObject *ref)  /******************************************************************************  *                                                                             * -*  Paramètres  : ref = espace de référencement global.                        * -*                                                                             * -*  Description : Construit et intègre un panneau d'affichage des symboles.    * -*                                                                             * -*  Retour      : Adresse du panneau mis en place.                             * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -GPanelItem *create_symbols_panel(GObject *ref) -{ -    GEditorItem *result;                    /* Elément réactif à renvoyer  */ - -    result = g_symbols_panel_new(ref); - -    /* Enregistre correctement le tout */ -    register_editor_item(result); - -    return G_PANEL_ITEM(result); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : button = bouton de la barre activé.                          *  *                panel  = structure contenant les informations maîtresses.    *  *                                                                             * diff --git a/src/gui/panels/symbols.h b/src/gui/panels/symbols.h index 3da964c..ea947ea 100644 --- a/src/gui/panels/symbols.h +++ b/src/gui/panels/symbols.h @@ -55,10 +55,7 @@ typedef struct _GSymbolsPanelClass GSymbolsPanelClass;  GType g_symbols_panel_get_type(void);  /* Crée un panneau d'affichage des symboles. */ -GEditorItem *g_symbols_panel_new(GObject *); - -/* Construit et intègre un panneau d'affichage des symboles. */ -GPanelItem *create_symbols_panel(GObject *); +GPanelItem *g_symbols_panel_new(void); | 
