# HG changeset patch # User thib # Date 1237322108 0 # Node ID 658272d883ed11d55b5e989c8dd852f4d69e6b61 # Parent f88d47a4bf87eb4108105475672624de38b54475 * Support (more or less) button style selects (fuuko's ones) * Strip text objects from strings (may support object text objects later) diff --git a/font/text_stream.cc b/font/text_stream.cc --- a/font/text_stream.cc +++ b/font/text_stream.cc @@ -90,6 +90,33 @@ void TextStream::Add(const char* str) { TextElem elem; for (; *str; str++) { if (*str >= 0x20) { + if (*str == '#') { // Commands + str++; + char command = (*str)|32; + str++; + const char *tmp = str; + while (isdigit(*str)) { + str++; + } + char *args = new char[str+1-tmp]; + strncpy(args, tmp, str-tmp); + args[str-tmp] = 0; + // Different commands: + switch(command) { + case 'c': + /*TODO: int r, g, b; char key[17]; + sprintf(key, "#COLOR_TABLE.%03d", args); + if (config.GetParam(key, 3, &r, &g, &b)) { // color not found + r = g = b = 0; + } + elem.type = TextElem::color; + elem.impl.Color.r = r; + elem.impl.Color.g = g; + elem.impl.Color.b = b;*/ + break; + } + delete[] args; + } elem.type = TextElem::glyph; elem.impl.Glyph.code = *str; } else if (*str < 0 && str[1] != 0) { diff --git a/scn2k/scn2k_text.cc b/scn2k/scn2k_text.cc --- a/scn2k/scn2k_text.cc +++ b/scn2k/scn2k_text.cc @@ -668,7 +668,8 @@ void TextImpl::CreateSelect(Cmd& cmd) { char key[1024]; sprintf(key, "#WINDOW.%03d.SELCOM_USE",text_window_number); int sel_type = 0; - config.GetParam(key, 1, &sel_type); + if (cmd.cmd3 == 1) config.GetParam(key, 1, &sel_type); + else if (cmd.cmd3 == 3) sel_type = 0; int sel_size = cmd.args.size() / 2; int i;