2006-05-21 18:11:05 -05:00
|
|
|
/*
|
2005-09-02 23:27:25 +00:00
|
|
|
* mooeditor.h
|
2005-06-22 18:20:32 +00:00
|
|
|
*
|
2010-12-21 20:15:45 -08:00
|
|
|
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@users.sourceforge.net>
|
2005-06-22 18:20:32 +00:00
|
|
|
*
|
2008-09-05 17:20:50 -05:00
|
|
|
* 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.
|
2005-06-22 18:20:32 +00:00
|
|
|
*
|
2008-09-05 17:20:50 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
|
2005-06-22 18:20:32 +00:00
|
|
|
*/
|
|
|
|
|
2007-06-10 04:06:03 -05:00
|
|
|
#ifndef MOO_EDITOR_H
|
|
|
|
#define MOO_EDITOR_H
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2010-12-18 23:58:18 -08:00
|
|
|
#include <mooedit/mooedit.h>
|
|
|
|
#include <mooedit/mooeditview.h>
|
2006-06-19 04:28:32 -05:00
|
|
|
#include <mooedit/mooeditwindow.h>
|
2010-12-12 02:29:20 -08:00
|
|
|
#include <mooedit/mooeditfileinfo.h>
|
2005-10-13 14:08:18 +00:00
|
|
|
#include <mooutils/moouixml.h>
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2010-12-09 00:51:40 -08:00
|
|
|
enum {
|
|
|
|
MOO_EDIT_RELOAD_ERROR_BUSY = 1,
|
|
|
|
MOO_EDIT_RELOAD_ERROR_UNTITLED,
|
|
|
|
MOO_EDIT_RELOAD_ERROR_CANCELLED
|
|
|
|
};
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2010-12-12 02:29:20 -08:00
|
|
|
enum {
|
|
|
|
MOO_EDIT_SAVE_ERROR_BUSY = 1,
|
|
|
|
MOO_EDIT_SAVE_ERROR_CANCELLED
|
|
|
|
};
|
|
|
|
|
2005-06-22 18:20:32 +00:00
|
|
|
#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))
|
|
|
|
#define MOO_IS_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOO_TYPE_EDITOR))
|
|
|
|
#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))
|
|
|
|
|
2010-12-12 02:29:20 -08:00
|
|
|
typedef struct MooEditorPrivate MooEditorPrivate;
|
|
|
|
typedef struct MooEditorClass MooEditorClass;
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2010-12-12 02:29:20 -08:00
|
|
|
struct MooEditor
|
2005-06-22 18:20:32 +00:00
|
|
|
{
|
2008-09-08 02:17:32 -05:00
|
|
|
GObject base;
|
|
|
|
MooEditorPrivate *priv;
|
2005-06-22 18:20:32 +00:00
|
|
|
};
|
|
|
|
|
2010-12-12 02:29:20 -08:00
|
|
|
struct MooEditorClass
|
2005-06-22 18:20:32 +00:00
|
|
|
{
|
2008-09-08 02:17:32 -05:00
|
|
|
GObjectClass base_class;
|
2007-06-24 12:16:36 -05:00
|
|
|
|
2011-01-21 03:12:18 -08:00
|
|
|
MooCloseResponse (*before_close_window) (MooEditor *editor,
|
|
|
|
MooEditWindow *window);
|
|
|
|
/**signal:MooEditor**/
|
|
|
|
void (*will_close_window) (MooEditor *editor,
|
|
|
|
MooEditWindow *window);
|
|
|
|
void (*after_close_window) (MooEditor *editor);
|
|
|
|
|
|
|
|
/**signal:MooEditor**/
|
|
|
|
MooCloseResponse (*will_close_doc) (MooEditor *editor,
|
|
|
|
MooEdit *doc);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2011-01-20 01:53:29 -08:00
|
|
|
/**signal:MooEditor**/
|
2011-01-21 03:12:18 -08:00
|
|
|
MooSaveResponse (*before_save) (MooEditor *editor,
|
|
|
|
MooEdit *doc,
|
|
|
|
GFile *file);
|
|
|
|
/**signal:MooEditor**/
|
|
|
|
void (*will_save) (MooEditor *editor,
|
|
|
|
MooEdit *doc,
|
|
|
|
GFile *file);
|
2011-01-20 01:53:29 -08:00
|
|
|
/**signal:MooEditor**/
|
2011-01-21 03:12:18 -08:00
|
|
|
void (*after_save) (MooEditor *editor,
|
|
|
|
MooEdit *doc);
|
2007-11-22 21:42:49 -06:00
|
|
|
};
|
|
|
|
|
2010-12-12 02:29:20 -08:00
|
|
|
|
|
|
|
GType moo_editor_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
MooEditor *moo_editor_instance (void);
|
2011-04-17 00:30:53 -07:00
|
|
|
MooEditor *moo_editor_create_instance (gboolean embedded);
|
2010-12-12 02:29:20 -08:00
|
|
|
|
|
|
|
MooEditWindow *moo_editor_new_window (MooEditor *editor);
|
|
|
|
MooEdit *moo_editor_new_doc (MooEditor *editor,
|
|
|
|
MooEditWindow *window);
|
2011-04-17 21:41:04 -07:00
|
|
|
MooEdit *moo_editor_create_doc (MooEditor *editor,
|
|
|
|
const char *path,
|
|
|
|
const char *encoding,
|
|
|
|
GError **error);
|
2010-12-12 02:29:20 -08:00
|
|
|
|
|
|
|
MooEdit *moo_editor_new_file (MooEditor *editor,
|
2011-01-10 02:31:07 -08:00
|
|
|
MooOpenInfo *info,
|
2010-12-12 02:29:20 -08:00
|
|
|
GtkWidget *parent,
|
|
|
|
GError **error);
|
|
|
|
MooEdit *moo_editor_open_file (MooEditor *editor,
|
2011-01-10 02:31:07 -08:00
|
|
|
MooOpenInfo *info,
|
2010-12-12 02:29:20 -08:00
|
|
|
GtkWidget *parent,
|
|
|
|
GError **error);
|
|
|
|
gboolean moo_editor_open_files (MooEditor *editor,
|
2011-01-10 02:31:07 -08:00
|
|
|
MooOpenInfoArray *files,
|
2010-12-12 02:29:20 -08:00
|
|
|
GtkWidget *parent,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
gboolean moo_editor_reload (MooEditor *editor,
|
|
|
|
MooEdit *doc,
|
2011-01-10 02:31:07 -08:00
|
|
|
MooReloadInfo *info,
|
2010-12-12 02:29:20 -08:00
|
|
|
GError **error);
|
|
|
|
|
|
|
|
gboolean moo_editor_save (MooEditor *editor,
|
|
|
|
MooEdit *doc,
|
|
|
|
GError **error);
|
|
|
|
gboolean moo_editor_save_as (MooEditor *editor,
|
|
|
|
MooEdit *doc,
|
2011-01-10 02:31:07 -08:00
|
|
|
MooSaveInfo *info,
|
2010-12-12 02:29:20 -08:00
|
|
|
GError **error);
|
|
|
|
gboolean moo_editor_save_copy (MooEditor *editor,
|
|
|
|
MooEdit *doc,
|
2011-01-10 02:31:07 -08:00
|
|
|
MooSaveInfo *info,
|
2010-12-12 02:29:20 -08:00
|
|
|
GError **error);
|
|
|
|
|
|
|
|
MooEdit *moo_editor_get_doc (MooEditor *editor,
|
2011-01-24 03:13:01 -08:00
|
|
|
const char *filename);
|
|
|
|
MooEdit *moo_editor_get_doc_for_file (MooEditor *editor,
|
2010-12-12 02:29:20 -08:00
|
|
|
GFile *file);
|
|
|
|
MooEdit *moo_editor_get_doc_for_uri (MooEditor *editor,
|
|
|
|
const char *uri);
|
|
|
|
|
|
|
|
MooEdit *moo_editor_get_active_doc (MooEditor *editor);
|
|
|
|
void moo_editor_set_active_doc (MooEditor *editor,
|
|
|
|
MooEdit *doc);
|
2010-12-18 23:58:18 -08:00
|
|
|
MooEditView *moo_editor_get_active_view (MooEditor *editor);
|
|
|
|
void moo_editor_set_active_view (MooEditor *editor,
|
|
|
|
MooEditView *view);
|
2010-12-12 02:29:20 -08:00
|
|
|
MooEditWindow *moo_editor_get_active_window (MooEditor *editor);
|
|
|
|
void moo_editor_set_active_window (MooEditor *editor,
|
|
|
|
MooEditWindow *window);
|
|
|
|
|
|
|
|
void moo_editor_present (MooEditor *editor,
|
|
|
|
guint32 stamp);
|
|
|
|
|
|
|
|
MooEditWindowArray *moo_editor_get_windows (MooEditor *editor);
|
|
|
|
MooEditArray *moo_editor_get_docs (MooEditor *editor);
|
|
|
|
|
|
|
|
gboolean moo_editor_close_window (MooEditor *editor,
|
2011-01-21 03:12:18 -08:00
|
|
|
MooEditWindow *window);
|
2010-12-12 02:29:20 -08:00
|
|
|
gboolean moo_editor_close_doc (MooEditor *editor,
|
2011-01-21 03:12:18 -08:00
|
|
|
MooEdit *doc);
|
2010-12-12 02:29:20 -08:00
|
|
|
gboolean moo_editor_close_docs (MooEditor *editor,
|
2011-01-21 03:12:18 -08:00
|
|
|
MooEditArray *docs);
|
|
|
|
gboolean _moo_editor_close_all (MooEditor *editor);
|
2010-12-12 02:29:20 -08:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
void moo_editor_set_window_type (MooEditor *editor,
|
|
|
|
GType type);
|
|
|
|
void moo_editor_set_doc_type (MooEditor *editor,
|
|
|
|
GType type);
|
|
|
|
|
|
|
|
void _moo_editor_load_session (MooEditor *editor,
|
|
|
|
MooMarkupNode *xml);
|
|
|
|
void _moo_editor_save_session (MooEditor *editor,
|
|
|
|
MooMarkupNode *xml);
|
2007-11-22 21:42:49 -06:00
|
|
|
|
|
|
|
|
2005-06-22 18:20:32 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2007-06-10 04:06:03 -05:00
|
|
|
#endif /* MOO_EDITOR_H */
|