Ejemplo n.º 1
0
void sci_set_mark_long_lines(ScintillaObject *sci, gint type, gint column, const gchar *colour)
{
	glong colour_val = utils_parse_color_to_bgr(colour); /* Scintilla uses a "long" value */

	if (column == 0)
		type = 2;
	switch (type)
	{
		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;
		}
	}
	SSM(sci, SCI_SETEDGECOLUMN, (uptr_t) column, 0);
	SSM(sci, SCI_SETEDGECOLOUR, (uptr_t) colour_val, 0);
}
Ejemplo n.º 2
0
/* Parses a color in `str` which can be an HTML color (ex. #0099cc),
 * an abbreviated HTML color (ex. #09c) or a hex string color
 * (ex. 0x0099cc). The result of the conversion is stored into the
 * location pointed to by `clr`. */
static void parse_color(GKeyFile *kf, const gchar *str, gint *clr)
{
	gint c;
	gchar *named_color = NULL;

	g_return_if_fail(clr != NULL);

	if (G_UNLIKELY(EMPTY(str)))
		return;

	named_color = g_key_file_get_string(kf, "named_colors", str, NULL);
	if (named_color)
		str = named_color;

	c = utils_parse_color_to_bgr(str);
	if (c == -1)
		geany_debug("Bad color '%s'", str);
	else
		*clr = c;

	g_free(named_color);
}