Revision: 2212 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2212&view=re... Author: cesspit Date: 2011-09-25 08:32:05 +0000 (Sun, 25 Sep 2011) Log Message: ----------- debugger: grouping locals and arguments on a autos page, autos an watch icons, grouping pixbufs in a separate file
Modified Paths: -------------- trunk/geany-plugins/debugger/img/tabs.gif trunk/geany-plugins/debugger/src/Makefile.am trunk/geany-plugins/debugger/src/bptree.c trunk/geany-plugins/debugger/src/dbm_gdb.c trunk/geany-plugins/debugger/src/debug.c trunk/geany-plugins/debugger/src/debug_module.c trunk/geany-plugins/debugger/src/debug_module.h trunk/geany-plugins/debugger/src/pconfig.c trunk/geany-plugins/debugger/src/plugin.c trunk/geany-plugins/debugger/src/stree.c trunk/geany-plugins/debugger/src/tabs.c trunk/geany-plugins/debugger/src/tabs.h trunk/geany-plugins/debugger/src/vtree.c trunk/geany-plugins/debugger/src/watch_model.c trunk/geany-plugins/debugger/src/watch_model.h trunk/geany-plugins/debugger/src/wtree.c trunk/geany-plugins/debugger/src/xpm/Makefile.am
Added Paths: ----------- trunk/geany-plugins/debugger/src/atree.c trunk/geany-plugins/debugger/src/atree.h trunk/geany-plugins/debugger/src/pixbuf.c trunk/geany-plugins/debugger/src/pixbuf.h trunk/geany-plugins/debugger/src/xpm/argument.xpm trunk/geany-plugins/debugger/src/xpm/local.xpm trunk/geany-plugins/debugger/src/xpm/watch.xpm
Removed Paths: ------------- trunk/geany-plugins/debugger/src/ltree.c trunk/geany-plugins/debugger/src/ltree.h
Modified: trunk/geany-plugins/debugger/img/tabs.gif =================================================================== (Binary files differ)
Modified: trunk/geany-plugins/debugger/src/Makefile.am =================================================================== --- trunk/geany-plugins/debugger/src/Makefile.am 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/Makefile.am 2011-09-25 08:32:05 UTC (rev 2212) @@ -39,10 +39,12 @@ gui.c \ keys.c \ keys.h \ - ltree.c \ - ltree.h \ + atree.c \ + atree.h \ markers.c \ markers.h \ + pixbuf.c \ + pixbuf.h \ pconfig.c \ pconfig.h \ plugin.c \
Added: trunk/geany-plugins/debugger/src/atree.c =================================================================== --- trunk/geany-plugins/debugger/src/atree.c (rev 0) +++ trunk/geany-plugins/debugger/src/atree.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -0,0 +1,46 @@ +/* + * atree.c + * + * Copyright 2010 Alexander Petukhov <devel(at)apetukhov.ru> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +/* + * Contains autos tree view functions. + */ + +#include <gtk/gtk.h> + +#include "watch_model.h" +#include "vtree.h" + +/* pointer to a widget */ +static GtkWidget *tree = NULL; + +/* + * init autos tree, and sets on expanded handler + * arguments: + * expanded - handler to call when tree item is expanded + */ +GtkWidget* atree_init(watch_expanded_callback expanded, watch_button_pressed buttonpressed) +{ + tree = vtree_create(NULL, NULL); + g_signal_connect(G_OBJECT(tree), "row-expanded", G_CALLBACK (expanded), NULL); + g_signal_connect(G_OBJECT(tree), "button-press-event", G_CALLBACK (buttonpressed), NULL); + + return tree; +}
Added: trunk/geany-plugins/debugger/src/atree.h =================================================================== --- trunk/geany-plugins/debugger/src/atree.h (rev 0) +++ trunk/geany-plugins/debugger/src/atree.h 2011-09-25 08:32:05 UTC (rev 2212) @@ -0,0 +1,23 @@ +/* + * atree.h + * + * Copyright 2010 Alexander Petukhov <devel(at)apetukhov.ru> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +GtkWidget* atree_init(watch_expanded_callback expanded, watch_button_pressed buttonpressed); +
Modified: trunk/geany-plugins/debugger/src/bptree.c =================================================================== --- trunk/geany-plugins/debugger/src/bptree.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/bptree.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -40,11 +40,8 @@ #include "utils.h" #include "dconfig.h" #include "tabs.h" +#include "pixbuf.h"
-#include "xpm/breakpoint.xpm" -#include "xpm/breakpoint_disabled.xpm" -#include "xpm/breakpoint_condition.xpm" - /* Tree view columns */ enum { @@ -74,12 +71,6 @@ /* hash table to keep file nodes in the tree */ static GHashTable *files;
-/* pixbufers */ -GdkPixbuf *file_pixbuf = NULL; -GdkPixbuf *break_pixbuf = NULL; -GdkPixbuf *break_disabled_pixbuf = NULL; -GdkPixbuf *break_condition_pixbuf = NULL; - /* callback handler */ move_to_line_cb on_break_clicked = NULL;
@@ -545,11 +536,6 @@ (GDestroyNotify)gtk_tree_row_reference_free ); - file_pixbuf = gdk_pixbuf_new_from_xpm_data(breakpoint_xpm); - break_pixbuf = gdk_pixbuf_new_from_xpm_data(breakpoint_xpm); - break_disabled_pixbuf = gdk_pixbuf_new_from_xpm_data(breakpoint_disabled_xpm); - break_condition_pixbuf = gdk_pixbuf_new_from_xpm_data(breakpoint_condition_xpm); - /* create tree view */ store = gtk_tree_store_new ( N_COLUMNS, @@ -645,11 +631,6 @@ void bptree_destroy() { g_hash_table_destroy(files); - - g_object_unref(file_pixbuf); - g_object_unref(break_pixbuf); - g_object_unref(break_disabled_pixbuf); - g_object_unref(break_condition_pixbuf); }
/*
Modified: trunk/geany-plugins/debugger/src/dbm_gdb.c =================================================================== --- trunk/geany-plugins/debugger/src/dbm_gdb.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/dbm_gdb.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -96,8 +96,8 @@ /* flag, showing that on debugger stop we have to call a callback */ gboolean requested_interrupt = FALSE;
-/* locals list */ -static GList *locals = NULL; +/* autos list */ +static GList *autos = NULL;
/* watches list */ static GList *watches = NULL; @@ -113,7 +113,7 @@ void stop(); variable* add_watch(gchar* expression); void update_watches(); -void update_locals(); +void update_autos(); void update_files();
/* list of start messages, to show them in init if initialization is successfull */ @@ -176,10 +176,10 @@ shutdown_channel(&gdb_ch_in); shutdown_channel(&gdb_ch_out); - /* delete locals */ - g_list_foreach(locals, (GFunc)g_free, NULL); - g_list_free(locals); - locals = NULL; + /* delete autos */ + g_list_foreach(autos, (GFunc)g_free, NULL); + g_list_free(autos); + autos = NULL; /* delete watches */ g_list_foreach(watches, (GFunc)g_free, NULL); @@ -296,8 +296,8 @@ /* removing read callback (will pulling all output left manually) */ g_source_remove(gdb_id_out);
- /* update locals */ - update_locals(); + /* update autos */ + update_autos();
/* update watches */ update_watches(); @@ -633,7 +633,7 @@ { gchar *name = (gchar*)witer->data;
- variable *var = variable_new(name); + variable *var = variable_new(name, VT_WATCH); watches = g_list_append(watches, var); witer = witer->next; @@ -1239,14 +1239,14 @@ }
/* - * updates locals list + * updates autos list */ -void update_locals() +void update_autos() { gchar command[1000];
- /* remove all previous GDB variables for locals */ - GList *iter = locals; + /* remove all previous GDB variables for autos */ + GList *iter = autos; while (iter) { variable *var = (variable*)iter->data; @@ -1257,68 +1257,73 @@ iter = iter->next; }
- g_list_foreach(locals, (GFunc)variable_free, NULL); - g_list_free(locals); - locals = NULL; + g_list_foreach(autos, (GFunc)variable_free, NULL); + g_list_free(autos); + autos = NULL; - /* add current locals to the list */ - gchar *record = NULL; - result_class rc = exec_sync_command("-stack-list-locals 0", TRUE, &record); - if (RC_DONE != rc) - return; - + /* add current autos to the list */ GList *unevaluated = NULL; - - gchar *pos = record; - while ((pos = strstr(pos, "name=""))) + + const char *gdb_commands[] = { "-stack-list-arguments 0 0 0", "-stack-list-locals 0" }; + int i, size = sizeof (gdb_commands) / sizeof(char*); + for (i = 0; i < size; i++) { - pos += strlen("name=""); - *(strchr(pos, '"')) = '\0'; + gchar *record = NULL; + result_class rc = exec_sync_command(gdb_commands[i], TRUE, &record); + if (RC_DONE != rc) + break;
- variable *var = variable_new(pos); + gchar *pos = record; + while ((pos = strstr(pos, "name=""))) + { + pos += strlen("name=""); + *(strchr(pos, '"')) = '\0';
- /* create new gdb variable */ - gchar *create_record = NULL; - - gchar *escaped = g_strescape(pos, NULL); - sprintf(command, "-var-create - * "%s"", escaped); - g_free(escaped); + variable *var = variable_new(pos, i ? VT_LOCAL : VT_ARGUMENT);
- /* form new variable */ - if (RC_DONE == exec_sync_command(command, TRUE, &create_record)) - { - gchar *intname = strstr(create_record, "name="") + strlen ("name=""); - *strchr(intname, '"') = '\0'; - var->evaluated = TRUE; - g_string_assign(var->internal, intname); - locals = g_list_append(locals, var); + /* create new gdb variable */ + gchar *create_record = NULL; + + gchar *escaped = g_strescape(pos, NULL); + sprintf(command, "-var-create - * "%s"", escaped); + g_free(escaped);
- g_free(create_record); + /* form new variable */ + if (RC_DONE == exec_sync_command(command, TRUE, &create_record)) + { + gchar *intname = strstr(create_record, "name="") + strlen ("name=""); + *strchr(intname, '"') = '\0'; + var->evaluated = TRUE; + g_string_assign(var->internal, intname); + autos = g_list_append(autos, var); + + g_free(create_record); + } + else + { + var->evaluated = FALSE; + g_string_assign(var->internal, ""); + unevaluated = g_list_append(unevaluated, var); + } + + pos += strlen(pos) + 1; } - else - { - var->evaluated = FALSE; - g_string_assign(var->internal, ""); - unevaluated = g_list_append(unevaluated, var); - } - - pos += strlen(pos) + 1; + g_free(record); } - g_free(record); - - /* get values for the locals (without incorrect variables) */ - get_variables(locals); + /* get values for the autos (without incorrect variables) */ + get_variables(autos); + /* add incorrect variables */ - locals = g_list_concat(locals, unevaluated); + autos = g_list_concat(autos, unevaluated); }
/* - * get locals list + * get autos list */ -GList* get_locals () +GList* get_autos () { - return g_list_copy(locals); + return g_list_copy(autos); }
/* @@ -1383,7 +1388,7 @@ name = g_strcompress(pos); - variable *var = variable_new2(name, internal); + variable *var = variable_new2(name, internal, VT_CHILD); var->evaluated = TRUE; pos += strlen(pos) + 1; @@ -1407,7 +1412,7 @@ { gchar command[1000];
- variable *var = variable_new(expression); + variable *var = variable_new(expression, VT_WATCH); watches = g_list_append(watches, var);
/* try to create a variable */
Modified: trunk/geany-plugins/debugger/src/debug.c =================================================================== --- trunk/geany-plugins/debugger/src/debug.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/debug.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -53,7 +53,7 @@ #include "stree.h" #include "watch_model.h" #include "wtree.h" -#include "ltree.h" +#include "atree.h" #include "tpage.h" #include "calltip.h" #include "bptree.h" @@ -119,17 +119,17 @@ static GtkAdjustment *hadj = NULL; static GtkAdjustment *vadj = NULL;
-/* stack trace/watch/locals CtkTreeView widgets */ +/* stack trace/watch/autos CtkTreeView widgets */ static GtkWidget *stree = NULL; static GtkWidget *wtree = NULL; -static GtkWidget *ltree = NULL; +static GtkWidget *atree = NULL;
/* watch tree view model and store */ GtkTreeStore *wstore = NULL; GtkTreeModel *wmodel = NULL;
/* array of widgets, ti enable/disable regard of a debug state */ -static GtkWidget **sensitive_widget[] = {&stree, &wtree, <ree, NULL}; +static GtkWidget **sensitive_widget[] = {&stree, &wtree, &atree, NULL};
/* * current stack for holding @@ -468,7 +468,7 @@ }
/* - * mouse button has been pressed while being in watch(locals) tree view + * mouse button has been pressed while being in watch(autos) tree view */ gboolean on_watch_button_pressed_callback(GtkWidget *treeview, GdkEventButton *event, gpointer userdata) { @@ -520,7 +520,7 @@ */ static void on_watch_expanded_callback(GtkTreeView *tree, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) { - /* get tree view model and store as it can be watch or locals tree */ + /* get tree view model and store as it can be watch or autos tree */ GtkTreeModel *model = gtk_tree_view_get_model(tree); GtkTreeStore *store = GTK_TREE_STORE(model); @@ -713,9 +713,9 @@ } g_list_free(files);
- /* locals */ - GList *locals = active_module->get_locals(); - update_variables(GTK_TREE_VIEW(ltree), NULL, locals); + /* autos */ + GList *autos = active_module->get_autos(); + update_variables(GTK_TREE_VIEW(atree), NULL, autos); /* watches */ GList *watches = active_module->get_watches(); @@ -759,8 +759,8 @@ /* clear watch page */ clear_watch_values(GTK_TREE_VIEW(wtree)); - /* clear locals page */ - gtk_tree_store_clear(GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ltree)))); + /* clear autos page */ + gtk_tree_store_clear(GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(atree))));
/* clear stack trace tree */ stree_clear(); @@ -888,16 +888,16 @@ GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(tab_watch), wtree);
- /* create locals page */ - ltree = ltree_init(on_watch_expanded_callback, on_watch_button_pressed_callback); - tab_locals = gtk_scrolled_window_new( - gtk_tree_view_get_hadjustment(GTK_TREE_VIEW(ltree)), - gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(ltree)) + /* create autos page */ + atree = atree_init(on_watch_expanded_callback, on_watch_button_pressed_callback); + tab_autos = gtk_scrolled_window_new( + gtk_tree_view_get_hadjustment(GTK_TREE_VIEW(atree)), + gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(atree)) ); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tab_locals), + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tab_autos), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add(GTK_CONTAINER(tab_locals), ltree); + gtk_container_add(GTK_CONTAINER(tab_autos), atree); /* create stack trace page */ stree = stree_init(editor_open_position);
Modified: trunk/geany-plugins/debugger/src/debug_module.c =================================================================== --- trunk/geany-plugins/debugger/src/debug_module.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/debug_module.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -30,7 +30,7 @@ #include "debug_module.h"
/* creates new variable */ -variable *variable_new(gchar *name) +variable *variable_new(gchar *name, variable_type vt) { variable *var = g_malloc(sizeof(variable)); var->name = g_string_new(name); @@ -39,14 +39,15 @@ var->type = g_string_new(""); var->value = g_string_new(""); var->has_children = var->evaluated = FALSE; + var->vt = vt; return var; }
/* creates new variable with internal name */ -variable *variable_new2(gchar *name, gchar *internal) +variable *variable_new2(gchar *name, gchar *internal, variable_type vt) { - variable *var = variable_new(name); + variable *var = variable_new(name, vt); g_string_assign(var->internal, internal); return var;
Modified: trunk/geany-plugins/debugger/src/debug_module.h =================================================================== --- trunk/geany-plugins/debugger/src/debug_module.h 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/debug_module.h 2011-09-25 08:32:05 UTC (rev 2212) @@ -29,6 +29,15 @@ void (*report_error) (const gchar* message); } dbg_callbacks;
+typedef enum _variable_type { + VT_ARGUMENT, + VT_LOCAL, + VT_WATCH, + VT_GLOBAL, + VT_CHILD, + VT_NONE +} variable_type; + /* type to hold information about a variable */ typedef struct _variable { /* variable name */ @@ -46,6 +55,8 @@ gboolean has_children; /* flag indicating whether getting variable value was successfull */ gboolean evaluated; + /* variable type */ + variable_type vt; } variable;
/* type to hold information about a stack frame */ @@ -90,7 +101,7 @@ gboolean (*remove_break) (breakpoint* bp); GList* (*get_stack) (); - GList* (*get_locals) (); + GList* (*get_autos) (); GList* (*get_watches) (); GList* (*get_files) (); @@ -123,7 +134,7 @@ set_break, \ remove_break, \ get_stack, \ - get_locals, \ + get_autos, \ get_watches, \ get_files, \ get_children, \ @@ -135,7 +146,7 @@ MODULE_FEATURES }
void variable_free(variable *var); -variable* variable_new(gchar *name); -variable* variable_new2(gchar *name, gchar *internal); +variable* variable_new(gchar *name, variable_type vt); +variable* variable_new2(gchar *name, gchar *internal, variable_type vt); void variable_reset(variable *var);
Deleted: trunk/geany-plugins/debugger/src/ltree.c =================================================================== --- trunk/geany-plugins/debugger/src/ltree.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/ltree.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -1,46 +0,0 @@ -/* - * ltree.c - * - * Copyright 2010 Alexander Petukhov <devel(at)apetukhov.ru> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* - * Contains locals tree view functions. - */ - -#include <gtk/gtk.h> - -#include "watch_model.h" -#include "vtree.h" - -/* pointer to a widget */ -static GtkWidget *tree = NULL; - -/* - * init locals tree, and sets on expanded handler - * arguments: - * expanded - handler to call when tree item is expanded - */ -GtkWidget* ltree_init(watch_expanded_callback expanded, watch_button_pressed buttonpressed) -{ - tree = vtree_create(NULL, NULL); - g_signal_connect(G_OBJECT(tree), "row-expanded", G_CALLBACK (expanded), NULL); - g_signal_connect(G_OBJECT(tree), "button-press-event", G_CALLBACK (buttonpressed), NULL); - - return tree; -}
Deleted: trunk/geany-plugins/debugger/src/ltree.h =================================================================== --- trunk/geany-plugins/debugger/src/ltree.h 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/ltree.h 2011-09-25 08:32:05 UTC (rev 2212) @@ -1,23 +0,0 @@ -/* - * ltree.h - * - * Copyright 2010 Alexander Petukhov <devel(at)apetukhov.ru> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -GtkWidget* ltree_init(watch_expanded_callback expanded, watch_button_pressed buttonpressed); -
Modified: trunk/geany-plugins/debugger/src/pconfig.c =================================================================== --- trunk/geany-plugins/debugger/src/pconfig.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/pconfig.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -84,11 +84,11 @@ { g_key_file_set_boolean(key_file, "tabbed_mode", "enabled", FALSE);
- int all_tabs[] = { TID_TARGET, TID_BREAKS, TID_LOCALS, TID_WATCH, TID_STACK, TID_TERMINAL, TID_MESSAGES }; + int all_tabs[] = { TID_TARGET, TID_BREAKS, TID_AUTOS, TID_WATCH, TID_STACK, TID_TERMINAL, TID_MESSAGES }; g_key_file_set_integer_list(key_file, "one_panel_mode", "tabs", all_tabs, sizeof(all_tabs) / sizeof(int)); g_key_file_set_integer(key_file, "one_panel_mode", "selected_tab_index", 0);
- int left_tabs[] = { TID_TARGET, TID_BREAKS, TID_LOCALS, TID_WATCH }; + int left_tabs[] = { TID_TARGET, TID_BREAKS, TID_AUTOS, TID_WATCH }; g_key_file_set_integer_list(key_file, "two_panels_mode", "left_tabs", left_tabs, sizeof(left_tabs) / sizeof(int)); g_key_file_set_integer(key_file, "two_panels_mode", "left_selected_tab_index", 0); int right_tabs[] = { TID_STACK, TID_TERMINAL, TID_MESSAGES };
Added: trunk/geany-plugins/debugger/src/pixbuf.c =================================================================== --- trunk/geany-plugins/debugger/src/pixbuf.c (rev 0) +++ trunk/geany-plugins/debugger/src/pixbuf.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -0,0 +1,83 @@ +/* + * pixbufs.c + * + * Copyright 2010 Alexander Petukhov <devel(at)apetukhov.ru> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +/* + * pixbuffers + */ + +#include <gtk/gtk.h> + +#include "xpm/breakpoint.xpm" +#include "xpm/breakpoint_disabled.xpm" +#include "xpm/breakpoint_condition.xpm" + +#include "xpm/argument.xpm" +#include "xpm/local.xpm" +#include "xpm/watch.xpm" + +#include "xpm/frame.xpm" +#include "xpm/frame_current.xpm" + +GdkPixbuf *break_pixbuf = NULL; +GdkPixbuf *break_disabled_pixbuf = NULL; +GdkPixbuf *break_condition_pixbuf = NULL; + +GdkPixbuf *argument_pixbuf = NULL; +GdkPixbuf *local_pixbuf = NULL; +GdkPixbuf *watch_pixbuf = NULL; + +GdkPixbuf *frame_pixbuf = NULL; +GdkPixbuf *frame_current_pixbuf = NULL; + +/* + * create pixbuffers + */ +void pixbufs_init() +{ + break_pixbuf = gdk_pixbuf_new_from_xpm_data(breakpoint_xpm); + break_disabled_pixbuf = gdk_pixbuf_new_from_xpm_data(breakpoint_disabled_xpm); + break_condition_pixbuf = gdk_pixbuf_new_from_xpm_data(breakpoint_condition_xpm); + + argument_pixbuf = gdk_pixbuf_new_from_xpm_data(argument_xpm); + local_pixbuf = gdk_pixbuf_new_from_xpm_data(local_xpm); + watch_pixbuf = gdk_pixbuf_new_from_xpm_data(watch_xpm); + + frame_pixbuf = gdk_pixbuf_new_from_xpm_data(frame_xpm); + frame_current_pixbuf = gdk_pixbuf_new_from_xpm_data(frame_current_xpm); +} + +/* + * free pixbuffers + */ +void pixbufs_destroy() +{ + g_object_unref(break_pixbuf); + g_object_unref(break_disabled_pixbuf); + g_object_unref(break_condition_pixbuf); + + g_object_unref(argument_pixbuf); + g_object_unref(local_pixbuf); + g_object_unref(watch_pixbuf); + + g_object_unref(frame_pixbuf); + g_object_unref(frame_current_pixbuf); +} +
Added: trunk/geany-plugins/debugger/src/pixbuf.h =================================================================== --- trunk/geany-plugins/debugger/src/pixbuf.h (rev 0) +++ trunk/geany-plugins/debugger/src/pixbuf.h 2011-09-25 08:32:05 UTC (rev 2212) @@ -0,0 +1,33 @@ +/* + * pixbufs.h + * + * Copyright 2011 Alexander Petukhov <devel(at)apetukhov.ru> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +extern GdkPixbuf *break_pixbuf; +extern GdkPixbuf *break_disabled_pixbuf; +extern GdkPixbuf *break_condition_pixbuf; + +extern GdkPixbuf *argument_pixbuf; +extern GdkPixbuf *local_pixbuf; +extern GdkPixbuf *watch_pixbuf; + +extern GdkPixbuf *frame_current_pixbuf; + +void pixbufs_init(); +void pixbufs_destroy();
Modified: trunk/geany-plugins/debugger/src/plugin.c =================================================================== --- trunk/geany-plugins/debugger/src/plugin.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/plugin.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -39,6 +39,7 @@ #include "dpaned.h" #include "tabs.h" #include "envtree.h" +#include "pixbuf.h"
/* These items are set by Geany before plugin_init() is called. */ GeanyPlugin *geany_plugin; @@ -90,6 +91,8 @@ main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
keys_init(); + + pixbufs_init();
/* main box */ hbox = gtk_hbox_new(FALSE, 0); @@ -155,6 +158,8 @@ g_main_context_iteration(NULL,FALSE); }
+ pixbufs_destroy(); + /* destroy debug-related stuff */ debug_destroy();
Modified: trunk/geany-plugins/debugger/src/stree.c =================================================================== --- trunk/geany-plugins/debugger/src/stree.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/stree.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -32,9 +32,8 @@ #include "breakpoints.h" #include "utils.h" #include "debug_module.h" +#include "pixbuf.h"
-#include "xpm/frame_current.xpm" - #define ARROW_PADDING 7
/* Tree view columns */ @@ -65,9 +64,6 @@ /* flag to indicate whether to handle selection change */ static gboolean handle_selection = TRUE;
-/* pixbuf with the frame arrow */ -GdkPixbuf *arrow_pixbuf = NULL; - /* * Handles same tree row click to open frame position */ @@ -159,8 +155,6 @@ GtkWidget* stree_init(move_to_line_cb cb) { callback = cb; - - arrow_pixbuf = gdk_pixbuf_new_from_xpm_data(frame_current_xpm);
/* create tree view */ store = gtk_list_store_new ( @@ -177,7 +171,6 @@ /* set tree view properties */ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), 1); - g_object_set(tree, "rules-hint", TRUE, NULL);
/* connect signals */ g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree))), "changed", @@ -193,7 +186,7 @@ /* arrow */ renderer_arrow = gtk_cell_renderer_pixbuf_new (); column = gtk_tree_view_column_new_with_attributes ("", renderer_arrow, "pixbuf", S_ARROW, NULL); - gtk_tree_view_column_set_min_width(column, gdk_pixbuf_get_width(arrow_pixbuf) + 2 * ARROW_PADDING); + gtk_tree_view_column_set_min_width(column, gdk_pixbuf_get_width(frame_current_pixbuf) + 2 * ARROW_PADDING); gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
/* address */ @@ -252,7 +245,7 @@ if (first) { gtk_list_store_set (store, &iter, - S_ARROW, arrow_pixbuf, + S_ARROW, frame_current_pixbuf, -1); }
@@ -293,5 +286,4 @@ */ void stree_destroy() { - g_object_unref(arrow_pixbuf); }
Modified: trunk/geany-plugins/debugger/src/tabs.c =================================================================== --- trunk/geany-plugins/debugger/src/tabs.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/tabs.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -34,7 +34,7 @@ GtkWidget *tab_target = NULL; GtkWidget *tab_breaks = NULL; GtkWidget *tab_watch = NULL; -GtkWidget *tab_locals = NULL; +GtkWidget *tab_autos = NULL; GtkWidget *tab_call_stack = NULL; GtkWidget *tab_terminal = NULL; GtkWidget *tab_messages = NULL; @@ -59,9 +59,9 @@ { id = TID_WATCH; } - else if (tab_locals == tab) + else if (tab_autos == tab) { - id = TID_LOCALS; + id = TID_AUTOS; } else if (tab_call_stack == tab) { @@ -98,8 +98,8 @@ case TID_WATCH: tab = tab_watch; break; - case TID_LOCALS: - tab = tab_locals; + case TID_AUTOS: + tab = tab_autos; break; case TID_STACK: tab = tab_call_stack; @@ -133,8 +133,8 @@ case TID_WATCH: label = _("Watch"); break; - case TID_LOCALS: - label = _("Locals"); + case TID_AUTOS: + label = _("Autos"); break; case TID_STACK: label = _("Call Stack");
Modified: trunk/geany-plugins/debugger/src/tabs.h =================================================================== --- trunk/geany-plugins/debugger/src/tabs.h 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/tabs.h 2011-09-25 08:32:05 UTC (rev 2212) @@ -25,7 +25,7 @@ TID_TARGET, TID_BREAKS, TID_WATCH, - TID_LOCALS, + TID_AUTOS, TID_STACK, TID_TERMINAL, TID_MESSAGES @@ -34,7 +34,7 @@ extern GtkWidget *tab_target; extern GtkWidget *tab_breaks; extern GtkWidget *tab_watch; -extern GtkWidget *tab_locals; +extern GtkWidget *tab_autos; extern GtkWidget *tab_call_stack; extern GtkWidget *tab_terminal; extern GtkWidget *tab_messages;
Modified: trunk/geany-plugins/debugger/src/vtree.c =================================================================== --- trunk/geany-plugins/debugger/src/vtree.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/vtree.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -21,7 +21,7 @@
/* * Variables tree view. - * Base class for locals and watch tree views. + * Base class for autos and watch tree views. */
#include <string.h> @@ -30,9 +30,13 @@
#include "geanyplugin.h"
+#include "breakpoint.h" +#include "debug_module.h" #include "watch_model.h" #include "utils.h" +#include "pixbuf.h"
+ /* columns minumum width in characters */ #define MIN_COLUMN_CHARS 20
@@ -68,6 +72,42 @@ /* * value rendere function */ +void render_icon(GtkTreeViewColumn *tree_column, + GtkCellRenderer *cell, + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gpointer data) +{ + variable_type vt; + gtk_tree_model_get ( + tree_model, + iter, + W_VT, &vt, + -1); + + if (VT_NONE != vt && VT_CHILD != vt) + { + g_object_set(cell, "visible", TRUE, NULL); + + GdkPixbuf *pixbuf = NULL; + if (VT_ARGUMENT == vt) + pixbuf = argument_pixbuf; + else if (VT_LOCAL == vt) + pixbuf = local_pixbuf; + else if (VT_WATCH == vt) + pixbuf = watch_pixbuf; + + g_object_set (cell, "pixbuf", (gpointer)pixbuf, NULL); + } + else + { + g_object_set(cell, "visible", FALSE, NULL); + } +} + +/* + * value rendere function + */ void render_value(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, @@ -102,13 +142,14 @@ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, + G_TYPE_INT, G_TYPE_INT); GtkWidget* tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL(store)); /* set tree view parameters */ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), TRUE); gtk_tree_view_set_enable_tree_lines(GTK_TREE_VIEW(tree), TRUE); - g_object_set(tree, "rules-hint", TRUE, NULL); + gtk_tree_view_set_level_indentation(GTK_TREE_VIEW(tree), 10);
/* connect signals */ g_signal_connect(G_OBJECT(tree), "key-press-event", G_CALLBACK (on_key_pressed), NULL); @@ -118,8 +159,18 @@ GtkTreeViewColumn *column; /* Name */ + column = gtk_tree_view_column_new(); + gtk_tree_view_column_set_title(column, _("Name")); + renderer = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes (_("Name"), renderer, "text", W_NAME, NULL); + gtk_tree_view_column_pack_end(column, renderer, TRUE); + gtk_tree_view_column_set_attributes(column, renderer, "text", W_NAME, NULL); + + GtkCellRenderer *icon_renderer = gtk_cell_renderer_pixbuf_new (); + g_object_set(icon_renderer, "follow-state", TRUE, NULL); + gtk_tree_view_column_pack_end(column, icon_renderer, FALSE); + gtk_tree_view_column_set_cell_data_func(column, icon_renderer, render_icon, NULL, NULL); + gtk_tree_view_column_set_resizable (column, TRUE); if (on_render_name) gtk_tree_view_column_set_cell_data_func(column, renderer, on_render_name, NULL, NULL);
Modified: trunk/geany-plugins/debugger/src/watch_model.c =================================================================== --- trunk/geany-plugins/debugger/src/watch_model.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/watch_model.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -68,6 +68,7 @@ W_EXPRESSION, "", W_STUB, FALSE, W_CHANGED, FALSE, + W_VT, VT_NONE, -1); /* set W_STUB flag */ @@ -89,38 +90,95 @@ GtkTreeModel *model = gtk_tree_view_get_model(tree); GtkTreeStore *store = GTK_TREE_STORE(model);
+ GtkTreeIter child; + + /* get existing rows */ + GHashTable *ht = NULL; + if (gtk_tree_model_iter_n_children(model, parent)) + { + /* collect all existing rows */ + gtk_tree_model_iter_children(model, &child, parent); + + ht = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)gtk_tree_row_reference_free); + + do + { + gchar *name = NULL; + gtk_tree_model_get(model, &child, W_NAME, &name, -1); + if (name && strlen(name)) + { + GtkTreePath *path = gtk_tree_model_get_path(model, &child); + g_hash_table_insert(ht, name, gtk_tree_row_reference_new(model, path)); + gtk_tree_path_free(path); + } + } + while(gtk_tree_model_iter_next(model, &child)); + } + + int current_position = 0; while (vars) { variable *v = vars->data; - /* set row */ - GtkTreeIter child; - gtk_tree_store_prepend (store, &child, parent); - gtk_tree_store_set (store, &child, - W_NAME, v->name->str, - W_VALUE, v->value->str, - W_TYPE, v->type->str, - W_INTERNAL, v->internal->str, - W_EXPRESSION, v->expression->str, - W_STUB, v->has_children, - W_CHANGED, mark_changed, - -1); - - /* expand to row if we were asked to */ - if (expand) + GtkTreeRowReference *reference = NULL; + if (ht && (reference = g_hash_table_lookup (ht, v->name->str))) { - GtkTreePath *path = gtk_tree_model_get_path(model, &child); - gtk_tree_view_expand_row(tree, path, FALSE); + GtkTreePath *path = gtk_tree_row_reference_get_path(reference); + if (current_position != gtk_tree_path_get_indices(path)[0]) + { + /* move a row if not at it's place */ + GtkTreeIter iter; + gtk_tree_model_get_iter(model, &iter, path); + if (current_position) + { + GtkTreeIter insert_after; + gtk_tree_model_iter_nth_child(model, &insert_after, parent, current_position - 1); + gtk_tree_store_move_after(store, &iter, &insert_after); + } + else + { + gtk_tree_store_move_after(store, &iter, NULL); + } + } + gtk_tree_path_free(path); } + else + { + gtk_tree_store_insert(store, &child, parent, current_position); + gtk_tree_store_set (store, &child, + W_NAME, v->name->str, + W_VALUE, v->value->str, + W_TYPE, v->type->str, + W_INTERNAL, v->internal->str, + W_EXPRESSION, v->expression->str, + W_STUB, v->has_children, + W_CHANGED, mark_changed, + W_VT, v->vt, + -1); + + /* expand to row if we were asked to */ + if (expand) + { + GtkTreePath *path = gtk_tree_model_get_path(model, &child); + gtk_tree_view_expand_row(tree, path, FALSE); + gtk_tree_path_free(path); + } + + /* add stub if added child also have children */ + if (v->has_children) + add_stub(store, &child); + } - /* add stub if added child also have children */ - if (v->has_children) - add_stub(store, &child); - /* move to next variable */ vars = vars->next; + current_position++; } + + if (ht) + { + g_hash_table_destroy(ht); + } }
/* @@ -164,6 +222,7 @@ W_EXPRESSION, var->expression->str, W_STUB, FALSE, W_CHANGED, changed, + W_VT, var->vt, -1); }
@@ -324,10 +383,7 @@ add_stub(store, &child); } - /* 6. Remove variable from "vars" list */ - vars = g_list_delete_link(vars, var); - - /* 7. free name, expression */ + /* 6. free name, expression */ g_free(name); g_free(internal); g_free(value); @@ -389,6 +445,7 @@ W_EXPRESSION, "", W_STUB, FALSE, W_CHANGED, FALSE, + W_VT, VT_WATCH, -1); }
Modified: trunk/geany-plugins/debugger/src/watch_model.h =================================================================== --- trunk/geany-plugins/debugger/src/watch_model.h 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/watch_model.h 2011-09-25 08:32:05 UTC (rev 2212) @@ -30,6 +30,7 @@ W_EXPRESSION, W_STUB, W_CHANGED, + W_VT, W_N_COLUMNS };
Modified: trunk/geany-plugins/debugger/src/wtree.c =================================================================== --- trunk/geany-plugins/debugger/src/wtree.c 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/wtree.c 2011-09-25 08:32:05 UTC (rev 2212) @@ -29,6 +29,8 @@ #include "watch_model.h" #include "vtree.h" #include "dconfig.h" +#include "breakpoint.h" +#include "debug_module.h"
/* drag types */ enum @@ -65,6 +67,7 @@ W_INTERNAL, "", W_EXPRESSION, "", W_VALUE, "", + W_VT, VT_NONE, -1);
/* save reference */
Modified: trunk/geany-plugins/debugger/src/xpm/Makefile.am =================================================================== --- trunk/geany-plugins/debugger/src/xpm/Makefile.am 2011-09-24 22:28:32 UTC (rev 2211) +++ trunk/geany-plugins/debugger/src/xpm/Makefile.am 2011-09-25 08:32:05 UTC (rev 2212) @@ -4,4 +4,7 @@ breakpoint_disabled.xpm \ breakpoint.xpm \ frame_current.xpm \ - frame.xpm + frame.xpm \ + argument.xpm \ + local.xpm \ + watch.xpm
Added: trunk/geany-plugins/debugger/src/xpm/argument.xpm =================================================================== --- trunk/geany-plugins/debugger/src/xpm/argument.xpm (rev 0) +++ trunk/geany-plugins/debugger/src/xpm/argument.xpm 2011-09-25 08:32:05 UTC (rev 2212) @@ -0,0 +1,31 @@ +/* XPM */ +static const char * argument_xpm[] = { +"16 16 12 1", +" c None", +". c #206820", +"+ c #58A058", +"@ c #509050", +"# c #407040", +"$ c #508850", +"% c #98C098", +"& c #90B090", +"* c #C8D8C8", +"= c #F8F8F0", +"- c #E8E8E0", +"; c #FFFFFF", +" ", +" ", +" &....& ", +" *.$****$.* ", +" .&;;;;;;&. ", +" &$;;%##%;;$& ", +" .*;;#=%#;;*. ", +" .*;;*#@#*;*. ", +" .*;-#;%#*;*. ", +" .*;%#%%#*;*. ", +" &$;-+##*#;$& ", +" .&;;;;;;&. ", +" *.$****$.* ", +" &....& ", +" ", +" "};
Property changes on: trunk/geany-plugins/debugger/src/xpm/argument.xpm ___________________________________________________________________ Added: svn:executable + *
Added: trunk/geany-plugins/debugger/src/xpm/local.xpm =================================================================== --- trunk/geany-plugins/debugger/src/xpm/local.xpm (rev 0) +++ trunk/geany-plugins/debugger/src/xpm/local.xpm 2011-09-25 08:32:05 UTC (rev 2212) @@ -0,0 +1,24 @@ +/* XPM */ +static const char * local_xpm[] = { +"16 16 5 1", +" c None", +". c #334C6F", +"+ c #8B98AA", +"@ c #9DA6B2", +"# c #657C99", +" ", +" ", +" ", +" +. .+ ", +"+.+ +.+ ", +"#. .+ +. .# ", +".# +.@.+ #. ....", +".# +.+ #. ", +".# +.@.+ #. ....", +"#. .+ +. .# ", +"+.+ +.+ ", +" +. .+ ", +" ", +" ", +" ", +" "};
Property changes on: trunk/geany-plugins/debugger/src/xpm/local.xpm ___________________________________________________________________ Added: svn:executable + *
Added: trunk/geany-plugins/debugger/src/xpm/watch.xpm =================================================================== --- trunk/geany-plugins/debugger/src/xpm/watch.xpm (rev 0) +++ trunk/geany-plugins/debugger/src/xpm/watch.xpm 2011-09-25 08:32:05 UTC (rev 2212) @@ -0,0 +1,30 @@ +/* XPM */ +static const char * watch_xpm[] = { +"16 16 11 1", +" c None", +". c #A9B2C6", +"+ c #8B96AB", +"@ c #17325D", +"# c #556C87", +"$ c #AEB9C6", +"% c #324E6E", +"& c #E4E8EC", +"* c #D5F3FF", +"= c #EBFAFF", +"- c #FCFFFF", +" ", +" ##. ", +" %. # .%#+", +" %. % .% #", +" #. .% %", +".%%%.%%.%%%+ ", +"%*==%..%*==% ", +"%=--% %=--% ", +"%&-.% %&-.% ", +".%%%+ .%%%. ", +" ", +" @ @ @@@ ", +" $@$ $$$ ", +" @ @ @@@ ", +" ", +" "};
Property changes on: trunk/geany-plugins/debugger/src/xpm/watch.xpm ___________________________________________________________________ Added: svn:executable + *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org