File: lr_dsopt.pas

package info (click to toggle)
lazarus 2.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 214,460 kB
  • sloc: pascal: 1,862,622; xml: 265,709; cpp: 56,595; sh: 3,008; java: 609; makefile: 535; perl: 297; sql: 222; ansic: 137
file content (159 lines) | stat: -rw-r--r-- 4,170 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159

{*****************************************}
{                                         }
{             FastReport v2.3             }
{             Designer options            }
{                                         }
{  Copyright (c) 1998-99 by Tzyganenko A. }
{                                         }
{*****************************************}

unit LR_DsOpt;

interface

{$I LR_Vers.inc}

uses
  Classes, SysUtils, LResources,
  Forms, Controls, Graphics, Dialogs,
  Buttons, StdCtrls,ComCtrls, ButtonPanel, Spin,
  LR_Const;

type

  { TfrDesOptionsForm }

  TfrDesOptionsForm = class(TForm)
    ButtonPanel1: TButtonPanel;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    GroupBox6: TGroupBox;
    GroupBox7: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    PageControl1: TPageControl;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    SpinEdit1: TSpinEdit;
    SpinEdit2: TSpinEdit;
    Tab1: TTabSheet;
    GroupBox1: TGroupBox;
    CB1: TCheckBox;
    CB2: TCheckBox;
    GroupBox2: TGroupBox;
    RB4: TRadioButton;
    RB5: TRadioButton;
    GroupBox3: TGroupBox;
    RB6: TRadioButton;
    RB7: TRadioButton;
    RB8: TRadioButton;
    GroupBox4: TGroupBox;
    RB1: TRadioButton;
    RB2: TRadioButton;
    RB3: TRadioButton;
    GroupBox5: TGroupBox;
    CB3: TCheckBox;
    CB4: TCheckBox;
    CB5: TCheckBox;
    TabSheet1: TTabSheet;
    procedure FormCreate(Sender: TObject);
    procedure RadioButton1Change(Sender: TObject);
  private
    procedure FillFonts;
  public
    { Public declarations }
  end;


implementation
uses LCLType, LCLIntf;

{$R *.lfm}

function EnumFontsProc( var LogFont: TEnumLogFontEx; var {%H-}Metric: TNewTextMetricEx;
  FontType: Longint; {%H-}Data: LParam):LongInt; stdcall;
var
  S: String;
  Lst: TStrings;
begin
  s := StrPas(LogFont.elfLogFont.lfFaceName);
  Lst := TStrings(PtrInt(Data));
  if Lst.IndexOf(S)<0 then
    Lst.AddObject(S, TObject(PtrInt(FontType)));
  Result := 1;
end;

procedure TfrDesOptionsForm.FormCreate(Sender: TObject);
begin
  PageControl1.ActivePageIndex:=0;
  Caption := sDesOptionsFormOpt;
  Tab1.Caption := sDesOptionsFormDes;
  GroupBox1.Caption := sDesOptionsFormGrid;
  GroupBox2.Caption := sDesOptionsFormObj;
  GroupBox3.Caption := sDesOptionsFormUnits;
  GroupBox4.Caption := sDesOptionsFormGrdSize;
  GroupBox5.Caption := sDesOptionsFormOther;
  CB1.Caption := sDesOptionsFormShowGrd;
  CB2.Caption := sDesOptionsFormAlignGrd;
  CB3.Caption := sDesOptionsFormColoredButton;
  CB4.Caption := sDesOptionsFormEditing;
  CB5.Caption := sDesOptionsFormShowBand;
  RB1.Caption := sDesOptionsForm4Pix;
  RB2.Caption := sDesOptionsForm8Pix;
  RB3.Caption := sDesOptionsForm18pix;
  RB4.Caption := sDesOptionsFormShape;
  RB5.Caption := sDesOptionsFormContents;
  RB6.Caption := sDesOptionsFormPix;
  RB7.Caption := sDesOptionsFormmm;
  RB8.Caption := sDesOptionsFormInch;
  TabSheet1.Caption := sEditor;
  GroupBox6.Caption := sMemoEditor;
  RadioButton1.Caption := sUseMemoFontSettings;
  RadioButton2.Caption := sUseFixedFontSettings;
  Label1.Caption := sFRDesignerFormFontName;
  Label2.Caption := sFRDesignerFormFontSize;
  GroupBox7.Caption := sScriptEditor;
  Label3.Caption := sFRDesignerFormFontName;
  Label4.Caption := sFRDesignerFormFontSize;
  CheckBox1.Caption := sUseSyntaxHighlight;
  //
  CheckBox2.Caption:= sDesOptionsFormInPlace;
  FillFonts;
  RadioButton1Change(nil);
end;

procedure TfrDesOptionsForm.RadioButton1Change(Sender: TObject);
begin
  Label1.Enabled:=RadioButton2.Checked;
  Label2.Enabled:=RadioButton2.Checked;
  ComboBox1.Enabled:=RadioButton2.Checked;
  SpinEdit1.Enabled:=RadioButton2.Checked;
end;

procedure TfrDesOptionsForm.FillFonts;
var
  DC: HDC;
  Lf: TLogFont;
begin
  ComboBox1.Clear;
  DC := GetDC(0);
  try
    Lf.lfFaceName := '';
    Lf.lfCharSet := DEFAULT_CHARSET;
    Lf.lfPitchAndFamily := 0;
    EnumFontFamiliesEx(DC, @Lf, @EnumFontsProc, PtrInt(ComboBox1.Items), 0);
  finally
    ReleaseDC(0, DC);
  end;
  ComboBox2.Items.Assign(ComboBox1.Items);
end;

end.