2005-11-22 12:26:26 +00:00
|
|
|
/*
|
2007-05-28 16:07:30 +00:00
|
|
|
* editor.h - this file is part of Geany, a fast and lightweight IDE
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
2008-01-06 18:11:57 +00:00
|
|
|
* Copyright 2005-2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
|
|
|
* Copyright 2006-2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
2007-06-17 17:56:48 +00:00
|
|
|
* $Id$
|
2005-11-22 12:26:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GEANY_SCI_CB_H
|
|
|
|
#define GEANY_SCI_CB_H 1
|
|
|
|
|
2006-08-20 20:39:59 +00:00
|
|
|
#include "Scintilla.h"
|
|
|
|
#include "ScintillaWidget.h"
|
|
|
|
|
2008-04-23 16:47:42 +00:00
|
|
|
#define GEANY_WORDCHARS "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
|
|
|
#define GEANY_TOGGLE_MARK "~ "
|
|
|
|
#define GEANY_MAX_WORD_LENGTH 192
|
|
|
|
#define GEANY_MAX_AUTOCOMPLETE_WORDS 30
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* Note: Avoid using SSM in files not related to scintilla, use sciwrappers.h instead. */
|
2006-08-20 20:39:59 +00:00
|
|
|
#define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-06-12 15:16:17 +00:00
|
|
|
typedef enum
|
2007-05-29 16:30:54 +00:00
|
|
|
{
|
|
|
|
INDENT_NONE = 0,
|
|
|
|
INDENT_BASIC,
|
2007-08-29 15:14:07 +00:00
|
|
|
INDENT_CURRENTCHARS,
|
|
|
|
INDENT_MATCHBRACES
|
2007-06-12 15:16:17 +00:00
|
|
|
} IndentMode;
|
2007-05-29 16:30:54 +00:00
|
|
|
|
|
|
|
/* These are the default prefs when creating a new editor window.
|
2007-08-24 16:20:33 +00:00
|
|
|
* Some of these can be overridden per document.
|
|
|
|
* Remember to increment abi_version in plugindata.h when changing items. */
|
2007-08-03 15:05:53 +00:00
|
|
|
typedef struct EditorPrefs
|
2007-05-29 16:30:54 +00:00
|
|
|
{
|
2008-02-27 13:17:29 +00:00
|
|
|
/* display */
|
2007-05-29 16:30:54 +00:00
|
|
|
gboolean show_white_space;
|
|
|
|
gboolean show_indent_guide;
|
|
|
|
gboolean show_line_endings;
|
2007-08-24 16:20:33 +00:00
|
|
|
gint long_line_type;
|
|
|
|
gint long_line_column;
|
|
|
|
gchar *long_line_color;
|
2008-02-27 13:17:29 +00:00
|
|
|
gboolean show_markers_margin; /* view menu */
|
|
|
|
gboolean show_linenumber_margin; /* view menu */
|
|
|
|
gboolean show_scrollbars; /* hidden pref */
|
|
|
|
gboolean scroll_stop_at_last_line; /* hidden pref */
|
2007-08-24 16:20:33 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* behaviour */
|
2007-08-24 16:20:33 +00:00
|
|
|
gboolean line_wrapping;
|
|
|
|
gboolean use_indicators;
|
2007-05-29 16:30:54 +00:00
|
|
|
gboolean folding;
|
|
|
|
gboolean unfold_all_children;
|
|
|
|
gint tab_width;
|
|
|
|
gboolean use_tabs;
|
2008-02-27 13:17:29 +00:00
|
|
|
gboolean use_tab_to_indent; /* hidden pref */
|
2007-08-24 16:20:33 +00:00
|
|
|
IndentMode indent_mode;
|
2007-05-29 16:30:54 +00:00
|
|
|
gboolean disable_dnd;
|
2007-07-12 15:44:13 +00:00
|
|
|
gboolean smart_home_key;
|
2007-10-18 11:52:47 +00:00
|
|
|
gboolean newline_strip;
|
2007-08-24 16:20:33 +00:00
|
|
|
gboolean auto_complete_symbols;
|
|
|
|
gboolean auto_close_xml_tags;
|
2007-11-12 09:36:25 +00:00
|
|
|
gboolean complete_snippets;
|
2007-12-01 17:53:36 +00:00
|
|
|
gint symbolcompletion_min_chars;
|
2007-11-12 09:36:25 +00:00
|
|
|
gint symbolcompletion_max_height;
|
|
|
|
GHashTable *snippets;
|
2008-02-27 13:17:29 +00:00
|
|
|
gboolean brace_match_ltgt; /* whether to highlight < and > chars (hidden pref) */
|
|
|
|
gboolean use_gtk_word_boundaries; /* hidden pref */
|
|
|
|
gboolean complete_snippets_whilst_editing; /* hidden pref */
|
2007-10-17 12:27:07 +00:00
|
|
|
gboolean detect_tab_mode;
|
2008-05-09 12:13:29 +00:00
|
|
|
gint line_break_column;
|
2008-05-14 15:36:27 +00:00
|
|
|
gboolean auto_continue_multiline;
|
2007-05-29 16:30:54 +00:00
|
|
|
} EditorPrefs;
|
|
|
|
|
|
|
|
extern EditorPrefs editor_prefs;
|
|
|
|
|
|
|
|
|
2006-09-04 15:57:46 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2008-02-27 13:17:29 +00:00
|
|
|
gchar *current_word; /* holds word under the mouse or keyboard cursor */
|
|
|
|
gint click_pos; /* text position where the mouse was clicked */
|
2006-09-04 15:57:46 +00:00
|
|
|
} EditorInfo;
|
|
|
|
|
|
|
|
extern EditorInfo editor_info;
|
|
|
|
|
2006-07-16 22:02:31 +00:00
|
|
|
|
2007-06-17 17:56:48 +00:00
|
|
|
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton *event,
|
|
|
|
gpointer user_data);
|
2006-09-04 15:57:46 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data);
|
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
gboolean editor_start_auto_complete(gint idx, gint pos, gboolean force);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
void editor_close_block(gint idx, gint pos);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-11-12 09:36:25 +00:00
|
|
|
gboolean editor_complete_snippet(gint idx, gint pos);
|
2006-03-10 00:49:19 +00:00
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
void editor_auto_latex(gint idx, gint pos);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
void editor_show_macro_list(ScintillaObject *sci);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
gboolean editor_show_calltip(gint idx, gint pos);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
void editor_do_comment_toggle(gint idx);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-07-05 18:19:56 +00:00
|
|
|
void editor_do_comment(gint idx, gint line, gboolean allow_empty_lines, gboolean toggle);
|
2006-09-10 11:47:26 +00:00
|
|
|
|
2007-07-05 18:19:56 +00:00
|
|
|
gint editor_do_uncomment(gint idx, gint line, gboolean toggle);
|
2006-07-31 09:39:33 +00:00
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
void editor_highlight_braces(ScintillaObject *sci, gint cur_pos);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
gboolean editor_lexer_is_c_like(gint lexer);
|
2006-12-15 12:52:52 +00:00
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
gint editor_lexer_get_type_keyword_idx(gint lexer);
|
2006-12-16 17:18:53 +00:00
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
void editor_insert_multiline_comment(gint idx);
|
2007-01-06 15:03:53 +00:00
|
|
|
|
2007-10-17 12:27:07 +00:00
|
|
|
void editor_insert_alternative_whitespace(gint idx);
|
2007-03-25 20:51:45 +00:00
|
|
|
|
2007-07-16 15:42:12 +00:00
|
|
|
void editor_auto_line_indentation(gint idx, gint pos);
|
|
|
|
|
|
|
|
void editor_indentation_by_one_space(gint idx, gint pos, gboolean decrease);
|
|
|
|
|
2008-02-22 13:30:16 +00:00
|
|
|
gboolean editor_line_in_view(ScintillaObject *sci, gint line);
|
|
|
|
|
2007-07-17 16:27:49 +00:00
|
|
|
void editor_scroll_to_line(ScintillaObject *sci, gint line, gfloat percent_of_view);
|
|
|
|
|
2008-02-22 13:30:16 +00:00
|
|
|
void editor_display_current_line(gint idx, gfloat percent_of_view);
|
|
|
|
|
2008-02-20 11:24:23 +00:00
|
|
|
void editor_finalize(void);
|
2007-06-17 17:56:48 +00:00
|
|
|
|
2008-01-14 17:30:59 +00:00
|
|
|
|
|
|
|
/* General editing functions */
|
|
|
|
|
|
|
|
void editor_find_current_word(ScintillaObject *sci, gint pos, gchar *word, size_t wordlen,
|
|
|
|
const gchar *wc);
|
|
|
|
|
2008-03-23 16:29:43 +00:00
|
|
|
gchar *editor_get_default_selection(gint idx, gboolean use_current_word, const gchar *wordchars);
|
2008-01-14 17:30:59 +00:00
|
|
|
|
|
|
|
void editor_select_word(ScintillaObject *sci);
|
|
|
|
|
|
|
|
void editor_select_lines(ScintillaObject *sci, gboolean extra_line);
|
|
|
|
|
|
|
|
void editor_select_paragraph(ScintillaObject *sci);
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
#endif
|