home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / kolekce / d6 / FRCLX.ZIP / SOURCE / FR_DsOpt.pas < prev    next >
Pascal/Delphi Source File  |  2001-07-04  |  5KB  |  171 lines

  1.  
  2. {******************************************}
  3. {                                          }
  4. {           FastReport CLX v2.4            }
  5. {             Designer options             }
  6. {                                          }
  7. { Copyright (c) 1998-2001 by Tzyganenko A. }
  8. {                                          }
  9. {******************************************}
  10.  
  11. unit FR_DsOpt;
  12.  
  13. interface
  14.  
  15. {$I FR.inc}
  16.  
  17. uses
  18.   SysUtils, Classes, QGraphics, QControls, QForms, QDialogs,
  19.   QStdCtrls, QComCtrls, QExtCtrls, FR_Ctrls;
  20.  
  21. type
  22.   TfrDesOptionsForm = class(TForm)
  23.     PageControl1: TPageControl;
  24.     Tab1: TTabSheet;
  25.     GroupBox1: TGroupBox;
  26.     CB1: TCheckBox;
  27.     CB2: TCheckBox;
  28.     GroupBox3: TGroupBox;
  29.     RB6: TRadioButton;
  30.     RB7: TRadioButton;
  31.     RB8: TRadioButton;
  32.     GroupBox4: TGroupBox;
  33.     RB1: TRadioButton;
  34.     RB2: TRadioButton;
  35.     RB3: TRadioButton;
  36.     Button1: TButton;
  37.     Button2: TButton;
  38.     GroupBox5: TGroupBox;
  39.     CB4: TCheckBox;
  40.     CB5: TCheckBox;
  41.     GroupBox6: TGroupBox;
  42.     RB9: TRadioButton;
  43.     RB10: TRadioButton;
  44.     RB11: TRadioButton;
  45.     Tab2: TTabSheet;
  46.     GroupBox7: TGroupBox;
  47.     ERB1: TRadioButton;
  48.     ERB2: TRadioButton;
  49.     Label2: TLabel;
  50.     TextFontNameCB: TfrFontComboBox;
  51.     Label3: TLabel;
  52.     TextFontSizeCB: TfrComboBox;
  53.     SampleTextPanel: TPanel;
  54.     GroupBox8: TGroupBox;
  55.     Label4: TLabel;
  56.     Label5: TLabel;
  57.     ScriptFontNameCB: TfrFontComboBox;
  58.     ScriptFontSizeCB: TfrComboBox;
  59.     SampleScriptPanel: TPanel;
  60.     procedure FormCreate(Sender: TObject);
  61.     procedure ERB1Click(Sender: TObject);
  62.     procedure TextFontNameCBChange(Sender: TObject);
  63.     procedure ScriptFontNameCBChange(Sender: TObject);
  64.     procedure FormHide(Sender: TObject);
  65.   private
  66.     { Private declarations }
  67.     procedure Localize;
  68.   public
  69.     { Public declarations }
  70.   end;
  71.  
  72.  
  73. implementation
  74.  
  75. {$R *.xfm}
  76.  
  77. uses FR_Class, FR_Utils, FR_Const, FR_Dock;
  78.  
  79.  
  80. procedure TfrDesOptionsForm.Localize;
  81. begin
  82.   Caption := S53280;
  83.   Tab1.Caption := S53281;
  84.   GroupBox1.Caption := S53282;
  85.   GroupBox3.Caption := S53284;
  86.   GroupBox4.Caption := S53285;
  87.   GroupBox5.Caption := S53297;
  88.   GroupBox6.Caption := S53300;
  89.   CB1.Caption := S53286;
  90.   CB2.Caption := S53287;
  91.   CB4.Caption := S53298;
  92.   CB5.Caption := S53299;
  93.   RB1.Caption := S53289;
  94.   RB2.Caption := S53290;
  95.   RB3.Caption := S53291;
  96.   RB6.Caption := S53294;
  97.   RB7.Caption := S53295;
  98.   RB8.Caption := S53296;
  99.   RB9.Caption := S53301;
  100.   RB10.Caption := S53302;
  101.   RB11.Caption := S53303;
  102.  
  103.   Tab2.Caption := S53304;
  104.   GroupBox7.Caption := S53305;
  105.   GroupBox8.Caption := S53310;
  106.   ERB1.Caption := S53306;
  107.   ERB2.Caption := S53307;
  108.   Label2.Caption := S53308;
  109.   Label3.Caption := S53309;
  110.   Label4.Caption := S53308;
  111.   Label5.Caption := S53309;
  112.  
  113.   Button1.Caption := (SOk);
  114.   Button2.Caption := (SCancel);
  115. end;
  116.  
  117. procedure TfrDesOptionsForm.FormCreate(Sender: TObject);
  118. var
  119.   Nm: String;
  120. begin
  121.   Localize;
  122.   Nm := rsForm + frDesigner.ClassName;
  123.   TextFontNameCB.ItemIndex := TextFontNameCB.Items.IndexOf(frIni.ReadString(Nm, 'TextFontName', 'Arial'));
  124.   TextFontSizeCB.Text := frIni.ReadString(Nm, 'TextFontSize', '10');
  125.   ScriptFontNameCB.Text := frIni.ReadString(Nm, 'ScriptFontName', 'Courier New');
  126.   ScriptFontSizeCB.Text := frIni.ReadString(Nm, 'ScriptFontSize', '10');
  127.   ERB1.Checked := frIni.ReadBool(Nm, 'UseDefaultFont', True);
  128.   ERB2.Checked := not ERB1.Checked;
  129.  
  130.   ERB1Click(nil);
  131.   TextFontNameCBChange(nil);
  132.   ScriptFontNameCBChange(nil);
  133. end;
  134.  
  135. procedure TfrDesOptionsForm.FormHide(Sender: TObject);
  136. var
  137.   Nm: String;
  138. begin
  139.   if ModalResult = mrOk then
  140.   begin
  141.     Nm := rsForm + frDesigner.ClassName;
  142.     frIni.WriteString(Nm, 'TextFontName', TextFontNameCB.Text);
  143.     frIni.WriteString(Nm, 'TextFontSize', TextFontSizeCB.Text);
  144.     frIni.WriteString(Nm, 'ScriptFontName', ScriptFontNameCB.Text);
  145.     frIni.WriteString(Nm, 'ScriptFontSize', ScriptFontSizeCB.Text);
  146.     frIni.WriteBool(Nm, 'UseDefaultFont', ERB1.Checked);
  147.   end;
  148. end;
  149.  
  150. procedure TfrDesOptionsForm.ERB1Click(Sender: TObject);
  151. begin
  152.   frEnableControls([Label2, TextFontNameCB, Label3, TextFontSizeCB], ERB2.Checked);
  153. end;
  154.  
  155. procedure TfrDesOptionsForm.TextFontNameCBChange(Sender: TObject);
  156. begin
  157.   SampleTextPanel.Font.Charset := TFontCharset(frCharset);
  158.   SampleTextPanel.Font.Name := TextFontNameCB.Text;
  159.   SampleTextPanel.Font.Size := StrToInt(TextFontSizeCB.Text);
  160. end;
  161.  
  162. procedure TfrDesOptionsForm.ScriptFontNameCBChange(Sender: TObject);
  163. begin
  164.   SampleScriptPanel.Font.Charset := TFontCharset(frCharset);
  165.   SampleScriptPanel.Font.Name := ScriptFontNameCB.Text;
  166.   SampleScriptPanel.Font.Size := StrToInt(ScriptFontSizeCB.Text);
  167. end;
  168.  
  169. end.
  170.  
  171.