2005-11-22 12:26:26 +00:00
|
|
|
/*
|
|
|
|
* sciwrappers.c - this file is part of Geany, a fast and lightweight IDE
|
|
|
|
*
|
2009-01-04 18:30:42 +00:00
|
|
|
* Copyright 2005-2009 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
|
|
|
* Copyright 2006-2009 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
|
2006-06-13 19:37:21 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
2005-12-01 22:50:05 +00:00
|
|
|
* $Id$
|
2005-11-22 12:26:26 +00:00
|
|
|
*/
|
|
|
|
|
2008-07-25 14:18:49 +00:00
|
|
|
/** @file sciwrappers.h
|
|
|
|
* Wrapper functions for the Scintilla editor widget @c SCI_* messages.
|
|
|
|
* You should also check the http://scintilla.org documentation, as it is more detailed.
|
|
|
|
* @note These functions were originally from the cssed project
|
|
|
|
* (http://cssed.sf.net, thanks).
|
|
|
|
* @see ScintillaFuncs::send_message().
|
2007-02-24 11:41:56 +00:00
|
|
|
*/
|
|
|
|
|
2005-12-29 19:50:50 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "geany.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
#include "sciwrappers.h"
|
2005-12-11 02:16:02 +00:00
|
|
|
#include "utils.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
/* line numbers visibility */
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_set_line_numbers(ScintillaObject *sci, gboolean set, gint extra_width)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
if (set)
|
|
|
|
{
|
|
|
|
gchar tmp_str[15];
|
|
|
|
gint len = SSM(sci, SCI_GETLINECOUNT, 0, 0);
|
|
|
|
gint width;
|
2009-07-24 15:44:14 +00:00
|
|
|
|
2009-10-16 11:07:49 +00:00
|
|
|
g_snprintf(tmp_str, 15, "_%d", len);
|
2009-07-24 15:44:14 +00:00
|
|
|
width = sci_text_width(sci, STYLE_LINENUMBER, tmp_str);
|
2009-10-16 11:07:49 +00:00
|
|
|
if (extra_width)
|
|
|
|
{
|
|
|
|
g_snprintf(tmp_str, 15, "%d", extra_width);
|
|
|
|
width += sci_text_width(sci, STYLE_LINENUMBER, tmp_str);
|
|
|
|
}
|
2009-10-14 16:00:40 +00:00
|
|
|
SSM(sci, SCI_SETMARGINWIDTHN, 0, width);
|
|
|
|
SSM(sci, SCI_SETMARGINSENSITIVEN, 0, FALSE); /* use default behaviour */
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-14 16:00:40 +00:00
|
|
|
SSM(sci, SCI_SETMARGINWIDTHN, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_set_mark_long_lines(ScintillaObject *sci, gint type, gint column, const gchar *colour)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-05 21:07:40 +00:00
|
|
|
if (column == 0)
|
|
|
|
type = 2;
|
2006-06-30 14:28:32 +00:00
|
|
|
switch (type)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2006-06-30 14:28:32 +00:00
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETEDGEMODE, EDGE_LINE, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETEDGEMODE, EDGE_BACKGROUND, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETEDGEMODE, EDGE_NONE, 0);
|
|
|
|
return;
|
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
2008-02-08 11:22:36 +00:00
|
|
|
SSM(sci, SCI_SETEDGECOLUMN, column, 0);
|
2006-07-27 20:57:13 +00:00
|
|
|
SSM(sci, SCI_SETEDGECOLOUR, utils_strtod(colour, NULL, TRUE), 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* symbol margin visibility */
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_set_symbol_margin(ScintillaObject *sci, gboolean set)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
if (set)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETMARGINWIDTHN, 1, 16);
|
|
|
|
SSM(sci, SCI_SETMARGINSENSITIVEN, 1, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-14 16:00:40 +00:00
|
|
|
SSM(sci, SCI_SETMARGINWIDTHN, 1, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
SSM(sci, SCI_SETMARGINSENSITIVEN, 1, FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
/* folding margin visibility */
|
2006-02-26 18:19:28 +00:00
|
|
|
void sci_set_folding_margin_visible(ScintillaObject *sci, gboolean set)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2006-02-26 18:19:28 +00:00
|
|
|
if (set)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETMARGINWIDTHN, 2, 12);
|
|
|
|
SSM(sci, SCI_SETMARGINSENSITIVEN, 2, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETMARGINSENSITIVEN, 2, FALSE);
|
|
|
|
SSM(sci, SCI_SETMARGINWIDTHN, 2, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
}
|
2006-01-23 17:10:01 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
/* end of lines */
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_set_visible_eols(ScintillaObject *sci, gboolean set)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_SETVIEWEOL, set, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
|
|
|
void sci_set_visible_white_spaces(ScintillaObject *sci, gboolean set)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-08-24 11:31:27 +00:00
|
|
|
if (set)
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_SETVIEWWS, SCWS_VISIBLEALWAYS, 0);
|
2007-08-24 11:31:27 +00:00
|
|
|
else
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_SETVIEWWS, SCWS_INVISIBLE, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
2006-01-23 17:10:01 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
|
|
|
void sci_set_lines_wrapped(ScintillaObject *sci, gboolean set)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-08-24 11:31:27 +00:00
|
|
|
if (set)
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_SETWRAPMODE, SC_WRAP_WORD, 0);
|
2007-08-24 11:31:27 +00:00
|
|
|
else
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_SETWRAPMODE, SC_WRAP_NONE, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
2006-01-23 17:10:01 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
|
|
|
gint sci_get_eol_mode(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETEOLMODE, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
|
|
|
void sci_set_eol_mode(ScintillaObject *sci, gint eolmode)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_SETEOLMODE, eolmode, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
|
|
|
void sci_convert_eols(ScintillaObject *sci, gint eolmode)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_CONVERTEOLS, eolmode, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_add_text(ScintillaObject *sci, const gchar *text)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-15 22:47:33 +00:00
|
|
|
if (text != NULL)
|
2009-10-14 15:40:12 +00:00
|
|
|
{ /* if null text is passed scintilla will segfault */
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_ADDTEXT, strlen(text), (sptr_t) text);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Set all text.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param text Text. */
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_set_text(ScintillaObject *sci, const gchar *text)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-02-27 13:17:29 +00:00
|
|
|
if( text != NULL ){ /* if null text is passed to scintilla will segfault */
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_SETTEXT, 0, (sptr_t) text);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
gboolean sci_can_undo(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_CANUNDO, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
gboolean sci_can_redo(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_CANREDO, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_undo(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
if (sci_can_undo(sci))
|
|
|
|
SSM(sci, SCI_UNDO, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_redo(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-10-19 11:50:36 +00:00
|
|
|
if (sci_can_redo(sci))
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_REDO, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-25 14:18:49 +00:00
|
|
|
/** Begin grouping a set of edits together as one Undo action.
|
|
|
|
* You must call sci_end_undo_action() after making your edits.
|
|
|
|
* @param sci Scintilla @c GtkWidget. */
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_start_undo_action(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_BEGINUNDOACTION, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-25 14:18:49 +00:00
|
|
|
/** End grouping a set of edits together as one Undo action.
|
|
|
|
* @param sci Scintilla @c GtkWidget.
|
|
|
|
* @see sci_start_undo_action(). */
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_end_undo_action(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_ENDUNDOACTION, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_set_undo_collection(ScintillaObject *sci, gboolean set)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_SETUNDOCOLLECTION, set, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_empty_undo_buffer(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_EMPTYUNDOBUFFER, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-24 13:41:34 +00:00
|
|
|
gboolean sci_is_modified(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
return (SSM(sci, SCI_GETMODIFY, 0, 0) != 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_zoom_in(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_ZOOMIN, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_zoom_out(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_ZOOMOUT, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_zoom_off(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_SETZOOM, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
gint sci_get_zoom(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETZOOM, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-12 17:39:49 +00:00
|
|
|
/** Set a line marker.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param line_number Line number.
|
|
|
|
* @param marker Marker number. */
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_set_marker_at_line(ScintillaObject *sci, gint line_number, gint marker)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_MARKERADD, line_number, marker);
|
2009-09-12 17:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Delete a line marker.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param line_number Line number.
|
|
|
|
* @param marker Marker number. */
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_delete_marker_at_line(ScintillaObject *sci, gint line_number, gint marker)
|
2009-09-12 17:39:49 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_MARKERDELETE, line_number, marker);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-12 17:39:49 +00:00
|
|
|
/** Check if a line has a marker set.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param line Line number.
|
|
|
|
* @param marker Marker number.
|
|
|
|
* @return Whether it's set. */
|
2009-09-13 15:33:04 +00:00
|
|
|
gboolean sci_is_marker_set_at_line(ScintillaObject *sci, gint line, gint marker)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
gint state;
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
state = SSM(sci, SCI_MARKERGET, line, 0);
|
2007-03-15 13:14:04 +00:00
|
|
|
return (state & (1 << marker));
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_toggle_marker_at_line(ScintillaObject *sci, gint line, gint marker)
|
2009-09-12 17:39:49 +00:00
|
|
|
{
|
|
|
|
gboolean set = sci_is_marker_set_at_line(sci, line, marker);
|
|
|
|
|
|
|
|
if (!set)
|
|
|
|
sci_set_marker_at_line(sci, line, marker);
|
|
|
|
else
|
|
|
|
sci_delete_marker_at_line(sci, line, marker);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-15 12:52:16 +00:00
|
|
|
/* Returns the line number of the next marker that matches marker_mask, or -1.
|
|
|
|
* marker_mask is a bitor of 1 << marker_index. (See MarkerHandleSet::MarkValue()).
|
|
|
|
* Note: If there is a marker on the line, it returns the same line. */
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_marker_next(ScintillaObject *sci, gint line, gint marker_mask, gboolean wrap)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
gint marker_line;
|
|
|
|
|
|
|
|
marker_line = SSM(sci, SCI_MARKERNEXT, line, marker_mask);
|
2007-03-15 12:52:16 +00:00
|
|
|
if (wrap && marker_line == -1)
|
|
|
|
marker_line = SSM(sci, SCI_MARKERNEXT, 0, marker_mask);
|
|
|
|
return marker_line;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-15 12:52:16 +00:00
|
|
|
/* Returns the line number of the previous marker that matches marker_mask, or -1.
|
|
|
|
* marker_mask is a bitor of 1 << marker_index. (See MarkerHandleSet::MarkValue()).
|
|
|
|
* Note: If there is a marker on the line, it returns the same line. */
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_marker_previous(ScintillaObject *sci, gint line, gint marker_mask, gboolean wrap)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
gint marker_line;
|
|
|
|
|
|
|
|
marker_line = SSM(sci, SCI_MARKERPREVIOUS, line, marker_mask);
|
2007-03-15 12:52:16 +00:00
|
|
|
if (wrap && marker_line == -1)
|
|
|
|
{
|
|
|
|
gint len = sci_get_length(sci);
|
|
|
|
gint last_line = sci_get_line_from_position(sci, len - 1);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-03-15 12:52:16 +00:00
|
|
|
marker_line = SSM(sci, SCI_MARKERPREVIOUS, last_line, marker_mask);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
2007-03-15 12:52:16 +00:00
|
|
|
return marker_line;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get line number from position.
|
|
|
|
* @param sci Scintilla widget.
|
2008-09-17 12:36:04 +00:00
|
|
|
* @param position Position. */
|
2009-09-16 14:13:38 +00:00
|
|
|
gint sci_get_line_from_position(ScintillaObject *sci, gint position)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
return SSM(sci, SCI_LINEFROMPOSITION, position, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get column number relative to the start of the line that @a position is on.
|
|
|
|
* @param sci Scintilla widget.
|
2008-09-17 12:36:04 +00:00
|
|
|
* @param position Position. */
|
2009-09-16 14:13:38 +00:00
|
|
|
gint sci_get_col_from_position(ScintillaObject *sci, gint position)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETCOLUMN, position, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get position for the start of @a line.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param line Line.
|
|
|
|
* @return Position. */
|
2009-09-16 14:13:38 +00:00
|
|
|
gint sci_get_position_from_line(ScintillaObject *sci, gint line)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
return SSM(sci, SCI_POSITIONFROMLINE, line, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get cursor position.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @return Position. */
|
2009-09-16 14:13:38 +00:00
|
|
|
gint sci_get_current_position(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETCURRENTPOS, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Set the cursor position.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param position Position.
|
|
|
|
* @param scroll_to_caret Whether to scroll the cursor in view. */
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_set_current_position(ScintillaObject *sci, gint position, gboolean scroll_to_caret)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-01-27 18:45:47 +00:00
|
|
|
if (scroll_to_caret)
|
|
|
|
SSM(sci, SCI_GOTOPOS, position, 0);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETCURRENTPOS, position, 0);
|
2008-02-27 13:17:29 +00:00
|
|
|
SSM(sci, SCI_SETANCHOR, position, 0); /* to avoid creation of a selection */
|
2007-01-27 18:45:47 +00:00
|
|
|
}
|
2008-02-28 16:41:23 +00:00
|
|
|
SSM(sci, SCI_CHOOSECARETX, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-22 17:29:45 +00:00
|
|
|
/* Set the cursor line without scrolling the view.
|
|
|
|
* Use sci_goto_line() to also scroll. */
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_set_current_line(ScintillaObject *sci, gint line)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-02-22 17:29:45 +00:00
|
|
|
gint pos = sci_get_position_from_line(sci, line);
|
|
|
|
sci_set_current_position(sci, pos, FALSE);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get total number of lines.
|
|
|
|
* @param sci Scintilla widget. */
|
2009-09-16 14:13:38 +00:00
|
|
|
gint sci_get_line_count(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETLINECOUNT, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Set selection start position.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param position Position. */
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_set_selection_start(ScintillaObject *sci, gint position)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETSELECTIONSTART, position, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Set selection end position.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param position Position. */
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_set_selection_end(ScintillaObject *sci, gint position)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETSELECTIONEND, position, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-18 14:51:37 +00:00
|
|
|
void sci_set_selection(ScintillaObject *sci, gint anchorPos, gint currentPos)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETSEL, anchorPos, currentPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_line_end_position(ScintillaObject *sci, gint line)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-02-16 16:38:23 +00:00
|
|
|
return SSM(sci, SCI_GETLINEENDPOSITION, line, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_cut(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_CUT, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_copy(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_COPY, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_paste(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_PASTE, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_clear(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_CLEAR, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get position of selection start.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @return Position. */
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_selection_start(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETSELECTIONSTART, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get position of selection end.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @return Position. */
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_selection_end(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETSELECTIONEND, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Replace selection.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param text Text. */
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_replace_sel(ScintillaObject *sci, const gchar *text)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_REPLACESEL, 0, (sptr_t) text);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get length of all text.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @return Length. */
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_length(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETLENGTH, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_lexer(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETLEXER, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get line length.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param line Line number.
|
|
|
|
* @return Length. */
|
2009-09-16 14:13:38 +00:00
|
|
|
gint sci_get_line_length(ScintillaObject *sci, gint line)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_LINELENGTH, line, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-28 16:32:22 +00:00
|
|
|
/* safe way to read Scintilla string into new memory.
|
|
|
|
* works with any string buffer messages that follow the Windows message convention. */
|
|
|
|
gchar *sci_get_string(ScintillaObject *sci, gint msg, gulong wParam)
|
|
|
|
{
|
|
|
|
gint size = SSM(sci, msg, wParam, 0) + 1;
|
|
|
|
gchar *str = g_malloc(size);
|
|
|
|
|
|
|
|
SSM(sci, msg, wParam, (sptr_t)str);
|
|
|
|
str[size - 1] = '\0'; /* ensure termination, needed for SCI_GETLINE */
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get line contents.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param line_num Line number.
|
|
|
|
* @return A @c NULL-terminated copy of the line text. */
|
2009-09-13 15:33:04 +00:00
|
|
|
gchar *sci_get_line(ScintillaObject *sci, gint line_num)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-10-28 16:32:22 +00:00
|
|
|
return sci_get_string(sci, SCI_GETLINE, line_num);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
2006-10-02 15:22:29 +00:00
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get all text.
|
2009-03-24 18:13:28 +00:00
|
|
|
* @deprecated sci_get_text is deprecated and should not be used in newly-written code.
|
|
|
|
* Use sci_get_contents() instead.
|
|
|
|
*
|
2008-09-16 15:37:50 +00:00
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param len Length of @a text buffer, usually sci_get_length() + 1.
|
|
|
|
* @param text Text buffer; must be allocated @a len + 1 bytes for null-termination. */
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_get_text(ScintillaObject *sci, gint len, gchar *text)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_GETTEXT, len, (sptr_t) text);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-03-24 18:13:28 +00:00
|
|
|
/** Get all text inside a given text length.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param len Length of the text to retrieve from the start of the document,
|
|
|
|
* usually sci_get_length() + 1.
|
|
|
|
* @return A copy of the text. Should be freed when no longer needed.
|
|
|
|
*
|
|
|
|
* @since 0.17
|
|
|
|
*/
|
|
|
|
gchar *sci_get_contents(ScintillaObject *sci, gint len)
|
|
|
|
{
|
|
|
|
gchar *text = g_malloc(len);
|
|
|
|
SSM(sci, SCI_GETTEXT, len, (sptr_t) text);
|
|
|
|
return text;
|
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get selected text.
|
2009-03-24 18:13:28 +00:00
|
|
|
* @deprecated sci_get_selected_text is deprecated and should not be used in newly-written code.
|
|
|
|
* Use sci_get_selection_contents() instead.
|
|
|
|
*
|
2008-09-16 15:37:50 +00:00
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param text Text buffer; must be allocated sci_get_selected_text_length() + 1 bytes
|
|
|
|
* for null-termination. */
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_get_selected_text(ScintillaObject *sci, gchar *text)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_GETSELTEXT, 0, (sptr_t) text);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-03-24 18:13:28 +00:00
|
|
|
/** Get selected text.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
*
|
|
|
|
* @return The selected text. Should be freed when no longer needed.
|
|
|
|
*
|
|
|
|
* @since 0.17
|
|
|
|
*/
|
|
|
|
gchar *sci_get_selection_contents(ScintillaObject *sci)
|
|
|
|
{
|
2009-10-28 16:32:22 +00:00
|
|
|
return sci_get_string(sci, SCI_GETSELTEXT, 0);
|
2009-03-24 18:13:28 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get selected text length.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @return Length. */
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_selected_text_length(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETSELTEXT, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_position_from_xy(ScintillaObject *sci, gint x, gint y, gboolean nearby)
|
2006-06-07 19:25:20 +00:00
|
|
|
{
|
2008-02-27 13:17:29 +00:00
|
|
|
/* for nearby return -1 if there is no character near to the x,y point. */
|
2006-06-07 19:25:20 +00:00
|
|
|
return SSM(sci, (nearby) ? SCI_POSITIONFROMPOINTCLOSE : SCI_POSITIONFROMPOINT, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Check if a line is visible (folding may have hidden it).
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param line Line number.
|
|
|
|
* @return Whether @a line will be drawn on the screen. */
|
2009-09-13 15:33:04 +00:00
|
|
|
gboolean sci_get_line_is_visible(ScintillaObject *sci, gint line)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETLINEVISIBLE, line, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Make the @a line visible (folding may have hidden it).
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param line Line number. */
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_ensure_line_is_visible(ScintillaObject *sci, gint line)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_ENSUREVISIBLE, line, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_fold_level(ScintillaObject *sci, gint line)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETFOLDLEVEL, line, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-12 16:24:34 +00:00
|
|
|
/* Get the line number of the fold point before start_line, or -1 if there isn't one */
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_fold_parent(ScintillaObject *sci, gint start_line)
|
2006-10-12 16:24:34 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETFOLDPARENT, start_line, 0);
|
2006-10-12 16:24:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_toggle_fold(ScintillaObject *sci, gint line)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_TOGGLEFOLD, line, 1);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
gboolean sci_get_fold_expanded(ScintillaObject *sci, gint line)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETFOLDEXPANDED, line, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
void sci_colourise(ScintillaObject *sci, gint start, gint end)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_COLOURISE, start, end);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_clear_all(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_CLEARALL, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_end_styled(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETENDSTYLED, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_set_tab_width(ScintillaObject *sci, gint width)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETTABWIDTH, width, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get display tab width (this is not indent width, see GeanyIndentPrefs).
|
|
|
|
* @param sci Scintilla widget.
|
2009-01-30 18:53:23 +00:00
|
|
|
* @return Width.
|
|
|
|
*
|
|
|
|
* @since 0.15
|
|
|
|
**/
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_tab_width(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETTABWIDTH, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get character.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param pos Position.
|
|
|
|
* @return Char. */
|
2005-11-22 12:26:26 +00:00
|
|
|
gchar sci_get_char_at(ScintillaObject *sci, gint pos)
|
|
|
|
{
|
2005-12-11 02:16:02 +00:00
|
|
|
return (gchar) SSM(sci, SCI_GETCHARAT, pos, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sci_set_savepoint(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETSAVEPOINT, 0, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-21 16:43:45 +00:00
|
|
|
void sci_set_indentation_guides(ScintillaObject *sci, gint mode)
|
2008-09-17 12:36:04 +00:00
|
|
|
{
|
2008-09-21 16:43:45 +00:00
|
|
|
SSM(sci, SCI_SETINDENTATIONGUIDES, mode, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sci_use_popup(ScintillaObject *sci, gboolean enable)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_USEPOPUP, enable, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Check if there's a selection.
|
|
|
|
* @param sci Scintilla widget.
|
2009-01-30 18:53:23 +00:00
|
|
|
* @return Whether a selection is present.
|
|
|
|
*
|
|
|
|
* @since 0.15
|
|
|
|
**/
|
2008-09-17 18:02:55 +00:00
|
|
|
gboolean sci_has_selection(ScintillaObject *sci)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
if (SSM(sci, SCI_GETSELECTIONEND, 0, 0) - SSM(sci, SCI_GETSELECTIONSTART, 0, 0))
|
2005-11-22 12:26:26 +00:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-18 15:58:00 +00:00
|
|
|
void sci_goto_pos(ScintillaObject *sci, gint pos, gboolean unfold)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
if (unfold) SSM(sci, SCI_ENSUREVISIBLE, SSM(sci, SCI_LINEFROMPOSITION, pos, 0), 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
SSM(sci, SCI_GOTOPOS, pos, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sci_set_search_anchor(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SEARCHANCHOR, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-24 15:44:14 +00:00
|
|
|
/* removes a selection if pos < 0 */
|
2005-11-22 12:26:26 +00:00
|
|
|
void sci_set_anchor(ScintillaObject *sci, gint pos)
|
|
|
|
{
|
2009-07-24 15:44:14 +00:00
|
|
|
if (pos < 0)
|
|
|
|
pos = sci_get_current_position(sci);
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
SSM(sci, SCI_SETANCHOR, pos, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Scroll the cursor in view.
|
|
|
|
* @param sci Scintilla widget. */
|
2005-11-22 12:26:26 +00:00
|
|
|
void sci_scroll_caret(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SCROLLCARET, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-03 15:09:13 +00:00
|
|
|
void sci_scroll_lines(ScintillaObject *sci, gint lines)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_LINESCROLL, 0, lines);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-11 17:18:06 +00:00
|
|
|
void sci_scroll_columns(ScintillaObject *sci, gint columns)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_LINESCROLL, columns, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
gint sci_search_next(ScintillaObject *sci, gint flags, const gchar *text)
|
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_SEARCHNEXT, flags, (sptr_t) text);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gint sci_search_prev(ScintillaObject *sci, gint flags, const gchar *text)
|
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_SEARCHPREV, flags, (sptr_t) text);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-04 09:20:28 +00:00
|
|
|
gint sci_find_text(ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_FINDTEXT, flags, (long) ttf);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_set_font(ScintillaObject *sci, gint style, const gchar *font, gint size)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_STYLESETFONT, style, (sptr_t) font);
|
|
|
|
SSM(sci, SCI_STYLESETSIZE, style, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-25 22:27:13 +00:00
|
|
|
/** Jump to the specified line in the document.
|
|
|
|
* If @a unfold is set and @a line is hidden by a fold, it is unfolded
|
|
|
|
* first to ensure it is visible.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param line Line.
|
|
|
|
* @param unfold Whether to unfold first.
|
|
|
|
*/
|
2008-05-22 14:41:28 +00:00
|
|
|
void sci_goto_line(ScintillaObject *sci, gint line, gboolean unfold)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-05-22 14:41:28 +00:00
|
|
|
if (unfold) SSM(sci, SCI_ENSUREVISIBLE, line, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
SSM(sci, SCI_GOTOLINE, line, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sci_marker_delete_all(ScintillaObject *sci, gint marker)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_MARKERDELETEALL, marker, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get style ID for @a position.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param position Position.
|
|
|
|
* @return Style ID. */
|
2005-11-22 12:26:26 +00:00
|
|
|
gint sci_get_style_at(ScintillaObject *sci, gint position)
|
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETSTYLEAT, position, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void sci_set_codepage(ScintillaObject *sci, gint cp)
|
|
|
|
{
|
2006-04-27 17:59:12 +00:00
|
|
|
g_return_if_fail(cp == 0 || cp == SC_CP_UTF8);
|
|
|
|
SSM(sci, SCI_SETCODEPAGE, cp, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-08 21:07:06 +00:00
|
|
|
void sci_assign_cmdkey(ScintillaObject *sci, gint key, gint command)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_ASSIGNCMDKEY, key, command);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void sci_clear_cmdkey(ScintillaObject *sci, gint key)
|
|
|
|
{
|
2009-10-14 16:00:40 +00:00
|
|
|
SSM(sci, SCI_CLEARCMDKEY, key, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get text between @a start and @a end.
|
2009-03-24 18:13:28 +00:00
|
|
|
* @deprecated sci_get_text_range is deprecated and should not be used in newly-written code.
|
|
|
|
* Use sci_get_contents_range() instead.
|
|
|
|
*
|
2008-09-16 15:37:50 +00:00
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param start Start.
|
|
|
|
* @param end End.
|
|
|
|
* @param text Text will be zero terminated and must be allocated (end - start + 1) bytes. */
|
2005-11-22 12:26:26 +00:00
|
|
|
void sci_get_text_range(ScintillaObject *sci, gint start, gint end, gchar *text)
|
|
|
|
{
|
2009-07-04 09:20:28 +00:00
|
|
|
struct Sci_TextRange tr;
|
2005-11-22 12:26:26 +00:00
|
|
|
tr.chrg.cpMin = start;
|
|
|
|
tr.chrg.cpMax = end;
|
|
|
|
tr.lpstrText = text;
|
|
|
|
SSM(sci, SCI_GETTEXTRANGE, 0, (long) &tr);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-03-24 18:13:28 +00:00
|
|
|
/** Get text between @a start and @a end.
|
|
|
|
*
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param start Start.
|
|
|
|
* @param end End.
|
|
|
|
* @return The text inside the given range. Should be freed when no longer needed.
|
|
|
|
*
|
|
|
|
* @since 0.17
|
|
|
|
*/
|
|
|
|
gchar *sci_get_contents_range(ScintillaObject *sci, gint start, gint end)
|
|
|
|
{
|
|
|
|
gchar *text = g_malloc((end - start) + 1);
|
|
|
|
sci_get_text_range(sci, start, end, text);
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
void sci_line_duplicate(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_LINEDUPLICATE, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-17 15:39:47 +00:00
|
|
|
void sci_selection_duplicate(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SELECTIONDUPLICATE, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Insert text.
|
|
|
|
* @param sci Scintilla widget.
|
2009-10-15 14:57:11 +00:00
|
|
|
* @param pos Position, or -1 for current.
|
2008-09-16 15:37:50 +00:00
|
|
|
* @param text Text. */
|
2005-11-22 12:26:26 +00:00
|
|
|
void sci_insert_text(ScintillaObject *sci, gint pos, const gchar *text)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_INSERTTEXT, pos, (sptr_t) text);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sci_target_from_selection(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_TARGETFROMSELECTION, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-29 17:54:48 +00:00
|
|
|
void sci_set_target_start(ScintillaObject *sci, gint start)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETTARGETSTART, start, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-29 17:54:48 +00:00
|
|
|
void sci_set_target_end(ScintillaObject *sci, gint end)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETTARGETEND, end, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-29 17:54:48 +00:00
|
|
|
gint sci_replace_target(ScintillaObject *sci, const gchar *text, gboolean regex)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-02-20 11:24:23 +00:00
|
|
|
return SSM(sci, (regex) ? SCI_REPLACETARGETRE : SCI_REPLACETARGET, (uptr_t) -1, (sptr_t) text);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-07 14:17:40 +00:00
|
|
|
void sci_set_keywords(ScintillaObject *sci, gint k, const gchar *text)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETKEYWORDS, k, (sptr_t) text);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void sci_set_readonly(ScintillaObject *sci, gboolean readonly)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETREADONLY, readonly, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-07-25 14:18:49 +00:00
|
|
|
/** A simple convenience function for sending Scintilla commands without any parameters.
|
|
|
|
* @param sci The Scintilla @c GtkWidget.
|
|
|
|
* @param cmd @c SCI_COMMAND.
|
2009-01-30 18:53:23 +00:00
|
|
|
* @see http://scintilla.org for the documentation.
|
|
|
|
*
|
|
|
|
* @since 0.16
|
|
|
|
*/
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_send_command(ScintillaObject *sci, gint cmd)
|
2005-12-01 22:50:05 +00:00
|
|
|
{
|
|
|
|
SSM(sci, cmd, 0, 0);
|
|
|
|
}
|
2005-12-09 01:34:32 +00:00
|
|
|
|
2006-11-18 15:43:28 +00:00
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get current line number.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @return Line number. */
|
2007-09-25 16:44:33 +00:00
|
|
|
gint sci_get_current_line(ScintillaObject *sci)
|
2005-12-09 01:34:32 +00:00
|
|
|
{
|
2007-09-25 16:44:33 +00:00
|
|
|
return SSM(sci, SCI_LINEFROMPOSITION, SSM(sci, SCI_GETCURRENTPOS, 0, 0), 0);
|
2005-12-09 01:34:32 +00:00
|
|
|
}
|
2006-03-10 21:40:20 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2006-09-21 10:31:06 +00:00
|
|
|
/* Get number of lines partially or fully selected.
|
|
|
|
* Returns 1 if there is a partial selection on the same line.
|
|
|
|
* Returns 2 if a whole line is selected including the line break char(s). */
|
2006-03-10 21:40:20 +00:00
|
|
|
gint sci_get_lines_selected(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
gint start = SSM(sci, SCI_GETSELECTIONSTART, 0, 0);
|
|
|
|
gint end = SSM(sci, SCI_GETSELECTIONEND, 0, 0);
|
2006-06-30 13:42:53 +00:00
|
|
|
|
2006-03-10 21:40:20 +00:00
|
|
|
if (start == end)
|
2008-02-27 13:17:29 +00:00
|
|
|
return 0; /* no selection */
|
2006-06-30 13:42:53 +00:00
|
|
|
|
2006-03-10 21:40:20 +00:00
|
|
|
return SSM(sci, SCI_LINEFROMPOSITION, end, 0) - SSM(sci, SCI_LINEFROMPOSITION, start, 0) + 1;
|
|
|
|
}
|
2006-06-13 19:37:21 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2006-11-18 15:43:28 +00:00
|
|
|
gint sci_get_first_visible_line(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETFIRSTVISIBLELINE, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-25 18:57:00 +00:00
|
|
|
/**
|
|
|
|
* Set the current indicator. This is necessary to define an indicator for a range of text or
|
|
|
|
* clearing indicators for a range of text.
|
|
|
|
*
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param indic The indicator number to set.
|
|
|
|
*
|
|
|
|
* @see sci_indicator_clear
|
2009-01-30 18:53:23 +00:00
|
|
|
*
|
|
|
|
* @since 0.16
|
|
|
|
*/
|
2008-11-16 17:54:28 +00:00
|
|
|
void sci_indicator_set(ScintillaObject *sci, gint indic)
|
2008-09-17 18:05:27 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETINDICATORCURRENT, indic, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-18 13:27:10 +00:00
|
|
|
void sci_indicator_fill(ScintillaObject *sci, gint pos, gint len)
|
2008-09-17 18:05:27 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_INDICATORFILLRANGE, pos, len);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-10-25 18:57:00 +00:00
|
|
|
/**
|
|
|
|
* Clear a range of text from the currently set indicator.
|
|
|
|
* Starting at @a pos, @a len characters long.
|
|
|
|
* In order to make this function properly, you need to set the current indicator before with
|
2008-11-18 20:14:58 +00:00
|
|
|
* @ref sci_indicator_set().
|
2008-10-25 18:57:00 +00:00
|
|
|
*
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param pos Starting position.
|
|
|
|
* @param len Length.
|
2009-01-30 18:53:23 +00:00
|
|
|
*
|
|
|
|
* @since 0.16
|
|
|
|
*/
|
2008-09-18 13:27:10 +00:00
|
|
|
void sci_indicator_clear(ScintillaObject *sci, gint pos, gint len)
|
2008-09-17 18:05:27 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_INDICATORCLEARRANGE, pos, len);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2006-06-30 13:42:53 +00:00
|
|
|
void sci_select_all(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SELECTALL, 0, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2006-08-01 10:35:32 +00:00
|
|
|
gint sci_get_line_indent_position(ScintillaObject *sci, gint line)
|
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETLINEINDENTPOSITION, line, 0);
|
|
|
|
}
|
2006-08-13 15:04:30 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2006-08-13 15:04:30 +00:00
|
|
|
void sci_set_autoc_max_height(ScintillaObject *sci, gint val)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_AUTOCSETMAXHEIGHT, val, 0);
|
|
|
|
}
|
2006-10-11 22:01:26 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Find a matching brace at @a pos.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param pos Position.
|
2009-01-30 18:53:23 +00:00
|
|
|
* @return Matching brace position.
|
|
|
|
*
|
|
|
|
* @since 0.15
|
|
|
|
**/
|
2008-09-17 18:02:55 +00:00
|
|
|
gint sci_find_matching_brace(ScintillaObject *sci, gint pos)
|
2006-10-11 22:01:26 +00:00
|
|
|
{
|
|
|
|
return SSM(sci, SCI_BRACEMATCH, pos, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2006-12-08 15:30:44 +00:00
|
|
|
gint sci_get_overtype(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETOVERTYPE, 0, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2006-12-12 21:52:48 +00:00
|
|
|
void sci_set_tab_indents(ScintillaObject *sci, gboolean set)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETTABINDENTS, set, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2007-01-14 17:09:17 +00:00
|
|
|
void sci_set_use_tabs(ScintillaObject *sci, gboolean set)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETUSETABS, set, 0);
|
|
|
|
}
|
2007-03-01 17:36:51 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2007-03-01 17:36:51 +00:00
|
|
|
gint sci_get_pos_at_line_sel_start(ScintillaObject *sci, gint line)
|
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETLINESELSTARTPOSITION, line, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2007-03-01 17:36:51 +00:00
|
|
|
gint sci_get_pos_at_line_sel_end(ScintillaObject *sci, gint line)
|
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETLINESELENDPOSITION, line, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Get selection mode.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @return Selection mode. */
|
2007-03-01 17:36:51 +00:00
|
|
|
gint sci_get_selection_mode(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETSELECTIONMODE, 0, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-16 15:37:50 +00:00
|
|
|
/** Set selection mode.
|
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param mode Mode. */
|
2007-03-01 17:36:51 +00:00
|
|
|
void sci_set_selection_mode(ScintillaObject *sci, gint mode)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETSELECTIONMODE, mode, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2007-04-10 17:06:57 +00:00
|
|
|
void sci_set_scrollbar_mode(ScintillaObject *sci, gboolean visible)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETHSCROLLBAR, visible, 0);
|
|
|
|
SSM(sci, SCI_SETVSCROLLBAR, visible, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2007-05-08 16:03:07 +00:00
|
|
|
void sci_set_line_indentation(ScintillaObject *sci, gint line, gint indent)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETLINEINDENTATION, line, indent);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
gint sci_get_line_indentation(ScintillaObject *sci, gint line)
|
2007-05-08 16:03:07 +00:00
|
|
|
{
|
|
|
|
return SSM(sci, SCI_GETLINEINDENTATION, line, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2007-07-11 17:05:13 +00:00
|
|
|
void sci_set_caret_policy_x(ScintillaObject *sci, gint policy, gint slop)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETXCARETPOLICY, policy, slop);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2007-07-11 17:05:13 +00:00
|
|
|
void sci_set_caret_policy_y(ScintillaObject *sci, gint policy, gint slop)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETYCARETPOLICY, policy, slop);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-09-13 15:33:04 +00:00
|
|
|
void sci_set_scroll_stop_at_last_line(ScintillaObject *sci, gboolean set)
|
2008-09-01 11:18:06 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETENDATLASTLINE, set, 0);
|
2008-09-12 11:37:02 +00:00
|
|
|
}
|
2008-09-25 18:29:53 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-25 18:29:53 +00:00
|
|
|
void sci_cancel(ScintillaObject *sci)
|
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_CANCEL, 0, 0);
|
2008-09-25 18:29:53 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-25 18:29:53 +00:00
|
|
|
gint sci_get_target_end(ScintillaObject *sci)
|
|
|
|
{
|
2009-09-16 14:13:38 +00:00
|
|
|
return SSM(sci, SCI_GETTARGETEND, 0, 0);
|
2008-09-25 18:29:53 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-09-25 18:29:53 +00:00
|
|
|
gint sci_get_position_after(ScintillaObject *sci, gint start)
|
|
|
|
{
|
|
|
|
return SSM(sci, SCI_POSITIONAFTER, start, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-07-24 15:44:14 +00:00
|
|
|
void sci_lines_split(ScintillaObject *sci, gint pixelWidth)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_LINESSPLIT, pixelWidth, 0);
|
|
|
|
}
|
2008-09-25 18:29:53 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-07-24 15:44:14 +00:00
|
|
|
void sci_lines_join(ScintillaObject *sci)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_LINESJOIN, 0, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-07-24 15:44:14 +00:00
|
|
|
gint sci_text_width(ScintillaObject *sci, gint styleNumber, const gchar *text)
|
|
|
|
{
|
|
|
|
return SSM(sci, SCI_TEXTWIDTH, styleNumber, (sptr_t) text);
|
|
|
|
}
|