[geany/geany-plugins] 5763dc: scope - better message window on right support, apply some prefs asap

Dimitar Zhekov git-noreply at xxxxx
Sat Sep 7 08:45:46 UTC 2013


Branch:      refs/heads/master
Author:      Dimitar Zhekov <dimitar.zhekov at gmail.com>
Committer:   Dimitar Zhekov <dimitar.zhekov at gmail.com>
Date:        Sat, 07 Sep 2013 08:45:46 UTC
Commit:      5763dc9357008e8df29462a7b80d5a71b8fab8d1
             https://github.com/geany/geany-plugins/commit/5763dc9357008e8df29462a7b80d5a71b8fab8d1

Log Message:
-----------
scope - better message window on right support, apply some prefs asap


Modified Paths:
--------------
    scope/ChangeLog
    scope/NEWS
    scope/NOTES
    scope/data/scope.glade
    scope/docs/scope.html
    scope/src/conterm.c
    scope/src/conterm.h
    scope/src/inspect.c
    scope/src/prefs.c
    scope/src/scope.c
    scope/src/scope.h

Modified: scope/ChangeLog
17 files changed, 16 insertions(+), 1 deletions(-)
===================================================================
@@ -1,7 +1,22 @@
+2013-09-07  Dimitar Zhekov  <dimitar.zhekov at gmail.com>
+
+ * data/scope.glade:
+   Removed "Program Terminal", "Breakpoints" and "Debug Console"
+   panel tab names - they are always initialized explicitly now.
+ * src/conterm.c, src/conterm.h, src/prefs.c, src/scope.c:
+   Apply VTE settings immediately after Edit -> Preferences.
+ * src/prefs.c, src/prefs.h, src/scope.c, src/scope.h:
+   Apply pref_panel_tab_pos immediately after scope.conf save.
+   Automatically switch to short panel tab names if Geany message
+   window is on right.
+ * docs/scope.html, src/scope.c:
+   Increased version to 0.92.
+
+
 2013-08-31  Dimitar Zhekov  <dimitar.zhekov at gmail.com>
 
  * data/scope.glade:
-   Set Debug Panel tabs to "scrollable", so that the messages window
+   Set Debug Panel tabs to "scrollable", so that Geany message window
    is not extended if it's not wide/tall enough to fit the tab names.
  * src/break.c:
    No async break messages only: don't disable a "dis" breakpoint on


Modified: scope/NEWS
8 files changed, 8 insertions(+), 0 deletions(-)
===================================================================
@@ -1,3 +1,11 @@
+Scope 0.92 (2013-09-07)
+
+    * Better support for Geany message window on right, but don't
+      expect miracles.
+
+    * Apply VTE and Debug panel position preferences immediately.
+
+
 Scope 0.91.2 (2013-07-25)
 
     * Fixed various errors on plugin unload-and-reload.


Modified: scope/NOTES
6 files changed, 0 insertions(+), 6 deletions(-)
===================================================================
@@ -38,9 +38,6 @@ thread has stopped before prompting for another command
 clicking a button with response 0, and then clicking an accept button or
 gtk_dialog_response(ACCEPT), may generate 0 instead of accept
 
-breakpoints don't need unapply: they can be disabled, and all relevant
-columns are editable
-
 -var-create for global symbols allows any frame
 -set-update-range seems to have no effect on my system
 
@@ -71,9 +68,6 @@ set print elements 10: "\a01\002\003\004\005\006\a\b\t\n"...
 	{290, 291, 292, 293, 294, 295, 296, 297, 298, 299...}
 '\000' <repeats 100 times>, '\001' <repeats 100 times>
 
-GDB does specify that individual breakpoint location may be enabled or
-disabled, but not deleted; no mention of condition/ignore/script though
-
 pending breakpoints are handled either at thread stopped, or by async
 modified message; parsing =library-loaded seems pointless
 


Modified: scope/data/scope.glade
3 files changed, 0 insertions(+), 3 deletions(-)
===================================================================
@@ -1569,7 +1569,6 @@
     <child type="tab">
       <object class="GtkLabel" id="program_terminal_label">
         <property name="visible">True</property>
-        <property name="label" translatable="yes">Program Terminal</property>
       </object>
       <packing>
         <property name="tab_fill">False</property>
@@ -1859,7 +1858,6 @@
     <child type="tab">
       <object class="GtkLabel" id="break_view_label">
         <property name="visible">True</property>
-        <property name="label" translatable="yes">Breakpoints</property>
       </object>
       <packing>
         <property name="position">2</property>
@@ -2174,7 +2172,6 @@
     <child type="tab">
       <object class="GtkLabel" id="debug_console_label">
         <property name="visible">True</property>
-        <property name="label" translatable="yes">Debug Console</property>
       </object>
       <packing>
         <property name="position">7</property>


Modified: scope/docs/scope.html
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -584,7 +584,7 @@
 
 <h3><a name="notes">Notes</a></h3>
 
-<p>Changes in Geany VTE preferences will be applied when Scope is restarted.</p>
+<p>Debug Console ignores VTE foreground color, except for the cursor.</p>
 
 <p>Locale/UTF-8 conversion is fully supported for values only. Filenames not matching your
 locale and non-ascii identifiers are not guaranteed to work.</p>
@@ -748,7 +748,7 @@
 
 <b><a name="copyright">Copyright</a></b>
 
-<p>Scope 0.91.4, Copyright (C) 2013 Dimitar Toshkov Zhekov</p>
+<p>Scope 0.92, Copyright (C) 2013 Dimitar Toshkov Zhekov</p>
 
 <p>The menu and toolbar icons are from <a href="http://netbeans.org">Netbeans</a>, except for
 BreakPoint.</p>


Modified: scope/src/conterm.c
53 files changed, 45 insertions(+), 8 deletions(-)
===================================================================
@@ -150,10 +150,8 @@ static guint terminal_menu_extra_state(void)
 
 static MenuInfo terminal_menu_info = { terminal_menu_items, terminal_menu_extra_state, 0 };
 
-void on_vte_realize(GtkWidget *widget, G_GNUC_UNUSED gpointer gdata)
+void on_vte_realize(VteTerminal *vte, G_GNUC_UNUSED gpointer gdata)
 {
-	VteTerminal *vte = VTE_TERMINAL(widget);
-
 	vte_terminal_set_emulation(vte, pref_vte_emulation);
 	vte_terminal_set_font_from_string(vte, pref_vte_font);
 	vte_terminal_set_scrollback_lines(vte, pref_vte_scrollback);
@@ -168,7 +166,7 @@ void on_vte_realize(GtkWidget *widget, G_GNUC_UNUSED gpointer gdata)
 #endif
 }
 
-static VteTerminal *debug_console;  /* non-NULL == vte console */
+static VteTerminal *debug_console;  /* NULL -> GtkTextView "context" */
 
 static void console_output(int fd, const char *text, gint length)
 {
@@ -380,6 +378,48 @@ static guint console_menu_extra_state(void)
 
 static MenuInfo console_menu_info = { console_menu_items, console_menu_extra_state, 0 };
 
+void conterm_load_config(void)
+{
+	gchar *configfile = g_build_filename(geany_data->app->configdir, "geany.conf", NULL);
+	GKeyFile *config = g_key_file_new();
+	gchar *tmp_string;
+
+	g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL);
+	pref_vte_blinken = utils_get_setting_boolean(config, "VTE", "cursor_blinks", FALSE);
+	pref_vte_emulation = utils_get_setting_string(config, "VTE", "emulation", "xterm");
+	pref_vte_font = utils_get_setting_string(config, "VTE", "font", "Monospace 10");
+	pref_vte_scrollback = utils_get_setting_integer(config, "VTE", "scrollback_lines", 500);
+	tmp_string = utils_get_setting_string(config, "VTE", "colour_fore", "#ffffff");
+	gdk_color_parse(tmp_string, &pref_vte_colour_fore);
+	g_free(tmp_string);
+	tmp_string = utils_get_setting_string(config, "VTE", "colour_back", "#000000");
+	gdk_color_parse(tmp_string, &pref_vte_colour_back);
+	g_free(tmp_string);
+	g_key_file_free(config);
+	g_free(configfile);
+}
+
+static void context_apply_config(GtkWidget *console)
+{
+	gtk_widget_modify_base(console, GTK_STATE_NORMAL, &pref_vte_colour_back);
+	gtk_widget_modify_cursor(console, &pref_vte_colour_fore, &pref_vte_colour_back);
+	ui_widget_modify_font_from_string(console, pref_vte_font);
+}
+
+void conterm_apply_config(void)
+{
+#ifdef G_OS_UNIX
+	on_vte_realize(program_terminal, NULL);
+
+	if (debug_console)
+		on_vte_realize(debug_console, NULL);
+	else
+#endif
+	{
+		context_apply_config(GTK_WIDGET(debug_context));
+	}
+}
+
 #ifdef G_OS_UNIX
 static int pty_slave;
 char *slave_pty_name;
@@ -501,10 +541,7 @@ void conterm_init(void)
 		dc_chars = 0;
 
 		console = get_widget("debug_context");
-		gtk_widget_modify_base(console, GTK_STATE_NORMAL, &pref_vte_colour_back);
-		gtk_widget_modify_cursor(console, &pref_vte_colour_fore, &pref_vte_colour_back);
-		ui_widget_modify_font_from_string(console, pref_vte_font);
-
+		context_apply_config(console);
 		debug_context = GTK_TEXT_VIEW(console);
 		dc_output = context_output;
 		dc_output_nl = context_output_nl;


Modified: scope/src/conterm.h
3 files changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -37,6 +37,9 @@
 void dc_clear(void);
 gboolean dc_update(void);
 
+void conterm_load_config(void);  /* Geany VTE config */
+void conterm_apply_config(void);
+
 void conterm_init(void);
 void conterm_finalize(void);
 


Modified: scope/src/inspect.c
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -553,7 +553,7 @@ static gint inspect_iter_refresh(ScpTreeStore *store, GtkTreeIter *iter, gpointe
 static void inspects_send_refresh(char token)
 {
 	scp_tree_store_traverse(store, TRUE, NULL, NULL, inspect_iter_refresh,
-		GINT_TO_POINTER(token));
+		GINT_TO_POINTER((gint) token));
 	query_all_inspects = FALSE;
 }
 


Modified: scope/src/prefs.c
28 files changed, 4 insertions(+), 24 deletions(-)
===================================================================
@@ -192,6 +192,8 @@ static void prefs_configure(void)
 
 	foreach_document(i)
 		prefs_apply(documents[i]);
+
+	configure_panel();
 }
 
 char *prefs_file_name(void)
@@ -211,7 +213,7 @@ static void on_document_save(G_GNUC_UNUSED GObject *obj, GeanyDocument *doc,
 		g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL);
 		load_scope_prefs(config);
 		prefs_configure();
-		scope_configure();
+		configure_toolbar();
 		g_key_file_free(config);
 	}
 	g_free(configfile);
@@ -227,7 +229,6 @@ void prefs_init(void)
 	char *configdir = g_build_filename(geany->app->configdir, "plugins", "scope", NULL);
 	char *configfile = prefs_file_name();
 	GKeyFile *config = g_key_file_new();
-	gchar *tmp_string;
 
 	group = stash_group_new("scope");
 	stash_group_add_string(group, &pref_gdb_executable, "gdb_executable", "gdb");
@@ -291,13 +292,6 @@ void prefs_init(void)
 	prefs_configure();
 	program_load_config(config);
 
-	if (pref_panel_tab_pos == GTK_POS_LEFT || pref_panel_tab_pos == GTK_POS_RIGHT)
-	{
-		gtk_label_set_label(GTK_LABEL(get_widget("program_terminal_label")), _("Program"));
-		gtk_label_set_label(GTK_LABEL(get_widget("break_view_label")), _("Breaks"));
-		gtk_label_set_label(GTK_LABEL(get_widget("debug_console_label")), _("Console"));
-	}
-
 	if (!g_file_test(configfile, G_FILE_TEST_IS_REGULAR))
 	{
 		gint error = utils_mkdir(configdir, TRUE);
@@ -316,21 +310,7 @@ void prefs_init(void)
 	g_free(configfile);
 	g_free(configdir);
 
-	configfile = g_build_filename(geany_data->app->configdir, "geany.conf", NULL);
-	config = g_key_file_new();
-	g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL);
-	pref_vte_blinken = utils_get_setting_boolean(config, "VTE", "cursor_blinks", FALSE);
-	pref_vte_emulation = utils_get_setting_string(config, "VTE", "emulation", "xterm");
-	pref_vte_font = utils_get_setting_string(config, "VTE", "font", "Monospace 10");
-	pref_vte_scrollback = utils_get_setting_integer(config, "VTE", "scrollback_lines", 500);
-	tmp_string = utils_get_setting_string(config, "VTE", "colour_fore", "#ffffff");
-	gdk_color_parse(tmp_string, &pref_vte_colour_fore);
-	g_free(tmp_string);
-	tmp_string = utils_get_setting_string(config, "VTE", "colour_back", "#000000");
-	gdk_color_parse(tmp_string, &pref_vte_colour_back);
-	g_free(tmp_string);
-	g_key_file_free(config);
-	g_free(configfile);
+	conterm_load_config();
 }
 
 void prefs_finalize(void)


Modified: scope/src/scope.c
62 files changed, 44 insertions(+), 18 deletions(-)
===================================================================
@@ -32,7 +32,7 @@
 PLUGIN_VERSION_CHECK(215)
 
 PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, _("Scope Debugger"),
-	_("Relatively simple GDB front-end."), "0.91.4" ,
+	_("Relatively simple GDB front-end."), "0.92",
 	"Dimitar Toshkov Zhekov <dimitar.zhekov at gmail.com>")
 
 /* Keybinding(s) */
@@ -313,9 +313,9 @@ static void on_document_open(G_GNUC_UNUSED GObject *obj, GeanyDocument *doc,
 		threads_mark(doc);
 }
 
-static guint resync_id;
+static guint after_save_id;
 
-static gboolean resync_readonly(G_GNUC_UNUSED gpointer gdata)
+static gboolean settings_after_save(gpointer gdata)
 {
 	guint i;
 
@@ -325,30 +325,41 @@ static gboolean resync_readonly(G_GNUC_UNUSED gpointer gdata)
 			SCI_GETREADONLY, 0, 0);
 	}
 
-	resync_id = 0;
+	if (GPOINTER_TO_INT(gdata))
+	{
+		conterm_load_config();
+		conterm_apply_config();
+	}
+
+	after_save_id = 0;
 	return FALSE;
 }
 
-static void unlock_readonly(void)
+static void schedule_after_save(gboolean conterm)
 {
 	guint i;
 
+	after_save_id = plugin_idle_add(geany_plugin, settings_after_save,
+		GINT_TO_POINTER(conterm));
+
 	foreach_document(i)
 	{
 		if (utils_attrib(documents[i], SCOPE_LOCK))
-		{
 			documents[i]->readonly = FALSE;
-
-			if (!resync_id)
-				resync_id = plugin_idle_add(geany_plugin, resync_readonly, NULL);
-		}
 	}
 }
 
-static void on_session_save(G_GNUC_UNUSED GObject *obj, G_GNUC_UNUSED GKeyFile *keyfile,
+static void on_settings_save(G_GNUC_UNUSED GObject *obj, G_GNUC_UNUSED GKeyFile *keyfile,
+	G_GNUC_UNUSED gpointer gdata)
+{
+	configure_panel();
+	schedule_after_save(TRUE);
+}
+
+static void on_project_before_save(G_GNUC_UNUSED GObject *obj, G_GNUC_UNUSED GKeyFile *keyfile,
 	G_GNUC_UNUSED gpointer gdata)
 {
-	unlock_readonly();
+	schedule_after_save(FALSE);
 }
 
 static gboolean on_editor_notify(G_GNUC_UNUSED GObject *obj, GeanyEditor *editor,
@@ -427,12 +438,12 @@ static void on_build_start(G_GNUC_UNUSED GObject *obj, G_GNUC_UNUSED gpointer gd
 	{ "document-new",             G_CALLBACK(on_document_new) },
 	{ "document-open",            G_CALLBACK(on_document_open) },
 	{ "document-reload",          G_CALLBACK(on_document_open) },
-	{ "save-settings",            G_CALLBACK(on_session_save) },
+	{ "save-settings",            G_CALLBACK(on_settings_save) },
 	{ "editor-notify",            G_CALLBACK(on_editor_notify) },
 	{ "document-filetype-set",    G_CALLBACK(on_document_filetype_set) },
 	{ "document-activate",        G_CALLBACK(on_document_activate) },
 	{ "document-save",            G_CALLBACK(on_document_activate) },
-	{ "project-before-save",      G_CALLBACK(on_session_save) },
+	{ "project-before-save",      G_CALLBACK(on_project_before_save) },
 	{ "project-open",             G_CALLBACK(on_project_open) },
 	{ "project-close",            G_CALLBACK(on_project_close) },
 	{ "geany-startup-complete",   G_CALLBACK(on_geany_startup_complete) },
@@ -476,7 +487,7 @@ GtkWidget *get_widget(const char *name)
 #endif  /* G_DISABLE_ASSERT */
 }
 
-void scope_configure(void)
+void configure_toolbar(void)
 {
 	guint item;
 	ToolItem *tool_item = toolbar_items;
@@ -503,6 +514,22 @@ void open_debug_panel(void)
 	gtk_widget_grab_focus(debug_panel);
 }
 
+void configure_panel(void)
+{
+	gboolean short_tab_names = pref_panel_tab_pos == GTK_POS_LEFT ||
+		pref_panel_tab_pos == GTK_POS_RIGHT ||
+		geany_data->interface_prefs->msgwin_orientation == GTK_ORIENTATION_HORIZONTAL;
+
+	gtk_label_set_label(GTK_LABEL(get_widget("program_terminal_label")),
+		short_tab_names ? _("Program") : _("Program Terminal"));
+	gtk_label_set_label(GTK_LABEL(get_widget("break_view_label")),
+		short_tab_names ? _("Breaks") : _("Breakpoints"));
+	gtk_label_set_label(GTK_LABEL(get_widget("debug_console_label")),
+		short_tab_names ? _("Console") : _("Debug Console"));
+
+	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(debug_panel), pref_panel_tab_pos);
+}
+
 void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
 {
 	GeanyKeyGroup *scope_key_group;
@@ -517,7 +544,7 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
 	last_toolbar_state = 0;
 	last_statusbar_state = DS_INACTIVE;
 	blink_id = 0;
-	resync_id = 0;
+	after_save_id = 0;
 
 	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
 	scope_key_group = plugin_set_key_group(geany_plugin, "scope", COUNT_KB, NULL);
@@ -575,7 +602,6 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
 	gtk216_init();
 	program_init();
 	prefs_init();
-	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(debug_panel), pref_panel_tab_pos);
 	conterm_init();
 	inspect_init();
 	register_init();
@@ -609,7 +635,7 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
 
 	toolbar_update_state(DS_INACTIVE);
 	views_update_state(DS_INACTIVE);
-	scope_configure();
+	configure_toolbar();
 
 	g_signal_connect(debug_panel, "switch-page", G_CALLBACK(on_view_changed), NULL);
 	for (scb = scope_callbacks; scb->name; scb++)


Modified: scope/src/scope.h
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -27,8 +27,9 @@
 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 scope_configure(void);
+void configure_panel(void);
 
 #define SCOPE_H 1
 #endif



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list