File: designeditors.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 (589 lines) | stat: -rw-r--r-- 13,289 bytes parent folder | download | duplicates (2)
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
unit DesignEditors;

{$mode delphi}{$H+}

interface

uses
  Classes, SysUtils, ComponentEditors, PropEdits, DesignIntf, DesignMenus, Generics.Defaults,
  TypInfo, IniFiles, Menus;

type

  { TComponentEditor }

  TComponentEditor = class(TBaseComponentEditor, IComponentEditor)
  private
    //FLazaComponentEditors: ComponentEditors.TComponentEditor;
    FComponent: TComponent;
    FDesigner: IDesigner;
  public
    constructor Create(AComponent: TComponent; ADesigner: IDesigner); override;
    procedure Edit; virtual;
    procedure ExecuteVerb(Index: Integer); virtual;
    function GetComponent: TComponent;
    function GetDesigner: IDesigner;
    function GetVerb(Index: Integer): string; virtual;
    function GetVerbCount: Integer; virtual;
    function IsInInlined: Boolean;
    procedure Copy; virtual;
    procedure PrepareItem(Index: Integer; const AItem: IMenuItem); virtual;
    property Component: TComponent read FComponent;
    property Designer: IDesigner read GetDesigner;
  end;

implementation

type

  { TIDesignerProxy }

  TIDesignerProxy = class(TInterfacedObject, IDesigner60, IDesigner70, IDesigner80,
    IDesigner100, IDesigner)
  private
    FLazarusDesigner: TComponentEditorDesigner;
  public
    constructor Create(ADesigner: TComponentEditorDesigner);

    // IDesigner60
    procedure Activate;
    procedure Modified;
    function CreateMethod(const Name: string; TypeData: PTypeData): TMethod; overload;
    function GetMethodName(const Method: TMethod): string;
    procedure GetMethods(TypeData: PTypeData; Proc: TGetStrProc); overload;
    function GetPathAndBaseExeName: string;
    function GetPrivateDirectory: string;
    function GetBaseRegKey: string;
    function GetIDEOptions: TCustomIniFile;
    procedure GetSelections(const List: IDesignerSelections);
    function MethodExists(const Name: string): Boolean;
    procedure RenameMethod(const CurName, NewName: string);
    procedure SelectComponent(Instance: TPersistent); overload;
    procedure SetSelections(const List: IDesignerSelections);
    procedure ShowMethod(const Name: string);
    procedure GetComponentNames(TypeData: PTypeData; Proc: TGetStrProc);
    function GetComponent(const Name: string): TComponent;
    function GetComponentName(Component: TComponent): string;
    function GetObject(const Name: string): TPersistent;
    function GetObjectName(Instance: TPersistent): string;
    procedure GetObjectNames(TypeData: PTypeData; Proc: TGetStrProc);
    function MethodFromAncestor(const Method: TMethod): Boolean;
    function CreateComponent(ComponentClass: TComponentClass; Parent: TComponent;
      Left, Top, Width, Height: Integer): TComponent;
    function CreateCurrentComponent(Parent: TComponent; const Rect: TRect): TComponent;
    function IsComponentLinkable(Component: TComponent): Boolean;
    function IsComponentHidden(Component: TComponent): Boolean;
    procedure MakeComponentLinkable(Component: TComponent);
    procedure Revert(Instance: TPersistent; PropInfo: PPropInfo);
    function GetIsDormant: Boolean;
    procedure GetProjectModules(Proc: TGetModuleProc);
    function GetAncestorDesigner: IDesigner;
    function IsSourceReadOnly: Boolean;
    function GetScrollRanges(const ScrollPosition: TPoint): TPoint;
    procedure Edit(const Component: TComponent);
    procedure ChainCall(const MethodName, InstanceName, InstanceMethod: string;
      TypeData: PTypeData); overload;
    procedure ChainCall(const MethodName, InstanceName, InstanceMethod: string;
      const AEventInfo: IEventInfo); overload;
    procedure CopySelection;
    procedure CutSelection;
    function CanPaste: Boolean;
    procedure PasteSelection;
    procedure DeleteSelection(ADoAll: Boolean = False);
    procedure ClearSelection;
    procedure NoSelection;
    procedure ModuleFileNames(var ImplFileName, IntfFileName, FormFileName: string);
    function GetRootClassName: string;
    function UniqueName(const BaseName: string): string;
    function GetRoot: TComponent;
    function GetShiftState: TShiftState;
    procedure ModalEdit(EditKey: Char; const ReturnWindow: IActivatable);
    procedure SelectItemName(const PropertyName: string);
    procedure Resurrect;

    // IDesigner70
    function GetActiveClassGroup: TPersistentClass;
    function FindRootAncestor(const AClassName: string): TComponent;

    // IDesigner80
    function CreateMethod(const Name: string; const AEventInfo: IEventInfo): TMethod; overload;
    procedure GetMethods(const AEventInfo: IEventInfo; Proc: TGetStrProc); overload;
    procedure SelectComponent(const ADesignObject: IDesignObject); overload;

    // IDesigner100 = interface(IDesigner80)
    function GetDesignerExtension: string;

    // IDesigner
    function GetAppDataDirectory(Local: Boolean = False): string;
  end;


  { TComponentEditorProxy }

  TComponentEditorProxy = class(ComponentEditors.TComponentEditor)
  private
    FDelphiComponentEditor: TComponentEditor;
  public
    constructor Create(AComponent: TComponent;
      ADesigner: TComponentEditorDesigner); override;
    procedure Edit; override;
    procedure ExecuteVerb(Index: Integer); override;
    function GetComponent: TComponent; override;
    function GetCustomHint: String; override;
    function GetDesigner: TComponentEditorDesigner; override;
    function GetVerb(Index: Integer): string; override;
    function GetVerbCount: Integer; override;
    function IsInInlined: Boolean; override;
    procedure Copy; override;
    procedure PrepareItem({%H-}Index: Integer; const {%H-}AnItem: TMenuItem); override;
    function GetHook(out Hook: TPropertyEditorHook): boolean; override;
    procedure Modified; override;
  end;

{ TIDesignerProxy }

constructor TIDesignerProxy.Create(ADesigner: TComponentEditorDesigner);
begin
  inherited Create;
  FLazarusDesigner := ADesigner;
end;

procedure TIDesignerProxy.Activate;
begin

end;

procedure TIDesignerProxy.Modified;
begin
  FLazarusDesigner.Modified;
end;

function TIDesignerProxy.CreateMethod(const Name: string; TypeData: PTypeData
  ): TMethod;
begin
  FLazarusDesigner.PropertyEditorHook.CreateMethod(Name, TypeData.BaseType,
    FLazarusDesigner.LookupRoot, '');
end;

function TIDesignerProxy.GetMethodName(const Method: TMethod): string;
begin

end;

procedure TIDesignerProxy.GetMethods(TypeData: PTypeData; Proc: TGetStrProc);
begin

end;

function TIDesignerProxy.GetPathAndBaseExeName: string;
begin

end;

function TIDesignerProxy.GetPrivateDirectory: string;
begin

end;

function TIDesignerProxy.GetBaseRegKey: string;
begin

end;

function TIDesignerProxy.GetIDEOptions: TCustomIniFile;
begin

end;

procedure TIDesignerProxy.GetSelections(const List: IDesignerSelections);
begin

end;

function TIDesignerProxy.MethodExists(const Name: string): Boolean;
begin

end;

procedure TIDesignerProxy.RenameMethod(const CurName, NewName: string);
begin

end;

procedure TIDesignerProxy.SelectComponent(Instance: TPersistent);
begin

end;

procedure TIDesignerProxy.SetSelections(const List: IDesignerSelections);
begin

end;

procedure TIDesignerProxy.ShowMethod(const Name: string);
begin

end;

procedure TIDesignerProxy.GetComponentNames(TypeData: PTypeData;
  Proc: TGetStrProc);
begin

end;

function TIDesignerProxy.GetComponent(const Name: string): TComponent;
begin

end;

function TIDesignerProxy.GetComponentName(Component: TComponent): string;
begin

end;

function TIDesignerProxy.GetObject(const Name: string): TPersistent;
begin

end;

function TIDesignerProxy.GetObjectName(Instance: TPersistent): string;
begin

end;

procedure TIDesignerProxy.GetObjectNames(TypeData: PTypeData; Proc: TGetStrProc
  );
begin

end;

function TIDesignerProxy.MethodFromAncestor(const Method: TMethod): Boolean;
begin

end;

function TIDesignerProxy.CreateComponent(ComponentClass: TComponentClass;
  Parent: TComponent; Left, Top, Width, Height: Integer): TComponent;
begin

end;

function TIDesignerProxy.CreateCurrentComponent(Parent: TComponent;
  const Rect: TRect): TComponent;
begin

end;

function TIDesignerProxy.IsComponentLinkable(Component: TComponent): Boolean;
begin

end;

function TIDesignerProxy.IsComponentHidden(Component: TComponent): Boolean;
begin

end;

procedure TIDesignerProxy.MakeComponentLinkable(Component: TComponent);
begin

end;

procedure TIDesignerProxy.Revert(Instance: TPersistent; PropInfo: PPropInfo);
begin

end;

function TIDesignerProxy.GetIsDormant: Boolean;
begin

end;

procedure TIDesignerProxy.GetProjectModules(Proc: TGetModuleProc);
begin

end;

function TIDesignerProxy.GetAncestorDesigner: IDesigner;
begin

end;

function TIDesignerProxy.IsSourceReadOnly: Boolean;
begin

end;

function TIDesignerProxy.GetScrollRanges(const ScrollPosition: TPoint): TPoint;
begin

end;

procedure TIDesignerProxy.Edit(const Component: TComponent);
begin

end;

procedure TIDesignerProxy.ChainCall(const MethodName, InstanceName,
  InstanceMethod: string; TypeData: PTypeData);
begin

end;

procedure TIDesignerProxy.ChainCall(const MethodName, InstanceName,
  InstanceMethod: string; const AEventInfo: IEventInfo);
begin

end;

procedure TIDesignerProxy.CopySelection;
begin

end;

procedure TIDesignerProxy.CutSelection;
begin

end;

function TIDesignerProxy.CanPaste: Boolean;
begin

end;

procedure TIDesignerProxy.PasteSelection;
begin

end;

procedure TIDesignerProxy.DeleteSelection(ADoAll: Boolean);
begin

end;

procedure TIDesignerProxy.ClearSelection;
begin

end;

procedure TIDesignerProxy.NoSelection;
begin

end;

procedure TIDesignerProxy.ModuleFileNames(var ImplFileName, IntfFileName,
  FormFileName: string);
begin

end;

function TIDesignerProxy.GetRootClassName: string;
begin

end;

function TIDesignerProxy.UniqueName(const BaseName: string): string;
begin

end;

function TIDesignerProxy.GetRoot: TComponent;
begin

end;

function TIDesignerProxy.GetShiftState: TShiftState;
begin

end;

procedure TIDesignerProxy.ModalEdit(EditKey: Char;
  const ReturnWindow: IActivatable);
begin

end;

procedure TIDesignerProxy.SelectItemName(const PropertyName: string);
begin

end;

procedure TIDesignerProxy.Resurrect;
begin

end;

function TIDesignerProxy.GetActiveClassGroup: TPersistentClass;
begin

end;

function TIDesignerProxy.FindRootAncestor(const AClassName: string): TComponent;
begin

end;

function TIDesignerProxy.CreateMethod(const Name: string;
  const AEventInfo: IEventInfo): TMethod;
begin

end;

procedure TIDesignerProxy.GetMethods(const AEventInfo: IEventInfo;
  Proc: TGetStrProc);
begin

end;

procedure TIDesignerProxy.SelectComponent(const ADesignObject: IDesignObject);
begin

end;

function TIDesignerProxy.GetDesignerExtension: string;
begin

end;

function TIDesignerProxy.GetAppDataDirectory(Local: Boolean): string;
begin

end;

constructor TComponentEditorProxy.Create(AComponent: TComponent;
  ADesigner: TComponentEditorDesigner);
begin
  inherited Create(AComponent, ADesigner);
  //TComponentEditor.Create();
end;

procedure TComponentEditorProxy.Edit;
begin
  inherited Edit;
end;

procedure TComponentEditorProxy.ExecuteVerb(Index: Integer);
begin
  inherited ExecuteVerb(Index);
end;

function TComponentEditorProxy.GetComponent: TComponent;
begin
  Result:=inherited GetComponent;
end;

function TComponentEditorProxy.GetCustomHint: String;
begin
  Result:=inherited GetCustomHint;
end;

function TComponentEditorProxy.GetDesigner: TComponentEditorDesigner;
begin
  Result:=inherited GetDesigner;
end;

function TComponentEditorProxy.GetVerb(Index: Integer): string;
begin
  Result:=inherited GetVerb(Index);
end;

function TComponentEditorProxy.GetVerbCount: Integer;
begin
  Result:=inherited GetVerbCount;
end;

function TComponentEditorProxy.IsInInlined: Boolean;
begin
  Result:=inherited IsInInlined;
end;

procedure TComponentEditorProxy.Copy;
begin
  inherited Copy;
end;

procedure TComponentEditorProxy.PrepareItem(Index: Integer;
  const AnItem: TMenuItem);
begin
  inherited PrepareItem(Index, AnItem);
end;

function TComponentEditorProxy.GetHook(out Hook: TPropertyEditorHook): boolean;
begin
  Result:=inherited GetHook(Hook);
end;

procedure TComponentEditorProxy.Modified;
begin
  inherited Modified;
end;

{ TComponentEditor }

constructor TComponentEditor.Create(AComponent: TComponent; ADesigner: IDesigner
  );
begin
  inherited Create(AComponent, ADesigner);

  //FLazComponentEditors := ComponentEditors.TComponentEditor.Create(AComponent);
  FComponent := AComponent;
  FDesigner := ADesigner;
end;

procedure TComponentEditor.Edit;
begin

end;

procedure TComponentEditor.ExecuteVerb(Index: Integer);
begin

end;

function TComponentEditor.GetComponent: TComponent;
begin

end;

function TComponentEditor.GetDesigner: IDesigner;
begin

end;

function TComponentEditor.GetVerb(Index: Integer): string;
begin

end;

function TComponentEditor.GetVerbCount: Integer;
begin

end;

function TComponentEditor.IsInInlined: Boolean;
begin

end;

procedure TComponentEditor.Copy;
begin

end;

procedure TComponentEditor.PrepareItem(Index: Integer; const AItem: IMenuItem);
begin

end;

procedure LazRegisterComponentEditor(ComponentClass: TComponentClass;
  ComponentEditor: TComponentEditorClass);
begin

end;

initialization
  DesignIntf.RegisterComponentEditorProc := LazRegisterComponentEditor;
finalization
  DesignIntf.RegisterComponentEditorProc := nil;
end.