Note: this breaks the plugin API for indentation editor_prefs.

Add GeanyIndentPrefs struct from some GeanyEditorPrefs fields (maybe
this struct will get used elsewhere too).
Add editor_init().


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/custom-tab-width@2821 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-07-25 15:05:27 +00:00
parent af5a64f186
commit 501d543492
5 changed files with 40 additions and 14 deletions

View File

@ -1,3 +1,12 @@
2008-07-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/plugindata.h, src/main.c, src/editor.c, src/editor.h:
Note: this breaks the plugin API for indentation editor_prefs.
Add GeanyIndentPrefs struct from some GeanyEditorPrefs fields (maybe
this struct will get used elsewhere too).
Add editor_init().
2008-07-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> 2008-07-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/interface.c, src/ui_utils.c, geany.glade: * src/interface.c, src/ui_utils.c, geany.glade:

View File

@ -3662,3 +3662,13 @@ GeanyEditor *editor_create(GeanyDocument *doc)
return editor; return editor;
} }
void editor_init(void)
{
static GeanyIndentPrefs indent_prefs;
memset(&editor_prefs, 0, sizeof(GeanyEditorPrefs));
memset(&indent_prefs, 0, sizeof GeanyIndentPrefs);
editor_prefs->indentation = &indent_prefs;
}

View File

@ -51,14 +51,25 @@ typedef enum
INDENT_BASIC, INDENT_BASIC,
INDENT_CURRENTCHARS, INDENT_CURRENTCHARS,
INDENT_MATCHBRACES INDENT_MATCHBRACES
} IndentMode; } GeanyIndentMode;
/* These are the default prefs when creating a new editor window. typedef struct GeanyIndentPrefs
* Some of these can be overridden per document. {
* Remember to increment abi_version in plugindata.h when changing items. */ gint width; /**< Indent width. */
gint tab_width; /**< Width of a tab, if @c custom_tab_width is set. */
gboolean custom_tab_width; /**< Whether a tab is a different size from an indent. */
gboolean use_tabs; /**< Whether to (mainly) use tabs or spaces to indent. */
gboolean use_tab_to_indent; /* hidden pref */
GeanyIndentMode mode;
}
GeanyIndentPrefs;
/** Default prefs when creating a new editor window.
* Some of these can be overridden per document. */
typedef struct GeanyEditorPrefs typedef struct GeanyEditorPrefs
{ {
/* display */ GeanyIndentPrefs *indentation; /**< Indentation prefs. */
gboolean show_white_space; gboolean show_white_space;
gboolean show_indent_guide; gboolean show_indent_guide;
gboolean show_line_endings; gboolean show_line_endings;
@ -69,16 +80,10 @@ typedef struct GeanyEditorPrefs
gboolean show_linenumber_margin; /* view menu */ gboolean show_linenumber_margin; /* view menu */
gboolean show_scrollbars; /* hidden pref */ gboolean show_scrollbars; /* hidden pref */
gboolean scroll_stop_at_last_line; /* hidden pref */ gboolean scroll_stop_at_last_line; /* hidden pref */
/* behaviour */
gboolean line_wrapping; gboolean line_wrapping;
gboolean use_indicators; gboolean use_indicators;
gboolean folding; gboolean folding;
gboolean unfold_all_children; gboolean unfold_all_children;
gint tab_width;
gboolean use_tabs;
gboolean use_tab_to_indent; /* hidden pref */
IndentMode indent_mode;
gboolean disable_dnd; gboolean disable_dnd;
gboolean smart_home_key; gboolean smart_home_key;
gboolean newline_strip; gboolean newline_strip;
@ -125,6 +130,8 @@ extern EditorInfo editor_info;
void editor_init(void);
GeanyEditor *editor_create(GeanyDocument *doc); GeanyEditor *editor_create(GeanyDocument *doc);
void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data); void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data);

View File

@ -740,7 +740,6 @@ gint main(gint argc, gchar **argv)
memset(&prefs, 0, sizeof(GeanyPrefs)); memset(&prefs, 0, sizeof(GeanyPrefs));
memset(&interface_prefs, 0, sizeof(GeanyInterfacePrefs)); memset(&interface_prefs, 0, sizeof(GeanyInterfacePrefs));
memset(&toolbar_prefs, 0, sizeof(GeanyToolbarPrefs)); memset(&toolbar_prefs, 0, sizeof(GeanyToolbarPrefs));
memset(&editor_prefs, 0, sizeof(GeanyEditorPrefs));
memset(&file_prefs, 0, sizeof(GeanyFilePrefs)); memset(&file_prefs, 0, sizeof(GeanyFilePrefs));
memset(&search_prefs, 0, sizeof(GeanySearchPrefs)); memset(&search_prefs, 0, sizeof(GeanySearchPrefs));
memset(&tool_prefs, 0, sizeof(GeanyToolPrefs)); memset(&tool_prefs, 0, sizeof(GeanyToolPrefs));
@ -800,6 +799,7 @@ gint main(gint argc, gchar **argv)
load_settings(); load_settings();
msgwin_init(); msgwin_init();
editor_init();
build_init(); build_init();
search_init(); search_init();
ui_create_insert_menu_items(); ui_create_insert_menu_items();

View File

@ -36,12 +36,12 @@
/* The API version should be incremented whenever any plugin data types below are /* The API version should be incremented whenever any plugin data types below are
* modified or appended to. */ * modified or appended to. */
static const gint api_version = 82; static const gint api_version = 83;
/* The ABI version should be incremented whenever existing fields in the plugin /* 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 * 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. */ * are only appended, as this doesn't affect existing fields. */
static const gint abi_version = 43; static const gint abi_version = 44;
/** Check the plugin can be loaded by Geany. /** Check the plugin can be loaded by Geany.
* This performs runtime checks that try to ensure: * This performs runtime checks that try to ensure: