2006-05-21 18:11:05 -05:00
|
|
|
/*
|
2005-09-06 16:21:05 +00:00
|
|
|
* mooedit-private.h
|
2005-06-22 18:20:32 +00:00
|
|
|
*
|
2008-01-07 03:34:52 -06:00
|
|
|
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@tamu.edu>
|
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-07-24 04:58:57 +00:00
|
|
|
*/
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
#ifndef MOOEDIT_COMPILATION
|
|
|
|
#error "Do not include this file"
|
|
|
|
#endif
|
|
|
|
|
2007-06-10 04:06:03 -05:00
|
|
|
#ifndef MOO_EDIT_PRIVATE_H
|
|
|
|
#define MOO_EDIT_PRIVATE_H
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2006-11-25 15:03:17 -06:00
|
|
|
#include "mooedit/moolinemark.h"
|
2005-06-22 18:20:32 +00:00
|
|
|
#include "mooedit/mooeditor.h"
|
2005-09-09 09:40:10 +00:00
|
|
|
#include "mooedit/mootextview.h"
|
2008-02-20 06:52:05 -06:00
|
|
|
#include "mooutils/mdhistorymgr.h"
|
2008-09-15 03:59:22 -05:00
|
|
|
#include <gio/gio.h>
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2006-06-30 00:58:35 -05:00
|
|
|
#define PROGRESS_TIMEOUT 100
|
|
|
|
#define PROGRESS_WIDTH 300
|
|
|
|
#define PROGRESS_HEIGHT 100
|
|
|
|
|
|
|
|
|
2006-04-20 03:57:05 -05:00
|
|
|
extern GSList *_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);
|
|
|
|
|
|
|
|
void _moo_edit_do_popup (MooEdit *edit,
|
|
|
|
GdkEventButton *event);
|
|
|
|
|
2006-04-29 22:54:03 -05:00
|
|
|
gboolean _moo_edit_has_comments (MooEdit *edit,
|
|
|
|
gboolean *single_line,
|
|
|
|
gboolean *multi_line);
|
|
|
|
|
2006-11-25 15:03:17 -06:00
|
|
|
#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);
|
2007-11-27 22:22:57 -06:00
|
|
|
void _moo_edit_update_bookmarks_style(MooEdit *edit);
|
2006-11-25 15:03:17 -06:00
|
|
|
|
2008-02-20 06:52:05 -06:00
|
|
|
void _moo_edit_history_item_set_encoding (MdHistoryItem *item,
|
|
|
|
const char *encoding);
|
|
|
|
void _moo_edit_history_item_set_line (MdHistoryItem *item,
|
|
|
|
int line);
|
|
|
|
const char *_moo_edit_history_item_get_encoding (MdHistoryItem *item);
|
|
|
|
int _moo_edit_history_item_get_line (MdHistoryItem *item);
|
|
|
|
|
2006-04-20 03:57:05 -05:00
|
|
|
|
2005-06-22 18:20:32 +00:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Preferences
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2006-07-27 14:39:53 -05:00
|
|
|
enum {
|
|
|
|
MOO_EDIT_SETTING_LANG,
|
|
|
|
MOO_EDIT_SETTING_INDENT,
|
|
|
|
MOO_EDIT_SETTING_STRIP,
|
2007-12-24 10:24:33 -06:00
|
|
|
MOO_EDIT_SETTING_ADD_NEWLINE,
|
2006-07-27 14:39:53 -05:00
|
|
|
MOO_EDIT_SETTING_WRAP_MODE,
|
|
|
|
MOO_EDIT_SETTING_SHOW_LINE_NUMBERS,
|
|
|
|
MOO_EDIT_SETTING_TAB_WIDTH,
|
2008-01-06 12:50:09 -06:00
|
|
|
MOO_EDIT_SETTING_WORD_CHARS,
|
2006-07-27 14:39:53 -05:00
|
|
|
MOO_EDIT_LAST_SETTING
|
|
|
|
};
|
|
|
|
|
|
|
|
extern guint *_moo_edit_settings;
|
|
|
|
|
|
|
|
void _moo_edit_update_global_config (void);
|
|
|
|
void _moo_edit_init_config (void);
|
|
|
|
void _moo_edit_update_lang_config (void);
|
|
|
|
|
|
|
|
void _moo_edit_apply_prefs (MooEdit *edit);
|
2005-11-24 14:14:48 +00:00
|
|
|
|
|
|
|
|
2005-06-22 18:20:32 +00:00
|
|
|
/***********************************************************************/
|
|
|
|
/* File operations
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2008-09-15 03:59:22 -05:00
|
|
|
GFile *_moo_edit_get_file (MooEdit *edit);
|
|
|
|
|
|
|
|
void _moo_edit_set_file (MooEdit *edit,
|
|
|
|
GFile *file,
|
2006-07-14 22:30:45 -05:00
|
|
|
const char *encoding);
|
2007-11-26 00:13:17 -06:00
|
|
|
void _moo_edit_set_encoding (MooEdit *edit,
|
|
|
|
const char *encoding);
|
2007-11-29 19:53:33 -06:00
|
|
|
const char *_moo_edit_get_default_encoding (void);
|
2007-12-24 10:24:33 -06:00
|
|
|
void _moo_edit_ensure_newline (MooEdit *edit);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2006-07-14 22:30:45 -05:00
|
|
|
void _moo_edit_stop_file_watch (MooEdit *edit);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2006-07-14 22:30:45 -05:00
|
|
|
void _moo_edit_set_status (MooEdit *edit,
|
|
|
|
MooEditStatus status);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2006-06-30 00:58:35 -05:00
|
|
|
void _moo_edit_set_state (MooEdit *edit,
|
|
|
|
MooEditState state,
|
2006-07-14 22:30:45 -05:00
|
|
|
const char *text,
|
|
|
|
GDestroyNotify cancel,
|
|
|
|
gpointer data);
|
2006-06-30 00:58:35 -05:00
|
|
|
void _moo_edit_create_progress_dialog (MooEdit *edit);
|
|
|
|
void _moo_edit_set_progress_text (MooEdit *edit,
|
|
|
|
const char *text);
|
|
|
|
|
2007-07-07 07:34:41 -05:00
|
|
|
GdkPixbuf *_moo_edit_get_icon (MooEdit *edit,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GtkIconSize size);
|
|
|
|
|
2008-09-15 03:59:22 -05:00
|
|
|
#define MOO_EDIT_IS_UNTITLED(edit) (!(edit)->priv->file)
|
2007-07-07 07:34:41 -05:00
|
|
|
|
2008-09-07 00:15:07 -05:00
|
|
|
struct MooEditFileInfo {
|
2008-09-15 03:59:22 -05:00
|
|
|
GFile *file;
|
2007-07-07 07:34:41 -05:00
|
|
|
char *encoding;
|
|
|
|
};
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2006-04-05 13:55:48 -05:00
|
|
|
MOO_EDIT_LINE_END_NONE,
|
|
|
|
MOO_EDIT_LINE_END_UNIX,
|
|
|
|
MOO_EDIT_LINE_END_WIN32,
|
|
|
|
MOO_EDIT_LINE_END_MAC,
|
|
|
|
MOO_EDIT_LINE_END_MIX
|
2005-06-22 18:20:32 +00:00
|
|
|
} MooEditLineEndType;
|
|
|
|
|
2008-09-07 00:15:07 -05:00
|
|
|
struct MooEditPrivate {
|
2005-06-22 18:20:32 +00:00
|
|
|
MooEditor *editor;
|
|
|
|
|
|
|
|
gulong modified_changed_handler_id;
|
2006-04-26 23:04:41 -05:00
|
|
|
guint apply_config_idle;
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Document
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2008-09-15 03:59:22 -05:00
|
|
|
GFile *file;
|
2005-06-22 18:20:32 +00:00
|
|
|
char *filename;
|
|
|
|
char *display_filename;
|
|
|
|
char *display_basename;
|
|
|
|
|
|
|
|
char *encoding;
|
|
|
|
MooEditLineEndType line_end_type;
|
2005-09-02 23:27:25 +00:00
|
|
|
MooEditStatus status;
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2006-12-08 14:55:46 -06:00
|
|
|
guint file_monitor_id;
|
2005-06-22 18:20:32 +00:00
|
|
|
gulong focus_in_handler_id;
|
2005-10-13 14:08:18 +00:00
|
|
|
gboolean modified_on_disk;
|
|
|
|
gboolean deleted_from_disk;
|
2005-12-11 04:30:02 +00:00
|
|
|
|
2006-06-30 00:58:35 -05:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Progress dialog and stuff
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2006-06-30 00:58:35 -05:00
|
|
|
MooEditState state;
|
|
|
|
guint progress_timeout;
|
|
|
|
GtkWidget *progress;
|
|
|
|
GtkWidget *progressbar;
|
|
|
|
char *progress_text;
|
2006-07-14 22:30:45 -05:00
|
|
|
GDestroyNotify cancel_op;
|
|
|
|
gpointer cancel_data;
|
2006-06-30 00:58:35 -05:00
|
|
|
|
2005-12-11 04:30:02 +00:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Bookmarks
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2005-12-11 04:30:02 +00:00
|
|
|
gboolean enable_bookmarks;
|
|
|
|
GSList *bookmarks; /* sorted by line number */
|
|
|
|
guint update_bookmarks_idle;
|
2006-04-20 03:57:05 -05:00
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Actions
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2006-08-15 02:12:41 -05:00
|
|
|
MooActionCollection *actions;
|
2005-09-09 09:40:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-06-22 18:20:32 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2007-06-10 04:06:03 -05:00
|
|
|
#endif /* MOO_EDIT_PRIVATE_H */
|