2006-05-21 18:11:05 -05:00
|
|
|
/*
|
2005-10-13 14:08:18 +00:00
|
|
|
* mootextview-private.h
|
|
|
|
*
|
2010-12-21 20:15:45 -08:00
|
|
|
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@users.sourceforge.net>
|
2005-10-13 14:08:18 +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-10-13 14:08:18 +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-10-13 14:08:18 +00:00
|
|
|
*/
|
|
|
|
|
2007-06-10 04:06:03 -05:00
|
|
|
#ifndef MOO_TEXT_VIEW_PRIVATE_H
|
|
|
|
#define MOO_TEXT_VIEW_PRIVATE_H
|
2005-10-13 14:08:18 +00:00
|
|
|
|
|
|
|
#include "mooedit/mootextview.h"
|
2005-12-13 04:22:40 +00:00
|
|
|
#include "mooedit/mootextsearch.h"
|
2005-10-13 14:08:18 +00:00
|
|
|
#include "mooutils/moohistorylist.h"
|
2006-04-05 01:22:26 -05:00
|
|
|
#include <gtk/gtk.h>
|
2005-10-13 14:08:18 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* GtkTextView stuff
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2005-10-13 14:08:18 +00:00
|
|
|
void _moo_text_view_move_cursor (GtkTextView *text_view,
|
|
|
|
GtkMovementStep step,
|
|
|
|
gint count,
|
|
|
|
gboolean extend_selection);
|
2008-12-24 15:29:32 -06:00
|
|
|
void _moo_text_view_ensure_primary (GtkTextView *text_view);
|
2005-10-13 14:08:18 +00:00
|
|
|
void _moo_text_view_delete_from_cursor (GtkTextView *text_view,
|
|
|
|
GtkDeleteType type,
|
|
|
|
gint count);
|
|
|
|
int _moo_text_view_key_press_event (GtkWidget *widget,
|
|
|
|
GdkEventKey *event);
|
|
|
|
int _moo_text_view_key_release_event (GtkWidget *widget,
|
|
|
|
GdkEventKey *event);
|
|
|
|
int _moo_text_view_button_press_event (GtkWidget *widget,
|
|
|
|
GdkEventButton *event);
|
|
|
|
int _moo_text_view_button_release_event (GtkWidget *widget,
|
|
|
|
GdkEventButton *event);
|
|
|
|
int _moo_text_view_motion_event (GtkWidget *widget,
|
|
|
|
GdkEventMotion *event);
|
|
|
|
int _moo_text_view_extend_selection (MooTextView *view,
|
|
|
|
MooTextSelectionType type,
|
|
|
|
GtkTextIter *insert,
|
|
|
|
GtkTextIter *selection_bound);
|
|
|
|
|
|
|
|
void _moo_text_view_check_char_inserted (MooTextView *view);
|
2006-04-24 23:18:25 -05:00
|
|
|
int _moo_text_view_get_line_height (MooTextView *view);
|
2006-11-14 00:58:23 -06:00
|
|
|
void _moo_text_view_set_line_numbers_font (MooTextView *view,
|
|
|
|
const char *name);
|
2005-10-13 14:08:18 +00:00
|
|
|
|
2009-12-06 23:50:01 -08:00
|
|
|
void _moo_text_view_update_text_cursor (MooTextView *view,
|
|
|
|
int x,
|
|
|
|
int y);
|
|
|
|
|
2008-09-13 21:43:03 -05:00
|
|
|
extern gpointer _moo_text_view_parent_class;
|
2005-10-13 14:08:18 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
MOO_TEXT_VIEW_DRAG_NONE = 0,
|
|
|
|
MOO_TEXT_VIEW_DRAG_SELECT,
|
2007-04-06 13:22:44 -05:00
|
|
|
MOO_TEXT_VIEW_DRAG_DRAG,
|
|
|
|
MOO_TEXT_VIEW_DRAG_SELECT_LINES
|
2005-10-13 14:08:18 +00:00
|
|
|
} MooTextViewDragType;
|
|
|
|
|
2005-12-13 04:22:40 +00:00
|
|
|
typedef enum {
|
|
|
|
MOO_TEXT_VIEW_POS_LEFT,
|
|
|
|
MOO_TEXT_VIEW_POS_RIGHT,
|
|
|
|
MOO_TEXT_VIEW_POS_TOP,
|
|
|
|
MOO_TEXT_VIEW_POS_BOTTOM,
|
|
|
|
MOO_TEXT_VIEW_POS_INVALID
|
|
|
|
} MooTextViewPos;
|
|
|
|
|
2007-07-15 04:51:58 -05:00
|
|
|
typedef enum {
|
|
|
|
MOO_TEXT_VIEW_COLOR_CURRENT_LINE,
|
|
|
|
MOO_TEXT_VIEW_COLOR_RIGHT_MARGIN,
|
|
|
|
MOO_TEXT_VIEW_N_COLORS
|
|
|
|
} MooTextViewColor;
|
|
|
|
|
2008-05-15 17:25:53 -05:00
|
|
|
typedef struct {
|
|
|
|
MooTextView *view;
|
|
|
|
char *text;
|
|
|
|
} MooTextViewClipboard;
|
|
|
|
|
2010-12-12 02:29:20 -08:00
|
|
|
struct MooTextViewPrivate {
|
2005-10-13 14:08:18 +00:00
|
|
|
gboolean constructed;
|
2008-05-25 02:01:10 -05:00
|
|
|
GType buffer_type;
|
|
|
|
GtkTextBuffer *buffer;
|
2005-10-13 14:08:18 +00:00
|
|
|
|
2006-04-29 00:37:29 -05:00
|
|
|
GdkRectangle *update_rectangle;
|
|
|
|
gboolean in_expose;
|
|
|
|
guint update_idle;
|
2008-01-09 12:03:41 -06:00
|
|
|
guint move_cursor_idle;
|
2006-04-29 00:37:29 -05:00
|
|
|
|
2005-11-21 08:00:10 +00:00
|
|
|
/* Clipboard */
|
|
|
|
gboolean manage_clipboard;
|
2008-05-15 17:25:53 -05:00
|
|
|
MooTextViewClipboard *clipboard;
|
2005-11-21 08:00:10 +00:00
|
|
|
|
2009-12-06 23:50:01 -08:00
|
|
|
MooTextCursor text_cursor;
|
|
|
|
|
2005-11-21 08:00:10 +00:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Drawing
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2006-08-26 04:46:29 -05:00
|
|
|
MooTextStyleScheme *style_scheme;
|
2006-06-17 04:08:25 -05:00
|
|
|
guint tab_width;
|
2007-07-15 04:51:58 -05:00
|
|
|
gboolean color_settings[MOO_TEXT_VIEW_N_COLORS];
|
|
|
|
char *colors[MOO_TEXT_VIEW_N_COLORS];
|
2016-10-02 21:14:12 -07:00
|
|
|
GdkGC *gcs[MOO_TEXT_VIEW_N_COLORS];
|
2007-07-15 04:51:58 -05:00
|
|
|
guint right_margin_offset;
|
|
|
|
int right_margin_pixel_offset;
|
2011-01-21 03:12:18 -08:00
|
|
|
MooDrawWsFlags draw_whitespace;
|
2005-12-08 22:46:03 +00:00
|
|
|
gboolean highlight_matching_brackets;
|
|
|
|
gboolean highlight_mismatching_brackets;
|
2010-12-21 22:06:14 -08:00
|
|
|
gboolean highlight_current_line_unfocused;
|
2005-10-13 14:08:18 +00:00
|
|
|
|
2006-11-23 20:09:41 -06:00
|
|
|
struct {
|
|
|
|
gboolean show_icons;
|
|
|
|
int icon_width;
|
|
|
|
gboolean show_numbers;
|
|
|
|
int digit_width;
|
2007-04-06 13:22:44 -05:00
|
|
|
int numbers_width;
|
2006-11-23 20:09:41 -06:00
|
|
|
PangoFontDescription *numbers_font;
|
|
|
|
gboolean show_folds;
|
|
|
|
int fold_width;
|
|
|
|
} lm;
|
2005-12-09 13:56:12 +00:00
|
|
|
|
2006-11-23 20:09:41 -06:00
|
|
|
int n_lines;
|
|
|
|
guint update_n_lines_idle;
|
2005-12-11 04:23:32 +00:00
|
|
|
|
2005-12-12 10:58:25 +00:00
|
|
|
gboolean enable_folding;
|
2006-11-23 20:09:41 -06:00
|
|
|
GSList *line_marks;
|
2005-12-12 10:58:25 +00:00
|
|
|
|
2005-10-13 14:08:18 +00:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Search
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2005-10-13 14:08:18 +00:00
|
|
|
int last_search_stamp;
|
|
|
|
GtkTextMark *last_found_start, *last_found_end;
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Indentation
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2005-10-13 14:08:18 +00:00
|
|
|
MooIndenter *indenter;
|
|
|
|
gboolean backspace_indents;
|
|
|
|
gboolean enter_indents;
|
2007-12-02 12:19:02 -06:00
|
|
|
gboolean tab_indents;
|
2005-10-13 14:08:18 +00:00
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Keyboard
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2005-11-11 20:08:24 +00:00
|
|
|
gboolean smart_home_end;
|
2005-10-13 14:08:18 +00:00
|
|
|
gboolean ctrl_up_down_scrolls;
|
|
|
|
gboolean ctrl_page_up_down_scrolls;
|
|
|
|
/* key press handler sets this flag in order to distinguish typed in
|
|
|
|
characters in buffer's insert-text signal */
|
|
|
|
gboolean in_key_press;
|
2008-09-18 21:23:33 -05:00
|
|
|
char *char_inserted;
|
2006-04-25 02:30:28 -05:00
|
|
|
int char_inserted_offset;
|
2005-10-13 14:08:18 +00:00
|
|
|
|
2008-01-06 12:50:09 -06:00
|
|
|
gunichar *word_chars;
|
|
|
|
guint n_word_chars;
|
|
|
|
|
2005-10-13 14:08:18 +00:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Selection and drag
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2007-04-06 13:22:44 -05:00
|
|
|
struct {
|
|
|
|
guint scroll_timeout;
|
|
|
|
GdkEventType button;
|
|
|
|
MooTextViewDragType type;
|
|
|
|
int start_x; /* buffer coordinates */
|
|
|
|
int start_y; /* buffer coordinates */
|
2007-04-08 10:12:07 -05:00
|
|
|
GtkTextMark *start_mark;
|
2007-04-06 13:22:44 -05:00
|
|
|
guint moved : 1;
|
|
|
|
guint double_click_selects_brackets : 1;
|
|
|
|
guint double_click_selects_inside : 1;
|
|
|
|
} dnd;
|
2005-11-18 05:13:25 +00:00
|
|
|
|
2005-12-13 04:22:40 +00:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Children
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2006-04-01 00:11:58 -06:00
|
|
|
GtkWidget *children[4];
|
2005-12-13 04:22:40 +00:00
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Search
|
2006-12-04 04:54:12 -06:00
|
|
|
*/
|
2006-04-05 01:22:26 -05:00
|
|
|
struct {
|
|
|
|
gboolean enable;
|
|
|
|
gboolean in_search;
|
|
|
|
GtkWidget *evbox;
|
|
|
|
GtkWidget *entry;
|
|
|
|
GtkToggleButton *case_sensitive;
|
|
|
|
GtkToggleButton *regex;
|
|
|
|
MooTextSearchFlags flags;
|
|
|
|
} qs;
|
2005-11-18 05:13:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
DND_TARGET_TEXT = 1
|
2005-10-13 14:08:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2007-06-10 04:06:03 -05:00
|
|
|
#endif /* MOO_TEXT_VIEW_PRIVATE_H */
|