File: edupropsevents.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 (305 lines) | stat: -rw-r--r-- 8,516 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
{
 *****************************************************************************
  This file is part of the EducationLaz package

  See the file COPYING.modifiedLGPL.txt, included in this distribution,
  for details about the license.
 *****************************************************************************

  Author: Michael Kuhardt

  Abstract:
    Frame to setup Properties and events
}
unit EduPropsEvents;

{$mode objfpc}{$H+}

interface

uses
  Classes,
  // LCL
  LResources, Forms, StdCtrls, ExtCtrls,
  // LazUtils
  LazConfigStorage,
  // IdeIntf
  IDEOptionsIntf, IDEOptEditorIntf,
  // Education
  EduOptions;

type

  { TEduPropsEventsOptions }

  TEduPropsEventsOptions = class(TEduOptionsNode)
  private

    FPropsMinimal: boolean;
    FPropsExt: boolean;
    FPropsFull: boolean;

    FEventsMinimal: boolean;
    FEventsExt: boolean;
    FEventsFull: boolean;

  public
    constructor Create; override;
    destructor Destroy; override;
    function Load(Config: TConfigStorage): TModalResult; override;
    function Save(Config: TConfigStorage): TModalResult; override;
    procedure Apply(Enable: boolean); override;

    property PropsMinimal: boolean read FPropsMinimal write FPropsMinimal;
    property PropsExt: boolean read FPropsExt write FPropsExt;
    property PropsFull: boolean read FPropsFull write FPropsFull;

    property EventsMinimal: boolean read FEventsMinimal write FEventsMinimal;
    property EventsExt: boolean read FEventsExt write FEventsExt;
    property EventsFull: boolean read FEventsFull write FEventsFull;

  end;

  { TEduPropsEventsFrame }

  TEduPropsEventsFrame = class(TAbstractIDEOptionsEditor)
    grpBoxEvents: TGroupBox;
    grpBoxProps: TGroupBox;
    OptsPanel: TPanel;
    PropsMinRadioBtn: TRadioButton;
    PropsExtRadioBtn: TRadioButton;
    rdGrpProps: TRadioGroup;
    PropsFullRadioBtn: TRadioButton;
    EventsMinRadioBtn: TRadioButton;
    EventsExtRadioBtn: TRadioButton;
    EventsFullRadioBtn: TRadioButton;
    rdGrpEvents: TRadioGroup;
    stTextMinEvents: TStaticText;
    stTextExtProps: TStaticText;
    stTextMinProps: TStaticText;

    procedure EventsExtRadioBtnClick(Sender: TObject);
    procedure EventsFullRadioBtnClick(Sender: TObject);
    procedure EventsMinRadioBtnClick(Sender: TObject);
    procedure PropsExtRadioBtnClick(Sender: TObject);
    procedure PropsFullRadioBtnClick(Sender: TObject);
    procedure PropsMinRadioBtnClick(Sender: TObject);
    procedure rdGrpPropsClick(Sender: TObject);

  private
  public
    function GetTitle: String; override;
    procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
    procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
    class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
    procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
  end;

var
  EduPropsEventsOptions: TEduPropsEventsOptions = nil;

procedure Register;

implementation

procedure Register;
begin
  EduPropsEventsOptions:=TEduPropsEventsOptions.Create;
  EducationOptions.Root.Add(EduPropsEventsOptions);
  EduPropsEventsOptionsID:=RegisterIDEOptionsEditor(EduOptionID,
                           TEduPropsEventsFrame,EduPropsEventsOptionsID)^.Index;
end;

{ TEduPropsEventsOptions }

constructor TEduPropsEventsOptions.Create;

begin
  inherited Create;
  Name:='PropsEvents';

  PropsMinimal:=true;
  PropsExt:=false;
  PropsFull:=false;

  EventsMinimal:=true;
  EventsExt:=false;
  EventsFull:=false;

end;

destructor TEduPropsEventsOptions.Destroy;
begin
  inherited Destroy;
end;

function TEduPropsEventsOptions.Load(Config: TConfigStorage): TModalResult;
begin

  FPropsMinimal:=Config.GetValue('PropsMinimal',true);
  FPropsExt:=Config.GetValue('PropsExt',true);
  FPropsFull:=Config.GetValue('PropsFull',true);

  FEventsMinimal:=Config.GetValue('EventsMinimal',true);
  FEventsExt:=Config.GetValue('EventsExt',true);
  FEventsFull:=Config.GetValue('EventsFull',true);


  Result:=inherited Load(Config);
end;

function TEduPropsEventsOptions.Save(Config: TConfigStorage): TModalResult;
begin

  Config.SetValue('PropsMinimal',FPropsMinimal);
  Config.SetValue('PropsExt',FPropsExt);
  Config.SetValue('PropsFull',FPropsFull);

  Config.SetValue('EventsMinimal',FEventsMinimal);
  Config.SetValue('EventsExt',FEventsExt);
  Config.SetValue('EventsFull',FEventsFull);

  Result:=inherited Save(Config);
end;

procedure TEduPropsEventsOptions.Apply(Enable: boolean);
begin
  inherited Apply(Enable);
end;

{ TEduPropsEventsFrame }


procedure TEduPropsEventsFrame.PropsMinRadioBtnClick(Sender: TObject);
begin
  grpBoxProps.Caption:=ersGrpBoxPropsMin;
  stTextMinProps.Caption:=ersStTextPropsMin;
  stTextExtProps.Visible:=false;
end;

procedure TEduPropsEventsFrame.rdGrpPropsClick(Sender: TObject);
begin

end;

procedure TEduPropsEventsFrame.PropsExtRadioBtnClick(Sender: TObject);
begin
  grpBoxProps.Caption:=ersGrpBoxPropsExt;
  stTextMinProps.Caption:=ersStTextPropsMin;
  stTextExtProps.Visible:=true;
end;

procedure TEduPropsEventsFrame.EventsMinRadioBtnClick(Sender: TObject);
begin
  grpBoxEvents.Caption:=ersGrpBoxEventsMin;
  stTextMinEvents.Caption:=ersStTextEventsMin;
end;

procedure TEduPropsEventsFrame.EventsExtRadioBtnClick(Sender: TObject);
begin
   grpBoxEvents.Caption:=ersGrpBoxEventsExt;
   stTextMinEvents.Caption:=ersStTextEventsExt;
end;

procedure TEduPropsEventsFrame.EventsFullRadioBtnClick(Sender: TObject);
begin
  grpBoxEvents.Caption:=ersGrpBoxEventsFull;
  stTextMinEvents.Caption:=ersStTextEventsFull;
end;

procedure TEduPropsEventsFrame.PropsFullRadioBtnClick(Sender: TObject);
begin
  grpBoxProps.Caption:=ersGrpBoxPropsFull;
  stTextMinProps.Caption:=ersStTextPropsFull;
    stTextExtProps.Visible:=false;
end;



function TEduPropsEventsFrame.GetTitle: String;
begin
  Result:=ersEduPropsEventsTitle;
end;

procedure TEduPropsEventsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
begin
  if AOptions=EducationOptions then begin
    PropsMinRadioBtn.Checked:=EduPropsEventsOptions.PropsMinimal;
    PropsExtRadioBtn.Checked:=EduPropsEventsOptions.PropsExt;
    PropsFullRadioBtn.Checked:=EduPropsEventsOptions.PropsFull;

    EventsMinRadioBtn.Checked:=EduPropsEventsOptions.EventsMinimal;
    EventsExtRadioBtn.Checked:=EduPropsEventsOptions.EventsExt;
    EventsFullRadioBtn.Checked:=EduPropsEventsOptions.EventsFull;
  end;
end;

procedure TEduPropsEventsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin

  rdGrpProps.Caption:= ersRdGrpPropsCaption;
  rdGrpEvents.Caption:= ersRdGrpEventsCaption;

  PropsMinRadioBtn.Caption:= ersShowMinimal;
  PropsExtRadioBtn.Caption:= ersShowExtended;
  PropsFullRadioBtn.Caption:= ersRdBtnFull;

  EventsMinRadioBtn.Caption:= ersShowMinimal;
  EventsExtRadioBtn.Caption:= ersShowExtended;
  EventsFullRadioBtn.Caption:= ersRdBtnFull;

  stTextExtProps.Caption:=ersStTextPropsExt;
  stTextExtProps.Visible:=false;

  if (EduPropsEventsOptions.PropsMinimal)
   then begin
    grpBoxProps.Caption:=ersGrpBoxPropsMin;
    stTextMinProps.Caption:=ersStTextPropsMin
   end else if (EduPropsEventsOptions.PropsExt)
      then begin
        grpBoxProps.Caption:=ersGrpBoxPropsExt;
        stTextMinProps.Caption:=ersStTextPropsMin;
        stTextExtProps.Visible:=true
      end
   else begin
     grpBoxProps.Caption:=ersGrpBoxPropsFull;
     stTextMinProps.Caption:=ersStTextPropsFull

   end;
   if (EduPropsEventsOptions.EventsMinimal)
   then begin
    grpBoxEvents.Caption:=ersGrpBoxEventsMin;
    stTextMinEvents.Caption:=ersStTextEventsMin
   end
   else if (EduPropsEventsOptions.EventsExt)
      then begin
        grpBoxEvents.Caption:=ersGrpBoxEventsExt;
        stTextMinEvents.Caption:=ersStTextEventsExt;
      end
   else begin
     grpBoxEvents.Caption:=ersGrpBoxEventsFull;
     stTextMinEvents.Caption:=ersStTextEventsFull;
   end;
end;

class function TEduPropsEventsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin
  Result:=EducationIDEOptionsClass;
end;

procedure TEduPropsEventsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin
  if AOptions=EducationOptions then begin
    EduPropsEventsOptions.PropsMinimal:=PropsMinRadioBtn.Checked;
    EduPropsEventsOptions.PropsExt:=PropsExtRadioBtn.Checked;
    EduPropsEventsOptions.PropsFull:=PropsFullRadioBtn.Checked;

    EduPropsEventsOptions.EventsMinimal:=EventsMinRadioBtn.Checked;
    EduPropsEventsOptions.EventsExt:=EventsExtRadioBtn.Checked;
    EduPropsEventsOptions.EventsFull:=EventsFullRadioBtn.Checked;
  end;
end;

{$R *.lfm}

end.