Beispiel #1
0
void cSetup::StoreLanguages(const char *Name, int *Values)
{
  char buffer[I18nLanguages()->Size() * 4];
  char *q = buffer;
  for (int i = 0; i < I18nLanguages()->Size(); i++) {
      if (Values[i] < 0)
         break;
      const char *s = I18nLanguageCode(Values[i]);
      if (s) {
         if (q > buffer)
            *q++ = ' ';
         strncpy(q, s, 3);
         q += 3;
         }
      }
  *q = 0;
  Store(Name, buffer);
}
Beispiel #2
0
bool cSetup::ParseLanguages(const char *Value, int *Values)
{
  int n = 0;
  while (Value && *Value && n < I18nLanguages()->Size()) {
        char buffer[4];
        strn0cpy(buffer, Value, sizeof(buffer));
        int i = I18nLanguageIndex(buffer);
        if (i >= 0)
           Values[n++] = i;
        if ((Value = strchr(Value, ' ')) != NULL)
           Value++;
        }
  Values[n] = -1;
  return true;
}
Beispiel #3
0
bool cTheme::Save(const char *FileName)
{
  if (!FileNameOk(FileName))
     return false;
  bool result = true;
  cSafeFile f(FileName);
  if (f.Open()) {
     for (int i = 0; i < I18nLanguages()->Size(); i++) {
         if (descriptions[i])
            fprintf(f, "Description%s%.*s = %s\n", i ? "." : "", 3, i ? I18nLanguageCode(i) : "", descriptions[i]);
         }
     for (int i = 0; i < MaxThemeColors; i++) {
         if (colorNames[i])
            fprintf(f, "%s = %08X\n", colorNames[i], colorValues[i]);
         }
     if (!f.Close())
        result = false;
     }
  else
     result = false;
  return result;
}