void sci_set_mark_long_lines(ScintillaObject *sci, gint type, gint column, const gchar *colour) { glong colour_val = utils_strtod(colour, NULL, TRUE); /* 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); }
/* 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 hex_clr[9] = { 0 }; gchar *named_color = NULL; const gchar *start; 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; if (str[0] == '#') start = str + 1; else if (strlen(str) > 1 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) start = str + 2; else { geany_debug("Bad color '%s'", str); g_free(named_color); return; } if (strlen(start) == 3) { g_snprintf(hex_clr, 9, "0x%c%c%c%c%c%c", start[0], start[0], start[1], start[1], start[2], start[2]); } else g_snprintf(hex_clr, 9, "0x%s", start); g_free(named_color); c = utils_strtod(hex_clr, NULL, FALSE); if (c > -1) { *clr = c; return; } geany_debug("Bad color '%s'", str); }