diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/analysis/block-int.h | 12 | ||||
| -rw-r--r-- | src/analysis/block.c | 16 | ||||
| -rw-r--r-- | src/analysis/blocks/flow.c | 18 | ||||
| -rw-r--r-- | src/analysis/blocks/virtual.c | 17 | ||||
| -rw-r--r-- | src/gtkext/graph/node-int.h | 16 | ||||
| -rw-r--r-- | src/gtkext/graph/node.c | 22 | ||||
| -rw-r--r-- | src/gtkext/graph/node.h | 11 | ||||
| -rw-r--r-- | src/gtkext/graph/nodes/flow.c | 13 | ||||
| -rw-r--r-- | src/gtkext/graph/nodes/flow.h | 11 | ||||
| -rw-r--r-- | src/gtkext/graph/nodes/virtual.c | 32 | ||||
| -rw-r--r-- | src/gtkext/graph/nodes/virtual.h | 11 | ||||
| -rw-r--r-- | src/gtkext/gtkblockview.c | 11 | ||||
| -rw-r--r-- | src/gtkext/gtkbufferview.c | 8 | ||||
| -rw-r--r-- | src/gtkext/gtkgraphview.c | 3 | ||||
| -rw-r--r-- | src/gtkext/gtksourceview.c | 10 | ||||
| -rw-r--r-- | src/gtkext/gtkviewpanel-int.h | 10 | ||||
| -rw-r--r-- | src/gtkext/gtkviewpanel.c | 8 | 
17 files changed, 101 insertions, 128 deletions
diff --git a/src/analysis/block-int.h b/src/analysis/block-int.h index 18b1ce4..ce401ae 100644 --- a/src/analysis/block-int.h +++ b/src/analysis/block-int.h @@ -52,12 +52,6 @@ struct _GInstrBlock  {      GObject parent;                         /* A laisser en premier        */ -    find_by_addr_fc find_by_addr;           /* Recherche par adresse       */ -    visit_all_blocks_fc visit_blocks;       /* Visite des différents blocs */ -    list_all_blocks_fc list_blocks;         /* Liste de tous les blocs     */ -    list_leafs_blocks_fc list_leafs;        /* Liste des blocs terminaux   */ -    //list_regs_accesses_fc list_regs;        /* Liste des accès registres   */ -      GInstrBlock *links_block;               /* Lieu des blocs attachés     */  }; @@ -67,6 +61,12 @@ struct _GInstrBlockClass  {      GObjectClass parent;                    /* A laisser en premier        */ +    find_by_addr_fc find_by_addr;           /* Recherche par adresse       */ +    visit_all_blocks_fc visit_blocks;       /* Visite des différents blocs */ +    list_all_blocks_fc list_blocks;         /* Liste de tous les blocs     */ +    list_leafs_blocks_fc list_leafs;        /* Liste des blocs terminaux   */ +    //list_regs_accesses_fc list_regs;        /* Liste des accès registres   */ +  }; diff --git a/src/analysis/block.c b/src/analysis/block.c index 23fbfc5..e906d36 100644 --- a/src/analysis/block.c +++ b/src/analysis/block.c @@ -42,14 +42,6 @@ static void g_instr_block_finalize(GInstrBlock *); - - - - - - - -  /* Indique le type défini pour un bloc d'instructions. */  G_DEFINE_TYPE(GInstrBlock, g_instr_block, G_TYPE_OBJECT); @@ -153,7 +145,7 @@ static void g_instr_block_finalize(GInstrBlock *block)  GInstrBlock *g_instr_block_find_by_addr(const GInstrBlock *block, const vmpa2t *addr, bool final)  { -    return block->find_by_addr(block, addr, final); +    return G_INSTR_BLOCK_GET_CLASS(block)->find_by_addr(block, addr, final);  } @@ -174,7 +166,7 @@ GInstrBlock *g_instr_block_find_by_addr(const GInstrBlock *block, const vmpa2t *  bool g_instr_block_visit(GInstrBlock *block, instr_block_visitor_cb callback, void *data)  { -    return block->visit_blocks(block, callback, data); +    return G_INSTR_BLOCK_GET_CLASS(block)->visit_blocks(block, callback, data);  } @@ -195,7 +187,7 @@ bool g_instr_block_visit(GInstrBlock *block, instr_block_visitor_cb callback, vo  void g_instr_block_list_all_blocks(const GInstrBlock *block, GInstrBlock ***list, size_t *count)  { -    block->list_blocks(block, list, count); +    G_INSTR_BLOCK_GET_CLASS(block)->list_blocks(block, list, count);  } @@ -216,7 +208,7 @@ void g_instr_block_list_all_blocks(const GInstrBlock *block, GInstrBlock ***list  void g_instr_block_list_leafs_blocks(const GInstrBlock *block, GInstrBlock ***list, size_t *count)  { -    block->list_leafs(block, list, count); +    G_INSTR_BLOCK_GET_CLASS(block)->list_leafs(block, list, count);  } diff --git a/src/analysis/blocks/flow.c b/src/analysis/blocks/flow.c index 305dad0..99d4553 100644 --- a/src/analysis/blocks/flow.c +++ b/src/analysis/blocks/flow.c @@ -111,12 +111,20 @@ G_DEFINE_TYPE(GFlowBlock, g_flow_block, G_TYPE_INSTR_BLOCK);  static void g_flow_block_class_init(GFlowBlockClass *class)  {      GObjectClass *object;                   /* Autre version de la classe  */ +    GInstrBlockClass *block_class;          /* Version parente du la classe*/      object = G_OBJECT_CLASS(class); +    block_class = G_INSTR_BLOCK_CLASS(class);      object->dispose = (GObjectFinalizeFunc/* ! */)g_flow_block_dispose;      object->finalize = (GObjectFinalizeFunc)g_flow_block_finalize; +    block_class->find_by_addr = (find_by_addr_fc)g_flow_block_find_by_addr; +    block_class->visit_blocks = (visit_all_blocks_fc)g_flow_block_visit; +    block_class->list_blocks = (list_all_blocks_fc)g_flow_block_list_all_blocks; +    block_class->list_leafs = (list_leafs_blocks_fc)g_flow_block_list_leafs_blocks; +    //block_class->list_regs = (list_regs_accesses_fc)g_flow_block_list_regs_accesses; +  } @@ -134,16 +142,6 @@ static void g_flow_block_class_init(GFlowBlockClass *class)  static void g_flow_block_init(GFlowBlock *block)  { -    GInstrBlock *parent;                    /* Instance parente            */ - -    parent = G_INSTR_BLOCK(block); - -    parent->find_by_addr = (find_by_addr_fc)g_flow_block_find_by_addr; -    parent->visit_blocks = (visit_all_blocks_fc)g_flow_block_visit; -    parent->list_blocks = (list_all_blocks_fc)g_flow_block_list_all_blocks; -    parent->list_leafs = (list_leafs_blocks_fc)g_flow_block_list_leafs_blocks; -    //parent->list_regs = (list_regs_accesses_fc)g_flow_block_list_regs_accesses; -      g_flow_block_set_rank(block, 0);      block->regs = g_raccess_list_new(); diff --git a/src/analysis/blocks/virtual.c b/src/analysis/blocks/virtual.c index a3e1695..d5b1b5a 100644 --- a/src/analysis/blocks/virtual.c +++ b/src/analysis/blocks/virtual.c @@ -107,12 +107,20 @@ G_DEFINE_TYPE(GVirtualBlock, g_virtual_block, G_TYPE_INSTR_BLOCK);  static void g_virtual_block_class_init(GVirtualBlockClass *class)  {      GObjectClass *object;                   /* Autre version de la classe  */ +    GInstrBlockClass *block_class;          /* Version parente du la classe*/      object = G_OBJECT_CLASS(class); +    block_class = G_INSTR_BLOCK_CLASS(class);      object->dispose = (GObjectFinalizeFunc/* ! */)g_virtual_block_dispose;      object->finalize = (GObjectFinalizeFunc)g_virtual_block_finalize; +    block_class->find_by_addr = (find_by_addr_fc)g_virtual_block_find_by_addr; +    block_class->visit_blocks = (visit_all_blocks_fc)g_virtual_block_visit; +    block_class->list_blocks = (list_all_blocks_fc)g_virtual_block_list_all_blocks; +    block_class->list_leafs = (list_leafs_blocks_fc)g_virtual_block_list_leafs_blocks; +    //block_class->list_regs = (list_regs_accesses_fc)g_virtual_block_list_regs_accesses; +  } @@ -130,15 +138,6 @@ static void g_virtual_block_class_init(GVirtualBlockClass *class)  static void g_virtual_block_init(GVirtualBlock *block)  { -    GInstrBlock *parent;                    /* Instance parente            */ - -    parent = G_INSTR_BLOCK(block); - -    parent->find_by_addr = (find_by_addr_fc)g_virtual_block_find_by_addr; -    parent->visit_blocks = (visit_all_blocks_fc)g_virtual_block_visit; -    parent->list_blocks = (list_all_blocks_fc)g_virtual_block_list_all_blocks; -    parent->list_leafs = (list_leafs_blocks_fc)g_virtual_block_list_leafs_blocks; -    //parent->list_regs = (list_regs_accesses_fc)g_virtual_block_list_regs_accesses;  } diff --git a/src/gtkext/graph/node-int.h b/src/gtkext/graph/node-int.h index 18b6b20..2572fce 100644 --- a/src/gtkext/graph/node-int.h +++ b/src/gtkext/graph/node-int.h @@ -56,14 +56,6 @@ struct _GGraphNode  {      GObject parent;                         /* A laisser en premier        */ -    get_node_rank_fc get_rank;              /* Premier rang d'appartenance */ -    node_reset_pos_fc reset_pos;            /* Réinitialise l'emplacement  */ -    node_prepare_x_fc prepare_x;            /* Préparation des abscisses   */ -    node_apply_pos_fc apply_pos;            /* Applique une absisse finale */ -    node_set_pos_fc set_pos;                /* Définit l'emplacement       */ -    visit_flow_nodes_fc visit;              /* Visite des noeuds d'exécut° */ -    find_container_fc contain;              /* Retrouve un conteneur       */ -      GtkAllocation alloc;                    /* Emplacement du bloc rattaché*/      pending_position pending_pos;           /* Indication sur la position  */      PendingPositionFlags pending_flag;      /* Cible le champ valide       */ @@ -81,6 +73,14 @@ struct _GGraphNodeClass  {      GObjectClass parent;                    /* A laisser en premier        */ +    get_node_rank_fc get_rank;              /* Premier rang d'appartenance */ +    node_reset_pos_fc reset_pos;            /* Réinitialise l'emplacement  */ +    node_prepare_x_fc prepare_x;            /* Préparation des abscisses   */ +    node_apply_pos_fc apply_pos;            /* Applique une absisse finale */ +    node_set_pos_fc set_pos;                /* Définit l'emplacement       */ +    visit_flow_nodes_fc visit;              /* Visite des noeuds d'exécut° */ +    find_container_fc contain;              /* Retrouve un conteneur       */ +  }; diff --git a/src/gtkext/graph/node.c b/src/gtkext/graph/node.c index 439d4e7..4fd7a8e 100644 --- a/src/gtkext/graph/node.c +++ b/src/gtkext/graph/node.c @@ -159,7 +159,7 @@ static void g_graph_node_finalize(GGraphNode *node)  unsigned int g_graph_node_get_rank(const GGraphNode *node)  { -    return node->get_rank(node); +    return G_GRAPH_NODE_GET_CLASS(node)->get_rank(node);  } @@ -183,8 +183,8 @@ void g_graph_node_reset_position(GGraphNode *node)      node->pending_flag = PPF_NONE; -    if (node->reset_pos != NULL) -        node->reset_pos(node); +    if (G_GRAPH_NODE_GET_CLASS(node)->reset_pos != NULL) +        G_GRAPH_NODE_GET_CLASS(node)->reset_pos(node);  } @@ -204,7 +204,7 @@ void g_graph_node_reset_position(GGraphNode *node)  void g_graph_node_prepare_x_line(GGraphNode *node, GGraphNode *nodes)  { -    node->prepare_x(node, nodes); +    G_GRAPH_NODE_GET_CLASS(node)->prepare_x(node, nodes);  } @@ -226,8 +226,8 @@ void g_graph_node_apply_position(GGraphNode *node)      gint x_pos;                             /* Position de référence       */      GGraphNode *ref;                        /* Accès rapide                */ -    if (node->apply_pos != NULL) -        node->apply_pos(node); +    if (G_GRAPH_NODE_GET_CLASS(node)->apply_pos != NULL) +        G_GRAPH_NODE_GET_CLASS(node)->apply_pos(node);      switch (node->pending_flag)      { @@ -289,8 +289,8 @@ void g_graph_node_apply_position(GGraphNode *node)  void g_graph_node_set_x_position(GGraphNode *node, gint x)  { -    if (node->set_pos != NULL && x != GRAPH_HORIZONTAL_MARGIN) -        node->set_pos(node, x); +    if (G_GRAPH_NODE_GET_CLASS(node)->set_pos != NULL && x != GRAPH_HORIZONTAL_MARGIN) +        G_GRAPH_NODE_GET_CLASS(node)->set_pos(node, x);      node->alloc.x = x; @@ -403,7 +403,7 @@ GtkAllocation g_graph_node_get_allocation(const GGraphNode *node)  bool g_graph_node_visit_nodes(GGraphNode *node, graph_node_visitor_cb callback, void *data)  { -    return node->visit(node, callback, data); +    return G_GRAPH_NODE_GET_CLASS(node)->visit(node, callback, data);  } @@ -427,8 +427,8 @@ GGraphNode *g_graph_node_find_container(GGraphNode *nodes, GGraphNode *target)      result = NULL; -    if (nodes->contain != NULL) -        result = nodes->contain(nodes, target); +    if (G_GRAPH_NODE_GET_CLASS(nodes)->contain != NULL) +        result = G_GRAPH_NODE_GET_CLASS(nodes)->contain(nodes, target);      return result; diff --git a/src/gtkext/graph/node.h b/src/gtkext/graph/node.h index c68719e..ab7d0da 100644 --- a/src/gtkext/graph/node.h +++ b/src/gtkext/graph/node.h @@ -37,11 +37,12 @@  /* -------------------------- GESTION DES NOEUDS A L'UNITE -------------------------- */ -#define G_TYPE_GRAPH_NODE               g_graph_node_get_type() -#define G_GRAPH_NODE(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_graph_node_get_type(), GGraphNode)) -#define G_IS_GRAPH_NODE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_graph_node_get_type())) -#define G_GRAPH_NODE_GET_IFACE(inst)    (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_graph_node_get_type(), GGraphNodeIface)) -#define G_GRAPH_NODE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_GRAPH_NODE, GGraphNodeClass)) +#define G_TYPE_GRAPH_NODE                  (g_graph_node_get_type()) +#define G_GRAPH_NODE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_GRAPH_NODE, GGraphNode)) +#define G_GRAPH_NODE_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_GRAPH_NODE, GGraphNodeClass)) +#define G_IS_GRAPH_NODE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_GRAPH_NODE)) +#define G_IS_GRAPH_NODE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_GRAPH_NODE)) +#define G_GRAPH_NODE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_GRAPH_NODE, GGraphNodeClass))  /* Intermédiaire entre le noeud dot et la bribe de code (instance) */ diff --git a/src/gtkext/graph/nodes/flow.c b/src/gtkext/graph/nodes/flow.c index d691da5..5ff21c9 100644 --- a/src/gtkext/graph/nodes/flow.c +++ b/src/gtkext/graph/nodes/flow.c @@ -130,12 +130,18 @@ G_DEFINE_TYPE(GFlowNode, g_flow_node, G_TYPE_GRAPH_NODE);  static void g_flow_node_class_init(GFlowNodeClass *klass)  {      GObjectClass *object;                   /* Autre version de la classe  */ +    GGraphNodeClass *node_class;            /* Version parente de la classe*/      object = G_OBJECT_CLASS(klass); +    node_class = G_GRAPH_NODE_CLASS(klass);      object->dispose = (GObjectFinalizeFunc/* ! */)g_flow_node_dispose;      object->finalize = (GObjectFinalizeFunc)g_flow_node_finalize; +    node_class->get_rank = (get_node_rank_fc)g_flow_node_get_rank; +    node_class->prepare_x = (node_prepare_x_fc)g_flow_node_prepare_x_line; +    node_class->visit = (visit_flow_nodes_fc)g_flow_node_visit_flow_nodes; +  } @@ -153,13 +159,6 @@ static void g_flow_node_class_init(GFlowNodeClass *klass)  static void g_flow_node_init(GFlowNode *node)  { -    GGraphNode *base;                       /* Version basique             */ - -    base = G_GRAPH_NODE(node); - -    base->get_rank = (get_node_rank_fc)g_flow_node_get_rank; -    base->prepare_x = (node_prepare_x_fc)g_flow_node_prepare_x_line; -    base->visit = (visit_flow_nodes_fc)g_flow_node_visit_flow_nodes;  } diff --git a/src/gtkext/graph/nodes/flow.h b/src/gtkext/graph/nodes/flow.h index 4e34481..413a8f2 100644 --- a/src/gtkext/graph/nodes/flow.h +++ b/src/gtkext/graph/nodes/flow.h @@ -35,11 +35,12 @@ typedef struct _GGraphLayout GGraphLayout; -#define G_TYPE_FLOW_NODE               g_flow_node_get_type() -#define G_FLOW_NODE(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_flow_node_get_type(), GFlowNode)) -#define G_IS_FLOW_NODE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_flow_node_get_type())) -#define G_FLOW_NODE_GET_IFACE(inst)    (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_flow_node_get_type(), GFlowNodeIface)) -#define G_FLOW_NODE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_FLOW_NODE, GFlowNodeClass)) +#define G_TYPE_FLOW_NODE                  (g_flow_node_get_type()) +#define G_FLOW_NODE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FLOW_NODE, GFlowNode)) +#define G_FLOW_NODE_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FLOW_NODE, GFlowNodeClass)) +#define G_IS_FLOW_NODE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FLOW_NODE)) +#define G_IS_FLOW_NODE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FLOW_NODE)) +#define G_FLOW_NODE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_FLOW_NODE, GFlowNodeClass))  /* Type d'un accrochage pour lien */ diff --git a/src/gtkext/graph/nodes/virtual.c b/src/gtkext/graph/nodes/virtual.c index cb46aee..894c6b6 100644 --- a/src/gtkext/graph/nodes/virtual.c +++ b/src/gtkext/graph/nodes/virtual.c @@ -85,9 +85,6 @@ struct _GVirtualNode      GVirtualBlock *block;                   /* Bloc virtuel associé        */ -    gint x;                                 /* Abscisse du noeud           */ -    gint y;                                 /* Ordonnée du noeud           */ -      GGraphNode **children;                  /* Noeuds englobés             */      size_t count;                           /* Quantité de ces noeuds      */      virtual_level *levels;                  /* Différents étages de noeuds */ @@ -245,11 +242,6 @@ static void extend_vertical_links_spans(vert_links *links, const reserved_vspan - - - - -  /* ---------------------------------------------------------------------------------- */  /*                        REPRESENTATIONS DES GROUPES LOGIQUES                        */  /* ---------------------------------------------------------------------------------- */ @@ -274,12 +266,22 @@ G_DEFINE_TYPE(GVirtualNode, g_virtual_node, G_TYPE_GRAPH_NODE);  static void g_virtual_node_class_init(GVirtualNodeClass *klass)  {      GObjectClass *object;                   /* Autre version de la classe  */ +    GGraphNodeClass *node_class;            /* Version parente de la classe*/      object = G_OBJECT_CLASS(klass); +    node_class = G_GRAPH_NODE_CLASS(klass);      object->dispose = (GObjectFinalizeFunc/* ! */)g_virtual_node_dispose;      object->finalize = (GObjectFinalizeFunc)g_virtual_node_finalize; +    node_class->get_rank = (get_node_rank_fc)g_virtual_node_get_rank; +    node_class->reset_pos = (node_reset_pos_fc)g_virtual_node_reset_position; +    node_class->prepare_x = (node_prepare_x_fc)g_virtual_node_prepare_x_line; +    node_class->apply_pos = (node_apply_pos_fc)g_virtual_node_apply_position; +    node_class->set_pos = (node_set_pos_fc)g_virtual_node_set_position; +    node_class->visit = (visit_flow_nodes_fc)g_virtual_node_visit_flow_nodes; +    node_class->contain = (find_container_fc)g_virtual_node_find_container; +  } @@ -297,20 +299,6 @@ static void g_virtual_node_class_init(GVirtualNodeClass *klass)  static void g_virtual_node_init(GVirtualNode *node)  { -    GGraphNode *base;                       /* Version basique             */ - -    base = G_GRAPH_NODE(node); - -    base->get_rank = (get_node_rank_fc)g_virtual_node_get_rank; -    base->reset_pos = (node_reset_pos_fc)g_virtual_node_reset_position; -    base->prepare_x = (node_prepare_x_fc)g_virtual_node_prepare_x_line; -    base->apply_pos = (node_apply_pos_fc)g_virtual_node_apply_position; -    base->set_pos = (node_set_pos_fc)g_virtual_node_set_position; -    base->visit = (visit_flow_nodes_fc)g_virtual_node_visit_flow_nodes; -    base->contain = (find_container_fc)g_virtual_node_find_container; - -    node->x = UNINITIALIZED_NODE_POS; -    node->y = UNINITIALIZED_NODE_POS;  } diff --git a/src/gtkext/graph/nodes/virtual.h b/src/gtkext/graph/nodes/virtual.h index c496df5..7f32591 100644 --- a/src/gtkext/graph/nodes/virtual.h +++ b/src/gtkext/graph/nodes/virtual.h @@ -36,11 +36,12 @@ typedef size_t vspan_slot_t;  #define UNINITIALIZED_VSPAN_SLOT (~((vspan_slot_t)0)) -#define G_TYPE_VIRTUAL_NODE               g_virtual_node_get_type() -#define G_VIRTUAL_NODE(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_virtual_node_get_type(), GVirtualNode)) -#define G_IS_VIRTUAL_NODE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_virtual_node_get_type())) -#define G_VIRTUAL_NODE_GET_IFACE(inst)    (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_virtual_node_get_type(), GVirtualNodeIface)) -#define G_VIRTUAL_NODE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_VIRTUAL_NODE, GVirtualNodeClass)) +#define G_TYPE_VIRTUAL_NODE                  (g_virtual_node_get_type()) +#define G_VIRTUAL_NODE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_VIRTUAL_NODE, GVirtualNode)) +#define G_VIRTUAL_NODE_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_VIRTUAL_NODE, GVirtualNodeClass)) +#define G_IS_VIRTUAL_NODE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_VIRTUAL_NODE)) +#define G_IS_VIRTUAL_NODE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_VIRTUAL_NODE)) +#define G_VIRTUAL_NODE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_VIRTUAL_NODE, GVirtualNodeClass))  /* Encapsulation graphique d'un bloc virtuel (instance) */ diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c index c0004b5..2584405 100644 --- a/src/gtkext/gtkblockview.c +++ b/src/gtkext/gtkblockview.c @@ -86,6 +86,11 @@ G_DEFINE_TYPE(GtkBlockView, gtk_block_view, GTK_TYPE_BUFFER_VIEW)  static void gtk_block_view_class_init(GtkBlockViewClass *class)  { +    GtkViewPanelClass *panel_class;         /* Classe parente              */ + +    panel_class = GTK_VIEW_PANEL_CLASS(class); + +    panel_class->attach = (attach_binary_fc)gtk_block_view_attach_binary;  } @@ -104,12 +109,6 @@ static void gtk_block_view_class_init(GtkBlockViewClass *class)  static void gtk_block_view_init(GtkBlockView *view)  { -    GtkViewPanel *panel;                    /* Instance parente            */ - -    panel = GTK_VIEW_PANEL(view); - -    panel->attach = (attach_binary_fc)gtk_block_view_attach_binary; -      g_signal_connect(G_OBJECT(view), "button_press_event",                       G_CALLBACK(gtk_block_view_button_press_event), NULL); diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c index 0d74176..ef4f985 100644 --- a/src/gtkext/gtkbufferview.c +++ b/src/gtkext/gtkbufferview.c @@ -125,6 +125,8 @@ static void gtk_buffer_view_class_init(GtkBufferViewClass *class)      panel_class->adjust = (adjust_scroll_value_fc)gtk_buffer_view_adjust_scroll_value;      panel_class->get_coordinates = (get_addr_coordinates_fc)gtk_buffer_view_get_address_coordinates;      panel_class->get_position = (get_view_position_fc)gtk_buffer_view_get_position; +    panel_class->cache_glance = (cache_glance_fc)gtk_buffer_view_cache_glance; +      g_signal_new("caret-moved",                   GTK_TYPE_BUFFER_VIEW, @@ -151,12 +153,6 @@ static void gtk_buffer_view_class_init(GtkBufferViewClass *class)  static void gtk_buffer_view_init(GtkBufferView *view)  { -    GtkViewPanel *viewpanel;                /* Instance parente            */ - -    viewpanel = GTK_VIEW_PANEL(view); - -    viewpanel->cache_glance = (cache_glance_fc)gtk_buffer_view_cache_glance; -      view->caret.x = 10;      view->caret.y = 10;      view->caret.width = 100; diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c index 70a803b..875c1b4 100644 --- a/src/gtkext/gtkgraphview.c +++ b/src/gtkext/gtkgraphview.c @@ -128,6 +128,7 @@ static void gtk_graph_view_class_init(GtkGraphViewClass *class)      panel_class->adjust = (adjust_scroll_value_fc)gtk_graph_view_adjust_scroll_value;      panel_class->define = (define_address_fc)gtk_graph_view_define_main_address;      panel_class->get_coordinates = (get_addr_coordinates_fc)gtk_graph_view_get_address_coordinates; +    panel_class->cache_glance = (cache_glance_fc)gtk_graph_view_cache_glance;  } @@ -148,13 +149,11 @@ static void gtk_graph_view_init(GtkGraphView *view)  {      GtkViewPanel *viewpanel;                /* Instance parente #1         */      //GtkBinView *binview;                    /* Instance parente #2         */ -    GdkColor white;                         /* Couleur de fond normale     */      viewpanel = GTK_VIEW_PANEL(view);      viewpanel->resize = (prepare_resize_fc)gtk_graph_view_prepare_resize;      ////////viewpanel->get_coordinates = (get_addr_coordinates_fc)gtk_graph_view_get_address_coordinates; -    viewpanel->cache_glance = (cache_glance_fc)gtk_graph_view_cache_glance;      //binview = GTK_BIN_VIEW(view); diff --git a/src/gtkext/gtksourceview.c b/src/gtkext/gtksourceview.c index 0b008fa..113b9bb 100644 --- a/src/gtkext/gtksourceview.c +++ b/src/gtkext/gtksourceview.c @@ -80,6 +80,11 @@ G_DEFINE_TYPE(GtkSourceView, gtk_source_view, GTK_TYPE_BUFFER_VIEW)  static void gtk_source_view_class_init(GtkSourceViewClass *class)  { +    GtkViewPanelClass *panel_class;         /* Classe parente              */ + +    panel_class = GTK_VIEW_PANEL_CLASS(class); + +    panel_class->attach = (attach_binary_fc)gtk_source_view_attach_binary;  } @@ -98,11 +103,6 @@ static void gtk_source_view_class_init(GtkSourceViewClass *class)  static void gtk_source_view_init(GtkSourceView *view)  { -    GtkViewPanel *panel;                    /* Instance parente            */ - -    panel = GTK_VIEW_PANEL(view); - -    panel->attach = (attach_binary_fc)gtk_source_view_attach_binary;  } diff --git a/src/gtkext/gtkviewpanel-int.h b/src/gtkext/gtkviewpanel-int.h index 07ce6e9..10ae933 100644 --- a/src/gtkext/gtkviewpanel-int.h +++ b/src/gtkext/gtkviewpanel-int.h @@ -33,6 +33,9 @@ +/* Prend acte de l'association d'un binaire chargé. */ +typedef void (* attach_binary_fc) (GtkViewPanel *, GLoadedBinary *); +  /* Indique les dimensions de travail du composant d'affichage. */  typedef void (* compute_requested_size_fc) (GtkViewPanel *, gint *, gint *); @@ -42,9 +45,6 @@ typedef void (* compute_scroll_inc_fc) (GtkViewPanel *, gint, GtkOrientation, gd  /* Réagit à un défilement chez une barre associée au composant. */  typedef void (* adjust_scroll_value_fc) (GtkViewPanel *, GtkAdjustment *, GtkOrientation); -/* Prend acte de l'association d'un binaire chargé. */ -typedef void (* attach_binary_fc) (GtkViewPanel *, GLoadedBinary *); -  /* Réagit à la sélection externe d'une adresse. */  typedef void (* define_address_fc) (GtkViewPanel *, const vmpa2t *); @@ -78,10 +78,8 @@ struct _GtkViewPanel      GLoadedBinary *binary;                  /* Binaire à visualiser        */ -    attach_binary_fc attach;                /* Association avec un binaire */      //define_address_fc define;               /* Centrage sur une partie     */      prepare_resize_fc resize;               /* Prépare une nouvelle taille */ -    cache_glance_fc cache_glance;           /* Cache de la mignature       */  }; @@ -90,12 +88,14 @@ struct _GtkViewPanelClass  {      GtkFixedClass parent;                   /* A laisser en premier        */ +    attach_binary_fc attach;                /* Association avec un binaire */      compute_requested_size_fc compute_size; /* Calcul de la taille requise */      compute_scroll_inc_fc compute_inc;      /* Calcul des bonds            */      adjust_scroll_value_fc adjust;          /* Réaction à un défilement    */      define_address_fc define;               /* Centrage sur une partie     */      get_addr_coordinates_fc get_coordinates;/* Conversion adresse <-> pos. */      get_view_position_fc get_position;      /* Indications sur la position */ +    cache_glance_fc cache_glance;           /* Cache de la mignature       */  }; diff --git a/src/gtkext/gtkviewpanel.c b/src/gtkext/gtkviewpanel.c index 1496056..a85853b 100644 --- a/src/gtkext/gtkviewpanel.c +++ b/src/gtkext/gtkviewpanel.c @@ -737,8 +737,8 @@ void gtk_view_panel_attach_binary(GtkViewPanel *panel, GLoadedBinary *binary, Bi      panel->content = view;      panel->display = g_loaded_binary_get_column_display(binary, view); -    if (panel->attach != NULL) /* REMME */ -        panel->attach(panel, binary); +    if (GTK_VIEW_PANEL_GET_CLASS(panel)->attach != NULL) /* REMME */ +        GTK_VIEW_PANEL_GET_CLASS(panel)->attach(panel, binary);      g_signal_connect(binary, "display-changed", G_CALLBACK(on_view_panel_binary_display_change), panel); @@ -937,7 +937,7 @@ bool gtk_view_panel_get_position(const GtkViewPanel *panel, GBufferLine **line,  void gtk_view_panel_cache_glance(GtkViewPanel *panel, cairo_t *cairo, const GtkAllocation *area, double scale)  { -    if (panel->cache_glance != NULL) -        panel->cache_glance(panel, cairo, area, scale); +    if (GTK_VIEW_PANEL_GET_CLASS(panel)->cache_glance != NULL) +        GTK_VIEW_PANEL_GET_CLASS(panel)->cache_glance(panel, cairo, area, scale);  }  | 
