summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/menus/project.c94
-rw-r--r--src/gui/panels/glance.c47
-rw-r--r--src/gui/panels/panel.c4
-rw-r--r--src/gui/panels/welcome.c2
4 files changed, 124 insertions, 23 deletions
diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c
index dbf61bc..19ced97 100644
--- a/src/gui/menus/project.c
+++ b/src/gui/menus/project.c
@@ -33,10 +33,14 @@
#include "../editem-int.h"
#include "../../analysis/binaries/file.h"
+#include "../../dialogs/shellcode.h"
#include "../../gtkext/easygtk.h"
+/* Affiche la boîte d'ajout d'un shellcode au projet courant. */
+static void mcb_project_add_shellcode(GtkMenuItem *, GMenuBar *);
+
/* Affiche la boîte d'ajout d'un binaire au projet courant. */
static void mcb_project_add_binary_file(GtkMenuItem *, GMenuBar *);
@@ -79,6 +83,10 @@ GtkWidget *build_menu_project(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
deepmenubar = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenuitem), deepmenubar);
+ deepmenuitem = qck_create_menu_item(NULL, NULL, _("Shellcode"),
+ G_CALLBACK(mcb_project_add_shellcode), bar);
+ gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
+
deepmenuitem = qck_create_menu_item(NULL, NULL, _("File"),
G_CALLBACK(mcb_project_add_binary_file), bar);
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
@@ -163,6 +171,92 @@ void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project,
* Paramètres : menuitem = élément de menu sélectionné. *
* bar = barre de menu parente. *
* *
+* Description : Affiche la boîte d'ajout d'un shellcode au projet courant. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void mcb_project_add_shellcode(GtkMenuItem *menuitem, GMenuBar *bar)
+{
+ GStudyProject *project; /* Projet courant */
+ GtkWindow *parent; /* Respect de la hiérarchie */
+ GtkWidget *dialog; /* Boîte à afficher */
+
+ project = get_current_project();
+ parent = GTK_WINDOW(G_EDITOR_ITEM(bar)->ref);
+
+ dialog = NULL;
+
+ run_shellcode_assistant(project, parent);
+
+ //if (run_shellcode_assistant(project, parent)) == GTK_RESPONSE_ACCEPT)
+ {
+
+ ;
+
+
+ }
+
+#if 0
+ GtkWidget *dialog; /* Boîte à afficher */
+ char *dir; /* Répertoire courant */
+ gchar *filename; /* Nom du fichier à intégrer */
+ GLoadedBinary *binary; /* Représentation chargée */
+
+ dialog = gtk_file_chooser_dialog_new(_("Open a binary file"),
+ GTK_WINDOW(G_EDITOR_ITEM(bar)->ref),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ if (g_study_project_get_filename(get_current_project()) != NULL)
+ {
+ dir = strdup(g_study_project_get_filename(get_current_project()));
+ dir = dirname(dir);
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dir);
+ free(dir);
+ }
+
+ if (g_study_project_get_filename(get_current_project()) != NULL)
+ {
+ dir = strdup(g_study_project_get_filename(get_current_project()));
+ dir = dirname(dir);
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dir);
+ free(dir);
+ }
+
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
+ {
+ filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+
+ binary = g_file_binary_new_from_file(filename);
+
+ if (binary != NULL)
+ {
+ g_signal_connect(binary, "disassembly-done",
+ G_CALLBACK(g_study_project_add_loaded_binary), get_current_project());
+ g_loaded_binary_analyse(binary);
+ }
+
+ g_free(filename);
+
+ }
+
+ gtk_widget_destroy(dialog);
+#endif
+}
+
+
+
+/******************************************************************************
+* *
+* Paramètres : menuitem = élément de menu sélectionné. *
+* bar = barre de menu parente. *
+* *
* Description : Affiche la boîte d'ajout d'un binaire au projet courant. *
* *
* Retour : - *
diff --git a/src/gui/panels/glance.c b/src/gui/panels/glance.c
index d6a744e..b344e69 100644
--- a/src/gui/panels/glance.c
+++ b/src/gui/panels/glance.c
@@ -97,7 +97,7 @@ static void compute_glance_scale(GGlancePanel *);
static void update_glance_panel_for_view_content(GGlancePanel *, GtkViewPanel *);
/* Met à jour l'affichage de l'aperçu rapide à présenter. */
-static gboolean redraw_glance_area(GtkWidget *, GdkEventExpose *, GGlancePanel *);
+static gboolean redraw_glance_area(GtkWidget *, cairo_t *, GGlancePanel *);
/* Assure la gestion des clics de souris sur l'aperçu. */
static gboolean on_button_press_over_glance(GtkWidget *, GdkEventButton *, GGlancePanel *);
@@ -166,7 +166,7 @@ static void g_glance_panel_init(GGlancePanel *panel)
gtk_widget_set_size_request(base->widget, 300, 300);
- g_signal_connect(G_OBJECT(area), "expose_event",
+ g_signal_connect(G_OBJECT(area), "draw",
G_CALLBACK(redraw_glance_area), panel);
g_signal_connect(G_OBJECT(area), "size-allocate",
G_CALLBACK(on_glance_resize), panel);
@@ -221,13 +221,14 @@ GEditorItem *g_glance_panel_new(GObject *ref)
static void define_glance_bg(GtkWidget *widget, GGlancePanel *panel)
{
+ /*
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL,
&widget->style->mid[GTK_STATE_NORMAL]);
panel->red = widget->style->mid[GTK_STATE_NORMAL].red / USHRT_MAX;
panel->green = widget->style->mid[GTK_STATE_NORMAL].green / USHRT_MAX;
panel->blue = widget->style->mid[GTK_STATE_NORMAL].blue / USHRT_MAX;
-
+ */
}
@@ -332,7 +333,7 @@ static void on_view_scroll_setup(GtkAdjustment *adj, GGlancePanel *panel)
hadj = gtk_scrolled_window_get_hadjustment(panel->support);
vadj = gtk_scrolled_window_get_vadjustment(panel->support);
- if (hadj->page_size == 0 || vadj->page_size == 0)
+ if (gtk_adjustment_get_page_size(hadj) == 0 || gtk_adjustment_get_page_size(vadj) == 0)
return;
compute_glance_scale(panel);
@@ -367,13 +368,13 @@ static void on_view_scrolled(GtkAdjustment *adj, GGlancePanel *panel)
hadj = gtk_scrolled_window_get_hadjustment(panel->support);
vadj = gtk_scrolled_window_get_vadjustment(panel->support);
- if (hadj->page_size == 0 || vadj->page_size == 0)
+ if (gtk_adjustment_get_page_size(hadj) == 0 || gtk_adjustment_get_page_size(vadj) == 0)
return;
- panel->visible.x = panel->painting.x + hadj->value * panel->scale;
- panel->visible.y = panel->painting.y + vadj->value * panel->scale;
- panel->visible.width = hadj->page_size * panel->scale;
- panel->visible.height = vadj->page_size * panel->scale;
+ panel->visible.x = panel->painting.x + gtk_adjustment_get_value(hadj) * panel->scale;
+ panel->visible.y = panel->painting.y + gtk_adjustment_get_value(vadj) * panel->scale;
+ panel->visible.width = gtk_adjustment_get_page_size(hadj) * panel->scale;
+ panel->visible.height = gtk_adjustment_get_page_size(vadj) * panel->scale;
gtk_widget_queue_draw(G_EDITOR_ITEM(panel)->widget);
@@ -427,7 +428,7 @@ static void compute_glance_scale(GGlancePanel *panel)
/* Superficies niveau GTK... */
gtk_widget_get_allocation(G_EDITOR_ITEM(panel)->widget, &available);
-
+ /*
border = MIN(2, G_EDITOR_ITEM(panel)->widget->style->xthickness);
if (border > 0)
{
@@ -441,7 +442,7 @@ static void compute_glance_scale(GGlancePanel *panel)
available.y = border;
available.height -= 2 * border;
}
-
+ */
/* Calcul des ratios et emplacements */
sx = (1.0 * available.width) / panel->req.width;
@@ -514,7 +515,7 @@ static void update_glance_panel_for_view_content(GGlancePanel *panel, GtkViewPan
/******************************************************************************
* *
* Paramètres : widget = composant GTK à redessiner. *
-* event = informations liées à l'événement. *
+* cr = contexte graphique liées à l'événement. *
* panel = informations liées au panneau associé. *
* *
* Description : Met à jour l'affichage de l'aperçu rapide à présenter. *
@@ -525,11 +526,11 @@ static void update_glance_panel_for_view_content(GGlancePanel *panel, GtkViewPan
* *
******************************************************************************/
-static gboolean redraw_glance_area(GtkWidget *widget, GdkEventExpose *event, GGlancePanel *panel)
+static gboolean redraw_glance_area(GtkWidget *widget, cairo_t *cr, GGlancePanel *panel)
{
GtkAllocation available; /* Surface disponible totale */
cairo_t *cairo; /* Gestionnaire de rendu */
-
+#if 0
/* Dessin de la bordure */
gtk_widget_get_allocation(widget, &available);
@@ -564,7 +565,7 @@ static gboolean redraw_glance_area(GtkWidget *widget, GdkEventExpose *event, GGl
cairo_destroy(cairo);
}
-
+#endif
return TRUE;
}
@@ -598,8 +599,8 @@ static gboolean on_button_press_over_glance(GtkWidget *widget, GdkEventButton *e
hadj = gtk_scrolled_window_get_hadjustment(panel->support);
vadj = gtk_scrolled_window_get_vadjustment(panel->support);
- panel->ref_h = hadj->value;
- panel->ref_v = vadj->value;
+ panel->ref_h = gtk_adjustment_get_value(hadj);
+ panel->ref_v = gtk_adjustment_get_value(vadj);
panel->valid = (panel->visible.x <= panel->start_x
&& panel->start_x < (panel->visible.x + panel->visible.width)
@@ -609,8 +610,8 @@ static gboolean on_button_press_over_glance(GtkWidget *widget, GdkEventButton *e
if (panel->valid)
{
cursor = gdk_cursor_new(GDK_FLEUR);
- gdk_window_set_cursor(widget->window, cursor);
- gdk_cursor_unref(cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
+ g_object_unref(G_OBJECT(cursor));
}
}
@@ -639,7 +640,7 @@ static gboolean on_button_release_over_glance(GtkWidget *widget, GdkEventButton
if (panel->view != NULL && event->button == 1)
{
if (panel->valid)
- gdk_window_set_cursor(widget->window, NULL);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), NULL);
}
@@ -678,10 +679,12 @@ static gboolean on_mouse_motion_over_glance(GtkWidget *widget, GdkEventMotion *e
hadj = gtk_scrolled_window_get_hadjustment(panel->support);
vadj = gtk_scrolled_window_get_vadjustment(panel->support);
- value = CLAMP(panel->ref_h + diff_x, hadj->lower, hadj->upper - hadj->page_size);
+ value = CLAMP(panel->ref_h + diff_x, gtk_adjustment_get_lower(hadj),
+ gtk_adjustment_get_upper(hadj) - gtk_adjustment_get_page_size(hadj));
gtk_adjustment_set_value(hadj, value);
- value = CLAMP(panel->ref_v + diff_y, vadj->lower, vadj->upper - vadj->page_size);
+ value = CLAMP(panel->ref_v + diff_y, gtk_adjustment_get_lower(vadj),
+ gtk_adjustment_get_upper(vadj) - gtk_adjustment_get_page_size(vadj));
gtk_adjustment_set_value(vadj, value);
}
diff --git a/src/gui/panels/panel.c b/src/gui/panels/panel.c
index b178443..a883bfa 100644
--- a/src/gui/panels/panel.c
+++ b/src/gui/panels/panel.c
@@ -41,6 +41,10 @@
+/* Transition vers GTK-3.x claire */
+#define GTK_IS_HPANED(p) gtk_orientable_get_orientation(GTK_ORIENTABLE(p)) == GTK_ORIENTATION_HORIZONTAL
+
+
/* Support de fond pour les composants. */
static GtkWidget *_support;
static panel_node *_nodes = NULL;
diff --git a/src/gui/panels/welcome.c b/src/gui/panels/welcome.c
index 018f12a..8825c52 100644
--- a/src/gui/panels/welcome.c
+++ b/src/gui/panels/welcome.c
@@ -110,7 +110,7 @@ static void g_welcome_panel_init(GWelcomePanel *panel)
GEditorItem *base; /* Version basique d'instance */
support = gtk_handle_box_new();
- gtk_widget_modify_bg(support, GTK_STATE_NORMAL, &support->style->bg[GTK_STATE_NORMAL]);
+ //gtk_widget_modify_bg(support, GTK_STATE_NORMAL, &support->style->bg[GTK_STATE_NORMAL]);
gtk_widget_show(support);
align = gtk_alignment_new(0.5f, 0.5f, 0.0f, 0.0f);