1 {
2 /***************************************************************************
3 mainintf.pas - the "integrated" in IDE
4 ----------------------------------------
5 TMainIDEInterface is the ancestor of TMainIDEBase.
6 TMainIDEInterface is used by functions/units, that uses several different
7 parts of the IDE (designer, source editor, codetools), so they can't be
8 assigned to a specific boss and which are yet too small to become a boss of
9 their own.
10
11
12 main.pp - TMainIDE = class(TMainIDEBase)
13 The highest manager/boss of the IDE. Only lazarus.pp uses
14 this unit.
15 mainbase.pas - TMainIDEBase = class(TMainIDEInterface)
16 The ancestor class used by (and only by) the other
17 bosses/managers like debugmanager, pkgmanager.
18 mainintf.pas - TMainIDEInterface = class(TLazIDEInterface)
19 The interface class of the top level functions of the IDE.
20 TMainIDEInterface is used by functions/units, that uses
21 several different parts of the IDE (designer, source editor,
22 codetools), so they can't be added to a specific boss and
23 which are yet too small to become a boss of their own.
24 lazideintf.pas - TLazIDEInterface = class(TComponent)
25 For designtime packages, this is the interface class of the
26 top level functions of the IDE.
27
28
29 ***************************************************************************/
30
31 ***************************************************************************
32 * *
33 * This source is free software; you can redistribute it and/or modify *
34 * it under the terms of the GNU General Public License as published by *
35 * the Free Software Foundation; either version 2 of the License, or *
36 * (at your option) any later version. *
37 * *
38 * This code is distributed in the hope that it will be useful, but *
39 * WITHOUT ANY WARRANTY; without even the implied warranty of *
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
41 * General Public License for more details. *
42 * *
43 * A copy of the GNU General Public License is available on the World *
44 * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
45 * obtain it by writing to the Free Software Foundation, *
46 * Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. *
47 * *
48 ***************************************************************************
49 }
50 unit MainIntf;
51
52 {$mode objfpc}{$H+}
53
54 interface
55
56 {$I ide.inc}
57
58 uses
59 {$IFDEF IDE_MEM_CHECK}
60 MemCheck,
61 {$ENDIF}
62 Classes, typinfo,
63 // LCL
64 LCLType, Buttons, Controls, Graphics, Dialogs, Forms, LCLProc,
65 // Codetools
66 CodeCache,
67 // LazUtils
68 LazMethodList,
69 // IDEIntf
70 PropEdits, ObjectInspector, MenuIntf, SrcEditorIntf, ProjectIntf,
71 CompOptsIntf, LazIDEIntf, IDEWindowIntf,
72 // IDE
73 LazConf, LazarusIDEStrConsts, Project, BuildLazDialog,
74 ProgressDlg, EnvironmentOpts, IDEDefs, PackageDefs;
75
76 type
77 // The IDE is at anytime in a specific state:
78 TIDEToolStatus = TLazToolStatus;
79
80 // window in front
81 TDisplayState = (
82 dsSource, // focussing sourcenotebook
83 dsInspector, // focussing object inspector after Source
84 dsForm, // focussing designer form
85 dsInspector2 // focussing object inspector after form
86 );
87
88 // revert file flags
89 TRevertFlag = (
90 rfQuiet
91 );
92 TRevertFlags = set of TRevertFlag;
93
94 // codetools flags
95 TCodeToolsFlag = (
96 ctfSwitchToFormSource, // bring source notebook to front and show source of
97 // current designed form
98 ctfActivateAbortMode, // activate the CodeToolBoss.Abortable mode
99 ctfSourceEditorNotNeeded, // do not check, if the source editor has a file open
100 ctfUseGivenSourceEditor
101 );
102 TCodeToolsFlags = set of TCodeToolsFlag;
103
104 TJumpToCodePosFlag = (
105 jfAddJumpPoint,
106 jfFocusEditor,
107 jfMarkLine,
108 jfMapLineFromDebug,
109 jfDoNotExpandFilename,
110 jfSearchVirtualFullPath
111 );
112 TJumpToCodePosFlags = set of TJumpToCodePosFlag;
113
114 { TMainIDEInterface }
115
116 TMainIDEInterface = class(TLazIDEInterface)
117 protected
GetActiveProjectnull118 function GetActiveProject: TLazProject; override;
119
120 public
121 HiddenWindowsOnRun: TFPList; // list of forms, that were automatically hidden
122 // and will be shown when debugged program stops
123
124 constructor Create(TheOwner: TComponent); override;
125 destructor Destroy; override;
126
127 procedure SetMainBarSubTitle(const AValue: string); override;
128 procedure UpdateCaption; virtual; abstract;
129 procedure HideIDE; virtual; abstract;
130 procedure UnhideIDE; virtual; abstract;
131 procedure SaveIncludeLinks; virtual; abstract;
132
133 procedure GetCurrentUnitInfo(out ActiveSourceEditor: TSourceEditorInterface;
134 out ActiveUnitInfo: TUnitInfo); virtual; abstract;
135 procedure GetUnitInfoForDesigner(ADesigner: TIDesigner;
136 out ActiveSourceEditor: TSourceEditorInterface;
137 out ActiveUnitInfo: TUnitInfo); virtual; abstract;
138
139 procedure DoCommand(EditorCommand: integer); virtual; abstract;
140
141 procedure GetIDEFileState(Sender: TObject; const AFilename: string;
142 NeededFlags: TIDEFileStateFlags;
143 out ResultFlags: TIDEFileStateFlags); virtual; abstract;
144
CreateProjectObjectnull145 function CreateProjectObject(ProjectDesc,
146 FallbackProjectDesc: TProjectDescriptor): TProject; virtual; abstract;
DoInitProjectRunnull147 function DoInitProjectRun: TModalResult; virtual; abstract;
DoOpenMacroFilenull148 function DoOpenMacroFile(Sender: TObject;
149 const AFilename: string): TModalResult; virtual; abstract;
150
151 procedure DoShowProjectInspector(State: TIWGetFormState = iwgfShowOnTop); virtual; abstract;
PrepareForCompilenull152 function PrepareForCompile: TModalResult; virtual; abstract; // stop things that interfere with compilation, like debugging
DoSaveBuildIDEConfigsnull153 function DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult; virtual; abstract;
DoExampleManagernull154 function DoExampleManager: TModalResult; virtual; abstract;
DoBuildLazarusnull155 function DoBuildLazarus(Flags: TBuildLazarusFlags): TModalResult; virtual; abstract;
DoSaveForBuildnull156 function DoSaveForBuild(AReason: TCompileReason): TModalResult; virtual; abstract;
DoFixupComponentReferencesnull157 function DoFixupComponentReferences(RootComponent: TComponent;
158 OpenFlags: TOpenFlags): TModalResult; virtual; abstract;
159
160 procedure SaveEnvironment(Immediately: boolean = false); virtual; abstract;
161 procedure UpdateHighlighters(Immediately: boolean = false); virtual; abstract;
162 procedure PackageTranslated(APackage: TLazPackage); virtual; abstract;
163 procedure SetRecentSubMenu(Section: TIDEMenuSection; FileList: TStringList;
164 OnClickEvent: TNotifyEvent); virtual; abstract;
DoJumpToSourcePositionnull165 function DoJumpToSourcePosition(const Filename: string;
166 NewX, NewY, NewTopLine: integer;
167 AddJumpPoint: boolean;
168 MarkLine: Boolean = False): TModalResult;
DoJumpToSourcePositionnull169 function DoJumpToSourcePosition(const Filename: string;
170 NewX, NewY, NewTopLine: integer;
171 Flags: TJumpToCodePosFlags = [jfFocusEditor]): TModalResult; virtual; abstract;
DoJumpToCodePositionnull172 function DoJumpToCodePosition(
173 ActiveSrcEdit: TSourceEditorInterface;
174 ActiveUnitInfo: TUnitInfo;
175 NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
176 AddJumpPoint: boolean;
177 MarkLine: Boolean = False): TModalResult; overload;
DoJumpToCodePositionnull178 function DoJumpToCodePosition(
179 ActiveSrcEdit: TSourceEditorInterface;
180 ActiveUnitInfo: TUnitInfo;
181 NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
182 Flags: TJumpToCodePosFlags = [jfFocusEditor]): TModalResult; overload;
DoJumpToCodePositionnull183 function DoJumpToCodePosition(
184 ActiveSrcEdit: TSourceEditorInterface;
185 ActiveUnitInfo: TUnitInfo;
186 NewSource: TCodeBuffer; NewX, NewY, NewTopLine,
187 BlockTopLine, BlockBottomLine: integer;
188 AddJumpPoint: boolean;
189 MarkLine: Boolean = False): TModalResult; overload;
DoJumpToCodePositionnull190 function DoJumpToCodePosition(
191 ActiveSrcEdit: TSourceEditorInterface;
192 ActiveUnitInfo: TUnitInfo;
193 NewSource: TCodeBuffer; NewX, NewY, NewTopLine,
194 BlockTopLine, BlockBottomLine: integer;
195 Flags: TJumpToCodePosFlags = [jfFocusEditor]): TModalResult; virtual; abstract; overload;
196
197 procedure FindInFilesPerDialog(AProject: TProject); virtual; abstract;
198 procedure FindInFiles(AProject: TProject; const FindText: string); virtual; abstract;
199
GetPrimaryConfigPathnull200 class function GetPrimaryConfigPath: String; override;
GetSecondaryConfigPathnull201 class function GetSecondaryConfigPath: String; override;
202 procedure CopySecondaryConfigFile(const AFilename: String); override;
203
ShowProgressnull204 function ShowProgress(const SomeText: string;
205 Step, MaxStep: integer): boolean; override;
206
CallSaveEditorFileHandlernull207 function CallSaveEditorFileHandler(Sender: TObject;
208 aFile: TLazProjectFile; SaveStep: TSaveEditorFileStep;
209 TargetFilename: string = ''): TModalResult;
210 end;
211
212 var
213 MainIDEInterface: TMainIDEInterface = nil;
214 ObjectInspector1: TObjectInspectorDlg = nil; // created by the IDE
215
OpenFlagsToStringnull216 function OpenFlagsToString(Flags: TOpenFlags): string;
SaveFlagsToStringnull217 function SaveFlagsToString(Flags: TSaveFlags): string;
218
219
220 //==============================================================================
221 type
222
223 { TFileDescPascalUnitWithProjectResource }
224
225 TFileDescPascalUnitWithProjectResource = class(TFileDescPascalUnitWithResource)
226 protected
GetResourceTypenull227 function GetResourceType: TResourceType; override;
228 end;
229
230 { TFileDescPascalUnitWithForm }
231
232 TFileDescPascalUnitWithForm = class(TFileDescPascalUnitWithProjectResource)
233 public
234 constructor Create; override;
GetInterfaceUsesSectionnull235 function GetInterfaceUsesSection: string; override;
GetLocalizedNamenull236 function GetLocalizedName: string; override;
GetLocalizedDescriptionnull237 function GetLocalizedDescription: string; override;
238 end;
239
240 { TFileDescPascalUnitWithDataModule }
241
242 TFileDescPascalUnitWithDataModule = class(TFileDescPascalUnitWithProjectResource)
243 public
244 constructor Create; override;
GetInterfaceUsesSectionnull245 function GetInterfaceUsesSection: string; override;
GetLocalizedNamenull246 function GetLocalizedName: string; override;
GetLocalizedDescriptionnull247 function GetLocalizedDescription: string; override;
248 end;
249
250 { TFileDescPascalUnitWithFrame }
251
252 TFileDescPascalUnitWithFrame = class(TFileDescPascalUnitWithProjectResource)
253 public
254 constructor Create; override;
GetInterfaceUsesSectionnull255 function GetInterfaceUsesSection: string; override;
GetLocalizedNamenull256 function GetLocalizedName: string; override;
GetLocalizedDescriptionnull257 function GetLocalizedDescription: string; override;
258 end;
259
260 { TFileDescInheritedItem }
261
262 TFileDescInheritedItem = class(TFileDescPascalUnitWithProjectResource)
263 private
264 FInheritedUnits: string;
265 public
GetResourceSourcenull266 function GetResourceSource(const ResourceName: string): string; override;
GetInterfaceSourcenull267 function GetInterfaceSource(const {%H-}Filename, {%H-}SourceName,
268 ResourceName: string): string; override;
269 property InheritedUnits: string read FInheritedUnits write FInheritedUnits;
270 end;
271
272 { TFileDescInheritedComponent }
273
274 TFileDescInheritedComponent = class(TFileDescInheritedItem)
275 private
276 FInheritedUnit: TUnitInfo;
277 procedure SetInheritedUnit(const AValue: TUnitInfo);
278 public
279 constructor Create; override;
GetInterfaceUsesSectionnull280 function GetInterfaceUsesSection: string; override;
GetLocalizedNamenull281 function GetLocalizedName: string; override;
GetLocalizedDescriptionnull282 function GetLocalizedDescription: string; override;
283 property InheritedUnit: TUnitInfo read FInheritedUnit write SetInheritedUnit;
284 end;
285
286 { TFileDescText }
287
288 TFileDescText = class(TProjectFileDescriptor)
289 public
290 constructor Create; override;
GetLocalizedNamenull291 function GetLocalizedName: string; override;
GetLocalizedDescriptionnull292 function GetLocalizedDescription: string; override;
293 end;
294
dbgsnull295 function dbgs(d: TDisplayState): string; overload;
296
297 implementation
298
OpenFlagsToStringnull299 function OpenFlagsToString(Flags: TOpenFlags): string;
300 var
301 Flag: TOpenFlag;
302 s: string;
303 begin
304 Result:='';
305 for Flag:=Low(TOpenFlag) to High(TOpenFlag) do begin
306 if Flag in Flags then begin
307 if Result<>'' then
308 Result:=Result+',';
309 WriteStr(s, Flag);
310 Result:=Result+s;
311 end;
312 end;
313 Result:='['+Result+']';
314 end;
315
SaveFlagsToStringnull316 function SaveFlagsToString(Flags: TSaveFlags): string;
317 var
318 Flag: TSaveFlag;
319 s: string;
320 begin
321 Result:='';
322 for Flag:=Low(TSaveFlag) to High(TSaveFlag) do begin
323 if Flag in Flags then begin
324 if Result<>'' then
325 Result:=Result+',';
326 WriteStr(s, Flag);
327 Result:=Result+s;
328 end;
329 end;
330 Result:='['+Result+']';
331 end;
332
dbgsnull333 function dbgs(d: TDisplayState): string;
334 begin
335 Result:=GetEnumName(typeinfo(d),ord(d));
336 end;
337
338 { TMainIDEInterface }
339
TMainIDEInterface.GetActiveProjectnull340 function TMainIDEInterface.GetActiveProject: TLazProject;
341 begin
342 Result:=Project1;
343 end;
344
345 constructor TMainIDEInterface.Create(TheOwner: TComponent);
346 begin
347 MainIDEInterface:=Self;
348 inherited Create(TheOwner);
349 end;
350
351 destructor TMainIDEInterface.Destroy;
352 begin
353 inherited Destroy;
354 MainIDEInterface:=nil;
355 end;
356
357 procedure TMainIDEInterface.SetMainBarSubTitle(const AValue: string);
358 begin
359 if MainBarSubTitle=AValue then exit;
360 inherited SetMainBarSubTitle(AValue);
361 UpdateCaption;
362 end;
363
TMainIDEInterface.DoJumpToSourcePositionnull364 function TMainIDEInterface.DoJumpToSourcePosition(const Filename: string; NewX, NewY,
365 NewTopLine: integer; AddJumpPoint: boolean; MarkLine: Boolean): TModalResult;
366 var
367 Flags: TJumpToCodePosFlags;
368 begin
369 Flags := [jfFocusEditor];
370 if AddJumpPoint then Include(Flags, jfAddJumpPoint);
371 if MarkLine then Include(Flags, jfMarkLine);
372 Result := DoJumpToSourcePosition(Filename, NewX, NewY, NewTopLine, Flags);
373 end;
374
TMainIDEInterface.DoJumpToCodePositionnull375 function TMainIDEInterface.DoJumpToCodePosition(
376 ActiveSrcEdit: TSourceEditorInterface; ActiveUnitInfo: TUnitInfo;
377 NewSource: TCodeBuffer; NewX, NewY, NewTopLine, BlockTopLine,
378 BlockBottomLine: integer; AddJumpPoint: boolean; MarkLine: Boolean
379 ): TModalResult;
380 var
381 Flags: TJumpToCodePosFlags;
382 begin
383 Flags := [jfFocusEditor];
384 if AddJumpPoint then Include(Flags, jfAddJumpPoint);
385 if MarkLine then Include(Flags, jfMarkLine);
386 Result := DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo, NewSource, NewX, NewY, NewTopLine, BlockTopLine, BlockBottomLine,
387 Flags);
388 end;
389
TMainIDEInterface.DoJumpToCodePositionnull390 function TMainIDEInterface.DoJumpToCodePosition(
391 ActiveSrcEdit: TSourceEditorInterface; ActiveUnitInfo: TUnitInfo;
392 NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
393 AddJumpPoint: boolean; MarkLine: Boolean): TModalResult;
394 begin
395 Result := DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo, NewSource,
396 NewX, NewY, NewTopLine, NewY, NewY, AddJumpPoint, MarkLine);
397 end;
398
TMainIDEInterface.DoJumpToCodePositionnull399 function TMainIDEInterface.DoJumpToCodePosition(
400 ActiveSrcEdit: TSourceEditorInterface; ActiveUnitInfo: TUnitInfo;
401 NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
402 Flags: TJumpToCodePosFlags): TModalResult;
403 begin
404 Result := DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo, NewSource,
405 NewX, NewY, NewTopLine, NewY, NewY, Flags);
406 end;
407
TMainIDEInterface.GetPrimaryConfigPathnull408 class function TMainIDEInterface.GetPrimaryConfigPath: String;
409 begin
410 Result:=LazConf.GetPrimaryConfigPath;
411 end;
412
TMainIDEInterface.GetSecondaryConfigPathnull413 class function TMainIDEInterface.GetSecondaryConfigPath: String;
414 begin
415 Result:=LazConf.GetSecondaryConfigPath;
416 end;
417
418 procedure TMainIDEInterface.CopySecondaryConfigFile(const AFilename: String);
419 begin
420 LazConf.CopySecondaryConfigFile(AFilename);
421 end;
422
ShowProgressnull423 function TMainIDEInterface.ShowProgress(const SomeText: string; Step,
424 MaxStep: integer): boolean;
425 begin
426 Result:=ProgressDlg.ShowProgress(SomeText,Step,MaxStep);
427 end;
428
CallSaveEditorFileHandlernull429 function TMainIDEInterface.CallSaveEditorFileHandler(Sender: TObject;
430 aFile: TLazProjectFile; SaveStep: TSaveEditorFileStep; TargetFilename: string
431 ): TModalResult;
432 var
433 Handler: TMethodList;
434 i: Integer;
435 begin
436 Result:=mrOk;
437 if TargetFilename='' then
438 TargetFilename:=aFile.Filename;
439 Handler:=FLazarusIDEHandlers[lihtSaveEditorFile];
440 i := Handler.Count;
441 while Handler.NextDownIndex(i) do begin
442 Result:=TSaveEditorFileEvent(Handler[i])(Sender,aFile,SaveStep,TargetFilename);
443 if Result<>mrOk then exit;
444 end;
445 end;
446
447 { TFileDescPascalUnitWithForm }
448
449 constructor TFileDescPascalUnitWithForm.Create;
450 begin
451 inherited Create;
452 Name:=FileDescNameLCLForm;
453 ResourceClass:=TForm;
454 UseCreateFormStatements:=true;
455 RequiredPackages:='LCL';
456 end;
457
GetInterfaceUsesSectionnull458 function TFileDescPascalUnitWithForm.GetInterfaceUsesSection: string;
459 begin
460 Result := inherited GetInterfaceUsesSection + ', Forms, Controls, Graphics, Dialogs';
461 end;
462
TFileDescPascalUnitWithForm.GetLocalizedNamenull463 function TFileDescPascalUnitWithForm.GetLocalizedName: string;
464 begin
465 Result:=lisForm;
466 end;
467
TFileDescPascalUnitWithForm.GetLocalizedDescriptionnull468 function TFileDescPascalUnitWithForm.GetLocalizedDescription: string;
469 begin
470 Result:=lisNewDlgCreateANewUnitWithALCLForm;
471 end;
472
473 { TFileDescPascalUnitWithDataModule }
474
475 constructor TFileDescPascalUnitWithDataModule.Create;
476 begin
477 inherited Create;
478 Name:=FileDescNameDatamodule;
479 ResourceClass:=TDataModule;
480 UseCreateFormStatements:=true;
481 end;
482
GetInterfaceUsesSectionnull483 function TFileDescPascalUnitWithDataModule.GetInterfaceUsesSection: string;
484 begin
485 Result := inherited GetInterfaceUsesSection;
486 end;
487
TFileDescPascalUnitWithDataModule.GetLocalizedNamenull488 function TFileDescPascalUnitWithDataModule.GetLocalizedName: string;
489 begin
490 Result:=lisDataModule;
491 end;
492
GetLocalizedDescriptionnull493 function TFileDescPascalUnitWithDataModule.GetLocalizedDescription: string;
494 begin
495 Result:=lisNewDlgCreateANewUnitWithADataModule;
496 end;
497
498 { TFileDescText }
499
500 constructor TFileDescText.Create;
501 begin
502 inherited Create;
503 Name:=FileDescNameText;
504 DefaultFilename:='text.txt';
505 AddToProject:=false;
506 end;
507
GetLocalizedNamenull508 function TFileDescText.GetLocalizedName: string;
509 begin
510 Result:=dlgMouseOptNodeMain;
511 end;
512
GetLocalizedDescriptionnull513 function TFileDescText.GetLocalizedDescription: string;
514 begin
515 Result:=lisNewDlgCreateANewEmptyTextFile;
516 end;
517
518 { TFileDescPascalUnitWithFrame }
519
520 constructor TFileDescPascalUnitWithFrame.Create;
521 begin
522 inherited Create;
523 Name := FileDescNameFrame;
524 ResourceClass := TFrame;
525 UseCreateFormStatements := False;
526 DeclareClassVariable := False;
527 RequiredPackages:='LCL';
528 end;
529
GetInterfaceUsesSectionnull530 function TFileDescPascalUnitWithFrame.GetInterfaceUsesSection: string;
531 begin
532 Result := inherited GetInterfaceUsesSection + ', Forms, Controls';
533 end;
534
TFileDescPascalUnitWithFrame.GetLocalizedNamenull535 function TFileDescPascalUnitWithFrame.GetLocalizedName: string;
536 begin
537 Result:=lisFrame;
538 end;
539
GetLocalizedDescriptionnull540 function TFileDescPascalUnitWithFrame.GetLocalizedDescription: string;
541 begin
542 Result := lisNewDlgCreateANewUnitWithAFrame;
543 end;
544
545 { TFileDescInheritedComponent }
546
547 procedure TFileDescInheritedComponent.SetInheritedUnit(const AValue: TUnitInfo);
548 begin
549 if FInheritedUnit=AValue then exit;
550 FInheritedUnit:=AValue;
551 InheritedUnits:=FInheritedUnit.Unit_Name;
552 end;
553
554 constructor TFileDescInheritedComponent.Create;
555 begin
556 inherited Create;
557 Name := FileDescNameLCLInheritedComponent;
558 ResourceClass := TForm;// will be adjusted on the fly
559 UseCreateFormStatements := true;
560 end;
561
GetInterfaceUsesSectionnull562 function TFileDescInheritedComponent.GetInterfaceUsesSection: string;
563 begin
564 Result:=inherited GetInterfaceUsesSection;
565 Result := Result+', Forms, Controls, Graphics, Dialogs';
566 if InheritedUnits<>'' then
567 Result := Result+', '+InheritedUnits;
568 end;
569
TFileDescInheritedComponent.GetLocalizedNamenull570 function TFileDescInheritedComponent.GetLocalizedName: string;
571 begin
572 Result:=lisInheritedProjectComponent;
573 end;
574
GetLocalizedDescriptionnull575 function TFileDescInheritedComponent.GetLocalizedDescription: string;
576 begin
577 Result:=lisNewDlgInheritFromAProjectFormComponent;
578 end;
579
580 { TFileDescInheritedItem }
581
TFileDescInheritedItem.GetResourceSourcenull582 function TFileDescInheritedItem.GetResourceSource(const ResourceName: string): string;
583 begin
584 Result := 'inherited '+ ResourceName+': T'+ResourceName+LineEnding+
585 'end';
586 end;
587
GetInterfaceSourcenull588 function TFileDescInheritedItem.GetInterfaceSource(const Filename, SourceName,
589 ResourceName: string): string;
590 var
591 LE: string;
592 begin
593 LE:=LineEnding;
594 Result:=
595 'type'+LE
596 +' T'+ResourceName+' = class('+ResourceClass.ClassName+')'+LE
597 +' private'+LE
598 +LE
599 +' public'+LE
600 +LE
601 +' end;'+LE
602 +LE;
603
604 if DeclareClassVariable then
605 Result := Result +
606 'var'+LE
607 +' '+ResourceName+': T'+ResourceName+';'+LE
608 +LE;
609 end;
610
611 { TFileDescPascalUnitWithProjectResource }
612
TFileDescPascalUnitWithProjectResource.GetResourceTypenull613 function TFileDescPascalUnitWithProjectResource.GetResourceType: TResourceType;
614 begin
615 Result := Project1.ProjResources.ResourceType;
616 end;
617
618 end.
619
620
621