Branch: refs/heads/master Author: Dimitar Zhekov dimitar.zhekov@gmail.com Committer: Dimitar Zhekov dimitar.zhekov@gmail.com Date: Mon, 31 Dec 2012 16:38:43 UTC Commit: 7881564f8ffbe99cdaadc4d4166725ebf69c28d0 https://github.com/geany/geany-plugins/commit/7881564f8ffbe99cdaadc4d4166725...
Log Message: ----------- scope - select tree element -> select + focus + align
Modified Paths: -------------- scope/ChangeLog scope/src/break.c scope/src/inspect.c scope/src/stack.c scope/src/thread.c scope/src/utils.c scope/src/utils.h scope/src/watch.c
Modified: scope/ChangeLog 7 files changed, 7 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,10 @@ +2012-12-30 Dimitar Zhekov dimitar.zhekov@gmail.com + + * src/break.c, src/inspect.c, src/stack.c, src/thread.c, src/utils.c, + src/utils.h, src/watch.c: + Select, focus and align tree elements instead of simply selecting. + + 2012-12-28 Dimitar Zhekov dimitar.zhekov@gmail.com
* src/break.c, src/inspect.c, src/parse.c, src/program.c,
Modified: scope/src/break.c 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -412,7 +412,7 @@ static void break_node_parse(const ParseNode *node, BreakData *bd) BREAK_DISCARD, !persist, -1);
if (persist) - gtk_tree_selection_select_iter(selection, iter); + utils_tree_set_cursor(selection, iter, 0.5);
g_free(original); g_free(display); @@ -940,7 +940,7 @@ void on_break_toggle(G_GNUC_UNUSED const MenuItem *menu_item) break_relocate(&iter, doc->real_path, doc_line); gtk_list_store_set(store, &iter, BREAK_SCID, ++scid_gen, BREAK_TYPE, 'b', BREAK_ENABLED, TRUE, BREAK_RUN_APPLY, TRUE, -1); - gtk_tree_selection_select_iter(selection, &iter); + utils_tree_set_cursor(selection, &iter, 0.5); sci_set_marker_at_line(doc->editor->sci, doc_line - 1, MARKER_BREAKPT + TRUE); } }
Modified: scope/src/inspect.c 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -169,7 +169,7 @@ static void on_jump_to_menu_item_activate(GtkMenuItem *menuitem, G_GNUC_UNUSED g const gchar *expr = gtk_menu_item_get_label(menuitem);
if (model_find(model, &iter, INSPECT_EXPR, expr)) - gtk_tree_selection_select_iter(selection, &iter); + utils_tree_set_cursor(selection, &iter, 0); }
static GtkWidget *jump_to_item; @@ -632,7 +632,7 @@ void inspect_add(const gchar *text) gtk_tree_store_set(store, &iter, INSPECT_HB_MODE, pm->hb_mode, INSPECT_SCID, ++scid_gen, INSPECT_FORMAT, FORMAT_NATURAL, INSPECT_COUNT, option_inspect_count, INSPECT_EXPAND, option_inspect_expand, -1); - gtk_tree_selection_select_iter(selection, &iter); + utils_tree_set_cursor(selection, &iter, -1);
if (debug_state() & DS_DEBUG) inspect_apply(&iter);
Modified: scope/src/stack.c 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -186,7 +186,7 @@ void on_stack_follow(GArray *nodes) GtkTreeIter iter;
iff (model_find(model, &iter, STACK_ID, id), "%s: level not found", id) - gtk_tree_selection_select_iter(selection, &iter); + utils_tree_set_cursor(selection, &iter, 0.5); } } }
Modified: scope/src/thread.c 6 files changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -182,7 +182,7 @@ static void auto_select_thread(void)
if (model_find(model, &iter, THREAD_STATE, STOPPED)) { - gtk_tree_selection_select_iter(selection, &iter); + utils_tree_set_cursor(selection, &iter, -1); view_seek_selected(selection, FALSE, SK_EXECUTE); } } @@ -409,7 +409,7 @@ void on_thread_stopped(GArray *nodes)
if (thread_select_on_stopped && thread_state <= THREAD_RUNNING && sd.found) { - gtk_tree_selection_select_iter(selection, &sd.iter); + utils_tree_set_cursor(selection, &sd.iter, -1); view_seek_selected(selection, FALSE, SK_EXECUTE); }
@@ -432,7 +432,7 @@ static void set_gdb_thread(const char *tid, gboolean select) GtkTreeIter iter;
if (find_thread(gdb_thread, &iter)) - gtk_tree_selection_select_iter(selection, &iter); + utils_tree_set_cursor(selection, &iter, -1); } }
Modified: scope/src/utils.c 12 files changed, 12 insertions(+), 0 deletions(-) =================================================================== @@ -780,6 +780,18 @@ void utils_enter_to_clicked(GtkWidget *widget, GtkWidget *button) g_signal_connect(widget, "key-press-event", G_CALLBACK(on_widget_key_press), button); }
+void utils_tree_set_cursor(GtkTreeSelection *selection, GtkTreeIter *iter, gdouble align) +{ + GtkTreeView *tree = gtk_tree_selection_get_tree_view(selection); + GtkTreePath *path = gtk_tree_model_get_path(gtk_tree_view_get_model(tree), iter); + + if (align >= 0) + gtk_tree_view_scroll_to_cell(tree, path, NULL, TRUE, align, 0); + + gtk_tree_view_set_cursor(tree, path, NULL, FALSE); + gtk_tree_path_free(path); +} + void utils_finalize(void) { guint i;
Modified: scope/src/utils.h 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -110,8 +110,8 @@ enum
gchar *utils_text_buffer_get_text(GtkTextBuffer *text, gint maxlen); void utils_enter_to_clicked(GtkWidget *widget, GtkWidget *button); +void utils_tree_set_cursor(GtkTreeSelection *selection, GtkTreeIter *iter, gdouble align);
-void utils_init(void); void utils_finalize(void);
#define UTILS_H 1
Modified: scope/src/watch.c 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -210,7 +210,7 @@ void watch_add(const gchar *text) gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, WATCH_EXPR, expr, WATCH_HB_MODE, pm->hb_mode, WATCH_MR_MODE, pm->mr_mode, WATCH_SCID, ++scid_gen, WATCH_ENABLED, TRUE, -1); - gtk_tree_selection_select_iter(selection, &iter); + utils_tree_set_cursor(selection, &iter, 0.5);
if (debug_state() & DS_DEBUG) watch_fetch(&iter);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).