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
|
|
|
*
|
2007-01-14 17:36:42 +00:00
|
|
|
* Copyright 2005-2007 Enrico Tröger <enrico.troeger@uvena.de>
|
2007-01-06 15:03:53 +00:00
|
|
|
* Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.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
|
|
|
#ifndef PLAT_GTK
|
|
|
|
# define PLAT_GTK 1 // needed for ScintillaWidget.h
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "Scintilla.h"
|
|
|
|
#include "ScintillaWidget.h"
|
|
|
|
|
2006-11-18 15:47:28 +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,
|
|
|
|
INDENT_ADVANCED
|
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.
|
|
|
|
* Some of these can be overridden per document. */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gboolean line_breaking;
|
2007-06-12 15:16:17 +00:00
|
|
|
IndentMode indent_mode;
|
2007-05-29 16:30:54 +00:00
|
|
|
gboolean use_indicators;
|
|
|
|
gboolean show_white_space;
|
|
|
|
gboolean show_indent_guide;
|
|
|
|
gboolean show_line_endings;
|
|
|
|
gboolean auto_complete_symbols;
|
|
|
|
gboolean auto_close_xml_tags;
|
|
|
|
gboolean auto_complete_constructs;
|
|
|
|
gboolean folding;
|
|
|
|
gboolean unfold_all_children;
|
|
|
|
gboolean show_scrollbars;
|
|
|
|
gint tab_width;
|
2007-06-17 17:56:48 +00:00
|
|
|
gint caret_blink_time;
|
2007-05-29 16:30:54 +00:00
|
|
|
gboolean use_tabs;
|
2007-06-26 15:41:27 +00:00
|
|
|
gint default_new_encoding;
|
|
|
|
gint default_open_encoding;
|
2007-05-29 16:30:54 +00:00
|
|
|
gboolean new_line;
|
|
|
|
gboolean replace_tabs;
|
|
|
|
gboolean trail_space;
|
|
|
|
gboolean disable_dnd;
|
2007-06-17 17:56:48 +00:00
|
|
|
GHashTable *auto_completions;
|
2007-05-29 16:30:54 +00:00
|
|
|
} EditorPrefs;
|
|
|
|
|
|
|
|
extern EditorPrefs editor_prefs;
|
|
|
|
|
|
|
|
|
2006-09-04 15:57:46 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *current_word; // holds word under the mouse or keyboard cursor
|
|
|
|
gint click_pos; // text position where the mouse was clicked
|
|
|
|
} EditorInfo;
|
|
|
|
|
|
|
|
extern EditorInfo editor_info;
|
|
|
|
|
2006-07-16 22:02:31 +00:00
|
|
|
|
2007-06-17 17:56:48 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *type; // represents in most cases the filetype(two exceptions: default and special)
|
|
|
|
gchar *name; // name of the key in config file, represents the entered text to complete
|
|
|
|
gchar *value;
|
|
|
|
} AutoCompletion;
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-04 15:57:46 +00:00
|
|
|
gboolean
|
|
|
|
on_editor_button_press_event (GtkWidget *widget,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2006-09-01 17:07:49 +00:00
|
|
|
// callback func called by all editors when a signal arises
|
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-05-28 16:07:30 +00:00
|
|
|
gboolean editor_auto_forif(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
|
|
|
|
2006-10-22 16:52:42 +00:00
|
|
|
/* Reads the word at given cursor position and writes it into the given buffer. The buffer will be
|
|
|
|
* NULL terminated in any case, even when the word is truncated because wordlen is too small.
|
2007-01-24 19:20:12 +00:00
|
|
|
* position can be -1, then the current position is used.
|
|
|
|
* wc are the wordchars to use, if NULL, GEANY_WORDCHARS will be used */
|
2007-05-28 16:07:30 +00:00
|
|
|
void editor_find_current_word(ScintillaObject *sci, gint pos, gchar *word, size_t wordlen,
|
2007-01-24 19:20:12 +00:00
|
|
|
const gchar *wc);
|
2006-08-20 20:39:59 +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
|
|
|
void editor_auto_table(ScintillaObject *sci, gint 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-05-28 16:07:30 +00:00
|
|
|
void editor_select_word(ScintillaObject *sci);
|
2007-03-22 15:51:39 +00:00
|
|
|
|
2007-07-07 15:12:13 +00:00
|
|
|
void editor_select_line(ScintillaObject *sci);
|
|
|
|
|
2007-07-06 10:16:51 +00:00
|
|
|
void editor_select_paragraph(ScintillaObject *sci);
|
|
|
|
|
2007-05-28 16:07:30 +00:00
|
|
|
void editor_insert_alternative_whitespace(ScintillaObject *sci);
|
2007-03-25 20:51:45 +00:00
|
|
|
|
2007-06-17 17:56:48 +00:00
|
|
|
void editor_finalize();
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
#endif
|