SF.net SVN: geany:[5069] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Tue Jun 29 12:11:21 UTC 2010
Revision: 5069
http://geany.svn.sourceforge.net/geany/?rev=5069&view=rev
Author: ntrel
Date: 2010-06-29 12:11:21 +0000 (Tue, 29 Jun 2010)
Log Message:
-----------
Add statusbar_template hidden pref (based on patch by Dimitar
Zhekov, thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/THANKS
trunk/doc/geany.html
trunk/doc/geany.txt
trunk/src/ui_utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-06-29 11:53:41 UTC (rev 5068)
+++ trunk/ChangeLog 2010-06-29 12:11:21 UTC (rev 5069)
@@ -1,3 +1,10 @@
+2010-06-29 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/ui_utils.c, THANKS, doc/geany.txt, doc/geany.html:
+ Add statusbar_template hidden pref (based on patch by Dimitar
+ Zhekov, thanks).
+
+
2010-06-28 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/search.c:
Modified: trunk/THANKS
===================================================================
--- trunk/THANKS 2010-06-29 11:53:41 UTC (rev 5068)
+++ trunk/THANKS 2010-06-29 12:11:21 UTC (rev 5069)
@@ -77,7 +77,7 @@
Jon Senior <jon(at)restlesslemon(dot)co(dot)uk> - R tagmanager parser patch
Can Koy <cankoy(at)ymail(dot)com> - Multiple changes/improvements
Yoann Le Montagner <yoann(dot)le-montagner(at)m4x(dot)org> - set VTE bold color
-Dimitar Zhekov <hamster(at)mbox(dot)contact(dot)bg> - matching brace improvements patch
+Dimitar Zhekov <hamster(at)mbox(dot)contact(dot)bg> - various patches
Ondrej Donek <ondrejd(at)gmail(dot)com> - Support for creating PHP classes with the classbuilder plugin
Daniel Marjamaki <danielm77(at)spray(dot)se> - Small improvements
Jiří Techet <techet(at)gmail(dot)com> - Fix switch to last used tab ordering bug
Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html 2010-06-29 11:53:41 UTC (rev 5068)
+++ trunk/doc/geany.html 2010-06-29 12:11:21 UTC (rev 5069)
@@ -6,7 +6,7 @@
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
<title>Geany</title>
<meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" />
-<meta name="date" content="2010-06-21" />
+<meta name="date" content="2010-06-23" />
<style type="text/css">
/*
@@ -139,7 +139,7 @@
<br />Nick Treleaven
<br />Frank Lanitz</td></tr>
<tr><th class="docinfo-name">Date:</th>
-<td>2010-06-21</td></tr>
+<td>2010-06-23</td></tr>
<tr><th class="docinfo-name">Version:</th>
<td>0.20</td></tr>
</tbody>
@@ -4659,12 +4659,6 @@
<td>Whether to highlight <, > angle brackets.</td>
<td>false</td>
</tr>
-<tr><td>show_editor_scrollbars</td>
-<td>Whether to display scrollbars. If set to
-false, the horizontal and vertical
-scrollbars are hidden completely.</td>
-<td>true</td>
-</tr>
<tr><td>use_gtk_word_boundaries</td>
<td>Whether to look for the end of a word when
using word-boundary related Scintilla
@@ -4701,12 +4695,40 @@
and files can be saved.</td>
<td>false</td>
</tr>
+<tr><td>show_editor_scrollbars</td>
+<td>Whether to display scrollbars. If set to
+false, the horizontal and vertical
+scrollbars are hidden completely.</td>
+<td>true</td>
+</tr>
<tr><td>compiler_tab_autoscroll</td>
<td>Whether to automatically scroll to the
last line of the output in the Compiler
tab.</td>
<td>true</td>
</tr>
+<tr><td>statusbar_template</td>
+<td>The status bar statistics line format.
+(Search in src/ui_utils.c for details).</td>
+<td>See below.</td>
+</tr>
+</tbody>
+</table>
+<p>statusbar_template default:</p>
+<p><tt class="docutils literal"><span class="pre">line:</span> <span class="pre">%l</span> <span class="pre">/</span> <span class="pre">%L\t</span> <span class="pre">col:</span> <span class="pre">%c\t</span> <span class="pre">sel:</span> <span class="pre">%s\t</span> <span class="pre">%w</span> <span class="pre">%t</span> <span class="pre">%mmode:</span> <span class="pre">%M</span> <span class="pre">encoding:</span> <span class="pre">%e</span> <span class="pre">filetype:</span> <span class="pre">%f</span> <span class="pre">scope:</span> <span class="pre">%S</span></tt></p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="34%" />
+<col width="46%" />
+<col width="19%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">Key</th>
+<th class="head">Description</th>
+<th class="head">Default</th>
+</tr>
+</thead>
+<tbody valign="top">
<tr><td><strong>VTE related</strong></td>
<td> </td>
<td> </td>
@@ -6118,7 +6140,7 @@
<div class="footer">
<hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2010-06-23 12:24 UTC.
+Generated on: 2010-06-29 12:05 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt 2010-06-29 11:53:41 UTC (rev 5068)
+++ trunk/doc/geany.txt 2010-06-29 12:11:21 UTC (rev 5069)
@@ -4017,9 +4017,6 @@
================================ =========================================== ==================
**Editor related**
brace_match_ltgt Whether to highlight <, > angle brackets. false
-show_editor_scrollbars Whether to display scrollbars. If set to true
- false, the horizontal and vertical
- scrollbars are hidden completely.
use_gtk_word_boundaries Whether to look for the end of a word when true
using word-boundary related Scintilla
commands (see `Scintilla keyboard
@@ -4041,9 +4038,23 @@
setting this option to true, the Save
buttons and menu items are always active
and files can be saved.
+show_editor_scrollbars Whether to display scrollbars. If set to true
+ false, the horizontal and vertical
+ scrollbars are hidden completely.
compiler_tab_autoscroll Whether to automatically scroll to the true
last line of the output in the Compiler
tab.
+statusbar_template The status bar statistics line format. See below.
+ (Search in src/ui_utils.c for details).
+================================ =========================================== ==================
+
+statusbar_template default:
+
+``line: %l / %L\t col: %c\t sel: %s\t %w %t %mmode: %M encoding: %e filetype: %f scope: %S``
+
+================================ =========================================== ==================
+Key Description Default
+================================ =========================================== ==================
**VTE related**
emulation Terminal emulation mode. Only change this xterm
if you have VTE termcap files other than
Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c 2010-06-29 11:53:41 UTC (rev 5068)
+++ trunk/src/ui_utils.c 2010-06-29 12:11:21 UTC (rev 5069)
@@ -159,6 +159,112 @@
}
+static gchar *statusbar_template = NULL;
+
+/* note: some comments below are for translators */
+static void add_statusbar_statistics(GString *stats_str,
+ GeanyDocument *doc, guint line, guint col)
+{
+ const gchar *cur_tag;
+ const gchar *fmt;
+ const gchar *expos; /* % expansion position */
+ const gchar sp[] = " ";
+
+ fmt = statusbar_template ? statusbar_template :
+ /* Status bar statistics: col = column, sel = selection. */
+ _("line: %l / %L\t col: %c\t sel: %s\t %w %t %m"
+ "mode: %M encoding: %e filetype: %f scope: %S");
+
+ g_string_assign(stats_str, "");
+ while ((expos = strchr(fmt, '%')) != NULL)
+ {
+ /* append leading text before % char */
+ g_string_append_len(stats_str, fmt, expos - fmt);
+
+ switch (*++expos)
+ {
+ case 'l':
+ g_string_append_printf(stats_str, "%d", line + 1);
+ break;
+ case 'L':
+ g_string_append_printf(stats_str, "%d",
+ sci_get_line_count(doc->editor->sci));
+ break;
+ case 'c':
+ g_string_append_printf(stats_str, "%d", col);
+ break;
+ case 'C':
+ g_string_append_printf(stats_str, "%d", col + 1);
+ break;
+ case 's':
+ g_string_append_printf(stats_str, "%d",
+ sci_get_selected_text_length(doc->editor->sci) - 1);
+ break;
+ case 'w':
+ /* RO = read-only */
+ g_string_append(stats_str, (doc->readonly) ? _("RO ") :
+ /* OVR = overwrite/overtype, INS = insert */
+ (sci_get_overtype(doc->editor->sci) ? _("OVR") : _("INS")));
+ break;
+ case 'r':
+ if (doc->readonly) /* RO = read-only */
+ g_string_append(stats_str, _("RO "));
+ break;
+ case 't':
+ {
+ switch (editor_get_indent_prefs(doc->editor)->type)
+ {
+ case GEANY_INDENT_TYPE_TABS:
+ g_string_append(stats_str, _("TAB"));
+ break;
+ case GEANY_INDENT_TYPE_SPACES: /* SP = space */
+ g_string_append(stats_str, _("SP"));
+ break;
+ case GEANY_INDENT_TYPE_BOTH: /* T/S = tabs and spaces */
+ g_string_append(stats_str, _("T/S"));
+ break;
+ }
+ break;
+ }
+ case 'm':
+ if (doc->changed)
+ {
+ /* MOD = modified */
+ g_string_append(stats_str, _("MOD"));
+ g_string_append(stats_str, sp);
+ }
+ break;
+ case 'M':
+ g_string_append(stats_str, editor_get_eol_char_name(doc->editor));
+ break;
+ case 'e':
+ g_string_append(stats_str,
+ doc->encoding ? doc->encoding : _("unknown"));
+ if (encodings_is_unicode_charset(doc->encoding) && (doc->has_bom))
+ g_string_append(stats_str, _("(with BOM)")); /* BOM = byte order mark */
+ break;
+ case 'f':
+ g_string_append(stats_str, doc->file_type->name);
+ break;
+ case 'S':
+ symbols_get_current_function(doc, &cur_tag);
+ g_string_append(stats_str, cur_tag);
+ break;
+ default:
+ g_string_append_len(stats_str, expos, 1);
+ }
+
+ /* skip past %c chars */
+ if (*expos)
+ fmt = expos + 1;
+ else
+ break;
+ }
+ /* add any remaining text */
+ g_string_append(stats_str, fmt);
+}
+
+
/* updates the status bar document statistics */
void ui_update_statusbar(GeanyDocument *doc, gint pos)
{
@@ -171,10 +277,7 @@
if (doc != NULL)
{
static GString *stats_str = NULL;
- const gchar sp[] = " ";
guint line, col;
- const gchar *cur_tag;
- gchar *filetype_name = doc->file_type->name;
if (G_UNLIKELY(stats_str == NULL))
stats_str = g_string_sized_new(120);
@@ -191,59 +294,17 @@
else
col = 0;
- /* Status bar statistics: col = column, sel = selection. */
- g_string_printf(stats_str, _("line: %d / %d\t col: %d\t sel: %d\t "),
- (line + 1), sci_get_line_count(doc->editor->sci), col,
- sci_get_selected_text_length(doc->editor->sci) - 1);
+ add_statusbar_statistics(stats_str, doc, line, col);
- g_string_append(stats_str,
- /* RO = read-only */
- (doc->readonly) ? _("RO ") :
- /* OVR = overwrite/overtype, INS = insert */
- (sci_get_overtype(doc->editor->sci) ? _("OVR") : _("INS")));
- g_string_append(stats_str, sp);
-
- switch (editor_get_indent_prefs(doc->editor)->type)
- {
- case GEANY_INDENT_TYPE_TABS:
- g_string_append(stats_str, _("TAB"));
- break;
- case GEANY_INDENT_TYPE_SPACES:
- g_string_append(stats_str, _("SP")); /* SP = space */
- break;
- case GEANY_INDENT_TYPE_BOTH:
- g_string_append(stats_str, _("T/S")); /* T/S = tabs and spaces */
- break;
- }
- g_string_append(stats_str, sp);
- g_string_append_printf(stats_str, _("mode: %s"),
- editor_get_eol_char_name(doc->editor));
- g_string_append(stats_str, sp);
- g_string_append_printf(stats_str, _("encoding: %s %s"),
- (doc->encoding) ? doc->encoding : _("unknown"),
- (encodings_is_unicode_charset(doc->encoding)) ?
- /* BOM = byte order mark */
- ((doc->has_bom) ? _("(with BOM)") : "") : "");
- g_string_append(stats_str, sp);
- g_string_append_printf(stats_str, _("filetype: %s"), filetype_name);
- g_string_append(stats_str, sp);
- if (doc->changed)
- {
- g_string_append(stats_str, _("MOD")); /* MOD = modified */
- g_string_append(stats_str, sp);
- }
-
- symbols_get_current_function(doc, &cur_tag);
- g_string_append_printf(stats_str, _("scope: %s"),
- cur_tag);
-
#ifdef GEANY_DEBUG
+ {
+ const gchar sp[] = " ";
g_string_append(stats_str, sp);
g_string_append_printf(stats_str, "pos: %d", pos);
g_string_append(stats_str, sp);
g_string_append_printf(stats_str, "style: %d", sci_get_style_at(doc->editor->sci, pos));
+ }
#endif
-
/* can be overridden by status messages */
set_statusbar(stats_str->str, TRUE);
}
@@ -1929,10 +1990,21 @@
}
+static void on_load_settings(GObject *obj, GKeyFile *config)
+{
+ g_assert(statusbar_template == NULL);
+
+ statusbar_template = utils_get_setting_string(config,
+ PACKAGE, "statusbar_template", NULL);
+}
+
+
void ui_init(void)
{
GtkWidget *item;
+ g_signal_connect(geany_object, "load-settings", G_CALLBACK(on_load_settings), NULL);
+
init_recent_files();
ui_widgets.statusbar = ui_lookup_widget(main_widgets.window, "statusbar");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list