More bindings
This commit is contained in:
parent
d5869940ef
commit
976e87ccf4
@ -130,11 +130,18 @@ built_moo_sources += mooedit/medit-ui.h mooedit/mooedit-ui.h
|
||||
|
||||
if MOO_DEV_MODE
|
||||
|
||||
if MOO_OS_WIN32
|
||||
win32_arg = win32=True
|
||||
else
|
||||
win32_arg = win32=False
|
||||
endif
|
||||
|
||||
built_moo_sources += mooedit/mooedit-enums.stamp
|
||||
mooedit/mooedit-enums.stamp: mooedit/mooedit-enums-in.py $(top_srcdir)/tools/genenums.py
|
||||
$(AM_V_at)$(MKDIR_P) mooedit
|
||||
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/tools/genenums.py MOO_EDIT \
|
||||
$(srcdir)/mooedit/mooedit-enums-in.py $(srcdir)/mooedit/mooedit-enums mooedit/mooedit-enums.stamp
|
||||
$(srcdir)/mooedit/mooedit-enums-in.py $(srcdir)/mooedit/mooedit-enums mooedit/mooedit-enums.stamp \
|
||||
$(win32_arg)
|
||||
|
||||
endif
|
||||
|
||||
|
@ -46,6 +46,11 @@ enums['MooLineEndType'] = [
|
||||
[ 'MOO_LE_MIX', None, None, 'mix' ],
|
||||
]
|
||||
|
||||
if win32:
|
||||
enums['MooLineEndType'].append([ 'MOO_LE_DEFAULT', 'MOO_LE_WIN32' ])
|
||||
else:
|
||||
enums['MooLineEndType'].append([ 'MOO_LE_DEFAULT', 'MOO_LE_UNIX' ])
|
||||
|
||||
flags['MooFindFlags'] = [
|
||||
[ 'MOO_FIND_REGEX', '1 << 0', None, 'regex' ],
|
||||
[ 'MOO_FIND_CASELESS', '1 << 1', None, 'caseless' ],
|
||||
|
@ -138,6 +138,7 @@ moo_line_end_type_get_type (void)
|
||||
{ MOO_LE_WIN32, (char*) "MOO_LE_WIN32", (char*) "win32" },
|
||||
{ MOO_LE_MAC, (char*) "MOO_LE_MAC", (char*) "mac" },
|
||||
{ MOO_LE_MIX, (char*) "MOO_LE_MIX", (char*) "mix" },
|
||||
{ MOO_LE_DEFAULT, (char*) "MOO_LE_DEFAULT", (char*) "MOO_LE_DEFAULT" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
etype = g_enum_register_static ("MooLineEndType", values);
|
||||
@ -225,10 +226,10 @@ moo_draw_whitespace_flags_get_type (void)
|
||||
if (G_UNLIKELY (!etype))
|
||||
{
|
||||
static const GFlagsValue values[] = {
|
||||
{ MOO_DRAW_NO_WHITESPACE, (char*) "MOO_DRAW_NO_WHITESPACE", (char*) "None" },
|
||||
{ MOO_DRAW_SPACES, (char*) "MOO_DRAW_SPACES", (char*) "None" },
|
||||
{ MOO_DRAW_TABS, (char*) "MOO_DRAW_TABS", (char*) "None" },
|
||||
{ MOO_DRAW_TRAILING_SPACES, (char*) "MOO_DRAW_TRAILING_SPACES", (char*) "None" },
|
||||
{ MOO_DRAW_NO_WHITESPACE, (char*) "MOO_DRAW_NO_WHITESPACE", (char*) "MOO_DRAW_NO_WHITESPACE" },
|
||||
{ MOO_DRAW_SPACES, (char*) "MOO_DRAW_SPACES", (char*) "MOO_DRAW_SPACES" },
|
||||
{ MOO_DRAW_TABS, (char*) "MOO_DRAW_TABS", (char*) "MOO_DRAW_TABS" },
|
||||
{ MOO_DRAW_TRAILING_SPACES, (char*) "MOO_DRAW_TRAILING_SPACES", (char*) "MOO_DRAW_TRAILING_SPACES" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
etype = g_flags_register_static ("MooDrawWhitespaceFlags", values);
|
||||
|
@ -67,7 +67,8 @@ typedef enum {
|
||||
MOO_LE_UNIX,
|
||||
MOO_LE_WIN32,
|
||||
MOO_LE_MAC,
|
||||
MOO_LE_MIX
|
||||
MOO_LE_MIX,
|
||||
MOO_LE_DEFAULT = MOO_LE_UNIX
|
||||
} MooLineEndType;
|
||||
|
||||
GType moo_line_end_type_get_type (void) G_GNUC_CONST;
|
||||
|
@ -240,6 +240,9 @@ set_encoding_error (GError **error)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* moo_edit_get_line_end_type:
|
||||
**/
|
||||
MooLineEndType
|
||||
moo_edit_get_line_end_type (MooEdit *edit)
|
||||
{
|
||||
@ -266,6 +269,9 @@ moo_edit_set_line_end_type_full (MooEdit *edit,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* moo_edit_set_line_end_type:
|
||||
**/
|
||||
void
|
||||
moo_edit_set_line_end_type (MooEdit *edit,
|
||||
MooLineEndType le)
|
||||
@ -428,7 +434,7 @@ moo_edit_load_local (MooEdit *edit,
|
||||
if (undo)
|
||||
gtk_text_buffer_begin_user_action (buffer);
|
||||
else
|
||||
moo_text_view_begin_not_undoable_action (view);
|
||||
moo_text_view_begin_non_undoable_action (view);
|
||||
|
||||
moo_text_buffer_begin_non_interactive_action (MOO_TEXT_BUFFER (buffer));
|
||||
|
||||
@ -506,7 +512,7 @@ moo_edit_load_local (MooEdit *edit,
|
||||
if (undo)
|
||||
gtk_text_buffer_end_user_action (buffer);
|
||||
else
|
||||
moo_text_view_end_not_undoable_action (view);
|
||||
moo_text_view_end_non_undoable_action (view);
|
||||
|
||||
moo_text_buffer_end_non_interactive_action (MOO_TEXT_BUFFER (buffer));
|
||||
|
||||
|
@ -2,6 +2,66 @@
|
||||
#include "mooedit/mootextview.h"
|
||||
#include "mooutils/mooutils.h"
|
||||
|
||||
/**
|
||||
* moo_edit_can_undo:
|
||||
**/
|
||||
gboolean
|
||||
moo_edit_can_undo (MooEdit *doc)
|
||||
{
|
||||
moo_return_val_if_fail (MOO_IS_EDIT (doc), FALSE);
|
||||
return moo_text_view_can_undo (MOO_TEXT_VIEW (moo_edit_get_view (doc)));
|
||||
}
|
||||
|
||||
/**
|
||||
* moo_edit_can_redo:
|
||||
**/
|
||||
gboolean
|
||||
moo_edit_can_redo (MooEdit *doc)
|
||||
{
|
||||
moo_return_val_if_fail (MOO_IS_EDIT (doc), FALSE);
|
||||
return moo_text_view_can_redo (MOO_TEXT_VIEW (moo_edit_get_view (doc)));
|
||||
}
|
||||
|
||||
/**
|
||||
* moo_edit_undo:
|
||||
**/
|
||||
gboolean
|
||||
moo_edit_undo (MooEdit *doc)
|
||||
{
|
||||
moo_return_val_if_fail (MOO_IS_EDIT (doc), FALSE);
|
||||
return moo_text_view_undo (MOO_TEXT_VIEW (moo_edit_get_view (doc)));
|
||||
}
|
||||
|
||||
/**
|
||||
* moo_edit_redo:
|
||||
**/
|
||||
gboolean
|
||||
moo_edit_redo (MooEdit *doc)
|
||||
{
|
||||
moo_return_val_if_fail (MOO_IS_EDIT (doc), FALSE);
|
||||
return moo_text_view_redo (MOO_TEXT_VIEW (moo_edit_get_view (doc)));
|
||||
}
|
||||
|
||||
/**
|
||||
* moo_edit_begin_non_undoable_action:
|
||||
**/
|
||||
void
|
||||
moo_edit_begin_non_undoable_action (MooEdit *doc)
|
||||
{
|
||||
moo_return_if_fail (MOO_IS_EDIT (doc));
|
||||
moo_text_view_begin_non_undoable_action (MOO_TEXT_VIEW (moo_edit_get_view (doc)));
|
||||
}
|
||||
|
||||
/**
|
||||
* moo_edit_end_non_undoable_action:
|
||||
**/
|
||||
void
|
||||
moo_edit_end_non_undoable_action (MooEdit *doc)
|
||||
{
|
||||
moo_return_if_fail (MOO_IS_EDIT (doc));
|
||||
moo_text_view_end_non_undoable_action (MOO_TEXT_VIEW (moo_edit_get_view (doc)));
|
||||
}
|
||||
|
||||
static void
|
||||
get_selected_lines_bounds (GtkTextBuffer *buf,
|
||||
GtkTextIter *start,
|
||||
|
@ -5,6 +5,13 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean moo_edit_can_undo (MooEdit *doc);
|
||||
gboolean moo_edit_can_redo (MooEdit *doc);
|
||||
gboolean moo_edit_undo (MooEdit *doc);
|
||||
gboolean moo_edit_redo (MooEdit *doc);
|
||||
void moo_edit_begin_non_undoable_action (MooEdit *doc);
|
||||
void moo_edit_end_non_undoable_action (MooEdit *doc);
|
||||
|
||||
char **moo_edit_get_selected_lines (MooEdit *doc);
|
||||
void moo_edit_replace_selected_lines (MooEdit *doc,
|
||||
char **replacement);
|
||||
|
@ -343,6 +343,9 @@ modify_status (MooEdit *edit,
|
||||
edit->priv->status = (MooEditStatus) (edit->priv->status & ~status);
|
||||
}
|
||||
|
||||
/**
|
||||
* moo_edit_set_modified:
|
||||
**/
|
||||
void
|
||||
moo_edit_set_modified (MooEdit *edit,
|
||||
gboolean modified)
|
||||
@ -448,6 +451,15 @@ moo_edit_is_untitled (MooEdit *edit)
|
||||
return MOO_EDIT_IS_UNTITLED (edit);
|
||||
}
|
||||
|
||||
/**
|
||||
* moo_edit_is_modified:
|
||||
**/
|
||||
gboolean
|
||||
moo_edit_is_modified (MooEdit *edit)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_EDIT (edit), FALSE);
|
||||
return MOO_EDIT_IS_MODIFIED (edit);
|
||||
}
|
||||
|
||||
/**
|
||||
* moo_edit_get_status:
|
||||
@ -1089,9 +1101,8 @@ config_changed (MooEdit *doc)
|
||||
* moo_edit_reload:
|
||||
*
|
||||
* @edit:
|
||||
* @encoding: (allow-none) (default NULL): encoding to use. If %NULL,
|
||||
* current document encoding will be used.
|
||||
* @error: (allow-none): location for returned error or %NULL
|
||||
* @info: (allow-none) (default NULL):
|
||||
* @error:
|
||||
*
|
||||
* Reload document from disk
|
||||
*
|
||||
|
@ -83,18 +83,13 @@ void moo_edit_set_encoding (MooEdit *edit,
|
||||
|
||||
char *moo_edit_get_lang_id (MooEdit *edit);
|
||||
|
||||
#ifdef __WIN32__
|
||||
#define MOO_LE_DEFAULT MOO_LE_WIN32
|
||||
#else
|
||||
#define MOO_LE_DEFAULT MOO_LE_UNIX
|
||||
#endif
|
||||
|
||||
MooLineEndType moo_edit_get_line_end_type (MooEdit *edit);
|
||||
void moo_edit_set_line_end_type (MooEdit *edit,
|
||||
MooLineEndType le);
|
||||
|
||||
gboolean moo_edit_is_empty (MooEdit *edit);
|
||||
gboolean moo_edit_is_untitled (MooEdit *edit);
|
||||
gboolean moo_edit_is_modified (MooEdit *edit);
|
||||
void moo_edit_set_modified (MooEdit *edit,
|
||||
gboolean modified);
|
||||
gboolean moo_edit_get_clean (MooEdit *edit);
|
||||
|
@ -988,7 +988,7 @@ moo_text_view_can_undo (MooTextView *view)
|
||||
|
||||
|
||||
void
|
||||
moo_text_view_begin_not_undoable_action (MooTextView *view)
|
||||
moo_text_view_begin_non_undoable_action (MooTextView *view)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_TEXT_VIEW (view));
|
||||
moo_undo_stack_freeze (get_undo_stack (view));
|
||||
@ -996,7 +996,7 @@ moo_text_view_begin_not_undoable_action (MooTextView *view)
|
||||
|
||||
|
||||
void
|
||||
moo_text_view_end_not_undoable_action (MooTextView *view)
|
||||
moo_text_view_end_non_undoable_action (MooTextView *view)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_TEXT_VIEW (view));
|
||||
moo_undo_stack_thaw (get_undo_stack (view));
|
||||
|
@ -103,8 +103,8 @@ gboolean moo_text_view_can_redo (MooTextView *view);
|
||||
gboolean moo_text_view_can_undo (MooTextView *view);
|
||||
gboolean moo_text_view_redo (MooTextView *view);
|
||||
gboolean moo_text_view_undo (MooTextView *view);
|
||||
void moo_text_view_begin_not_undoable_action(MooTextView *view);
|
||||
void moo_text_view_end_not_undoable_action (MooTextView *view);
|
||||
void moo_text_view_begin_non_undoable_action(MooTextView *view);
|
||||
void moo_text_view_end_non_undoable_action (MooTextView *view);
|
||||
|
||||
void moo_text_view_set_font_from_string (MooTextView *view,
|
||||
const char *font);
|
||||
|
@ -91,26 +91,6 @@
|
||||
<method name='uri' retval='string'/>
|
||||
<method name='basename' retval='string'/>
|
||||
|
||||
<method name='is_modified' retval='bool'/>
|
||||
<method name='set_modified' param-type='bool' param-name='modified'/>
|
||||
|
||||
<method name='encoding' retval='string'/>
|
||||
<method name='set_encoding' param-name='encoding' param-type='string'/>
|
||||
|
||||
<method name='line_endings' retval='string'/>
|
||||
<method name='set_line_endings' param-name='value' param-type='string'/>
|
||||
|
||||
<method name='reload'/>
|
||||
<method name='save' retval='bool'/>
|
||||
<method name='save_as' param-name='filename' param-type='string' param-optional='1' retval='bool'/>
|
||||
|
||||
<method name='can_undo' retval='bool'/>
|
||||
<method name='can_redo' retval='bool'/>
|
||||
<method name='undo'/>
|
||||
<method name='redo'/>
|
||||
<method name='begin_not_undoable_action'/>
|
||||
<method name='end_not_undoable_action'/>
|
||||
|
||||
<method name='start_pos' retval='index'/>
|
||||
<method name='end_pos' retval='index'/>
|
||||
<method name='cursor_pos' retval='index'/>
|
||||
|
@ -30,6 +30,10 @@ output_c_tmp = output_c + '.tmp'
|
||||
stamp = sys.argv[4]
|
||||
|
||||
vrs = {}
|
||||
for a in sys.argv[5:]:
|
||||
key, val = a.split('=')
|
||||
vrs[key] = eval(val)
|
||||
print '%s=%s' % (key, vrs[key])
|
||||
execfile(input_py, vrs)
|
||||
|
||||
def parse_name(Name):
|
||||
@ -109,7 +113,9 @@ GType\n%(name)s_get_type (void)
|
||||
''' % dic)
|
||||
|
||||
for v in vals:
|
||||
out.write(' { %s, (char*) "%s", (char*) "%s" },\n' % (v[0], v[0], v[3]))
|
||||
name = v[0]
|
||||
nick = v[3] if v[3:] and v[3] else name
|
||||
out.write(' { %s, (char*) "%s", (char*) "%s" },\n' % (name, name, nick))
|
||||
|
||||
out.write(''' { 0, NULL, NULL }
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user