Partly fixed scintilla build
This commit is contained in:
parent
8e9a322a98
commit
455d8a6c6c
@ -47,8 +47,8 @@ SET(source_files
|
||||
../moo/mooedit/mooeditaction-factory.c
|
||||
../moo/mooedit/mooeditaction-factory.h
|
||||
../moo/mooedit/mooeditaction.h
|
||||
../moo/mooedit/mooeditbookmark.c
|
||||
../moo/mooedit/mooeditbookmark.h
|
||||
../moo/mooedit/native/mooeditbookmark.cpp
|
||||
../moo/mooedit/native/mooeditbookmark.h
|
||||
../moo/mooedit/mooedit.cpp
|
||||
../moo/mooedit/mooeditconfig.c
|
||||
../moo/mooedit/mooeditconfig.h
|
||||
|
@ -57,6 +57,7 @@ void _moo_edit_class_init_actions (MooEditClass *klass);
|
||||
|
||||
void _moo_edit_status_changed (MooEdit *edit);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
gboolean _moo_edit_has_comments (MooEdit *edit,
|
||||
gboolean *single_line,
|
||||
gboolean *multi_line);
|
||||
@ -71,12 +72,15 @@ void _moo_edit_line_mark_deleted (MooEdit *edit,
|
||||
gboolean _moo_edit_line_mark_clicked (MooTextView *view,
|
||||
int line);
|
||||
void _moo_edit_update_bookmarks_style (MooEdit *edit);
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
/***********************************************************************/
|
||||
/* Preferences
|
||||
*/
|
||||
enum {
|
||||
#ifndef MOO_USE_SCI
|
||||
MOO_EDIT_SETTING_LANG,
|
||||
#endif
|
||||
MOO_EDIT_SETTING_INDENT,
|
||||
MOO_EDIT_SETTING_STRIP,
|
||||
MOO_EDIT_SETTING_ADD_NEWLINE,
|
||||
|
@ -58,12 +58,14 @@ struct MooEditPrivate
|
||||
MooEditState state;
|
||||
MooEditProgress *progress;
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
/***********************************************************************/
|
||||
/* Bookmarks
|
||||
*/
|
||||
bool enable_bookmarks;
|
||||
GSList *bookmarks; /* sorted by line number */
|
||||
guint update_bookmarks_idle;
|
||||
#endif
|
||||
|
||||
/***********************************************************************/
|
||||
/* Actions
|
||||
|
@ -1,6 +1,8 @@
|
||||
LIST(APPEND moo_edit_enum_headers mooedit/mooedit-enums.h)
|
||||
|
||||
SET(mooedit_gtksourceview_sources
|
||||
mooedit/native/mooeditbookmark.cpp
|
||||
mooedit/native/mooeditbookmark.h
|
||||
mooedit/native/moolang-private.h
|
||||
mooedit/native/moolang.cpp
|
||||
mooedit/native/moolang.h
|
||||
@ -33,8 +35,6 @@ SET(mooedit_sources
|
||||
mooedit/mooeditaction-factory.h
|
||||
mooedit/mooeditaction.cpp
|
||||
mooedit/mooeditaction.h
|
||||
mooedit/mooeditbookmark.cpp
|
||||
mooedit/mooeditbookmark.h
|
||||
mooedit/mooeditconfig.cpp
|
||||
mooedit/mooeditconfig.h
|
||||
mooedit/mooeditdialogs.cpp
|
||||
|
@ -38,7 +38,9 @@
|
||||
#include "mooedit/mooeditaction-factory.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooeditview-impl.h"
|
||||
#include "mooedit/mooeditbookmark.h"
|
||||
#ifndef MOO_USE_SCI
|
||||
#include "mooedit/native/mooeditbookmark.h"
|
||||
#endif
|
||||
#include "mooedit/mooeditdialogs.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mootextbuffer.h"
|
||||
@ -95,7 +97,9 @@ static void changed_cb (GtkTextBuffer *buffer,
|
||||
static void modified_changed_cb (GtkTextBuffer *buffer,
|
||||
MooEdit *edit);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static MooLang *moo_edit_get_lang (MooEdit *doc);
|
||||
#endif
|
||||
|
||||
static void moo_edit_apply_prefs (MooEdit *doc);
|
||||
static void moo_edit_freeze_notify (MooEdit *doc);
|
||||
@ -117,10 +121,14 @@ static guint signals[LAST_SIGNAL];
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_EDITOR,
|
||||
#ifndef MOO_USE_SCI
|
||||
PROP_ENABLE_BOOKMARKS,
|
||||
#endif
|
||||
PROP_HAS_COMMENTS,
|
||||
PROP_LINE_END_TYPE,
|
||||
#ifndef MOO_USE_SCI
|
||||
PROP_LANG,
|
||||
#endif
|
||||
PROP_ENCODING
|
||||
};
|
||||
|
||||
@ -146,9 +154,11 @@ moo_edit_class_init (MooEditClass *klass)
|
||||
g_param_spec_object ("editor", "editor", "editor",
|
||||
MOO_TYPE_EDITOR, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
g_object_class_install_property (gobject_class, PROP_ENABLE_BOOKMARKS,
|
||||
g_param_spec_boolean ("enable-bookmarks", "enable-bookmarks", "enable-bookmarks",
|
||||
TRUE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_CONSTRUCT)));
|
||||
#endif
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_HAS_COMMENTS,
|
||||
g_param_spec_boolean ("has-comments", "has-comments", "has-comments",
|
||||
@ -163,9 +173,11 @@ moo_edit_class_init (MooEditClass *klass)
|
||||
g_param_spec_string ("encoding", "encoding", "encoding",
|
||||
NULL, (GParamFlags) G_PARAM_READWRITE));
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
g_object_class_install_property (gobject_class, PROP_LANG,
|
||||
g_param_spec_object ("lang", "lang", "lang",
|
||||
MOO_TYPE_LANG, G_PARAM_READABLE));
|
||||
#endif
|
||||
|
||||
signals[DOC_STATUS_CHANGED] =
|
||||
g_signal_new ("doc-status-changed",
|
||||
@ -295,9 +307,11 @@ MooEditPrivate::MooEditPrivate()
|
||||
, sync_timeout_id(0)
|
||||
, state(MOO_EDIT_STATE_NORMAL)
|
||||
, progress(nullptr)
|
||||
#ifndef MOO_USE_SCI
|
||||
, enable_bookmarks(false)
|
||||
, bookmarks(nullptr)
|
||||
, update_bookmarks_idle(0)
|
||||
#endif
|
||||
, actions(nullptr)
|
||||
{
|
||||
}
|
||||
@ -360,12 +374,14 @@ moo_edit_constructor (GType type,
|
||||
|
||||
_moo_edit_set_file (doc, NULL, NULL);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
g_signal_connect_swapped (doc->priv->buffer, "line-mark-moved",
|
||||
G_CALLBACK (_moo_edit_line_mark_moved),
|
||||
doc);
|
||||
g_signal_connect_swapped (doc->priv->buffer, "line-mark-deleted",
|
||||
G_CALLBACK (_moo_edit_line_mark_deleted),
|
||||
doc);
|
||||
#endif
|
||||
|
||||
return object;
|
||||
}
|
||||
@ -430,6 +446,7 @@ _moo_edit_closed (MooEdit *doc)
|
||||
doc->priv->sync_timeout_id = 0;
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
if (doc->priv->update_bookmarks_idle)
|
||||
{
|
||||
g_source_remove (doc->priv->update_bookmarks_idle);
|
||||
@ -437,6 +454,7 @@ _moo_edit_closed (MooEdit *doc)
|
||||
}
|
||||
|
||||
_moo_edit_delete_bookmarks (doc, TRUE);
|
||||
#endif
|
||||
|
||||
if (doc->priv->actions)
|
||||
{
|
||||
@ -749,9 +767,11 @@ moo_edit_set_property (GObject *object,
|
||||
edit->priv->editor = (MooEditor*) g_value_get_object (value);
|
||||
break;
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
case PROP_ENABLE_BOOKMARKS:
|
||||
moo_edit_set_enable_bookmarks (edit, g_value_get_boolean (value));
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PROP_ENCODING:
|
||||
moo_edit_set_encoding (edit, g_value_get_string (value));
|
||||
@ -782,6 +802,7 @@ moo_edit_get_property (GObject *object,
|
||||
g_value_set_object (value, edit->priv->editor);
|
||||
break;
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
case PROP_ENABLE_BOOKMARKS:
|
||||
g_value_set_boolean (value, edit->priv->enable_bookmarks);
|
||||
break;
|
||||
@ -789,14 +810,17 @@ moo_edit_get_property (GObject *object,
|
||||
case PROP_HAS_COMMENTS:
|
||||
g_value_set_boolean (value, _moo_edit_has_comments (edit, NULL, NULL));
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PROP_ENCODING:
|
||||
g_value_set_string (value, edit->priv->encoding);
|
||||
break;
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
case PROP_LANG:
|
||||
g_value_set_object (value, moo_edit_get_lang (edit));
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PROP_LINE_END_TYPE:
|
||||
g_value_set_enum (value, edit->priv->line_end_type);
|
||||
@ -1117,6 +1141,7 @@ set_emacs_var (MooEdit *edit,
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static void
|
||||
parse_emacs_mode_string (MooEdit *edit,
|
||||
char *string)
|
||||
@ -1132,7 +1157,7 @@ parse_emacs_mode_string (MooEdit *edit,
|
||||
else
|
||||
parse_mode_string (edit, string, ":", set_emacs_var);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
parse_moo_mode_string (MooEdit *edit,
|
||||
@ -1159,6 +1184,7 @@ try_mode_string (MooEdit *edit,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
if ((start = strstr (string, EMACS_MODE_STRING)))
|
||||
{
|
||||
start += strlen (EMACS_MODE_STRING);
|
||||
@ -1170,6 +1196,7 @@ try_mode_string (MooEdit *edit,
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((start = strstr (string, MOO_MODE_STRING)))
|
||||
{
|
||||
@ -1241,6 +1268,7 @@ update_config_from_mode_lines (MooEdit *edit)
|
||||
}
|
||||
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static MooLang *
|
||||
moo_edit_get_lang (MooEdit *doc)
|
||||
{
|
||||
@ -1249,12 +1277,12 @@ moo_edit_get_lang (MooEdit *doc)
|
||||
return moo_text_buffer_get_lang (MOO_TEXT_BUFFER (doc->priv->buffer));
|
||||
}
|
||||
|
||||
/**
|
||||
* moo_edit_get_lang_id:
|
||||
*
|
||||
* Returns: (type utf8): id of language currently used in the document. If no language
|
||||
* is used, then string "none" is returned.
|
||||
*/
|
||||
//**
|
||||
/* moo_edit_get_lang_id:
|
||||
/*
|
||||
/* Returns: (type utf8): id of language currently used in the document. If no language
|
||||
/* is used, then string "none" is returned.
|
||||
/*/
|
||||
char *
|
||||
moo_edit_get_lang_id (MooEdit *doc)
|
||||
{
|
||||
@ -1274,6 +1302,7 @@ moo_edit_get_lang_id (MooEdit *doc)
|
||||
|
||||
return g_strdup (_moo_lang_id (lang));
|
||||
}
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
static gboolean
|
||||
moo_edit_apply_config_all_in_idle (void)
|
||||
@ -1297,6 +1326,7 @@ _moo_edit_queue_recheck_config_all (void)
|
||||
}
|
||||
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static void
|
||||
update_lang_config_from_lang_globs (MooEdit *doc)
|
||||
{
|
||||
@ -1312,6 +1342,7 @@ update_lang_config_from_lang_globs (MooEdit *doc)
|
||||
moo_edit_config_set (doc->config, MOO_EDIT_CONFIG_SOURCE_FILENAME,
|
||||
"lang", lang_id, (char*) NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
update_config_from_filter_settings (MooEdit *doc)
|
||||
@ -1327,6 +1358,7 @@ update_config_from_filter_settings (MooEdit *doc)
|
||||
g_free (filter_config);
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static void
|
||||
update_config_from_lang (MooEdit *doc)
|
||||
{
|
||||
@ -1334,11 +1366,13 @@ update_config_from_lang (MooEdit *doc)
|
||||
_moo_lang_mgr_update_config (moo_lang_mgr_default (), doc->config, lang_id);
|
||||
g_free (lang_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
moo_edit_apply_config (MooEdit *doc)
|
||||
{
|
||||
guint i;
|
||||
#ifndef MOO_USE_SCI
|
||||
const char *lang_id = moo_edit_config_get_string (doc->config, "lang");
|
||||
MooLangMgr *mgr = moo_lang_mgr_default ();
|
||||
MooLang *lang = lang_id ? _moo_lang_mgr_find_lang (mgr, lang_id) : NULL;
|
||||
@ -1347,6 +1381,7 @@ moo_edit_apply_config (MooEdit *doc)
|
||||
|
||||
g_object_notify (G_OBJECT (doc), "has-comments");
|
||||
g_object_notify (G_OBJECT (doc), "lang");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < doc->priv->views->n_elms; ++i)
|
||||
_moo_edit_view_apply_config (doc->priv->views->elms[i]);
|
||||
@ -1372,8 +1407,10 @@ moo_edit_recheck_config (MooEdit *doc)
|
||||
// First global settings
|
||||
moo_edit_apply_prefs (doc);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
// then language from globs
|
||||
update_lang_config_from_lang_globs (doc);
|
||||
#endif
|
||||
|
||||
// then settings from mode lines, these may change lang
|
||||
update_config_from_mode_lines (doc);
|
||||
@ -1381,8 +1418,10 @@ moo_edit_recheck_config (MooEdit *doc)
|
||||
// then filter settings, these also may change lang
|
||||
update_config_from_filter_settings (doc);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
// update config for lang
|
||||
update_config_from_lang (doc);
|
||||
#endif
|
||||
|
||||
// finally apply config
|
||||
moo_edit_apply_config (doc);
|
||||
@ -1611,6 +1650,8 @@ _moo_edit_set_state (MooEdit *doc,
|
||||
}
|
||||
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Comment/uncomment
|
||||
*/
|
||||
@ -1916,6 +1957,8 @@ moo_edit_uncomment_selection (MooEdit *edit)
|
||||
gtk_text_buffer_end_user_action (buffer);
|
||||
}
|
||||
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
void
|
||||
_moo_edit_ensure_newline (MooEdit *edit)
|
||||
|
@ -35,7 +35,9 @@ MOO_DEBUG_INIT(filters, FALSE)
|
||||
#define PROP_CONFIG "config"
|
||||
|
||||
typedef enum {
|
||||
#ifndef MOO_USE_SCI
|
||||
MOO_EDIT_FILTER_LANGS,
|
||||
#endif
|
||||
MOO_EDIT_FILTER_GLOBS,
|
||||
MOO_EDIT_FILTER_REGEX,
|
||||
MOO_EDIT_FILTER_INVALID
|
||||
@ -44,7 +46,9 @@ typedef enum {
|
||||
struct MooEditFilter {
|
||||
MooEditFilterType type;
|
||||
union {
|
||||
#ifndef MOO_USE_SCI
|
||||
GSList *langs;
|
||||
#endif
|
||||
GSList *globs;
|
||||
GRegex *regex;
|
||||
char *string;
|
||||
@ -66,8 +70,10 @@ static FilterSettingsStore *settings_store;
|
||||
static char *filter_settings_store_get_setting (FilterSettingsStore *store,
|
||||
MooEdit *doc);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static MooEditFilter *moo_edit_filter_new_langs (const char *string,
|
||||
GError **error);
|
||||
#endif // !MOO_USE_SCI
|
||||
static MooEditFilter *moo_edit_filter_new_regex (const char *string,
|
||||
GError **error);
|
||||
static MooEditFilter *moo_edit_filter_new_globs (const char *string,
|
||||
@ -78,7 +84,6 @@ moo_edit_filter_get_string (MooEditFilter *filter,
|
||||
MooEditFilterType default_type)
|
||||
{
|
||||
GString *str;
|
||||
GSList *l;
|
||||
|
||||
g_return_val_if_fail (filter != NULL, NULL);
|
||||
|
||||
@ -88,9 +93,11 @@ moo_edit_filter_get_string (MooEditFilter *filter,
|
||||
{
|
||||
switch (filter->type)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
case MOO_EDIT_FILTER_LANGS:
|
||||
g_string_append (str, "langs:");
|
||||
break;
|
||||
#endif
|
||||
case MOO_EDIT_FILTER_GLOBS:
|
||||
g_string_append (str, "globs:");
|
||||
break;
|
||||
@ -104,15 +111,17 @@ moo_edit_filter_get_string (MooEditFilter *filter,
|
||||
|
||||
switch (filter->type)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
case MOO_EDIT_FILTER_LANGS:
|
||||
case MOO_EDIT_FILTER_GLOBS:
|
||||
for (l = filter->u.langs; l != NULL; l = l->next)
|
||||
for (GSList* l = filter->u.langs; l != NULL; l = l->next)
|
||||
{
|
||||
if (l != filter->u.langs)
|
||||
g_string_append (str, ";");
|
||||
g_string_append (str, (const char*) l->data);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case MOO_EDIT_FILTER_REGEX:
|
||||
g_string_append (str, g_regex_get_pattern (filter->u.regex));
|
||||
break;
|
||||
@ -131,8 +140,10 @@ _moo_edit_filter_new_full (const char *string,
|
||||
{
|
||||
g_return_val_if_fail (string && string[0], NULL);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
if (!strncmp (string, "langs:", strlen ("langs:")))
|
||||
return moo_edit_filter_new_langs (string + strlen ("langs:"), error);
|
||||
#endif
|
||||
if (!strncmp (string, "globs:", strlen ("globs:")))
|
||||
return moo_edit_filter_new_globs (string + strlen ("globs:"), error);
|
||||
if (!strncmp (string, "regex:", strlen ("regex:")))
|
||||
@ -169,6 +180,8 @@ _moo_edit_filter_new (const char *string,
|
||||
return filter;
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
|
||||
static GSList *
|
||||
_moo_edit_parse_langs (const char *string)
|
||||
{
|
||||
@ -210,6 +223,8 @@ moo_edit_filter_new_langs (const char *string,
|
||||
return filt;
|
||||
}
|
||||
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
static MooEditFilter *
|
||||
moo_edit_regex_new_invalid (const char *string,
|
||||
GError **error)
|
||||
@ -305,11 +320,13 @@ _moo_edit_filter_free (MooEditFilter *filter)
|
||||
{
|
||||
switch (filter->type)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
case MOO_EDIT_FILTER_GLOBS:
|
||||
case MOO_EDIT_FILTER_LANGS:
|
||||
g_slist_foreach (filter->u.langs, (GFunc) g_free, NULL);
|
||||
g_slist_free (filter->u.langs);
|
||||
break;
|
||||
#endif
|
||||
case MOO_EDIT_FILTER_REGEX:
|
||||
if (filter->u.regex)
|
||||
g_regex_unref (filter->u.regex);
|
||||
@ -346,6 +363,8 @@ moo_edit_filter_check_globs (GSList *globs,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
|
||||
static gboolean
|
||||
moo_edit_filter_check_langs (GSList *langs,
|
||||
MooEdit *doc)
|
||||
@ -367,6 +386,8 @@ moo_edit_filter_check_langs (GSList *langs,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
static gboolean
|
||||
moo_edit_filter_check_regex (GRegex *regex,
|
||||
MooEdit *doc)
|
||||
@ -387,8 +408,10 @@ _moo_edit_filter_match (MooEditFilter *filter,
|
||||
{
|
||||
case MOO_EDIT_FILTER_GLOBS:
|
||||
return moo_edit_filter_check_globs (filter->u.globs, doc);
|
||||
#ifndef MOO_USE_SCI
|
||||
case MOO_EDIT_FILTER_LANGS:
|
||||
return moo_edit_filter_check_langs (filter->u.langs, doc);
|
||||
#endif
|
||||
case MOO_EDIT_FILTER_REGEX:
|
||||
return moo_edit_filter_check_regex (filter->u.regex, doc);
|
||||
case MOO_EDIT_FILTER_INVALID:
|
||||
|
@ -44,7 +44,9 @@ struct MooEditorPrivate {
|
||||
GType window_type;
|
||||
GType doc_type;
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
MooLangMgr *lang_mgr;
|
||||
#endif
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -366,10 +366,12 @@ moo_editor_constructor (GType type,
|
||||
moo_ui_xml_add_ui_from_string (editor->priv->doc_ui_xml,
|
||||
mooedit_ui_xml, -1);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
editor->priv->lang_mgr = g::object_ref (moo_lang_mgr_default ());
|
||||
g_signal_connect_swapped (editor->priv->lang_mgr, "loaded",
|
||||
G_CALLBACK (_moo_editor_apply_prefs),
|
||||
editor);
|
||||
#endif
|
||||
|
||||
editor->priv->history = NULL;
|
||||
if (!is_embedded (editor))
|
||||
@ -477,7 +479,9 @@ moo_editor_finalize (GObject *object)
|
||||
g_object_unref (editor->priv->ui_xml);
|
||||
if (editor->priv->history)
|
||||
g_object_unref (editor->priv->history);
|
||||
#ifndef MOO_USE_SCI
|
||||
g_object_unref (editor->priv->lang_mgr);
|
||||
#endif
|
||||
g_object_unref (editor->priv->doc_ui_xml);
|
||||
|
||||
if (editor->priv->file_watch)
|
||||
@ -2980,7 +2984,6 @@ void
|
||||
_moo_editor_apply_prefs (MooEditor *editor)
|
||||
{
|
||||
gboolean backups;
|
||||
const char *color_scheme;
|
||||
|
||||
_moo_edit_window_update_title ();
|
||||
_moo_edit_window_set_use_tabs ();
|
||||
@ -2988,10 +2991,12 @@ _moo_editor_apply_prefs (MooEditor *editor)
|
||||
_moo_edit_update_global_config ();
|
||||
_moo_edit_queue_recheck_config_all ();
|
||||
|
||||
color_scheme = moo_prefs_get_string (moo_edit_setting (MOO_EDIT_PREFS_COLOR_SCHEME));
|
||||
#ifndef MOO_USE_SCI
|
||||
const char *color_scheme = moo_prefs_get_string (moo_edit_setting (MOO_EDIT_PREFS_COLOR_SCHEME));
|
||||
|
||||
if (color_scheme)
|
||||
_moo_lang_mgr_set_active_scheme (editor->priv->lang_mgr, color_scheme);
|
||||
#endif
|
||||
|
||||
backups = moo_prefs_get_bool (moo_edit_setting (MOO_EDIT_PREFS_MAKE_BACKUPS));
|
||||
|
||||
|
@ -79,10 +79,12 @@ _moo_edit_init_config (void)
|
||||
|
||||
_moo_edit_init_prefs ();
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
_moo_edit_settings[MOO_EDIT_SETTING_LANG] =
|
||||
moo_edit_config_install_setting (g_param_spec_string ("lang", "lang", "lang",
|
||||
NULL,
|
||||
(GParamFlags) G_PARAM_READWRITE));
|
||||
#endif
|
||||
_moo_edit_settings[MOO_EDIT_SETTING_INDENT] =
|
||||
moo_edit_config_install_setting (g_param_spec_string ("indent", "indent", "indent",
|
||||
NULL,
|
||||
@ -220,16 +222,20 @@ _moo_edit_update_global_config (void)
|
||||
void
|
||||
_moo_edit_view_apply_prefs (MooEditView *view)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
MooLangMgr *mgr;
|
||||
MooTextStyleScheme *scheme;
|
||||
#endif
|
||||
MooDrawWsFlags ws_flags = MOO_DRAW_WS_NONE;
|
||||
|
||||
g_return_if_fail (MOO_IS_EDIT_VIEW (view));
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (view));
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
mgr = moo_lang_mgr_default ();
|
||||
scheme = moo_lang_mgr_get_active_scheme (mgr);
|
||||
#endif
|
||||
|
||||
if (get_bool (MOO_EDIT_PREFS_SHOW_TABS))
|
||||
ws_flags |= MOO_DRAW_WS_TABS;
|
||||
@ -240,10 +246,12 @@ _moo_edit_view_apply_prefs (MooEditView *view)
|
||||
|
||||
g_object_set (view,
|
||||
"smart-home-end", get_bool (MOO_EDIT_PREFS_SMART_HOME_END),
|
||||
#ifndef MOO_USE_SCI
|
||||
"enable-highlight", get_bool (MOO_EDIT_PREFS_ENABLE_HIGHLIGHTING),
|
||||
"highlight-matching-brackets", get_bool (MOO_EDIT_PREFS_HIGHLIGHT_MATCHING),
|
||||
"highlight-mismatching-brackets", get_bool (MOO_EDIT_PREFS_HIGHLIGHT_MISMATCHING),
|
||||
"highlight-current-line", get_bool (MOO_EDIT_PREFS_HIGHLIGHT_CURRENT_LINE),
|
||||
#endif
|
||||
"draw-right-margin", get_bool (MOO_EDIT_PREFS_DRAW_RIGHT_MARGIN),
|
||||
"right-margin-offset", get_int (MOO_EDIT_PREFS_RIGHT_MARGIN_OFFSET),
|
||||
"quick-search-flags", get_int (MOO_EDIT_PREFS_QUICK_SEARCH_FLAGS),
|
||||
@ -259,8 +267,10 @@ _moo_edit_view_apply_prefs (MooEditView *view)
|
||||
_moo_text_view_set_line_numbers_font (MOO_TEXT_VIEW (view),
|
||||
get_string (MOO_EDIT_PREFS_LINE_NUMBERS_FONT));
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
if (scheme)
|
||||
moo_text_view_set_style_scheme (MOO_TEXT_VIEW (view), scheme);
|
||||
#endif
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (view));
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ typedef struct PrefsPage PrefsPage;
|
||||
static void prefs_page_apply_lang_prefs (MooPrefsPage *page);
|
||||
static void apply_filter_settings (PrefsFiltersXml *gxml);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static void scheme_combo_init (GtkComboBox *combo);
|
||||
static void scheme_combo_data_func (GtkCellLayout *layout,
|
||||
GtkCellRenderer *cell,
|
||||
@ -57,16 +58,21 @@ static void scheme_combo_set_scheme (GtkComboBox *combo,
|
||||
static void lang_combo_init (GtkComboBox *combo,
|
||||
MooPrefsPage *page,
|
||||
PrefsLangsXml *gxml);
|
||||
#endif
|
||||
|
||||
static void filter_treeview_init (PrefsFiltersXml *gxml);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static GtkTreeModel *create_lang_model (void);
|
||||
#endif
|
||||
|
||||
static void save_encoding_combo_init (PrefsFileXml *gxml);
|
||||
static void save_encoding_combo_apply (PrefsFileXml *gxml);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static GtkTreeModel *page_get_lang_model (MooPrefsPage *page);
|
||||
static MooTextStyleScheme *page_get_scheme (PrefsGeneralXml *gxml);
|
||||
#endif
|
||||
|
||||
|
||||
static GtkWidget *
|
||||
@ -140,21 +146,26 @@ page_general_init (MooPrefsPage *page)
|
||||
gxml->indent_width);
|
||||
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
MooTextStyleScheme *scheme;
|
||||
#endif
|
||||
|
||||
g_object_set (gxml->fontbutton, "monospace", TRUE, NULL);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
scheme = moo_lang_mgr_get_active_scheme (moo_lang_mgr_default ());
|
||||
g_return_if_fail (scheme != NULL);
|
||||
|
||||
scheme_combo_init (gxml->color_scheme_combo);
|
||||
scheme_combo_set_scheme (gxml->color_scheme_combo, scheme);
|
||||
#endif // !MOO_USE_SCI
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
page_general_apply (MooPrefsPage *page)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
PrefsGeneralXml *gxml = (PrefsGeneralXml*) g_object_get_data (G_OBJECT (page), "moo-edit-prefs-page-xml");
|
||||
MooTextStyleScheme *scheme = page_get_scheme (gxml);
|
||||
|
||||
@ -164,6 +175,7 @@ page_general_apply (MooPrefsPage *page)
|
||||
moo_text_style_scheme_get_id (scheme));
|
||||
g_object_unref (scheme);
|
||||
}
|
||||
#endif // !MOO_USE_SCI
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@ -322,6 +334,8 @@ moo_edit_prefs_page_new_3 (MooEditor *editor)
|
||||
}
|
||||
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
|
||||
static void
|
||||
page_langs_init_ui (MooPrefsPage *page)
|
||||
{
|
||||
@ -811,6 +825,8 @@ prefs_page_apply_lang_prefs (MooPrefsPage *page)
|
||||
_moo_edit_queue_recheck_config_all ();
|
||||
}
|
||||
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
/* Filters
|
||||
|
@ -7,7 +7,9 @@
|
||||
#include "mooedit/mooeditwindow-impl.h"
|
||||
#include "mooedit/mooedittab-impl.h"
|
||||
#include "mooedit/mooeditor-impl.h"
|
||||
#include "mooedit/mooeditbookmark.h"
|
||||
#ifndef MOO_USE_SCI
|
||||
#include "mooedit/native/mooeditbookmark.h"
|
||||
#endif
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooutils/mooutils.h"
|
||||
#include "mooutils/moocompat.h"
|
||||
@ -29,10 +31,12 @@ static gboolean moo_edit_view_drag_drop (GtkWidget *widget,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time);
|
||||
#ifndef MOO_USE_SCI
|
||||
static void moo_edit_view_apply_style_scheme (MooTextView *view,
|
||||
MooTextStyleScheme *scheme);
|
||||
static gboolean moo_edit_view_line_mark_clicked (MooTextView *view,
|
||||
int line);
|
||||
#endif
|
||||
|
||||
G_DEFINE_TYPE (MooEditView, moo_edit_view, MOO_TYPE_TEXT_VIEW)
|
||||
|
||||
@ -41,7 +45,6 @@ moo_edit_view_class_init (MooEditViewClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
MooTextViewClass *textview_class = MOO_TEXT_VIEW_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = moo_edit_view_dispose;
|
||||
|
||||
@ -50,8 +53,11 @@ moo_edit_view_class_init (MooEditViewClass *klass)
|
||||
widget_class->drag_drop = moo_edit_view_drag_drop;
|
||||
widget_class->focus_in_event = moo_edit_view_focus_in;
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
MooTextViewClass *textview_class = MOO_TEXT_VIEW_CLASS (klass);
|
||||
textview_class->line_mark_clicked = moo_edit_view_line_mark_clicked;
|
||||
textview_class->apply_style_scheme = moo_edit_view_apply_style_scheme;
|
||||
#endif
|
||||
|
||||
g_type_class_add_private (klass, sizeof (MooEditViewPrivate));
|
||||
}
|
||||
@ -117,6 +123,8 @@ _moo_edit_view_new (MooEdit *doc)
|
||||
}
|
||||
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
|
||||
static gboolean
|
||||
moo_edit_view_line_mark_clicked (MooTextView *view,
|
||||
int line)
|
||||
@ -133,6 +141,8 @@ moo_edit_view_apply_style_scheme (MooTextView *view,
|
||||
_moo_edit_update_bookmarks_style (moo_edit_view_get_doc (MOO_EDIT_VIEW (view)));
|
||||
}
|
||||
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
static gboolean
|
||||
moo_edit_view_focus_in (GtkWidget *widget,
|
||||
|
@ -36,7 +36,9 @@
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mooplugin.h"
|
||||
#include "mooedit/mooeditaction.h"
|
||||
#include "mooedit/mooeditbookmark.h"
|
||||
#ifndef MOO_USE_SCI
|
||||
#include "mooedit/native/mooeditbookmark.h"
|
||||
#endif
|
||||
#include "mooutils/moonotebook.h"
|
||||
#include "mooutils/moostock.h"
|
||||
#include "marshals.h"
|
||||
@ -195,9 +197,11 @@ static void edit_encoding_changed (MooEditWindow *win
|
||||
static void edit_line_end_changed (MooEditWindow *window,
|
||||
GParamSpec *pspec,
|
||||
MooEdit *doc);
|
||||
#ifndef MOO_USE_SCI
|
||||
static void edit_lang_changed (MooEditWindow *window,
|
||||
GParamSpec *pspec,
|
||||
MooEdit *doc);
|
||||
#endif
|
||||
static void view_overwrite_changed (MooEditWindow *window,
|
||||
GParamSpec *pspec,
|
||||
MooEditView *view);
|
||||
@ -215,7 +219,9 @@ static void update_tab_labels (MooEditWindow *win
|
||||
static void view_cursor_moved (MooEditWindow *window,
|
||||
GtkTextIter *iter,
|
||||
MooEditView *view);
|
||||
#ifndef MOO_USE_SCI
|
||||
static void update_lang_menu (MooEditWindow *window);
|
||||
#endif
|
||||
static void update_doc_view_actions (MooEditWindow *window);
|
||||
static void update_split_view_actions (MooEditWindow *window);
|
||||
|
||||
@ -226,7 +232,9 @@ static MooEditTab *get_nth_tab (MooNotebook ¬
|
||||
static MooEdit *get_nth_doc (MooNotebook *notebook,
|
||||
guint n);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static GtkAction *create_lang_action (MooEditWindow *window);
|
||||
#endif
|
||||
|
||||
static void create_paned (MooEditWindow *window);
|
||||
static void save_paned_config (MooEditWindow *window);
|
||||
@ -276,11 +284,13 @@ static void action_next_tab_in_view (MooEditWindow *window);
|
||||
static void action_switch_to_tab (MooEditWindow *window,
|
||||
guint n);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static void action_toggle_bookmark (MooEditWindow *window);
|
||||
static void action_next_bookmark (MooEditWindow *window);
|
||||
static void action_prev_bookmark (MooEditWindow *window);
|
||||
static GtkAction *create_goto_bookmark_action (MooWindow *window,
|
||||
gpointer data);
|
||||
#endif
|
||||
|
||||
static void action_find_now_f (MooEditWindow *window);
|
||||
static void action_find_now_b (MooEditWindow *window);
|
||||
@ -319,7 +329,9 @@ enum {
|
||||
/* aux properties */
|
||||
PROP_CAN_RELOAD,
|
||||
PROP_HAS_OPEN_DOCUMENT,
|
||||
#ifndef MOO_USE_SCI
|
||||
PROP_HAS_COMMENTS,
|
||||
#endif
|
||||
PROP_HAS_JOBS_RUNNING,
|
||||
PROP_HAS_STOP_CLIENTS,
|
||||
PROP_CAN_MOVE_TO_SPLIT_NOTEBOOK
|
||||
@ -419,7 +431,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass)
|
||||
|
||||
INSTALL_PROP (PROP_CAN_RELOAD, "can-reload");
|
||||
INSTALL_PROP (PROP_HAS_OPEN_DOCUMENT, "has-open-document");
|
||||
#ifndef MOO_USE_SCI
|
||||
INSTALL_PROP (PROP_HAS_COMMENTS, "has-comments");
|
||||
#endif
|
||||
INSTALL_PROP (PROP_HAS_JOBS_RUNNING, "has-jobs-running");
|
||||
INSTALL_PROP (PROP_HAS_STOP_CLIENTS, "has-stop-clients");
|
||||
INSTALL_PROP (PROP_CAN_MOVE_TO_SPLIT_NOTEBOOK, "can-move-to-split-notebook");
|
||||
@ -706,6 +720,7 @@ moo_edit_window_class_init (MooEditWindowClass *klass)
|
||||
g_free (action_id);
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
for (i = 1; i < 10; ++i)
|
||||
{
|
||||
char *action_id = g_strdup_printf (MOO_EDIT_GOTO_BOOKMARK_ACTION "%u", i);
|
||||
@ -740,7 +755,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass)
|
||||
"connect-accel", TRUE,
|
||||
"closure-callback", action_prev_bookmark,
|
||||
NULL);
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
moo_window_class_new_action (window_class, "Comment", NULL,
|
||||
/* action */
|
||||
"display-name", _("Comment"),
|
||||
@ -760,6 +777,7 @@ moo_edit_window_class_init (MooEditWindowClass *klass)
|
||||
"closure-proxy-func", moo_edit_window_get_active_doc,
|
||||
"condition::sensitive", "has-comments",
|
||||
NULL);
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
moo_window_class_new_action (window_class, "Indent", NULL,
|
||||
"display-name", GTK_STOCK_INDENT,
|
||||
@ -827,9 +845,11 @@ moo_edit_window_class_init (MooEditWindowClass *klass)
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
moo_window_class_new_action_custom (window_class, LANG_ACTION_ID, NULL,
|
||||
(MooWindowActionFunc) create_lang_action,
|
||||
NULL, NULL);
|
||||
#endif
|
||||
|
||||
{
|
||||
GValue val = { 0 };
|
||||
@ -976,10 +996,12 @@ static void moo_edit_window_get_property(GObject *object,
|
||||
case PROP_CAN_MOVE_TO_SPLIT_NOTEBOOK:
|
||||
g_value_set_boolean (value, can_move_to_split_notebook (window));
|
||||
break;
|
||||
#ifndef MOO_USE_SCI
|
||||
case PROP_HAS_COMMENTS:
|
||||
doc = ACTIVE_DOC (window);
|
||||
g_value_set_boolean (value, doc && _moo_edit_has_comments (doc, NULL, NULL));
|
||||
break;
|
||||
#endif
|
||||
case PROP_HAS_JOBS_RUNNING:
|
||||
g_value_set_boolean (value, window->priv->jobs != NULL);
|
||||
break;
|
||||
@ -1721,6 +1743,8 @@ action_abort_jobs (MooEditWindow *window)
|
||||
}
|
||||
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
|
||||
static void
|
||||
action_toggle_bookmark (MooEditWindow *window)
|
||||
{
|
||||
@ -1818,16 +1842,22 @@ create_goto_bookmark_action (MooWindow *window,
|
||||
return action;
|
||||
}
|
||||
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
const ObjectDataAccessor<GtkWidget, MooEditBookmark*> widget_bookmark("moo-bookmark");
|
||||
#endif
|
||||
const ObjectDataAccessor<GtkWidget, MooEdit*> widget_doc("moo-edit");
|
||||
const ObjectDataAccessor<GtkWidget, MooEditView*> widget_view("moo-edit-view");
|
||||
const ObjectDataAccessor<GtkWidget, MooEditTab*> data_moo_edit_tab("moo-edit-tab");
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
|
||||
static void
|
||||
bookmark_item_activated (GtkWidget *item)
|
||||
{
|
||||
@ -1954,16 +1984,19 @@ doc_item_selected (MooWindow *window,
|
||||
populate_bookmark_menu (MOO_EDIT_WINDOW (window), menu, next_bk_item);
|
||||
}
|
||||
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
static void
|
||||
moo_edit_window_connect_menubar (MooWindow *window)
|
||||
{
|
||||
GtkWidget *doc_item;
|
||||
GtkWidget *win_item;
|
||||
|
||||
if (!window->menubar)
|
||||
return;
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
GtkWidget *doc_item;
|
||||
doc_item = moo_ui_xml_get_widget (moo_window_get_ui_xml (window),
|
||||
window->menubar,
|
||||
"Editor/Menubar/Document");
|
||||
@ -1971,6 +2004,7 @@ moo_edit_window_connect_menubar (MooWindow *window)
|
||||
g_signal_connect_swapped (doc_item, "select",
|
||||
G_CALLBACK (doc_item_selected),
|
||||
window);
|
||||
#endif
|
||||
|
||||
win_item = moo_ui_xml_get_widget (moo_window_get_ui_xml (window),
|
||||
window->menubar,
|
||||
@ -2545,16 +2579,20 @@ edit_changed (MooEditWindow *window,
|
||||
g_object_freeze_notify (G_OBJECT (window));
|
||||
g_object_notify (G_OBJECT (window), "can-reload");
|
||||
g_object_notify (G_OBJECT (window), "has-open-document");
|
||||
#ifndef MOO_USE_SCI
|
||||
g_object_notify (G_OBJECT (window), "has-comments");
|
||||
#endif
|
||||
g_object_thaw_notify (G_OBJECT (window));
|
||||
|
||||
update_split_view_actions (window);
|
||||
update_window_title (window);
|
||||
update_statusbar (window);
|
||||
#ifndef MOO_USE_SCI
|
||||
update_lang_menu (window);
|
||||
#endif
|
||||
update_doc_view_actions (window);
|
||||
update_doc_encoding_item (window);
|
||||
update_doc_line_end_item (window);
|
||||
update_doc_line_end_item (window);
|
||||
}
|
||||
|
||||
if (doc)
|
||||
@ -3108,10 +3146,12 @@ _moo_edit_window_insert_tab (MooEditWindow *window,
|
||||
G_CALLBACK (edit_line_end_changed), window);
|
||||
g_signal_connect_swapped (doc, "filename_changed",
|
||||
G_CALLBACK (edit_filename_changed), window);
|
||||
#ifndef MOO_USE_SCI
|
||||
g_signal_connect_swapped (doc, "notify::has-comments",
|
||||
G_CALLBACK (proxy_boolean_property), window);
|
||||
g_signal_connect_swapped (doc, "notify::lang",
|
||||
G_CALLBACK (edit_lang_changed), window);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < moo_edit_view_array_get_size (views); ++i)
|
||||
connect_view (window, views->elms[i]);
|
||||
@ -3172,7 +3212,9 @@ _moo_edit_window_remove_doc (MooEditWindow *window,
|
||||
g_signal_handlers_disconnect_by_func (doc, (gpointer) edit_changed, window);
|
||||
g_signal_handlers_disconnect_by_func (doc, (gpointer) edit_filename_changed, window);
|
||||
g_signal_handlers_disconnect_by_func (doc, (gpointer) proxy_boolean_property, window);
|
||||
#ifndef MOO_USE_SCI
|
||||
g_signal_handlers_disconnect_by_func (doc, (gpointer) edit_lang_changed, window);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < views->n_elms; ++i)
|
||||
disconnect_view (window, views->elms[i]);
|
||||
@ -3976,6 +4018,8 @@ create_statusbar (MooEditWindow *window)
|
||||
}
|
||||
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Language menu
|
||||
*/
|
||||
@ -4101,6 +4145,8 @@ edit_lang_changed (MooEditWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Action properties checks
|
||||
|
@ -56,9 +56,10 @@ void _moo_text_buffer_update_highlight (MooTextBuffer *buffer,
|
||||
gpointer _moo_text_buffer_get_undo_stack (MooTextBuffer *buffer);
|
||||
gboolean _moo_text_buffer_is_bracket_tag (MooTextBuffer *buffer,
|
||||
GtkTextTag *tag);
|
||||
#ifndef MOO_USE_SCI
|
||||
void _moo_text_buffer_set_style_scheme (MooTextBuffer *buffer,
|
||||
MooTextStyleScheme *scheme);
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -33,6 +33,7 @@ struct MooTextBufferPrivate {
|
||||
gboolean has_selection;
|
||||
gboolean has_text;
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
MooTextStyleScheme *style_scheme;
|
||||
GtkSourceEngine *engine;
|
||||
MooLang *lang;
|
||||
@ -47,6 +48,7 @@ struct MooTextBufferPrivate {
|
||||
GtkTextTag *incorrect_match_tag;
|
||||
GtkTextMark *bracket_mark[4];
|
||||
MooBracketMatchType bracket_found;
|
||||
#endif
|
||||
|
||||
LineBuffer *line_buf;
|
||||
MooFoldTree *fold_tree;
|
||||
@ -90,6 +92,7 @@ static void moo_text_buffer_begin_user_action (GtkTextBuffer *buffer)
|
||||
static void moo_text_buffer_end_user_action (GtkTextBuffer *buffer);
|
||||
static void moo_text_buffer_modified_changed (GtkTextBuffer *buffer);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static void moo_text_buffer_highlight_brackets (MooTextBuffer *buffer,
|
||||
const GtkTextIter *insert);
|
||||
static void moo_text_buffer_unhighlight_brackets(MooTextBuffer *buffer);
|
||||
@ -102,6 +105,7 @@ static void emit_cursor_moved (MooTextBuffer *buffer,
|
||||
const GtkTextIter *iter);
|
||||
static void freeze_cursor_moved (MooTextBuffer *buffer);
|
||||
static void thaw_cursor_moved (MooTextBuffer *buffer);
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
static guint INSERT_ACTION_TYPE;
|
||||
@ -128,8 +132,10 @@ static void line_mark_deleted (MooTextBuffer *buffer,
|
||||
|
||||
|
||||
enum {
|
||||
#ifndef MOO_USE_SCI
|
||||
HIGHLIGHT_UPDATED, /* GtkSourceBuffer's */
|
||||
CURSOR_MOVED,
|
||||
#endif
|
||||
SELECTION_CHANGED,
|
||||
LINE_MARK_ADDED,
|
||||
LINE_MARK_MOVED,
|
||||
@ -145,14 +151,18 @@ static guint signals[LAST_SIGNAL];
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
#ifndef MOO_USE_SCI
|
||||
PROP_HIGHLIGHT_SYNTAX, /* mimic GtkSourceBuffer */
|
||||
PROP_HIGHLIGHT_MATCHING_BRACKETS,
|
||||
PROP_HIGHLIGHT_MISMATCHING_BRACKETS,
|
||||
PROP_BRACKET_MATCH_STYLE,
|
||||
PROP_BRACKET_MISMATCH_STYLE,
|
||||
#endif
|
||||
PROP_HAS_TEXT,
|
||||
PROP_HAS_SELECTION,
|
||||
#ifndef MOO_USE_SCI
|
||||
PROP_LANG,
|
||||
#endif
|
||||
PROP_CAN_UNDO,
|
||||
PROP_CAN_REDO
|
||||
};
|
||||
@ -181,10 +191,13 @@ moo_text_buffer_class_init (MooTextBufferClass *klass)
|
||||
buffer_class->end_user_action = moo_text_buffer_end_user_action;
|
||||
buffer_class->modified_changed = moo_text_buffer_modified_changed;
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
klass->cursor_moved = moo_text_buffer_cursor_moved;
|
||||
#endif
|
||||
|
||||
g_type_class_add_private (klass, sizeof (MooTextBufferPrivate));
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HIGHLIGHT_SYNTAX,
|
||||
g_param_spec_boolean ("highlight-syntax",
|
||||
@ -224,6 +237,7 @@ moo_text_buffer_class_init (MooTextBufferClass *klass)
|
||||
"bracket-mismatch-style",
|
||||
MOO_TYPE_TEXT_STYLE,
|
||||
(GParamFlags) (G_PARAM_CONSTRUCT | G_PARAM_WRITABLE)));
|
||||
#endif
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HAS_TEXT,
|
||||
@ -241,6 +255,7 @@ moo_text_buffer_class_init (MooTextBufferClass *klass)
|
||||
FALSE,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LANG,
|
||||
g_param_spec_object ("lang",
|
||||
@ -248,6 +263,7 @@ moo_text_buffer_class_init (MooTextBufferClass *klass)
|
||||
"lang",
|
||||
MOO_TYPE_LANG,
|
||||
(GParamFlags) G_PARAM_READWRITE));
|
||||
#endif
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CAN_UNDO,
|
||||
@ -265,6 +281,7 @@ moo_text_buffer_class_init (MooTextBufferClass *klass)
|
||||
FALSE,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
signals[HIGHLIGHT_UPDATED] =
|
||||
g_signal_new ("highlight_updated",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
@ -284,6 +301,7 @@ moo_text_buffer_class_init (MooTextBufferClass *klass)
|
||||
_moo_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_TEXT_ITER);
|
||||
#endif
|
||||
|
||||
signals[SELECTION_CHANGED] =
|
||||
g_signal_new ("selection-changed",
|
||||
@ -362,8 +380,10 @@ moo_text_buffer_init (MooTextBuffer *buffer)
|
||||
buffer->priv = G_TYPE_INSTANCE_GET_PRIVATE (buffer, MOO_TYPE_TEXT_BUFFER, MooTextBufferPrivate);
|
||||
|
||||
buffer->priv->line_buf = _moo_line_buffer_new ();
|
||||
#ifndef MOO_USE_SCI
|
||||
buffer->priv->do_highlight = TRUE;
|
||||
buffer->priv->bracket_found = MOO_BRACKET_MATCH_NONE;
|
||||
#endif
|
||||
|
||||
buffer->priv->fold_tree = _moo_fold_tree_new (buffer);
|
||||
|
||||
@ -391,7 +411,9 @@ moo_text_buffer_init (MooTextBuffer *buffer)
|
||||
g_signal_connect_swapped (buffer->priv->undo_stack, "notify::can-redo",
|
||||
G_CALLBACK (proxy_notify_can_undo_redo), buffer);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
moo_text_buffer_set_brackets (buffer, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -407,6 +429,7 @@ moo_text_buffer_dispose (GObject *object)
|
||||
buffer->priv->fold_tree = NULL;
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
if (buffer->priv->engine)
|
||||
{
|
||||
_gtk_source_engine_attach_buffer (buffer->priv->engine, NULL);
|
||||
@ -425,6 +448,7 @@ moo_text_buffer_dispose (GObject *object)
|
||||
g_object_unref (buffer->priv->lang);
|
||||
buffer->priv->engine = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (buffer->priv->line_buf)
|
||||
{
|
||||
@ -432,10 +456,12 @@ moo_text_buffer_dispose (GObject *object)
|
||||
buffer->priv->line_buf = NULL;
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
g_free (buffer->priv->left_brackets);
|
||||
g_free (buffer->priv->right_brackets);
|
||||
buffer->priv->left_brackets = NULL;
|
||||
buffer->priv->right_brackets = NULL;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
g_signal_handlers_disconnect_by_func (buffer->priv->undo_stack,
|
||||
@ -552,8 +578,10 @@ moo_text_buffer_mark_set (GtkTextBuffer *text_buffer,
|
||||
|
||||
if (mark == insert)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
moo_text_buffer_unhighlight_brackets (buffer);
|
||||
emit_cursor_moved (buffer, iter);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -575,7 +603,7 @@ moo_text_buffer_insert_text (GtkTextBuffer *text_buffer,
|
||||
MooTextBuffer *buffer = MOO_TEXT_BUFFER (text_buffer);
|
||||
GtkTextTag *tag;
|
||||
int first_line, last_line;
|
||||
int start_offset, end_offset;
|
||||
int start_offset;
|
||||
gboolean starts_line, ins_line;
|
||||
|
||||
if (!text[0])
|
||||
@ -607,7 +635,9 @@ moo_text_buffer_insert_text (GtkTextBuffer *text_buffer,
|
||||
moo_undo_stack_add_action (buffer->priv->undo_stack, INSERT_ACTION_TYPE, action);
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
moo_text_buffer_unhighlight_brackets (buffer);
|
||||
#endif
|
||||
|
||||
GTK_TEXT_BUFFER_CLASS(moo_text_buffer_parent_class)->insert_text (text_buffer, pos, text, length);
|
||||
|
||||
@ -627,12 +657,14 @@ moo_text_buffer_insert_text (GtkTextBuffer *text_buffer,
|
||||
g_slist_free (marks);
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
emit_cursor_moved (buffer, pos);
|
||||
|
||||
end_offset = gtk_text_iter_get_offset (pos);
|
||||
int end_offset = gtk_text_iter_get_offset (pos);
|
||||
|
||||
if (buffer->priv->engine)
|
||||
_gtk_source_engine_text_inserted (buffer->priv->engine, start_offset, end_offset);
|
||||
#endif
|
||||
|
||||
if (!buffer->priv->has_text)
|
||||
{
|
||||
@ -710,6 +742,7 @@ moo_text_buffer_delete_range (GtkTextBuffer *text_buffer,
|
||||
gtk_text_buffer_remove_tag (text_buffer, tag, &tag_start, &tag_end);
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
moo_text_buffer_unhighlight_brackets (buffer);
|
||||
|
||||
#define MANY_LINES 1000
|
||||
@ -719,6 +752,7 @@ moo_text_buffer_delete_range (GtkTextBuffer *text_buffer,
|
||||
gtk_text_buffer_remove_all_tags (text_buffer, start, end);
|
||||
}
|
||||
#undef MANY_LINES
|
||||
#endif
|
||||
|
||||
if (!moo_undo_stack_frozen (buffer->priv->undo_stack))
|
||||
{
|
||||
@ -754,7 +788,9 @@ moo_text_buffer_delete_range (GtkTextBuffer *text_buffer,
|
||||
g_slist_free (moved_marks);
|
||||
|
||||
update_selection (buffer);
|
||||
#ifndef MOO_USE_SCI
|
||||
emit_cursor_moved (buffer, start);
|
||||
#endif
|
||||
|
||||
if (buffer->priv->has_text)
|
||||
{
|
||||
@ -763,8 +799,10 @@ moo_text_buffer_delete_range (GtkTextBuffer *text_buffer,
|
||||
g_object_notify (G_OBJECT (buffer), "has-text");
|
||||
}
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
if (buffer->priv->engine != NULL)
|
||||
_gtk_source_engine_text_deleted (buffer->priv->engine, offset, length);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -812,6 +850,7 @@ proxy_notify_can_undo_redo (MooTextBuffer *buffer,
|
||||
}
|
||||
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
void
|
||||
moo_text_buffer_set_lang (MooTextBuffer *buffer,
|
||||
MooLang *lang)
|
||||
@ -884,6 +923,7 @@ moo_text_buffer_get_highlight (MooTextBuffer *buffer)
|
||||
g_return_val_if_fail (MOO_IS_TEXT_BUFFER (buffer), FALSE);
|
||||
return buffer->priv->do_highlight;
|
||||
}
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
static void
|
||||
@ -892,10 +932,13 @@ moo_text_buffer_set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
MooTextBuffer *buffer = MOO_TEXT_BUFFER (object);
|
||||
#endif
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
case PROP_HIGHLIGHT_SYNTAX:
|
||||
moo_text_buffer_set_highlight (buffer, g_value_get_boolean (value));
|
||||
break;
|
||||
@ -921,6 +964,7 @@ moo_text_buffer_set_property (GObject *object,
|
||||
case PROP_LANG:
|
||||
moo_text_buffer_set_lang (buffer, g_value_get_object (value));
|
||||
break;
|
||||
#endif // MOO_USE_SCI
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@ -939,6 +983,7 @@ moo_text_buffer_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
case PROP_HIGHLIGHT_SYNTAX:
|
||||
g_value_set_boolean (value, buffer->priv->do_highlight);
|
||||
break;
|
||||
@ -954,6 +999,7 @@ moo_text_buffer_get_property (GObject *object,
|
||||
case PROP_LANG:
|
||||
g_value_set_object (value, buffer->priv->lang);
|
||||
break;
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
case PROP_HAS_TEXT:
|
||||
g_value_set_boolean (value, moo_text_buffer_has_text (buffer));
|
||||
@ -990,6 +1036,7 @@ moo_text_buffer_has_selection (MooTextBuffer *buffer)
|
||||
}
|
||||
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
void
|
||||
_moo_text_buffer_update_highlight (MooTextBuffer *buffer,
|
||||
const GtkTextIter *start,
|
||||
@ -1045,13 +1092,16 @@ _moo_text_buffer_set_style_scheme (MooTextBuffer *buffer,
|
||||
_gtk_source_engine_set_style_scheme (buffer->priv->engine,
|
||||
GTK_SOURCE_STYLE_SCHEME (scheme));
|
||||
}
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
void
|
||||
moo_text_buffer_freeze (MooTextBuffer *buffer)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_TEXT_BUFFER (buffer));
|
||||
#ifndef MOO_USE_SCI
|
||||
freeze_cursor_moved (buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1059,7 +1109,9 @@ void
|
||||
moo_text_buffer_thaw (MooTextBuffer *buffer)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_TEXT_BUFFER (buffer));
|
||||
#ifndef MOO_USE_SCI
|
||||
thaw_cursor_moved (buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1158,6 +1210,8 @@ moo_text_iter_set_visual_line_offset (GtkTextIter *iter,
|
||||
/* Matching brackets
|
||||
*/
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
|
||||
#define FIND_BRACKETS_LIMIT 3000
|
||||
|
||||
static void
|
||||
@ -1552,6 +1606,8 @@ moo_text_iter_find_matching_bracket (GtkTextIter *iter,
|
||||
return MOO_BRACKET_MATCH_NONE;
|
||||
}
|
||||
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Undo/redo
|
||||
|
@ -50,8 +50,11 @@ struct MooTextBufferClass
|
||||
gboolean (* undo) (MooTextBuffer *buffer);
|
||||
gboolean (* redo) (MooTextBuffer *buffer);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
void (*cursor_moved) (MooTextBuffer *buffer,
|
||||
const GtkTextIter *iter);
|
||||
#endif
|
||||
|
||||
void (*selection_changed) (MooTextBuffer *buffer);
|
||||
|
||||
void (*line_mark_added) (MooTextBuffer *buffer,
|
||||
@ -74,6 +77,7 @@ GType moo_text_buffer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkTextBuffer *moo_text_buffer_new (GtkTextTagTable *table);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
void moo_text_buffer_set_lang (MooTextBuffer *buffer,
|
||||
MooLang *lang);
|
||||
MooLang *moo_text_buffer_get_lang (MooTextBuffer *buffer);
|
||||
@ -84,6 +88,7 @@ gboolean moo_text_buffer_get_highlight (MooTextBuffer *buf
|
||||
|
||||
void moo_text_buffer_set_brackets (MooTextBuffer *buffer,
|
||||
const char *brackets);
|
||||
#endif
|
||||
|
||||
gboolean moo_text_buffer_can_redo (MooTextBuffer *buffer);
|
||||
gboolean moo_text_buffer_can_undo (MooTextBuffer *buffer);
|
||||
|
@ -106,7 +106,9 @@ struct MooTextViewPrivate {
|
||||
/***********************************************************************/
|
||||
/* Drawing
|
||||
*/
|
||||
#ifndef MOO_USE_SCI
|
||||
MooTextStyleScheme *style_scheme;
|
||||
#endif
|
||||
guint tab_width;
|
||||
gboolean color_settings[MOO_TEXT_VIEW_N_COLORS];
|
||||
char *colors[MOO_TEXT_VIEW_N_COLORS];
|
||||
|
@ -100,8 +100,10 @@ static void moo_text_view_paste_clipboard (GtkTextView *text_view);
|
||||
static void moo_text_view_populate_popup(GtkTextView *text_view,
|
||||
GtkMenu *menu);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
static void moo_text_view_apply_style_scheme (MooTextView *view,
|
||||
MooTextStyleScheme *scheme);
|
||||
#endif
|
||||
|
||||
static void invalidate_gcs (MooTextView *view);
|
||||
static void update_gcs (MooTextView *view);
|
||||
@ -237,7 +239,9 @@ enum {
|
||||
PROP_CAN_REDO,
|
||||
PROP_MANAGE_CLIPBOARD,
|
||||
PROP_SMART_HOME_END,
|
||||
#ifndef MOO_USE_SCI
|
||||
PROP_ENABLE_HIGHLIGHT,
|
||||
#endif
|
||||
PROP_SHOW_LINE_NUMBERS,
|
||||
PROP_SHOW_LINE_MARKS,
|
||||
PROP_ENABLE_FOLDING,
|
||||
@ -298,7 +302,9 @@ static void moo_text_view_class_init (MooTextViewClass *klass)
|
||||
klass->replace_interactive = replace_interactive;
|
||||
klass->goto_line_interactive = goto_line_interactive;
|
||||
klass->char_inserted = moo_text_view_char_inserted;
|
||||
#ifndef MOO_USE_SCI
|
||||
klass->apply_style_scheme = moo_text_view_apply_style_scheme;
|
||||
#endif
|
||||
klass->get_text_cursor = moo_text_view_get_text_cursor;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
@ -446,6 +452,7 @@ static void moo_text_view_class_init (MooTextViewClass *klass)
|
||||
TRUE,
|
||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_CONSTRUCT)));
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ENABLE_HIGHLIGHT,
|
||||
g_param_spec_boolean ("enable-highlight",
|
||||
@ -453,6 +460,7 @@ static void moo_text_view_class_init (MooTextViewClass *klass)
|
||||
"enable-highlight",
|
||||
TRUE,
|
||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_CONSTRUCT)));
|
||||
#endif
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_LINE_NUMBERS,
|
||||
@ -843,11 +851,13 @@ moo_text_view_dispose (GObject *object)
|
||||
while (view->priv->line_marks)
|
||||
remove_line_mark (view, view->priv->line_marks->data);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
if (view->priv->style_scheme)
|
||||
{
|
||||
g_object_unref (view->priv->style_scheme);
|
||||
view->priv->style_scheme = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (view->priv->move_cursor_idle)
|
||||
{
|
||||
@ -1150,11 +1160,13 @@ moo_text_view_set_property (GObject *object,
|
||||
g_object_notify (object, "smart-home-end");
|
||||
break;
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
case PROP_ENABLE_HIGHLIGHT:
|
||||
moo_text_buffer_set_highlight (get_moo_buffer (view),
|
||||
g_value_get_boolean (value));
|
||||
g_object_notify (object, "enable-highlight");
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PROP_SHOW_LINE_NUMBERS:
|
||||
moo_text_view_set_show_line_numbers (view, g_value_get_boolean (value));
|
||||
@ -1266,9 +1278,11 @@ moo_text_view_get_property (GObject *object,
|
||||
case PROP_SMART_HOME_END:
|
||||
g_value_set_boolean (value, view->priv->smart_home_end != 0);
|
||||
break;
|
||||
#ifndef MOO_USE_SCI
|
||||
case PROP_ENABLE_HIGHLIGHT:
|
||||
g_value_set_boolean (value, moo_text_buffer_get_highlight (get_moo_buffer (view)));
|
||||
break;
|
||||
#endif
|
||||
case PROP_SHOW_LINE_NUMBERS:
|
||||
g_value_set_boolean (value, view->priv->lm.show_numbers);
|
||||
break;
|
||||
@ -2597,6 +2611,7 @@ moo_text_tag_get_cursor (GtkTextTag *tag)
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
void
|
||||
moo_text_view_set_lang (MooTextView *view,
|
||||
MooLang *lang)
|
||||
@ -2607,12 +2622,12 @@ moo_text_view_set_lang (MooTextView *view,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* moo_text_view_set_lang_by_id: (moo.private 1)
|
||||
*
|
||||
* @view:
|
||||
* @lang_id: (type const-utf8)
|
||||
*/
|
||||
//**
|
||||
/* moo_text_view_set_lang_by_id: (moo.private 1)
|
||||
/*
|
||||
/* @view:
|
||||
/* @lang_id: (type const-utf8)
|
||||
/*/
|
||||
void
|
||||
moo_text_view_set_lang_by_id (MooTextView *view,
|
||||
const char *lang_id)
|
||||
@ -2670,6 +2685,7 @@ moo_text_view_get_style_scheme (MooTextView *view)
|
||||
g_return_val_if_fail (MOO_IS_TEXT_VIEW (view), NULL);
|
||||
return view->priv->style_scheme;
|
||||
}
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
|
||||
static void
|
||||
|
@ -75,8 +75,10 @@ struct MooTextViewClass
|
||||
GtkTextIter *insert,
|
||||
GtkTextIter *selection_bound);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
void (*apply_style_scheme) (MooTextView *view,
|
||||
MooTextStyleScheme *scheme);
|
||||
#endif
|
||||
|
||||
MooTextCursor (*get_text_cursor)(MooTextView *view,
|
||||
int x, /* buffer coordinates */
|
||||
@ -131,9 +133,11 @@ void moo_text_view_set_right_margin_color (MooTextView *view,
|
||||
const char *color);
|
||||
void moo_text_view_set_right_margin_offset (MooTextView *view,
|
||||
guint offset);
|
||||
#ifndef MOO_USE_SCI
|
||||
MooTextStyleScheme *moo_text_view_get_style_scheme (MooTextView *view);
|
||||
void moo_text_view_set_style_scheme (MooTextView *view,
|
||||
MooTextStyleScheme *scheme);
|
||||
#endif
|
||||
|
||||
void moo_text_view_set_show_line_numbers (MooTextView *view,
|
||||
gboolean show);
|
||||
@ -143,11 +147,13 @@ void moo_text_view_set_tab_width (MooTextView *view,
|
||||
GtkTextTag *moo_text_view_lookup_tag (MooTextView *view,
|
||||
const char *name);
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
MooLang *moo_text_view_get_lang (MooTextView *view);
|
||||
void moo_text_view_set_lang (MooTextView *view,
|
||||
MooLang *lang);
|
||||
void moo_text_view_set_lang_by_id (MooTextView *view,
|
||||
const char *id);
|
||||
#endif
|
||||
|
||||
void moo_text_view_set_word_chars (MooTextView *view,
|
||||
const char *word_chars);
|
||||
|
@ -13,11 +13,7 @@
|
||||
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* class:MooEditBookmark: (parent MooLineMark) (moo.private 1)
|
||||
**/
|
||||
|
||||
#include "mooedit/mooeditbookmark.h"
|
||||
#include "mooedit/native/mooeditbookmark.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mootextbuffer.h"
|
||||
#include "mooutils/moostock.h"
|
@ -28,7 +28,9 @@
|
||||
#include "mooedit/mooedit.h"
|
||||
#include "mooedit/mooeditor.h"
|
||||
#include "mooedit/mooeditwindow.h"
|
||||
#include "mooedit/mooeditbookmark.h"
|
||||
#ifndef MOO_USE_SCI
|
||||
#include "mooedit/native/mooeditbookmark.h"
|
||||
#endif
|
||||
#include "mooedit/mooplugin.h"
|
||||
#include "mooedit/mooedit-enums.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
|
@ -55,14 +55,16 @@ G_END_DECLS
|
||||
#include "mooedit/mooedit.h"
|
||||
#include "mooedit/mooeditor.h"
|
||||
#include "mooedit/mooeditwindow.h"
|
||||
#include "mooedit/mooeditbookmark.h"
|
||||
#ifndef MOO_USE_SCI
|
||||
#include "mooedit/native/mooeditbookmark.h"
|
||||
#include "mooedit/native/moolangmgr.h"
|
||||
#endif
|
||||
#include "mooedit/mooplugin.h"
|
||||
#include "mooedit/mooedit-enums.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mooeditaction.h"
|
||||
#include "mooedit/mooeditaction-factory.h"
|
||||
#include "mooedit/mootextbuffer.h"
|
||||
#include "mooedit/moolangmgr.h"
|
||||
#include "mooedit/mooeditfileinfo.h"
|
||||
#include "mooedit/mooedit-script.h"
|
||||
#include "mooedit/mooedittab.h"
|
||||
|
@ -1078,10 +1078,12 @@ unx_factory_create_widget (G_GNUC_UNUSED MooCommandFactory *factory)
|
||||
xml = exe_page_xml_new ();
|
||||
|
||||
moo_text_view_set_font_from_string (xml->textview, "Monospace");
|
||||
#ifndef MOO_USE_SCI
|
||||
#ifndef __WIN32__
|
||||
moo_text_view_set_lang_by_id (xml->textview, "sh");
|
||||
#else
|
||||
moo_text_view_set_lang_by_id (xml->textview, "dosbatch");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
init_combo (xml->input, input_names, G_N_ELEMENTS (input_names));
|
||||
|
@ -186,13 +186,17 @@ script_factory_create_command (MooCommandFactory *factory_base,
|
||||
static GtkWidget *
|
||||
script_factory_create_widget (MooCommandFactory *factory_base)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
MooCommandFactoryScript *factory = (MooCommandFactoryScript*) factory_base;
|
||||
#endif
|
||||
|
||||
ScriptPageXml *xml;
|
||||
|
||||
xml = script_page_xml_new ();
|
||||
|
||||
moo_text_view_set_font_from_string (xml->textview, "Monospace");
|
||||
|
||||
#ifndef MOO_USE_SCI
|
||||
switch (factory->type)
|
||||
{
|
||||
case MOO_SCRIPT_LUA:
|
||||
@ -202,6 +206,7 @@ script_factory_create_widget (MooCommandFactory *factory_base)
|
||||
moo_text_view_set_lang_by_id (xml->textview, "python");
|
||||
break;
|
||||
}
|
||||
#endif // !MOO_USE_SCI
|
||||
|
||||
return GTK_WIDGET (xml->ScriptPage);
|
||||
}
|
||||
|
@ -388,11 +388,14 @@ get_tag (MooLineView *view,
|
||||
|
||||
if (!tag)
|
||||
{
|
||||
#ifndef MOO_USE_SCI
|
||||
MooLangMgr *lang_mgr;
|
||||
MooTextStyleScheme *scheme;
|
||||
MooTextStyle *style = NULL;
|
||||
#endif
|
||||
|
||||
tag = moo_line_view_create_tag (view, name, NULL);
|
||||
#ifndef MOO_USE_SCI
|
||||
lang_mgr = moo_lang_mgr_default ();
|
||||
scheme = moo_lang_mgr_get_active_scheme (lang_mgr);
|
||||
|
||||
@ -401,7 +404,9 @@ get_tag (MooLineView *view,
|
||||
|
||||
if (style)
|
||||
_moo_text_style_apply_to_tag (style, tag);
|
||||
else if (type == OUTPUT_STDERR || !strcmp (name, "output-error") ||
|
||||
else
|
||||
#endif // !MOO_USE_SCI
|
||||
if (type == OUTPUT_STDERR || !strcmp (name, "output-error") ||
|
||||
!strcmp (name, "output-stderr"))
|
||||
g_object_set (tag, "foreground", "red", NULL);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user