Corretto caricamento colori da file di configurazione

git-svn-id: svn://10.65.10.50/trunk@3144 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-07-08 07:25:19 +00:00
parent 85a2d7afec
commit 79069687e7

View File

@ -121,12 +121,11 @@ void TConfig::_write_file()
out.close(); in.close();
while (access(_file, 02) != 0)
message_box("Il file %s e' gia' in uso", (const char*)_file);
/*
TFilename bak(_file); bak.ext("bak");
rename(_file, bak);
*/
if (fexist(_file))
{
while (access(_file, 02) != 0)
message_box("Il file %s e' gia' in uso", (const char*)_file);
}
fcopy(temp, _file); // Copia dalla tempdir al nuovo .ini
remove(temp); // Cancella file temporaneo
}
@ -369,7 +368,26 @@ COLOR TConfig::get_color(
int r, g, b; RGB_COLOR(def, r, g, b);
TString16 d; d << r << ',' << g << ',' << b;
set(var, d, section, TRUE, index);
}
}
// Se nel colore non compare l'indice cerca di calcolarlo
const byte color_index = byte(def >> 12);
if (color_index < 0x1 || color_index > 0xF)
{
const COLOR native_color[11] = { COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_CYAN,
COLOR_MAGENTA, COLOR_YELLOW, COLOR_BLACK, COLOR_DKGRAY,
COLOR_GRAY, COLOR_LTGRAY, COLOR_WHITE };
for (int c = 0; c < 11; c++)
{
if (def == (native_color[c] & 0x00FFFFFF)) // Confronta solo la terna R,G,B
{
def = native_color[c];
break;
}
}
}
return def;
}