⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prtsetup.cpp

📁 用于开发Atmel的AVR系列单片机的GCC集成开发环境
💻 CPP
字号:
/**************************************************************************
Project: WinAVRIDE        Class: Printer Setup
Copyright (C) 2005  Philipp Schober

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

History
19.Feb 2005 - First Release (V1.0)
****************************************************************************/

#include <vcl.h>
#pragma hdrstop

#include "PrtSetup.h"
#include "MainForm.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TPrtSetForm *PrtSetForm;
//---------------------------------------------------------------------------
__fastcall TPrtSetForm::TPrtSetForm(TComponent* Owner)
        : TForm(Owner)
{
 TopMargin = 20;
 BottomMargin = 15;
 LeftMargin = 10;
 RightMargin = 10;
 HeaderMargin = 15;
 FooterMargin = 10;
 UseHighlighter = false;
 PrintNumbers = false;
}
//---------------------------------------------------------------------------
void __fastcall TPrtSetForm::ShowWindow (void)
{
 TopEd->Text = IntToStr (TopMargin);
 BottomEd->Text = IntToStr (BottomMargin);
 LeftEd->Text = IntToStr (LeftMargin);
 RightEd->Text = IntToStr (RightMargin);
 HeaderEd->Text = IntToStr (HeaderMargin);
 FooterEd->Text = IntToStr (FooterMargin);
 HLBox->Checked = UseHighlighter;
 LNBox->Checked = PrintNumbers;
 ShowModal ();
}
//---------------------------------------------------------------------------
void __fastcall TPrtSetForm::PrtButtonClick(TObject *Sender)
{
 PrinterSetupDialog1->Execute ();        
}
//---------------------------------------------------------------------------
void __fastcall TPrtSetForm::OkButtonClick(TObject *Sender)
{
 TopMargin = StrToInt (TopEd->Text);
 BottomMargin = StrToInt (BottomEd->Text);
 LeftMargin = StrToInt (LeftEd->Text);
 RightMargin = StrToInt (RightEd->Text);
 HeaderMargin = StrToInt (HeaderEd->Text);
 FooterMargin = StrToInt (FooterEd->Text);
 UseHighlighter = HLBox->Checked;
 PrintNumbers = LNBox->Checked;
 ModalResult = mrOk;
}
//---------------------------------------------------------------------------
void __fastcall TPrtSetForm::CancelClick(TObject *Sender)
{
 ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
void __fastcall TPrtSetForm::EditKeyPress(TObject *Sender, char &Key)
{
 if ((Key < '0' || Key > '9') && Key != '\b') Key = 0;
}
//---------------------------------------------------------------------------
void __fastcall TPrtSetForm::SaveStandard (void)
{
 int itemp;
 bool btemp;

 itemp = StrToInt (TopEd->Text);
 Form1->EnvIni->WriteInteger ("Printer", "TopMargin", itemp);
 itemp = StrToInt (BottomEd->Text);
 Form1->EnvIni->WriteInteger ("Printer", "BottomMargin", itemp);
 itemp = StrToInt (LeftEd->Text);
 Form1->EnvIni->WriteInteger ("Printer", "LeftMargin", itemp);
 itemp = StrToInt (RightEd->Text);
 Form1->EnvIni->WriteInteger ("Printer", "RightMargin", itemp);
 itemp = StrToInt (HeaderEd->Text);
 Form1->EnvIni->WriteInteger ("Printer", "HeaderMargin", itemp);
 itemp = StrToInt (FooterEd->Text);
 Form1->EnvIni->WriteInteger ("Printer", "FooterMargin", itemp);
 btemp = HLBox->Checked;
 Form1->EnvIni->WriteBool ("Printer", "UseHighlighter", btemp);
 btemp = LNBox->Checked;
 Form1->EnvIni->WriteBool ("Printer", "PrintNumbers", btemp);
}
//---------------------------------------------------------------------------
void __fastcall TPrtSetForm::LoadSettings (TIniFile *prj)
{
 TopMargin = prj->ReadInteger ("Printer", "TopMargin", 20);
 BottomMargin = prj->ReadInteger ("Printer", "BottomMargin", 15);
 LeftMargin = prj->ReadInteger ("Printer", "LeftMargin", 10);
 RightMargin = prj->ReadInteger ("Printer", "RightMargin", 10);
 HeaderMargin = prj->ReadInteger ("Printer", "HeaderMargin", 15);
 FooterMargin = prj->ReadInteger ("Printer", "FooterMargin", 10);
 UseHighlighter = prj->ReadBool ("Printer", "UseHighlighter", false);
 PrintNumbers = prj->ReadBool ("Printer", "PrintNumbers", false);
}
//---------------------------------------------------------------------------
void __fastcall TPrtSetForm::StdButtonClick(TObject *Sender)
{
 SaveStandard ();
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -