Revision: 3843
http://geany.svn.sourceforge.net/geany/?rev=3843&view=rev
Author: ntrel
Date: 2009-06-05 15:59:58 +0000 (Fri, 05 Jun 2009)
Log Message:
-----------
Fix segfault on parsing a filetypes.* style definition that has < 4
fields.
Allow style definitions to have missing fields to use the default
style fields.
Modified Paths:
--------------
trunk/ChangeLog
trunk/data/filetypes.common
trunk/src/highlighting.c
trunk/src/utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-06-05 15:57:01 UTC (rev 3842)
+++ trunk/ChangeLog 2009-06-05 15:59:58 UTC (rev 3843)
@@ -6,6 +6,11 @@
* src/editor.c:
Fix redrawing due to colourising just after the document is first
drawn. Now colourising should happen before the first draw.
+ * src/utils.c, src/highlighting.c, data/filetypes.common:
+ Fix segfault on parsing a filetypes.* style definition that has < 4
+ fields.
+ Allow style definitions to have missing fields to use the default
+ style fields.
2009-06-05 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/data/filetypes.common
===================================================================
--- trunk/data/filetypes.common 2009-06-05 15:57:01 UTC (rev 3842)
+++ trunk/data/filetypes.common 2009-06-05 15:59:58 UTC (rev 3843)
@@ -18,7 +18,7 @@
# background colour of the current line, only the second and third argument is interpreted
# use the third argument to enable or disable the highlighting of the current line (has to be true/false)
-current_line=0x0;0xf0f0f0;true;false
+current_line=0x000000;0xf0f0f0;true;false
# translucency for the current line(first argument) and the selection (second argument)
# values between 0 and 256 are accepted. Note for Windows 95, 98 and ME users:
@@ -40,7 +40,7 @@
# colour of the caret(the blinking cursor), only first and third argument is interpreted
# set the third argument to true to change the caret into a block caret
-caret=0x000000;0x0;false;false
+caret=0x000000;0x000000;false;false
# width of the caret(the blinking cursor), only first argument is interpreted
# width in pixels, use 0 to make it invisible, maximum width is 3
Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c 2009-06-05 15:57:01 UTC (rev 3842)
+++ trunk/src/highlighting.c 2009-06-05 15:59:58 UTC (rev 3843)
@@ -233,42 +233,59 @@
}
-/* FIXME: is not safe for badly formed key e.g. "key='" */
+static void parse_color(const gchar *str, gint *clr)
+{
+ gint c;
+
+ /* ignore empty strings */
+ if (!NZV(str))
+ return;
+
+ c = utils_strtod(str, NULL, FALSE);
+ if (c > -1)
+ {
+ *clr = c;
+ return;
+ }
+ geany_debug("Bad color '%s'", str);
+}
+
+
static void parse_keyfile_style(gchar **list,
const GeanyLexerStyle *default_style, GeanyLexerStyle *style)
{
+ gsize len;
+ gchar *str;
+
g_return_if_fail(default_style);
g_return_if_fail(style);
- if (G_LIKELY(list != NULL) && G_UNLIKELY(list[0] != NULL))
+ *style = *default_style;
+ style->foreground = rotate_rgb(default_style->foreground);
+ style->background = rotate_rgb(default_style->background);
+
+ if (!list)
+ return;
+
+ len = g_strv_length(list);
+
+ str = list[0];
+ if (len == 1 && isalpha(str[0]))
+ read_named_style(str, style);
+ else
{
- gchar *str = list[0];
-
- if (list[1] == NULL && isalpha(str[0]))
+ switch (len)
{
- read_named_style(str, style);
- return;
+ case 4:
+ style->italic = utils_atob(list[3]);
+ case 3:
+ style->bold = utils_atob(list[2]);
+ case 2:
+ parse_color(list[1], &style->background);
+ case 1:
+ parse_color(list[0], &style->foreground);
}
- else
- style->foreground = (gint) utils_strtod(str, NULL, FALSE);
}
- else
- style->foreground = rotate_rgb(default_style->foreground);
-
- if (G_LIKELY(list != NULL) && G_LIKELY(list[1] != NULL))
- style->background = (gint) utils_strtod(list[1], NULL, FALSE);
- else
- style->background = rotate_rgb(default_style->background);
-
- if (G_LIKELY(list != NULL) && G_LIKELY(list[2] != NULL))
- style->bold = utils_atob(list[2]);
- else
- style->bold = default_style->bold;
-
- if (G_LIKELY(list != NULL) && list[3] != NULL)
- style->italic = utils_atob(list[3]);
- else
- style->italic = default_style->italic;
}
@@ -304,6 +321,7 @@
}
+/* FIXME: is not safe for badly formed key e.g. "key=" */
static void get_keyfile_int(GKeyFile *config, GKeyFile *configh, const gchar *section,
const gchar *key, gint fdefault_val, gint sdefault_val,
GeanyLexerStyle *style)
Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c 2009-06-05 15:57:01 UTC (rev 3842)
+++ trunk/src/utils.c 2009-06-05 15:59:58 UTC (rev 3843)
@@ -943,7 +943,8 @@
/* utils_strtod() converts a string containing a hex colour ("0x00ff00") into an integer.
* Basically, it is the same as strtod() would do, but it does not understand hex colour values,
- * before ANSI-C99. With with_route set, it takes strings of the format "#00ff00". */
+ * before ANSI-C99. With with_route set, it takes strings of the format "#00ff00".
+ * Returns -1 on failure. */
gint utils_strtod(const gchar *source, gchar **end, gboolean with_route)
{
guint red, green, blue, offset = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3842
http://geany.svn.sourceforge.net/geany/?rev=3842&view=rev
Author: eht16
Date: 2009-06-05 15:57:01 +0000 (Fri, 05 Jun 2009)
Log Message:
-----------
When closing a document, mark it as invalid before removing it from the documents notebook (this fixes wrong Save All button state when closing an unsaved document because the "switch-page" signal handler was using old data).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/document.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-06-05 15:49:55 UTC (rev 3841)
+++ trunk/ChangeLog 2009-06-05 15:57:01 UTC (rev 3842)
@@ -17,6 +17,11 @@
dashes (patch by PCMan, thanks).
* data/filetypes.matlab:
Add build_settings section to allow executing Matlab scripts.
+ * src/document.c:
+ When closing a document, mark it as invalid before removing it from
+ the documents notebook (this fixes wrong Save All button state when
+ closing an unsaved document because the "switch-page" signal handler
+ was using old data).
2009-06-03 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2009-06-05 15:49:55 UTC (rev 3841)
+++ trunk/src/document.c 2009-06-05 15:57:01 UTC (rev 3842)
@@ -672,6 +672,8 @@
if (! main_status.closing_all && doc->real_path != NULL)
ui_add_recent_file(doc->file_name);
+ doc->is_valid = FALSE;
+
notebook_remove_page(page_num);
treeviews_remove_document(doc);
navqueue_remove_file(doc->file_name);
@@ -687,7 +689,6 @@
document_stop_file_monitoring(doc);
- doc->is_valid = FALSE;
doc->file_name = NULL;
doc->real_path = NULL;
doc->file_type = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3841
http://geany.svn.sourceforge.net/geany/?rev=3841&view=rev
Author: ntrel
Date: 2009-06-05 15:49:55 +0000 (Fri, 05 Jun 2009)
Log Message:
-----------
Fix redrawing due to colourising just after the document is first
drawn. Now colourising should happen before the first draw.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-06-05 15:45:44 UTC (rev 3840)
+++ trunk/ChangeLog 2009-06-05 15:49:55 UTC (rev 3841)
@@ -3,6 +3,9 @@
* src/toolbar.c:
Set status bar text instead of showing a dialog when saving
ui_toolbar.xml because the user might save several times.
+ * src/editor.c:
+ Fix redrawing due to colourising just after the document is first
+ drawn. Now colourising should happen before the first draw.
2009-06-05 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2009-06-05 15:45:44 UTC (rev 3840)
+++ trunk/src/editor.c 2009-06-05 15:49:55 UTC (rev 3841)
@@ -4210,29 +4210,47 @@
}
-static void editor_colourise(ScintillaObject *sci)
+static gboolean editor_check_colourise(GeanyEditor *editor)
{
- sci_colourise(sci, 0, -1);
+ GeanyDocument *doc = editor->document;
+ if (!doc->priv->colourise_needed)
+ return FALSE;
+
+ doc->priv->colourise_needed = FALSE;
+ sci_colourise(editor->sci, 0, -1);
+
/* now that the current document is colourised, fold points are now accurate,
* so force an update of the current function/tag. */
symbols_get_current_function(NULL, NULL);
ui_update_statusbar(NULL, -1);
+
+ return TRUE;
}
+/* We only want to colourise just before drawing, to save startup time and
+ * prevent unnecessary recolouring other documents after one is saved.
+ * Really we want a "draw" signal but there doesn't seem to be one (expose is too late,
+ * and "show" doesn't work). */
+static gboolean on_editor_focus_in(GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+ GeanyEditor *editor = user_data;
+
+ editor_check_colourise(editor);
+ return FALSE;
+}
+
+
+/* This is just to catch any uncolourised documents being drawn that didn't receive focus
+ * for some reason, maybe it's not necessary but just in case. */
static gboolean on_editor_expose_event(GtkWidget *widget, GdkEventExpose *event,
gpointer user_data)
{
GeanyEditor *editor = user_data;
- GeanyDocument *doc = editor->document;
- if (doc->priv->colourise_needed)
- {
- editor_colourise(editor->sci);
- doc->priv->colourise_needed = FALSE;
- }
- return FALSE; /* propagate event */
+ editor_check_colourise(editor);
+ return FALSE;
}
@@ -4302,6 +4320,7 @@
g_signal_connect(sci, "button-press-event", G_CALLBACK(on_editor_button_press_event), editor);
g_signal_connect(sci, "scroll-event", G_CALLBACK(on_editor_scroll_event), editor);
g_signal_connect(sci, "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
+ g_signal_connect(sci, "focus-in-event", G_CALLBACK(on_editor_focus_in), editor);
g_signal_connect(sci, "expose-event", G_CALLBACK(on_editor_expose_event), editor);
}
return sci;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3840
http://geany.svn.sourceforge.net/geany/?rev=3840&view=rev
Author: ntrel
Date: 2009-06-05 15:45:44 +0000 (Fri, 05 Jun 2009)
Log Message:
-----------
Set status bar text instead of showing a dialog when saving
ui_toolbar.xml because the user might save several times.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/toolbar.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-06-05 15:35:47 UTC (rev 3839)
+++ trunk/ChangeLog 2009-06-05 15:45:44 UTC (rev 3840)
@@ -1,3 +1,10 @@
+2009-06-05 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/toolbar.c:
+ Set status bar text instead of showing a dialog when saving
+ ui_toolbar.xml because the user might save several times.
+
+
2009-06-05 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/images.c, src/about.c, src/ui_utils.c, THANKS:
Modified: trunk/src/toolbar.c
===================================================================
--- trunk/src/toolbar.c 2009-06-05 15:35:47 UTC (rev 3839)
+++ trunk/src/toolbar.c 2009-06-05 15:45:44 UTC (rev 3840)
@@ -150,8 +150,8 @@
if (utils_str_equal(doc->real_path, utils_build_path(app->configdir, "ui_toolbar.xml", NULL)))
{
- dialogs_show_msgbox(GTK_MESSAGE_INFO,
- _("For all changes you make in this file to take effect, you need to restart Geany."));
+ ui_set_statusbar(FALSE, "%s",
+ _("For all changes you make in this file to take effect, you need to restart Geany."));
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3839
http://geany.svn.sourceforge.net/geany/?rev=3839&view=rev
Author: eht16
Date: 2009-06-05 15:35:47 +0000 (Fri, 05 Jun 2009)
Log Message:
-----------
Add build_settings section to allow executing Matlab scripts.
Modified Paths:
--------------
trunk/ChangeLog
trunk/data/filetypes.matlab
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-06-05 15:09:04 UTC (rev 3838)
+++ trunk/ChangeLog 2009-06-05 15:35:47 UTC (rev 3839)
@@ -5,6 +5,8 @@
* plugins/classbuilder.c:
Fix wrongly created header guards when the class filenames contains
dashes (patch by PCMan, thanks).
+ * data/filetypes.matlab:
+ Add build_settings section to allow executing Matlab scripts.
2009-06-03 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/data/filetypes.matlab
===================================================================
--- trunk/data/filetypes.matlab 2009-06-05 15:09:04 UTC (rev 3838)
+++ trunk/data/filetypes.matlab 2009-06-05 15:35:47 UTC (rev 3839)
@@ -36,3 +36,10 @@
# context action command (please see Geany's main documentation for details)
context_action_cmd=
+
+[build_settings]
+# %f will be replaced by the complete filename
+# %e will be replaced by the filename without extension
+# (use only one of it at one time)
+compiler=
+run_cmd=octave -q "%f"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.