[geany/geany] 9eb865: Merge pull request #337 from ntrel/project-line-wrap
Nick Treleaven
git-noreply at xxxxx
Mon Sep 29 15:16:50 UTC 2014
Branch: refs/heads/master
Author: Nick Treleaven <nick.treleaven at btinternet.com>
Committer: Nick Treleaven <nick.treleaven at btinternet.com>
Date: Mon, 29 Sep 2014 15:16:50 UTC
Commit: 9eb865dab366ca8de07b7d1ff34cef71d092b513
https://github.com/geany/geany/commit/9eb865dab366ca8de07b7d1ff34cef71d092b513
Log Message:
-----------
Merge pull request #337 from ntrel/project-line-wrap
Project line wrapping pref
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
15 lines changed, 11 insertions(+), 4 deletions(-)
===================================================================
@@ -404,6 +404,12 @@ static gint editor_get_long_line_column(void)
}
+static gboolean editor_get_line_wrapping(void)
+{
+ return app->project ? app->project->priv->line_wrapping : editor_prefs.line_wrapping;
+}
+
+
static const GeanyEditorPrefs *
get_default_prefs(void)
{
@@ -415,6 +421,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;
}
@@ -4755,7 +4762,7 @@ static gboolean register_named_icon(ScintillaObject *sci, guint id, const gchar
* @note The @c "sci-notify" signal is connected separately. */
static ScintillaObject *create_new_sci(GeanyEditor *editor)
{
- ScintillaObject *sci;
+ ScintillaObject *sci;
sci = SCINTILLA(scintilla_new());
@@ -4774,7 +4781,7 @@ static ScintillaObject *create_new_sci(GeanyEditor *editor)
setup_sci_keys(sci);
sci_set_symbol_margin(sci, editor_prefs.show_markers_margin);
- sci_set_lines_wrapped(sci, editor_prefs.line_wrapping);
+ sci_set_lines_wrapped(sci, editor->line_wrapping);
sci_set_caret_policy_x(sci, CARET_JUMPS | CARET_EVEN, 0);
/*sci_set_caret_policy_y(sci, CARET_JUMPS | CARET_EVEN, 0);*/
SSM(sci, SCI_AUTOCSETSEPARATOR, '\n', 0);
@@ -4843,7 +4850,7 @@ GeanyEditor *editor_create(GeanyDocument *doc)
doc->editor = editor; /* needed in case some editor functions/callbacks expect it */
editor->auto_indent = (iprefs->auto_indent_mode != GEANY_AUTOINDENT_NONE);
- editor->line_wrapping = editor_prefs.line_wrapping;
+ editor->line_wrapping = editor_get_line_wrapping();
editor->scroll_percent = -1.0F;
editor->line_breaking = FALSE;
@@ -4982,7 +4989,7 @@ void editor_set_indentation_guides(GeanyEditor *editor)
}
-/* Apply just the prefs that can change in the Preferences dialog */
+/* Apply non-document prefs that can change in the Preferences dialog */
void editor_apply_update_prefs(GeanyEditor *editor)
{
ScintillaObject *sci;
Modified: src/project.c
25 lines changed, 17 insertions(+), 8 deletions(-)
===================================================================
@@ -1129,6 +1129,7 @@ static gboolean write_config(gboolean emit_signal)
g_key_file_set_string_list(config, "project", "file_patterns",
(const gchar**) p->file_patterns, g_strv_length(p->file_patterns));
+ // editor settings
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);
@@ -1245,22 +1246,29 @@ void project_apply_prefs(void)
}
-static void add_stash_group(StashGroup *group)
+static void add_stash_group(StashGroup *group, gboolean apply_defaults)
{
+ GKeyFile *kf;
+
stash_groups = g_slist_prepend(stash_groups, group);
+ if (!apply_defaults)
+ return;
+
+ kf = g_key_file_new();
+ stash_group_load_from_key_file(group, kf);
+ g_key_file_free(kf);
}
static void init_stash_prefs(void)
{
StashGroup *group;
- GKeyFile *kf;
group = stash_group_new("indentation");
/* copy global defaults */
indentation = *editor_get_indent_prefs(NULL);
stash_group_set_use_defaults(group, FALSE);
- add_stash_group(group);
+ add_stash_group(group, FALSE);
stash_group_add_spin_button_integer(group, &indentation.width,
"indent_width", 4, "spin_indent_width_project");
@@ -1289,11 +1297,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");
- add_stash_group(group);
- /* apply defaults */
- kf = g_key_file_new();
- stash_group_load_from_key_file(group, kf);
- g_key_file_free(kf);
+ add_stash_group(group, TRUE);
+
+ group = stash_group_new("editor");
+ stash_group_add_toggle_button(group, &priv.line_wrapping,
+ "line_wrapping", editor_prefs.line_wrapping, "check_line_wrapping1");
+ add_stash_group(group, TRUE);
}
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