diff --git a/3rdparty/mmu_man/themes/TODO.txt b/3rdparty/mmu_man/themes/TODO.txt index bff9c7ecd0..541f6ce2aa 100644 --- a/3rdparty/mmu_man/themes/TODO.txt +++ b/3rdparty/mmu_man/themes/TODO.txt @@ -2,9 +2,14 @@ TODOs for Theme manager: * style cleanup (-> Haiku style) * make ParseMessage more robust * forbid quitting while themes are loading! +* fix TerminalAddon: get theme from haiku * ideas for addons: - ~/config/settings/Tracker/DefaultFolderTemplate/ (default background ??) + - Desktop icon size ? - dircolors (cf. http://linux.die.net/man/5/dir_colors ) - icons (/etc/icons ? svg/hvif, setmime...) - mouse cursors (needs app_server fixes ??) + - Pulse colors (-> sample code) + - BeIDE/Pe/Eddie full colors (map to singe namespace) + diff --git a/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp b/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp index 90c43d462f..6dac974d11 100644 --- a/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -180,7 +181,9 @@ status_t UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) { BMessage uisettings; BFont fnt; + struct menu_info menuInfo; status_t err; + status_t gmierr = ENOENT; int i; FENTRY; @@ -194,7 +197,7 @@ status_t UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) font_style style; err = FindFont(uisettings, "be:f:be_plain_font", 0, &fnt); - uisettings.RemoveName("be:f:be_plain_font"); + //uisettings.RemoveName("be:f:be_plain_font"); DERR(err); if (err == B_OK) { fnt.GetFamilyAndStyle(&family, &style); @@ -203,7 +206,7 @@ status_t UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) err = FindFont(uisettings, "be:f:be_bold_font", 0, &fnt); DERR(err); - uisettings.RemoveName("be:f:be_bold_font"); + //uisettings.RemoveName("be:f:be_bold_font"); if (err == B_OK) { fnt.GetFamilyAndStyle(&family, &style); _set_system_font_("bold", family, style, fnt.Size()); @@ -211,21 +214,50 @@ status_t UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) err = FindFont(uisettings, "be:f:be_fixed_font", 0, &fnt); DERR(err); - uisettings.RemoveName("be:f:be_fixed_font"); + //uisettings.RemoveName("be:f:be_fixed_font"); if (err == B_OK) { fnt.GetFamilyAndStyle(&family, &style); _set_system_font_("fixed", family, style, fnt.Size()); } + err = FindFont(uisettings, "be:f:Tip", 0, &fnt); + DERR(err); + //uisettings.RemoveName("be:f:Tip"); + if (err == B_OK) { + fnt.GetFamilyAndStyle(&family, &style); + // not implemented yet in Haiku + //_set_system_font_("tip", family, style, fnt.Size()); + //_set_system_font_("tooltip", family, style, fnt.Size()); + } + + gmierr = get_menu_info(&menuInfo); + for (i = 0; gUIColorMap[i].name; i++) { rgb_color c; if (FindRGBColor(uisettings, gUIColorMap[i].name, 0, &c) == B_OK) { set_ui_color(gUIColorMap[i].id, c); - fprintf(stderr, "set_ui_color(%d, #%02x%02x%02x)\n", - gUIColorMap[i].id, c.red, c.green, c.blue); + PRINT(("set_ui_color(%d, #%02x%02x%02x)\n", + gUIColorMap[i].id, c.red, c.green, c.blue)); + if (gUIColorMap[i].id == B_MENU_BACKGROUND_COLOR) + menuInfo.background_color = c; } } + if (gmierr >= B_OK) { + bool bval; + int32 ival; + if (uisettings.FindBool("be:MenTrig", &bval) >= B_OK) + menuInfo.triggers_always_shown = bval; + if (uisettings.FindInt32("be:MenSep", &ival) >= B_OK) + menuInfo.separator = ival; + err = FindFont(uisettings, "be:f:MenTx", 0, &fnt); + DERR(err); + if (err == B_OK) { + fnt.GetFamilyAndStyle(&menuInfo.f_family, &menuInfo.f_style); + menuInfo.font_size = fnt.Size(); + } + set_menu_info(&menuInfo); + } return B_OK; } @@ -235,6 +267,7 @@ status_t UISettingsThemesAddon::MakeTheme(BMessage &theme, uint32 flags) BMessage uisettings; BMessage names; BFont fnt; + menu_info menuInfo; status_t err; int i; FENTRY; @@ -253,6 +286,18 @@ status_t UISettingsThemesAddon::MakeTheme(BMessage &theme, uint32 flags) AddFont(uisettings, "be:f:be_plain_font", (BFont *)be_plain_font); AddFont(uisettings, "be:f:be_bold_font", (BFont *)be_bold_font); AddFont(uisettings, "be:f:be_fixed_font", (BFont *)be_fixed_font); + // XXX: FIXME + //AddFont(uisettings, "be:f:Tip", (BFont *)be_tip_font); + + // menu stuff + err = get_menu_info(&menuInfo); + if (err >= B_OK) { + uisettings.AddBool("be:MenTrig", menuInfo.triggers_always_shown); + uisettings.AddInt32("be:MenSep", menuInfo.separator); + fnt.SetFamilyAndStyle(menuInfo.f_family, menuInfo.f_style); + fnt.SetSize(menuInfo.font_size); + AddFont(uisettings, "be:f:MenTx", &fnt); + } err = SetMyMessage(theme, uisettings); return err; @@ -262,7 +307,7 @@ status_t UISettingsThemesAddon::ApplyDefaultTheme(uint32 flags) { BMessage theme; BMessage uisettings; - BFont fnt; + rgb_color color; FENTRY; /* @@ -294,6 +339,20 @@ status_t UISettingsThemesAddon::ApplyDefaultTheme(uint32 flags) f.SetSize(size); AddFont(uisettings, "be:f:be_plain_font", &f); + // menu stuff + sprintf(family,"%s","Bitstream Vera Sans"); + sprintf(style,"%s","Roman"); + f.SetFamilyAndStyle(family, style); + f.SetSize(12.0); + AddFont(uisettings, "be:f:MenTx", &f); + color.red = 216; + color.blue = 216; + color.green = 216; + color.alpha = 255; + AddRGBColor(uisettings, "be:c:MenBg", color); + uisettings.AddBool("be:MenTrig", false); + uisettings.AddInt32("be:MenSep", 0); + theme.AddMessage(A_MSGNAME, &uisettings); return ApplyTheme(theme, flags); } diff --git a/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp b/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp index 51de53c14a..8a1dd9bb2b 100644 --- a/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp @@ -14,6 +14,9 @@ #include #include +#define DEBUG 1 +#include + #include #include #include @@ -30,6 +33,8 @@ #define A_MSGNAME Z_THEME_TERMINAL_SETTINGS #define A_DESCRIPTION "Terminal color, font and size" +/* definitions for R5 Terminal settings file */ + #define TP_MAGIC 0xf1f2f3f4 #define TP_VERSION 0x02 #define TP_FONT_NAME_SZ 128 @@ -62,6 +67,41 @@ struct termprefs { struct tpref p; }; +#define MSG_R5_SET_PREF 'pref' + +/* definitions for Haiku Terminal settings file */ +/* from TermConst.h */ + +#define PREF_HALF_FONT_FAMILY "Half Font Family" +#define PREF_HALF_FONT_STYLE "Half Font Style" +#define PREF_HALF_FONT_SIZE "Half Font Size" + +#define PREF_TEXT_FORE_COLOR "Text Foreground Color" +#define PREF_TEXT_BACK_COLOR "Text Background Color" +#define PREF_SELECT_FORE_COLOR "Selection Foreground Color" +#define PREF_SELECT_BACK_COLOR "Selection Background Color" +#define PREF_CURSOR_FORE_COLOR "Cursor Foreground Color" +#define PREF_CURSOR_BACK_COLOR "Cursor Background Color" + +#define PREF_IM_FORE_COLOR "IM Foreground Color" +#define PREF_IM_BACK_COLOR "IM Background Color" +#define PREF_IM_SELECT_COLOR "IM Selection Color" + +#define PREF_HISTORY_SIZE "History Size" +#define PREF_CURSOR_BLINKING "Cursor Blinking rate" + +#define PREF_IM_AWARE = "Input Method Aware" + +#define PREF_COLS "Cols" +#define PREF_ROWS "Rows" +#define PREF_SHELL "Shell" + +#define PREF_TEXT_ENCODING "Text encoding" +#define PREF_GUI_LANGUAGE "Language" + + +/* theme field names */ + #define TP_COLS "term:cols" #define TP_ROWS "term:rows" #define TP_TABWIDTH "term:tab" @@ -96,6 +136,14 @@ status_t ApplyDefaultTheme(uint32 flags=0L); /* Theme installation */ status_t InstallFiles(BMessage &theme, BDirectory &folder); status_t BackupFiles(BMessage &theme, BDirectory &folder); + +private: +status_t ApplyThemeR5(BMessage &theme, uint32 flags); +status_t MakeThemeR5(BMessage &theme, uint32 flags); +status_t ApplyThemeHaiku(BMessage &theme, uint32 flags); +status_t MakeThemeHaiku(BMessage &theme, uint32 flags); +status_t LoadHaikuTerminalSettings(BMessage &into); +status_t SaveHaikuTerminalSettings(BMessage &from); }; TerminalThemesAddon::TerminalThemesAddon() @@ -138,6 +186,73 @@ status_t TerminalThemesAddon::AddNames(BMessage &names) } status_t TerminalThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) +{ + status_t err; + +#ifndef __HAIKU__ + err = ApplyThemeR5(theme, flags); +#endif + // Some people use the Haiku terminal in BeOS. + err = ApplyThemeHaiku(theme, flags); + if (err) + return err; + return B_OK; +} + +status_t TerminalThemesAddon::MakeTheme(BMessage &theme, uint32 flags) +{ +#ifdef __HAIKU__ + return MakeThemeHaiku(theme, flags); +#else + return MakeThemeR5(theme, flags); +#endif +} + +status_t TerminalThemesAddon::ApplyDefaultTheme(uint32 flags) +{ + BMessage theme; + BMessage termpref; + // XXX: add font and stuff... + AddRGBColor(termpref, "term:c:bg",make_color(255,255,255,0)); + AddRGBColor(termpref, "term:c:fg",make_color(0,0,0,0)); + AddRGBColor(termpref, "term:c:curbg",make_color(0,0,0,0)); + AddRGBColor(termpref, "term:c:curfg",make_color(255,255,255,0)); + AddRGBColor(termpref, "term:c:selbg",make_color(0,0,0,0)); + AddRGBColor(termpref, "term:c:selfg",make_color(255,255,255,0)); + theme.AddMessage(Z_THEME_TERMINAL_SETTINGS, &termpref); + return ApplyTheme(theme, flags); +} + +status_t TerminalThemesAddon::InstallFiles(BMessage &theme, BDirectory &folder) +{ + BMessage termpref; + status_t err; + + (void)folder; + err = MyMessage(theme, termpref); + if (err) + termpref.MakeEmpty(); + + return B_OK; +} + +status_t TerminalThemesAddon::BackupFiles(BMessage &theme, BDirectory &folder) +{ + BMessage termpref; + status_t err; + + (void)folder; + err = MyMessage(theme, termpref); + if (err) + termpref.MakeEmpty(); + + entry_ref ref; + //find_font_file(&ref, ff, fs); + return B_OK; +} + + +status_t TerminalThemesAddon::ApplyThemeR5(BMessage &theme, uint32 flags) { BMessage termpref; status_t err; @@ -188,7 +303,7 @@ status_t TerminalThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) if (termpref.FindInt32(TP_ENCODING, (int32 *)&tp.p.encoding) != B_OK) tp.p.encoding = 0; // UTF-8 - if (true/*flags & UI_THEME_SETTINGS_SAVE*/) { + if (flags & UI_THEME_SETTINGS_SAVE) { BPath pTermPref; if (find_directory(B_USER_SETTINGS_DIRECTORY, &pTermPref) < B_OK) return EINVAL; @@ -202,7 +317,7 @@ status_t TerminalThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) if (ni.InitCheck() == B_OK) ni.SetType("application/x-vnd.Be-pref"); } - if (true/*flags & UI_THEME_SETTINGS_APPLY*/) { + if (flags & UI_THEME_SETTINGS_APPLY) { BList teamList; app_info ainfo; int32 count, i; @@ -210,9 +325,9 @@ status_t TerminalThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) count = teamList.CountItems(); for (i = 0; i < count; i++) { if (be_roster->GetRunningAppInfo((team_id)(teamList.ItemAt(i)), &ainfo) == B_OK) { - if (!strcmp(ainfo.signature, kBeOSTerminalAppSig) || !strcmp(ainfo.signature, kHaikuTerminalAppSig)) { + if (!strcmp(ainfo.signature, kBeOSTerminalAppSig)) { err = B_OK; - BMessage msg('pref'); + BMessage msg(MSG_R5_SET_PREF); BMessenger msgr(NULL, ainfo.team); tp.x = 0; tp.y = 0; @@ -229,7 +344,7 @@ status_t TerminalThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) return B_OK; } -status_t TerminalThemesAddon::MakeTheme(BMessage &theme, uint32 flags) +status_t TerminalThemesAddon::MakeThemeR5(BMessage &theme, uint32 flags) { BMessage termpref; status_t err; @@ -278,45 +393,292 @@ status_t TerminalThemesAddon::MakeTheme(BMessage &theme, uint32 flags) return B_OK; } -status_t TerminalThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage termpref; - AddRGBColor(termpref, "term:c:bg",make_color(255,255,255,0)); - AddRGBColor(termpref, "term:c:fg",make_color(0,0,0,0)); - AddRGBColor(termpref, "term:c:curbg",make_color(0,0,0,0)); - AddRGBColor(termpref, "term:c:curfg",make_color(255,255,255,0)); - AddRGBColor(termpref, "term:c:selbg",make_color(0,0,0,0)); - AddRGBColor(termpref, "term:c:selfg",make_color(255,255,255,0)); - theme.AddMessage(Z_THEME_TERMINAL_SETTINGS, &termpref); - return ApplyTheme(theme, flags); -} -status_t TerminalThemesAddon::InstallFiles(BMessage &theme, BDirectory &folder) +status_t TerminalThemesAddon::ApplyThemeHaiku(BMessage &theme, uint32 flags) { BMessage termpref; + BMessage lines; status_t err; - - (void)folder; + struct termprefs tp; + int32 ival; + rgb_color color; + BString s; + + (void)flags; err = MyMessage(theme, termpref); if (err) - termpref.MakeEmpty(); + return err; + + if (termpref.FindInt32(TP_COLS, &ival) < B_OK) + ival = 80; + s = ""; + s << ival; + lines.AddString(PREF_COLS, s.String()); + + if (termpref.FindInt32(TP_ROWS, &ival) < B_OK) + ival = 25; + s = ""; + s << ival; + lines.AddString(PREF_ROWS, s.String()); + + if (termpref.FindInt32(TP_TABWIDTH, &ival) >= B_OK) { + //XXX: handle that ? + } + + BFont tFont; + tp.p.font_size = 12; + strcpy(tp.p.font, "Courier10 BT/Roman"); + if (FindFont(termpref, TP_FONT, 0, &tFont) == B_OK) { + font_family ff; + font_style fs; + tFont.GetFamilyAndStyle(&ff, &fs); + s = ""; + s << ff; + lines.AddString(PREF_HALF_FONT_FAMILY, s.String()); + s = ""; + s << fs; + lines.AddString(PREF_HALF_FONT_STYLE, s.String()); + s = ""; + s << tFont.Size(); + lines.AddString(PREF_HALF_FONT_SIZE, s.String()); + } + + if (FindRGBColor(termpref, TP_BG, 0, &color) != B_OK) + color = make_color(255,255,255,255); + s = ""; + s << color.red << ", " << color.green << ", " << color.blue; + lines.AddString(PREF_TEXT_BACK_COLOR, s.String()); + + if (FindRGBColor(termpref, TP_FG, 0, &color) != B_OK) + color = make_color(0,0,0,255); + s = ""; + s << color.red << ", " << color.green << ", " << color.blue; + lines.AddString(PREF_TEXT_FORE_COLOR, s.String()); + + if (FindRGBColor(termpref, TP_CURBG, 0, &color) != B_OK) + color = make_color(255,255,255,255); + s = ""; + s << color.red << ", " << color.green << ", " << color.blue; + lines.AddString(PREF_CURSOR_BACK_COLOR, s.String()); + + if (FindRGBColor(termpref, TP_CURFG, 0, &color) != B_OK) + color = make_color(0,0,0,255); + s = ""; + s << color.red << ", " << color.green << ", " << color.blue; + lines.AddString(PREF_CURSOR_FORE_COLOR, s.String()); + + if (FindRGBColor(termpref, TP_SELBG, 0, &color) != B_OK) + color = make_color(0,0,0,255); + s = ""; + s << color.red << ", " << color.green << ", " << color.blue; + lines.AddString(PREF_SELECT_BACK_COLOR, s.String()); + + if (FindRGBColor(termpref, TP_SELFG, 0, &color) != B_OK) + color = make_color(255,255,255,255); + s = ""; + s << color.red << ", " << color.green << ", " << color.blue; + lines.AddString(PREF_SELECT_FORE_COLOR, s.String()); + +/* XXX: handle PREF_IM_FORE_COLOR PREF_IM_BACK_COLOR PREF_IM_SELECT_COLOR */ + + + if (termpref.FindInt32(TP_ENCODING, &ival) != B_OK) + ival = 0; // UTF-8 + s = ""; + s << ival; + //XXX: shouldn't really be touched... + //lines.AddString(, s.String()); + + + if (flags & UI_THEME_SETTINGS_SAVE) { + SaveHaikuTerminalSettings(lines); + } + if (flags & UI_THEME_SETTINGS_APPLY) { + BList teamList; + app_info ainfo; + int32 count, i; + be_roster->GetAppList(&teamList); + count = teamList.CountItems(); + for (i = 0; i < count; i++) { + if (be_roster->GetRunningAppInfo((team_id)(teamList.ItemAt(i)), &ainfo) == B_OK) { + if (!strcmp(ainfo.signature, kHaikuTerminalAppSig)) { + err = B_OK; + //XXX: WRITEME +/* BMessage msg(MSG_R5_SET_PREF); + BMessenger msgr(NULL, ainfo.team); + tp.x = 0; + tp.y = 0; + + //msg.AddData("", 'UBYT', &(tp.p), sizeof(struct tpref)); + msg.AddData("", 'UBYT', &(tp), sizeof(struct termprefs)); + msg.AddSpecifier("Window", 0L); + err = msgr.SendMessage(&msg); +*/ + } + } + } + } return B_OK; } -status_t TerminalThemesAddon::BackupFiles(BMessage &theme, BDirectory &folder) +status_t TerminalThemesAddon::MakeThemeHaiku(BMessage &theme, uint32 flags) { BMessage termpref; + BMessage lines; status_t err; + BPath pTermPref; + char buffer[1024]; + char key[B_FIELD_NAME_LENGTH], data[512]; + int n; + FILE *file; - (void)folder; + (void)flags; err = MyMessage(theme, termpref); if (err) termpref.MakeEmpty(); - entry_ref ref; - //find_font_file(&ref, ff, fs); + err = LoadHaikuTerminalSettings(lines); + + //XXX: WRITEME + +/* + while (fgets(buffer, sizeof(buffer), file) != NULL) { + if (*buffer == '#') + continue; + + n = sscanf(buffer, "%*[\"]%[^\"]%*[\"]%*[^\"]%*[\"]%[^\"]", key, data); + if (n == 2) { + if (strstr(key, " Color")) { + rgb_color color; + int r, g, b; + n = sscanf(data, "%3d, %3d, %3d", &r, &g, &b); + color.red = r; + color.green = g; + color.blue = b; + color.alpha = 255; + + } else + lines.AddString(key, data); + } + } +*/ +/* + BFile fTermPref(pTermPref.Path(), B_READ_ONLY); + if (fTermPref.InitCheck() != B_OK) + return fTermPref.InitCheck(); + if (fTermPref.Read(&tp, sizeof(struct termprefs)) < (ssize_t)sizeof(struct termprefs)) + return EIO; + if ((tp.magic != TP_MAGIC) || (tp.version != TP_VERSION)) + return EINVAL; + termpref.AddInt32(TP_COLS, tp.p.cols); + termpref.AddInt32(TP_ROWS, tp.p.rows); + termpref.AddInt32(TP_TABWIDTH, tp.p.tab_width); + BFont tFont; + font_family ff; + font_style fs; + BString str(tp.p.font); + str.Truncate(str.FindFirst('/')); + strncpy(ff, str.String(), sizeof(ff)); + str.SetTo(tp.p.font); + str.Remove(0, str.FindFirst('/')+1); + strncpy(fs, str.String(), sizeof(fs)); + tFont.SetFamilyAndStyle(ff, fs); + tFont.SetSize(tp.p.font_size); + AddFont(termpref, TP_FONT, &tFont); + AddRGBColor(termpref, TP_BG, tp.p.bg); + AddRGBColor(termpref, TP_FG, tp.p.fg); + AddRGBColor(termpref, TP_CURBG, tp.p.curbg); + AddRGBColor(termpref, TP_CURFG, tp.p.curfg); + AddRGBColor(termpref, TP_SELBG, tp.p.selbg); + AddRGBColor(termpref, TP_SELFG, tp.p.selfg); + termpref.AddInt32(TP_ENCODING, tp.p.encoding); +*/ + err = SetMyMessage(theme, termpref); + return B_OK; +} + + +status_t TerminalThemesAddon::LoadHaikuTerminalSettings(BMessage &into) +{ + status_t err; + BPath pTermPref; + char buffer[1024]; + char key[B_FIELD_NAME_LENGTH], data[512]; + int n; + FILE *file; + + if (find_directory(B_USER_SETTINGS_DIRECTORY, &pTermPref) < B_OK) + return EINVAL; +#ifdef __HAIKU__ + pTermPref.Append("Terminal_settings"); +#else + pTermPref.Append("HaikuTerminal_settings"); +#endif + // cf PrefHandler.cpp + file = fopen(pTermPref.Path(), "r"); + if (file == NULL) + return B_ENTRY_NOT_FOUND; + + while (fgets(buffer, sizeof(buffer), file) != NULL) { + if (*buffer == '#') + continue; + + n = sscanf(buffer, "%*[\"]%[^\"]%*[\"]%*[^\"]%*[\"]%[^\"]", key, data); + if (n == 2) { + into.AddString(key, data); + } + } + fclose(file); + return B_OK; +} + + +status_t TerminalThemesAddon::SaveHaikuTerminalSettings(BMessage &from) +{ + BMessage settings; + status_t err; + BPath pTermPref; + + // load existing + err = LoadHaikuTerminalSettings(settings); + + if (find_directory(B_USER_SETTINGS_DIRECTORY, &pTermPref) < B_OK) + return EINVAL; +#ifdef __HAIKU__ + pTermPref.Append("Terminal_settings"); +#else + pTermPref.Append("HaikuTerminal_settings"); +#endif + + BFile file(pTermPref.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); + char buffer[512]; + type_code type; + char *key; + err = file.InitCheck(); + if (err < B_OK) + return err; + + // merge new values + for (int32 i = 0; + from.GetInfo(B_STRING_TYPE, i, GET_INFO_NAME_PTR(&key), &type) == B_OK; + i++) { + BString s; + if (from.FindString(key, &s) < B_OK) + continue; + settings.RemoveName(key); + settings.AddString(key, s.String()); + } + + for (int32 i = 0; + settings.GetInfo(B_STRING_TYPE, i, GET_INFO_NAME_PTR(&key), &type) == B_OK; + i++) { + BString s; + if (settings.FindString(key, &s) < B_OK) + continue; + int len = snprintf(buffer, sizeof(buffer), "\"%s\" , \"%s\"\n", key, s.String()); + file.Write(buffer, len); + } return B_OK; }