diff options
Diffstat (limited to 'src/project.c')
-rw-r--r-- | src/project.c | 91 |
1 files changed, 27 insertions, 64 deletions
diff --git a/src/project.c b/src/project.c index 5bb7b56..2fa2750 100644 --- a/src/project.c +++ b/src/project.c @@ -34,36 +34,34 @@ #include "gtkext/gtkblockview.h" #include "gtkext/gtkdockpanel.h" #include "gtkext/gtkgraphview.h" +#include "gtkext/gtkviewpanel.h" #include "panels/panel.h" +/* ----------------------- CACHE INTERMEDIAIRE D'ASSOCIATIONS ----------------------- */ + /* Conservation d'un binaire chargé */ typedef struct _loaded_binary { GOpenidaBinary *binary; /* Binaire en question */ - - bool lines_set; /* Construction complète */ - GMutex *mutex; /* Accès à la variable */ - GCond *cond; /* Attente de changement */ - GtkWidget *views[BVW_COUNT]; /* Composants pour l'affichage */ } loaded_binary; /* Met en place un nouveau binaire pour un projet. */ -loaded_binary *load_openida_binary(GOpenidaBinary *); - -/* Prend note de la fin d'une construction d'une visualisation. */ -static void notify_loaded_binary(GtkBinView *, loaded_binary *); +static loaded_binary *load_openida_binary(GOpenidaBinary *); /* Fournit un support d'affichage donné pour un binaire chargé. */ GtkWidget *get_loaded_binary_view(const loaded_binary *, BinaryView); +/* --------------------------- GESTION D'UN PROJET ENTIER --------------------------- */ + + /* Propriétés d'un ensemble de fichiers ouverts */ @@ -91,6 +89,9 @@ void display_new_binary_of_openida_project(GOpenidaBinary *, openida_project *); +/* ---------------------------------------------------------------------------------- */ +/* CACHE INTERMEDIAIRE D'ASSOCIATIONS */ +/* ---------------------------------------------------------------------------------- */ /****************************************************************************** @@ -105,68 +106,55 @@ void display_new_binary_of_openida_project(GOpenidaBinary *, openida_project *); * * ******************************************************************************/ -loaded_binary *load_openida_binary(GOpenidaBinary *binary) +static loaded_binary *load_openida_binary(GOpenidaBinary *binary) { loaded_binary *result; /* Structure à renvoyer */ BinaryView i; /* Boucle de parcours */ - GtkWidget *scrolledwindow; /* Surface d'exposition */ GtkWidget *view; /* Affichage du binaire */ + GtkWidget *scrolledwindow; /* Surface d'exposition */ result = (loaded_binary *)calloc(1, sizeof(loaded_binary)); result->binary = binary; - result->mutex = g_mutex_new(); - result->cond = g_cond_new(); - for (i = 0; i < BVW_COUNT; i++) { /* Préparation du support */ gdk_threads_enter(); - scrolledwindow = qck_create_scrolled_window(NULL, NULL); - switch (i) { - default: /* GCC ! */ case BVW_BLOCK: view = gtk_block_view_new(MRD_BLOCK); break; case BVW_GRAPH: view = gtk_graph_view_new(); break; + case BVW_SOURCE: + view = gtk_source_view_new(); + break; + default: /* GCC ! */ + break; } - gdk_flush (); - gdk_threads_leave(); - - result->lines_set = false; - - g_signal_connect(view, "lines-set", G_CALLBACK(notify_loaded_binary), result); - - gtk_bin_view_set_rendering_lines(GTK_BIN_VIEW(view), binary, - g_openida_binary_get_lines(binary), NULL); + gtk_widget_show(view); - /* Attente de la fin de construction */ - g_mutex_lock(result->mutex); - while (!result->lines_set) - g_cond_wait(result->cond, result->mutex); - g_mutex_unlock(result->mutex); + gdk_flush(); + gdk_threads_leave(); - g_signal_handlers_disconnect_by_func(view, G_CALLBACK(notify_loaded_binary), result); + gtk_view_panel_attach_binary(GTK_VIEW_PANEL(view), binary); /* Intégration finale */ gdk_threads_enter(); - gtk_widget_show(view); - + scrolledwindow = qck_create_scrolled_window(NULL, NULL); gtk_container_add(GTK_CONTAINER(scrolledwindow), view); result->views[i] = scrolledwindow; - gdk_flush (); + gdk_flush(); gdk_threads_leave(); } @@ -176,29 +164,6 @@ loaded_binary *load_openida_binary(GOpenidaBinary *binary) } -/****************************************************************************** -* * -* Paramètres : view = composant d'affichage prêt à utilisation. * -* binary = binaire chargé et encadré. * -* * -* Description : Prend note de la fin d'une construction d'une visualisation. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void notify_loaded_binary(GtkBinView *view, loaded_binary *binary) -{ - g_mutex_lock(binary->mutex); - - binary->lines_set = true; - - g_cond_signal(binary->cond); - g_mutex_unlock(binary->mutex); - -} @@ -591,7 +556,7 @@ GDockItem *gtk_dock_panel_get_item_from_binary(const openida_project *project, G * Paramètres : project = projet à consulter. * * binary = binaire chargé, encadré et concerné. * * view = type d'affichage requis. * -* binview = afficheur effectif de code binaire. [OUT] * +* panel = afficheur effectif quelconque. [OUT] * * * * Description : Fournit un support d'affichage donné pour un binaire chargé. * * * @@ -601,7 +566,7 @@ GDockItem *gtk_dock_panel_get_item_from_binary(const openida_project *project, G * * ******************************************************************************/ -GtkWidget *get_view_for_openida_project_binary(const openida_project *project, const GOpenidaBinary *binary, BinaryView view, GtkBinView **binview) +GtkWidget *get_view_for_openida_project_binary(const openida_project *project, const GOpenidaBinary *binary, BinaryView view, GtkViewPanel **panel) { GtkWidget *result; /* Composant GTK à retourner */ size_t i; /* Boucle de parcours */ @@ -612,7 +577,7 @@ GtkWidget *get_view_for_openida_project_binary(const openida_project *project, c if (project->binaries[i]->binary == binary) { result = get_loaded_binary_view(project->binaries[i], view); - *binview = GTK_BIN_VIEW(gtk_bin_get_child(result)); + *panel = GTK_VIEW_PANEL(gtk_bin_get_child(result)); break; } @@ -799,10 +764,9 @@ void display_openida_project(const openida_project *project, GObject *ref) { GtkDockPanel *dpanel; /* Support de panneaux */ size_t i; /* Boucle de parcours */ - GOpenidaBinary *binary; + GOpenidaBinary *binary; /* Binaire chargé */ GtkWidget *view; /* Affichage du code binaire */ GDockItem *ditem; /* Panneau avec ses infos. */ - GtkBinView *binview; /* Affichage à faire défiler */ dpanel = GTK_DOCK_PANEL(g_object_get_data(ref, "binpanel")); @@ -840,7 +804,6 @@ void display_new_binary_of_openida_project(GOpenidaBinary *binary, openida_proje GtkWidget *view; /* Affichage du code binaire */ char *title; /* Titre associé au binaire */ GDockItem *ditem; /* Panneau avec ses infos. */ - GtkBinView *binview; /* Affichage à faire défiler */ index = attach_binary_to_openida_project(project, binary); |