[geany/geany] cb2aeb: Enable per-project line wrapping
Tim Tassonis
git-noreply at xxxxx
Mon Sep 29 15:12:55 UTC 2014
Branch: refs/heads/master
Author: Tim Tassonis <stuff at decentral.ch>
Committer: Nick Treleaven <nick.treleaven at btinternet.com>
Date: Mon, 29 Sep 2014 15:12:55 UTC
Commit: cb2aebcfd98c8c53a98ffe00f33b7497c9c3f34a
https://github.com/geany/geany/commit/cb2aebcfd98c8c53a98ffe00f33b7497c9c3f34a
Log Message:
-----------
Enable per-project line wrapping
Modified Paths:
--------------
data/geany.glade
src/editor.c
src/project.c
src/projectprivate.h
Modified: data/geany.glade
16 lines changed, 16 insertions(+), 0 deletions(-)
===================================================================
@@ -9029,6 +9029,22 @@
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="check_line_wrapping1">
+ <property name="label" translatable="yes">Line wrapping</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Wrap the line at the window border and continue it on the next line. Note: line wrapping has a high performance cost for large documents so should be disabled on slow machines.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">2</property>
Modified: src/editor.c
13 lines changed, 13 insertions(+), 0 deletions(-)
===================================================================
@@ -375,6 +375,17 @@ static gboolean is_style_php(gint style)
}
+static gint editor_get_line_wrapping(void)
+{
+ if (app->project)
+ return app->project->priv->line_wrapping;
+ if (!editor_prefs.line_wrapping)
+ return 0;
+ else
+ return editor_prefs.line_wrapping;
+}
+
+
static gint editor_get_long_line_type(void)
{
if (app->project)
@@ -415,6 +426,7 @@ get_default_prefs(void)
eprefs.indentation = (GeanyIndentPrefs*)editor_get_indent_prefs(NULL);
eprefs.long_line_type = editor_get_long_line_type();
eprefs.long_line_column = editor_get_long_line_column();
+ eprefs.line_wrapping = editor_get_line_wrapping();
return &eprefs;
}
@@ -5009,6 +5021,7 @@ void editor_apply_update_prefs(GeanyEditor *editor)
sci_set_autoc_max_height(sci, editor_prefs.symbolcompletion_max_height);
SSM(sci, SCI_AUTOCSETDROPRESTOFWORD, editor_prefs.completion_drops_rest_of_word, 0);
+ editor_set_line_wrapping(editor, editor_get_line_wrapping());
editor_set_indentation_guides(editor);
sci_set_visible_white_spaces(sci, editor_prefs.show_white_space);
Modified: src/project.c
10 lines changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -684,6 +684,7 @@ static GeanyProject *create_project(void)
project->priv->long_line_behaviour = 1 /* use global settings */;
project->priv->long_line_column = editor_prefs.long_line_column;
+ project->priv->line_wrapping = editor_prefs.line_wrapping;
app->project = project;
return project;
@@ -1063,6 +1064,8 @@ static gboolean load_config(const gchar *filename)
"long_line_behaviour", 1 /* follow global */);
p->priv->long_line_column = utils_get_setting_integer(config, "long line marker",
"long_line_column", editor_prefs.long_line_column);
+ p->priv->line_wrapping = utils_get_setting_boolean(config, "line_wrapping",
+ "line_wrapping", editor_prefs.line_wrapping);
apply_editor_prefs();
build_load_menu(config, GEANY_BCS_PROJ, (gpointer)p);
@@ -1132,6 +1135,7 @@ static gboolean write_config(gboolean emit_signal)
g_key_file_set_integer(config, "long line marker", "long_line_behaviour", p->priv->long_line_behaviour);
g_key_file_set_integer(config, "long line marker", "long_line_column", p->priv->long_line_column);
+ g_key_file_set_boolean(config, "line_wrapping", "line_wrapping", p->priv->line_wrapping);
/* store the session files into the project too */
if (project_prefs.project_session)
configuration_save_session_files(config);
@@ -1289,6 +1293,12 @@ static void init_stash_prefs(void)
"strip_trailing_spaces", file_prefs.strip_trailing_spaces, "check_trailing_spaces1");
stash_group_add_toggle_button(group, &priv.replace_tabs,
"replace_tabs", file_prefs.replace_tabs, "check_replace_tabs1");
+ group = stash_group_new("file_prefs");
+ add_stash_group(group);
+
+ group = stash_group_new("line_wrapping");
+ stash_group_add_toggle_button(group, &priv.line_wrapping,
+ "line_wrapping", editor_prefs.line_wrapping, "check_line_wrapping1");
add_stash_group(group);
/* apply defaults */
kf = g_key_file_new();
Modified: src/projectprivate.h
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -39,6 +39,7 @@ typedef struct GeanyProjectPrivate
GPtrArray *build_filetypes_list; /* Project has custom filetype builds for these. */
gint long_line_behaviour; /* 0 - disabled, 1 - follow global settings, 2 - enabled (custom) */
gint long_line_column; /* Long line marker position. */
+ gboolean line_wrapping;
}
GeanyProjectPrivate;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list