1 
2 {*****************************************}
3 {                                         }
4 {             FastReport v2.3             }
5 {             Designer options            }
6 {                                         }
7 {  Copyright (c) 1998-99 by Tzyganenko A. }
8 {                                         }
9 {*****************************************}
10 
11 unit LR_DsOpt;
12 
13 interface
14 
15 {$I LR_Vers.inc}
16 
17 uses
18   Classes, SysUtils, LResources,
19   Forms, Controls, Graphics, Dialogs,
20   Buttons, StdCtrls,ComCtrls, ButtonPanel, Spin,
21   LR_Const;
22 
23 type
24 
25   { TfrDesOptionsForm }
26 
27   TfrDesOptionsForm = class(TForm)
28     ButtonPanel1: TButtonPanel;
29     CheckBox1: TCheckBox;
30     CheckBox2: TCheckBox;
31     ComboBox1: TComboBox;
32     ComboBox2: TComboBox;
33     GroupBox6: TGroupBox;
34     GroupBox7: TGroupBox;
35     Label1: TLabel;
36     Label2: TLabel;
37     Label3: TLabel;
38     Label4: TLabel;
39     Label5: TLabel;
40     Label6: TLabel;
41     PageControl1: TPageControl;
42     RadioButton1: TRadioButton;
43     RadioButton2: TRadioButton;
44     SpinEdit1: TSpinEdit;
45     SpinEdit2: TSpinEdit;
46     Tab1: TTabSheet;
47     GroupBox1: TGroupBox;
48     CB1: TCheckBox;
49     CB2: TCheckBox;
50     GroupBox2: TGroupBox;
51     RB4: TRadioButton;
52     RB5: TRadioButton;
53     GroupBox3: TGroupBox;
54     RB6: TRadioButton;
55     RB7: TRadioButton;
56     RB8: TRadioButton;
57     GroupBox4: TGroupBox;
58     RB1: TRadioButton;
59     RB2: TRadioButton;
60     RB3: TRadioButton;
61     GroupBox5: TGroupBox;
62     CB3: TCheckBox;
63     CB4: TCheckBox;
64     CB5: TCheckBox;
65     TabSheet1: TTabSheet;
66     procedure FormCreate(Sender: TObject);
67     procedure RadioButton1Change(Sender: TObject);
68   private
69     procedure FillFonts;
70   public
71     { Public declarations }
72   end;
73 
74 
75 implementation
76 uses LCLType, LCLIntf;
77 
78 {$R *.lfm}
79 
EnumFontsProcnull80 function EnumFontsProc( var LogFont: TEnumLogFontEx; var {%H-}Metric: TNewTextMetricEx;
81   FontType: Longint; {%H-}Data: LParam):LongInt; stdcall;
82 var
83   S: String;
84   Lst: TStrings;
85 begin
86   s := StrPas(LogFont.elfLogFont.lfFaceName);
87   Lst := TStrings(PtrInt(Data));
88   if Lst.IndexOf(S)<0 then
89     Lst.AddObject(S, TObject(PtrInt(FontType)));
90   Result := 1;
91 end;
92 
93 procedure TfrDesOptionsForm.FormCreate(Sender: TObject);
94 begin
95   PageControl1.ActivePageIndex:=0;
96   Caption := sDesOptionsFormOpt;
97   Tab1.Caption := sDesOptionsFormDes;
98   GroupBox1.Caption := sDesOptionsFormGrid;
99   GroupBox2.Caption := sDesOptionsFormObj;
100   GroupBox3.Caption := sDesOptionsFormUnits;
101   GroupBox4.Caption := sDesOptionsFormGrdSize;
102   GroupBox5.Caption := sDesOptionsFormOther;
103   CB1.Caption := sDesOptionsFormShowGrd;
104   CB2.Caption := sDesOptionsFormAlignGrd;
105   CB3.Caption := sDesOptionsFormColoredButton;
106   CB4.Caption := sDesOptionsFormEditing;
107   CB5.Caption := sDesOptionsFormShowBand;
108   RB1.Caption := sDesOptionsForm4Pix;
109   RB2.Caption := sDesOptionsForm8Pix;
110   RB3.Caption := sDesOptionsForm18pix;
111   RB4.Caption := sDesOptionsFormShape;
112   RB5.Caption := sDesOptionsFormContents;
113   RB6.Caption := sDesOptionsFormPix;
114   RB7.Caption := sDesOptionsFormmm;
115   RB8.Caption := sDesOptionsFormInch;
116   TabSheet1.Caption := sEditor;
117   GroupBox6.Caption := sMemoEditor;
118   RadioButton1.Caption := sUseMemoFontSettings;
119   RadioButton2.Caption := sUseFixedFontSettings;
120   Label1.Caption := sFRDesignerFormFontName;
121   Label2.Caption := sFRDesignerFormFontSize;
122   GroupBox7.Caption := sScriptEditor;
123   Label3.Caption := sFRDesignerFormFontName;
124   Label4.Caption := sFRDesignerFormFontSize;
125   CheckBox1.Caption := sUseSyntaxHighlight;
126   //
127   CheckBox2.Caption:= sDesOptionsFormInPlace;
128   FillFonts;
129   RadioButton1Change(nil);
130 end;
131 
132 procedure TfrDesOptionsForm.RadioButton1Change(Sender: TObject);
133 begin
134   Label1.Enabled:=RadioButton2.Checked;
135   Label2.Enabled:=RadioButton2.Checked;
136   ComboBox1.Enabled:=RadioButton2.Checked;
137   SpinEdit1.Enabled:=RadioButton2.Checked;
138 end;
139 
140 procedure TfrDesOptionsForm.FillFonts;
141 var
142   DC: HDC;
143   Lf: TLogFont;
144 begin
145   ComboBox1.Clear;
146   DC := GetDC(0);
147   try
148     Lf.lfFaceName := '';
149     Lf.lfCharSet := DEFAULT_CHARSET;
150     Lf.lfPitchAndFamily := 0;
151     EnumFontFamiliesEx(DC, @Lf, @EnumFontsProc, PtrInt(ComboBox1.Items), 0);
152   finally
153     ReleaseDC(0, DC);
154   end;
155   ComboBox2.Items.Assign(ComboBox1.Items);
156 end;
157 
158 end.
159 
160