diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-01-30 02:19:38 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-01-30 02:19:38 (GMT) |
commit | eacb69625d51707ac0a158815a53f71fb70968ce (patch) | |
tree | 8d14e34639f80a0955529604d9c0d3ccae4d7dde /src/project.c | |
parent | 7bcec72d69c5350678ed6350636687c3c29bbc61 (diff) |
Provided a new working Project menu.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@230 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/project.c')
-rw-r--r-- | src/project.c | 113 |
1 files changed, 71 insertions, 42 deletions
diff --git a/src/project.c b/src/project.c index f2b02ec..47bbe3e 100644 --- a/src/project.c +++ b/src/project.c @@ -80,11 +80,6 @@ static void g_study_project_class_init(GStudyProjectClass *); /*Initialise une instance de projet d'étude. */ static void g_study_project_init(GStudyProject *); -/* Assure l'intégration d'un élément binaire dans un projet. */ -static void g_study_project_add_loaded_binary(GOpenidaBinary *, GStudyProject *); - - - /* ---------------------------------------------------------------------------------- */ @@ -225,43 +220,6 @@ GStudyProject *g_study_project_open(const char *filename) /****************************************************************************** * * -* Paramètres : binary = élément binaire tout juste désassemblé. * -* project = projet dont le contenu est à compléter. * -* * -* Description : Assure l'intégration d'un élément binaire dans un projet. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_study_project_add_loaded_binary(GOpenidaBinary *binary, GStudyProject *project) -{ - size_t index; /* Indice du nouveau binaire */ - GtkWidget *view; /* Affichage du code binaire */ - const char *title; /* Titre associé au binaire */ - GEditorItem *item; /* Panneau avec ses infos. */ - - index = g_study_project_attach_binary(project, binary); - - view = project->binaries[index]->scrollwindows[BVW_BLOCK]; - - title = g_openida_binary_to_string(binary); - - //gdk_threads_enter(); - - item = g_panel_item_new(strrchr(title, G_DIR_SEPARATOR) + 1, title, view, "M"); - g_panel_item_dock(G_PANEL_ITEM(item)); - - //gdk_flush (); - //gdk_threads_leave(); - -} - - -/****************************************************************************** -* * * Paramètres : project = project à sauvegarder. * * filename = nom de fichier à utiliser ou NULL pour l'existant.* * * @@ -341,6 +299,43 @@ const char *g_study_project_get_filename(const GStudyProject *project) /****************************************************************************** * * +* Paramètres : binary = élément binaire tout juste désassemblé. * +* project = projet dont le contenu est à compléter. * +* * +* Description : Assure l'intégration d'un élément binaire dans un projet. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_study_project_add_loaded_binary(GOpenidaBinary *binary, GStudyProject *project) +{ + size_t index; /* Indice du nouveau binaire */ + GtkWidget *view; /* Affichage du code binaire */ + const char *title; /* Titre associé au binaire */ + GEditorItem *item; /* Panneau avec ses infos. */ + + index = g_study_project_attach_binary(project, binary); + + view = project->binaries[index]->scrollwindows[BVW_BLOCK]; + + title = g_openida_binary_to_string(binary); + + //gdk_threads_enter(); + + item = g_panel_item_new(strrchr(title, G_DIR_SEPARATOR) + 1, title, view, "M"); + g_panel_item_dock(G_PANEL_ITEM(item)); + + //gdk_flush (); + //gdk_threads_leave(); + +} + + +/****************************************************************************** +* * * Paramètres : project = project à effacer de la mémoire. * * binary = fichier binaire à associer au projet actuel. * * * @@ -420,6 +415,7 @@ size_t g_study_project_attach_binary(GStudyProject *project, GOpenidaBinary *bin g_mutex_unlock(project->mutex); + update_project_area(project); return result; @@ -459,6 +455,8 @@ void g_study_project_detach_binary(GStudyProject *project, GOpenidaBinary *binar project->binaries = (loaded_binary **)realloc(project->binaries, --project->binaries_count * sizeof(loaded_binary *)); + update_project_area(project); + } @@ -533,6 +531,37 @@ void g_study_project_display(const GStudyProject *project) } +/****************************************************************************** +* * +* Paramètres : project = projet dont le contenu est à afficher. * +* count = nombre de binaires pris en compte. [OUT] * +* * +* Description : Fournit l'ensemble des binaires associés à un projet. * +* * +* Retour : Liste à libérer de la mémoire. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GOpenidaBinary **g_study_project_get_binaries(const GStudyProject *project, size_t *count) +{ + GOpenidaBinary **result; /* Tableau à retourner */ + size_t i; /* Boucle de parcours */ + + *count = project->binaries_count; + result = (GOpenidaBinary **)calloc(*count, sizeof(GOpenidaBinary *)); + + for (i = 0; i < *count; i++) + { + result[i] = project->binaries[i]->binary; + g_object_ref(G_OBJECT(result[i])); + } + + return result; + +} + /* ---------------------------------------------------------------------------------- */ /* GESTION GLOBALISEE DES PROJETS */ |