medit/moo/mooedit/mooedit.h

145 lines
6.1 KiB
C
Raw Normal View History

2006-04-20 03:57:05 -05:00
/*
2005-09-06 16:21:05 +00:00
* mooedit.h
2005-06-22 18:20:32 +00:00
*
2010-11-07 01:20:45 -08:00
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@sourceforge.net>
2005-06-22 18:20:32 +00: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
*
* 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
*/
#ifndef MOO_EDIT_H
#define MOO_EDIT_H
2005-06-22 18:20:32 +00:00
2010-12-08 01:11:51 -08:00
#include <mooedit/mootextview.h>
#include <mooedit/mooeditconfig.h>
2009-11-01 12:44:46 -08:00
#include <mooedit/mooedit-enums.h>
2010-11-23 21:54:39 -08:00
#include <mooedit/mooedittypes.h>
#include <mooutils/mooprefs.h>
2005-06-22 18:20:32 +00:00
G_BEGIN_DECLS
2010-12-08 01:11:51 -08:00
#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))
#define MOO_IS_EDIT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_EDIT))
#define MOO_IS_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDIT))
#define MOO_EDIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDIT, MooEditClass))
2005-06-22 18:20:32 +00:00
2005-09-02 23:27:25 +00:00
#define MOO_EDIT_IS_MODIFIED(edit) (moo_edit_get_status (edit) & MOO_EDIT_MODIFIED)
#define MOO_EDIT_IS_CLEAN(edit) (moo_edit_get_status (edit) & MOO_EDIT_CLEAN)
2006-06-30 00:58:35 -05:00
#define MOO_EDIT_IS_BUSY(edit) (moo_edit_get_state (edit) != MOO_EDIT_STATE_NORMAL)
2005-06-22 18:20:32 +00:00
2010-12-08 01:11:51 -08:00
typedef struct MooEditPrivate MooEditPrivate;
typedef struct MooEditClass MooEditClass;
2010-12-08 01:11:51 -08:00
struct MooEdit
2005-06-22 18:20:32 +00:00
{
2010-12-08 01:11:51 -08:00
MooTextView parent;
MooEditConfig *config;
2005-06-22 18:20:32 +00:00
MooEditPrivate *priv;
};
2010-12-08 01:11:51 -08:00
struct MooEditClass
2005-06-22 18:20:32 +00:00
{
2010-12-08 01:11:51 -08:00
MooTextViewClass parent_class;
2005-06-22 18:20:32 +00:00
/* emitted when filename, modified status, or file on disk
are changed. for use in editor to adjust title bar, etc. */
void (* doc_status_changed) (MooEdit *edit);
2005-06-22 18:20:32 +00:00
void (* filename_changed) (MooEdit *edit,
const char *new_filename);
2005-11-04 01:35:22 +00:00
void (* bookmarks_changed) (MooEdit *edit);
void (* config_notify) (MooEdit *edit,
guint var_id,
GParamSpec *pspec);
void (* save_before) (MooEdit *edit);
void (* save_after) (MooEdit *edit);
2005-06-22 18:20:32 +00:00
};
GType moo_edit_get_type (void) G_GNUC_CONST;
2010-12-08 01:11:51 -08:00
GType moo_edit_file_info_get_type (void) G_GNUC_CONST;
2005-06-22 18:20:32 +00:00
2010-12-08 01:11:51 -08:00
MooEditWindow *moo_edit_get_window (MooEdit *edit);
2010-11-23 21:54:39 -08:00
GFile *moo_edit_get_file (MooEdit *edit);
char *moo_edit_get_uri (MooEdit *edit);
char *moo_edit_get_filename (MooEdit *edit);
2010-04-11 18:49:15 -07:00
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);
2005-06-22 18:20:32 +00:00
const char *moo_edit_get_encoding (MooEdit *edit);
2009-12-13 16:16:39 -08:00
void moo_edit_set_encoding (MooEdit *edit,
const char *encoding);
2010-09-02 18:18:33 -07:00
char *moo_edit_get_utf8_filename (MooEdit *edit);
2010-11-23 21:54:39 -08:00
MooLang *moo_edit_get_lang (MooEdit *edit);
2010-12-08 01:11:51 -08:00
MooEditor *moo_edit_get_editor (MooEdit *doc);
2009-12-13 16:16:39 -08:00
#ifdef __WIN32__
#define MOO_LE_DEFAULT MOO_LE_WIN32
#else
#define MOO_LE_DEFAULT MOO_LE_UNIX
#endif
MooLineEndType moo_edit_get_line_end_type (MooEdit *edit);
void moo_edit_set_line_end_type (MooEdit *edit,
MooLineEndType le);
2005-06-22 18:20:32 +00:00
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);
2010-12-08 01:11:51 -08:00
void moo_edit_status_changed (MooEdit *edit);
2006-06-30 00:58:35 -05:00
MooEditState moo_edit_get_state (MooEdit *edit);
2005-06-22 18:20:32 +00:00
2010-09-04 04:25:07 -07:00
void 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);
2005-11-11 20:04:17 +00:00
gboolean moo_edit_save_as (MooEdit *edit,
const char *filename,
const char *encoding,
GError **error);
2005-11-11 20:04:17 +00:00
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);
2010-12-08 01:11:51 -08:00
void moo_edit_ui_set_line_wrap_mode (MooEdit *edit,
gboolean enabled);
void moo_edit_ui_set_show_line_numbers (MooEdit *edit,
gboolean show);
2005-06-22 18:20:32 +00:00
G_END_DECLS
#endif /* MOO_EDIT_H */