medit/moo/mooedit/mooedit.h

134 lines
5.7 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
*
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@tamu.edu>
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
#include <mooedit/mootextview.h>
#include <mooedit/mooeditconfig.h>
2009-11-01 12:44:46 -08:00
#include <mooedit/mooedit-enums.h>
#include <mooutils/mooprefs.h>
2005-06-22 18:20:32 +00:00
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))
#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
2008-09-07 00:15:07 -05:00
typedef struct MooEdit MooEdit;
typedef struct MooEditPrivate MooEditPrivate;
typedef struct MooEditClass MooEditClass;
2008-09-07 00:15:07 -05:00
struct MooEdit
2005-06-22 18:20:32 +00:00
{
MooTextView parent;
MooEditConfig *config;
2005-06-22 18:20:32 +00:00
MooEditPrivate *priv;
};
2008-09-07 00:15:07 -05:00
struct MooEditClass
2005-06-22 18:20:32 +00: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;
GType moo_edit_file_info_get_type (void) G_GNUC_CONST;
2005-06-22 18:20:32 +00:00
char *moo_edit_get_uri (MooEdit *edit);
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);
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);
#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);
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
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);
2008-09-07 00:15:07 -05:00
typedef struct MooEditFileInfo MooEditFileInfo;
2008-09-15 03:59:22 -05:00
MooEditFileInfo *moo_edit_file_info_new_path (const char *path,
const char *encoding);
MooEditFileInfo *moo_edit_file_info_new_uri (const char *uri,
2008-09-07 00:15:07 -05:00
const char *encoding);
MooEditFileInfo *moo_edit_file_info_copy (MooEditFileInfo *info);
void moo_edit_file_info_free (MooEditFileInfo *info);
2005-06-22 18:20:32 +00:00
G_END_DECLS
#endif /* MOO_EDIT_H */