Revision: 2590
http://geany.svn.sourceforge.net/geany/?rev=2590&view=rev
Author: eht16
Date: 2008-05-15 09:19:00 -0700 (Thu, 15 May 2008)
Log Message:
-----------
Make p_editor macro also available if GEANY_DISABLE_DEPRECATED is not defined.
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/pluginmacros.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-15 15:58:28 UTC (rev 2589)
+++ trunk/ChangeLog 2008-05-15 16:19:00 UTC (rev 2590)
@@ -3,6 +3,9 @@
* src/*.c src/*.h:
Move several editing related functions from document.c to editor.c.
Fix two compiler warnings about non-literal format strings.
+ * plugins/pluginmacros.h:
+ Make p_editor macro also available if GEANY_DISABLE_DEPRECATED
+ is not defined.
2008-05-14 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/plugins/pluginmacros.h
===================================================================
--- trunk/plugins/pluginmacros.h 2008-05-15 15:58:28 UTC (rev 2589)
+++ trunk/plugins/pluginmacros.h 2008-05-15 16:19:00 UTC (rev 2590)
@@ -72,6 +72,7 @@
#define p_tm tagmanager
#define p_ui ui
#define p_utils utils
+#define p_editor geany_data->editor
/* Temporary source compatibility macros - do not use these in new code. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2586
http://geany.svn.sourceforge.net/geany/?rev=2586&view=rev
Author: ntrel
Date: 2008-05-14 09:44:18 -0700 (Wed, 14 May 2008)
Log Message:
-----------
Update adding a filetype section, make clearer.
Modified Paths:
--------------
trunk/ChangeLog
trunk/HACKING
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-14 16:37:09 UTC (rev 2585)
+++ trunk/ChangeLog 2008-05-14 16:44:18 UTC (rev 2586)
@@ -33,6 +33,8 @@
* src/document.c:
Fix line breaking not getting reset for new documents sometimes.
Merge all document default settings into init_doc_struct().
+ * HACKING:
+ Update adding a filetype section, make clearer.
2008-05-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/HACKING
===================================================================
--- trunk/HACKING 2008-05-14 16:37:09 UTC (rev 2585)
+++ trunk/HACKING 2008-05-14 16:44:18 UTC (rev 2586)
@@ -174,7 +174,8 @@
parser' below.
Add GEANY_FILETYPES_FOO to filetypes.h.
-Initialize GEANY_FILETYPES_FOO in filetypes_init_types() of filetypes.c.
+Initialize GEANY_FILETYPES_FOO in init_builtin_filetypes() of
+filetypes.c.
Rebuild Geany.
From your geany/ directory, run:
src/geany --generate-data-files
@@ -186,28 +187,37 @@
--generate-data-files argument to work - this is always defined in the
SVN version. Alternatively, edit the file by hand.
+filetypes.* configuration file
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
All languages need a data/filetypes.foo configuration file. See
-data/filetypes.c for an example. For languages with a Scintilla lexer,
-there should be a [styling] section, to correspond to the styles used
-in styleset_foo().
+data/filetypes.c for an example.
Programming languages should have:
[keywords] if the lexer supports it.
[settings] mostly for comment settings.
[build_settings] for commands to run.
+For languages with a Scintilla lexer, there should be a [styling] section,
+to correspond to the styles used in styleset_foo() in highlighting.c -
+see below.
+
+Syntax highlighting
+^^^^^^^^^^^^^^^^^^^
For syntax highlighting, you will need to edit highlighting.c and add
the following things:
1. Write styleset_foo_init() to setup default styles and load style
-settings from the filetypes.foo configuration file. For details, see
-styleset_c_init().
+settings from the filetypes.foo configuration file. You should probably
+start by copying and adapting another filetype's initialization, such
+as styleset_asm_init().
2. Write styleset_foo() to apply styles when a new scintilla widget
-is created. For details, see styleset_c().
+is created. Again you could copy and adapt a function like styleset_asm().
3. Add this in highlighting_init_styles():
init_styleset_case(GEANY_FILETYPES_FOO, foo);
4. Add this in highlighting_set_styles():
styleset_case(GEANY_FILETYPES_FOO, foo);
+Other features
+^^^^^^^^^^^^^^
Error message parsing is done in msgwin_parse_compiler_error_line() of
msgwindow.c. See the ParseData typedef for more information. (In future
this may be done with a regex).
@@ -219,13 +229,13 @@
in editor.c. For now, this prevents calltips and autocompletion when
typing in a comment (but it can still be forced by the user).
-If the Scintilla lexer supports user type keywords (e.g. SCLEX_CPP),
-see editor_lexer_get_type_keyword_idx() in editor.c.
+If the Scintilla lexer supports user type keyword highlighting (e.g.
+SCLEX_CPP), update editor_lexer_get_type_keyword_idx() in editor.c.
Adding a TagManager parser
--------------------------
-This assumes the Geany filetype already exists.
+This assumes the filetype for Geany already exists.
First write or find a CTags compatible parser, foo.c. Note that there
are some language patches for CTags at:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2584
http://geany.svn.sourceforge.net/geany/?rev=2584&view=rev
Author: eht16
Date: 2008-05-14 09:13:16 -0700 (Wed, 14 May 2008)
Log Message:
-----------
Add shebang detection for Makefiles.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/filetypes.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-14 15:58:03 UTC (rev 2583)
+++ trunk/ChangeLog 2008-05-14 16:13:16 UTC (rev 2584)
@@ -18,6 +18,8 @@
* src/templates.c:
Remove unnecessary case statement for PHP files, can be handled by
the default case.
+ * src/filetypes.c:
+ Add shebang detection for Makefiles.
2008-05-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c 2008-05-14 15:58:03 UTC (rev 2583)
+++ trunk/src/filetypes.c 2008-05-14 16:13:16 UTC (rev 2584)
@@ -597,6 +597,8 @@
ft = filetypes[GEANY_FILETYPES_RUBY];
else if (strncmp(basename_interpreter, "tcl", 3) == 0)
ft = filetypes[GEANY_FILETYPES_TCL];
+ else if (strncmp(basename_interpreter, "make", 4) == 0)
+ ft = filetypes[GEANY_FILETYPES_MAKE];
else if (strncmp(basename_interpreter, "zsh", 3) == 0)
ft = filetypes[GEANY_FILETYPES_SH];
else if (strncmp(basename_interpreter, "ksh", 3) == 0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2583
http://geany.svn.sourceforge.net/geany/?rev=2583&view=rev
Author: eht16
Date: 2008-05-14 08:58:03 -0700 (Wed, 14 May 2008)
Log Message:
-----------
Remove unnecessary case statement for PHP files, can be handled by the default case.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/templates.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-14 15:50:11 UTC (rev 2582)
+++ trunk/ChangeLog 2008-05-14 15:58:03 UTC (rev 2583)
@@ -15,6 +15,9 @@
plugin.
* plugins/vcdiff.c:
Change an error message to be more clear about the error.
+ * src/templates.c:
+ Remove unnecessary case statement for PHP files, can be handled by
+ the default case.
2008-05-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c 2008-05-14 15:50:11 UTC (rev 2582)
+++ trunk/src/templates.c 2008-05-14 15:58:03 UTC (rev 2583)
@@ -595,14 +595,6 @@
break;
}
- case GEANY_FILETYPES_PHP:
- {
- frame_start = "/*\n";
- frame_end = " */\n";
- line_prefix = " *";
- break;
- }
-
case GEANY_FILETYPES_CAML:
{
frame_start = "(*\n";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2582
http://geany.svn.sourceforge.net/geany/?rev=2582&view=rev
Author: eht16
Date: 2008-05-14 08:50:11 -0700 (Wed, 14 May 2008)
Log Message:
-----------
Change an error message to be more clear about the error.
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/vcdiff.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-14 15:46:48 UTC (rev 2581)
+++ trunk/ChangeLog 2008-05-14 15:50:11 UTC (rev 2582)
@@ -13,6 +13,8 @@
Add new function document_set_indicator_on_line() for future use.
Add some functions to the plugin API for the upcoming spell check
plugin.
+ * plugins/vcdiff.c:
+ Change an error message to be more clear about the error.
2008-05-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/plugins/vcdiff.c
===================================================================
--- trunk/plugins/vcdiff.c 2008-05-14 15:46:48 UTC (rev 2581)
+++ trunk/plugins/vcdiff.c 2008-05-14 15:50:11 UTC (rev 2582)
@@ -304,7 +304,7 @@
}
else
{
- p_ui->set_statusbar(FALSE, _("Could not parse the output of the diff"));
+ p_ui->set_statusbar(FALSE, _("Input conversion of the diff output failed."));
}
g_free(text);
g_free(detect_enc);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2581
http://geany.svn.sourceforge.net/geany/?rev=2581&view=rev
Author: eht16
Date: 2008-05-14 08:46:48 -0700 (Wed, 14 May 2008)
Log Message:
-----------
Add new function document_set_indicator_on_line() for future use.
Add some functions to the plugin API for the upcoming spell check plugin.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/build.c
trunk/src/document.c
trunk/src/document.h
trunk/src/msgwindow.c
trunk/src/msgwindow.h
trunk/src/plugindata.h
trunk/src/plugins.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-14 15:36:27 UTC (rev 2580)
+++ trunk/ChangeLog 2008-05-14 15:46:48 UTC (rev 2581)
@@ -8,6 +8,11 @@
(closes #1895362) and to disable the automatic continuation of
multi-line comments in C-like languages.
Enable multi-line continuation also for CSS files.
+ * src/document.c, src/document.h, src/msgwindow.c, src/msgwindow.h,
+ src/plugins.c, src/plugindata.h:
+ Add new function document_set_indicator_on_line() for future use.
+ Add some functions to the plugin API for the upcoming spell check
+ plugin.
2008-05-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c 2008-05-14 15:36:27 UTC (rev 2580)
+++ trunk/src/build.c 2008-05-14 15:46:48 UTC (rev 2581)
@@ -855,7 +855,7 @@
{
gint idx = document_find_by_filename(filename, FALSE);
- document_set_indicator(idx, line - 1); /* will check valid idx */
+ document_set_indicator_on_line(idx, line - 1); /* will check valid idx */
color = COLOR_RED; /* error message parsed on the line */
}
g_free(filename);
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2008-05-14 15:36:27 UTC (rev 2580)
+++ trunk/src/document.c 2008-05-14 15:46:48 UTC (rev 2581)
@@ -2203,6 +2203,12 @@
}
+/**
+ * Deletes all currently set indicators in the %document.
+ * Error indicators (red squiggly underlines) and usual line markers are removed.
+ *
+ * @param idx The document index to operate on.
+ **/
void document_clear_indicators(gint idx)
{
glong last_pos;
@@ -2219,13 +2225,22 @@
}
-void document_set_indicator(gint idx, gint line)
+/**
+ * This is a convenience function for document_set_indicator(). It sets an error indicator
+ * (red squiggly underline) on the whole given line.
+ * Whitespace at the start and the end of the line is not marked.
+ *
+ * @param idx The %document index to operate on.
+ * @param line The line number which should be marked.
+ **/
+void document_set_indicator_on_line(gint idx, gint line)
{
- gint start, end, current_mask;
+ gint start, end;
guint i = 0, len;
gchar *linebuf;
- if (idx == -1 || ! doc_list[idx].is_valid) return;
+ if (! DOC_IDX_VALID(idx))
+ return;
start = sci_get_position_from_line(doc_list[idx].sci, line);
end = sci_get_position_from_line(doc_list[idx].sci, line + 1);
@@ -2240,15 +2255,39 @@
linebuf = sci_get_line(doc_list[idx].sci, line);
while (isspace(linebuf[i])) i++;
- while (len > 1 && len > i && isspace(linebuf[len-1])) len--;
+ while (len > 1 && len > i && isspace(linebuf[len-1]))
+ {
+ len--;
+ end--;
+ }
g_free(linebuf);
+ document_set_indicator(idx, start + i, end);
+}
+
+
+/**
+ * Sets an error indicator (red squiggly underline) on the range specified by @c start and @c end.
+ * No error checking or whitespace removal is performed, this should be done by the calling
+ * function if necessary.
+ *
+ * @param idx The %document index to operate on.
+ * @param start The starting position for the marker.
+ * @param end The ending position for the marker.
+ **/
+void document_set_indicator(gint idx, gint start, gint end)
+{
+ gint current_mask;
+
+ if (! DOC_IDX_VALID(idx) || start >= end)
+ return;
+
current_mask = sci_get_style_at(doc_list[idx].sci, start);
current_mask &= INDICS_MASK;
current_mask |= INDIC2_MASK;
- sci_start_styling(doc_list[idx].sci, start + i, INDIC2_MASK);
- /*geany_debug("%p\tline: %d\tstart-end: %d - %d\t%d - %i", doc_list[idx].sci, line, start, end, len, i);*/
- sci_set_styling(doc_list[idx].sci, len - i, current_mask);
+
+ sci_start_styling(doc_list[idx].sci, start, INDIC2_MASK);
+ sci_set_styling(doc_list[idx].sci, end - start, current_mask);
}
Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h 2008-05-14 15:36:27 UTC (rev 2580)
+++ trunk/src/document.h 2008-05-14 15:46:48 UTC (rev 2581)
@@ -219,8 +219,10 @@
void document_unfold_all(gint idx);
-void document_set_indicator(gint idx, gint line);
+void document_set_indicator_on_line(gint idx, gint line);
+void document_set_indicator(gint idx, gint start, gint end);
+
void document_clear_indicators(gint idx);
void document_replace_tabs(gint idx);
Modified: trunk/src/msgwindow.c
===================================================================
--- trunk/src/msgwindow.c 2008-05-14 15:36:27 UTC (rev 2580)
+++ trunk/src/msgwindow.c 2008-05-14 15:46:48 UTC (rev 2581)
@@ -213,6 +213,13 @@
}
+/**
+ * Adds a new message in the compiler tab treeview in the messages window.
+ *
+ * @param msg_color A color to be used for the text. It must be an element of #MsgColors.
+ * @param format Printf()-style format string.
+ * @param ... Arguments for the @c format string.
+ **/
void msgwin_compiler_add_fmt(gint msg_color, const gchar *format, ...)
{
gchar string[512];
@@ -225,7 +232,6 @@
}
-/* adds string to the compiler textview */
void msgwin_compiler_add(gint msg_color, const gchar *msg)
{
GtkTreeIter iter;
@@ -260,6 +266,17 @@
}
+/**
+ * Adds a new message in the messages tab treeview in the messages window.
+ * If @c line and @c idx are set, clicking on this line jumps into the file which is specified
+ * by @c idx into the line specified with @c line.
+ *
+ * @param msg_color A color to be used for the text. It must be an element of #MsgColors.
+ * @param line The document's line where the message belongs to. Set to -1 to ignore.
+ * @param idx The document's index in the doc_array. Set to -1 to ignore.
+ * @param format Printf()-style format string.
+ * @param ... Arguments for the @c format string.
+ **/
void msgwin_msg_add_fmt(gint msg_color, gint line, gint idx, const gchar *format, ...)
{
gchar string[512];
@@ -299,8 +316,13 @@
}
-/* Log a status message *without* setting the status bar.
- * (Use ui_set_statusbar() to display text on the statusbar) */
+/**
+ * Log a status message *without* setting the status bar.
+ * (Use ui_set_statusbar() to display text on the statusbar)
+ *
+ * @param format Printf()-style format string.
+ * @param ... Arguments for the @c format string.
+ **/
void msgwin_status_add(const gchar *format, ...)
{
GtkTreeIter iter;
@@ -520,7 +542,7 @@
if (DOC_IDX_VALID(idx))
{
if (! doc_list[idx].changed) /* if modified, line may be wrong */
- document_set_indicator(idx, line - 1);
+ document_set_indicator_on_line(idx, line - 1);
ret = navqueue_goto_line(old_idx, idx, line);
}
@@ -882,7 +904,15 @@
}
-void msgwin_switch_tab(MessageWindowTabNum tabnum, gboolean show)
+/**
+ * Switches to the given notebook tab of the messages window and shows the messages window
+ * if it was previously hidden and @c show is set to @a TRUE.
+ *
+ * @param tabnum An index of a tab in the messages window. Valid values are all elements of
+ * #MessageWindowTabNum.
+ * @param show Whether to show the messages window at all if it was hidden before.
+ **/
+void msgwin_switch_tab(gint tabnum, gboolean show)
{
GtkWidget *widget = NULL; /* widget to focus */
@@ -904,8 +934,13 @@
gtk_widget_grab_focus(widget);
}
-
-void msgwin_clear_tab(MessageWindowTabNum tabnum)
+/**
+ * Removes all messages from a tab specified by @c tabnum in the messages window.
+ *
+ * @param tabnum An index of a tab in the messages window which should be cleared.
+ * Valid values are @a MSG_STATUS, @a MSG_COMPILER and @a MSG_MESSAGE.
+ **/
+void msgwin_clear_tab(gint tabnum)
{
GtkListStore *store = NULL;
Modified: trunk/src/msgwindow.h
===================================================================
--- trunk/src/msgwindow.h 2008-05-14 15:36:27 UTC (rev 2580)
+++ trunk/src/msgwindow.h 2008-05-14 15:46:48 UTC (rev 2581)
@@ -21,26 +21,37 @@
* $Id$
*/
+/**
+ * @file msgwindow.h
+ * Message window functions (status, compiler, messages windows).
+ * Also compiler error message parsing and grep file and line parsing.
+ **/
+
#ifndef GEANY_MSGWINDOW_H
#define GEANY_MSGWINDOW_H 1
-enum
+/**
+ * Various colors for use in the compiler and messages treeviews when adding messages.
+ **/
+enum MsgColors
{
- COLOR_RED,
- COLOR_DARK_RED,
- COLOR_BLACK,
- COLOR_BLUE
+ COLOR_RED, /**< Color red */
+ COLOR_DARK_RED, /**< Color dark red */
+ COLOR_BLACK, /**< Color black */
+ COLOR_BLUE /**< Color blue */
};
+/** Indices of the notebooks in the messages window. */
typedef enum
{
- MSG_STATUS = 0, /* force it to start at 0 to keep in sync with the notebook page numbers */
- MSG_COMPILER,
- MSG_MESSAGE,
- MSG_SCRATCH,
- MSG_VTE
+ /* force it to start at 0 to keep in sync with the notebook page numbers */
+ MSG_STATUS = 0, /**< Index of the status message tab */
+ MSG_COMPILER, /**< Index of the compiler tab */
+ MSG_MESSAGE, /**< Index of the messages tab */
+ MSG_SCRATCH, /**< Index of the scratch tab */
+ MSG_VTE /**< Index of the VTE tab */
} MessageWindowTabNum;
@@ -69,9 +80,9 @@
void msgwin_show_hide(gboolean show);
-void msgwin_switch_tab(MessageWindowTabNum tabnum, gboolean show);
+void msgwin_switch_tab(gint tabnum, gboolean show);
-void msgwin_clear_tab(MessageWindowTabNum tabnum);
+void msgwin_clear_tab(gint tabnum);
void msgwin_msg_add_fmt(gint msg_color, gint line, gint idx, const gchar *format, ...) G_GNUC_PRINTF (4, 5);
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2008-05-14 15:36:27 UTC (rev 2580)
+++ trunk/src/plugindata.h 2008-05-14 15:46:48 UTC (rev 2581)
@@ -202,6 +202,9 @@
void (*set_encoding) (gint idx, const gchar *new_encoding);
void (*set_text_changed) (gint idx);
void (*set_filetype) (gint idx, filetype *type);
+ void (*set_indicator) (gint idx, gint start, gint end);
+ void (*set_indicator_on_line) (gint idx, gint line);
+ void (*clear_indicators) (gint idx);
}
DocumentFuncs;
@@ -246,6 +249,7 @@
gint (*get_style_at) (struct _ScintillaObject *sci, gint position);
gchar (*get_char_at) (struct _ScintillaObject *sci, gint pos);
gint (*get_current_line) (struct _ScintillaObject *sci);
+ gboolean (*can_copy) (struct _ScintillaObject *sci);
}
ScintillaFuncs;
@@ -326,6 +330,10 @@
/* status_add() does not set the status bar - use ui->set_statusbar() instead. */
void (*status_add) (const gchar *format, ...);
void (*compiler_add) (gint msg_color, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
+ void (*msg_add) (gint msg_color, gint line, gint idx, const gchar *format, ...)
+ G_GNUC_PRINTF (4, 5);
+ void (*clear_tab) (gint tabnum);
+ void (*switch_tab) (gint tabnum, gboolean show);
}
MsgWinFuncs;
Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c 2008-05-14 15:36:27 UTC (rev 2580)
+++ trunk/src/plugins.c 2008-05-14 15:46:48 UTC (rev 2581)
@@ -113,7 +113,10 @@
&document_reload_file,
&document_set_encoding,
&document_set_text_changed,
- &document_set_filetype
+ &document_set_filetype,
+ &document_set_indicator,
+ &document_set_indicator_on_line,
+ &document_clear_indicators
};
static ScintillaFuncs sci_funcs = {
@@ -150,6 +153,7 @@
&sci_get_style_at,
&sci_get_char_at,
&sci_get_current_line,
+ &sci_can_copy
};
static TemplateFuncs template_funcs = {
@@ -193,7 +197,10 @@
static MsgWinFuncs msgwin_funcs = {
&msgwin_status_add,
- &msgwin_compiler_add_fmt
+ &msgwin_compiler_add_fmt,
+ &msgwin_msg_add_fmt,
+ &msgwin_clear_tab,
+ &msgwin_switch_tab
};
static EncodingFuncs encoding_funcs = {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.