Permalink
Browse files

scope - use ui_lookfind_widget(), sync [ ] Read only for the current …

…document
  • Loading branch information...
zhekov committed Jun 12, 2014
1 parent 8f98d4f commit 9ff8cf09058c0cd8e76425028cd0f6d78a7afdfd
Showing with 48 additions and 11 deletions.
  1. +14 −0 scope/ChangeLog
  2. +3 −4 scope/docs/scope.html
  3. +1 −1 scope/src/menu.c
  4. +9 −2 scope/src/scope.c
  5. +0 −1 scope/src/scope.h
  6. +20 −3 scope/src/utils.c
  7. +1 −0 scope/src/utils.h
View
@@ -1,3 +1,17 @@
+2014-06-12 Dimitar Zhekov <dimitar.zhekov@gmail.com>
+
+ * docs/scope.html:
+ Small changes in the "Temporary breakpoint on load" description.
+ * src/menu.c, src/scope.c, src/scope.h:
+ Replaced scope find_widget() with Geany ui_lookup_widget().
+ * src/scope.c:
+ Insert the Debug menu after Build if possible, instead of using
+ a fixed position.
+ * src/scope.c, src/utils.c, src/utils.h:
+ Sync Geany "Document -> [ ] Read only" state of the current
+ document if possible when locking/unlocking it on Run/Terminate.
+
+
2014-04-27 Dimitar Zhekov <dimitar.zhekov@gmail.com>
* src/conterm.c:
View
@@ -204,11 +204,10 @@ <h3><a name="debug_menu">Debug menu</a></h3>
from Scope preferences to take advantage of this.</p>
<p><em>Temporary breakpoint on load at</em> - set a temporary breakpoint when the program is
-loaded. If you leave the text field empty, Scope will try to detect the 1st line of code and
+loaded. If you leave the text field empty, Scope will try to find the 1st line of code and
place a breakpoint on it. Any breakpoint options and location are allowed in the text, for
-example <em>main</em> for C/C++ programs. Since setting a breakpoint requires a program, the
-temporary breakpoint on load will be disabled if both <em>Executable</em> and <em>Load
-script</em> are empty. </p>
+example <em>main</em> for C/C++ programs. Since setting a breakpoint requires a program, this
+option will be disabled if both <em>Executable</em> and <em>Load script</em> are empty.</p>
<p><em>Delete all breakpoints, watches and inspects</em> - usually when setting up a new
program. Scope will ask for confirmation.</p>
View
@@ -517,7 +517,7 @@ void menu_init(void)
{
GtkMenuShell *shell = GTK_MENU_SHELL(geany->main_widgets->editor_menu);
GList *children = gtk_container_get_children(GTK_CONTAINER(shell));
- GtkWidget *search2 = find_widget(shell, "search2");
+ GtkWidget *search2 = ui_lookup_widget(GTK_WIDGET(shell), "search2");
popup_item = get_widget("popup_item");
menu_connect("popup_menu", &popup_menu_info, NULL);
View
@@ -533,7 +533,7 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
GeanyKeyGroup *scope_key_group;
char *gladefile = g_build_filename(PLUGINDATADIR, "scope.glade", NULL);
GError *gerror = NULL;
- GtkWidget *menubar1 = find_widget(geany->main_widgets->window, "menubar1");
+ GtkWidget *menubar1 = ui_lookup_widget(geany->main_widgets->window, "menubar1");
guint item;
const MenuKey *menu_key = debug_menu_keys;
ToolItem *tool_item = toolbar_items;
@@ -564,7 +564,13 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
#endif
debug_item = get_widget("debug_item");
if (menubar1)
- gtk_menu_shell_insert(GTK_MENU_SHELL(menubar1), debug_item, DEBUG_MENU_ITEM_POS);
+ {
+ GList *children = gtk_container_get_children(GTK_CONTAINER(menubar1));
+ GtkWidget *menu_build1 = ui_lookup_widget(menubar1, "menu_build1");
+
+ gtk_menu_shell_insert(GTK_MENU_SHELL(menubar1), debug_item,
+ menu_build1 ? g_list_index(children, menu_build1) + 1 : DEBUG_MENU_ITEM_POS);
+ }
else
gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), debug_item);
@@ -595,6 +601,7 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
inspect_init();
register_init();
parse_init();
+ utils_init();
debug_init();
views_init();
thread_init();
View
@@ -26,7 +26,6 @@ void update_state(DebugState state);
GObject *get_object(const char *name);
GtkWidget *get_widget(const char *name);
#define get_column(name) GTK_TREE_VIEW_COLUMN(get_object(name))
-#define find_widget(parent, name) GTK_WIDGET(g_object_get_data(G_OBJECT(parent), (name)))
void configure_toolbar(void);
void open_debug_panel(void);
void configure_panel(void);
View
@@ -344,11 +344,22 @@ static void line_mark_unmark(GeanyDocument *doc, gboolean lock)
}
}
+static GtkCheckMenuItem *set_file_readonly1;
+
static void doc_lock_unlock(GeanyDocument *doc, gboolean lock)
{
- scintilla_send_message(doc->editor->sci, SCI_SETREADONLY, lock, 0);
- doc->readonly = lock;
- document_set_text_changed(doc, doc->changed); /* to redraw tab and update sidebar */
+ if (set_file_readonly1 && doc == document_get_current())
+ {
+ /* to ensure correct state of Document -> [ ] Read Only */
+ if (gtk_check_menu_item_get_active(set_file_readonly1) != lock)
+ gtk_check_menu_item_set_active(set_file_readonly1, lock);
+ }
+ else
+ {
+ scintilla_send_message(doc->editor->sci, SCI_SETREADONLY, lock, 0);
+ doc->readonly = lock;
+ document_set_text_changed(doc, doc->changed); /* to redraw tab & update sidebar */
+ }
}
void utils_lock(GeanyDocument *doc)
@@ -708,6 +719,12 @@ void utils_tree_set_cursor(GtkTreeSelection *selection, GtkTreeIter *iter, gdoub
gtk_tree_path_free(path);
}
+void utils_init(void)
+{
+ set_file_readonly1 = GTK_CHECK_MENU_ITEM(ui_lookup_widget(geany->main_widgets->window,
+ "set_file_readonly1"));
+}
+
void utils_finalize(void)
{
guint i;
View
@@ -104,6 +104,7 @@ 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 alignment);
+void utils_init(void);
void utils_finalize(void);
#define UTILS_H 1

0 comments on commit 9ff8cf0

Please sign in to comment.