[sword-cvs] sword/apps/windoze/CBuilder5/BibleCS PrintFrm.cpp,1.11,1.12 PrintFrm.dfm,1.14,1.15 PrintFrm.h,1.5,1.6
sword@www.crosswire.org
sword@www.crosswire.org
Tue, 11 Feb 2003 13:15:25 -0700
Update of /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS
In directory www:/tmp/cvs-serv23244
Modified Files:
PrintFrm.cpp PrintFrm.dfm PrintFrm.h
Log Message:
BibleCS:
Updated Printing: Implemented more saving and restoring of printing settings, esp. for margins. More to come...
Index: PrintFrm.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/PrintFrm.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** PrintFrm.cpp 27 Jan 2003 23:12:39 -0000 1.11
--- PrintFrm.cpp 11 Feb 2003 20:15:22 -0000 1.12
***************
*** 38,41 ****
--- 38,42 ----
void __fastcall TPrintForm::FormShow(TObject *Sender) {
+ /* TODO -oDavid T -cPrinting : Remove this once Printing is in a finished form */
if(Form1->optionsconf->Sections["Printing"]["Notice"] != "1"){
Application->MessageBox("This release of The Sword Printer is preliminary and is not yet fully functional, therefore some of the features here have been disabled. Please be sure to take a look at the formatting options to be able to fully take control of how your page will look. Also be sure to use the \"Print Preview\" feature to preview how your page(s) will look on paper before printing. Enjoy! From, The Sword Project Development Team!", "The Sword Printer", MB_ICONINFORMATION | MB_OK);
***************
*** 82,87 ****
}
SetHint();
! fontName = ((eit = Form1->optionsconf->Sections["PrintPrefs"].find("PrintFontName")) != Form1->optionsconf->Sections["PrintPrefs"].end())? (*eit).second.c_str() : "Times New Roman";
! cmbFont->ItemIndex = cmbFont->Items->IndexOf(fontName);
PageControl1->ActivePage = shtSelection;
--- 83,90 ----
}
SetHint();
! // Removed this because I want to place it in a central location which will load all
! // the printed page settings -- David Trotz
! // fontName = ((eit = Form1->optionsconf->Sections["PrintedPage"].find("TextFontName")) != Form1->optionsconf->Sections["PrintedPage"].end())? (*eit).second.c_str() : "Times New Roman";
! // cmbFont->ItemIndex = cmbFont->Items->IndexOf(fontName);
PageControl1->ActivePage = shtSelection;
***************
*** 149,153 ****
//---------------------------------------------------------------------------
! void __fastcall TPrintForm::spinLeftClick(TObject *Sender,
TUDBtnType Button)
{
--- 152,156 ----
//---------------------------------------------------------------------------
! void __fastcall TPrintForm::spnLeftClick(TObject *Sender,
TUDBtnType Button)
{
***************
*** 160,164 ****
//---------------------------------------------------------------------------
! void __fastcall TPrintForm::spinRightClick(TObject *Sender,
TUDBtnType Button)
{
--- 163,167 ----
//---------------------------------------------------------------------------
! void __fastcall TPrintForm::spnRightClick(TObject *Sender,
TUDBtnType Button)
{
***************
*** 170,174 ****
//---------------------------------------------------------------------------
! void __fastcall TPrintForm::spinBottomClick(TObject *Sender,
TUDBtnType Button)
{
--- 173,177 ----
//---------------------------------------------------------------------------
! void __fastcall TPrintForm::spnBottomClick(TObject *Sender,
TUDBtnType Button)
{
***************
*** 180,184 ****
//---------------------------------------------------------------------------
! void __fastcall TPrintForm::spinTopClick(TObject *Sender,
TUDBtnType Button)
{
--- 183,187 ----
//---------------------------------------------------------------------------
! void __fastcall TPrintForm::spnTopClick(TObject *Sender,
TUDBtnType Button)
{
***************
*** 355,372 ****
StrKey testKey;
SavePrintPrefs();
- /*
- format.bkFontHeadSize = 2 * editHeading->Text.ToInt();
- format.bodyFontSize = 2 * editBody->Text.ToInt();
- format.vsNumFontSize = 2 * editNumbers->Text.ToInt();
- format.chFontHeadSize = 2 * editHeading->Text.ToInt();
- format.fontFace = cmbFont->Text;
- format.paragraph = ckParagraph->Checked;
- format.prBookHeadings = ckBookHead->Checked;
- format.prChHeadings = ckChHead->Checked;
- format.prPreFix = ckPrefix->Checked;
- format.prPostFix = ckPostfix->Checked;
- format.prVerseNum = ckVSNum->Checked;
- format.superVSNum = ckSuperVS->Checked;
- */
lstKey.Persist(1);
--- 358,361 ----
***************
*** 419,422 ****
--- 408,510 ----
void TPrintForm::SetDefaultOps()
{
+ string modType = "",
+ tempVal = "";
+ if(radText->Checked)
+ modType = "Text";
+ else if(radComm->Checked)
+ modType = "Comm";
+ else modType = "LD";
+
+ //**** Print Chapter Headings? ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType + "ChHead")];
+ if (tempVal == "")
+ ckChHead->Checked = true;
+ else ckChHead->Checked = (atoi(tempVal.c_str())) ? true : false;
+
+ //**** Print Book Name? ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType +"BkName")];
+ if (tempVal == "")
+ ckBookHead->Checked = true;
+ else ckBookHead->Checked = (atoi(tempVal.c_str())) ? true : false;
+
+ //**** Prefix Each Verse? ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType +"PreFixTag")];
+ if (tempVal == "")
+ ckPrefix->Checked = true;
+ else ckPrefix->Checked = (atoi(tempVal.c_str())) ? true : false;
+
+ //**** Postfix Each Verse? ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType +"PostFixTag")];
+ if (tempVal == "")
+ ckPostfix->Checked = true;
+ else ckPostfix->Checked = (atoi(tempVal.c_str())) ? true : false;
+
+ //**** Print the verse number? ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType + "VSNum")];
+ if (tempVal == "")
+ ckVSNum->Checked = true;
+ else ckVSNum->Checked = (atoi(tempVal.c_str())) ? true : false;
+
+ //**** Superscript the verse number? ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType + "SuperVS")];
+ if (tempVal == "")
+ ckSuperVS->Checked = true;
+ else ckSuperVS->Checked = (atoi(tempVal.c_str())) ? true : false;
+
+ //**** Print as a paragraph? ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType + "Paragraph")];
+ if (tempVal == "")
+ ckParagraph->Checked = true;
+ else ckParagraph->Checked = (atoi(tempVal.c_str())) ? true : false;
+
+ //**** Chapter Heading Size ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType + "ChHeadSize")];
+ if (tempVal != "")
+ spnHeading->Position = (atoi(tempVal.c_str()));
+
+ //**** Body Text Size ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType + "FontSize")];
+ if (tempVal != "")
+ spnBody->Position = (atoi(tempVal.c_str()));
+
+ //**** Verse Number Size ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType + "VSNumSize")];
+ if (tempVal != "")
+ spnNumbers->Position = (atoi(tempVal.c_str()));
+
+ //**** Left Margin ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][("LeftMargin")];
+ if (tempVal != ""){
+ spnLeft->Position = GetSpinPos(atof(tempVal.c_str()));
+ editLeft->Text = roundMargin(atof(tempVal.c_str()));
+ }
+
+ //**** Right Margin ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][("RightMargin")];
+ if (tempVal != ""){
+ spnRight->Position = GetSpinPos(atof(tempVal.c_str()));
+ editRight->Text = roundMargin(atof(tempVal.c_str()));
+ }
+
+ //**** Top Margin ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][("TopMargin")];
+ if (tempVal != ""){
+ spnTop->Position = GetSpinPos(atof(tempVal.c_str()));
+ editTop->Text = roundMargin(atof(tempVal.c_str()));
+ }
+
+ //**** Bottom Margin ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][("BottomMargin")];
+ if (tempVal != ""){
+ spnBottom->Position = GetSpinPos(atof(tempVal.c_str()));
+ editBottom->Text = roundMargin(atof(tempVal.c_str()));
+ }
+
+ //**** Font Name ****//
+ tempVal = Form1->optionsconf->Sections["PrintedPage"][(modType + "FontName")];
+ if (tempVal != "")
+ cmbFont->ItemIndex = cmbFont->Items->IndexOf(tempVal.c_str());
+
+ /*
if(radText->Checked){
ckBookHead->Checked = true;
***************
*** 444,447 ****
--- 532,536 ----
ckPostfix->Checked = false;
}
+ */
}
***************
*** 469,479 ****
emap[type + "PreFixTag"] = IntToStr((ckPrefix->Checked)?1:0).c_str();
emap[type + "PostFixTag"] = IntToStr((ckPostfix->Checked)?1:0).c_str();
-
emap[type + "ChHeadSize"] = editHeading->Text.c_str();
emap[type + "FontSize"] = editBody->Text.c_str();
emap[type + "VSNumSize"] = editNumbers->Text.c_str();
emap[type + "FontName"] = cmbFont->Text.c_str();
config->Sections["PrintedPage"] = emap;
config->Save();
}
--- 558,590 ----
emap[type + "PreFixTag"] = IntToStr((ckPrefix->Checked)?1:0).c_str();
emap[type + "PostFixTag"] = IntToStr((ckPostfix->Checked)?1:0).c_str();
emap[type + "ChHeadSize"] = editHeading->Text.c_str();
emap[type + "FontSize"] = editBody->Text.c_str();
emap[type + "VSNumSize"] = editNumbers->Text.c_str();
emap[type + "FontName"] = cmbFont->Text.c_str();
+ // Non text type dependent settings
+ emap["LeftMargin"] = editLeft->Text.c_str();
+ emap["RightMargin"] = editRight->Text.c_str();
+ emap["TopMargin"] = editTop->Text.c_str();
+ emap["BottomMargin"] = editBottom->Text.c_str();
+ emap["PrnHeader"] = IntToStr((ckHeader->Checked)?1:0).c_str();
+ emap["PrnFooter"] = IntToStr((ckFooter->Checked)?1:0).c_str();
+ emap["Header"] = editHeader->Text.c_str();
+ emap["Footer"] = editFooter->Text.c_str();
config->Sections["PrintedPage"] = emap;
config->Save();
}
+
+ int inline TPrintForm::GetSpinPos(const float & value)
+ {
+ return ((int)(roundMargin(value) / .05));
+ }
+
+ float TPrintForm::roundMargin(float value)
+ {
+ value *= 100; // Move the decimal right two positions
+ int nVal = Ceil(value); // Round up
+ if(nVal % 5)
+ nVal = nVal - (nVal % 5) + 5;
+ return nVal / 100.00; // Move decimal left two positions
+ }
Index: PrintFrm.dfm
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/PrintFrm.dfm,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** PrintFrm.dfm 27 Aug 2002 22:52:36 -0000 1.14
--- PrintFrm.dfm 11 Feb 2003 20:15:22 -0000 1.15
***************
*** 1,5 ****
object PrintForm: TPrintForm
! Left = 151
! Top = 114
Width = 550
Height = 310
--- 1,5 ----
object PrintForm: TPrintForm
! Left = 275
! Top = 210
Width = 550
Height = 310
***************
*** 22,26 ****
Top = 0
Width = 92
! Height = 283
Align = alRight
BevelOuter = bvNone
--- 22,26 ----
Top = 0
Width = 92
! Height = 276
Align = alRight
BevelOuter = bvNone
***************
*** 123,129 ****
Top = 0
Width = 450
! Height = 283
! ActivePage = shtSelection
Align = alClient
TabOrder = 1
object shtSelection: TTabSheet
--- 123,130 ----
Top = 0
Width = 450
! Height = 276
! ActivePage = shtSetup
Align = alClient
+ TabIndex = 1
TabOrder = 1
object shtSelection: TTabSheet
***************
*** 255,262 ****
Width = 44
Height = 21
TabOrder = 0
Text = '0.50'
end
! object spinLeft: TUpDown
Left = 59
Top = 53
--- 256,264 ----
Width = 44
Height = 21
+ ReadOnly = True
TabOrder = 0
Text = '0.50'
end
! object spnLeft: TUpDown
Left = 59
Top = 53
***************
*** 264,272 ****
Height = 21
Min = 0
! Position = 50
TabOrder = 1
Thousands = False
Wrap = False
! OnClick = spinLeftClick
end
object editBottom: TEdit
--- 266,275 ----
Height = 21
Min = 0
! Max = 39
! Position = 9
TabOrder = 1
Thousands = False
Wrap = False
! OnClick = spnLeftClick
end
object editBottom: TEdit
***************
*** 275,282 ****
Width = 44
Height = 21
TabOrder = 2
Text = '0.75'
end
! object spinBottom: TUpDown
Left = 166
Top = 105
--- 278,286 ----
Width = 44
Height = 21
+ ReadOnly = True
TabOrder = 2
Text = '0.75'
end
! object spnBottom: TUpDown
Left = 166
Top = 105
***************
*** 284,293 ****
Height = 21
Min = 0
! Position = 50
TabOrder = 3
Wrap = False
! OnClick = spinBottomClick
end
! object spinRight: TUpDown
Left = 166
Top = 55
--- 288,298 ----
Height = 21
Min = 0
! Max = 39
! Position = 14
TabOrder = 3
Wrap = False
! OnClick = spnBottomClick
end
! object spnRight: TUpDown
Left = 166
Top = 55
***************
*** 295,302 ****
Height = 21
Min = 0
! Position = 50
TabOrder = 4
Wrap = False
! OnClick = spinRightClick
end
object editRight: TEdit
--- 300,308 ----
Height = 21
Min = 0
! Max = 39
! Position = 9
TabOrder = 4
Wrap = False
! OnClick = spnRightClick
end
object editRight: TEdit
***************
*** 305,312 ****
Width = 44
Height = 21
TabOrder = 5
Text = '0.50'
end
! object spinTop: TUpDown
Left = 59
Top = 103
--- 311,319 ----
Width = 44
Height = 21
+ ReadOnly = True
TabOrder = 5
Text = '0.50'
end
! object spnTop: TUpDown
Left = 59
Top = 103
***************
*** 314,321 ****
Height = 21
Min = 0
! Position = 50
TabOrder = 6
Wrap = False
! OnClick = spinTopClick
end
object editTop: TEdit
--- 321,329 ----
Height = 21
Min = 0
! Max = 39
! Position = 9
TabOrder = 6
Wrap = False
! OnClick = spnTopClick
end
object editTop: TEdit
***************
*** 324,327 ****
--- 332,336 ----
Width = 44
Height = 21
+ ReadOnly = True
TabOrder = 7
Text = '0.50'
***************
*** 429,433 ****
Caption = 'labelFont'
end
! object UpDown5: TUpDown
Left = 147
Top = 16
--- 438,442 ----
Caption = 'labelFont'
end
! object spnHeading: TUpDown
Left = 147
Top = 16
***************
*** 449,453 ****
Text = '16'
end
! object UpDown6: TUpDown
Left = 147
Top = 42
--- 458,462 ----
Text = '16'
end
! object spnBody: TUpDown
Left = 147
Top = 42
***************
*** 469,473 ****
Text = '12'
end
! object UpDown7: TUpDown
Left = 147
Top = 69
--- 478,482 ----
Text = '12'
end
! object spnNumbers: TUpDown
Left = 147
Top = 69
Index: PrintFrm.h
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/PrintFrm.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PrintFrm.h 27 Jan 2003 23:12:39 -0000 1.5
--- PrintFrm.h 11 Feb 2003 20:15:22 -0000 1.6
***************
*** 52,62 ****
TLabel *labelTop;
TEdit *editLeft;
! TUpDown *spinLeft;
TEdit *editBottom;
! TUpDown *spinBottom;
TEdit *editTop;
! TUpDown *spinTop;
TEdit *editRight;
! TUpDown *spinRight;
TLabel *labelHeader;
TLabel *labelFooter;
--- 52,62 ----
TLabel *labelTop;
TEdit *editLeft;
! TUpDown *spnLeft;
TEdit *editBottom;
! TUpDown *spnBottom;
TEdit *editTop;
! TUpDown *spnTop;
TEdit *editRight;
! TUpDown *spnRight;
TLabel *labelHeader;
TLabel *labelFooter;
***************
*** 66,74 ****
TLabel *Label11;
TLabel *Label12;
! TUpDown *UpDown5;
TEdit *editHeading;
! TUpDown *UpDown6;
TEdit *editBody;
! TUpDown *UpDown7;
TEdit *editNumbers;
TPrinterSetupDialog *PrinterSetupDialog;
--- 66,74 ----
TLabel *Label11;
TLabel *Label12;
! TUpDown *spnHeading;
TEdit *editHeading;
! TUpDown *spnBody;
TEdit *editBody;
! TUpDown *spnNumbers;
TEdit *editNumbers;
TPrinterSetupDialog *PrinterSetupDialog;
***************
*** 90,97 ****
void __fastcall radCommClick(TObject *Sender);
void __fastcall radLDClick(TObject *Sender);
! void __fastcall spinLeftClick(TObject *Sender, TUDBtnType Button);
! void __fastcall spinRightClick(TObject *Sender, TUDBtnType Button);
! void __fastcall spinBottomClick(TObject *Sender, TUDBtnType Button);
! void __fastcall spinTopClick(TObject *Sender, TUDBtnType Button);
void __fastcall btnPrintClick(TObject *Sender);
void __fastcall OnPrint(TRxRichEdit* rtfPrint);
--- 90,97 ----
void __fastcall radCommClick(TObject *Sender);
void __fastcall radLDClick(TObject *Sender);
! void __fastcall spnLeftClick(TObject *Sender, TUDBtnType Button);
! void __fastcall spnRightClick(TObject *Sender, TUDBtnType Button);
! void __fastcall spnBottomClick(TObject *Sender, TUDBtnType Button);
! void __fastcall spnTopClick(TObject *Sender, TUDBtnType Button);
void __fastcall btnPrintClick(TObject *Sender);
void __fastcall OnPrint(TRxRichEdit* rtfPrint);
***************
*** 102,106 ****
void __fastcall ckVSNumClick(TObject *Sender);
private:
! void SavePrintPrefs(); // User declarations
public: // User declarations
TFontComboBox *cmbFont;
--- 102,108 ----
void __fastcall ckVSNumClick(TObject *Sender);
private:
! void SavePrintPrefs();
! int inline GetSpinPos(const float & value);
! float roundMargin(float value); // User declarations
public: // User declarations
TFontComboBox *cmbFont;