Exemple #1
0
static void on_sci_notify(ScintillaObject *sci, gint param,
                          SCNotification *nt, gpointer data)
{
    gint line;

    switch (nt->nmhdr.code)
    {
    /* adapted from editor.c: on_margin_click() */
    case SCN_MARGINCLICK:
        /* left click to marker margin toggles marker */
        if (nt->margin == 1)
        {
            gboolean set;
            gint marker = 1;

            line = sci_get_line_from_position(sci, nt->position);
            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);
        }
        /* left click on the folding margin to toggle folding state of current line */
        if (nt->margin == 2)
        {
            line = sci_get_line_from_position(sci, nt->position);
            scintilla_send_message(sci, SCI_TOGGLEFOLD, line, 0);
        }
        break;

    default:
        break;
    }
}
Exemple #2
0
void sci_toggle_marker_at_line(ScintillaObject *sci, gint line, gint marker)
{
	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);
}
static PyObject *
Scintilla_is_marker_set_at_line(Scintilla *self, PyObject *args, PyObject *kwargs)
{
	gboolean result;
	gint line, marker;
	static gchar *kwlist[] = { "line", "marker", NULL };

	SCI_RET_IF_FAIL(self);

	if (PyArg_ParseTupleAndKeywords(args, kwargs, "ii", kwlist, &line, &marker))
	{
		result = sci_is_marker_set_at_line(self->sci, line, marker);
		if (result)
			Py_RETURN_TRUE;
		else
			Py_RETURN_FALSE;
	}

	Py_RETURN_NONE;
}