diff options
Diffstat (limited to 'apps/windoze/CBuilder5/BibleCS/optionfrm.cpp')
-rw-r--r-- | apps/windoze/CBuilder5/BibleCS/optionfrm.cpp | 206 |
1 files changed, 185 insertions, 21 deletions
diff --git a/apps/windoze/CBuilder5/BibleCS/optionfrm.cpp b/apps/windoze/CBuilder5/BibleCS/optionfrm.cpp index 5cff2a7..84b9763 100644 --- a/apps/windoze/CBuilder5/BibleCS/optionfrm.cpp +++ b/apps/windoze/CBuilder5/BibleCS/optionfrm.cpp @@ -112,7 +112,7 @@ void __fastcall TOptionsfrm::btnFontClick(TObject *Sender) //--------------------------------------------------------------------------- void __fastcall TOptionsfrm::shpCurrVSClrMouseDown(TObject *Sender, - TMouseButton Button, TShiftState Shift, int X, int Y) + TMouseButton Button, TShiftState Shift, int X, int Y) { btnCurrVerseClick(Sender); } @@ -342,29 +342,29 @@ void __fastcall TOptionsfrm::ImportClick(TObject *Sender) AnsiString newFileName; AnsiString exName, newPath; AnsiString subdir = ExtractFilePath(Application->ExeName) + COLOR_DIR; - if(OpenSchDlg->Execute()){ - exName = OpenSchDlg->FileName.c_str(); - newFileName = ExtractFileName(exName); - newPath = subdir + newFileName; + if(OpenSchDlg->Execute()){ + exName = OpenSchDlg->FileName.c_str(); + newFileName = ExtractFileName(exName); + newPath = subdir + newFileName; if(!CopyFileA(exName.c_str(), newPath.c_str(),1)) - MessageBox(this, "Import Failed." , "Oops", MB_OK); - } - SetCurrentDir(ExtractFilePath(Application->ExeName)); - FindSchemeNames(); + MessageBox(this, "Import Failed." , "Oops", MB_OK); + } + SetCurrentDir(ExtractFilePath(Application->ExeName)); + FindSchemeNames(); } //--------------------------------------------------------------------------- void __fastcall TOptionsfrm::DeleteClick(TObject *Sender) { - AnsiString name = cmbSchemeSelect->Text; - AnsiString fullName = ExtractFilePath(Application->ExeName) + COLOR_DIR + name + COLOR_EXT; - if(name != ""){ - DeleteFile(fullName); - }else{ - Application->MessageBox("No Scheme Selected to Delete. Please Select a Scheme and Retry" , "Oops", MB_OK); - } - SetCurrentDir(ExtractFilePath(Application->ExeName)); - FindSchemeNames(); + AnsiString name = cmbSchemeSelect->Text; + AnsiString fullName = ExtractFilePath(Application->ExeName) + COLOR_DIR + name + COLOR_EXT; + if(name != ""){ + DeleteFile(fullName); + }else{ + Application->MessageBox("No Scheme Selected to Delete. Please Select a Scheme and Retry" , "Oops", MB_OK); + } + SetCurrentDir(ExtractFilePath(Application->ExeName)); + FindSchemeNames(); } //--------------------------------------------------------------------------- @@ -490,8 +490,7 @@ void __fastcall TOptionsfrm::shpMorphClrMouseDown(TObject *Sender, -void TOptionsfrm::LoadDispSettings(SWConfig* config) -{ +void TOptionsfrm::LoadDispSettings(SWConfig* config) { SectionMap::iterator sit; if ((sit = config->Sections.find("Appearance")) != config->Sections.end()) { @@ -634,8 +633,173 @@ void TOptionsfrm::LoadDispSettings(SWConfig* config) } +void TOptionsfrm::LoadMiscSettings(SWConfig* config) { + ModMap::iterator it; + SectionMap::iterator sit; + ConfigEntMap::iterator eit; + ConfigEntMap emap; + int color; + string tmpval; + + if ((sit = config->Sections.find("Bookmarks")) != config->Sections.end()) { + Optionsfrm->AutoBMPersonal->Checked = ((atoi(sit->second["AutoSavePersonal"].c_str()))?true:false); + Optionsfrm->AutoBMOther->Checked = ((atoi(sit->second["AutoSaveOther"].c_str()))?true:false); + } + if ((sit = config->Sections.find("Layout")) != config->Sections.end()) { + Optionsfrm->AutoLayout->Checked = ((atoi(sit->second["AutoSaveLayout"].c_str()))?true:false); + + } + + Optionsfrm->HintStrongs->Checked = true; + tmpval = ((eit = config->Sections["HintStrongs"].find("On")) != config->Sections["HintStrongs"].end())? (*eit).second : (string)"1"; + if (!atoi(tmpval.c_str())) + Optionsfrm->HintStrongs->Checked = false; + + Optionsfrm->HintPopups->Checked = true; + tmpval = ((eit = config->Sections["Hints"].find("On")) != config->Sections["Hints"].end())? (*eit).second : (string)"1"; + if (!atoi(tmpval.c_str())) + Optionsfrm->HintPopups->Checked = false; + + Optionsfrm->devsAsDictsCB->Checked = false; + tmpval = ((eit = config->Sections["General"].find("DevsAsDicts")) != config->Sections["General"].end())? (*eit).second : (string)"false"; + if (!stricmp(tmpval.c_str(), "true")) + Optionsfrm->devsAsDictsCB->Checked = true; + + Optionsfrm->glosAsDictsCB->Checked = true; + tmpval = ((eit = config->Sections["General"].find("GlosAsDicts")) != config->Sections["General"].end())? (*eit).second : (string)"true"; + if (stricmp(tmpval.c_str(), "false")) + Optionsfrm->glosAsDictsCB->Checked = true; + + Optionsfrm->devSplashCB->Checked = false; + tmpval = ((eit = config->Sections["General"].find("TipOfTheDay")) != config->Sections["General"].end())? (*eit).second : (string)""; + if (!stricmp(tmpval.c_str(), "Devotional")) + Optionsfrm->devSplashCB->Checked = true; + + const char *localeName = LocaleMgr::systemLocaleMgr.getDefaultLocaleName(); + SWLocale *defLocale = LocaleMgr::systemLocaleMgr.getLocale(localeName); + Optionsfrm->localeCB->ItemIndex = Optionsfrm->localeCB->Items->IndexOf((defLocale)?defLocale->getDescription():"English (US)"); + + tmpval = ((eit = config->Sections["ModDefaults"].find("GreekDef")) != config->Sections["ModDefaults"].end())? (*eit).second : (string)""; + if ((it = Form1->mainmgr->Modules.find(tmpval)) != Form1->mainmgr->Modules.end()) { + Optionsfrm->greekDefCB->ItemIndex = Optionsfrm->greekDefCB->Items->IndexOf(it->second->Description()); + } + + tmpval = ((eit = config->Sections["ModDefaults"].find("GreekParse")) != config->Sections["ModDefaults"].end())? (*eit).second : (string)""; + if ((it = Form1->mainmgr->Modules.find(tmpval)) != Form1->mainmgr->Modules.end()) { + Optionsfrm->greekParseCB->ItemIndex = Optionsfrm->greekParseCB->Items->IndexOf(it->second->Description()); + } + + tmpval = ((eit = config->Sections["ModDefaults"].find("HebrewDef")) != config->Sections["ModDefaults"].end())? (*eit).second : (string)""; + if ((it = Form1->mainmgr->Modules.find(tmpval)) != Form1->mainmgr->Modules.end()) { + Optionsfrm->hebrewDefCB->ItemIndex = Optionsfrm->hebrewDefCB->Items->IndexOf(it->second->Description()); + } + + tmpval = ((eit = config->Sections["ModDefaults"].find("HebrewParse")) != config->Sections["ModDefaults"].end())? (*eit).second : (string)""; + if ((it = Form1->mainmgr->Modules.find(tmpval)) != Form1->mainmgr->Modules.end()) { + Optionsfrm->hebrewParseCB->ItemIndex = Optionsfrm->hebrewParseCB->Items->IndexOf(it->second->Description()); + } + + tmpval = ((eit = config->Sections["ModDefaults"].find("DailyDevotion")) != config->Sections["ModDefaults"].end())? (*eit).second : (string)""; + if ((it = Form1->mainmgr->Modules.find(tmpval)) != Form1->mainmgr->Modules.end()) { + Optionsfrm->dailyDefaultCB->ItemIndex = Optionsfrm->dailyDefaultCB->Items->IndexOf(it->second->Description()); + } + + tmpval = ((eit = config->Sections["ModDefaults"].find("StrongsNumbers")) != config->Sections["ModDefaults"].end())? (*eit).second : (string)""; + if ((it = Form1->mainmgr->Modules.find(tmpval)) != Form1->mainmgr->Modules.end()) { + Optionsfrm->strongsNumsCB->ItemIndex = Optionsfrm->strongsNumsCB->Items->IndexOf(it->second->Description()); + } +} + + +void TOptionsfrm::extractSettings(SWConfig* config) { + ModMap::iterator it; + SectionMap::iterator sit; + ConfigEntMap::iterator eit; + ConfigEntMap emap; + int color; + string tmpval; + + emap = config->Sections["Appearance"]; + emap.erase("AutoVSColor"); emap.insert(ConfigEntMap::value_type("AutoVSColor", IntToStr((Optionsfrm->AutoVSColor->Checked)?1:0).c_str())); + emap.erase("CurrentVSColor"); emap.insert(ConfigEntMap::value_type("CurrentVSColor", IntToStr(Optionsfrm->ColorDialogVS->Color).c_str())); + emap.erase("StrongsColor"); emap.insert(ConfigEntMap::value_type("StrongsColor", IntToStr(Optionsfrm->ColorDialogStrongs->Color).c_str())); + emap.erase("MorphColor"); emap.insert(ConfigEntMap::value_type("MorphColor", IntToStr(Optionsfrm->ColorDialogMorph->Color).c_str())); + emap.erase("VSNumberColor"); emap.insert(ConfigEntMap::value_type("VSNumberColor", IntToStr(Optionsfrm->ColorDialogVerseNum->Color).c_str())); + emap.erase("FieldColor"); emap.insert(ConfigEntMap::value_type("FieldColor", IntToStr(Optionsfrm->ColorDialogField->Color).c_str())); + + emap.erase("TextBackColor"); emap.insert(ConfigEntMap::value_type("TextBackColor", IntToStr(Optionsfrm->FontDialogText->BackColor).c_str())); + emap.erase("CommentBackColor"); emap.insert(ConfigEntMap::value_type("CommentBackColor", IntToStr(Optionsfrm->FontDialogComment->BackColor).c_str())); + emap.erase("LDBackColor"); emap.insert(ConfigEntMap::value_type("LDBackColor", IntToStr(Optionsfrm->FontDialogLD->BackColor).c_str())); + emap.erase("PopupBackColor"); emap.insert(ConfigEntMap::value_type("PopupBackColor", IntToStr(Optionsfrm->FontDialogPopup->BackColor).c_str())); + + emap.erase("TextFontName"); emap.insert(ConfigEntMap::value_type("TextFontName", (Optionsfrm->FontDialogText->Font->Name).c_str())); + emap.erase("CommentFontName"); emap.insert(ConfigEntMap::value_type("CommentFontName", (Optionsfrm->FontDialogComment->Font->Name).c_str())); + emap.erase("LDFontName"); emap.insert(ConfigEntMap::value_type("LDFontName", (Optionsfrm->FontDialogLD->Font->Name).c_str())); + emap.erase("PopupFontName"); emap.insert(ConfigEntMap::value_type("PopupFontName", (Optionsfrm->FontDialogPopup->Font->Name).c_str())); + + emap.erase("TextFontSize"); emap.insert(ConfigEntMap::value_type("TextFontSize", IntToStr(Optionsfrm->FontDialogText->Font->Size).c_str())); + emap.erase("CommentFontSize"); emap.insert(ConfigEntMap::value_type("CommentFontSize", IntToStr(Optionsfrm->FontDialogComment->Font->Size).c_str())); + emap.erase("LDFontSize"); emap.insert(ConfigEntMap::value_type("LDFontSize", IntToStr(Optionsfrm->FontDialogLD->Font->Size).c_str())); + emap.erase("PopupFontSize"); emap.insert(ConfigEntMap::value_type("PopupFontSize", IntToStr(Optionsfrm->FontDialogPopup->Font->Size).c_str())); + + emap.erase("TextFontColor"); emap.insert(ConfigEntMap::value_type("TextFontColor", IntToStr(Optionsfrm->FontDialogText->Font->Color).c_str())); + emap.erase("CommentFontColor"); emap.insert(ConfigEntMap::value_type("CommentFontColor", IntToStr(Optionsfrm->FontDialogComment->Font->Color).c_str())); + emap.erase("LDFontColor"); emap.insert(ConfigEntMap::value_type("LDFontColor", IntToStr(Optionsfrm->FontDialogLD->Font->Color).c_str())); + emap.erase("PopupFontColor"); emap.insert(ConfigEntMap::value_type("PopupFontColor", IntToStr(Optionsfrm->FontDialogPopup->Font->Color).c_str())); + + emap.erase("locale"); emap.insert(ConfigEntMap::value_type("locale", (const char *)Optionsfrm->localeCB->Items->Objects[Optionsfrm->localeCB->ItemIndex])); + config->Sections["Appearance"] = emap; + + emap = config->Sections["ModDefaults"]; + + if (Optionsfrm->greekDefCB->ItemIndex > -1) { + emap.erase("GreekDef"); emap.insert(ConfigEntMap::value_type("GreekDef", (const char *)Optionsfrm->greekDefCB->Items->Objects[Optionsfrm->greekDefCB->ItemIndex])); + } + if (Optionsfrm->greekParseCB->ItemIndex > -1) { + emap.erase("GreekParse"); emap.insert(ConfigEntMap::value_type("GreekParse", (const char *)Optionsfrm->greekParseCB->Items->Objects[Optionsfrm->greekParseCB->ItemIndex])); + } + if (Optionsfrm->hebrewDefCB->ItemIndex > -1) { + emap.erase("HebrewDef"); emap.insert(ConfigEntMap::value_type("HebrewDef", (const char *)Optionsfrm->hebrewDefCB->Items->Objects[Optionsfrm->hebrewDefCB->ItemIndex])); + } + if (Optionsfrm->hebrewParseCB->ItemIndex > -1) { + emap.erase("HebrewParse"); emap.insert(ConfigEntMap::value_type("HebrewParse", (const char *)Optionsfrm->hebrewParseCB->Items->Objects[Optionsfrm->hebrewParseCB->ItemIndex])); + } + if (Optionsfrm->dailyDefaultCB->ItemIndex > -1) { + emap.erase("DailyDevotion"); emap.insert(ConfigEntMap::value_type("DailyDevotion", (const char *)Optionsfrm->dailyDefaultCB->Items->Objects[Optionsfrm->dailyDefaultCB->ItemIndex])); + } + if (Optionsfrm->strongsNumsCB->ItemIndex > -1) { + emap.erase("StrongsNumbers"); emap.insert(ConfigEntMap::value_type("StrongsNumbers", (const char *)Optionsfrm->strongsNumsCB->Items->Objects[Optionsfrm->strongsNumsCB->ItemIndex])); + } + config->Sections["ModDefaults"] = emap; + + + emap = config->Sections["Bookmarks"]; + emap.erase("AutoSavePersonal"); emap.insert(ConfigEntMap::value_type("AutoSavePersonal", IntToStr((Optionsfrm->AutoBMPersonal->Checked)?1:0).c_str())); + emap.erase("AutoSaveOther"); emap.insert(ConfigEntMap::value_type("AutoSaveOther", IntToStr((Optionsfrm->AutoBMOther->Checked)?1:0).c_str())); + config->Sections["Bookmarks"] = emap; + + emap = config->Sections["Layout"]; + emap.erase("AutoSaveLayout"); emap.insert(ConfigEntMap::value_type("AutoSaveLayout", IntToStr((Optionsfrm->AutoLayout->Checked)?1:0).c_str())); + config->Sections["Layout"] = emap; + + emap = config->Sections["Hints"]; + emap.erase("On"); emap.insert(ConfigEntMap::value_type("On", IntToStr((Optionsfrm->HintPopups->Checked)?1:0).c_str())); + config->Sections["Hints"] = emap; + + emap = config->Sections["HintStrongs"]; + emap.erase("On"); emap.insert(ConfigEntMap::value_type("On", IntToStr((Optionsfrm->HintStrongs->Checked)?1:0).c_str())); + config->Sections["HintStrongs"] = emap; + + emap = config->Sections["General"]; + emap.erase("TipOfTheDay"); emap.insert(ConfigEntMap::value_type("TipOfTheDay", (Optionsfrm->devSplashCB->Checked)?"Devotional":"")); + emap.erase("DevsAsDicts"); emap.insert(ConfigEntMap::value_type("DevsAsDicts", (Optionsfrm->devsAsDictsCB->Checked)?"true":"false")); + emap.erase("GlosAsDicts"); emap.insert(ConfigEntMap::value_type("GlosAsDicts", (Optionsfrm->glosAsDictsCB->Checked)?"true":"false")); + config->Sections["General"] = emap; +} + + void __fastcall TOptionsfrm::shpNumClrMouseDown(TObject *Sender, - TMouseButton Button, TShiftState Shift, int X, int Y) + TMouseButton Button, TShiftState Shift, int X, int Y) { btnNumClrClick(Sender); } |