Use generated API for lua scripts too

master
Yevgen Muntyan 2010-12-12 02:29:20 -08:00
parent cb5c12de98
commit 71aa8e9db2
209 changed files with 5867 additions and 6657 deletions

View File

@ -36,10 +36,7 @@ plat/win32/gtk-win/release/
plat/win32/gtk-win/bdist-debug/
plat/win32/gtk-win/bdist-release/
moo/mooscript/mooscript-classes.cpp
moo/mooscript/mooscript-classes.h
doc/help/*.html
doc/man-medit.t2t
doc/medit.texi
doc/medit.1
doc/mooscript.texi

View File

@ -25,7 +25,7 @@ do have copyright notice inside; WTFPL will work fine for the rest.
Third-party stuff, for debian/copyright. Everything below
is under LGPL unless noted otherwise.
moo/mooscript/lua/*:
moo/moolua/lua/*:
Lua, LuaFileSystem. Distributed under MIT
license, see moo/moolua/COPYRIGHT, moo/moolua/ext/README.lfs.
Copyright (C) 1994-2007 Lua.org, PUC-Rio.

View File

@ -23,7 +23,6 @@ EXTRA_DIST = \
$(genlua_files) \
sourcefiles.mak \
moo.defs \
moo-lua.cpp \
moo.xml
BUILT_SOURCES =
@ -54,11 +53,4 @@ moo.defs.stamp: $(gendefs_files) moo.xml Makefile
rm -f moo.defs.tmp
echo stamp > moo.defs.stamp
BUILT_SOURCES += moo-lua.cpp.stamp
moo-lua.cpp.stamp: $(genlua_files) moo.xml Makefile
$(PYTHON) $(srcdir)/genlua.py $(srcdir)/moo.xml > moo-lua.cpp.tmp && \
(cmp -s moo-lua.cpp.tmp $(srcdir)/moo-lua.cpp || mv moo-lua.cpp.tmp $(srcdir)/moo-lua.cpp)
rm -f moo-lua.cpp.tmp
echo stamp > moo-lua.cpp.stamp
endif

View File

@ -1,10 +1,23 @@
#! /usr/bin/env python
import sys
import optparse
from mpi.module import Module
from mpi.luawriter import Writer
assert len(sys.argv) == 2
mod = Module.from_xml(sys.argv[1])
Writer(sys.stdout).write(mod)
op = optparse.OptionParser()
op.add_option("-i", "--import", action="append", dest="import_modules")
op.add_option("--include-header", action="append", dest="include_headers")
(opts, args) = op.parse_args()
import_modules = []
if opts.import_modules:
for filename in opts.import_modules:
import_modules.append(Module.from_xml(filename))
assert len(args) == 1
mod = Module.from_xml(args[0])
for im in import_modules:
mod.import_module(im)
Writer(sys.stdout).write(mod, opts.include_headers)

View File

@ -105,10 +105,7 @@ class DoxBlock(object):
ann_start = -1
if ann_start >= 0:
raise ParseError('unterminated annotation')
if annotations:
return annotations, None
else:
return None, None
return annotations, None
class Block(object):
def __init__(self, lines, filename, first_line, last_line):
@ -122,7 +119,7 @@ class Symbol(object):
def __init__(self, name, annotations, docs, block):
object.__init__(self)
self.name = name
self.annotations = annotations
self.annotations = annotations or []
self.docs = docs
self.block = block
@ -157,11 +154,11 @@ class VMethod(Function):
Function.__init__(self, name, annotations, params, retval, docs, block)
class ParamBase(object):
def __init__(self, annotations=None, docs=None):
def __init__(self, annotations=[], docs=None):
object.__init__(self)
self.docs = docs
self.type = None
self.annotations = annotations
self.annotations = annotations or []
class Param(ParamBase):
def __init__(self, name=None, annotations=None, docs=None):
@ -427,8 +424,9 @@ class Parser(object):
print >> sys.stderr, 'parsing gtk-doc comments in file', f
self.__read_comments(f)
for f in filenames:
print >> sys.stderr, 'parsing declarations in file', f
self.__read_declarations(f)
if f.endswith('.h'):
print >> sys.stderr, 'parsing declarations in file', f
self.__read_declarations(f)
# Code copied from h2def.py by Toby D. Reeves <toby@max.rl.plh.af.mil>
@ -604,6 +602,8 @@ class Parser(object):
func.retval = Retval()
if func.retval.type is None:
func.retval.type = ret
if ret in ('char*', 'strv', 'char**'):
func.retval.annotations.insert(0, 'transfer full')
is_varargs = 0
has_args = len(args) > 0

View File

@ -88,6 +88,8 @@ class Writer(object):
self.__end_tag('retval')
def __write_class(self, cls):
if not cls.parent:
raise RuntimeError('parent missing in class %s' % (cls.name,))
dic = dict(name=cls.name, short_name=cls.short_name, parent=cls.parent, gtype_id=cls.gtype_id)
if cls.constructable:
dic['constructable'] = '1'

View File

@ -16,6 +16,13 @@
(gtype-id "MOO_TYPE_ACTION_COLLECTION")
)
(define-object App
(in-module "Moo")
(parent "GObject")
(c-name "MooApp")
(gtype-id "MOO_TYPE_APP")
)
(define-object BigPaned
(in-module "Moo")
(parent "GtkFrame")
@ -86,6 +93,27 @@
(gtype-id "MOO_TYPE_EDIT_BOOKMARK")
)
(define-object EditOpenInfo
(in-module "Moo")
(parent "GObject")
(c-name "MooEditOpenInfo")
(gtype-id "MOO_TYPE_EDIT_OPEN_INFO")
)
(define-object EditReloadInfo
(in-module "Moo")
(parent "GObject")
(c-name "MooEditReloadInfo")
(gtype-id "MOO_TYPE_EDIT_RELOAD_INFO")
)
(define-object EditSaveInfo
(in-module "Moo")
(parent "GObject")
(c-name "MooEditSaveInfo")
(gtype-id "MOO_TYPE_EDIT_SAVE_INFO")
)
(define-object EditWindow
(in-module "Moo")
(parent "MooWindow")
@ -269,12 +297,6 @@
(gtype-id "MOO_TYPE_COMMAND_DATA")
)
(define-boxed FileEnc
(in-module "Moo")
(c-name "MooFileEnc")
(gtype-id "MOO_TYPE_FILE_ENC")
)
(define-boxed PaneLabel
(in-module "Moo")
(c-name "MooPaneLabel")
@ -355,6 +377,14 @@
; methods of MooActionCollection
; methods of MooApp
(define-method get_editor
(of-object "MooApp")
(c-name "moo_app_get_editor")
(return-type "MooEditor*")
)
; methods of MooBigPaned
(define-function MooBigPaned__new
@ -490,28 +520,172 @@
)
)
(define-method get_clean
(of-object "MooEdit")
(c-name "moo_edit_get_clean")
(return-type "gboolean")
)
(define-method get_cursor_pos
(of-object "MooEdit")
(c-name "moo_edit_get_cursor_pos")
(return-type "int")
)
(define-method get_display_basename
(of-object "MooEdit")
(c-name "moo_edit_get_display_basename")
(return-type "const-char*")
)
(define-method get_display_name
(of-object "MooEdit")
(c-name "moo_edit_get_display_name")
(return-type "const-char*")
)
(define-method get_encoding
(of-object "MooEdit")
(c-name "moo_edit_get_encoding")
(return-type "const-char*")
)
(define-method get_file
(of-object "MooEdit")
(c-name "moo_edit_get_file")
(return-type "GFile*")
)
(define-method get_filename
(of-object "MooEdit")
(c-name "moo_edit_get_filename")
(return-type "char*")
(caller-owns-return #t)
)
(define-method get_lang_id
(of-object "MooEdit")
(c-name "moo_edit_get_lang_id")
(return-type "const-char*")
)
(define-method get_selected_lines
(of-object "MooEdit")
(c-name "moo_edit_get_selected_lines")
(return-type "strv")
(caller-owns-return #t)
)
(define-method get_selected_text
(of-object "MooEdit")
(c-name "moo_edit_get_selected_text")
(return-type "char*")
(caller-owns-return #t)
)
(define-method get_status
(of-object "MooEdit")
(c-name "moo_edit_get_status")
(return-type "MooEditStatus")
)
(define-method get_text
(of-object "MooEdit")
(c-name "moo_edit_get_text")
(return-type "char*")
(caller-owns-return #t)
)
(define-method get_uri
(of-object "MooEdit")
(c-name "moo_edit_get_uri")
(return-type "char*")
(caller-owns-return #t)
)
(define-method has_selection
(of-object "MooEdit")
(c-name "moo_edit_has_selection")
(return-type "gboolean")
)
(define-method insert_text
(of-object "MooEdit")
(c-name "moo_edit_insert_text")
(return-type "none")
(parameters
'("const-char*" "text")
)
)
(define-method is_empty
(of-object "MooEdit")
(c-name "moo_edit_is_empty")
(return-type "gboolean")
)
(define-method is_untitled
(of-object "MooEdit")
(c-name "moo_edit_is_untitled")
(return-type "gboolean")
)
(define-method reload
(of-object "MooEdit")
(c-name "moo_edit_reload")
(return-type "gboolean")
(parameters
'("const-char*" "encoding" (null-ok) (default "NULL"))
'("MooEditReloadInfo*" "encoding" (null-ok) (default "NULL"))
'("GError**" "error" (null-ok))
)
)
(define-method replace_selected_lines
(of-object "MooEdit")
(c-name "moo_edit_replace_selected_lines")
(return-type "none")
(parameters
'("strv" "replacement")
)
)
(define-method replace_selected_text
(of-object "MooEdit")
(c-name "moo_edit_replace_selected_text")
(return-type "none")
(parameters
'("const-char*" "replacement")
)
)
(define-method set_clean
(of-object "MooEdit")
(c-name "moo_edit_set_clean")
(return-type "none")
(parameters
'("gboolean" "clean")
)
)
(define-method set_encoding
(of-object "MooEdit")
(c-name "moo_edit_set_encoding")
(return-type "none")
(parameters
'("const-char*" "encoding")
)
)
(define-method set_selection
(of-object "MooEdit")
(c-name "moo_edit_set_selection")
(return-type "none")
(parameters
'("int" "pos_start")
'("int" "pos_end")
)
)
; methods of MooEditAction
(define-virtual check_sensitive
@ -531,6 +705,62 @@
; methods of MooEditBookmark
; methods of MooEditOpenInfo
(define-function edit_open_info_new
(c-name "moo_edit_open_info_new")
(return-type "MooEditOpenInfo*")
(is-constructor-of MooEditOpenInfo)
(parameters
'("GFile*" "file")
'("const-char*" "encoding")
)
)
(define-method dup
(of-object "MooEditOpenInfo")
(c-name "moo_edit_open_info_dup")
(return-type "MooEditOpenInfo*")
(caller-owns-return #t)
)
; methods of MooEditReloadInfo
(define-function edit_reload_info_new
(c-name "moo_edit_reload_info_new")
(return-type "MooEditReloadInfo*")
(is-constructor-of MooEditReloadInfo)
(parameters
'("const-char*" "encoding")
)
)
(define-method dup
(of-object "MooEditReloadInfo")
(c-name "moo_edit_reload_info_dup")
(return-type "MooEditReloadInfo*")
(caller-owns-return #t)
)
; methods of MooEditSaveInfo
(define-function edit_save_info_new
(c-name "moo_edit_save_info_new")
(return-type "MooEditSaveInfo*")
(is-constructor-of MooEditSaveInfo)
(parameters
'("GFile*" "file")
'("const-char*" "encoding")
)
)
(define-method dup
(of-object "MooEditSaveInfo")
(c-name "moo_edit_save_info_dup")
(return-type "MooEditSaveInfo*")
(caller-owns-return #t)
)
; methods of MooEditWindow
(define-method abort_jobs
@ -638,16 +868,6 @@
; methods of MooEditor
(define-method close_all
(of-object "MooEditor")
(c-name "moo_editor_close_all")
(return-type "gboolean")
(parameters
'("gboolean" "leave_one")
'("gboolean" "ask_confirm" (default "TRUE"))
)
)
(define-method close_doc
(of-object "MooEditor")
(c-name "moo_editor_close_doc")
@ -690,12 +910,21 @@
(return-type "MooEditWindow*")
)
(define-method get_doc
(of-object "MooEditor")
(c-name "moo_editor_get_doc")
(return-type "MooEdit*")
(parameters
'("GFile*" "file")
)
)
(define-method get_doc_for_path
(of-object "MooEditor")
(c-name "moo_editor_get_doc_for_path")
(return-type "MooEdit*")
(parameters
'("const-char*" "filename")
'("const-char*" "path")
)
)
@ -743,12 +972,112 @@
)
)
(define-method new_file
(of-object "MooEditor")
(c-name "moo_editor_new_file")
(return-type "MooEdit*")
(parameters
'("MooEditOpenInfo*" "info")
'("GtkWidget*" "parent" (null-ok) (default "NULL"))
'("GError**" "error")
)
)
(define-method new_window
(of-object "MooEditor")
(c-name "moo_editor_new_window")
(return-type "MooEditWindow*")
)
(define-method open_file
(of-object "MooEditor")
(c-name "moo_editor_open_file")
(return-type "MooEdit*")
(parameters
'("MooEditOpenInfo*" "info")
'("GtkWidget*" "parent" (null-ok) (default "NULL"))
'("GError**" "error")
)
)
(define-method open_files
(of-object "MooEditor")
(c-name "moo_editor_open_files")
(return-type "gboolean")
(parameters
'("MooEditOpenInfoArray*" "files")
'("GtkWidget*" "parent" (null-ok) (default "NULL"))
'("GError**" "error")
)
)
(define-method open_path
(of-object "MooEditor")
(c-name "moo_editor_open_path")
(return-type "MooEdit*")
(parameters
'("const-char*" "path")
'("const-char*" "encoding" (null-ok) (default "NULL"))
'("int" "line" (default "-1"))
'("MooEditWindow*" "window" (null-ok) (default "NULL"))
)
)
(define-method open_uri
(of-object "MooEditor")
(c-name "moo_editor_open_uri")
(return-type "MooEdit*")
(parameters
'("const-char*" "uri")
'("const-char*" "encoding" (null-ok) (default "NULL"))
'("int" "line" (default "-1"))
'("MooEditWindow*" "window" (null-ok) (default "NULL"))
)
)
(define-method reload
(of-object "MooEditor")
(c-name "moo_editor_reload")
(return-type "gboolean")
(parameters
'("MooEdit*" "doc")
'("MooEditReloadInfo*" "info")
'("GError**" "error")
)
)
(define-method save
(of-object "MooEditor")
(c-name "moo_editor_save")
(return-type "gboolean")
(parameters
'("MooEdit*" "doc")
'("GError**" "error")
)
)
(define-method save_as
(of-object "MooEditor")
(c-name "moo_editor_save_as")
(return-type "gboolean")
(parameters
'("MooEdit*" "doc")
'("MooEditSaveInfo*" "info")
'("GError**" "error")
)
)
(define-method save_copy
(of-object "MooEditor")
(c-name "moo_editor_save_copy")
(return-type "gboolean")
(parameters
'("MooEdit*" "doc")
'("MooEditSaveInfo*" "info")
'("GError**" "error")
)
)
(define-method set_active_doc
(of-object "MooEditor")
(c-name "moo_editor_set_active_doc")
@ -1385,18 +1714,6 @@
; methods of MooCommandData
; methods of MooFileEnc
(define-function file_enc_new
(c-name "moo_file_enc_new")
(return-type "MooFileEnc*")
(is-constructor-of MooFileEnc)
(parameters
'("GFile*" "file")
'("const-char*" "encoding")
)
)
; methods of MooPaneLabel
(define-function pane_label_new
@ -1457,6 +1774,7 @@
(of-object "MooUiNode")
(c-name "moo_ui_node_get_path")
(return-type "char*")
(caller-owns-return #t)
)
(define-method get_child
@ -1491,6 +1809,46 @@
)
)
(define-function edit_open_info_new_path
(c-name "moo_edit_open_info_new_path")
(return-type "MooEditOpenInfo*")
(caller-owns-return #t)
(parameters
'("const-char*" "path")
'("const-char*" "encoding")
)
)
(define-function edit_open_info_new_uri
(c-name "moo_edit_open_info_new_uri")
(return-type "MooEditOpenInfo*")
(caller-owns-return #t)
(parameters
'("const-char*" "uri")
'("const-char*" "encoding")
)
)
(define-function edit_save_info_new_path
(c-name "moo_edit_save_info_new_path")
(return-type "MooEditSaveInfo*")
(caller-owns-return #t)
(parameters
'("const-char*" "path")
'("const-char*" "encoding")
)
)
(define-function edit_save_info_new_uri
(c-name "moo_edit_save_info_new_uri")
(return-type "MooEditSaveInfo*")
(caller-owns-return #t)
(parameters
'("const-char*" "uri")
'("const-char*" "encoding")
)
)
(define-function edit_window_set_action_filter
(c-name "moo_edit_window_set_action_filter")
(return-type "none")

View File

@ -1,6 +1,11 @@
<module name="Moo">
<class gtype_id="MOO_TYPE_ACTION" name="MooAction" parent="GtkAction" short_name="Action" />
<class gtype_id="MOO_TYPE_ACTION_COLLECTION" name="MooActionCollection" parent="GObject" short_name="ActionCollection" />
<class gtype_id="MOO_TYPE_APP" name="MooApp" parent="GObject" short_name="App">
<method c_name="moo_app_get_editor" name="get_editor">
<retval type="MooEditor*" />
</method>
</class>
<class constructable="1" gtype_id="MOO_TYPE_BIG_PANED" name="MooBigPaned" parent="GtkFrame" short_name="BigPaned" />
<class constructable="1" gtype_id="MOO_TYPE_CMD_VIEW" name="MooCmdView" parent="MooLineView" short_name="CmdView" />
<class constructable="1" gtype_id="MOO_TYPE_COMBO" name="MooCombo" parent="GtkTable" short_name="Combo" />
@ -63,17 +68,64 @@
<doc> whether document was closed</doc>
</retval>
</method>
<method c_name="moo_edit_get_clean" name="get_clean">
<retval type="gboolean" />
</method>
<method c_name="moo_edit_get_cursor_pos" name="get_cursor_pos">
<retval type="int" />
</method>
<method c_name="moo_edit_get_display_basename" name="get_display_basename">
<retval type="const-char*" />
</method>
<method c_name="moo_edit_get_display_name" name="get_display_name">
<retval type="const-char*" />
</method>
<method c_name="moo_edit_get_encoding" name="get_encoding">
<retval type="const-char*" />
</method>
<method c_name="moo_edit_get_file" name="get_file">
<retval type="GFile*" />
</method>
<method c_name="moo_edit_get_filename" name="get_filename">
<retval transfer_mode="full" type="char*" />
</method>
<method c_name="moo_edit_get_lang_id" name="get_lang_id">
<retval type="const-char*">
<doc> id of language currently used in the document. If no language is used, then string "none" is returned.</doc>
</retval>
</method>
<method c_name="moo_edit_get_selected_lines" name="get_selected_lines">
<retval transfer_mode="full" type="strv" />
<doc>Returns selected lines as a list of strings, one string for each line, line terminator characters not included. If nothing is selected, then line at cursor is returned. </doc>
</method>
<method c_name="moo_edit_get_selected_text" name="get_selected_text">
<retval transfer_mode="full" type="char*" />
<doc>returns selected text.</doc>
</method>
<method c_name="moo_edit_get_status" name="get_status">
<retval type="MooEditStatus" />
</method>
<method c_name="moo_edit_get_text" name="get_text">
<retval transfer_mode="full" type="char*" />
</method>
<method c_name="moo_edit_get_uri" name="get_uri">
<retval transfer_mode="full" type="char*" />
</method>
<method c_name="moo_edit_has_selection" name="has_selection">
<retval type="gboolean" />
</method>
<method c_name="moo_edit_insert_text" name="insert_text">
<param name="text" type="const-char*" />
</method>
<method c_name="moo_edit_is_empty" name="is_empty">
<retval type="gboolean" />
<doc>This function returns whether the document is "empty", i.e. is not modified, is untitled, and contains no text.</doc>
</method>
<method c_name="moo_edit_is_untitled" name="is_untitled">
<retval type="gboolean" />
</method>
<method c_name="moo_edit_reload" name="reload">
<param allow_none="1" default_value="NULL" name="encoding" type="const-char*">
<param allow_none="1" default_value="NULL" name="encoding" type="MooEditReloadInfo*">
<doc>encoding to use. If %NULL, current document encoding will be used.</doc>
</param>
<param allow_none="1" name="error" type="GError**">
@ -84,6 +136,24 @@
</retval>
<doc>Reload document from disk </doc>
</method>
<method c_name="moo_edit_replace_selected_lines" name="replace_selected_lines">
<param name="replacement" type="strv" />
<doc>replace selected lines with %param{replacement}. Similar to %method{replace_selected_text()}, but selection is extended to include whole lines. If nothing is selected, then line at cursor is replaced.</doc>
</method>
<method c_name="moo_edit_replace_selected_text" name="replace_selected_text">
<param name="replacement" type="const-char*" />
<doc>replace selected text with %param{replacement}. If nothing is selected, then %param{replacement} is inserted at cursor.</doc>
</method>
<method c_name="moo_edit_set_clean" name="set_clean">
<param name="clean" type="gboolean" />
</method>
<method c_name="moo_edit_set_encoding" name="set_encoding">
<param name="encoding" type="const-char*" />
</method>
<method c_name="moo_edit_set_selection" name="set_selection">
<param name="pos_start" type="int" />
<param name="pos_end" type="int" />
</method>
</class>
<class gtype_id="MOO_TYPE_EDIT_ACTION" name="MooEditAction" parent="MooAction" short_name="EditAction">
<virtual name="check_sensitive">
@ -95,6 +165,35 @@
</virtual>
</class>
<class gtype_id="MOO_TYPE_EDIT_BOOKMARK" name="MooEditBookmark" parent="MooLineMark" short_name="EditBookmark" />
<class gtype_id="MOO_TYPE_EDIT_OPEN_INFO" name="MooEditOpenInfo" parent="GObject" short_name="EditOpenInfo">
<constructor c_name="moo_edit_open_info_new" name="edit_open_info_new">
<param name="file" type="GFile*" />
<param name="encoding" type="const-char*" />
<retval type="MooEditOpenInfo*" />
</constructor>
<method c_name="moo_edit_open_info_dup" name="dup">
<retval transfer_mode="full" type="MooEditOpenInfo*" />
</method>
</class>
<class gtype_id="MOO_TYPE_EDIT_RELOAD_INFO" name="MooEditReloadInfo" parent="GObject" short_name="EditReloadInfo">
<constructor c_name="moo_edit_reload_info_new" name="edit_reload_info_new">
<param name="encoding" type="const-char*" />
<retval type="MooEditReloadInfo*" />
</constructor>
<method c_name="moo_edit_reload_info_dup" name="dup">
<retval transfer_mode="full" type="MooEditReloadInfo*" />
</method>
</class>
<class gtype_id="MOO_TYPE_EDIT_SAVE_INFO" name="MooEditSaveInfo" parent="GObject" short_name="EditSaveInfo">
<constructor c_name="moo_edit_save_info_new" name="edit_save_info_new">
<param name="file" type="GFile*" />
<param name="encoding" type="const-char*" />
<retval type="MooEditSaveInfo*" />
</constructor>
<method c_name="moo_edit_save_info_dup" name="dup">
<retval transfer_mode="full" type="MooEditSaveInfo*" />
</method>
</class>
<class gtype_id="MOO_TYPE_EDIT_WINDOW" name="MooEditWindow" parent="MooWindow" short_name="EditWindow">
<method c_name="moo_edit_window_abort_jobs" name="abort_jobs" />
<method c_name="moo_edit_window_add_pane" name="add_pane">
@ -142,11 +241,6 @@
</method>
</class>
<class gtype_id="MOO_TYPE_EDITOR" name="MooEditor" parent="GObject" short_name="Editor">
<method c_name="moo_editor_close_all" name="close_all">
<param name="leave_one" type="gboolean" />
<param default_value="TRUE" name="ask_confirm" type="gboolean" />
<retval type="gboolean" />
</method>
<method c_name="moo_editor_close_doc" name="close_doc">
<param name="doc" type="MooEdit*" />
<param default_value="TRUE" name="ask_confirm" type="gboolean" />
@ -168,8 +262,12 @@
<method c_name="moo_editor_get_active_window" name="get_active_window">
<retval type="MooEditWindow*" />
</method>
<method c_name="moo_editor_get_doc" name="get_doc">
<param name="file" type="GFile*" />
<retval type="MooEdit*" />
</method>
<method c_name="moo_editor_get_doc_for_path" name="get_doc_for_path">
<param name="filename" type="const-char*" />
<param name="path" type="const-char*" />
<retval type="MooEdit*" />
</method>
<method c_name="moo_editor_get_doc_for_uri" name="get_doc_for_uri">
@ -192,9 +290,64 @@
<param allow_none="1" default_value="NULL" name="window" type="MooEditWindow*" />
<retval type="MooEdit*" />
</method>
<method c_name="moo_editor_new_file" name="new_file">
<param name="info" type="MooEditOpenInfo*" />
<param allow_none="1" default_value="NULL" name="parent" type="GtkWidget*" />
<param name="error" type="GError**" />
<retval type="MooEdit*" />
</method>
<method c_name="moo_editor_new_window" name="new_window">
<retval type="MooEditWindow*" />
</method>
<method c_name="moo_editor_open_file" name="open_file">
<param name="info" type="MooEditOpenInfo*" />
<param allow_none="1" default_value="NULL" name="parent" type="GtkWidget*" />
<param name="error" type="GError**" />
<retval type="MooEdit*" />
</method>
<method c_name="moo_editor_open_files" name="open_files">
<param name="files" type="MooEditOpenInfoArray*" />
<param allow_none="1" default_value="NULL" name="parent" type="GtkWidget*" />
<param name="error" type="GError**" />
<retval type="gboolean" />
</method>
<method c_name="moo_editor_open_path" name="open_path">
<param name="path" type="const-char*" />
<param allow_none="1" default_value="NULL" name="encoding" type="const-char*" />
<param default_value="-1" name="line" type="int" />
<param allow_none="1" default_value="NULL" name="window" type="MooEditWindow*" />
<retval type="MooEdit*" />
</method>
<method c_name="moo_editor_open_uri" name="open_uri">
<param name="uri" type="const-char*" />
<param allow_none="1" default_value="NULL" name="encoding" type="const-char*" />
<param default_value="-1" name="line" type="int" />
<param allow_none="1" default_value="NULL" name="window" type="MooEditWindow*" />
<retval type="MooEdit*" />
</method>
<method c_name="moo_editor_reload" name="reload">
<param name="doc" type="MooEdit*" />
<param name="info" type="MooEditReloadInfo*" />
<param name="error" type="GError**" />
<retval type="gboolean" />
</method>
<method c_name="moo_editor_save" name="save">
<param name="doc" type="MooEdit*" />
<param name="error" type="GError**" />
<retval type="gboolean" />
</method>
<method c_name="moo_editor_save_as" name="save_as">
<param name="doc" type="MooEdit*" />
<param name="info" type="MooEditSaveInfo*" />
<param name="error" type="GError**" />
<retval type="gboolean" />
</method>
<method c_name="moo_editor_save_copy" name="save_copy">
<param name="doc" type="MooEdit*" />
<param name="info" type="MooEditSaveInfo*" />
<param name="error" type="GError**" />
<retval type="gboolean" />
</method>
<method c_name="moo_editor_set_active_doc" name="set_active_doc">
<param name="doc" type="MooEdit*" />
</method>
@ -430,13 +583,6 @@
</class>
<class gtype_id="MOO_TYPE_WINDOW" name="MooWindow" parent="GtkWindow" short_name="Window" />
<boxed gtype_id="MOO_TYPE_COMMAND_DATA" name="MooCommandData" short_name="CommandData" />
<boxed gtype_id="MOO_TYPE_FILE_ENC" name="MooFileEnc" short_name="FileEnc">
<constructor c_name="moo_file_enc_new" name="file_enc_new">
<param name="file" type="GFile*" />
<param name="encoding" type="const-char*" />
<retval type="MooFileEnc*" />
</constructor>
</boxed>
<boxed gtype_id="MOO_TYPE_PANE_LABEL" name="MooPaneLabel" short_name="PaneLabel">
<constructor c_name="moo_pane_label_new" name="pane_label_new">
<param allow_none="1" default_value="NULL" name="icon_name" type="const-char*" />
@ -473,7 +619,7 @@
</boxed>
<pointer gtype_id="MOO_TYPE_UI_NODE" name="MooUiNode" short_name="UiNode">
<method c_name="moo_ui_node_get_path" name="get_path">
<retval type="char*" />
<retval transfer_mode="full" type="char*" />
</method>
<method c_name="moo_ui_node_get_child" name="get_child">
<param name="path" type="const-char*" />
@ -499,6 +645,26 @@
<param name="string" type="const-char*" />
<retval type="const-char*" />
</function>
<function c_name="moo_edit_open_info_new_path" name="edit_open_info_new_path">
<param name="path" type="const-char*" />
<param name="encoding" type="const-char*" />
<retval transfer_mode="full" type="MooEditOpenInfo*" />
</function>
<function c_name="moo_edit_open_info_new_uri" name="edit_open_info_new_uri">
<param name="uri" type="const-char*" />
<param name="encoding" type="const-char*" />
<retval transfer_mode="full" type="MooEditOpenInfo*" />
</function>
<function c_name="moo_edit_save_info_new_path" name="edit_save_info_new_path">
<param name="path" type="const-char*" />
<param name="encoding" type="const-char*" />
<retval transfer_mode="full" type="MooEditSaveInfo*" />
</function>
<function c_name="moo_edit_save_info_new_uri" name="edit_save_info_new_uri">
<param name="uri" type="const-char*" />
<param name="encoding" type="const-char*" />
<retval transfer_mode="full" type="MooEditSaveInfo*" />
</function>
<function c_name="moo_edit_window_set_action_filter" name="edit_window_set_action_filter">
<param name="action_id" type="const-char*" />
<param name="type" type="MooActionCheckType" />

View File

@ -78,11 +78,17 @@ class Writer(object):
self.out.write(type_template % dic)
self.out.write('\n')
def __write_function_or_method(self, meth, cls):
if meth.retval:
return_type = meth.retval.type
def __get_pygtk_type_name(self, typ):
if isinstance(typ, InstanceType):
return typ.name + '*'
else:
return typ.name
def __write_function_or_method(self, meth, cls):
if meth.retval is None:
return_type = 'none'
else:
return_type = self.__get_pygtk_type_name(meth.retval.type)
dic = dict(name=meth.name, c_name=meth.c_name, return_type=return_type)
if not cls:
self.out.write(function_start_template % dic)
@ -104,7 +110,7 @@ class Writer(object):
if meth.params:
self.out.write(' (parameters\n')
for p in meth.params:
self.out.write(' \'("%s" "%s"' % (p.type, p.name))
self.out.write(' \'("%s" "%s"' % (self.__get_pygtk_type_name(p.type), p.name))
if p.allow_none:
self.out.write(' (null-ok)')
if p.default_value is not None:

View File

@ -1,8 +1,338 @@
import sys
from mpi.module import *
tmpl_file_start = """\
#include "moo-lua-api-util.h"
"""
tmpl_cfunc_method_start = """\
static int
%(cfunc)s (gpointer pself, G_GNUC_UNUSED lua_State *L, G_GNUC_UNUSED int first_arg)
{
%(Class)s *self = (%(Class)s*) pself;
"""
tmpl_cfunc_func_start = """\
static int
%(cfunc)s (G_GNUC_UNUSED lua_State *L)
{
"""
tmpl_register_module_start = """\
void
%(module)s_lua_api_register (void)
{
static gboolean been_here = FALSE;
if (been_here)
return;
been_here = TRUE;
"""
tmpl_register_one_type_start = """\
MooLuaMethodEntry methods_%(Class)s[] = {
"""
tmpl_register_one_type_end = """\
{ NULL, NULL }
};
moo_lua_register_methods (%(gtype_id)s, methods_%(Class)s);
"""
class ArgHelper(object):
def format_arg(self, allow_none, default_value, arg_name, arg_idx, param_name):
return ''
class SimpleArgHelper(ArgHelper):
def __init__(self, name, suffix):
super(SimpleArgHelper, self).__init__()
self.name = name
self.suffix = suffix
def format_arg(self, allow_none, default_value, arg_name, arg_idx, param_name):
dic = dict(type=self.name, arg_name=arg_name, default_value=default_value,
arg_idx=arg_idx, param_name=param_name, suffix=self.suffix)
if default_value is not None:
return '%(type)s %(arg_name)s = moo_lua_get_arg_%(suffix)s_opt (L, %(arg_idx)s, "%(param_name)s", %(default_value)s);' % dic
else:
return '%(type)s %(arg_name)s = moo_lua_get_arg_%(suffix)s (L, %(arg_idx)s, "%(param_name)s");' % dic
_arg_helpers = {}
_arg_helpers['int'] = SimpleArgHelper('int', 'int')
_arg_helpers['uint'] = SimpleArgHelper('guint', 'int')
_arg_helpers['gint'] = SimpleArgHelper('int', 'int')
_arg_helpers['guint'] = SimpleArgHelper('guint', 'int')
_arg_helpers['gboolean'] = SimpleArgHelper('gboolean', 'bool')
_arg_helpers['const-char*'] = SimpleArgHelper('const char*', 'string')
_arg_helpers['char*'] = SimpleArgHelper('char*', 'string')
_arg_helpers['strv'] = SimpleArgHelper('char**', 'strv')
def find_arg_helper(param):
return _arg_helpers[param.type.name]
_ret_helpers = {}
_ret_helpers['int'] = ('int', 'int')
_ret_helpers['uint'] = ('guint', 'uint')
_ret_helpers['gint'] = ('int', 'int')
_ret_helpers['guint'] = ('guint', 'uint')
_ret_helpers['gboolean'] = ('gboolean', 'bool')
def find_ret_helper(name):
return _ret_helpers[name]
_pod_ret_helpers = {}
_pod_ret_helpers['int'] = ('int', 'int')
_pod_ret_helpers['uint'] = ('guint', 'int')
_pod_ret_helpers['gint'] = ('int', 'int')
_pod_ret_helpers['guint'] = ('guint', 'int')
_pod_ret_helpers['gboolean'] = ('gboolean', 'bool')
def find_pod_ret_helper(name):
return _pod_ret_helpers.get(name, (None, None))
class Writer(object):
def __init__(self, out):
super(Writer, self).__init__()
self.out = out
def write(self, module):
def __write_function_param(self, func_body, param, i, meth, cls):
dic = dict(narg=i, gtype_id=param.type.gtype_id, param_name=param.name,
allow_none=('TRUE' if param.allow_none else 'FALSE'),
default_value=param.default_value,
arg_idx='first_arg + %d' % (i,),
TypeName=param.type.name,
)
if isinstance(param.type, Class) or isinstance(param.type, Boxed) or isinstance(param.type, Pointer):
if param.default_value is not None:
func_body.start.append(('%(TypeName)s *arg%(narg)d = (%(TypeName)s*) ' + \
'moo_lua_get_arg_instance_opt (L, %(arg_idx)s, "%(param_name)s", ' + \
'%(gtype_id)s);') % dic)
else:
func_body.start.append(('%(TypeName)s *arg%(narg)d = (%(TypeName)s*) ' + \
'moo_lua_get_arg_instance (L, %(arg_idx)s, "%(param_name)s", ' + \
'%(gtype_id)s);') % dic)
elif isinstance(param.type, Enum) or isinstance(param.type, Flags):
if param.default_value is not None:
func_body.start.append(('%(TypeName)s arg%(narg)d = (%(TypeName)s) ' + \
'moo_lua_get_arg_enum_opt (L, %(arg_idx)s, "%(param_name)s", ' + \
'%(gtype_id)s, %(default_value)s);') % dic)
else:
func_body.start.append(('%(TypeName)s arg%(narg)d = (%(TypeName)s) ' + \
'moo_lua_get_arg_enum (L, %(arg_idx)s, "%(param_name)s", ' + \
'%(gtype_id)s);') % dic)
elif isinstance(param.type, ArrayType):
assert isinstance(param.type.elm_type, Class)
dic['gtype_id'] = param.type.elm_type.gtype_id
if param.default_value is not None:
func_body.start.append(('%(TypeName)s arg%(narg)d = (%(TypeName)s) ' + \
'moo_lua_get_arg_object_array_opt (L, %(arg_idx)s, "%(param_name)s", ' + \
'%(gtype_id)s);') % dic)
else:
func_body.start.append(('%(TypeName)s arg%(narg)d = (%(TypeName)s) ' + \
'moo_lua_get_arg_object_array (L, %(arg_idx)s, "%(param_name)s", ' + \
'%(gtype_id)s);') % dic)
func_body.end.append('moo_object_array_free ((MooObjectArray*) arg%(narg)d);' % dic)
elif param.type.name == 'strv':
assert param.default_value is None or param.default_value == 'NULL'
if param.default_value is not None:
func_body.start.append(('char **arg%(narg)d = moo_lua_get_arg_strv_opt (L, %(arg_idx)s, "%(param_name)s");') % dic)
else:
func_body.start.append(('char **arg%(narg)d = moo_lua_get_arg_strv (L, %(arg_idx)s, "%(param_name)s");') % dic)
func_body.end.append('g_strfreev (arg%(narg)d);' % dic)
else:
arg_helper = find_arg_helper(param)
func_body.start.append(arg_helper.format_arg(param.allow_none, param.default_value,
'arg%(narg)d' % dic, 'first_arg + %(narg)d' % dic, param.name))
def __write_function(self, meth, cls, method_cfuncs):
assert not isinstance(meth, Constructor) and not isinstance(meth, VMethod)
has_gerror_return = False
params = []
for i in range(len(meth.params)):
p = meth.params[i]
if isinstance(p.type, GErrorReturnType):
print >> sys.stderr, "Skipping function %s because of 'GError**' parameter" % meth.c_name
return
if not p.type.name in _arg_helpers and not isinstance(p.type, ArrayType) and \
not isinstance(p.type, GTypedType):
print >> sys.stderr, "Skipping function %s because of '%s' parameter" % (meth.c_name, p.type.name)
return
if isinstance(p.type, GErrorReturnType):
assert i == len(meth.params) - 1
assert meth.retval.type.name == 'gboolean'
else:
params.append(p)
dic = dict(name=meth.name, c_name=meth.c_name)
if cls:
dic['cfunc'] = 'cfunc_%s_%s' % (cls.name, meth.name)
dic['Class'] = cls.name
self.out.write(tmpl_cfunc_method_start % dic)
else:
dic['cfunc'] = 'cfunc_%s' % meth.name
self.out.write(tmpl_cfunc_func_start % dic)
method_cfuncs.append([meth.name, dic['cfunc']])
class FuncBody:
def __init__(self):
self.start = []
self.end = []
func_body = FuncBody()
func_call = ''
i = 0
for p in params:
self.__write_function_param(func_body, p, i, meth, cls)
i += 1
if meth.retval:
dic = {'gtype_id': meth.retval.type.gtype_id,
'make_copy': ('FALSE' if meth.retval.transfer_mode == 'full' else 'TRUE'),
}
if isinstance(meth.retval.type, Class) or isinstance(meth.retval.type, Boxed) or isinstance(meth.retval.type, Pointer):
func_call = 'gpointer ret = '
push_ret = 'moo_lua_push_instance (L, ret, %(gtype_id)s, %(make_copy)s);' % dic
elif isinstance(meth.retval.type, Enum) or isinstance(meth.retval.type, Flags):
func_call = '%s ret = ' % meth.retval.type.name
push_ret = 'moo_lua_push_int (L, ret);' % dic
elif isinstance(meth.retval.type, ArrayType):
assert isinstance(meth.retval.type.elm_type, Class)
dic['gtype_id'] = meth.retval.type.elm_type.gtype_id
func_call = 'MooObjectArray *ret = (MooObjectArray*) '
push_ret = 'moo_lua_push_object_array (L, ret, %(make_copy)s);' % dic
elif meth.retval.type.name == 'strv':
assert meth.retval.transfer_mode == 'full'
func_call = 'char **ret = '
push_ret = 'moo_lua_push_strv (L, ret);'
elif meth.retval.type.name == 'char*':
assert meth.retval.transfer_mode == 'full'
func_call = 'char *ret = '
push_ret = 'moo_lua_push_string (L, ret);'
elif meth.retval.type.name == 'const-char*':
assert meth.retval.transfer_mode != 'full'
func_call = 'const char *ret = '
push_ret = 'moo_lua_push_string_copy (L, ret);'
else:
typ, suffix = find_pod_ret_helper(meth.retval.type.name)
if typ:
dic['suffix'] = suffix
func_call = '%s ret = ' % typ
push_ret = 'moo_lua_push_%(suffix)s (L, ret);' % dic
else:
typ, suffix = find_ret_helper(meth.retval.type.name)
dic['suffix'] = suffix
func_call = '%s ret = ' % typ
push_ret = 'moo_lua_push_%(suffix)s (L, ret, %(make_copy)s);' % dic
else:
push_ret = '0;'
func_body.end.append('return %s' % push_ret)
func_call += '%s (' % meth.c_name
first_arg = True
if cls:
first_arg = False
func_call += 'self'
for i in range(len(params)):
if not first_arg:
func_call += ', '
first_arg = False
func_call += 'arg%d' % i
func_call += ');'
for line in func_body.start:
print >>self.out, ' ' + line
print >>self.out, ' ' + func_call
for line in func_body.end:
print >>self.out, ' ' + line
self.out.write('}\n\n')
# if not cls:
# self.out.write(function_start_template % dic)
# elif isinstance(meth, Constructor):
# dic['class'] = cls.name
# self.out.write(function_start_template % dic)
# self.out.write(' (is-constructor-of %s)\n' % cls.name)
# elif isinstance(meth, VMethod):
# dic['class'] = cls.name
# self.out.write(vmethod_start_template % dic)
# else:
# dic['class'] = cls.name
# self.out.write(method_start_template % dic)
# if meth.retval:
# if meth.retval.transfer_mode == 'full':
# self.out.write(' (caller-owns-return #t)\n')
# elif meth.retval.transfer_mode is not None:
# raise RuntimeError('do not know how to handle transfer mode %s' % (meth.retval.transfer_mode,))
# if meth.params:
# self.out.write(' (parameters\n')
# for p in meth.params:
# self.out.write(' \'("%s" "%s"' % (p.type, p.name))
# if p.allow_none:
# self.out.write(' (null-ok)')
# if p.default_value is not None:
# self.out.write(' (default "%s")' % (p.default_value,))
# self.out.write(')\n')
# self.out.write(' )\n')
# self.out.write(')\n\n')
def __write_class(self, cls):
self.out.write('// methods of %s\n\n' % cls.name)
method_cfuncs = []
for meth in cls.methods:
if not isinstance(meth, VMethod):
self.__write_function(meth, cls, method_cfuncs)
return method_cfuncs
def __write_register_module(self, module, all_method_cfuncs):
self.out.write(tmpl_register_module_start % dict(module=module.name.lower()))
for cls in module.get_classes():
method_cfuncs = all_method_cfuncs[cls.name]
if method_cfuncs:
dic = dict(Class=cls.name, gtype_id=cls.gtype_id)
self.out.write(tmpl_register_one_type_start % dic)
for name, cfunc in method_cfuncs:
self.out.write(' { "%s", %s },\n' % (name, cfunc))
self.out.write(tmpl_register_one_type_end % dic)
self.out.write('}\n')
def write(self, module, include_headers):
self.module = module
self.out.write(tmpl_file_start)
if include_headers:
for h in include_headers:
self.out.write('#include "%s"\n' % h)
self.out.write('\n')
all_method_cfuncs = {}
for cls in module.get_classes():
method_cfuncs = self.__write_class(cls)
all_method_cfuncs[cls.name] = method_cfuncs
# for cls in module.get_boxed():
# self.__write_boxed_decl(cls)
# for cls in module.get_pointers():
# self.__write_pointer_decl(cls)
#
# for enum in module.get_enums():
# self.__write_enum_decl(enum)
#
# for cls in module.get_classes() + module.get_boxed() + module.get_pointers():
# self.__write_class_methods(cls)
#
# for func in module.get_functions():
# self.__write_function(func)
self.__write_register_module(module, all_method_cfuncs)
del self.module

View File

@ -1,3 +1,4 @@
import re
import xml.etree.ElementTree as _etree
class Doc(object):
@ -130,22 +131,44 @@ class VMethod(_FunctionBase):
_FunctionBase.__init__(self)
self.c_name = "fake"
class _GTypedType(_XmlObject):
class Type(_XmlObject):
def __init__(self):
_XmlObject.__init__(self)
self.name = None
self.short_name = None
self.c_name = None
self.gtype_id = None
class BasicType(Type):
def __init__(self, name):
Type.__init__(self)
self.name = name
class ArrayType(Type):
def __init__(self, elm_type):
Type.__init__(self)
self.elm_type = elm_type
self.name = '%sArray*' % elm_type.name
self.c_name = '%sArray*' % elm_type.name
class GErrorReturnType(Type):
def __init__(self):
Type.__init__(self)
self.name = 'GError**'
class GTypedType(Type):
def __init__(self):
Type.__init__(self)
self.short_name = None
def _parse_attribute(self, attr, value):
if attr in ('short_name', 'name', 'gtype_id'):
_set_unique_attribute(self, attr, value)
else:
return _XmlObject._parse_attribute(self, attr, value)
return Type._parse_attribute(self, attr, value)
return True
def _parse_xml(self, elm, *args):
_XmlObject._parse_xml(self, elm, *args)
Type._parse_xml(self, elm, *args)
if self.name is None:
raise RuntimeError('class name missing')
if self.short_name is None:
@ -153,17 +176,17 @@ class _GTypedType(_XmlObject):
if self.gtype_id is None:
raise RuntimeError('class gtype missing')
class Enum(_GTypedType):
class Enum(GTypedType):
def __init__(self):
_GTypedType.__init__(self)
GTypedType.__init__(self)
class Flags(_GTypedType):
class Flags(GTypedType):
def __init__(self):
_GTypedType.__init__(self)
GTypedType.__init__(self)
class _InstanceType(_GTypedType):
class InstanceType(GTypedType):
def __init__(self):
_GTypedType.__init__(self)
GTypedType.__init__(self)
self.constructor = None
self.methods = []
self.__method_hash = {}
@ -178,19 +201,19 @@ class _InstanceType(_GTypedType):
assert not self.constructor
self.constructor = Constructor.from_xml(elm)
else:
_GTypedType._parse_xml_element(self, elm)
GTypedType._parse_xml_element(self, elm)
class Pointer(_InstanceType):
class Pointer(InstanceType):
def __init__(self):
_InstanceType.__init__(self)
InstanceType.__init__(self)
class Boxed(_InstanceType):
class Boxed(InstanceType):
def __init__(self):
_InstanceType.__init__(self)
InstanceType.__init__(self)
class Class(_InstanceType):
class Class(InstanceType):
def __init__(self):
_InstanceType.__init__(self)
InstanceType.__init__(self)
self.parent = None
self.vmethods = []
self.constructable = None
@ -202,7 +225,7 @@ class Class(_InstanceType):
elif attr in ('constructable'):
_set_unique_attribute_bool(self, attr, value)
else:
return _InstanceType._parse_attribute(self, attr, value)
return InstanceType._parse_attribute(self, attr, value)
return True
def _parse_xml_element(self, elm):
@ -212,10 +235,10 @@ class Class(_InstanceType):
self.__vmethod_hash[meth.name] = meth
self.vmethods.append(meth)
else:
_InstanceType._parse_xml_element(self, elm)
InstanceType._parse_xml_element(self, elm)
def _parse_xml(self, elm, *args):
_InstanceType._parse_xml(self, elm, *args)
InstanceType._parse_xml(self, elm, *args)
if self.parent is None:
raise RuntimeError('class parent name missing')
if self.constructable and self.constructor:
@ -234,15 +257,70 @@ class Module(object):
self.__function_hash = {}
self.__import_modules = []
self.__parsing_done = False
self.__types = {}
def __add_type(self, typ):
if typ.name in self.__class_hash:
raise RuntimeError('duplicated type %s' % typ.name)
self.__class_hash[typ.name] = typ
def __finish_type(self, typ):
if isinstance(typ, Type):
return typ
if typ in self.__types:
return self.__types[typ]
if typ == 'GError**':
return GErrorReturnType()
m = re.match(r'([\w\d_]+)\*', typ)
if m:
name = m.group(1)
if name in self.__types:
obj_type = self.__types[name]
if isinstance(obj_type, InstanceType):
return obj_type
m = re.match(r'Array<([\w\d_]+)>\*', typ)
if m:
elm_type = self.__finish_type(m.group(1))
return ArrayType(elm_type)
m = re.match(r'([\w\d_]+)Array\*', typ)
if m:
elm_type = self.__finish_type(m.group(1))
return ArrayType(elm_type)
return BasicType(typ)
def __finish_parsing_method(self, meth, typ):
for p in meth.params:
p.type = self.__finish_type(p.type)
if meth.retval:
meth.retval.type = self.__finish_type(meth.retval.type)
def __finish_parsing_type(self, typ):
if hasattr(typ, 'constructor') and typ.constructor is not None:
self.__finish_parsing_method(typ.constructor, typ)
for meth in typ.methods:
self.__finish_parsing_method(meth, typ)
if hasattr(typ, 'vmethods'):
for meth in typ.vmethods:
self.__finish_parsing_method(meth, typ)
def __finish_parsing(self):
if self.__parsing_done:
return
for typ in self.__classes + self.__boxed + self.__pointers + self.__enums:
self.__types[typ.name] = typ
for module in self.__import_modules:
for typ in module.get_classes() + module.get_boxed() + \
module.get_pointers() + module.get_enums():
self.__types[typ.name] = typ
for typ in self.__classes + self.__boxed + self.__pointers:
self.__finish_parsing_type(typ)
for func in self.__functions:
self.__finish_parsing_method(func, None)
self.__parsing_done = True
def get_classes(self):

View File

@ -1,289 +1,291 @@
source_files = \
../moo/mooapp/mooapp-private.h\
../moo/mooapp/mooappabout.c\
../moo/mooapp/mooappabout.h\
../moo/mooapp/mooapp-accels.h\
../moo/mooapp/mooapp.c\
../moo/mooapp/moohtml.h\
../moo/mooapp/mooapp.h\
../moo/mooapp/mooapp-info.h\
../moo/mooapp/mooapp-private.h\
../moo/mooapp/moohtml.c\
../moo/mooapp/moohtml.h\
../moo/mooapp/moolinklabel.c\
../moo/mooapp/moolinklabel.h\
../moo/mooapp/mooapp-accels.h\
../moo/mooapp/mooappabout.h\
../moo/mooapp/moohtml.c\
../moo/mooapp/mooapp.h\
../moo/mooedit/mooeditor.c\
../moo/mooedit/moolangmgr.h\
../moo/mooedit/mootextsearch.h\
../moo/mooedit/mootextfind.h\
../moo/mooedit/mooeditwindow.c\
../moo/mooedit/mooeditfiltersettings.c\
../moo/mooedit/mooeditor-private.h\
../moo/mooedit/mooedithistoryitem.h\
../moo/mooedit/mootextview-private.h\
../moo/mooedit/mootextprint.h\
../moo/mooedit/mooindenter.c\
../moo/mooedit/mooplugin-loader.h\
../moo/mooedit/mooeditor-tests.c\
../moo/mooedit/mootextview.c\
../moo/mooedit/mootextprint-private.h\
../moo/mooedit/moolinemark.h\
../moo/mooedit/mootextprint.c\
../moo/mooedit/mooeditconfig.h\
../moo/mooedit/mooedit-fileops.c\
../moo/mooedit/mootextstylescheme.h\
../moo/mooedit/moofold.h\
../moo/mooedit/mooedit-enums.c\
../moo/mooedit/mooedit-private.h\
../moo/mooedit/moofileenc.h\
../moo/mooedit/mootextbuffer.h\
../moo/mooedit/moolangmgr.c\
../moo/mooedit/mooedit-accels.h\
../moo/mooedit/mooeditaction.c\
../moo/mooedit/mooeditaction-factory.c\
../moo/mooedit/mooeditaction-factory.h\
../moo/mooedit/mooeditor-impl.h\
../moo/mooedit/mooeditprefs.c\
../moo/mooedit/mootext-private.h\
../moo/mooedit/mooeditaction.h\
../moo/mooedit/mooeditbookmark.c\
../moo/mooedit/moolinebuffer.c\
../moo/mooedit/mooeditprefspage.c\
../moo/mooedit/mootextiter.h\
../moo/mooedit/mootextsearch.c\
../moo/mooedit/mooeditbookmark.h\
../moo/mooedit/mooedit.c\
../moo/mooedit/mooeditconfig.c\
../moo/mooedit/mooeditconfig.h\
../moo/mooedit/mooeditdialogs.c\
../moo/mooedit/mooeditdialogs.h\
../moo/mooedit/mooedit-enums.c\
../moo/mooedit/mooedit-enums.h\
../moo/mooedit/mooeditfileinfo.c\
../moo/mooedit/mooeditfileinfo.c\
../moo/mooedit/mooeditfileinfo.h\
../moo/mooedit/mooedit-fileops.c\
../moo/mooedit/mooedit-fileops.h\
../moo/mooedit/mooeditfiltersettings.c\
../moo/mooedit/mooeditfiltersettings.h\
../moo/mooedit/mooedit.h\
../moo/mooedit/mooedithistoryitem.c\
../moo/mooedit/mooedithistoryitem.h\
../moo/mooedit/mooedit-impl.h\
../moo/mooedit/mooedit-misc.c\
../moo/mooedit/mooeditor.c\
../moo/mooedit/mooeditor.h\
../moo/mooedit/mooeditor-impl.h\
../moo/mooedit/mooeditor-private.h\
../moo/mooedit/mooeditor-tests.c\
../moo/mooedit/mooeditor-tests.h\
../moo/mooedit/mooeditprefs.c\
../moo/mooedit/mooeditprefs.h\
../moo/mooedit/mooeditprefspage.c\
../moo/mooedit/mooedit-private.h\
../moo/mooedit/mooedit-script.c\
../moo/mooedit/mooedit-script.h\
../moo/mooedit/mooedittypes.h\
../moo/mooedit/mooeditwindow.c\
../moo/mooedit/mooeditwindow.h\
../moo/mooedit/mooeditwindow-impl.h\
../moo/mooedit/moofold.c\
../moo/mooedit/moofold.h\
../moo/mooedit/mooindenter.c\
../moo/mooedit/mooindenter.h\
../moo/mooedit/moolang.c\
../moo/mooedit/moolang.h\
../moo/mooedit/moolangmgr.c\
../moo/mooedit/moolangmgr.h\
../moo/mooedit/moolangmgr-private.h\
../moo/mooedit/moolang-private.h\
../moo/mooedit/moolinebuffer.c\
../moo/mooedit/moolinebuffer.h\
../moo/mooedit/moolinemark.c\
../moo/mooedit/moolinemark.h\
../moo/mooedit/mooplugin.c\
../moo/mooedit/mooplugin.h\
../moo/mooedit/mooplugin-loader.c\
../moo/mooedit/mooplugin-loader.h\
../moo/mooedit/mooplugin-macro.h\
../moo/mooedit/mooprintpreview.c\
../moo/mooedit/mooprintpreview.h\
../moo/mooedit/mootextbtree.c\
../moo/mooedit/mootextbtree.h\
../moo/mooedit/mootextbuffer.c\
../moo/mooedit/mootextfind.c\
../moo/mooedit/mootextfind.h\
../moo/mooedit/mootextiter.h\
../moo/mooedit/mootextprint.c\
../moo/mooedit/mootextprint.h\
../moo/mooedit/mootextprint-private.h\
../moo/mooedit/mootext-private.h\
../moo/mooedit/mootextsearch.c\
../moo/mooedit/mootextsearch.h\
../moo/mooedit/mootextsearch-private.h\
../moo/mooedit/mootextstylescheme.c\
../moo/mooedit/mootextstylescheme.h\
../moo/mooedit/mootextview.c\
../moo/mooedit/mootextview.h\
../moo/mooedit/mootextview-input.c\
../moo/mooedit/mooindenter.h\
../moo/mooedit/mooeditdialogs.h\
../moo/mooedit/mooplugin-macro.h\
../moo/mooedit/mootextbuffer.c\
../moo/mooedit/mootextbtree.c\
../moo/mooedit/mooeditdialogs.c\
../moo/mooedit/mooeditaction-factory.c\
../moo/mooedit/mooplugin.c\
../moo/mooedit/mooprintpreview.h\
../moo/mooedit/mooedit-enums.h\
../moo/mooedit/mooeditwindow.h\
../moo/mooedit/moolang.c\
../moo/mooedit/mooprintpreview.c\
../moo/mooedit/mooeditwindow-impl.h\
../moo/mooedit/mootextbtree.h\
../moo/mooedit/mooplugin-loader.c\
../moo/mooedit/mooedit.c\
../moo/mooedit/mootextsearch-private.h\
../moo/mooedit/mooeditprefs.h\
../moo/mooedit/moofileenc.c\
../moo/mooedit/mooplugin.h\
../moo/mooedit/mooeditconfig.c\
../moo/mooedit/moolangmgr-private.h\
../moo/mooedit/mooeditor-tests.h\
../moo/mooedit/mooedithistoryitem.c\
../moo/mooedit/mooeditor.h\
../moo/mooedit/mooedit-accels.h\
../moo/mooedit/mooeditfiltersettings.h\
../moo/mooedit/moofold.c\
../moo/mooedit/mooedit.h\
../moo/mooedit/mooedit-impl.h\
../moo/mooedit/mooeditaction.h\
../moo/mooedit/mootextstylescheme.c\
../moo/mooedit/mooeditaction.c\
../moo/mooedit/moolinebuffer.h\
../moo/mooedit/mooedit-fileops.h\
../moo/mooedit/moolinemark.c\
../moo/mooedit/mootextfind.c\
../moo/mooedit/moolang.h\
../moo/mooedit/mooeditbookmark.h\
../moo/mooedit/mooedittypes.h\
../moo/moofileview/moofileview-dialogs.h\
../moo/moofileview/mooiconview.h\
../moo/moofileview/moofileview-private.h\
../moo/moofileview/mootreeview.c\
../moo/moofileview/moofilesystem.h\
../moo/moofileview/moobookmarkview.h\
../moo/moofileview/moofolder-private.h\
../moo/moofileview/moofileentry.c\
../moo/moofileview/moofileview-dialogs.c\
../moo/moofileview/moofolder.c\
../moo/moofileview/moofileview.h\
../moo/mooedit/mootextview-private.h\
../moo/moofileview/moobookmarkmgr.c\
../moo/moofileview/moofile.c\
../moo/moofileview/moofileview-tools.c\
../moo/moofileview/moofileentry.h\
../moo/moofileview/moofolder.h\
../moo/moofileview/moobookmarkmgr.h\
../moo/moofileview/moofileview-aux.h\
../moo/moofileview/moobookmarkview.c\
../moo/moofileview/moofoldermodel-private.h\
../moo/moofileview/moofile-private.h\
../moo/moofileview/moofileview-accels.h\
../moo/moofileview/mooiconview.c\
../moo/moofileview/moofileview.c\
../moo/moofileview/moofileview-impl.h\
../moo/moofileview/mootreeview.h\
../moo/moofileview/moofoldermodel.h\
../moo/moofileview/moofileview-tools.h\
../moo/moofileview/moofilesystem.c\
../moo/moofileview/moofoldermodel.c\
../moo/moofileview/moobookmarkview.h\
../moo/moofileview/moofile.c\
../moo/moofileview/moofileentry.c\
../moo/moofileview/moofileentry.h\
../moo/moofileview/moofile.h\
../moo/mooutils/mooutils-file.h\
../moo/mooutils/mooclosure.c\
../moo/mooutils/mooundo.h\
../moo/mooutils/moo-mime.h\
../moo/mooutils/mooappinput.h\
../moo/mooutils/mooutils-messages.h\
../moo/mooutils/mooutils-treeview.h\
../moo/mooutils/mooprefsdialog.h\
../moo/mooutils/moocompat.h\
../moo/mooutils/mooutils-file.c\
../moo/mooutils/mooaccelprefs.c\
../moo/mooutils/mooactiongroup.h\
../moo/mooutils/moohelp.h\
../moo/mooutils/mooencodings.c\
../moo/mooutils/mooutils-macros.h\
../moo/mooutils/mooactionbase-private.h\
../moo/mooutils/moopaned.c\
../moo/mooutils/moofiltermgr.h\
../moo/mooutils/mooonce.h\
../moo/moofileview/moofile-private.h\
../moo/moofileview/moofilesystem.c\
../moo/moofileview/moofilesystem.h\
../moo/moofileview/moofileview-accels.h\
../moo/moofileview/moofileview-aux.h\
../moo/moofileview/moofileview.c\
../moo/moofileview/moofileview-dialogs.c\
../moo/moofileview/moofileview-dialogs.h\
../moo/moofileview/moofileview.h\
../moo/moofileview/moofileview-impl.h\
../moo/moofileview/moofileview-private.h\
../moo/moofileview/moofileview-tools.c\
../moo/moofileview/moofileview-tools.h\
../moo/moofileview/moofolder.c\
../moo/moofileview/moofolder.h\
../moo/moofileview/moofoldermodel.c\
../moo/moofileview/moofoldermodel.h\
../moo/moofileview/moofoldermodel-private.h\
../moo/moofileview/moofolder-private.h\
../moo/moofileview/mooiconview.c\
../moo/moofileview/mooiconview.h\
../moo/moofileview/mootreeview.c\
../moo/moofileview/mootreeview.h\
../moo/mooutils/mooaccelbutton.c\
../moo/mooutils/mooaccelbutton.h\
../moo/mooutils/moowin32/ms/sys/time.h\
../moo/mooutils/moowin32/ms/unistd.h\
../moo/mooutils/mooaccel.c\
../moo/mooutils/mooaccel.h\
../moo/mooutils/mooaccelprefs.c\
../moo/mooutils/mooaccelprefs.h\
../moo/mooutils/mooactionbase.c\
../moo/mooutils/mooactionbase.h\
../moo/mooutils/mooactionbase-private.h\
../moo/mooutils/mooaction.c\
../moo/mooutils/mooactioncollection.c\
../moo/mooutils/mooactioncollection.h\
../moo/mooutils/mooactionfactory.c\
../moo/mooutils/mooactionfactory.h\
../moo/mooutils/mooactiongroup.c\
../moo/mooutils/mooactiongroup.h\
../moo/mooutils/mooaction.h\
../moo/mooutils/mooaction-private.h\
../moo/mooutils/mooappinput.c\
../moo/mooutils/mooappinput.h\
../moo/mooutils/mooapp-ipc.c\
../moo/mooutils/mooapp-ipc.h\
../moo/mooutils/mooarray.h\
../moo/mooutils/mooatom.h\
../moo/mooutils/moobigpaned.c\
../moo/mooutils/moobigpaned.h\
../moo/mooutils/mooclosure.c\
../moo/mooutils/mooclosure.h\
../moo/mooutils/moocombo.c\
../moo/mooutils/moocombo.h\
../moo/mooutils/moocompat.h\
../moo/mooutils/moodialogs.c\
../moo/mooutils/moodialogs.h\
../moo/mooutils/mooeditops.c\
../moo/mooutils/mooeditops.h\
../moo/mooutils/mooencodings.c\
../moo/mooutils/mooencodings-data.h\
../moo/mooutils/mooencodings.h\
../moo/mooutils/mooentry.c\
../moo/mooutils/mooentry.h\
../moo/mooutils/moo-environ.h\
../moo/mooutils/moofiledialog.c\
../moo/mooutils/moofiledialog.h\
../moo/mooutils/moofileicon.c\
../moo/mooutils/moofileicon.h\
../moo/mooutils/moofilewatch.c\
../moo/mooutils/moofilewatch.h\
../moo/mooutils/moofilewriter.c\
../moo/mooutils/moofilewriter.h\
../moo/mooutils/moofilewriter-private.h\
../moo/mooutils/moofiltermgr.c\
../moo/mooutils/moofiltermgr.h\
../moo/mooutils/moofontsel.c\
../moo/mooutils/moofontsel.h\
../moo/mooutils/mooglade.c\
../moo/mooutils/mooglade.h\
../moo/mooutils/moohelp.c\
../moo/mooutils/moohelp.h\
../moo/mooutils/moohistorycombo.c\
../moo/mooutils/moohistorycombo.h\
../moo/mooutils/moohistorylist.c\
../moo/mooutils/moohistorylist.h\
../moo/mooutils/moohistorymgr.c\
../moo/mooutils/moohistorymgr.h\
../moo/mooutils/mooi18n.c\
../moo/mooutils/mooi18n.h\
../moo/mooutils/moolist.h\
../moo/mooutils/moomarkup.c\
../moo/mooutils/moomarkup.h\
../moo/mooutils/moomenuaction.c\
../moo/mooutils/moomenuaction.h\
../moo/mooutils/moomenu.c\
../moo/mooutils/moomenu.h\
../moo/mooutils/moomenumgr.c\
../moo/mooutils/moomenumgr.h\
../moo/mooutils/moomenutoolbutton.c\
../moo/mooutils/moomenutoolbutton.h\
../moo/mooutils/moo-mime.c\
../moo/mooutils/moo-mime.h\
../moo/mooutils/moonotebook.c\
../moo/mooutils/moonotebook.h\
../moo/mooutils/mooonce.h\
../moo/mooutils/moopane.c\
../moo/mooutils/moopaned.c\
../moo/mooutils/moopaned.h\
../moo/mooutils/moopane.h\
../moo/mooutils/mooprefs.c\
../moo/mooutils/mooprefsdialog.c\
../moo/mooutils/mooprefsdialog.h\
../moo/mooutils/mooprefs.h\
../moo/mooutils/mooprefspage.c\
../moo/mooutils/mooprefspage.h\
../moo/mooutils/moospawn.c\
../moo/mooutils/moospawn.h\
../moo/mooutils/moostat.h\
../moo/mooutils/moostock.c\
../moo/mooutils/moostock.h\
../moo/mooutils/moo-test-macros.h\
../moo/mooutils/moo-test-utils.c\
../moo/mooutils/moo-test-utils.h\
../moo/mooutils/mootypedecl-macros.h\
../moo/mooutils/mootype-macros.h\
../moo/mooutils/moouixml.c\
../moo/mooutils/moouixml.h\
../moo/mooutils/mooundo.c\
../moo/mooutils/mooundo.h\
../moo/mooutils/mooutils-debug.h\
../moo/mooutils/mooutils-enums.c\
../moo/mooutils/mooutils-enums.h\
../moo/mooutils/mooutils-file.c\
../moo/mooutils/mooutils-file.h\
../moo/mooutils/mooutils-fs.c\
../moo/mooutils/mooutils-fs.h\
../moo/mooutils/mooutils-gobject.c\
../moo/mooutils/mooutils-gobject.h\
../moo/mooutils/mooutils-gobject-private.h\
../moo/mooutils/mooutils.h\
../moo/mooutils/mooutils-macros.h\
../moo/mooutils/mooutils-mem.h\
../moo/mooutils/mooutils-messages.h\
../moo/mooutils/mooutils-misc.c\
../moo/mooutils/mooutils-misc.h\
../moo/mooutils/mooutils-tests.h\
../moo/mooutils/mooutils-thread.c\
../moo/mooutils/mooutils-thread.h\
../moo/mooutils/mooutils-treeview.c\
../moo/mooutils/mooutils-treeview.h\
../moo/mooutils/mooutils-win32.c\
../moo/mooutils/moowin32/mingw/fnmatch.h\
../moo/mooutils/moowin32/mingw/netinet/in.h\
../moo/mooutils/moowin32/mingw/sys/mman.h\
../moo/mooutils/stock-select-all-16.h\
../moo/mooutils/moomenuaction.c\
../moo/mooutils/mooglade.h\
../moo/mooutils/moouixml.h\
../moo/mooutils/mooprefspage.c\
../moo/mooutils/moo-environ.h\
../moo/mooutils/stock-file-24.h\
../moo/mooutils/moofilewatch.h\
../moo/mooutils/mooutils-gobject.h\
../moo/mooutils/mooundo.c\
../moo/mooutils/mooaccel.h\
../moo/mooutils/moowin32/ms/sys/time.h\
../moo/mooutils/moowin32/ms/unistd.h\
../moo/mooutils/moowindow.c\
../moo/mooutils/moo-test-utils.c\
../moo/mooutils/mooutils-gobject-private.h\
../moo/mooutils/moohistorylist.c\
../moo/mooutils/mooutils-win32.c\
../moo/mooutils/moomenutoolbutton.h\
../moo/mooutils/moolist.h\
../moo/mooutils/moobigpaned.c\
../moo/mooutils/mooactioncollection.h\
../moo/mooutils/moospawn.c\
../moo/mooutils/mooapp-ipc.h\
../moo/mooutils/mooencodings-data.h\
../moo/mooutils/mooutils-fs.c\
../moo/mooutils/moomenuaction.h\
../moo/mooutils/moomenu.h\
../moo/mooutils/mooatom.h\
../moo/mooutils/mooactionbase.h\
../moo/mooutils/mooarray.h\
../moo/mooutils/moostock.c\
../moo/mooutils/moouixml.c\
../moo/mooutils/mooentry.c\
../moo/mooutils/moo-test-macros.h\
../moo/mooutils/moofileicon.h\
../moo/mooutils/mooencodings.h\
../moo/mooutils/moospawn.h\
../moo/mooutils/moonotebook.c\
../moo/mooutils/stock-file-selector-24.h\
../moo/mooutils/moofiledialog.h\
../moo/mooutils/moohistorymgr.c\
../moo/mooutils/mooactionbase.c\
../moo/mooutils/moofontsel.c\
../moo/mooutils/mooaccelprefs.h\
../moo/mooutils/mooprefspage.h\
../moo/mooutils/mooi18n.h\
../moo/mooutils/moofileicon.c\
../moo/mooutils/moomarkup.h\
../moo/mooutils/moowindow.h\
../moo/mooutils/moohistorycombo.h\
../moo/mooutils/moofiltermgr.c\
../moo/mooutils/mooutils-misc.c\
../moo/mooutils/mooutils-thread.h\
../moo/mooutils/moopane.h\
../moo/mooutils/moofilewatch.c\
../moo/mooutils/moofiledialog.c\
../moo/mooutils/moopane.c\
../moo/mooutils/moofilewriter.h\
../moo/mooutils/mooprefs.c\
../moo/mooutils/moohelp.c\
../moo/mooutils/moomenutoolbutton.c\
../moo/mooutils/mooutils-enums.h\
../moo/mooutils/moomenu.c\
../moo/mooutils/moostat.h\
../moo/mooutils/mooappinput.c\
../moo/mooutils/mootype-macros.h\
../moo/mooutils/mooutils-misc.h\
../moo/mooutils/mooutils-fs.h\
../moo/mooutils/mooactionfactory.h\
../moo/mooutils/moostock.h\
../moo/mooutils/mooutils-enums.c\
../moo/mooutils/stock-file-24.h\
../moo/mooutils/stock-file-selector-24.h\
../moo/mooutils/stock-select-all-16.h\
../moo/mooutils/stock-select-all-24.h\
../moo/mooutils/mooeditops.h\
../moo/mooutils/moohistorymgr.h\
../moo/mooutils/mooaccel.c\
../moo/mooutils/moofilewriter-private.h\
../moo/mooutils/moo-mime.c\
../moo/mooutils/moodialogs.c\
../moo/mooutils/mooutils-mem.h\
../moo/mooutils/mooutils-treeview.c\
../moo/mooutils/mootypedecl-macros.h\
../moo/mooutils/mooentry.h\
../moo/mooutils/moomenumgr.c\
../moo/mooutils/moocombo.c\
../moo/mooutils/mooaction.c\
../moo/mooutils/mooutils-debug.h\
../moo/mooutils/moodialogs.h\
../moo/mooutils/mooeditops.c\
../moo/mooutils/moopaned.h\
../moo/mooutils/moohistorycombo.c\
../moo/mooutils/mooaction.h\
../moo/mooutils/mooaction-private.h\
../moo/mooutils/mooapp-ipc.c\
../moo/mooutils/mooprefsdialog.c\
../moo/mooutils/mooutils-gobject.c\
../moo/mooutils/mooutils.h\
../moo/mooutils/moobigpaned.h\
../moo/mooutils/mooprefs.h\
../moo/mooutils/mooaccelbutton.c\
../moo/mooutils/moocombo.h\
../moo/mooutils/mooactionfactory.c\
../moo/mooutils/mooactioncollection.c\
../moo/mooutils/moofontsel.h\
../moo/mooutils/stock-terminal-24.h\
../moo/mooutils/mooutils-tests.h\
../moo/mooutils/moomenumgr.h\
../moo/mooutils/mooutils-thread.c\
../moo/mooutils/moohistorylist.h\
../moo/mooutils/mooclosure.h\
../moo/mooutils/moonotebook.h\
../moo/mooutils/mooi18n.c\
../moo/mooutils/mooglade.c\
../moo/mooutils/moo-test-utils.h\
../moo/mooutils/moofilewriter.c\
../moo/mooutils/mooactiongroup.c\
../moo/mooutils/moomarkup.c\
../moo/plugins/support/moocmdview.c\
../moo/plugins/support/moocmdview.h\
../moo/plugins/support/mooeditwindowoutput.c\
../moo/plugins/support/mooeditwindowoutput.h\
../moo/plugins/support/moolineview.c\
../moo/plugins/support/moolineview.h\
../moo/plugins/support/moooutputfilter.c\
../moo/plugins/support/moooutputfilter.h\
../moo/plugins/usertools/exe/moocommand-exe.c\
../moo/plugins/usertools/exe/moocommand-exe.h\
../moo/plugins/usertools/moocommanddisplay.h\
../moo/plugins/usertools/moousertools-enums.h\
../moo/plugins/usertools/moousertools-prefs.c\
../moo/plugins/usertools/mookeyfile.h\
../moo/plugins/usertools/lua/moocommand-lua.h\
../moo/plugins/usertools/moocommand-private.h\
../moo/plugins/usertools/moousertools-prefs.h\
../moo/plugins/usertools/moousertools.h\
../moo/plugins/usertools/moousertools-enums.c\
../moo/plugins/usertools/moocommand.c\
../moo/plugins/usertools/moocommanddisplay.c\
../moo/plugins/usertools/moocommanddisplay.h\
../moo/plugins/usertools/moocommand.h\
../moo/plugins/usertools/moocommand-private.h\
../moo/plugins/usertools/mookeyfile.c\
../moo/plugins/usertools/mookeyfile.h\
../moo/plugins/usertools/moooutputfilterregex.c\
../moo/plugins/usertools/moooutputfilterregex.h\
../moo/plugins/usertools/moousertools.c\
../moo/plugins/usertools/moooutputfilterregex.c\
../moo/plugins/usertools/moocommanddisplay.c\
../moo/plugins/usertools/mookeyfile.c\
../moo/plugins/usertools/moocommand.h\
../moo/plugins/support/moolineview.c\
../moo/plugins/support/moocmdview.c\
../moo/plugins/support/moooutputfilter.h\
../moo/plugins/support/mooeditwindowoutput.h\
../moo/plugins/support/moolineview.h\
../moo/plugins/support/moocmdview.h\
../moo/plugins/support/moooutputfilter.c\
../moo/plugins/support/mooeditwindowoutput.c
../moo/plugins/usertools/moousertools-enums.c\
../moo/plugins/usertools/moousertools-enums.h\
../moo/plugins/usertools/moousertools.h\
../moo/plugins/usertools/moousertools-prefs.c\
../moo/plugins/usertools/moousertools-prefs.h

View File

@ -7,16 +7,15 @@ src_texinfo_files = \
user-tools.texi \
regex.texi \
license.texi \
script.texi \
mooscript.texi
script.texi
medit.texi: medit.texi.in $(top_builddir)/config.status
$(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/medit.texi
$(AM_V_at)mv medit.texi $(srcdir)/medit.texi
mooscript.texi: $(top_srcdir)/moo/mooscript/mooscript-classes-impl.cpp $(top_srcdir)/moo/mooscript/gendoc.py
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/moo/mooscript/gendoc.py $(top_srcdir)/moo/mooscript/mooscript-classes-impl.cpp \
> mooscript.texi.tmp && mv mooscript.texi.tmp $(srcdir)/mooscript.texi
# mooscript.texi: $(top_srcdir)/moo/mooscript/mooscript-classes-impl.cpp $(top_srcdir)/moo/mooscript/gendoc.py
# $(AM_V_GEN)$(PYTHON) $(top_srcdir)/moo/mooscript/gendoc.py $(top_srcdir)/moo/mooscript/mooscript-classes-impl.cpp \
# > mooscript.texi.tmp && mv mooscript.texi.tmp $(srcdir)/mooscript.texi
help/index.html: $(src_texinfo_files)
$(AM_V_at)rm -f $(srcdir)/help/*.html

View File

@ -6,7 +6,6 @@
#define HELP_SECTION_DIALOG_FIND_FILE "index.html"
#define HELP_SECTION_DIALOG_FIND_IN_FILES "index.html"
#define HELP_SECTION_DIALOG_REPLACE "index.html"
#define HELP_SECTION_DOCUMENT "Document-object.html"
#define HELP_SECTION_EDITING_OPTIONS "Options-for-editing-text.html"
#define HELP_SECTION_FILE_SELECTOR "index.html"
#define HELP_SECTION_LICENSE_GPL "GNU-GPL.html"
@ -24,9 +23,6 @@
#define HELP_SECTION_PREFS_PLUGINS "index.html"
#define HELP_SECTION_REGEX "Regular-expressions.html"
#define HELP_SECTION_SCRIPT "Scripting.html"
#define HELP_SECTION_SCRIPT_APPLICATION "Application-object.html"
#define HELP_SECTION_SCRIPT_DOCUMENT_WINDOW "DocumentWindow-object.html"
#define HELP_SECTION_SCRIPT_EDITOR "Editor-object.html"
#define HELP_SECTION_USER_TOOLS "User_002ddefined-tools.html"
#define HELP_SECTION_USER_TOOLS_FILES "Storing-tools-in-files.html"
#define HELP_SECTION_USER_TOOLS_MANAGING "Managing-tools.html"

View File

@ -29,7 +29,7 @@ in @medit{}, can be found in this section.
@node Lua License
@section Lua License
@helpsection{LICENSE_LUA}
@verbatiminclude ../moo/mooscript/lua/COPYRIGHT
@verbatiminclude ../moo/moolua/lua/COPYRIGHT
@node LuaFileSystem License
@section LuaFileSystem License

View File

@ -13,12 +13,3 @@
@macro null{}
@code{null}
@end macro
@menu
* Application object:: Application object
* Editor object:: Editor object
* DocumentWindow object:: DocumentWindow object
* Document object:: Document object
@end menu
@include mooscript.texi

View File

@ -33,7 +33,7 @@ include gtksourceview/Makefile.incl
include mooedit/Makefile.incl
include eggsmclient/Makefile.incl
include mooapp/Makefile.incl
include mooscript/Makefile.incl
include moolua/Makefile.incl
include moopython/Makefile.incl
include plugins/Makefile.incl
include medit-app/Makefile.incl

View File

@ -6,6 +6,7 @@ BOOL:OBJECT,BOOLEAN
BOOL:OBJECT,BOXED
BOOL:OBJECT,BOXED,BOXED
BOOL:OBJECT,OBJECT
BOOL:OBJECT,OBJECT,STRING
BOOL:STRING
BOOL:STRING,OBJECT,OBJECT,INT,INT,POINTER,UINT,UINT
BOOL:STRING,OBJECT,OBJECT,INT,INT,UINT

View File

@ -5,7 +5,7 @@ require("medit")
require("_moo_utils")
app = medit.get_app_obj()
editor = app.editor()
editor = app.get_editor()
local __docs_to_cleanup = {}
local function add_doc_to_cleanup(doc)
@ -18,45 +18,45 @@ local function cleanup()
end
local function test_active_window()
w1 = editor.active_window()
tassert(w1 ~= nil, 'editor.active_window() ~= nil')
w1 = editor.get_active_window()
tassert(w1 ~= nil, 'editor.get_active_window() ~= nil')
tassert(w1 == w1, 'w1 == w1')
tassert(#editor.windows() == 1, 'one window')
tassert(#editor.get_windows() == 1, 'one window')
w2 = editor.new_window()
tassert(w2 ~= nil, 'editor.new_window() ~= nil')
tassert(w1 ~= w2, 'old window != new window')
tassert(#editor.windows() == 2, 'two window')
tassert(#editor.get_windows() == 2, 'two window')
editor.set_active_window(w2)
_moo_utils.spin_main_loop(0.1)
tassert(w2 == editor.active_window(), 'w2 == editor.active_window()')
tassert(w2 == editor.get_active_window(), 'w2 == editor.get_active_window()')
editor.set_active_window(w1)
_moo_utils.spin_main_loop(0.1)
tassert(w1 == editor.active_window(), 'w1 == editor.active_window()')
tassert(w1 == editor.get_active_window(), 'w1 == editor.get_active_window()')
editor.close_window(w1)
tassert(#editor.windows() == 1, 'two window')
tassert(w2 == editor.active_window(), 'w2 == editor.active_window()')
tassert(#editor.get_windows() == 1, 'two window')
tassert(w2 == editor.get_active_window(), 'w2 == editor.get_active_window()')
end
local function test_selection()
doc = editor.new_document()
doc = editor.new_doc()
add_doc_to_cleanup(doc)
tassert(doc.text() == '')
tassert(doc.start_pos() == 1)
tassert(doc.end_pos() == 1)
tassert(doc.get_text() == '')
tassert(doc.get_start_pos() == 1)
tassert(doc.get_end_pos() == 1)
tassert(doc.text(1, 1) == '')
doc.insert_text('a')
doc.insert_text(1, 'b')
tassert(doc.text() == 'ba')
tassert(doc.start_pos() == 1)
tassert(doc.end_pos() == 3)
tassert(doc.get_text() == 'ba')
tassert(doc.get_start_pos() == 1)
tassert(doc.get_end_pos() == 3)
tassert(doc.text(1, 2) == 'b')
text = [[abcdefg
abcdefghij
1234567890
]]
doc.replace_text(doc.start_pos(), doc.end_pos(), text)
tassert(doc.start_pos() == 1)
tassert(doc.end_pos() == #text + 1)
doc.replace_text(doc.get_start_pos(), doc.get_end_pos(), text)
tassert(doc.get_start_pos() == 1)
tassert(doc.get_end_pos() == #text + 1)
doc.select_text(2, 3)
tassert(doc.selected_text() == 'b')
doc.select_text({3, 4})
@ -66,5 +66,5 @@ abcdefghij
end
test_active_window()
test_selection()
-- test_selection()
cleanup()

View File

@ -521,7 +521,8 @@ static gboolean
unit_test_func (void)
{
MooTestOptions opts = 0;
unit_tests_main (opts, medit_opts.ut_tests, medit_opts.ut_dir);
int status = unit_tests_main (opts, medit_opts.ut_tests, medit_opts.ut_dir);
moo_app_set_exit_status (moo_app_get_instance (), status);
moo_app_quit (moo_app_get_instance ());
return FALSE;
}
@ -547,8 +548,7 @@ medit_main (int argc, char *argv[])
const char *name = NULL;
char pid_buf[32];
GOptionContext *ctx;
MooAppFileInfo *files;
int n_files;
MooEditOpenInfoArray *files;
init_mem_stuff ();
g_thread_init (NULL);
@ -609,11 +609,11 @@ medit_main (int argc, char *argv[])
exit (0);
}
parse_files (&files, &n_files);
files = parse_files ();
if (name)
{
if (moo_app_send_files (files, n_files, stamp, name))
if (moo_app_send_files (files, stamp, name))
exit (0);
if (!medit_opts.instance_name)
@ -624,7 +624,7 @@ medit_main (int argc, char *argv[])
}
if (!new_instance && !medit_opts.instance_name &&
moo_app_send_files (files, n_files, stamp, NULL))
moo_app_send_files (files, stamp, NULL))
{
notify_startup_complete ();
exit (0);
@ -677,9 +677,9 @@ medit_main (int argc, char *argv[])
moo_editor_new_window (editor);
if (files)
moo_app_open_files (app, files, n_files, stamp);
moo_app_open_files (app, files, stamp);
free_files (files, n_files);
moo_edit_open_info_array_free (files);
g_option_context_free (ctx);
if (medit_opts.ut)

View File

@ -1,12 +1,14 @@
#include <errno.h>
#include <mooedit/mooeditfileinfo.h>
static gboolean
parse_filename (const char *filename,
MooAppFileInfo *file)
static MooEditOpenInfo *
parse_filename (const char *filename)
{
char *freeme2 = NULL;
char *freeme1 = NULL;
char *uri;
int line = -1;
MooEditOpenInfo *info;
freeme1 = _moo_normalize_file_path (filename);
filename = freeme1;
@ -19,7 +21,7 @@ parse_filename (const char *filename,
{
g_free (freeme1);
g_free (freeme2);
return FALSE;
return NULL;
}
if (g_utf8_validate (filename, -1, NULL))
@ -39,21 +41,21 @@ parse_filename (const char *filename,
if (g_regex_match (re, filename, 0, &match_info))
{
char *path = g_match_info_fetch_named (match_info, "path");
char *line = g_match_info_fetch_named (match_info, "line");
char *line_string = g_match_info_fetch_named (match_info, "line");
if (path && *path)
{
filename = path;
freeme2 = path;
path = NULL;
if (line && *line)
if (line_string && *line_string)
{
errno = 0;
file->line = strtol (line, NULL, 10);
line = strtol (line_string, NULL, 10);
if (errno)
file->line = 0;
line = -1;
}
}
g_free (line);
g_free (line_string);
g_free (path);
}
@ -67,20 +69,22 @@ parse_filename (const char *filename,
g_critical ("could not convert filename to URI");
g_free (freeme1);
g_free (freeme2);
return FALSE;
return NULL;
}
g_free (file->uri);
file->uri = uri;
info = moo_edit_open_info_new_uri (uri, NULL);
info->line = line;
g_free (uri);
g_free (freeme1);
g_free (freeme2);
return TRUE;
return info;
}
static void
parse_options_from_uri (const char *optstring,
MooAppFileInfo *file)
parse_options_from_uri (const char *optstring,
MooEditOpenInfo *info)
{
char **p, **comps;
@ -91,7 +95,7 @@ parse_options_from_uri (const char *optstring,
if (!strncmp (*p, "line=", strlen ("line=")))
{
/* doesn't matter if there is an error */
file->line = strtoul (*p + strlen ("line="), NULL, 10);
info->line = strtoul (*p + strlen ("line="), NULL, 10) - 1;
}
else if (!strncmp (*p, "options=", strlen ("options=")))
{
@ -100,9 +104,9 @@ parse_options_from_uri (const char *optstring,
for (op = opts; op && *op; ++op)
{
if (!strcmp (*op, "new-window"))
file->options |= MOO_EDIT_OPEN_NEW_WINDOW;
info->flags |= MOO_EDIT_OPEN_NEW_WINDOW;
else if (!strcmp (*op, "new-tab"))
file->options |= MOO_EDIT_OPEN_NEW_TAB;
info->flags |= MOO_EDIT_OPEN_NEW_TAB;
}
g_strfreev (opts);
}
@ -111,36 +115,37 @@ parse_options_from_uri (const char *optstring,
g_strfreev (comps);
}
static gboolean
parse_uri (const char *scheme,
const char *uri,
MooAppFileInfo *file)
static MooEditOpenInfo *
parse_uri (const char *scheme,
const char *uri)
{
const char *question_mark;
const char *optstring = NULL;
MooEditOpenInfo *info;
char *real_uri;
if (strcmp (scheme, "file") != 0)
{
file->uri = g_strdup (uri);
return TRUE;
}
return moo_edit_open_info_new_uri (uri, NULL);
question_mark = strchr (uri, '?');
if (question_mark && question_mark > uri)
{
file->uri = g_strndup (uri, question_mark - uri);
real_uri = g_strndup (uri, question_mark - uri);
optstring = question_mark + 1;
}
else
{
file->uri = g_strdup (uri);
real_uri = g_strdup (uri);
}
if (optstring)
parse_options_from_uri (optstring, file);
info = moo_edit_open_info_new_uri (real_uri, NULL);
return TRUE;
if (optstring)
parse_options_from_uri (optstring, info);
g_free (real_uri);
return info;
}
static char *
@ -166,21 +171,20 @@ parse_uri_scheme (const char *string)
return NULL;
}
static gboolean
parse_file (const char *string,
MooAppFileInfo *file,
char **current_dir)
static MooEditOpenInfo *
parse_file (const char *string,
char **current_dir)
{
char *uri_scheme;
char *filename;
gboolean ret;
MooEditOpenInfo *ret;
if (g_path_is_absolute (string))
return parse_filename (string, file);
return parse_filename (string);
if ((uri_scheme = parse_uri_scheme (string)))
{
ret = parse_uri (uri_scheme, string, file);
ret = parse_uri (uri_scheme, string);
g_free (uri_scheme);
return ret;
}
@ -189,63 +193,50 @@ parse_file (const char *string,
*current_dir = g_get_current_dir ();
filename = g_build_filename (*current_dir, string, NULL);
ret = parse_filename (filename, file);
ret = parse_filename (filename);
g_free (filename);
return ret;
}
static void
parse_files (MooAppFileInfo **files,
int *n_files)
static MooEditOpenInfoArray *
parse_files (void)
{
int i;
int count;
int n_files;
char *current_dir = NULL;
MooEditOpenInfoArray *files;
*files = NULL;
*n_files = 0;
if (!medit_opts.files || !(n_files = g_strv_length (medit_opts.files)))
return NULL;
if (!medit_opts.files || !(*n_files = g_strv_length (medit_opts.files)))
return;
*files = g_new0 (MooAppFileInfo, *n_files);
for (i = 0, count = 0; i < *n_files; ++i)
{
if (i == 0)
{
if (medit_opts.new_window)
(*files)[i].options |= MOO_EDIT_OPEN_NEW_WINDOW;
if (medit_opts.new_tab)
(*files)[i].options |= MOO_EDIT_OPEN_NEW_TAB;
if (medit_opts.reload)
(*files)[i].options |= MOO_EDIT_OPEN_RELOAD;
(*files)[i].line = medit_opts.line;
if (medit_opts.encoding && medit_opts.encoding[0])
(*files)[i].encoding = g_strdup (medit_opts.encoding);
}
if (parse_file (medit_opts.files[i], *files + count, &current_dir))
count++;
}
*n_files = count;
g_free (current_dir);
}
static void
free_files (MooAppFileInfo *files,
int n_files)
{
int i;
files = moo_edit_open_info_array_new ();
for (i = 0; i < n_files; ++i)
{
g_free (files[i].uri);
g_free (files[i].encoding);
MooEditOpenInfo *info;
info = parse_file (medit_opts.files[i], &current_dir);
if (!info)
continue;
if (medit_opts.new_window)
info->flags |= MOO_EDIT_OPEN_NEW_WINDOW;
if (medit_opts.new_tab)
info->flags |= MOO_EDIT_OPEN_NEW_TAB;
if (medit_opts.reload)
info->flags |= MOO_EDIT_OPEN_RELOAD;
if (info->line < 0)
info->line = medit_opts.line - 1;
if (!info->encoding && medit_opts.encoding && medit_opts.encoding[0])
info->encoding = g_strdup (medit_opts.encoding);
moo_edit_open_info_array_take (files, info);
}
g_free (files);
g_free (current_dir);
return files;
}

View File

@ -1,5 +1,5 @@
#include <mooedit/mooeditor-tests.h>
#include <mooscript/lua/moolua-tests.h>
#include <moolua/moolua-tests.h>
#include <mooutils/mooutils-tests.h>
#include <gtk/gtk.h>
#include <stdio.h>

View File

@ -13,6 +13,10 @@
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* class:MooApp: (parent GObject)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -24,10 +28,11 @@
#include "mooapp-accels.h"
#include "mooapp-info.h"
#include "mooappabout.h"
#include "mooscript/lua/moolua.h"
#include "moolua/medit-lua.h"
#include "mooedit/mooeditprefs.h"
#include "mooedit/mooeditor.h"
#include "mooedit/mooplugin.h"
#include "mooedit/mooeditfileinfo.h"
#include "mooutils/mooprefsdialog.h"
#include "marshals.h"
#include "mooutils/mooappinput.h"
@ -85,6 +90,7 @@ struct _MooAppPrivate {
gboolean running;
gboolean in_try_quit;
int exit_status;
int use_session;
EggSMClient *sm_client;
@ -541,6 +547,9 @@ moo_app_run_script (MooApp *app,
// }
/**
* moo_app_get_editor:
*/
MooEditor *
moo_app_get_editor (MooApp *app)
{
@ -827,7 +836,16 @@ moo_app_run_real (MooApp *app)
gtk_main ();
return 0;
return app->priv->exit_status;
}
void
moo_app_set_exit_status (MooApp *app,
int value)
{
moo_return_if_fail (MOO_IS_APP (app));
app->priv->exit_status = value;
}
@ -840,7 +858,7 @@ moo_app_try_quit_real (MooApp *app)
moo_app_save_session (app);
#ifdef MOO_BUILD_EDIT
if (!moo_editor_close_all (app->priv->editor, TRUE, TRUE))
if (!_moo_editor_close_all (app->priv->editor, TRUE, TRUE))
return TRUE;
#endif /* MOO_BUILD_EDIT */
@ -881,7 +899,7 @@ moo_app_quit_real (MooApp *app)
app->priv->sm_client = NULL;
#ifdef MOO_BUILD_EDIT
moo_editor_close_all (app->priv->editor, FALSE, FALSE);
_moo_editor_close_all (app->priv->editor, FALSE, FALSE);
moo_plugin_shutdown ();
@ -1270,16 +1288,13 @@ moo_app_load_session (MooApp *app)
// }
void
moo_app_open_files (MooApp *app,
MooAppFileInfo *files,
int n_files,
guint32 stamp)
moo_app_open_files (MooApp *app,
MooEditOpenInfoArray *files,
guint32 stamp)
{
int i;
g_return_if_fail (MOO_IS_APP (app));
if (!n_files)
if (moo_edit_open_info_array_is_empty (files))
{
MooEdit *doc;
@ -1291,13 +1306,7 @@ moo_app_open_files (MooApp *app,
return;
}
for (i = 0; i < n_files; ++i)
_moo_editor_open_uri (app->priv->editor,
files[i].uri,
files[i].encoding,
files[i].line,
files[i].options);
moo_editor_open_files (app->priv->editor, files, NULL, NULL);
moo_editor_present (app->priv->editor, stamp);
}
@ -1473,17 +1482,15 @@ moo_app_save_prefs (MooApp *app)
#define MOO_APP_CMD_VERSION "1.0"
static gboolean
static MooEditOpenInfoArray *
moo_app_parse_files (const char *data,
guint32 *stamp,
MooAppFileInfo **filesp,
int *n_files)
guint32 *stamp)
{
GArray *files = NULL;
MooMarkupDoc *xml;
MooMarkupNode *root;
MooMarkupNode *node;
const char *version;
MooEditOpenInfoArray *files;
xml = moo_markup_parse_memory (data, -1, NULL);
g_return_val_if_fail (xml != NULL, FALSE);
@ -1494,16 +1501,18 @@ moo_app_parse_files (const char *data,
{
g_warning ("%s: invalid markup", G_STRFUNC);
moo_markup_doc_unref (xml);
return FALSE;
return NULL;
}
*stamp = moo_markup_uint_prop (root, "stamp", 0);
files = moo_edit_open_info_array_new ();
for (node = root->children; node != NULL; node = node->next)
{
const char *uri;
const char *encoding;
MooAppFileInfo file = {0};
MooEditOpenInfo *info;
int line;
if (!MOO_MARKUP_IS_ELEMENT (node))
continue;
@ -1516,53 +1525,43 @@ moo_app_parse_files (const char *data,
continue;
}
file.uri = g_strdup (uri);
encoding = moo_markup_get_prop (node, "encoding");
if (encoding && encoding[0])
file.encoding = g_strdup (encoding);
if (!encoding || !encoding[0])
encoding = NULL;
info = moo_edit_open_info_new_uri (uri, encoding);
line = moo_markup_int_prop (node, "line", 0);
if (line > 0)
info->line = line - 1;
file.line = moo_markup_int_prop (node, "line", 0);
if (moo_markup_bool_prop (node, "new-window", FALSE))
file.options |= MOO_EDIT_OPEN_NEW_WINDOW;
info->flags |= MOO_EDIT_OPEN_NEW_WINDOW;
if (moo_markup_bool_prop (node, "new-tab", FALSE))
file.options |= MOO_EDIT_OPEN_NEW_TAB;
info->flags |= MOO_EDIT_OPEN_NEW_TAB;
if (moo_markup_bool_prop (node, "reload", FALSE))
file.options |= MOO_EDIT_OPEN_RELOAD;
info->flags |= MOO_EDIT_OPEN_RELOAD;
if (!files)
files = g_array_new (FALSE, FALSE, sizeof (MooAppFileInfo));
g_array_append_val (files, file);
}
if (files)
{
*n_files = files->len;
*filesp = (MooAppFileInfo *) g_array_free (files, FALSE);
moo_edit_open_info_array_take (files, info);
}
moo_markup_doc_unref (xml);
return TRUE;
return files;
}
static void
moo_app_cmd_open_files (MooApp *app,
const char *data)
{
MooAppFileInfo *files = NULL;
int n_files = 0;
int i;
MooEditOpenInfoArray *files;
guint32 stamp;
if (moo_app_parse_files (data, &stamp, &files, &n_files))
moo_app_open_files (app, files, n_files, stamp);
files = moo_app_parse_files (data, &stamp);
for (i = 0; i < n_files; ++i)
{
g_free (files[i].uri);
g_free (files[i].encoding);
}
if (!moo_edit_open_info_array_is_empty (files))
moo_app_open_files (app, files, stamp);
g_free (files);
moo_edit_open_info_array_free (files);
}
G_GNUC_PRINTF(2, 3) static void
@ -1581,14 +1580,13 @@ append_escaped (GString *str, const char *format, ...)
}
gboolean
moo_app_send_files (MooAppFileInfo *files,
int n_files,
guint32 stamp,
const char *pid)
moo_app_send_files (MooEditOpenInfoArray *files,
guint32 stamp,
const char *pid)
{
gboolean result;
GString *msg;
int i;
int i, c;
#if 0
_moo_message ("moo_app_send_files: got %d files to pid %s",
@ -1599,20 +1597,27 @@ moo_app_send_files (MooAppFileInfo *files,
g_string_append_printf (msg, "%s<moo-app-open-files version=\"%s\" stamp=\"%u\">",
CMD_OPEN_FILES_S, MOO_APP_CMD_VERSION, stamp);
for (i = 0; i < n_files; ++i)
for (i = 0, c = moo_edit_open_info_array_get_size (files); i < c; ++i)
{
MooEditOpenInfo *info = files->elms[i];
char *uri;
g_string_append (msg, "<file");
if (files[i].encoding)
g_string_append_printf (msg, " encoding=\"%s\"", files[i].encoding);
if (files[i].line)
g_string_append_printf (msg, " line=\"%u\"", (guint) files[i].line);
if (files[i].options & MOO_EDIT_OPEN_NEW_WINDOW)
if (info->encoding)
g_string_append_printf (msg, " encoding=\"%s\"", info->encoding);
if (info->line >= 0)
g_string_append_printf (msg, " line=\"%u\"", (guint) info->line + 1);
if (info->flags & MOO_EDIT_OPEN_NEW_WINDOW)
g_string_append_printf (msg, " new-window=\"true\"");
if (files[i].options & MOO_EDIT_OPEN_NEW_TAB)
if (info->flags & MOO_EDIT_OPEN_NEW_TAB)
g_string_append_printf (msg, " new-tab=\"true\"");
if (files[i].options & MOO_EDIT_OPEN_RELOAD)
if (info->flags & MOO_EDIT_OPEN_RELOAD)
g_string_append_printf (msg, " reload=\"true\"");
append_escaped (msg, ">%s</file>", files[i].uri);
uri = g_file_get_uri (info->file);
append_escaped (msg, ">%s</file>", uri);
g_free (uri);
}
g_string_append (msg, "</moo-app-open-files>");

View File

@ -64,44 +64,38 @@ GType moo_app_get_type (void) G_GNUC_CONST;
MooApp *moo_app_get_instance (void);
gboolean moo_app_init (MooApp *app);
int moo_app_run (MooApp *app);
gboolean moo_app_quit (MooApp *app);
gboolean moo_app_init (MooApp *app);
int moo_app_run (MooApp *app);
gboolean moo_app_quit (MooApp *app);
void moo_app_load_session (MooApp *app);
void moo_app_set_exit_status (MooApp *app,
int value);
MooEditor *moo_app_get_editor (MooApp *app);
void moo_app_load_session (MooApp *app);
void moo_app_prefs_dialog (GtkWidget *parent);
void moo_app_about_dialog (GtkWidget *parent);
MooEditor *moo_app_get_editor (MooApp *app);
char *moo_app_get_system_info (MooApp *app);
void moo_app_prefs_dialog (GtkWidget *parent);
void moo_app_about_dialog (GtkWidget *parent);
MooUiXml *moo_app_get_ui_xml (MooApp *app);
void moo_app_set_ui_xml (MooApp *app,
MooUiXml *xml);
char *moo_app_get_system_info (MooApp *app);
gboolean moo_app_send_msg (const char *pid,
const char *data,
int len);
MooUiXml *moo_app_get_ui_xml (MooApp *app);
void moo_app_set_ui_xml (MooApp *app,
MooUiXml *xml);
typedef struct {
char *uri;
char *encoding;
guint line : 24; /* 0 means unset */
guint options : 7;
} MooAppFileInfo;
gboolean moo_app_send_msg (const char *pid,
const char *data,
int len);
gboolean moo_app_send_files (MooAppFileInfo *files,
int n_files,
guint32 stamp,
const char *pid);
void moo_app_open_files (MooApp *app,
MooAppFileInfo *files,
int n_files,
guint32 stamp);
void moo_app_run_script (MooApp *app,
const char *script);
gboolean moo_app_send_files (MooEditOpenInfoArray *files,
guint32 stamp,
const char *pid);
void moo_app_open_files (MooApp *app,
MooEditOpenInfoArray *files,
guint32 stamp);
void moo_app_run_script (MooApp *app,
const char *script);
G_END_DECLS

View File

@ -21,13 +21,8 @@ moo_sources += \
mooedit/mooedithistoryitem.c \
mooedit/mooedithistoryitem.h \
mooedit/mooedit-impl.h \
mooedit/mooeditor.c \
mooedit/mooeditor.h \
mooedit/mooeditor-impl.h \
mooedit/mooeditor-private.h \
mooedit/mooeditor-tests.c \
mooedit/mooeditor-tests.h \
mooedit/mooeditor-tests.h \
mooedit/mooedit-script.c \
mooedit/mooedit-script.h \
mooedit/mooeditprefs.c \
mooedit/mooeditprefs.h \
mooedit/mooeditprefspage.c \
@ -36,8 +31,8 @@ moo_sources += \
mooedit/mooeditwindow.c \
mooedit/mooeditwindow.h \
mooedit/mooeditwindow-impl.h \
mooedit/moofileenc.c \
mooedit/moofileenc.h \
mooedit/mooeditfileinfo.c \
mooedit/mooeditfileinfo.h \
mooedit/moofold.c \
mooedit/moofold.h \
mooedit/mooindenter.c \
@ -78,7 +73,14 @@ moo_sources += \
mooedit/mootextview.c \
mooedit/mootextview.h \
mooedit/mootextview-input.c \
mooedit/mootextview-private.h
mooedit/mootextview-private.h \
mooedit/mooeditor.c \
mooedit/mooeditor.h \
mooedit/mooeditor-impl.h \
mooedit/mooeditor-private.h \
mooedit/mooeditor-tests.c \
mooedit/mooeditor-tests.h \
mooedit/mooeditor-tests.h
EXTRA_DIST += \
mooedit/glade/mooprintpreview.glade \

View File

@ -97,6 +97,17 @@ normalize_encoding (const char *encoding,
}
gboolean
_moo_edit_file_is_new (GFile *file)
{
char *filename;
moo_return_val_if_fail (G_IS_FILE (file), FALSE);
filename = g_file_get_path (file);
moo_return_val_if_fail (filename != NULL, FALSE);
return !g_file_test (filename, G_FILE_TEST_EXISTS);
}
gboolean
_moo_edit_load_file (MooEdit *edit,
GFile *file,
@ -1233,6 +1244,34 @@ char *_moo_edit_normalize_uri_for_comparison (const char *uri)
return _moo_edit_normalize_filename_for_comparison (uri);
}
char *
_moo_file_get_normalized_name (GFile *file)
{
char *ret;
char *tmp = NULL;
char *tmp2 = NULL;
moo_return_val_if_fail (G_IS_FILE (file), NULL);
tmp = g_file_get_path (file);
if (tmp)
{
tmp2 = _moo_normalize_file_path (tmp);
ret = _moo_edit_normalize_filename_for_comparison (tmp2);
}
else
{
tmp = g_file_get_uri (file);
moo_return_val_if_fail (tmp != NULL, NULL);
ret = _moo_edit_normalize_uri_for_comparison (tmp);
}
g_free (tmp2);
g_free (tmp);
return ret;
}
void
_moo_edit_set_file (MooEdit *edit,
GFile *file,
@ -1244,7 +1283,7 @@ _moo_edit_set_file (MooEdit *edit,
tmp = edit->priv->file;
free_list = g_slist_prepend (free_list, edit->priv->filename);
free_list = g_slist_prepend (free_list, edit->priv->norm_filename);
free_list = g_slist_prepend (free_list, edit->priv->norm_name);
free_list = g_slist_prepend (free_list, edit->priv->display_filename);
free_list = g_slist_prepend (free_list, edit->priv->display_basename);
@ -1257,7 +1296,7 @@ _moo_edit_set_file (MooEdit *edit,
edit->priv->file = NULL;
edit->priv->filename = NULL;
edit->priv->norm_filename = NULL;
edit->priv->norm_name = NULL;
if (n == 1)
edit->priv->display_filename = g_strdup (_("Untitled"));
@ -1268,18 +1307,13 @@ _moo_edit_set_file (MooEdit *edit,
}
else
{
char *norm_name_tmp;
remove_untitled (NULL, edit);
edit->priv->file = g_file_dup (file);
edit->priv->filename = g_file_get_path (file);
norm_name_tmp = _moo_normalize_file_path (edit->priv->filename);
edit->priv->norm_filename = _moo_edit_normalize_filename_for_comparison (norm_name_tmp);
free_list = g_slist_prepend (free_list, norm_name_tmp);
edit->priv->norm_name = _moo_file_get_normalized_name (file);
edit->priv->display_filename = moo_file_get_display_name (file);
edit->priv->display_basename = moo_file_get_display_basename (file);
// _moo_edit_normalize_filename_for_comparison (_moo_normalize_file_path (edit->priv->filename));
}
if (!encoding)

View File

@ -33,14 +33,17 @@ typedef enum {
} MooEditSaveFlags;
#define MOO_EDIT_FILE_ERROR (_moo_edit_file_error_quark ())
enum {
MOO_EDIT_FILE_ERROR_ENCODING,
MOO_EDIT_FILE_ERROR_ENCODING = 1,
MOO_EDIT_FILE_ERROR_FAILED,
MOO_EDIT_FILE_ERROR_NOT_IMPLEMENTED
MOO_EDIT_FILE_ERROR_NOT_IMPLEMENTED,
MOO_EDIT_FILE_ERROR_NOENT
};
GQuark _moo_edit_file_error_quark (void) G_GNUC_CONST;
gboolean _moo_edit_file_is_new (GFile *file);
gboolean _moo_edit_load_file (MooEdit *edit,
GFile *file,
const char *encoding,

View File

@ -26,29 +26,41 @@ G_BEGIN_DECLS
extern MooEditList *_moo_edit_instances;
void _moo_edit_add_class_actions (MooEdit *edit);
void _moo_edit_check_actions (MooEdit *edit);
void _moo_edit_class_init_actions (MooEditClass *klass);
char *_moo_file_get_normalized_name (GFile *file);
char *_moo_edit_get_normalized_name (MooEdit *edit);
void _moo_edit_status_changed (MooEdit *edit);
char *_moo_edit_get_utf8_filename (MooEdit *edit);
void _moo_edit_do_popup (MooEdit *edit,
GdkEventButton *event);
void _moo_edit_add_class_actions (MooEdit *edit);
void _moo_edit_check_actions (MooEdit *edit);
void _moo_edit_class_init_actions (MooEditClass *klass);
gboolean _moo_edit_has_comments (MooEdit *edit,
gboolean *single_line,
gboolean *multi_line);
void _moo_edit_status_changed (MooEdit *edit);
void _moo_edit_do_popup (MooEdit *edit,
GdkEventButton *event);
gboolean _moo_edit_has_comments (MooEdit *edit,
gboolean *single_line,
gboolean *multi_line);
void _moo_edit_comment (MooEdit *edit);
void _moo_edit_uncomment (MooEdit *edit);
void _moo_edit_ui_set_line_wrap_mode (MooEdit *edit,
gboolean enabled);
void _moo_edit_ui_set_show_line_numbers (MooEdit *edit,
gboolean show);
#define MOO_EDIT_GOTO_BOOKMARK_ACTION "GoToBookmark"
void _moo_edit_delete_bookmarks (MooEdit *edit,
gboolean in_destroy);
void _moo_edit_line_mark_moved (MooEdit *edit,
MooLineMark *mark);
void _moo_edit_line_mark_deleted (MooEdit *edit,
MooLineMark *mark);
gboolean _moo_edit_line_mark_clicked (MooTextView *view,
int line);
void _moo_edit_update_bookmarks_style(MooEdit *edit);
void _moo_edit_delete_bookmarks (MooEdit *edit,
gboolean in_destroy);
void _moo_edit_line_mark_moved (MooEdit *edit,
MooLineMark *mark);
void _moo_edit_line_mark_deleted (MooEdit *edit,
MooLineMark *mark);
gboolean _moo_edit_line_mark_clicked (MooTextView *view,
int line);
void _moo_edit_update_bookmarks_style (MooEdit *edit);
/***********************************************************************/
/* Preferences

View File

@ -26,7 +26,7 @@ G_BEGIN_DECLS
#define MOO_EDIT_IS_UNTITLED(edit) (!(edit)->priv->file)
struct _MooEditPrivate {
struct MooEditPrivate {
MooEditor *editor;
gulong modified_changed_handler_id;
@ -37,7 +37,7 @@ struct _MooEditPrivate {
*/
GFile *file;
char *filename;
char *norm_filename;
char *norm_name;
char *display_filename;
char *display_basename;

View File

@ -0,0 +1,263 @@
#include "mooedit-script.h"
#include "mooutils/mooutils.h"
static GtkTextBuffer *
get_buffer (MooEdit *doc)
{
return gtk_text_view_get_buffer (GTK_TEXT_VIEW (doc));
}
static void
get_selected_lines_bounds (GtkTextBuffer *buf,
GtkTextIter *start,
GtkTextIter *end,
gboolean *cursor_at_next_line)
{
if (cursor_at_next_line)
*cursor_at_next_line = FALSE;
gtk_text_buffer_get_selection_bounds (buf, start, end);
gtk_text_iter_set_line_offset (start, 0);
if (gtk_text_iter_starts_line (end) && !gtk_text_iter_equal (start, end))
{
gtk_text_iter_backward_line (end);
if (cursor_at_next_line)
*cursor_at_next_line = TRUE;
}
if (!gtk_text_iter_ends_line (end))
gtk_text_iter_forward_to_line_end (end);
}
/**
* moo_edit_get_selected_lines:
*
* Returns selected lines as a list of strings, one string for each line,
* line terminator characters not included. If nothing is selected, then
* line at cursor is returned.
*
* Returns: (type strv)
**/
char **
moo_edit_get_selected_lines (MooEdit *doc)
{
GtkTextIter start, end;
GtkTextBuffer *buf;
char *text;
char **lines;
moo_return_val_if_fail (MOO_IS_EDIT (doc), NULL);
buf = get_buffer (doc);
get_selected_lines_bounds (buf, &start, &end, NULL);
text = gtk_text_buffer_get_slice (buf, &start, &end, TRUE);
lines = moo_splitlines (text);
g_free (text);
return lines;
}
static char *
join_lines (char **strv)
{
char **p;
GString *string = g_string_new (NULL);
for (p = strv; p && *p; ++p)
{
if (p != strv)
g_string_append_c (string, '\n');
g_string_append (string, *p);
}
return g_string_free (string, FALSE);
}
/**
* moo_edit_replace_selected_lines:
*
* @doc:
* @replacement: (type strv)
*
* replace selected lines with %param{replacement}. Similar to
* %method{replace_selected_text()}, but selection is extended to include
* whole lines. If nothing is selected, then line at cursor is replaced.
**/
void
moo_edit_replace_selected_lines (MooEdit *doc,
char **replacement)
{
// switch (repl.vt())
// {
// case VtString:
// text = repl.value<VtString>();
// break;
// case VtArray:
// {
// moo::Vector<String> lines = get_string_list(repl);
// text = join(lines, "\n");
// }
// break;
// case VtArgList:
// {
// moo::Vector<String> lines = get_string_list(repl);
// text = join(lines, "\n");
// }
// break;
// default:
// Error::raisef("string or list of strings expected, got %s",
// get_argument_type_name(repl.vt()));
// break;
// }
GtkTextBuffer *buf;
GtkTextIter start, end;
gboolean cursor_at_next_line;
moo_return_if_fail (MOO_IS_EDIT (doc));
buf = get_buffer (doc);
get_selected_lines_bounds (buf, &start, &end, &cursor_at_next_line);
gtk_text_buffer_delete (buf, &start, &end);
if (replacement)
{
char *text = join_lines (replacement);
gtk_text_buffer_insert (buf, &start, text, -1);
g_free (text);
}
if (cursor_at_next_line)
{
gtk_text_iter_forward_line (&start);
gtk_text_buffer_place_cursor (buf, &start);
}
}
/**
* moo_edit_get_selected_text:
*
* returns selected text.
**/
char *
moo_edit_get_selected_text (MooEdit *doc)
{
GtkTextBuffer *buf;
GtkTextIter start, end;
moo_return_val_if_fail (MOO_IS_EDIT (doc), NULL);
buf = get_buffer (doc);
gtk_text_buffer_get_selection_bounds(buf, &start, &end);
return gtk_text_buffer_get_slice(buf, &start, &end, TRUE);
}
/**
* moo_edit_replace_selected_text:
*
* replace selected text with %param{replacement}. If nothing is selected,
* then %param{replacement} is inserted at cursor.
**/
void
moo_edit_replace_selected_text (MooEdit *doc,
const char *replacement)
{
GtkTextBuffer *buf;
GtkTextIter start, end;
moo_return_if_fail (MOO_IS_EDIT (doc));
moo_return_if_fail (replacement != NULL);
buf = get_buffer (doc);
gtk_text_buffer_get_selection_bounds (buf, &start, &end);
gtk_text_buffer_delete (buf, &start, &end);
if (*replacement)
gtk_text_buffer_insert (buf, &start, replacement, -1);
gtk_text_buffer_place_cursor (buf, &start);
}
/**
* moo_edit_has_selection:
**/
gboolean
moo_edit_has_selection (MooEdit *doc)
{
return moo_text_view_has_selection (MOO_TEXT_VIEW (doc));
}
/**
* moo_edit_get_text:
**/
char *
moo_edit_get_text (MooEdit *doc)
{
return moo_text_view_get_text (MOO_TEXT_VIEW (doc));
}
static void
get_iter (int pos, GtkTextBuffer *buf, GtkTextIter *iter)
{
if (pos > gtk_text_buffer_get_char_count(buf) || pos < 0)
{
moo_critical ("invalid offset");
pos = 0;
}
gtk_text_buffer_get_iter_at_offset (buf, iter, pos);
}
/**
* moo_edit_set_selection:
**/
void
moo_edit_set_selection (MooEdit *doc,
int pos_start,
int pos_end)
{
GtkTextBuffer *buf;
GtkTextIter start, end;
moo_return_if_fail (MOO_IS_EDIT (doc));
buf = get_buffer (doc);
get_iter (pos_start, buf, &start);
get_iter (pos_end, buf, &end);
gtk_text_buffer_select_range(buf, &start, &end);
}
/**
* moo_edit_get_cursor_pos:
**/
int
moo_edit_get_cursor_pos (MooEdit *doc)
{
GtkTextBuffer *buf;
GtkTextIter iter;
moo_return_val_if_fail (MOO_IS_EDIT (doc), 0);
buf = get_buffer (doc);
gtk_text_buffer_get_iter_at_mark(buf, &iter, gtk_text_buffer_get_insert(buf));
return gtk_text_iter_get_offset(&iter);
}
/**
* moo_edit_insert_text:
**/
void
moo_edit_insert_text (MooEdit *doc,
const char *text)
{
GtkTextIter iter;
GtkTextBuffer *buf;
moo_return_if_fail (MOO_IS_EDIT (doc));
moo_return_if_fail (text != NULL);
buf = get_buffer (doc);
gtk_text_buffer_get_iter_at_mark (buf, &iter, gtk_text_buffer_get_insert(buf));
gtk_text_buffer_insert (buf, &iter, text, -1);
}

View File

@ -0,0 +1,29 @@
#ifndef MOO_EDIT_SCRIPT_H
#define MOO_EDIT_SCRIPT_H
#include <mooedit/mooedit.h>
G_BEGIN_DECLS
char **moo_edit_get_selected_lines (MooEdit *doc);
void moo_edit_replace_selected_lines (MooEdit *doc,
char **replacement);
char *moo_edit_get_text (MooEdit *doc);
char *moo_edit_get_selected_text (MooEdit *doc);
void moo_edit_replace_selected_text (MooEdit *doc,
const char *replacement);
gboolean moo_edit_has_selection (MooEdit *doc);
void moo_edit_set_selection (MooEdit *doc,
int pos_start,
int pos_end);
int moo_edit_get_cursor_pos (MooEdit *doc);
void moo_edit_insert_text (MooEdit *doc,
const char *text);
G_END_DECLS
#endif /* MOO_EDIT_SCRIPT_H */

View File

@ -42,7 +42,7 @@
#define KEY_ENCODING "encoding"
#define KEY_LINE "line"
MOO_DEFINE_OBJECT_ARRAY (MooEditArray, moo_edit_array, MooEdit)
MOO_DEFINE_OBJECT_ARRAY (MooEdit, moo_edit)
MooEditList *_moo_edit_instances = NULL;
@ -221,7 +221,7 @@ moo_edit_class_init (MooEditClass *klass)
_moo_signal_new_cb ("comment",
G_OBJECT_CLASS_TYPE (klass),
(GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
G_CALLBACK (moo_edit_comment),
G_CALLBACK (_moo_edit_comment),
NULL, NULL,
_moo_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@ -230,7 +230,7 @@ moo_edit_class_init (MooEditClass *klass)
_moo_signal_new_cb ("uncomment",
G_OBJECT_CLASS_TYPE (klass),
(GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
G_CALLBACK (moo_edit_uncomment),
G_CALLBACK (_moo_edit_uncomment),
NULL, NULL,
_moo_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@ -332,7 +332,7 @@ moo_edit_finalize (GObject *object)
moo_file_free (edit->priv->file);
g_free (edit->priv->filename);
g_free (edit->priv->norm_filename);
g_free (edit->priv->norm_name);
g_free (edit->priv->display_filename);
g_free (edit->priv->display_basename);
g_free (edit->priv->encoding);
@ -450,6 +450,9 @@ moo_edit_set_modified (MooEdit *edit,
}
/**
* moo_edit_set_clean:
**/
void
moo_edit_set_clean (MooEdit *edit,
gboolean clean)
@ -459,7 +462,9 @@ moo_edit_set_clean (MooEdit *edit,
_moo_edit_status_changed (edit);
}
/**
* moo_edit_get_clean:
**/
gboolean
moo_edit_get_clean (MooEdit *edit)
{
@ -511,6 +516,9 @@ moo_edit_is_empty (MooEdit *edit)
return !gtk_text_iter_compare (&start, &end);
}
/**
* moo_edit_is_untitled:
**/
gboolean
moo_edit_is_untitled (MooEdit *edit)
{
@ -519,6 +527,9 @@ moo_edit_is_untitled (MooEdit *edit)
}
/**
* moo_edit_get_status:
**/
MooEditStatus
moo_edit_get_status (MooEdit *edit)
{
@ -638,6 +649,9 @@ moo_edit_focus_out (GtkWidget *widget,
}
/**
* moo_edit_get_file:
**/
GFile *
moo_edit_get_file (MooEdit *edit)
{
@ -645,6 +659,9 @@ moo_edit_get_file (MooEdit *edit)
return edit->priv->file ? g_file_dup (edit->priv->file) : NULL;
}
/**
* moo_edit_get_filename:
**/
char *
moo_edit_get_filename (MooEdit *edit)
{
@ -653,19 +670,22 @@ moo_edit_get_filename (MooEdit *edit)
}
char *
moo_edit_get_norm_filename (MooEdit *edit)
_moo_edit_get_normalized_name (MooEdit *edit)
{
g_return_val_if_fail (MOO_IS_EDIT (edit), NULL);
return g_strdup (edit->priv->norm_filename);
return g_strdup (edit->priv->norm_name);
}
char *
moo_edit_get_utf8_filename (MooEdit *edit)
_moo_edit_get_utf8_filename (MooEdit *edit)
{
g_return_val_if_fail (MOO_IS_EDIT (edit), NULL);
return edit->priv->filename ? g_strdup (edit->priv->display_filename) : NULL;
}
/**
* moo_edit_get_display_name:
**/
const char *
moo_edit_get_display_name (MooEdit *edit)
{
@ -673,6 +693,9 @@ moo_edit_get_display_name (MooEdit *edit)
return edit->priv->display_filename;
}
/**
* moo_edit_get_display_basename:
**/
const char *
moo_edit_get_display_basename (MooEdit *edit)
{
@ -680,6 +703,9 @@ moo_edit_get_display_basename (MooEdit *edit)
return edit->priv->display_basename;
}
/**
* moo_edit_get_uri:
**/
char *
moo_edit_get_uri (MooEdit *edit)
{
@ -687,6 +713,9 @@ moo_edit_get_uri (MooEdit *edit)
return edit->priv->file ? g_file_get_uri (edit->priv->file) : NULL;
}
/**
* moo_edit_get_encoding:
**/
const char *
moo_edit_get_encoding (MooEdit *edit)
{
@ -694,6 +723,9 @@ moo_edit_get_encoding (MooEdit *edit)
return edit->priv->encoding;
}
/**
* moo_edit_set_encoding:
**/
void
moo_edit_set_encoding (MooEdit *edit,
const char *encoding)
@ -1171,14 +1203,14 @@ moo_edit_filename_changed (MooEdit *edit,
* Returns: whether document was successfully reloaded
**/
gboolean
moo_edit_reload (MooEdit *edit,
const char *encoding,
GError **error)
moo_edit_reload (MooEdit *doc,
MooEditReloadInfo *info,
GError **error)
{
return _moo_editor_reload (edit->priv->editor, edit, encoding, error);
moo_return_error_if_fail (MOO_IS_EDIT (doc));
return moo_editor_reload (doc->priv->editor, doc, info, error);
}
/**
* moo_edit_close:
*
@ -1196,36 +1228,30 @@ moo_edit_close (MooEdit *edit,
return moo_editor_close_doc (edit->priv->editor, edit, ask_confirm);
}
gboolean
moo_edit_save (MooEdit *edit,
moo_edit_save (MooEdit *doc,
GError **error)
{
g_return_val_if_fail (MOO_IS_EDIT (edit), FALSE);
return _moo_editor_save (edit->priv->editor, edit, error);
moo_return_error_if_fail (MOO_IS_EDIT (doc));
return moo_editor_save (doc->priv->editor, doc, error);
}
gboolean
moo_edit_save_as (MooEdit *edit,
const char *filename,
const char *encoding,
GError **error)
moo_edit_save_as (MooEdit *doc,
MooEditSaveInfo *info,
GError **error)
{
g_return_val_if_fail (MOO_IS_EDIT (edit), FALSE);
return _moo_editor_save_as (edit->priv->editor, edit, filename, encoding, error);
moo_return_error_if_fail (MOO_IS_EDIT (doc));
return moo_editor_save_as (doc->priv->editor, doc, info, error);
}
gboolean
moo_edit_save_copy (MooEdit *edit,
const char *filename,
const char *encoding,
GError **error)
moo_edit_save_copy (MooEdit *doc,
MooEditSaveInfo *info,
GError **error)
{
g_return_val_if_fail (MOO_IS_EDIT (edit), FALSE);
return moo_editor_save_copy (edit->priv->editor, edit,
filename, encoding, error);
moo_return_error_if_fail (MOO_IS_EDIT (doc));
return moo_editor_save_copy (doc->priv->editor, doc, info, error);
}
@ -1504,7 +1530,7 @@ block_uncomment (GtkTextBuffer *buffer,
void
moo_edit_comment (MooEdit *edit)
_moo_edit_comment (MooEdit *edit)
{
MooLang *lang;
GtkTextIter start, end;
@ -1560,7 +1586,7 @@ moo_edit_comment (MooEdit *edit)
void
moo_edit_uncomment (MooEdit *edit)
_moo_edit_uncomment (MooEdit *edit)
{
MooLang *lang;
GtkTextIter start, end;
@ -1892,8 +1918,8 @@ _moo_edit_set_state (MooEdit *edit,
void
moo_edit_ui_set_line_wrap_mode (MooEdit *doc,
gboolean enabled)
_moo_edit_ui_set_line_wrap_mode (MooEdit *doc,
gboolean enabled)
{
GtkWrapMode mode;
gboolean old_enabled;
@ -1919,8 +1945,8 @@ moo_edit_ui_set_line_wrap_mode (MooEdit *doc,
}
void
moo_edit_ui_set_show_line_numbers (MooEdit *doc,
gboolean show)
_moo_edit_ui_set_show_line_numbers (MooEdit *doc,
gboolean show)
{
gboolean old_show;

View File

@ -20,13 +20,12 @@
#include <mooedit/mooeditconfig.h>
#include <mooedit/mooedit-enums.h>
#include <mooedit/mooedittypes.h>
#include <mooedit/mooeditfileinfo.h>
#include <mooutils/mooprefs.h>
G_BEGIN_DECLS
#define MOO_TYPE_EDIT_FILE_INFO (moo_edit_file_info_get_type ())
#define MOO_TYPE_EDIT (moo_edit_get_type ())
#define MOO_EDIT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_EDIT, MooEdit))
#define MOO_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_EDIT, MooEditClass))
@ -38,17 +37,17 @@ G_BEGIN_DECLS
#define MOO_EDIT_IS_CLEAN(edit) (moo_edit_get_status (edit) & MOO_EDIT_CLEAN)
#define MOO_EDIT_IS_BUSY(edit) (moo_edit_get_state (edit) != MOO_EDIT_STATE_NORMAL)
typedef struct _MooEditPrivate MooEditPrivate;
typedef struct _MooEditClass MooEditClass;
typedef struct MooEditPrivate MooEditPrivate;
typedef struct MooEditClass MooEditClass;
struct _MooEdit
struct MooEdit
{
MooTextView parent;
MooEditConfig *config;
MooEditPrivate *priv;
};
struct _MooEditClass
struct MooEditClass
{
MooTextViewClass parent_class;
@ -70,28 +69,25 @@ struct _MooEditClass
};
GType moo_edit_get_type (void) G_GNUC_CONST;
GType moo_edit_file_info_get_type (void) G_GNUC_CONST;
GType moo_edit_get_type (void) G_GNUC_CONST;
MooEditWindow *moo_edit_get_window (MooEdit *edit);
MooEditWindow *moo_edit_get_window (MooEdit *edit);
GFile *moo_edit_get_file (MooEdit *edit);
GFile *moo_edit_get_file (MooEdit *edit);
char *moo_edit_get_uri (MooEdit *edit);
char *moo_edit_get_filename (MooEdit *edit);
char *moo_edit_get_norm_filename (MooEdit *edit);
const char *moo_edit_get_display_name (MooEdit *edit);
const char *moo_edit_get_display_basename (MooEdit *edit);
char *moo_edit_get_uri (MooEdit *edit);
const char *moo_edit_get_encoding (MooEdit *edit);
void moo_edit_set_encoding (MooEdit *edit,
const char *encoding);
char *moo_edit_get_filename (MooEdit *edit);
const char *moo_edit_get_display_name (MooEdit *edit);
const char *moo_edit_get_display_basename (MooEdit *edit);
char *moo_edit_get_utf8_filename (MooEdit *edit);
const char *moo_edit_get_encoding (MooEdit *edit);
void moo_edit_set_encoding (MooEdit *edit,
const char *encoding);
const char *moo_edit_get_lang_id (MooEdit *edit);
const char *moo_edit_get_lang_id (MooEdit *edit);
MooEditor *moo_edit_get_editor (MooEdit *doc);
MooEditor *moo_edit_get_editor (MooEdit *doc);
#ifdef __WIN32__
#define MOO_LE_DEFAULT MOO_LE_WIN32
@ -99,44 +95,33 @@ MooEditor *moo_edit_get_editor (MooEdit *doc);
#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);
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);
void moo_edit_set_modified (MooEdit *edit,
gboolean modified);
gboolean moo_edit_get_clean (MooEdit *edit);
void moo_edit_set_clean (MooEdit *edit,
gboolean clean);
MooEditStatus moo_edit_get_status (MooEdit *edit);
MooEditState moo_edit_get_state (MooEdit *edit);
gboolean moo_edit_reload (MooEdit *edit,
const char *encoding,
GError **error);
gboolean moo_edit_close (MooEdit *edit,
gboolean ask_confirm);
gboolean moo_edit_save (MooEdit *edit,
GError **error);
gboolean moo_edit_save_as (MooEdit *edit,
const char *filename,
const char *encoding,
GError **error);
gboolean moo_edit_save_copy (MooEdit *edit,
const char *filename,
const char *encoding,
GError **error);
void moo_edit_comment (MooEdit *edit);
void moo_edit_uncomment (MooEdit *edit);
void moo_edit_ui_set_line_wrap_mode (MooEdit *edit,
gboolean enabled);
void moo_edit_ui_set_show_line_numbers (MooEdit *edit,
gboolean show);
gboolean moo_edit_is_empty (MooEdit *edit);
gboolean moo_edit_is_untitled (MooEdit *edit);
void moo_edit_set_modified (MooEdit *edit,
gboolean modified);
gboolean moo_edit_get_clean (MooEdit *edit);
void moo_edit_set_clean (MooEdit *edit,
gboolean clean);
MooEditStatus moo_edit_get_status (MooEdit *edit);
MooEditState moo_edit_get_state (MooEdit *edit);
gboolean moo_edit_reload (MooEdit *edit,
MooEditReloadInfo *info,
GError **error);
gboolean moo_edit_save (MooEdit *edit,
GError **error);
gboolean moo_edit_save_as (MooEdit *edit,
MooEditSaveInfo *info,
GError **error);
gboolean moo_edit_save_copy (MooEdit *edit,
MooEditSaveInfo *info,
GError **error);
gboolean moo_edit_close (MooEdit *edit,
gboolean ask_confirm);
G_END_DECLS

View File

@ -33,7 +33,7 @@ typedef enum {
#define N_FILTERS 2
struct _MooEditActionPrivate {
struct MooEditActionPrivate {
MooEdit *doc;
MooEditFilter *file_filter;
GRegex *filters[N_FILTERS];

View File

@ -29,17 +29,17 @@ G_BEGIN_DECLS
#define MOO_IS_EDIT_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDIT_ACTION))
#define MOO_EDIT_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDIT_ACTION, MooEditActionClass))
typedef struct _MooEditAction MooEditAction;
typedef struct _MooEditActionPrivate MooEditActionPrivate;
typedef struct _MooEditActionClass MooEditActionClass;
typedef struct MooEditAction MooEditAction;
typedef struct MooEditActionPrivate MooEditActionPrivate;
typedef struct MooEditActionClass MooEditActionClass;
struct _MooEditAction
struct MooEditAction
{
MooAction parent;
MooEditActionPrivate *priv;
};
struct _MooEditActionClass
struct MooEditActionClass
{
MooActionClass parent_class;

View File

@ -29,16 +29,16 @@ G_BEGIN_DECLS
#define MOO_IS_EDIT_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDIT_BOOKMARK))
#define MOO_EDIT_BOOKMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDIT_BOOKMARK, MooEditBookmarkClass))
typedef struct _MooEditBookmark MooEditBookmark;
typedef struct _MooEditBookmarkClass MooEditBookmarkClass;
typedef struct MooEditBookmark MooEditBookmark;
typedef struct MooEditBookmarkClass MooEditBookmarkClass;
struct _MooEditBookmark
struct MooEditBookmark
{
MooLineMark mark;
guint no;
};
struct _MooEditBookmarkClass
struct MooEditBookmarkClass
{
MooLineMarkClass mark_class;
};

View File

@ -34,7 +34,7 @@ typedef struct VarArray VarArray;
typedef struct Value Value;
struct _MooEditConfigPrivate {
struct MooEditConfigPrivate {
MOO_IP_ARRAY_ELMS (Value, values);
};

View File

@ -29,17 +29,17 @@ G_BEGIN_DECLS
#define MOO_IS_EDIT_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDIT_CONFIG))
#define MOO_EDIT_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDIT_CONFIG, MooEditConfigClass))
typedef struct _MooEditConfig MooEditConfig;
typedef struct _MooEditConfigPrivate MooEditConfigPrivate;
typedef struct _MooEditConfigClass MooEditConfigClass;
typedef struct MooEditConfig MooEditConfig;
typedef struct MooEditConfigPrivate MooEditConfigPrivate;
typedef struct MooEditConfigClass MooEditConfigClass;
struct _MooEditConfig
struct MooEditConfig
{
GObject object;
MooEditConfigPrivate *priv;
};
struct _MooEditConfigClass
struct MooEditConfigClass
{
GObjectClass object_class;
};

View File

@ -17,7 +17,7 @@
#include "mooedit/mooeditdialogs.h"
#include "mooedit/mooeditprefs.h"
#include "mooedit/mooedit-fileops.h"
#include "mooedit/moofileenc.h"
#include "mooedit/mooeditfileinfo.h"
#include "mooutils/moodialogs.h"
#include "mooutils/moostock.h"
#include "mooutils/mooi18n.h"
@ -30,7 +30,7 @@
#include <string.h>
MooFileEncArray *
MooEditOpenInfoArray *
_moo_edit_open_dialog (GtkWidget *widget,
MooEdit *current_doc)
{
@ -38,7 +38,7 @@ _moo_edit_open_dialog (GtkWidget *widget,
const char *encoding;
GFile *start = NULL;
MooFileArray *files = NULL;
MooFileEncArray *fencs = NULL;
MooEditOpenInfoArray *info_array = NULL;
guint i;
moo_prefs_create_key (moo_edit_setting (MOO_EDIT_PREFS_LAST_DIR), MOO_PREFS_STATE, G_TYPE_STRING, NULL);
@ -75,9 +75,9 @@ _moo_edit_open_dialog (GtkWidget *widget,
files = moo_file_dialog_get_files (dialog);
g_return_val_if_fail (files != NULL && files->n_elms != 0, NULL);
fencs = moo_file_enc_array_new ();
info_array = moo_edit_open_info_array_new ();
for (i = 0; i < files->n_elms; ++i)
moo_file_enc_array_take (fencs, moo_file_enc_new (files->elms[i], encoding));
moo_edit_open_info_array_take (info_array, moo_edit_open_info_new (files->elms[i], encoding));
g_object_unref (start);
start = g_file_get_parent (files->elms[0]);
@ -87,17 +87,17 @@ _moo_edit_open_dialog (GtkWidget *widget,
g_object_unref (start);
g_object_unref (dialog);
moo_file_array_free (files);
return fencs;
return info_array;
}
MooFileEnc *
MooEditSaveInfo *
_moo_edit_save_as_dialog (MooEdit *doc,
const char *display_basename)
{
const char *encoding;
MooFileDialog *dialog;
MooFileEnc *fenc;
MooEditSaveInfo *info;
GFile *start = NULL;
GFile *file = NULL;
@ -137,7 +137,7 @@ _moo_edit_save_as_dialog (MooEdit *doc,
encoding = moo_file_dialog_get_encoding (dialog);
file = moo_file_dialog_get_file (dialog);
g_return_val_if_fail (file != NULL, NULL);
fenc = moo_file_enc_new (file, encoding);
info = moo_edit_save_info_new (file, encoding);
g_object_unref (start);
start = g_file_get_parent (file);
@ -146,7 +146,7 @@ _moo_edit_save_as_dialog (MooEdit *doc,
g_object_unref (start);
g_object_unref (file);
g_object_unref (dialog);
return fenc;
return info;
}

View File

@ -22,44 +22,39 @@
G_BEGIN_DECLS
MooEditSaveInfo *_moo_edit_save_as_dialog (MooEdit *doc,
const char *display_basename);
MooEditOpenInfoArray *_moo_edit_open_dialog (GtkWidget *widget,
MooEdit *current_doc);
MooFileEnc *_moo_edit_save_as_dialog (MooEdit *doc,
const char *display_basename);
MooFileEncArray *_moo_edit_open_dialog (GtkWidget *widget,
MooEdit *current_doc);
MooSaveChangesDialogResponse _moo_edit_save_changes_dialog (MooEdit *doc);
MooSaveChangesDialogResponse _moo_edit_save_multiple_changes_dialog (MooEditArray *docs,
MooEditArray *to_save);
MooSaveChangesDialogResponse
_moo_edit_save_changes_dialog (MooEdit *doc);
MooSaveChangesDialogResponse
_moo_edit_save_multiple_changes_dialog (MooEditArray *docs,
MooEditArray *to_save);
gboolean _moo_edit_reload_modified_dialog (MooEdit *doc);
gboolean _moo_edit_overwrite_modified_dialog (MooEdit *doc);
gboolean _moo_edit_reload_modified_dialog (MooEdit *doc);
gboolean _moo_edit_overwrite_modified_dialog (MooEdit *doc);
void _moo_edit_save_error_dialog (GtkWidget *widget,
GFile *file,
GError *error);
void _moo_edit_save_error_enc_dialog (GtkWidget *widget,
GFile *file,
const char *encoding);
void _moo_edit_open_error_dialog (GtkWidget *widget,
GFile *file,
const char *encoding,
GError *error);
void _moo_edit_reload_error_dialog (MooEdit *doc,
GError *error);
void _moo_edit_save_error_dialog (GtkWidget *widget,
GFile *file,
GError *error);
void _moo_edit_save_error_enc_dialog (GtkWidget *widget,
GFile *file,
const char *encoding);
void _moo_edit_open_error_dialog (GtkWidget *widget,
GFile *file,
const char *encoding,
GError *error);
void _moo_edit_reload_error_dialog (MooEdit *doc,
GError *error);
gboolean _moo_text_search_from_start_dialog (GtkWidget *parent,
gboolean backwards);
void _moo_text_regex_error_dialog (GtkWidget *parent,
GError *error);
gboolean _moo_text_replace_from_start_dialog(GtkWidget *parent,
int replaced);
GtkWidget *_moo_text_prompt_on_replace_dialog (GtkWidget *parent);
gboolean _moo_text_search_from_start_dialog (GtkWidget *parent,
gboolean backwards);
void _moo_text_regex_error_dialog (GtkWidget *parent,
GError *error);
gboolean _moo_text_replace_from_start_dialog (GtkWidget *parent,
int replaced);
GtkWidget *_moo_text_prompt_on_replace_dialog (GtkWidget *parent);
G_END_DECLS

View File

@ -0,0 +1,265 @@
/**
* class:MooEditOpenInfo: (parent GObject)
**/
/**
* class:MooEditSaveInfo: (parent GObject)
**/
/**
* class:MooEditReloadInfo: (parent GObject)
**/
#include "mooeditfileinfo.h"
static void moo_edit_open_info_class_init (MooEditOpenInfoClass *klass);
static void moo_edit_save_info_class_init (MooEditSaveInfoClass *klass);
static void moo_edit_reload_info_class_init (MooEditReloadInfoClass *klass);
MOO_DEFINE_OBJECT_ARRAY (MooEditOpenInfo, moo_edit_open_info)
G_DEFINE_TYPE (MooEditOpenInfo, moo_edit_open_info, G_TYPE_OBJECT)
G_DEFINE_TYPE (MooEditSaveInfo, moo_edit_save_info, G_TYPE_OBJECT)
G_DEFINE_TYPE (MooEditReloadInfo, moo_edit_reload_info, G_TYPE_OBJECT)
/**
* moo_edit_open_info_new: (constructor-of MooEditOpenInfo)
**/
MooEditOpenInfo *
moo_edit_open_info_new (GFile *file,
const char *encoding)
{
MooEditOpenInfo *info;
g_return_val_if_fail (G_IS_FILE (file), NULL);
info = g_object_new (MOO_TYPE_EDIT_OPEN_INFO, NULL);
info->file = g_file_dup (file);
info->encoding = g_strdup (encoding);
info->line = -1;
return info;
}
/**
* moo_edit_open_info_new_path:
*
* Returns: (transfer full)
**/
MooEditOpenInfo *
moo_edit_open_info_new_path (const char *path,
const char *encoding)
{
GFile *file = g_file_new_for_path (path);
MooEditOpenInfo *info = moo_edit_open_info_new (file, encoding);
g_object_unref (file);
return info;
}
/**
* moo_edit_open_info_new_uri:
*
* Returns: (transfer full)
**/
MooEditOpenInfo *
moo_edit_open_info_new_uri (const char *uri,
const char *encoding)
{
GFile *file = g_file_new_for_uri (uri);
MooEditOpenInfo *info = moo_edit_open_info_new (file, encoding);
g_object_unref (file);
return info;
}
/**
* moo_edit_open_info_dup:
*
* Returns: (transfer full)
**/
MooEditOpenInfo *
moo_edit_open_info_dup (MooEditOpenInfo *info)
{
MooEditOpenInfo *copy;
g_return_val_if_fail (info != NULL, NULL);
copy = moo_edit_open_info_new (info->file, info->encoding);
g_return_val_if_fail (copy != NULL, NULL);
copy->flags = info->flags;
copy->line = info->line;
return copy;
}
static void
moo_edit_open_info_finalize (GObject *object)
{
MooEditOpenInfo *info = (MooEditOpenInfo*) object;
g_object_unref (info->file);
g_free (info->encoding);
G_OBJECT_CLASS (moo_edit_open_info_parent_class)->finalize (object);
}
static void
moo_edit_open_info_class_init (MooEditOpenInfoClass *klass)
{
G_OBJECT_CLASS (klass)->finalize = moo_edit_open_info_finalize;
}
static void
moo_edit_open_info_init (MooEditOpenInfo *info)
{
info->line = -1;
}
/**
* moo_edit_save_info_new: (constructor-of MooEditSaveInfo)
**/
MooEditSaveInfo *
moo_edit_save_info_new (GFile *file,
const char *encoding)
{
MooEditSaveInfo *info;
g_return_val_if_fail (G_IS_FILE (file), NULL);
info = g_object_new (MOO_TYPE_EDIT_SAVE_INFO, NULL);
info->file = g_file_dup (file);
info->encoding = g_strdup (encoding);
return info;
}
/**
* moo_edit_save_info_new_path:
*
* Returns: (transfer full)
**/
MooEditSaveInfo *
moo_edit_save_info_new_path (const char *path,
const char *encoding)
{
GFile *file = g_file_new_for_path (path);
MooEditSaveInfo *info = moo_edit_save_info_new (file, encoding);
g_object_unref (file);
return info;
}
/**
* moo_edit_save_info_new_uri:
*
* Returns: (transfer full)
**/
MooEditSaveInfo *
moo_edit_save_info_new_uri (const char *uri,
const char *encoding)
{
GFile *file = g_file_new_for_uri (uri);
MooEditSaveInfo *info = moo_edit_save_info_new (file, encoding);
g_object_unref (file);
return info;
}
/**
* moo_edit_save_info_dup:
*
* Returns: (transfer full)
**/
MooEditSaveInfo *
moo_edit_save_info_dup (MooEditSaveInfo *info)
{
MooEditSaveInfo *copy;
g_return_val_if_fail (info != NULL, NULL);
copy = moo_edit_save_info_new (info->file, info->encoding);
g_return_val_if_fail (copy != NULL, NULL);
return copy;
}
static void
moo_edit_save_info_finalize (GObject *object)
{
MooEditSaveInfo *info = (MooEditSaveInfo*) object;
g_object_unref (info->file);
g_free (info->encoding);
G_OBJECT_CLASS (moo_edit_save_info_parent_class)->finalize (object);
}
static void
moo_edit_save_info_class_init (MooEditSaveInfoClass *klass)
{
G_OBJECT_CLASS (klass)->finalize = moo_edit_save_info_finalize;
}
static void
moo_edit_save_info_init (G_GNUC_UNUSED MooEditSaveInfo *info)
{
}
/**
* moo_edit_reload_info_new: (constructor-of MooEditReloadInfo)
**/
MooEditReloadInfo *
moo_edit_reload_info_new (const char *encoding)
{
MooEditReloadInfo *info;
info = g_object_new (MOO_TYPE_EDIT_RELOAD_INFO, NULL);
info->encoding = g_strdup (encoding);
info->line = -1;
return info;
}
/**
* moo_edit_reload_info_dup:
*
* Returns: (transfer full)
**/
MooEditReloadInfo *
moo_edit_reload_info_dup (MooEditReloadInfo *info)
{
MooEditReloadInfo *copy;
g_return_val_if_fail (info != NULL, NULL);
copy = moo_edit_reload_info_new (info->encoding);
g_return_val_if_fail (copy != NULL, NULL);
copy->line = info->line;
return copy;
}
static void
moo_edit_reload_info_finalize (GObject *object)
{
MooEditReloadInfo *info = (MooEditReloadInfo*) object;
g_free (info->encoding);
G_OBJECT_CLASS (moo_edit_reload_info_parent_class)->finalize (object);
}
static void
moo_edit_reload_info_class_init (MooEditReloadInfoClass *klass)
{
G_OBJECT_CLASS (klass)->finalize = moo_edit_reload_info_finalize;
}
static void
moo_edit_reload_info_init (MooEditReloadInfo *info)
{
info->line = -1;
}

View File

@ -0,0 +1,120 @@
/*
* mooeditfileinfo.h
*
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@sourceforge.net>
*
* This file is part of medit. medit is free software; you can
* redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License,
* or (at your option) any later version.
*
* You should have received a copy of the GNU Lesser General Public
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MOO_EDIT_FILE_INFO_H
#define MOO_EDIT_FILE_INFO_H
#include <gio/gio.h>
#include <mooedit/mooedittypes.h>
G_BEGIN_DECLS
#define MOO_TYPE_EDIT_OPEN_INFO (moo_edit_open_info_get_type ())
#define MOO_EDIT_OPEN_INFO(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_EDIT_OPEN_INFO, MooEditOpenInfo))
#define MOO_EDIT_OPEN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_EDIT_OPEN_INFO, MooEditOpenInfoClass))
#define MOO_IS_EDIT_OPEN_INFO(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_EDIT_OPEN_INFO))
#define MOO_IS_EDIT_OPEN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDIT_OPEN_INFO))
#define MOO_EDIT_OPEN_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDIT_OPEN_INFO, MooEditOpenInfoClass))
#define MOO_TYPE_EDIT_SAVE_INFO (moo_edit_save_info_get_type ())
#define MOO_EDIT_SAVE_INFO(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_EDIT_SAVE_INFO, MooEditSaveInfo))
#define MOO_EDIT_SAVE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_EDIT_SAVE_INFO, MooEditSaveInfoClass))
#define MOO_IS_EDIT_SAVE_INFO(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_EDIT_SAVE_INFO))
#define MOO_IS_EDIT_SAVE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDIT_SAVE_INFO))
#define MOO_EDIT_SAVE_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDIT_SAVE_INFO, MooEditSaveInfoClass))
#define MOO_TYPE_EDIT_RELOAD_INFO (moo_edit_reload_info_get_type ())
#define MOO_EDIT_RELOAD_INFO(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_EDIT_RELOAD_INFO, MooEditReloadInfo))
#define MOO_EDIT_RELOAD_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_EDIT_RELOAD_INFO, MooEditReloadInfoClass))
#define MOO_IS_EDIT_RELOAD_INFO(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_EDIT_RELOAD_INFO))
#define MOO_IS_EDIT_RELOAD_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDIT_RELOAD_INFO))
#define MOO_EDIT_RELOAD_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDIT_RELOAD_INFO, MooEditReloadInfoClass))
typedef struct MooEditOpenInfoClass MooEditOpenInfoClass;
typedef struct MooEditSaveInfoClass MooEditSaveInfoClass;
typedef struct MooEditReloadInfoClass MooEditReloadInfoClass;
typedef enum {
MOO_EDIT_OPEN_NEW_WINDOW = 1 << 0,
MOO_EDIT_OPEN_NEW_TAB = 1 << 1,
MOO_EDIT_OPEN_RELOAD = 1 << 2,
MOO_EDIT_OPEN_CREATE_NEW = 1 << 3
} MooEditOpenFlags;
struct MooEditOpenInfo
{
GObject parent;
GFile *file;
char *encoding;
int line;
MooEditOpenFlags flags;
};
struct MooEditOpenInfoClass
{
GObjectClass parent_class;
};
struct MooEditReloadInfo {
GObject parent;
char *encoding;
int line;
};
struct MooEditReloadInfoClass
{
GObjectClass parent_class;
};
struct MooEditSaveInfo {
GObject parent;
GFile *file;
char *encoding;
};
struct MooEditSaveInfoClass
{
GObjectClass parent_class;
};
GType moo_edit_open_info_get_type (void) G_GNUC_CONST;
GType moo_edit_reload_info_get_type (void) G_GNUC_CONST;
GType moo_edit_save_info_get_type (void) G_GNUC_CONST;
MooEditOpenInfo *moo_edit_open_info_new (GFile *file,
const char *encoding);
MooEditOpenInfo *moo_edit_open_info_new_path (const char *path,
const char *encoding);
MooEditOpenInfo *moo_edit_open_info_new_uri (const char *uri,
const char *encoding);
MooEditOpenInfo *moo_edit_open_info_dup (MooEditOpenInfo *info);
MooEditReloadInfo *moo_edit_reload_info_new (const char *encoding);
MooEditReloadInfo *moo_edit_reload_info_dup (MooEditReloadInfo *info);
MooEditSaveInfo *moo_edit_save_info_new (GFile *file,
const char *encoding);
MooEditSaveInfo *moo_edit_save_info_new_path (const char *path,
const char *encoding);
MooEditSaveInfo *moo_edit_save_info_new_uri (const char *uri,
const char *encoding);
MooEditSaveInfo *moo_edit_save_info_dup (MooEditSaveInfo *info);
G_END_DECLS
#endif /* MOO_EDIT_FILE_INFO_H */

View File

@ -39,7 +39,7 @@ typedef enum {
MOO_EDIT_FILTER_REGEX
} MooEditFilterType;
struct _MooEditFilter {
struct MooEditFilter {
MooEditFilterType type;
union {
GSList *langs;

View File

@ -25,7 +25,7 @@
G_BEGIN_DECLS
typedef struct _MooEditFilter MooEditFilter;
typedef struct MooEditFilter MooEditFilter;
MooEditFilter *_moo_edit_filter_new (const char *string);
MooEditFilter *_moo_edit_filter_new_langs (const char *string);

View File

@ -24,18 +24,9 @@ void _moo_editor_move_doc (MooEditor *editor,
gboolean focus);
MooFileWatch *_moo_editor_get_file_watch (MooEditor *editor);
gboolean _moo_editor_reload (MooEditor *editor,
MooEdit *doc,
const char *encoding,
GError **error);
gboolean _moo_editor_save (MooEditor *editor,
MooEdit *doc,
GError **error);
gboolean _moo_editor_save_as (MooEditor *editor,
MooEdit *doc,
const char *filename,
const char *encoding,
GError **error);
void _moo_editor_apply_prefs (MooEditor *editor);
void _moo_editor_queue_apply_prefs (MooEditor *editor);
G_END_DECLS

View File

@ -30,7 +30,7 @@ typedef enum {
EMBEDDED = 1 << 5
} MooEditorOptions;
struct _MooEditorPrivate {
struct MooEditorPrivate {
MooEditArray *windowless;
MooEditWindowArray *windows;
MooUiXml *doc_ui_xml;

View File

@ -49,10 +49,13 @@ test_basic (void)
MooEdit *doc, *doc2;
GtkTextBuffer *buffer;
char *filename;
MooEditOpenInfo *info;
editor = moo_editor_instance ();
filename = g_build_filename (test_data.working_dir, "test.txt", NULL);
doc = moo_editor_new_file (editor, NULL, NULL, filename, NULL);
info = moo_edit_open_info_new_path (filename, NULL);
doc = moo_editor_new_file (editor, info, NULL, NULL);
TEST_ASSERT (doc != NULL);
TEST_ASSERT (moo_edit_save (doc, NULL));
check_contents (filename, "");
@ -75,33 +78,34 @@ test_basic (void)
TEST_ASSERT (moo_edit_save (doc, NULL));
check_contents (filename, TT3);
doc2 = moo_editor_open_file (editor, NULL, NULL, filename, NULL);
doc2 = moo_editor_open_path (editor, filename, NULL, -1, NULL);
TEST_ASSERT (doc2 == doc);
TEST_ASSERT (moo_edit_close (doc, TRUE));
TEST_ASSERT (moo_editor_get_doc_for_path (editor, filename) == NULL);
g_file_set_contents (filename, TT4, -1, NULL);
doc = moo_editor_open_file (editor, NULL, NULL, filename, NULL);
doc = moo_editor_open_path (editor, filename, NULL, -1, NULL);
TEST_ASSERT (doc != NULL);
TEST_ASSERT (moo_edit_save (doc, NULL));
check_contents (filename, TT4);
TEST_ASSERT (moo_edit_close (doc, TRUE));
g_file_set_contents (filename, TT5, -1, NULL);
doc = moo_editor_open_file (editor, NULL, NULL, filename, NULL);
doc = moo_editor_open_path (editor, filename, NULL, -1, NULL);
TEST_ASSERT (doc != NULL);
TEST_ASSERT (moo_edit_save (doc, NULL));
check_contents (filename, TT5);
TEST_ASSERT (moo_edit_close (doc, TRUE));
g_file_set_contents (filename, TT6, -1, NULL);
doc = moo_editor_open_file (editor, NULL, NULL, filename, NULL);
doc = moo_editor_open_path (editor, filename, NULL, -1, NULL);
TEST_ASSERT (doc != NULL);
TEST_ASSERT (moo_edit_save (doc, NULL));
check_contents (filename, TT6);
TEST_ASSERT (moo_edit_close (doc, TRUE));
g_object_unref (info);
g_free (filename);
}
@ -149,7 +153,7 @@ test_encodings_1 (const char *name,
filename2 = g_build_filename (working_dir, name, (char*)0);
editor = moo_editor_instance ();
doc = moo_editor_open_file (editor, NULL, NULL, filename, encoding);
doc = moo_editor_open_path (editor, filename, encoding, -1, NULL);
TEST_ASSERT_MSG (doc != NULL,
"file '%s', encoding '%s'",
TEST_FMT_STR (filename),
@ -157,9 +161,11 @@ test_encodings_1 (const char *name,
if (doc)
{
TEST_ASSERT (moo_edit_save_as (doc, filename2, NULL, NULL));
MooEditSaveInfo *info = moo_edit_save_info_new_path (filename2, NULL);
TEST_ASSERT (moo_edit_save_as (doc, info, NULL));
TEST_ASSERT_SAME_FILE_CONTENT (filename2, filename);
TEST_ASSERT (moo_edit_close (doc, TRUE));
g_object_unref (info);
}
g_free (encoding);

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@
#include <mooedit/mooedittypes.h>
#include <mooedit/mooeditwindow.h>
#include <mooedit/mooeditfileinfo.h>
#include <mooutils/moouixml.h>
G_BEGIN_DECLS
@ -28,6 +29,11 @@ enum {
MOO_EDIT_RELOAD_ERROR_CANCELLED
};
enum {
MOO_EDIT_SAVE_ERROR_BUSY = 1,
MOO_EDIT_SAVE_ERROR_CANCELLED
};
#define MOO_TYPE_EDITOR (moo_editor_get_type ())
#define MOO_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOO_TYPE_EDITOR, MooEditor))
#define MOO_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_EDITOR, MooEditorClass))
@ -35,132 +41,129 @@ enum {
#define MOO_IS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDITOR))
#define MOO_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDITOR, MooEditorClass))
typedef struct _MooEditorPrivate MooEditorPrivate;
typedef struct _MooEditorClass MooEditorClass;
typedef struct MooEditorPrivate MooEditorPrivate;
typedef struct MooEditorClass MooEditorClass;
struct _MooEditor
struct MooEditor
{
GObject base;
MooEditorPrivate *priv;
};
struct _MooEditorClass
struct MooEditorClass
{
GObjectClass base_class;
gboolean (*close_window) (MooEditor *editor,
MooEditWindow *window,
gboolean ask_confirm);
gboolean (*before_save) (MooEditor *editor,
MooEdit *doc,
GFile *file,
const char *encoding);
void (*after_save) (MooEditor *editor,
MooEdit *doc);
};
GType moo_editor_get_type (void) G_GNUC_CONST;
GType moo_editor_get_type (void) G_GNUC_CONST;
MooEditor *moo_editor_instance (void);
MooEditor *moo_editor_create (gboolean embedded);
MooEditor *moo_editor_instance (void);
MooEditor *moo_editor_create (gboolean embedded);
/* this creates 'windowless' MooEdit instance */
MooEdit *moo_editor_create_doc (MooEditor *editor,
const char *filename,
const char *encoding,
GError **error);
MooEditWindow *moo_editor_new_window (MooEditor *editor);
MooEdit *moo_editor_new_doc (MooEditor *editor,
MooEditWindow *window);
MooEditWindow *moo_editor_new_window (MooEditor *editor);
MooEdit *moo_editor_new_doc (MooEditor *editor,
MooEditWindow *window);
MooEdit *moo_editor_new_file (MooEditor *editor,
MooEditOpenInfo *info,
GtkWidget *parent,
GError **error);
MooEdit *moo_editor_open_file (MooEditor *editor,
MooEditOpenInfo *info,
GtkWidget *parent,
GError **error);
gboolean moo_editor_open_files (MooEditor *editor,
MooEditOpenInfoArray *files,
GtkWidget *parent,
GError **error);
gboolean moo_editor_open (MooEditor *editor,
MooEditWindow *window,
GtkWidget *parent,
MooFileEncArray *files);
MooEdit *moo_editor_open_file (MooEditor *editor,
MooEditWindow *window,
GtkWidget *parent,
const char *filename,
const char *encoding);
MooEdit *moo_editor_open_file_line (MooEditor *editor,
const char *filename,
int line,
MooEditWindow *window);
MooEdit *moo_editor_new_file (MooEditor *editor,
MooEditWindow *window,
GtkWidget *parent,
const char *filename,
const char *encoding);
MooEdit *moo_editor_open_uri (MooEditor *editor,
MooEditWindow *window,
GtkWidget *parent,
const char *uri,
const char *encoding);
MooEdit *moo_editor_open_uri (MooEditor *editor,
const char *uri,
const char *encoding,
int line,
MooEditWindow *window);
MooEdit *moo_editor_open_path (MooEditor *editor,
const char *path,
const char *encoding,
int line,
MooEditWindow *window);
MooEdit *moo_editor_get_doc_for_path(MooEditor *editor,
const char *filename);
MooEdit *moo_editor_get_doc_for_uri (MooEditor *editor,
const char *uri);
gboolean moo_editor_reload (MooEditor *editor,
MooEdit *doc,
MooEditReloadInfo *info,
GError **error);
MooEdit *moo_editor_get_active_doc (MooEditor *editor);
MooEditWindow *moo_editor_get_active_window (MooEditor *editor);
gboolean moo_editor_save (MooEditor *editor,
MooEdit *doc,
GError **error);
gboolean moo_editor_save_as (MooEditor *editor,
MooEdit *doc,
MooEditSaveInfo *info,
GError **error);
gboolean moo_editor_save_copy (MooEditor *editor,
MooEdit *doc,
MooEditSaveInfo *info,
GError **error);
void moo_editor_set_active_window (MooEditor *editor,
MooEditWindow *window);
void moo_editor_set_active_doc (MooEditor *editor,
MooEdit *doc);
MooEdit *moo_editor_get_doc (MooEditor *editor,
GFile *file);
MooEdit *moo_editor_get_doc_for_path (MooEditor *editor,
const char *path);
MooEdit *moo_editor_get_doc_for_uri (MooEditor *editor,
const char *uri);
void moo_editor_present (MooEditor *editor,
guint32 stamp);
MooEdit *moo_editor_get_active_doc (MooEditor *editor);
void moo_editor_set_active_doc (MooEditor *editor,
MooEdit *doc);
MooEditWindow *moo_editor_get_active_window (MooEditor *editor);
void moo_editor_set_active_window (MooEditor *editor,
MooEditWindow *window);
MooEditWindowArray *moo_editor_get_windows (MooEditor *editor);
MooEditArray *moo_editor_get_docs (MooEditor *editor);
void moo_editor_present (MooEditor *editor,
guint32 stamp);
gboolean moo_editor_close_window (MooEditor *editor,
MooEditWindow *window,
gboolean ask_confirm);
gboolean moo_editor_close_doc (MooEditor *editor,
MooEdit *doc,
gboolean ask_confirm);
gboolean moo_editor_close_docs (MooEditor *editor,
MooEditArray *docs,
gboolean ask_confirm);
gboolean moo_editor_close_all (MooEditor *editor,
gboolean leave_one,
gboolean ask_confirm);
MooEditWindowArray *moo_editor_get_windows (MooEditor *editor);
MooEditArray *moo_editor_get_docs (MooEditor *editor);
MooUiXml *moo_editor_get_ui_xml (MooEditor *editor);
void moo_editor_set_ui_xml (MooEditor *editor,
MooUiXml *xml);
MooUiXml *moo_editor_get_doc_ui_xml (MooEditor *editor);
gboolean moo_editor_close_window (MooEditor *editor,
MooEditWindow *window,
gboolean ask_confirm);
gboolean moo_editor_close_doc (MooEditor *editor,
MooEdit *doc,
gboolean ask_confirm);
gboolean moo_editor_close_docs (MooEditor *editor,
MooEditArray *docs,
gboolean ask_confirm);
gboolean _moo_editor_close_all (MooEditor *editor,
gboolean leave_one,
gboolean ask_confirm);
void moo_editor_set_window_type (MooEditor *editor,
GType type);
void moo_editor_set_doc_type (MooEditor *editor,
GType type);
MooUiXml *moo_editor_get_doc_ui_xml (MooEditor *editor);
MooUiXml *moo_editor_get_ui_xml (MooEditor *editor);
void moo_editor_set_ui_xml (MooEditor *editor,
MooUiXml *xml);
gboolean moo_editor_save_copy (MooEditor *editor,
MooEdit *doc,
const char *filename,
const char *encoding,
GError **error);
void moo_editor_set_window_type (MooEditor *editor,
GType type);
void moo_editor_set_doc_type (MooEditor *editor,
GType type);
void moo_editor_apply_prefs (MooEditor *editor);
void moo_editor_queue_apply_prefs (MooEditor *editor);
void _moo_editor_load_session (MooEditor *editor,
MooMarkupNode *xml);
void _moo_editor_save_session (MooEditor *editor,
MooMarkupNode *xml);
enum {
MOO_EDIT_OPEN_NEW_WINDOW = 1 << 0,
MOO_EDIT_OPEN_NEW_TAB = 1 << 1,
MOO_EDIT_OPEN_RELOAD = 1 << 2
};
void _moo_editor_open_uri (MooEditor *editor,
const char *filename,
const char *encoding,
guint line,
guint options);
void _moo_editor_load_session (MooEditor *editor,
MooMarkupNode *xml);
void _moo_editor_save_session (MooEditor *editor,
MooMarkupNode *xml);
G_END_DECLS

View File

@ -121,7 +121,7 @@ prefs_page_new (MooEditor *editor,
init_ui, init, apply);
g_signal_connect_swapped (prefs_page, "apply",
G_CALLBACK (moo_editor_queue_apply_prefs),
G_CALLBACK (_moo_editor_queue_apply_prefs),
editor);
return prefs_page;

View File

@ -8,24 +8,28 @@
G_BEGIN_DECLS
typedef struct _MooFileEnc MooFileEnc;
typedef struct MooEditOpenInfo MooEditOpenInfo;
typedef struct MooEditSaveInfo MooEditSaveInfo;
typedef struct MooEditReloadInfo MooEditReloadInfo;
typedef struct _MooEdit MooEdit;
typedef struct _MooEditWindow MooEditWindow;
typedef struct _MooEditor MooEditor;
typedef struct MooEdit MooEdit;
typedef struct MooEditWindow MooEditWindow;
typedef struct MooEditor MooEditor;
MOO_DECLARE_OBJECT_ARRAY (MooEditArray, moo_edit_array, MooEdit)
MOO_DECLARE_OBJECT_ARRAY (MooEditWindowArray, moo_edit_window_array, MooEditWindow)
MOO_DECLARE_OBJECT_ARRAY (MooEdit, moo_edit)
MOO_DECLARE_OBJECT_ARRAY (MooEditWindow, moo_edit_window)
MOO_DEFINE_SLIST (MooEditList, moo_edit_list, MooEdit)
MOO_DEFINE_SLIST (MooEditWindowList, moo_edit_window_list, MooEditWindow)
MOO_DECLARE_PTR_ARRAY (MooFileEncArray, moo_file_enc_array, MooFileEnc)
MOO_DECLARE_OBJECT_ARRAY (MooEditOpenInfo, moo_edit_open_info)
#define MOO_TYPE_LINE_END (moo_type_line_end ())
GType moo_type_line_end (void) G_GNUC_CONST;
#define MOO_EDIT_RELOAD_ERROR (moo_edit_reload_error_quark ())
#define MOO_EDIT_SAVE_ERROR (moo_edit_save_error_quark ())
MOO_DECLARE_QUARK (moo-edit-reload-error, moo_edit_reload_error_quark)
MOO_DECLARE_QUARK (moo-edit-save-error, moo_edit_save_error_quark)
G_END_DECLS

View File

@ -27,6 +27,7 @@
#define MOOEDIT_COMPILATION
#include "mooedit/mooedit-impl.h"
#include "mooedit/mooeditdialogs.h"
#include "mooedit/mooeditwindow-impl.h"
#include "mooedit/mooedit-accels.h"
#include "mooedit/mooeditor-impl.h"
@ -83,7 +84,7 @@ typedef struct {
static GHashTable *action_checks; /* char* -> ActionCheck* */
static GSList *windows;
struct _MooEditWindowPrivate {
struct MooEditWindowPrivate {
MooEditor *editor;
guint statusbar_idle;
@ -106,7 +107,7 @@ struct _MooEditWindowPrivate {
guint history_blocked : 1;
};
MOO_DEFINE_OBJECT_ARRAY (MooEditWindowArray, moo_edit_window_array, MooEditWindow)
MOO_DEFINE_OBJECT_ARRAY (MooEditWindow, moo_edit_window)
enum {
TARGET_MOO_EDIT_TAB = 1,
@ -629,7 +630,7 @@ moo_edit_window_class_init (MooEditWindowClass *klass)
"display-name", _("Comment"),
"label", _("Comment"),
"tooltip", _("Comment"),
"closure-callback", moo_edit_comment,
"closure-callback", _moo_edit_comment,
"closure-proxy-func", moo_edit_window_get_active_doc,
"condition::sensitive", "has-comments",
NULL);
@ -639,7 +640,7 @@ moo_edit_window_class_init (MooEditWindowClass *klass)
"display-name", _("Uncomment"),
"label", _("Uncomment"),
"tooltip", _("Uncomment"),
"closure-callback", moo_edit_uncomment,
"closure-callback", _moo_edit_uncomment,
"closure-proxy-func", moo_edit_window_get_active_doc,
"condition::sensitive", "has-comments",
NULL);
@ -1157,7 +1158,10 @@ action_new_doc (MooEditWindow *window)
static void
action_open (MooEditWindow *window)
{
moo_editor_open (window->priv->editor, window, GTK_WIDGET (window), NULL);
MooEdit *active = moo_edit_window_get_active_doc (window);
MooEditOpenInfoArray *files = _moo_edit_open_dialog (GTK_WIDGET (window), active);
moo_editor_open_files (window->priv->editor, files, GTK_WIDGET (window), NULL);
moo_edit_open_info_array_free (files);
}
@ -1166,7 +1170,7 @@ action_reload (MooEditWindow *window)
{
MooEdit *edit = ACTIVE_DOC (window);
g_return_if_fail (edit != NULL);
_moo_editor_reload (window->priv->editor, edit, NULL, NULL);
moo_edit_reload (edit, NULL, NULL);
}
@ -1176,11 +1180,13 @@ reopen_encoding_item_activated (const char *encoding,
{
MooEditWindow *window = data;
MooEdit *doc;
MooEditReloadInfo *info;
doc = ACTIVE_DOC (window);
g_return_if_fail (doc != NULL);
_moo_editor_reload (window->priv->editor, doc, encoding, NULL);
info = moo_edit_reload_info_new (encoding);
moo_edit_reload (doc, info, NULL);
}
static GtkAction *
@ -1333,7 +1339,7 @@ action_save (MooEditWindow *window)
{
MooEdit *edit = ACTIVE_DOC (window);
g_return_if_fail (edit != NULL);
_moo_editor_save (window->priv->editor, edit, NULL);
moo_editor_save (window->priv->editor, edit, NULL);
}
@ -1342,7 +1348,7 @@ action_save_as (MooEditWindow *window)
{
MooEdit *edit = ACTIVE_DOC (window);
g_return_if_fail (edit != NULL);
_moo_editor_save_as (window->priv->editor, edit, NULL, NULL, NULL);
moo_editor_save_as (window->priv->editor, edit, NULL, NULL);
}
@ -1768,7 +1774,7 @@ wrap_text_toggled (MooEditWindow *window,
{
MooEdit *doc = ACTIVE_DOC (window);
g_return_if_fail (doc != NULL);
moo_edit_ui_set_line_wrap_mode (doc, active);
_moo_edit_ui_set_line_wrap_mode (doc, active);
}
@ -1778,7 +1784,7 @@ line_numbers_toggled (MooEditWindow *window,
{
MooEdit *doc = ACTIVE_DOC (window);
g_return_if_fail (doc != NULL);
moo_edit_ui_set_show_line_numbers (doc, active);
_moo_edit_ui_set_show_line_numbers (doc, active);
}
@ -3864,8 +3870,7 @@ notebook_drag_data_recv (GtkWidget *widget,
{
char *filename = g_filename_from_uri (*u, NULL, NULL);
if (!filename || !g_file_test (filename, G_FILE_TEST_IS_DIR))
moo_editor_open_uri (window->priv->editor, window,
NULL, *u, NULL);
moo_editor_open_uri (window->priv->editor, *u, NULL, -1, window);
g_free (filename);
}

View File

@ -33,17 +33,17 @@ G_BEGIN_DECLS
#define MOO_IS_EDIT_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDIT_WINDOW))
#define MOO_EDIT_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDIT_WINDOW, MooEditWindowClass))
typedef struct _MooEditWindowPrivate MooEditWindowPrivate;
typedef struct _MooEditWindowClass MooEditWindowClass;
typedef struct MooEditWindowPrivate MooEditWindowPrivate;
typedef struct MooEditWindowClass MooEditWindowClass;
struct _MooEditWindow
struct MooEditWindow
{
MooWindow parent;
MooEditWindowPrivate *priv;
MooBigPaned *paned;
};
struct _MooEditWindowClass
struct MooEditWindowClass
{
MooWindowClass parent_class;

View File

@ -1,67 +0,0 @@
/**
* boxed:MooFileEnc:
**/
#include "config.h"
#include "moofileenc.h"
MOO_DEFINE_BOXED_TYPE_C (MooFileEnc, moo_file_enc)
MOO_DEFINE_PTR_ARRAY (MooFileEncArray, moo_file_enc_array, MooFileEnc,
moo_file_enc_copy, moo_file_enc_free)
/**
* moo_file_enc_new: (constructor-of MooFileEnc)
**/
MooFileEnc *
moo_file_enc_new (GFile *file,
const char *encoding)
{
MooFileEnc *fenc;
g_return_val_if_fail (G_IS_FILE (file), NULL);
fenc = g_slice_new0 (MooFileEnc);
fenc->file = g_file_dup (file);
fenc->encoding = g_strdup (encoding);
return fenc;
}
MooFileEnc *
moo_file_enc_copy (MooFileEnc *fenc)
{
g_return_val_if_fail (fenc != NULL, NULL);
return moo_file_enc_new (fenc->file, fenc->encoding);
}
void
moo_file_enc_free (MooFileEnc *fenc)
{
if (fenc)
{
g_object_unref (fenc->file);
g_free (fenc->encoding);
g_slice_free (MooFileEnc, fenc);
}
}
MooFileEnc *
moo_file_enc_new_for_path (const char *path,
const char *encoding)
{
GFile *file = g_file_new_for_path (path);
MooFileEnc *fenc = moo_file_enc_new (file, encoding);
g_object_unref (file);
return fenc;
}
MooFileEnc *
moo_file_enc_new_for_uri (const char *uri,
const char *encoding)
{
GFile *file = g_file_new_for_uri (uri);
MooFileEnc *fenc = moo_file_enc_new (file, encoding);
g_object_unref (file);
return fenc;
}

View File

@ -1,29 +0,0 @@
#ifndef MOO_FILE_INFO_H
#define MOO_FILE_INFO_H
#include <gio/gio.h>
#include <mooedit/mooedittypes.h>
G_BEGIN_DECLS
#define MOO_TYPE_FILE_ENC (moo_file_enc_get_type ())
struct _MooFileEnc {
GFile *file;
char *encoding;
};
GType moo_file_enc_get_type (void) G_GNUC_CONST;
MooFileEnc *moo_file_enc_new (GFile *file,
const char *encoding);
MooFileEnc *moo_file_enc_new_for_path (const char *path,
const char *encoding);
MooFileEnc *moo_file_enc_new_for_uri (const char *uri,
const char *encoding);
MooFileEnc *moo_file_enc_copy (MooFileEnc *fenc);
void moo_file_enc_free (MooFileEnc *fenc);
G_END_DECLS
#endif /* MOO_FILE_INFO_H */

View File

@ -27,9 +27,9 @@ G_BEGIN_DECLS
#define MOO_FOLD_TAG "moo-fold-invisible"
typedef struct _MooFoldTree MooFoldTree;
typedef struct MooFoldTree MooFoldTree;
struct _MooFoldTree
struct MooFoldTree
{
MooFold *folds;
guint n_folds;
@ -37,7 +37,7 @@ struct _MooFoldTree
guint consistent : 1;
};
struct _MooFold
struct MooFold
{
GObject object;
@ -54,7 +54,7 @@ struct _MooFold
guint deleted : 1; /* alive just because of reference count */
};
struct _MooFoldClass
struct MooFoldClass
{
GObjectClass object_class;
};

View File

@ -29,10 +29,10 @@ G_BEGIN_DECLS
#define MOO_INDENTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_INDENTER, MooIndenterClass))
typedef struct _MooIndenter MooIndenter;
typedef struct _MooIndenterClass MooIndenterClass;
typedef struct MooIndenter MooIndenter;
typedef struct MooIndenterClass MooIndenterClass;
struct _MooIndenter
struct MooIndenter
{
GObject parent;
MooEdit *doc;
@ -41,7 +41,7 @@ struct _MooIndenter
guint indent;
};
struct _MooIndenterClass
struct MooIndenterClass
{
GObjectClass parent_class;

View File

@ -31,15 +31,15 @@ G_BEGIN_DECLS
#define MOO_IS_LANG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_LANG))
#define MOO_LANG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_LANG, MooLangClass))
typedef struct _MooLangPrivate MooLangPrivate;
typedef struct _MooLangClass MooLangClass;
typedef struct MooLangPrivate MooLangPrivate;
typedef struct MooLangClass MooLangClass;
struct _MooLang {
struct MooLang {
GtkSourceLanguage base;
MooLangPrivate *priv;
};
struct _MooLangClass {
struct MooLangClass {
GtkSourceLanguageClass base_class;
};

View File

@ -28,7 +28,7 @@ G_BEGIN_DECLS
#define MOO_LANG_NONE "none"
#define MOO_LANG_NONE_NAME "None"
typedef struct _MooLang MooLang;
typedef struct MooLang MooLang;
GType moo_lang_get_type (void) G_GNUC_CONST;

View File

@ -31,9 +31,9 @@ G_BEGIN_DECLS
#define MOO_IS_LANG_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_LANG_MGR))
#define MOO_LANG_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_LANG_MGR, MooLangMgrClass))
typedef struct _MooLangMgrClass MooLangMgrClass;
typedef struct MooLangMgrClass MooLangMgrClass;
struct _MooLangMgr {
struct MooLangMgr {
GObject base;
GtkSourceLanguageManager *lang_mgr;
@ -50,7 +50,7 @@ struct _MooLangMgr {
gboolean modified;
};
struct _MooLangMgrClass
struct MooLangMgrClass
{
GObjectClass base_class;
};

View File

@ -27,7 +27,7 @@ G_BEGIN_DECLS
#define MOO_LANG_MGR(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_LANG_MGR, MooLangMgr))
#define MOO_IS_LANG_MGR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_LANG_MGR))
typedef struct _MooLangMgr MooLangMgr;
typedef struct MooLangMgr MooLangMgr;
GType moo_lang_mgr_get_type (void) G_GNUC_CONST;

View File

@ -27,10 +27,10 @@
G_BEGIN_DECLS
typedef struct _LineBuffer LineBuffer;
typedef struct _BTData Line;
typedef struct LineBuffer LineBuffer;
typedef struct BTData Line;
struct _LineBuffer {
struct LineBuffer {
BTree *tree;
};

View File

@ -26,7 +26,7 @@
#include "mooutils/moocompat.h"
struct _MooLineMarkPrivate {
struct MooLineMarkPrivate {
GdkColor background;
GdkGC *background_gc;

View File

@ -36,22 +36,22 @@ G_BEGIN_DECLS
#define MOO_LINE_MARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_LINE_MARK, MooLineMarkClass))
typedef struct _MooTextBuffer MooTextBuffer;
typedef struct MooTextBuffer MooTextBuffer;
typedef struct _MooFold MooFold;
typedef struct _MooFoldClass MooFoldClass;
typedef struct MooFold MooFold;
typedef struct MooFoldClass MooFoldClass;
typedef struct _MooLineMark MooLineMark;
typedef struct _MooLineMarkPrivate MooLineMarkPrivate;
typedef struct _MooLineMarkClass MooLineMarkClass;
typedef struct MooLineMark MooLineMark;
typedef struct MooLineMarkPrivate MooLineMarkPrivate;
typedef struct MooLineMarkClass MooLineMarkClass;
struct _MooLineMark
struct MooLineMark
{
GObject parent;
MooLineMarkPrivate *priv;
};
struct _MooLineMarkClass
struct MooLineMarkClass
{
GObjectClass parent_class;

View File

@ -21,7 +21,7 @@
G_BEGIN_DECLS
typedef struct _MooPluginLoader MooPluginLoader;
typedef struct MooPluginLoader MooPluginLoader;
typedef void (*MooLoadModuleFunc) (const char *module_file,
const char *ini_file,
@ -34,7 +34,7 @@ typedef void (*MooLoadPluginFunc) (const char *plugin_file,
gpointer data);
struct _MooPluginLoader
struct MooPluginLoader
{
MooLoadModuleFunc load_module;
MooLoadPluginFunc load_plugin;

View File

@ -53,15 +53,15 @@ G_BEGIN_DECLS
#define MOO_TYPE_PLUGIN_PARAMS (moo_plugin_params_get_type ())
typedef struct _MooPlugin MooPlugin;
typedef struct _MooPluginInfo MooPluginInfo;
typedef struct _MooPluginParams MooPluginParams;
typedef struct _MooPluginClass MooPluginClass;
typedef struct _MooWinPlugin MooWinPlugin;
typedef struct _MooWinPluginClass MooWinPluginClass;
typedef struct _MooDocPlugin MooDocPlugin;
typedef struct _MooDocPluginClass MooDocPluginClass;
typedef struct _MooPluginMeth MooPluginMeth;
typedef struct MooPlugin MooPlugin;
typedef struct MooPluginInfo MooPluginInfo;
typedef struct MooPluginParams MooPluginParams;
typedef struct MooPluginClass MooPluginClass;
typedef struct MooWinPlugin MooWinPlugin;
typedef struct MooWinPluginClass MooWinPluginClass;
typedef struct MooDocPlugin MooDocPlugin;
typedef struct MooDocPluginClass MooDocPluginClass;
typedef struct MooPluginMeth MooPluginMeth;
typedef gboolean (*MooModuleInitFunc) (void);
@ -88,7 +88,7 @@ typedef gboolean (*MooDocPluginCreateFunc) (MooDocPlugin *doc_plugin);
typedef void (*MooDocPluginDestroyFunc) (MooDocPlugin *doc_plugin);
struct _MooPluginMeth
struct MooPluginMeth
{
GType ptype;
GType return_type;
@ -98,13 +98,13 @@ struct _MooPluginMeth
};
struct _MooPluginParams
struct MooPluginParams
{
gboolean enabled;
gboolean visible;
};
struct _MooPluginInfo
struct MooPluginInfo
{
char *name;
char *description;
@ -112,7 +112,7 @@ struct _MooPluginInfo
char *version;
};
struct _MooPlugin
struct MooPlugin
{
GObject parent;
@ -127,14 +127,14 @@ struct _MooPlugin
GType doc_plugin_type;
};
struct _MooWinPlugin
struct MooWinPlugin
{
GObject parent;
MooEditWindow *window;
MooPlugin *plugin;
};
struct _MooDocPlugin
struct MooDocPlugin
{
GObject parent;
MooEditWindow *window;
@ -142,7 +142,7 @@ struct _MooDocPlugin
MooPlugin *plugin;
};
struct _MooPluginClass
struct MooPluginClass
{
GObjectClass parent_class;
@ -168,7 +168,7 @@ struct _MooPluginClass
GtkWidget *(*create_prefs_page) (MooPlugin *plugin);
};
struct _MooWinPluginClass
struct MooWinPluginClass
{
GObjectClass parent_class;
@ -178,7 +178,7 @@ struct _MooWinPluginClass
void (*destroy) (MooWinPlugin *win_plugin);
};
struct _MooDocPluginClass
struct MooDocPluginClass
{
GObjectClass parent_class;

View File

@ -44,7 +44,7 @@ MOO_DEBUG_INIT(printing, TRUE)
#define PRINTER_SCALE (1.)
#endif
struct _MooPrintPreviewPrivate {
struct MooPrintPreviewPrivate {
MooPrintOperation *op;
GtkPrintContext *context;
GtkPrintOperationPreview *gtk_preview;

View File

@ -32,19 +32,19 @@ G_BEGIN_DECLS
#define MOO_IS_PRINT_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_PRINT_PREVIEW))
#define MOO_PRINT_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_PRINT_PREVIEW, MooPrintPreviewClass))
typedef struct _MooPrintPreview MooPrintPreview;
typedef struct _MooPrintPreviewPrivate MooPrintPreviewPrivate;
typedef struct _MooPrintPreviewClass MooPrintPreviewClass;
typedef struct MooPrintPreview MooPrintPreview;
typedef struct MooPrintPreviewPrivate MooPrintPreviewPrivate;
typedef struct MooPrintPreviewClass MooPrintPreviewClass;
#define MOO_PRINT_PREVIEW_RESPONSE_PRINT GTK_RESPONSE_APPLY
struct _MooPrintPreview
struct MooPrintPreview
{
GtkDialog base;
MooPrintPreviewPrivate *priv;
};
struct _MooPrintPreviewClass
struct MooPrintPreviewClass
{
GtkDialogClass base_class;
};

View File

@ -31,15 +31,15 @@ G_BEGIN_DECLS
#define BTREE_MAX_DEPTH 9 /* 2^(3*(9-1)) == 2^24 > 16,777,216 - more than enough */
#define BTREE_MAX_DEPTH_EXP 4 /* 2^4 > 8 */
typedef struct _BTNode BTNode;
typedef struct _BTData BTData;
typedef struct _BTIter BTIter;
typedef struct _BTree BTree;
typedef struct BTNode BTNode;
typedef struct BTData BTData;
typedef struct BTIter BTIter;
typedef struct BTree BTree;
struct _MooLineMark;
struct MooLineMark;
struct _BTNode {
struct BTNode {
BTNode *parent;
guint n_marks;
@ -53,14 +53,14 @@ struct _BTNode {
guint count : (30 - BTREE_NODE_EXP);
};
struct _BTData {
struct BTData {
BTNode *parent;
guint n_marks;
struct _MooLineMark **marks;
struct MooLineMark **marks;
};
struct _BTree {
struct BTree {
BTNode *root;
guint depth;
guint stamp;

View File

@ -28,7 +28,7 @@
#include <string.h>
struct _MooTextBufferPrivate {
struct MooTextBufferPrivate {
gboolean has_selection;
gboolean has_text;

View File

@ -31,17 +31,17 @@ G_BEGIN_DECLS
#define MOO_TEXT_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_TEXT_BUFFER, MooTextBufferClass))
typedef struct _MooTextBufferPrivate MooTextBufferPrivate;
typedef struct _MooTextBufferClass MooTextBufferClass;
typedef struct MooTextBufferPrivate MooTextBufferPrivate;
typedef struct MooTextBufferClass MooTextBufferClass;
struct _MooTextBuffer
struct MooTextBuffer
{
GtkTextBuffer parent;
MooTextBufferPrivate *priv;
};
struct _MooTextBufferClass
struct MooTextBufferClass
{
GtkTextBufferClass parent_class;

View File

@ -33,10 +33,10 @@ G_BEGIN_DECLS
#define MOO_FIND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_FIND, MooFindClass))
typedef struct _MooFind MooFind;
typedef struct _MooFindClass MooFindClass;
typedef struct MooFind MooFind;
typedef struct MooFindClass MooFindClass;
struct _MooFind
struct MooFind
{
GtkDialog base;
struct MooFindBoxXml *xml;
@ -44,7 +44,7 @@ struct _MooFind
guint replace : 1;
};
struct _MooFindClass
struct MooFindClass
{
GtkDialogClass base_class;
};

View File

@ -71,7 +71,7 @@ typedef struct {
double ln_space;
} Page;
struct _MooPrintOperationPrivate {
struct MooPrintOperationPrivate {
GtkWindow *parent;
GtkTextView *doc;
GtkTextBuffer *buffer;
@ -107,7 +107,7 @@ G_STMT_START { \
#define GET_OPTION(op, opt) (((op)->priv->settings->flags & (opt)) != 0)
typedef struct _HFFormat HFFormat;
typedef struct HFFormat HFFormat;
static HFFormat *hf_format_parse (const char *strformat);
static void hf_format_free (HFFormat *format);
static char *hf_format_eval (HFFormat *format,
@ -1984,7 +1984,7 @@ typedef struct {
char *string;
} HFFormatChunk;
struct _HFFormat {
struct HFFormat {
GSList *chunks;
};

View File

@ -32,17 +32,17 @@ G_BEGIN_DECLS
#define MOO_IS_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_PRINT_OPERATION))
#define MOO_PRINT_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_PRINT_OPERATION, MooPrintOperationClass))
typedef struct _MooPrintOperation MooPrintOperation;
typedef struct _MooPrintOperationPrivate MooPrintOperationPrivate;
typedef struct _MooPrintOperationClass MooPrintOperationClass;
typedef struct MooPrintOperation MooPrintOperation;
typedef struct MooPrintOperationPrivate MooPrintOperationPrivate;
typedef struct MooPrintOperationClass MooPrintOperationClass;
struct _MooPrintOperation
struct MooPrintOperation
{
GtkPrintOperation base;
MooPrintOperationPrivate *priv;
};
struct _MooPrintOperationClass
struct MooPrintOperationClass
{
GtkPrintOperationClass base_class;
};

View File

@ -30,8 +30,8 @@ G_BEGIN_DECLS
#define MOO_TEXT_STYLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOO_TYPE_TEXT_STYLE, MooTextStyle))
#define MOO_IS_TEXT_STYLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOO_TYPE_TEXT_STYLE))
typedef struct _MooTextStyle MooTextStyle;
typedef struct _MooTextStyleScheme MooTextStyleScheme;
typedef struct MooTextStyle MooTextStyle;
typedef struct MooTextStyleScheme MooTextStyleScheme;
GType moo_text_style_scheme_get_type (void) G_GNUC_CONST;
GType moo_text_style_get_type (void) G_GNUC_CONST;

View File

@ -97,7 +97,7 @@ typedef struct {
char *text;
} MooTextViewClipboard;
struct _MooTextViewPrivate {
struct MooTextViewPrivate {
gboolean constructed;
GType buffer_type;
GtkTextBuffer *buffer;

View File

@ -34,18 +34,18 @@ G_BEGIN_DECLS
#define MOO_TEXT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_TEXT_VIEW, MooTextViewClass))
typedef struct _MooTextView MooTextView;
typedef struct _MooTextViewPrivate MooTextViewPrivate;
typedef struct _MooTextViewClass MooTextViewClass;
typedef struct MooTextView MooTextView;
typedef struct MooTextViewPrivate MooTextViewPrivate;
typedef struct MooTextViewClass MooTextViewClass;
struct _MooTextView
struct MooTextView
{
GtkTextView parent;
MooTextViewPrivate *priv;
};
struct _MooTextViewClass
struct MooTextViewClass
{
GtkTextViewClass parent_class;

46
moo/moolua/Makefile.incl Normal file
View File

@ -0,0 +1,46 @@
moo_sources += \
moolua/medit-lua.h \
moolua/medit-lua.cpp \
moolua/moolua-tests.h \
moolua/moolua-tests.cpp \
moolua/moo-tests-lua.h \
moolua/moo-lua-api-util.h \
moolua/moo-lua-api-util.cpp \
moolua/moo-lua-api.cpp \
moolua/gtk-lua-api.cpp
genlua_files = \
$(top_srcdir)/api/genlua.py \
$(top_srcdir)/api/mpi/__init__.py \
$(top_srcdir)/api/mpi/module.py \
$(top_srcdir)/api/mpi/luawriter.py
include moolua/lua/Makefile.incl
EXTRA_DIST += moolua/lua-default-init.lua
built_moo_sources += moolua/lua-default-init.h
moolua/lua-default-init.h: moolua/lua-default-init.lua $(top_srcdir)/tools/xml2h.py
$(AM_V_at)$(MKDIR_P) moolua
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/tools/xml2h.py $(srcdir)/moolua/lua-default-init.lua moolua/lua-default-init.h.tmp LUA_DEFAULT_INIT \
&& mv moolua/lua-default-init.h.tmp moolua/lua-default-init.h
if MOO_DEV_MODE
BUILT_SOURCES += moolua/moo-lua-api.cpp
moolua/moo-lua-api.cpp: $(genlua_files) $(top_srcdir)/api/moo.xml $(srcdir)/moolua/gtk.xml
$(AM_V_at)$(MKDIR_P) moolua
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/genlua.py \
--include-header moo-lua-api.h \
--import $(srcdir)/moolua/gtk.xml \
$(top_srcdir)/api/moo.xml > moolua/moo-lua-api.cpp.tmp && \
mv moolua/moo-lua-api.cpp.tmp $(srcdir)/moolua/moo-lua-api.cpp
$(AM_V_at)rm -f moolua/moo-lua-api.cpp.tmp
BUILT_SOURCES += moolua/gtk-lua-api.cpp
moolua/gtk-lua-api.cpp: $(genlua_files) $(srcdir)/moolua/gtk.xml
$(AM_V_at)$(MKDIR_P) moolua
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/genlua.py $(srcdir)/moolua/gtk.xml > moolua/gtk-lua-api.cpp.tmp && \
mv moolua/gtk-lua-api.cpp.tmp $(srcdir)/moolua/gtk-lua-api.cpp
$(AM_V_at)rm -f moolua/gtk-lua-api.cpp.tmp
endif

View File

@ -0,0 +1,25 @@
#include "moo-lua-api-util.h"
// methods of GObject
// methods of GFile
// methods of GdkPixbuf
// methods of GtkObject
// methods of GtkAccelGroup
// methods of GtkWidget
void
gtk_lua_api_register (void)
{
static gboolean been_here = FALSE;
if (been_here)
return;
been_here = TRUE;
}

8
moo/moolua/gtk.xml Normal file
View File

@ -0,0 +1,8 @@
<module name="Gtk">
<class gtype_id="G_TYPE_OBJECT" name="GObject" parent="null" short_name='Object'/>
<class gtype_id="G_TYPE_FILE" name="GFile" parent="GObject" short_name='File'/>
<class gtype_id="GDK_TYPE_PIXBUF" name="GdkPixbuf" parent="GObject" short_name='Pixbuf'/>
<class gtype_id="GTK_TYPE_OBJECT" name="GtkObject" parent="GObject" short_name='Object'/>
<class gtype_id="GTK_TYPE_ACCEL_GROUP" name="GtkAccelGroup" parent="GObject" short_name='AccelGroup'/>
<class gtype_id="GTK_TYPE_WIDGET" name="GtkWidget" parent="GtkObject" short_name='Widget'/>
</module>

View File

@ -2,4 +2,4 @@ local _g = getfenv(0)
require("moo.builtin")._inject(_g)
local medit = require("medit")
_g.app = medit.get_app_obj()
_g.editor = _g.app.editor()
_g.editor = _g.app.get_editor()

View File

@ -0,0 +1,87 @@
AM_CPPFLAGS += -DLUA_USE_APICHECK
# -I$(moo_srcdir)/moolua/lua
if MOO_OS_DARWIN
AM_CPPFLAGS += -DLUA_USE_MACOSX
else !MOO_OS_DARWIN
if MOO_OS_WIN32
else !MOO_OS_WIN32
AM_CPPFLAGS += -DLUA_USE_POSIX -DLUA_USE_DLOPEN
moo_libadd += -ldl
endif !MOO_OS_WIN32
endif !MOO_OS_DARWIN
moo_sources += \
moolua/lua/lfs.h \
moolua/lua/lfs.cpp \
moolua/lua/moolua.h \
moolua/lua/moolua.cpp \
moolua/lua/luaall.cpp
EXTRA_DIST += \
moolua/lua/COPYRIGHT \
moolua/lua/lapi.c \
moolua/lua/lapi.h \
moolua/lua/lauxlib.c \
moolua/lua/lauxlib.h \
moolua/lua/lbaselib.c \
moolua/lua/lcode.c \
moolua/lua/lcode.h \
moolua/lua/ldblib.c \
moolua/lua/ldebug.c \
moolua/lua/ldebug.h \
moolua/lua/ldo.c \
moolua/lua/ldo.h \
moolua/lua/ldump.c \
moolua/lua/lfunc.c \
moolua/lua/lfunc.h \
moolua/lua/lgc.c \
moolua/lua/lgc.h \
moolua/lua/linit.c \
moolua/lua/liolib.c \
moolua/lua/llex.c \
moolua/lua/llex.h \
moolua/lua/llimits.h \
moolua/lua/lmathlib.c \
moolua/lua/lmem.c \
moolua/lua/lmem.h \
moolua/lua/loadlib.c \
moolua/lua/lobject.c \
moolua/lua/lobject.h \
moolua/lua/lopcodes.c \
moolua/lua/lopcodes.h \
moolua/lua/loslib.c \
moolua/lua/lparser.c \
moolua/lua/lparser.h \
moolua/lua/lstate.c \
moolua/lua/lstate.h \
moolua/lua/lstring.c \
moolua/lua/lstring.h \
moolua/lua/ltable.c \
moolua/lua/ltable.h \
moolua/lua/ltablib.c \
moolua/lua/ltm.c \
moolua/lua/ltm.h \
moolua/lua/lua.h \
moolua/lua/luaall.cpp \
moolua/lua/luaconf.h \
moolua/lua/lualib.h \
moolua/lua/lundump.c \
moolua/lua/lundump.h \
moolua/lua/lvm.c \
moolua/lua/lvm.h \
moolua/lua/lzio.c \
moolua/lua/lzio.h \
moolua/lua/README \
moolua/lua/slnudata.c \
moolua/lua/slnunico.c
luadir = $(MOO_DATA_DIR)/lua
EXTRA_DIST += moolua/lua/moo
install-data-local: install-lua-moo
uninstall-local: uninstall-lua-moo
install-lua-moo:
$(MKDIR_P) $(DESTDIR)$(luadir)/moo
cd $(srcdir) && $(INSTALL_DATA) moolua/lua/moo/*.lua $(DESTDIR)$(luadir)/moo/
uninstall-lua-moo:
rm -f $(DESTDIR)$(luadir)/moo/*.lua

Some files were not shown because too many files have changed in this diff Show More