diff options
Diffstat (limited to 'apps/windoze/CBuilder5/BibleCS/optionfrm.cpp')
-rw-r--r-- | apps/windoze/CBuilder5/BibleCS/optionfrm.cpp | 644 |
1 files changed, 644 insertions, 0 deletions
diff --git a/apps/windoze/CBuilder5/BibleCS/optionfrm.cpp b/apps/windoze/CBuilder5/BibleCS/optionfrm.cpp new file mode 100644 index 0000000..5cff2a7 --- /dev/null +++ b/apps/windoze/CBuilder5/BibleCS/optionfrm.cpp @@ -0,0 +1,644 @@ +//--------------------------------------------------------------------------- +#include <vcl\vcl.h> +#pragma hdrstop + +#include <localemgr.h> +#include <list> +#include <string> +#include <dirent.h> +#include <io.h> +#include <dir.h> +#include "TModuleFonts.h" +#include "optionfrm.h" +#include "mainfrm.h" + + +//--------------------------------------------------------------------------- +#pragma resource "*.dfm" +TOptionsfrm *Optionsfrm; + +const char *TOptionsfrm::defaultLocaleName = "en_us"; +const char *TOptionsfrm::defaultLocaleDescription = "English (US)"; +//--------------------------------------------------------------------------- +__fastcall TOptionsfrm::TOptionsfrm(TComponent* Owner) + : TForm(Owner) +{ + FontDialogText = new TFontSelFrm(this); + FontDialogComment = new TFontSelFrm(this); + FontDialogLD = new TFontSelFrm(this); + FontDialogPopup = new TFontSelFrm(this); +} +//--------------------------------------------------------------------------- +void __fastcall TOptionsfrm::btnCurrVerseClick(TObject *Sender) +{ + ColorDialogVS->Execute(); + shpCurrVSClr->Brush->Color = ColorDialogVS->Color; + UpdatePreview(); +} +//--------------------------------------------------------------------------- + + +void __fastcall TOptionsfrm::FormCreate(TObject *Sender) +{ + list<string> locales; + + localeCB->Clear(); + localeCB->Items->AddObject(defaultLocaleDescription, (TObject *)defaultLocaleName); + + locales = LocaleMgr::systemLocaleMgr.getAvailableLocales(); + + for (list<string>::iterator it = locales.begin(); it != locales.end(); it++) { + const char *name = LocaleMgr::systemLocaleMgr.getLocale(it->c_str())->getName(); + const char *description = LocaleMgr::systemLocaleMgr.getLocale(it->c_str())->getDescription(); + localeCB->Items->AddObject(description, (TObject *)name); + } + localeCB->ItemIndex = 0; +} +//--------------------------------------------------------------------------- + + +void __fastcall TOptionsfrm::FormShow(TObject *Sender) +{ + PageControl1->ActivePage = TabSheet1; + FindSchemeNames(); + cmbTextSelect->ItemIndex = 0; + UpdatePreview(); +} + + + +void __fastcall TOptionsfrm::btnFontClick(TObject *Sender) +{ + + TFontSelFrm* tempFrm = new TFontSelFrm(this); + switch (cmbTextSelect->ItemIndex) + { + case 0: + CopyFontDlg(tempFrm, FontDialogText); + if(FontDialogText->ShowModal() == mrOk){ + CopyFontDlg(FontDialogComment, FontDialogText); + CopyFontDlg(FontDialogLD, FontDialogText); + CopyFontDlg(FontDialogPopup, FontDialogText); + UpdatePreview(); + }else CopyFontDlg(FontDialogText, tempFrm); + break; + case 1: + CopyFontDlg(tempFrm, FontDialogText); + if(FontDialogText->ShowModal() == mrOk) + UpdatePreview(); + else CopyFontDlg(FontDialogText, tempFrm); + break; + case 2: + CopyFontDlg(tempFrm, FontDialogComment); + if(FontDialogComment->ShowModal() == mrOk) + UpdatePreview(); + else CopyFontDlg(FontDialogComment, tempFrm); + break; + case 3: + CopyFontDlg(tempFrm, FontDialogLD); + if(FontDialogLD->ShowModal() == mrOk) + UpdatePreview(); + else CopyFontDlg(FontDialogLD, tempFrm); + break; + case 4: + CopyFontDlg(tempFrm, FontDialogPopup); + if(FontDialogPopup->ShowModal() == mrOk) + UpdatePreview(); + else CopyFontDlg(FontDialogPopup, tempFrm); + break; + } + delete tempFrm; +} +//--------------------------------------------------------------------------- + +void __fastcall TOptionsfrm::shpCurrVSClrMouseDown(TObject *Sender, + TMouseButton Button, TShiftState Shift, int X, int Y) +{ + btnCurrVerseClick(Sender); +} +//--------------------------------------------------------------------------- + +void __fastcall TOptionsfrm::btnNumClrClick(TObject *Sender) +{ + ColorDialogVerseNum->Execute(); + shpNumClr->Brush->Color = ColorDialogVerseNum->Color; + UpdatePreview(); + +} +//--------------------------------------------------------------------------- + + +void __fastcall TOptionsfrm::btnFieldClrClick(TObject *Sender) +{ + ColorDialogField->Execute(); + shpFieldClr->Brush->Color = ColorDialogField->Color; + UpdatePreview(); +} +//--------------------------------------------------------------------------- + +// TODO 2 -cOptions: add new category, Search Results +void __fastcall TOptionsfrm::cmbTextSelectChange(TObject *Sender) +{ + UpdatePreview(); +} +//--------------------------------------------------------------------------- + + +void __fastcall TOptionsfrm::cmbSchemeSelectChange(TObject *Sender) +{ + AnsiString tempName = ExtractFilePath(Application->ExeName) + COLOR_DIR + cmbSchemeSelect->Text + COLOR_EXT; + SWConfig schemesconf(tempName.c_str()); + LoadDispSettings(&schemesconf); + UpdatePreview(); +} +//--------------------------------------------------------------------------- + +// TODO 1 -cOptions: Change to use RxRichEditX somehow, so we're consistent with look and feel of real control +void TOptionsfrm::UpdatePreview() +{ + char buffTemp[512], buffFinal[512], font[64]; + char* verse = "Why, my beloved brothers, let every man be swift to hear, slow to speak, slow to wrath"; + int vsColorRed, vsColorGreen, vsColorBlue, numColorRed, numColorGreen, numColorBlue; + int fontSize; + TMemoryStream * RTFStream = new TMemoryStream; + + strcpy(buffFinal, "{\\rtf1\\ansi"); + + switch (cmbTextSelect->ItemIndex) + { + case 2: + TRxRichEditX::TColorToRGB(FontDialogComment->Font->Color, vsColorRed, vsColorGreen, vsColorBlue); + TRxRichEditX::TColorToRGB(ColorDialogVerseNum->Color, numColorRed, numColorGreen, numColorBlue); + strcpy(font, FontDialogComment->Font->Name.c_str()); + fontSize = FontDialogComment->Font->Size; + RTFPreview->Color = FontDialogComment->BackColor; + break; + case 3: + TRxRichEditX::TColorToRGB(FontDialogLD->Font->Color, vsColorRed, vsColorGreen, vsColorBlue); + TRxRichEditX::TColorToRGB(ColorDialogVerseNum->Color, numColorRed, numColorGreen, numColorBlue); + strcpy(font, FontDialogLD->Font->Name.c_str()); + fontSize = FontDialogLD->Font->Size; + RTFPreview->Color = FontDialogLD->BackColor; + break; + default: + TRxRichEditX::TColorToRGB(FontDialogText->Font->Color, vsColorRed, vsColorGreen, vsColorBlue); + TRxRichEditX::TColorToRGB(ColorDialogVerseNum->Color, numColorRed, numColorGreen, numColorBlue); + strcpy(font, FontDialogText->Font->Name.c_str()); + fontSize = FontDialogText->Font->Size; + RTFPreview->Color = FontDialogText->BackColor; + } + + // This is a strange way to deal with font size but I can't think of a different way to do it. + // So for now I will use the current system. + fontSize -= 12; + sprintf(buffTemp, "{\\fonttbl{\\f0\\fdecor\\fprq2 %s;}}" , font); + strcat(buffFinal, buffTemp); + sprintf(buffTemp, "{\\colortbl;\\red%d\\green%d\\blue%d;\\red%d\\green%d\\blue%d;}" , vsColorRed, vsColorGreen, vsColorBlue, numColorRed, numColorGreen, numColorBlue); + strcat(buffFinal, buffTemp); + + sprintf(buffTemp, "\\pard \\qc\\nowidctlpar{\\f1\\fs%d\\cf1\\b Chapter 1 ", (30 + fontSize)); + strcat(buffFinal, buffTemp); + sprintf(buffTemp, "\\par\\fs%d\\par}", (10 + fontSize)); + strcat(buffFinal, buffTemp); + + sprintf(buffTemp, "{\\fs%d\\cf2\\super 19}", (10 + fontSize)); + strcat(buffFinal, buffTemp); + + sprintf(buffTemp, "\\ql\\nowidctlpar \\cf1\\f0\\fs%d ", (24 + fontSize)); + strcat(buffFinal, buffTemp); + strcat(buffFinal, verse); + + strcat(buffFinal, " }"); + + RTFStream->WriteBuffer(buffFinal, 512); + RTFStream->Position = 0; + RTFPreview->Lines->LoadFromStream(RTFStream); + GetCurrentScheme(); +} + +TOptionsfrm::CopyFontDlg(TFontSelFrm* lhs, const TFontSelFrm* rhs) +{ + lhs->BackColor = rhs->BackColor; + lhs->Font->Color = rhs->Font->Color; + lhs->Font->Size = rhs->Font->Size; + lhs->Font->Name = rhs->Font->Name; +} + +void __fastcall TOptionsfrm::btnSaveScheme(TObject *Sender) +{ + TPoint menup, point; + point.x = 0; + point.y = btnSave->Height; + menup = btnSave->ClientToScreen(point); + SavePopup->Popup(menup.x, menup.y); +} +//--------------------------------------------------------------------------- + +void __fastcall TOptionsfrm::SaveSchemeClick(TObject *Sender) +{ + + ConfigEntMap emap; + AnsiString strName = cmbSchemeSelect->Text; + if(strName != "" && !strName.Pos("/") && !strName.Pos("\\") + && !strName.Pos(":") && !strName.Pos("*") + && !strName.Pos("?") && !strName.Pos("\"") + && !strName.Pos("<") && !strName.Pos(">") + && !strName.Pos("|")) { + + AnsiString strName = COLOR_DIR + cmbSchemeSelect->Text + COLOR_EXT; + SWConfig schemeconf(strName.c_str()); + + emap = schemeconf.Sections["Appearance"]; + emap.erase("AutoVSColor"); emap.insert(ConfigEntMap::value_type("AutoVSColor", IntToStr((AutoVSColor->Checked)?1:0).c_str())); + emap.erase("CurrentVSColor"); emap.insert(ConfigEntMap::value_type("CurrentVSColor", IntToStr(shpCurrVSClr->Brush->Color).c_str())); + emap.erase("VSNumberColor"); emap.insert(ConfigEntMap::value_type("VSNumberColor", IntToStr(ColorDialogVerseNum->Color).c_str())); + emap.erase("FieldColor"); emap.insert(ConfigEntMap::value_type("FieldColor", IntToStr(ColorDialogField->Color).c_str())); + emap.erase("StrongsColor"); emap.insert(ConfigEntMap::value_type("StrongsColor", IntToStr(ColorDialogStrongs->Color).c_str())); + emap.erase("MorphColor"); emap.insert(ConfigEntMap::value_type("MorphColor", IntToStr(ColorDialogMorph->Color).c_str())); + + emap.erase("TextBackColor"); emap.insert(ConfigEntMap::value_type("TextBackColor", IntToStr(FontDialogText->BackColor).c_str())); + emap.erase("CommentBackColor"); emap.insert(ConfigEntMap::value_type("CommentBackColor", IntToStr(FontDialogComment->BackColor).c_str())); + emap.erase("LDBackColor"); emap.insert(ConfigEntMap::value_type("LDBackColor", IntToStr(FontDialogLD->BackColor).c_str())); + emap.erase("PopupBackColor"); emap.insert(ConfigEntMap::value_type("PopupBackColor", IntToStr(FontDialogPopup->BackColor).c_str())); + + emap.erase("TextFontName"); emap.insert(ConfigEntMap::value_type("TextFontName", (FontDialogText->Font->Name).c_str())); + emap.erase("CommentFontName"); emap.insert(ConfigEntMap::value_type("CommentFontName", (FontDialogComment->Font->Name).c_str())); + emap.erase("LDFontName"); emap.insert(ConfigEntMap::value_type("LDFontName", (FontDialogLD->Font->Name).c_str())); + emap.erase("PopupFontName"); emap.insert(ConfigEntMap::value_type("PopupFontName", (FontDialogPopup->Font->Name).c_str())); + + emap.erase("TextFontSize"); emap.insert(ConfigEntMap::value_type("TextFontSize", IntToStr(FontDialogText->Font->Size).c_str())); + emap.erase("CommentFontSize"); emap.insert(ConfigEntMap::value_type("CommentFontSize", IntToStr(FontDialogComment->Font->Size).c_str())); + emap.erase("LDFontSize"); emap.insert(ConfigEntMap::value_type("LDFontSize", IntToStr(FontDialogLD->Font->Size).c_str())); + emap.erase("PopupFontSize"); emap.insert(ConfigEntMap::value_type("PopupFontSize", IntToStr(FontDialogPopup->Font->Size).c_str())); + + emap.erase("TextFontColor"); emap.insert(ConfigEntMap::value_type("TextFontColor", IntToStr(FontDialogText->Font->Color).c_str())); + emap.erase("CommentFontColor"); emap.insert(ConfigEntMap::value_type("CommentFontColor", IntToStr(FontDialogComment->Font->Color).c_str())); + emap.erase("LDFontColor"); emap.insert(ConfigEntMap::value_type("LDFontColor", IntToStr(FontDialogLD->Font->Color).c_str())); + emap.erase("PopupFontColor"); emap.insert(ConfigEntMap::value_type("PopupFontColor", IntToStr(FontDialogPopup->Font->Color).c_str())); + + schemeconf.Sections["Appearance"] = emap; + schemeconf.Save(); + }else{ + Application->MessageBox("Scheme name missing or invalid.","Oops", MB_OK); + } + SetCurrentDir(ExtractFilePath(Application->ExeName)); + FindSchemeNames(); +} +//--------------------------------------------------------------------------- + + +void TOptionsfrm::FindSchemeNames() +{ + DIR *dir; + struct dirent *ent; + string conffile; + AnsiString strName; + AnsiString strPath = COLOR_DIR; + + TStringList *schemeNames = new TStringList; + cmbSchemeSelect->Clear(); + + if (access(strPath.c_str(), 0)) { // directory does not exist + _mkdir(strPath.c_str()); + } + + if (dir = opendir(strPath.c_str())) { + rewinddir(dir); + while ((ent = readdir(dir))) { + if ((strcmp(ent->d_name, "."))&& (strcmp(ent->d_name, "..")) && !strcmp(ExtractFileExt(ent->d_name).c_str(), COLOR_EXT.c_str())) { + strName = ent->d_name; + schemeNames->Add(strName.SubString(1, strName.Length() - 4).c_str()); + } + } + closedir(dir); + cmbSchemeSelect->Items = schemeNames; + } + delete schemeNames; +} + +void __fastcall TOptionsfrm::ExportClick(TObject *Sender) +{ + AnsiString name = cmbSchemeSelect->Text; + AnsiString newFileName; + AnsiString exName; + AnsiString subdir = ExtractFilePath(Application->ExeName) + COLOR_DIR; + if(name != ""){ + SaveSchDlg->FileName = name; + if(SaveSchDlg->Execute()){ + exName = subdir + name + COLOR_EXT; + newFileName = SaveSchDlg->FileName.c_str(); + if(!CopyFileA(exName.c_str(), newFileName.c_str(),1)) + Application->MessageBox("Export Failed." , "Oops", MB_OK); + } + }else{ + Application->MessageBox("No Scheme Selected to Export. Please Select a Scheme and Retry" , "Oops", MB_OK); + } + SetCurrentDir(ExtractFilePath(Application->ExeName)); +} +//--------------------------------------------------------------------------- + +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(!CopyFileA(exName.c_str(), newPath.c_str(),1)) + 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(); +} +//--------------------------------------------------------------------------- + + +void TOptionsfrm::GetCurrentScheme() +{ + + AnsiString tempName; + SWConfig *schemesconf; + SectionMap::iterator sit, oit; + + SWConfig *optionsconf = dynamic_cast<TForm1*>(Application->MainForm)->optionsconf; + for(int count = 0; count < cmbSchemeSelect->Items->Count; count++) + { + tempName = ExtractFilePath(Application->ExeName) + COLOR_DIR + cmbSchemeSelect->Items->Strings[count] + COLOR_EXT; + schemesconf = new SWConfig(tempName.c_str()); + if( schemesconf->Sections["Appearance"]["CurrentVSColor"] == optionsconf->Sections["Appearance"]["CurrentVSColor"] && + schemesconf->Sections["Appearance"]["VSNumberColor"] == optionsconf->Sections["Appearance"]["VSNumberColor"] && + schemesconf->Sections["Appearance"]["StrongsColor"] == optionsconf->Sections["Appearance"]["StrongsColor"] && + schemesconf->Sections["Appearance"]["MorphColor"] == optionsconf->Sections["Appearance"]["MorphColor"] && + schemesconf->Sections["Appearance"]["FieldColor"] == optionsconf->Sections["Appearance"]["FieldColor"] && + + schemesconf->Sections["Appearance"]["TextBackColor"] == optionsconf->Sections["Appearance"]["TextBackColor"] && + schemesconf->Sections["Appearance"]["CommentBackColor"] == optionsconf->Sections["Appearance"]["CommentBackColor"] && + schemesconf->Sections["Appearance"]["LDBackColor"] == optionsconf->Sections["Appearance"]["LDBackColor"] && + schemesconf->Sections["Appearance"]["PopupBackColor"] == optionsconf->Sections["Appearance"]["PopupBackColor"] && + + schemesconf->Sections["Appearance"]["TextFontName"] == optionsconf->Sections["Appearance"]["TextFontName"] && + schemesconf->Sections["Appearance"]["CommentFontName"] == optionsconf->Sections["Appearance"]["CommentFontName"] && + schemesconf->Sections["Appearance"]["LDFontName"] == optionsconf->Sections["Appearance"]["LDFontName"] && + schemesconf->Sections["Appearance"]["PopupFontName"] == optionsconf->Sections["Appearance"]["PopupFontName"] && + + schemesconf->Sections["Appearance"]["TextFontSize"] == optionsconf->Sections["Appearance"]["TextFontSize"] && + schemesconf->Sections["Appearance"]["CommentFontSize"] == optionsconf->Sections["Appearance"]["CommentFontSize"] && + schemesconf->Sections["Appearance"]["LDFontSize"] == optionsconf->Sections["Appearance"]["LDFontSize"] && + schemesconf->Sections["Appearance"]["PopupFontSize"] == optionsconf->Sections["Appearance"]["PopupFontSize"] && + + schemesconf->Sections["Appearance"]["TextFontColor"] == optionsconf->Sections["Appearance"]["TextFontColor"] && + schemesconf->Sections["Appearance"]["CommentFontColor"] == optionsconf->Sections["Appearance"]["CommentFontColor"] && + schemesconf->Sections["Appearance"]["LDFontColor"] == optionsconf->Sections["Appearance"]["LDFontColor"] && + schemesconf->Sections["Appearance"]["PopupFontColor"] == optionsconf->Sections["Appearance"]["PopupFontColor"]){ cmbSchemeSelect->ItemIndex = count; + count = cmbSchemeSelect->Items->Count; // Basically we are done and can move on :) + } + delete schemesconf; + } +} + + + +void __fastcall TOptionsfrm::btnModFontsClick(TObject *Sender) +{ + TModuleFonts *pDlg = new TModuleFonts(this); + pDlg->ShowModal(); + + delete pDlg; +} +//--------------------------------------------------------------------------- + + + +// TODO 1 -cOptions: add hint verselist preview toggle +void __fastcall TOptionsfrm::HintStrongsClick(TObject *Sender) +{ + //In order for HintStrongs to work HintPopups has to be on + if(HintStrongs->Checked){ + HintPopups->Checked = true; + } + +} +//--------------------------------------------------------------------------- + +void __fastcall TOptionsfrm::HintPopupsClick(TObject *Sender) +{ + // If we turn off HintPopups we have to turn off HintStrongs + // because HintStrongs will not work if hints are off + if(!HintPopups->Checked) + HintStrongs->Checked = false; +} +//--------------------------------------------------------------------------- + + +void __fastcall TOptionsfrm::btnStrongClrClick(TObject *Sender) +{ + ColorDialogStrongs->Execute(); + shpStrongClr->Brush->Color = ColorDialogStrongs->Color; + UpdatePreview(); + +} +//--------------------------------------------------------------------------- + +void __fastcall TOptionsfrm::btnMorphClrClick(TObject *Sender) +{ + ColorDialogMorph->Execute(); + shpMorphClr->Brush->Color = ColorDialogMorph->Color; + UpdatePreview(); +} +//--------------------------------------------------------------------------- + + +void __fastcall TOptionsfrm::shpFieldClrMouseDown(TObject *Sender, + TMouseButton Button, TShiftState Shift, int X, int Y) +{ + btnFieldClrClick(Sender); +} +//--------------------------------------------------------------------------- + + +void __fastcall TOptionsfrm::shpStrongClrMouseDown(TObject *Sender, + TMouseButton Button, TShiftState Shift, int X, int Y) +{ + btnStrongClrClick(Sender); +} +//--------------------------------------------------------------------------- + + +void __fastcall TOptionsfrm::shpMorphClrMouseDown(TObject *Sender, + TMouseButton Button, TShiftState Shift, int X, int Y) +{ + btnMorphClrClick(Sender); +} +//--------------------------------------------------------------------------- + + + + +void TOptionsfrm::LoadDispSettings(SWConfig* config) +{ + SectionMap::iterator sit; + + if ((sit = config->Sections.find("Appearance")) != config->Sections.end()) { + if ((*sit).second.find("CurrentVSColor") != (*sit).second.end()){ + shpCurrVSClr->Brush->Color = TColor(atoi((*(*sit).second.find("CurrentVSColor")).second.c_str())); + ColorDialogVS->Color = TColor(atoi((*(*sit).second.find("CurrentVSColor")).second.c_str())); + } + else { + shpCurrVSClr->Brush->Color = TColor(clBlue); + ColorDialogVS->Color = TColor(clBlue); + } + if ((*sit).second.find("AutoVSColor") != (*sit).second.end()) { + AutoVSColor->Checked = (atoi((*(*sit).second.find("AutoVSColor")).second.c_str()) == 0) ? false : true; + } + else { + AutoVSColor->Checked = true; + } + + if ((*sit).second.find("StrongsColor") != (*sit).second.end()){ + shpStrongClr->Brush->Color = TColor(atoi((*(*sit).second.find("StrongsColor")).second.c_str())); + ColorDialogStrongs->Color = TColor(atoi((*(*sit).second.find("StrongsColor")).second.c_str())); + } + else{ + shpStrongClr->Brush->Color = TColor(16711935); // Magenta + ColorDialogStrongs->Color = TColor(16711935); + } + + if ((*sit).second.find("MorphColor") != (*sit).second.end()){ + shpMorphClr->Brush->Color = TColor(atoi((*(*sit).second.find("MorphColor")).second.c_str())); + ColorDialogMorph->Color = TColor(atoi((*(*sit).second.find("MorphColor")).second.c_str())); + } + else{ + shpMorphClr->Brush->Color = TColor(60534); // Light Green + ColorDialogMorph->Color = TColor(60534); + } + + if ((*sit).second.find("VSNumberColor") != (*sit).second.end()){ + shpNumClr->Brush->Color = TColor(atoi((*(*sit).second.find("VSNumberColor")).second.c_str())); + ColorDialogVerseNum->Color = TColor(atoi((*(*sit).second.find("VSNumberColor")).second.c_str())); + } + else{ + shpNumClr->Brush->Color = TColor(clBlue); + ColorDialogVerseNum->Color = TColor(clBlue); + } + + if ((*sit).second.find("FieldColor") != (*sit).second.end()){ + shpFieldClr->Brush->Color = TColor(atoi((*(*sit).second.find("FieldColor")).second.c_str())); + ColorDialogField->Color = TColor(atoi((*(*sit).second.find("FieldColor")).second.c_str())); + } + else{ + shpFieldClr->Brush->Color = TColor(clAqua); + ColorDialogField->Color = TColor(clAqua); + } + + + if ((*sit).second.find("VSNumberColor") != (*sit).second.end()) + ColorDialogVerseNum->Color = TColor(atoi ((*(*sit).second.find("VSNumberColor")).second.c_str())); + else + ColorDialogVerseNum->Color = clBlue; + + //**** Font BackColor ****// + if ((*sit).second.find("TextBackColor") != (*sit).second.end()) + FontDialogText->BackColor = TColor(atoi((*(*sit).second.find("TextBackColor")).second.c_str())); + else + FontDialogText->BackColor = TColor(clWhite); + + if ((*sit).second.find("CommentBackColor") != (*sit).second.end()) + FontDialogComment->BackColor = TColor(atoi((*(*sit).second.find("CommentBackColor")).second.c_str())); + else + FontDialogComment->BackColor = TColor(clWhite); + + if ((*sit).second.find("LDBackColor") != (*sit).second.end()) + FontDialogLD->BackColor = TColor(atoi((*(*sit).second.find("LDBackColor")).second.c_str())); + else + FontDialogLD->BackColor = TColor(clWhite); + if ((*sit).second.find("PopupBackColor") != (*sit).second.end()) + FontDialogPopup->BackColor = TColor(atoi((*(*sit).second.find("PopupBackColor")).second.c_str())); + else + FontDialogPopup->BackColor = TColor(14680063); // 13434879 == cream color + + //**** Font Face Name ****// + if ((*sit).second.find("TextFontName") != (*sit).second.end()) + FontDialogText->Font->Name = ((*(*sit).second.find("TextFontName")).second.c_str()); + else + FontDialogText->Font->Name = "Times New Roman"; + + if ((*sit).second.find("CommentFontName") != (*sit).second.end()) + FontDialogComment->Font->Name = ((*(*sit).second.find("CommentFontName")).second.c_str()); + else + FontDialogComment->Font->Name = "Times New Roman"; + + if ((*sit).second.find("LDFontName") != (*sit).second.end()) + FontDialogLD->Font->Name = ((*(*sit).second.find("LDFontName")).second.c_str()); + else + FontDialogLD->Font->Name = "Times New Roman"; + if ((*sit).second.find("PopupFontName") != (*sit).second.end()) + FontDialogPopup->Font->Name = ((*(*sit).second.find("PopupFontName")).second.c_str()); + else + FontDialogPopup->Font->Name = "Times New Roman"; + + //**** Font Size ****// + if ((*sit).second.find("TextFontSize") != (*sit).second.end()) + FontDialogText->Font->Size = (atoi ((*(*sit).second.find("TextFontSize")).second.c_str())); + else + FontDialogText->Font->Size = 10; + if ((*sit).second.find("CommentFontSize") != (*sit).second.end()) + FontDialogComment->Font->Size = (atoi ((*(*sit).second.find("CommentFontSize")).second.c_str())); + else + FontDialogComment->Font->Size = 10; + + if ((*sit).second.find("LDFontSize") != (*sit).second.end()) + FontDialogLD->Font->Size = (atoi ((*(*sit).second.find("LDFontSize")).second.c_str())); + else + FontDialogLD->Font->Size = 10; + if ((*sit).second.find("PopupFontSize") != (*sit).second.end()) + FontDialogPopup->Font->Size = (atoi ((*(*sit).second.find("PopupFontSize")).second.c_str())); + else + FontDialogPopup->Font->Size = 10; + + //**** Font ForeColor ****// + if ((*sit).second.find("TextFontColor") != (*sit).second.end()) + FontDialogText->Font->Color = TColor(atoi ((*(*sit).second.find("TextFontColor")).second.c_str())); + else + FontDialogText->Font->Color = clBlack; + + if ((*sit).second.find("CommentFontColor") != (*sit).second.end()) + FontDialogComment->Font->Color = TColor(atoi ((*(*sit).second.find("CommentFontColor")).second.c_str())); + else + FontDialogComment->Font->Color = clBlack; + + if ((*sit).second.find("LDFontColor") != (*sit).second.end()) + FontDialogLD->Font->Color = TColor(atoi ((*(*sit).second.find("LDFontColor")).second.c_str())); + else + FontDialogLD->Font->Color = clBlack; + if ((*sit).second.find("PopupFontColor") != (*sit).second.end()) + FontDialogPopup->Font->Color = TColor(atoi ((*(*sit).second.find("PopupFontColor")).second.c_str())); + else + FontDialogPopup->Font->Color = clBlack; + } +} + + +void __fastcall TOptionsfrm::shpNumClrMouseDown(TObject *Sender, + TMouseButton Button, TShiftState Shift, int X, int Y) +{ + btnNumClrClick(Sender); +} +//--------------------------------------------------------------------------- + + |