Revision: 2121 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2121&view=re... Author: cesspit Date: 2011-08-05 21:28:14 +0000 (Fri, 05 Aug 2011)
Log Message: ----------- debugger plugin: - adjusting breakpoints lines when one modifies a document - fixed a bug with in-panel watch editing - code formatting
Modified Paths: -------------- trunk/geany-plugins/debugger/src/bptree.h trunk/geany-plugins/debugger/src/breakpoints.h trunk/geany-plugins/debugger/src/callbacks.c trunk/geany-plugins/debugger/src/debug.c trunk/geany-plugins/debugger/src/utils.c trunk/geany-plugins/debugger/src/utils.h
Modified: trunk/geany-plugins/debugger/src/bptree.h =================================================================== --- trunk/geany-plugins/debugger/src/bptree.h 2011-08-05 12:25:20 UTC (rev 2120) +++ trunk/geany-plugins/debugger/src/bptree.h 2011-08-05 21:28:14 UTC (rev 2121) @@ -19,13 +19,13 @@ * MA 02110-1301, USA. */
-gboolean bptree_init(move_to_line_cb callback); +gboolean bptree_init(move_to_line_cb callback); GtkWidget* bptree_get_widget(); -void bptree_add_breakpoint(breakpoint* bp); -void bptree_update_breakpoint(breakpoint* bp); -void bptree_remove_breakpoint(breakpoint* bp); -void bptree_set_condition(GtkTreeIter iter, gchar* condition); -void bptree_set_hitscount(GtkTreeIter iter, int hitscount); -void bptree_set_enabled(GtkTreeIter iter, gboolean enabled); +void bptree_add_breakpoint(breakpoint* bp); +void bptree_update_breakpoint(breakpoint* bp); +void bptree_remove_breakpoint(breakpoint* bp); +void bptree_set_condition(GtkTreeIter iter, gchar* condition); +void bptree_set_hitscount(GtkTreeIter iter, int hitscount); +void bptree_set_enabled(GtkTreeIter iter, gboolean enabled); gchar* bptree_get_condition(GtkTreeIter iter); -void bptree_set_readonly(gboolean readonly); +void bptree_set_readonly(gboolean readonly);
Modified: trunk/geany-plugins/debugger/src/breakpoints.h =================================================================== --- trunk/geany-plugins/debugger/src/breakpoints.h 2011-08-05 12:25:20 UTC (rev 2120) +++ trunk/geany-plugins/debugger/src/breakpoints.h 2011-08-05 21:28:14 UTC (rev 2121) @@ -31,5 +31,5 @@ void breaks_set_condition(char* file, int line, char* condition); void breaks_iterate(breaks_iterate_function bif); gboolean breaks_is_set(char* file, int line); -GtkWidget* breaks_get_widget(); -GTree* breaks_get_for_document(char* file); +GtkWidget* breaks_get_widget(); +GTree* breaks_get_for_document(char* file);
Modified: trunk/geany-plugins/debugger/src/callbacks.c =================================================================== --- trunk/geany-plugins/debugger/src/callbacks.c 2011-08-05 12:25:20 UTC (rev 2120) +++ trunk/geany-plugins/debugger/src/callbacks.c 2011-08-05 21:28:14 UTC (rev 2121) @@ -35,6 +35,7 @@ #include "stree.h" #include "markers.h" #include "utils.h" +#include "bptree.h"
extern GeanyFunctions *geany_functions;
@@ -167,6 +168,50 @@ dialogs_show_msgbox(GTK_MESSAGE_INFO, _("To edit source files stop debugging session")); break; } + case SCN_MODIFIED: + { + if(((SC_MOD_INSERTTEXT & nt->modificationType) || (SC_MOD_DELETETEXT && nt->modificationType)) && nt->linesAdded) + { + int line = sci_get_line_from_position(editor->sci, nt->position) + 1; + + GTree *breakpoints = breaks_get_for_document(editor->document->file_name); + if (breakpoints && g_tree_nnodes(breakpoints)) + { + + GList *breaks_list = NULL; + g_tree_foreach(breakpoints, tree_foreach_add_to_list, &breaks_list); + + GList *iter = breaks_list; + while (iter) + { + breakpoint *bp = (breakpoint*)iter->data; + + if (nt->linesAdded > 0 && bp->line >= line) + { + bp->line += nt->linesAdded; + bptree_update_breakpoint(bp); + } + else if (nt->linesAdded < 0 && bp->line >= line) + { + if (bp->line < line - nt->linesAdded) + { + bptree_remove_breakpoint(bp); + breaks_remove(bp->file, bp->line); + } + else + { + bp->line += nt->linesAdded; + bptree_update_breakpoint(bp); + } + } + iter = iter->next; + } + + g_list_free(breaks_list); + } + } + break; + } }
return FALSE;
Modified: trunk/geany-plugins/debugger/src/debug.c =================================================================== --- trunk/geany-plugins/debugger/src/debug.c 2011-08-05 12:25:20 UTC (rev 2120) +++ trunk/geany-plugins/debugger/src/debug.c 2011-08-05 21:28:14 UTC (rev 2121) @@ -177,7 +177,7 @@ wmodel, &iter, W_INTERNAL, &internal, - 1); + -1);
/* check if it is empty row */ gboolean is_empty_row = !gtk_tree_path_compare (tree_path, wtree_empty_path());
Modified: trunk/geany-plugins/debugger/src/utils.c =================================================================== --- trunk/geany-plugins/debugger/src/utils.c 2011-08-05 12:25:20 UTC (rev 2120) +++ trunk/geany-plugins/debugger/src/utils.c 2011-08-05 21:28:14 UTC (rev 2121) @@ -103,7 +103,7 @@ }
/* - * GTree iteratin functions that sets marker for each breakpoint in the tree + * GTree iteration functions that sets marker for each breakpoint in the tree */ gboolean tree_foreach_set_marker(gpointer key, gpointer value, gpointer data) { @@ -113,6 +113,16 @@ }
/* + * GTree iteration functions that adds data to the list supplied in "data" parameter + */ +gboolean tree_foreach_add_to_list(gpointer key, gpointer value, gpointer data) +{ + GList **list = (GList**)data; + *list = g_list_append(*list, value); + return FALSE; +} + +/* * get word at "position" in Scintilla document */ GString* get_word_at_position(ScintillaObject *sci, int position)
Modified: trunk/geany-plugins/debugger/src/utils.h =================================================================== --- trunk/geany-plugins/debugger/src/utils.h 2011-08-05 12:25:20 UTC (rev 2120) +++ trunk/geany-plugins/debugger/src/utils.h 2011-08-05 21:28:14 UTC (rev 2121) @@ -25,3 +25,4 @@ GtkTreeViewColumn* create_column(gchar *name, GtkCellRenderer *renderer, gboolean expandable, gint minwidth, gchar *arg, int value); gboolean tree_foreach_set_marker(gpointer key, gpointer value, gpointer data); GString* get_word_at_position(ScintillaObject *sci, int position); +gboolean tree_foreach_add_to_list(gpointer key, gpointer value, gpointer data);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org