Revision: 2719
http://geany.svn.sourceforge.net/geany/?rev=2719&view=rev
Author: ntrel
Date: 2008-06-20 07:19:57 -0700 (Fri, 20 Jun 2008)
Log Message:
-----------
Remove document_delay_colourise(), document_colourise_all().
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/callbacks.c
trunk/src/document.c
trunk/src/document.h
trunk/src/keyfile.c
trunk/src/main.c
trunk/src/socket.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-20 14:17:15 UTC (rev 2718)
+++ trunk/ChangeLog 2008-06-20 14:19:57 UTC (rev 2719)
@@ -7,6 +7,11 @@
document_colourise_all() functions redundant (they'll be removed in
the next commit).
Note: I'll move on_editor_expose_event() to editor.c.
+ * src/dialogs.c:
+ Use stack buffers for g_vsnprintf() instead of heap allocation.
+ * src/callbacks.c, src/keyfile.c, src/document.c, src/document.h,
+ src/main.c, src/socket.c:
+ Remove document_delay_colourise(), document_colourise_all().
2008-06-19 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c 2008-06-20 14:17:15 UTC (rev 2718)
+++ trunk/src/callbacks.c 2008-06-20 14:19:57 UTC (rev 2719)
@@ -204,8 +204,6 @@
gint i, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));
GeanyDocument *doc, *cur_doc = document_get_current();
- document_delay_colourise(); /* avoid recolourising all C files after each save */
-
for (i = 0; i < max; i++)
{
doc = document_get_from_page(i);
@@ -220,7 +218,6 @@
else
document_save_file(doc, FALSE);
}
- document_colourise_new();
treeviews_update_tag_list(cur_doc, TRUE);
ui_set_window_title(cur_doc);
}
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2008-06-20 14:17:15 UTC (rev 2718)
+++ trunk/src/document.c 2008-06-20 14:19:57 UTC (rev 2719)
@@ -703,14 +703,6 @@
* Open a %document specified by @a locale_filename.
* After all, the "document-open" signal is emitted for plugins.
*
- * When opening more than one file, either:
- * -# Use document_open_files().
- * -# Call document_delay_colourise() before document_open_file() and
- * document_colourise_new() after opening all files.
- *
- * This avoids unnecessary recolourising, saving significant processing when a lot of files
- * are open of a %filetype that supports user typenames, e.g. C.
- *
* @param locale_filename The filename of the %document to load, in locale encoding.
* @param readonly Whether to open the %document in read-only mode.
* @param ft The %filetype for the %document or @c NULL to auto-detect the %filetype.
@@ -1033,15 +1025,7 @@
* To reload a file, set the doc for the document to be reloaded; filename should be NULL.
* pos is the cursor position, which can be overridden by --line and --column.
* forced_enc can be NULL to detect the file encoding.
- * Returns: doc of the opened file or NULL if an error occurred.
- *
- * When opening more than one file, either:
- * 1. Use document_open_files().
- * 2. Call document_delay_colourise() before document_open_file() and
- * document_colourise_new() after opening all files.
- *
- * This avoids unnecessary recolourising, saving significant processing when a lot of files
- * are open of a filetype that supports user typenames, e.g. C. */
+ * Returns: doc of the opened file or NULL if an error occurred. */
GeanyDocument *document_open_file_full(GeanyDocument *doc, const gchar *filename, gint pos,
gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc)
{
@@ -1215,8 +1199,6 @@
default: list = g_strsplit(data, "\n", 0);
}
- document_delay_colourise();
-
for (i = 0; ; i++)
{
if (list[i] == NULL) break;
@@ -1225,15 +1207,13 @@
document_open_file(filename, FALSE, NULL, NULL);
g_free(filename);
}
- document_colourise_new();
g_strfreev(list);
}
/**
- * Opens each file in the list @a filenames, ensuring the newly opened documents and
- * existing documents (if necessary) are only colourised once.
+ * Opens each file in the list @a filenames.
* Internally, document_open_file() is called for every list item.
*
* @param filenames A list of filenames to load, in locale encoding.
@@ -1246,13 +1226,10 @@
{
const GSList *item;
- document_delay_colourise();
-
for (item = filenames; item != NULL; item = g_slist_next(item))
{
document_open_file(item->data, readonly, ft, forced_enc);
}
- document_colourise_new();
}
@@ -2493,21 +2470,9 @@
#endif
-void document_delay_colourise()
-{
- /* TODO: remove */
-}
-
-
-void document_colourise_new()
-{
- /* TODO: remove */
-}
-
-
+/* create a new file and copy file content and properties */
GeanyDocument *document_clone(GeanyDocument *old_doc, const gchar *utf8_filename)
{
- /* create a new file and copy file content and properties */
gint len;
gchar *text;
GeanyDocument *doc;
Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h 2008-06-20 14:17:15 UTC (rev 2718)
+++ trunk/src/document.h 2008-06-20 14:19:57 UTC (rev 2719)
@@ -235,8 +235,4 @@
GdkColor *document_get_status_color(GeanyDocument *doc);
-void document_delay_colourise(void);
-
-void document_colourise_new(void);
-
#endif
Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c 2008-06-20 14:17:15 UTC (rev 2718)
+++ trunk/src/keyfile.c 2008-06-20 14:19:57 UTC (rev 2719)
@@ -875,8 +875,6 @@
/* necessary to set it to TRUE for project session support */
main_status.opening_session_files = TRUE;
- document_delay_colourise();
-
i = file_prefs.tab_order_ltr ? 0 : (session_files->len - 1);
while (TRUE)
{
@@ -900,7 +898,6 @@
if (i < 0) break;
}
}
- document_colourise_new();
g_ptr_array_free(session_files, TRUE);
session_files = NULL;
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2008-06-20 14:17:15 UTC (rev 2718)
+++ trunk/src/main.c 2008-06-20 14:19:57 UTC (rev 2719)
@@ -708,8 +708,6 @@
if (argc <= 1) return FALSE;
- document_delay_colourise();
-
for (i = 1; i < argc; i++)
{
gchar *filename = get_argv_filename(argv[i]);
@@ -717,7 +715,6 @@
handle_cl_filename(filename);
g_free(filename);
}
- document_colourise_new();
return TRUE;
}
Modified: trunk/src/socket.c
===================================================================
--- trunk/src/socket.c 2008-06-20 14:17:15 UTC (rev 2718)
+++ trunk/src/socket.c 2008-06-20 14:19:57 UTC (rev 2719)
@@ -489,8 +489,6 @@
{
if (strncmp(buf, "open", 4) == 0)
{
- document_delay_colourise();
-
while (socket_fd_gets(sock, buf, sizeof(buf)) != -1 && *buf != '.')
{
g_strstrip(buf); /* remove \n char */
@@ -508,7 +506,6 @@
geany_debug("got data from socket, but it does not look like a filename");
}
}
- document_colourise_new();
#ifdef G_OS_WIN32
/* we need to bring the main window up with gtk_window_present() but this is not
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2717
http://geany.svn.sourceforge.net/geany/?rev=2717&view=rev
Author: ntrel
Date: 2008-06-20 05:34:13 -0700 (Fri, 20 Jun 2008)
Log Message:
-----------
Don't colourise any documents until they need to be drawn. This
should make Save All faster for filetypes that support typename
highlighting, and makes the document_delay_colourise(),
document_colourise_all() functions redundant (they'll be removed in
the next commit).
Note: I'll move on_editor_expose_event() to editor.c.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/document.c
trunk/src/documentprivate.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-19 17:42:40 UTC (rev 2716)
+++ trunk/ChangeLog 2008-06-20 12:34:13 UTC (rev 2717)
@@ -1,3 +1,14 @@
+2008-06-20 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/document.c, src/documentprivate.h:
+ Don't colourise any documents until they need to be drawn. This
+ should make Save All faster for filetypes that support typename
+ highlighting, and makes the document_delay_colourise(),
+ document_colourise_all() functions redundant (they'll be removed in
+ the next commit).
+ Note: I'll move on_editor_expose_event() to editor.c.
+
+
2008-06-19 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/dialogs.c, src/dialogs.c:
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2008-06-19 17:42:40 UTC (rev 2716)
+++ trunk/src/document.c 2008-06-20 12:34:13 UTC (rev 2717)
@@ -88,17 +88,10 @@
} undo_action;
-/* Whether to colourise the document straight after styling settings are changed.
- * (e.g. when filetype is set or typenames are updated) */
-static gboolean delay_colourise = FALSE;
-
-
static void document_undo_clear(GeanyDocument *doc);
static void document_redo_add(GeanyDocument *doc, guint type, gpointer data);
-static gboolean update_type_keywords(ScintillaObject *sci, gint lang);
-
/* ignore the case of filenames and paths under WIN32, causes errors if not */
#ifdef G_OS_WIN32
#define filenamecmp(a,b) strcasecmp((a), (b))
@@ -409,6 +402,44 @@
}
+static void queue_colourise(GeanyDocument *doc)
+{
+ /* Colourise the editor before it is next drawn */
+ DOCUMENT(doc)->colourise_needed = TRUE;
+
+ /* If the editor doesn't need drawing (e.g. after saving the current
+ * document), we need to force a redraw, so the expose event is triggered.
+ * This ensures we don't start colourising before all documents are opened/saved,
+ * only once the editor is drawn. */
+ gtk_widget_queue_draw(GTK_WIDGET(doc->sci));
+}
+
+
+static void editor_colourise(ScintillaObject *sci)
+{
+ sci_colourise(sci, 0, -1);
+
+ /* now that the current document is colourised, fold points are now accurate,
+ * so force an update of the current function/tag. */
+ utils_get_current_function(NULL, NULL);
+ ui_update_statusbar(NULL, -1);
+}
+
+
+static gboolean on_editor_expose_event(GtkWidget *widget, GdkEventExpose *event,
+ gpointer user_data)
+{
+ GeanyDocument *doc = user_data;
+
+ if (DOCUMENT(doc)->colourise_needed)
+ {
+ editor_colourise(doc->sci);
+ DOCUMENT(doc)->colourise_needed = FALSE;
+ }
+ return FALSE; /* propagate event */
+}
+
+
/* Create new editor (the scintilla widget) */
static ScintillaObject *create_new_sci(GeanyDocument *doc)
{
@@ -446,6 +477,8 @@
g_signal_connect(G_OBJECT(sci), "scroll-event",
G_CALLBACK(on_editor_scroll_event), doc);
g_signal_connect(G_OBJECT(sci), "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
+ g_signal_connect(G_OBJECT(sci), "expose-event",
+ G_CALLBACK(on_editor_expose_event), doc);
return sci;
}
@@ -1113,7 +1146,7 @@
/* "the" SCI signal (connect after initial setup(i.e. adding text)) */
g_signal_connect((GtkWidget*) doc->sci, "sci-notify",
- G_CALLBACK(on_editor_notification), doc);
+ G_CALLBACK(on_editor_notification), doc);
use_ft = (ft != NULL) ? ft : filetypes_detect_from_file(doc);
}
@@ -1121,9 +1154,9 @@
{ /* reloading */
document_undo_clear(doc);
- /* Unset the filetype so the document gets colourised by document_set_filetype().
+ /* Ensure the document gets colourised.
* (The text could have changed without typenames changing.) */
- doc->file_type = NULL;
+ queue_colourise(doc);
use_ft = ft;
}
/* update taglist, typedef keywords and build menu if necessary */
@@ -2075,11 +2108,12 @@
* If sci is not NULL, then if sci supports typenames, project typenames are updated
* if necessary, and typename keywords are set for sci.
* Returns: TRUE if any scintilla type keywords were updated. */
-static gboolean update_type_keywords(ScintillaObject *sci, gint lang)
+static gboolean update_type_keywords(GeanyDocument *doc, gint lang)
{
gboolean ret = FALSE;
guint n;
const GString *s;
+ ScintillaObject *sci = doc ? doc->sci : NULL;
if (sci != NULL && editor_lexer_get_type_keyword_idx(sci_get_lexer(sci)) == -1)
return FALSE;
@@ -2091,10 +2125,7 @@
gint keyword_idx = editor_lexer_get_type_keyword_idx(sci_get_lexer(sci));
sci_set_keywords(sci, keyword_idx, s->str);
- if (! delay_colourise)
- {
- sci_colourise(sci, 0, -1);
- }
+ queue_colourise(doc);
}
return FALSE;
}
@@ -2111,10 +2142,7 @@
if (keyword_idx > 0)
{
sci_set_keywords(wid, keyword_idx, s->str);
- if (! delay_colourise)
- {
- sci_colourise(wid, 0, -1);
- }
+ queue_colourise(documents[n]);
ret = TRUE;
}
}
@@ -2128,7 +2156,6 @@
* @param type The filetype. */
void document_set_filetype(GeanyDocument *doc, GeanyFiletype *type)
{
- gboolean colourise = FALSE;
gboolean ft_changed;
if (type == NULL || doc == NULL)
@@ -2152,22 +2179,13 @@
}
highlighting_set_styles(doc->sci, type->id);
build_menu_update(doc);
- colourise = TRUE;
+ queue_colourise(doc);
}
document_update_tag_list(doc, TRUE);
- if (! delay_colourise)
- {
- /* Check if project typename keywords have changed.
- * If they haven't, we may need to colourise the document. */
- if (! update_type_keywords(doc->sci, type->lang) && colourise)
- sci_colourise(doc->sci, 0, -1);
- }
- if (ft_changed)
- {
- utils_get_current_function(NULL, NULL);
- ui_update_statusbar(doc, -1);
- }
+
+ /* Update session typename keywords. */
+ update_type_keywords(doc, type->lang);
}
@@ -2475,72 +2493,15 @@
#endif
-static GArray *doc_indexes = NULL;
-
-/* Cache the current document indexes and prevent any colourising until
- * document_colourise_new() is called. */
void document_delay_colourise()
{
- gint n;
-
- g_return_if_fail(delay_colourise == FALSE);
- g_return_if_fail(doc_indexes == NULL);
-
- /* make an array containing all the current document indexes */
- doc_indexes = g_array_new(FALSE, FALSE, sizeof(gint));
- for (n = 0; n < (gint) documents_array->len; n++)
- {
- if (documents[n]->is_valid)
- g_array_append_val(doc_indexes, n);
- }
- delay_colourise = TRUE;
+ /* TODO: remove */
}
-/* Colourise only newly opened documents and existing documents whose project typenames
- * keywords have changed.
- * document_delay_colourise() should already have been called. */
void document_colourise_new()
{
- guint n, i;
- /* A bitset representing which docs need [re]colourising.
- * (use gint8 to save memory because gboolean = gint) */
- gint8 *doc_set = g_newa(gint8, documents_array->len);
- gboolean recolour = FALSE; /* whether to recolourise existing typenames */
-
- g_return_if_fail(delay_colourise == TRUE);
- g_return_if_fail(doc_indexes != NULL);
-
- /* first assume recolourising all docs */
- memset(doc_set, TRUE, documents_array->len * sizeof(gint8));
-
- /* remove existing docs from the set if they don't use typenames or typenames haven't changed */
- recolour = update_type_keywords(NULL, -2);
- for (i = 0; i < doc_indexes->len; i++)
- {
- ScintillaObject *sci;
-
- n = g_array_index(doc_indexes, gint, i);
- sci = documents[n]->sci;
- if (! recolour || (sci && editor_lexer_get_type_keyword_idx(sci_get_lexer(sci)) == -1))
- {
- doc_set[n] = FALSE;
- }
- }
- /* colourise all in the doc_set */
- for (n = 0; n < documents_array->len; n++)
- {
- if (doc_set[n] && documents[n]->is_valid)
- sci_colourise(documents[n]->sci, 0, -1);
- }
- delay_colourise = FALSE;
- g_array_free(doc_indexes, TRUE);
- doc_indexes = NULL;
-
- /* now that the current document is colourised, fold points are now accurate,
- * so force an update of the current function/tag. */
- utils_get_current_function(NULL, NULL);
- ui_update_statusbar(NULL, -1);
+ /* TODO: remove */
}
Modified: trunk/src/documentprivate.h
===================================================================
--- trunk/src/documentprivate.h 2008-06-19 17:42:40 UTC (rev 2716)
+++ trunk/src/documentprivate.h 2008-06-20 12:34:13 UTC (rev 2717)
@@ -67,6 +67,7 @@
GTrashStack *redo_actions;
/* Used so Undo/Redo works for encoding changes. */
FileEncoding saved_encoding;
+ gboolean colourise_needed;
}
Document;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2716
http://geany.svn.sourceforge.net/geany/?rev=2716&view=rev
Author: eht16
Date: 2008-06-19 10:42:40 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
Scroll by page only when Alt key is held to avoid possible conflicts.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-19 17:37:26 UTC (rev 2715)
+++ trunk/ChangeLog 2008-06-19 17:42:40 UTC (rev 2716)
@@ -23,6 +23,8 @@
* src/msgwindow.c:
Add "Copy All" to the popup menu of the Status, Compiler and Messages
treeviews to copy all items to the clipboard.
+ * src/editor.c:
+ Scroll by page only when Alt key is held to avoid possible conflicts.
2008-06-18 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-06-19 17:37:26 UTC (rev 2715)
+++ trunk/src/editor.c 2008-06-19 17:42:40 UTC (rev 2716)
@@ -3329,7 +3329,7 @@
{
/* Handle scroll events if Shift or Alt is pressed and scroll whole pages instead of a
* few lines only, maybe this could/should be done in Scintilla directly */
- if (event->state & (GDK_MOD1_MASK | GDK_SHIFT_MASK))
+ if (event->state & GDK_MOD1_MASK)
{
GeanyDocument *doc = user_data;
sci_cmd(doc->sci, (event->direction == GDK_SCROLL_DOWN) ? SCI_PAGEDOWN : SCI_PAGEUP);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2714
http://geany.svn.sourceforge.net/geany/?rev=2714&view=rev
Author: eht16
Date: 2008-06-19 10:25:40 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
Increase ABI for recent keybindings changes.
Modified Paths:
--------------
trunk/src/plugindata.h
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2008-06-19 17:09:46 UTC (rev 2713)
+++ trunk/src/plugindata.h 2008-06-19 17:25:40 UTC (rev 2714)
@@ -41,7 +41,7 @@
/* The ABI version should be incremented whenever existing fields in the plugin
* data types below have to be changed or reordered. It should stay the same if fields
* are only appended, as this doesn't affect existing fields. */
-static const gint abi_version = 39;
+static const gint abi_version = 40;
/** Check the plugin can be loaded by Geany.
* This performs runtime checks that try to ensure:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2712
http://geany.svn.sourceforge.net/geany/?rev=2712&view=rev
Author: eht16
Date: 2008-06-19 09:19:26 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
Allow symbol auto completion in embedded JavaScript in HTML files (closes #1997409).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-19 16:13:19 UTC (rev 2711)
+++ trunk/ChangeLog 2008-06-19 16:19:26 UTC (rev 2712)
@@ -14,6 +14,9 @@
* src/editor.c:
Improve scrolling on wrapped lines to avoid having search results on
wrapped lines but outside of visible lines.
+ * src/editor.c:
+ Allow symbol auto completion in embedded JavaScript in HTML files
+ (closes #1997409).
2008-06-18 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-06-19 16:13:19 UTC (rev 2711)
+++ trunk/src/editor.c 2008-06-19 16:19:26 UTC (rev 2712)
@@ -1231,9 +1231,9 @@
root = linebuf + startword;
rootlen = current - startword;
- /* entity autocompletion always in a HTML file, in a PHP file only
- * when we are outside of <? ?> */
- if (ft->id == GEANY_FILETYPES_HTML ||
+ /* entity autocompletion always in a HTML file except when inside embedded JavaScript,
+ * in a PHP file only when we are outside of <? ?> */
+ if ((ft->id == GEANY_FILETYPES_HTML && (style < SCE_HJ_START || style > SCE_HJ_REGEX)) ||
(ft->id == GEANY_FILETYPES_PHP && (style < SCE_HPHP_DEFAULT || style > SCE_HPHP_OPERATOR) &&
line != (sci_get_line_count(sci) - 1))) /* this check is a workaround for a Scintilla bug:
* the last line in a PHP gets wrong styling */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2711
http://geany.svn.sourceforge.net/geany/?rev=2711&view=rev
Author: eht16
Date: 2008-06-19 09:13:19 -0700 (Thu, 19 Jun 2008)
Log Message:
-----------
Improve scrolling on wrapped lines to avoid having search results on wrapped lines but outside of visible lines.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-19 15:58:10 UTC (rev 2710)
+++ trunk/ChangeLog 2008-06-19 16:13:19 UTC (rev 2711)
@@ -11,6 +11,9 @@
Replace Spaces by tabs.
Refactor different document keybindings callback functions into
cb_func_document_action().
+ * src/editor.c:
+ Improve scrolling on wrapped lines to avoid having search results on
+ wrapped lines but outside of visible lines.
2008-06-18 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-06-19 15:58:10 UTC (rev 2710)
+++ trunk/src/editor.c 2008-06-19 16:13:19 UTC (rev 2711)
@@ -2891,6 +2891,11 @@
{
gint vis1, los;
+ /* If line is wrapped the result may occur on another virtual line than the first and may be
+ * still hidden, so increase the line number to check for the next document line */
+ if (SSM(sci, SCI_WRAPCOUNT, line, 0) > 1)
+ line++;
+
line = SSM(sci, SCI_VISIBLEFROMDOCLINE, line, 0); /* convert to visible line number */
vis1 = SSM(sci, SCI_GETFIRSTVISIBLELINE, 0, 0);
los = SSM(sci, SCI_LINESONSCREEN, 0, 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.