~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to ideintf/projectintf.pas

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
uses
25
25
  Classes, SysUtils, LCLProc, FileUtil, Controls, Forms, AvgLvlTree,
26
 
  NewItemIntf, ObjInspStrConsts, IDEOptionsIntf;
 
26
  NewItemIntf, ObjInspStrConsts, IDEOptionsIntf, CompOptsIntf;
27
27
 
28
28
const
29
29
  FileDescGroupName = 'File';
50
50
    rtRes    // fpc resources
51
51
  );
52
52
 
53
 
type
54
 
 
55
 
  { TLazBuildMacro
56
 
    Every package/project can define build macros. A build macro has a name,
57
 
    a description, a list of possible values and a default value.
58
 
    The default value can be an expression using other build macros.
59
 
    The IDE defines basic macros like TargetOS and TargetCPU.
60
 
    The LCL package defines the macro LCLWidgetType. }
61
 
 
62
 
  TLazBuildMacro = class
63
 
  protected
64
 
    FDefaultValue: string;
65
 
    FIdentifier: string;
66
 
    FDescription: string;
67
 
    FValueDescriptions: TStrings;
68
 
    FValues: TStrings;
69
 
    procedure SetIdentifier(const AValue: string); virtual; abstract;
70
 
    procedure SetDescription(const AValue: string); virtual; abstract;
71
 
    procedure SetValueDescriptions(const AValue: TStrings); virtual; abstract;
72
 
    procedure SetValues(const AValue: TStrings); virtual; abstract;
73
 
  public
74
 
    procedure Assign(Source: TLazBuildMacro); virtual; abstract;
75
 
    property Identifier: string read FIdentifier write SetIdentifier;
76
 
    property Description: string read FDescription write SetDescription;
77
 
    property Values: TStrings read FValues write SetValues;
78
 
    property ValueDescriptions: TStrings read FValueDescriptions write SetValueDescriptions;
79
 
  end;
80
 
 
81
 
  { TLazBuildMacros
82
 
    The list of build macros of a package/project.
83
 
    They are stored in the compiler options. }
84
 
 
85
 
  TLazBuildMacros = class
86
 
  private
87
 
    FOwner: TObject;
88
 
  protected
89
 
    function GetItems(Index: integer): TLazBuildMacro; virtual; abstract;
90
 
  public
91
 
    constructor Create(TheOwner: TObject); virtual;
92
 
    function Add(Identifier: string): TLazBuildMacro; virtual; abstract;
93
 
    procedure Delete(Index: integer); virtual; abstract;
94
 
    procedure Move(OldIndex, NewIndex: integer); virtual; abstract;
95
 
    function IndexOfIdentifier(Identifier: string): integer; virtual; abstract;
96
 
    function VarWithIdentifier(Identifier: string): TLazBuildMacro; virtual; abstract;
97
 
    function Count: integer; virtual; abstract;
98
 
    procedure Clear; virtual; abstract;
99
 
    property Items[Index: integer]: TLazBuildMacro read GetItems; default;
100
 
    property Owner: TObject read FOwner;
101
 
  end;
102
 
 
103
 
  { TLazCompilerOptions }
104
 
 
105
 
  TCompilationExecutableType = (
106
 
    cetProgram,
107
 
    cetLibrary
108
 
    );
109
 
 
110
 
  TCompileReason = (
111
 
    crCompile,  // normal build current project/package
112
 
    crBuild,    // build all
113
 
    crRun       // quick build before run
114
 
    );
115
 
  TCompileReasons = set of TCompileReason;
116
 
const
117
 
  crAll = [crCompile, crBuild, crRun];
118
 
 
119
 
type
120
 
  { TLazCompilerOptions }
121
 
 
122
 
  TLazCompilerOptions = class(TAbstractIDEProjectOptions)
123
 
  private
124
 
    FOnModified: TNotifyEvent;
125
 
    fOwner: TObject;
126
 
    SetEmulatedFloatOpcodes: boolean;
127
 
    procedure SetAllowLabel(const AValue: Boolean);
128
 
    procedure SetAssemblerStyle(const AValue: Integer);
129
 
    procedure SetCMacros(const AValue: Boolean);
130
 
    procedure SetConfigFilePath(const AValue: String);
131
 
    procedure SetCPPInline(const AValue: Boolean);
132
 
    procedure SetCStyleOp(const AValue: Boolean);
133
 
    procedure SetCustomConfigFile(const AValue: Boolean);
134
 
    procedure SetDontUseConfigFile(const AValue: Boolean);
135
 
    procedure SetExecutableType(const AValue: TCompilationExecutableType);
136
 
    procedure SetGenDebugInfo(const AValue: Boolean);
137
 
    procedure SetGenerateDwarf(const AValue: Boolean);
138
 
    procedure SetGenGProfCode(const AValue: Boolean);
139
 
    procedure SetHeapSize(const AValue: Integer);
140
 
    procedure SetIncludeAssertionCode(const AValue: Boolean);
141
 
    procedure SetInitConst(const AValue: Boolean);
142
 
    procedure SetIOChecks(const AValue: Boolean);
143
 
    procedure SetLinkSmart(const AValue: Boolean);
144
 
    procedure SetOptLevel(const AValue: Integer);
145
 
    procedure SetOverflowChecks(const AValue: Boolean);
146
 
    procedure SetPassLinkerOpt(const AValue: Boolean);
147
 
    procedure SetRangeChecks(const AValue: Boolean);
148
 
    procedure SetShowAll(const AValue: Boolean);
149
 
    procedure SetShowAllProcsOnError(const AValue: Boolean);
150
 
    procedure SetShowCompProc(const AValue: Boolean);
151
 
    procedure SetShowCond(const AValue: Boolean);
152
 
    procedure SetShowDebugInfo(const AValue: Boolean);
153
 
    procedure SetShowDefMacros(const AValue: Boolean);
154
 
    procedure SetShowErrors(const AValue: Boolean);
155
 
    procedure SetShowExecInfo(const AValue: Boolean);
156
 
    procedure SetShowGenInfo(const AValue: Boolean);
157
 
    procedure SetShowHints(const AValue: Boolean);
158
 
    procedure SetShowHintsForSenderNotUsed(const AValue: Boolean);
159
 
    procedure SetShowHintsForUnusedUnitsInMainSrc(const AValue: Boolean);
160
 
    procedure SetShowLineNum(const AValue: Boolean);
161
 
    procedure SetShowNotes(const AValue: Boolean);
162
 
    procedure SetShowNothing(const AValue: Boolean);
163
 
    procedure SetShowSummary(const AValue: Boolean);
164
 
    procedure SetShowTriedFiles(const AValue: Boolean);
165
 
    procedure SetShowUsedFiles(const AValue: Boolean);
166
 
    procedure SetShowWarn(const AValue: Boolean);
167
 
    procedure SetSmallerCode(const AValue: boolean);
168
 
    procedure SetSmartLinkUnit(const AValue: Boolean);
169
 
    procedure SetStackChecks(const AValue: Boolean);
170
 
    procedure SetStaticKeyword(const AValue: Boolean);
171
 
    procedure SetStopAfterErrCount(const AValue: integer);
172
 
    procedure SetStripSymbols(const AValue: Boolean);
173
 
    procedure SetSyntaxMode(const AValue: string);
174
 
    procedure SetTargetFilenameAppplyConventions(const AValue: boolean);
175
 
    procedure SetUncertainOpt(const AValue: Boolean);
176
 
    procedure SetUseAnsiStr(const AValue: Boolean);
177
 
    procedure SetUseExternalDbgSyms(const AValue: Boolean);
178
 
    procedure SetUseHeaptrc(const AValue: Boolean);
179
 
    procedure SetUseLineInfoUnit(const AValue: Boolean);
180
 
    procedure SetUseValgrind(const AValue: Boolean);
181
 
    procedure SetVarsInReg(const AValue: Boolean);
182
 
    procedure SetVerifyObjMethodCall(const AValue: boolean);
183
 
    procedure SetWin32GraphicApp(const AValue: boolean);
184
 
    procedure SetWriteFPCLogo(const AValue: Boolean);
185
 
  protected
186
 
    FChangeStamp: int64;
187
 
    FSavedChangeStamp: int64;
188
 
    fOnChanged: TMethodList;
189
 
 
190
 
    // Paths:
191
 
 
192
 
    // conditionals / build modes
193
 
    FConditionals: string;
194
 
    fBuildMacros: TLazBuildMacros;
195
 
    fLCLWidgetType: string;
196
 
 
197
 
    // Parsing:
198
 
    // assembler style
199
 
    fAssemblerStyle: Integer;
200
 
 
201
 
    // syntax options
202
 
    FSyntaxMode: string;
203
 
    fCStyleOp: Boolean;
204
 
    fIncludeAssertionCode: Boolean;
205
 
    fAllowLabel: Boolean;
206
 
    fUseAnsiStr: Boolean;
207
 
    fCPPInline: Boolean;
208
 
    fCMacros: Boolean;
209
 
    fInitConst: Boolean;
210
 
    fStaticKeyword: Boolean;
211
 
 
212
 
    // Code generation:
213
 
    fSmartLinkUnit: Boolean;
214
 
    fIOChecks: Boolean;
215
 
    fRangeChecks: Boolean;
216
 
    fOverflowChecks: Boolean;
217
 
    fStackChecks: Boolean;
218
 
    FEmulatedFloatOpcodes: boolean;
219
 
    fHeapSize: LongInt;
220
 
    fVerifyObjMethodCall: boolean;
221
 
    FSmallerCode: boolean;
222
 
    fTargetProc: string;
223
 
    fTargetCPU: string;
224
 
    fVarsInReg: Boolean;
225
 
    fUncertainOpt: Boolean;
226
 
    fOptLevel: Integer;
227
 
    fTargetOS: String;
228
 
 
229
 
    // Linking:
230
 
    fGenDebugInfo: Boolean;
231
 
    fUseLineInfoUnit: Boolean;
232
 
    FGenerateDwarf: Boolean;
233
 
    fUseHeaptrc: Boolean;
234
 
    fUseValgrind: Boolean;
235
 
    fGenGProfCode: Boolean;
236
 
    fStripSymbols: Boolean;
237
 
    fLinkSmart: Boolean;
238
 
    fPassLinkerOpt: Boolean;
239
 
    fLinkerOptions: String;
240
 
    FWin32GraphicApp: boolean;
241
 
    FExecutableType: TCompilationExecutableType;
242
 
    FUseExternalDbgSyms : Boolean;
243
 
    fTargetFilename: string;
244
 
    FTargetFilenameAppplyConventions: boolean;
245
 
 
246
 
    // Messages:
247
 
    fShowErrors: Boolean;
248
 
    fShowWarn: Boolean;
249
 
    fShowNotes: Boolean;
250
 
    fShowHints: Boolean;
251
 
    fShowGenInfo: Boolean;
252
 
    fShowLineNum: Boolean;
253
 
    fShowAll: Boolean;
254
 
    fShowAllProcsOnError: Boolean;
255
 
    fShowDebugInfo: Boolean;
256
 
    fShowUsedFiles: Boolean;
257
 
    fShowTriedFiles: Boolean;
258
 
    fShowDefMacros: Boolean;
259
 
    fShowCompProc: Boolean;
260
 
    fShowCond: Boolean;
261
 
    fShowExecInfo: Boolean;
262
 
    fShowNothing: Boolean;
263
 
    fShowSummary: Boolean;
264
 
    fShowHintsForUnusedUnitsInMainSrc: Boolean;
265
 
    fShowHintsForSenderNotUsed: Boolean;
266
 
    fWriteFPCLogo: Boolean;
267
 
    fStopAfterErrCount: integer;
268
 
 
269
 
    // Other:
270
 
    fDontUseConfigFile: Boolean;
271
 
    fCustomConfigFile: Boolean;
272
 
    fConfigFilePath: String;
273
 
  protected
274
 
    function GetCustomOptions: string; virtual; abstract;
275
 
    function GetDebugPath: string; virtual; abstract;
276
 
    function GetIncludePaths: String; virtual; abstract;
277
 
    function GetLibraryPaths: String; virtual; abstract;
278
 
    function GetModified: boolean; virtual;
279
 
    function GetObjectPath: string; virtual; abstract;
280
 
    function GetSrcPath: string; virtual; abstract;
281
 
    function GetUnitOutputDir: string; virtual; abstract;
282
 
    function GetUnitPaths: String; virtual; abstract;
283
 
    procedure SetCompilerPath(const AValue: String); virtual; abstract;
284
 
    procedure SetConditionals(const AValue: string); virtual; abstract;
285
 
    procedure SetCustomOptions(const AValue: string); virtual; abstract;
286
 
    procedure SetDebugPath(const AValue: string); virtual; abstract;
287
 
    procedure SetIncludePaths(const AValue: String); virtual; abstract;
288
 
    procedure SetLibraryPaths(const AValue: String); virtual; abstract;
289
 
    procedure SetLinkerOptions(const AValue: String); virtual; abstract;
290
 
    procedure SetModified(const AValue: boolean); virtual; abstract;
291
 
    procedure SetObjectPath(const AValue: string); virtual; abstract;
292
 
    procedure SetSrcPath(const AValue: string); virtual; abstract;
293
 
    procedure SetTargetCPU(const AValue: string); virtual; abstract;
294
 
    procedure SetTargetFilename(const AValue: String); virtual; abstract;
295
 
    procedure SetTargetOS(const AValue: string); virtual; abstract;
296
 
    procedure SetTargetProc(const AValue: string); virtual; abstract;
297
 
    procedure SetUnitOutputDir(const AValue: string); virtual; abstract;
298
 
    procedure SetUnitPaths(const AValue: String); virtual; abstract;
299
 
    procedure SetLCLWidgetType(const AValue: string); virtual;
300
 
  public
301
 
    constructor Create(const TheOwner: TObject); virtual;
302
 
    destructor Destroy; override;
303
 
    function IsActive: boolean; virtual;
304
 
    function TrimCustomOptions(o: string): string; virtual; abstract;
305
 
  public
306
 
    property Owner: TObject read fOwner write fOwner;
307
 
    property Modified: boolean read GetModified write SetModified;
308
 
    property OnModified: TNotifyEvent read FOnModified write FOnModified;
309
 
    property ChangeStamp: int64 read FChangeStamp;
310
 
    procedure IncreaseChangeStamp;
311
 
    class function InvalidChangeStamp: int64;
312
 
    procedure AddOnChangedHandler(const Handler: TNotifyEvent);
313
 
    procedure RemoveOnChangedHandler(const Handler: TNotifyEvent);
314
 
 
315
 
    // search paths:
316
 
    property IncludePath: String read GetIncludePaths write SetIncludePaths; // alias IncPath
317
 
    property Libraries: String read GetLibraryPaths write SetLibraryPaths; // alias LibraryPath
318
 
    property OtherUnitFiles: String read GetUnitPaths write SetUnitPaths; // alias UnitPath
319
 
    property ObjectPath: string read GetObjectPath write SetObjectPath;
320
 
    property SrcPath: string read GetSrcPath write SetSrcPath;  // alias SrcPath
321
 
    property DebugPath: string read GetDebugPath write SetDebugPath;
322
 
    property UnitOutputDirectory: string read GetUnitOutputDir write SetUnitOutputDir;
323
 
 
324
 
    // conditional / build modes
325
 
    property Conditionals: string read FConditionals write SetConditionals;
326
 
    property BuildMacros: TLazBuildMacros read fBuildMacros;
327
 
    // Beware: eventually LCLWidgetType will be replaced by a more generic solution
328
 
    property LCLWidgetType: string read fLCLWidgetType write SetLCLWidgetType;
329
 
 
330
 
    // target:
331
 
    property TargetFilename: String read fTargetFilename write SetTargetFilename;
332
 
    property TargetFilenameAppplyConventions: boolean read FTargetFilenameAppplyConventions write SetTargetFilenameAppplyConventions;
333
 
 
334
 
    // parsing:
335
 
    property SyntaxMode: string read FSyntaxMode write SetSyntaxMode;
336
 
    property AssemblerStyle: Integer read fAssemblerStyle write SetAssemblerStyle;
337
 
    property CStyleOperators: Boolean read fCStyleOp write SetCStyleOp;
338
 
    property IncludeAssertionCode: Boolean
339
 
                         read fIncludeAssertionCode write SetIncludeAssertionCode;
340
 
    property AllowLabel: Boolean read fAllowLabel write SetAllowLabel;
341
 
    property UseAnsiStrings: Boolean read fUseAnsiStr write SetUseAnsiStr;
342
 
    property CPPInline: Boolean read fCPPInline write SetCPPInline;
343
 
    property CStyleMacros: Boolean read fCMacros write SetCMacros;
344
 
    property InitConstructor: Boolean read fInitConst write SetInitConst;
345
 
    property StaticKeyword: Boolean read fStaticKeyword write SetStaticKeyword;
346
 
 
347
 
    // code generation:
348
 
    property IOChecks: Boolean read fIOChecks write SetIOChecks;
349
 
    property RangeChecks: Boolean read fRangeChecks write SetRangeChecks;
350
 
    property OverflowChecks: Boolean read fOverflowChecks write SetOverflowChecks;
351
 
    property StackChecks: Boolean read fStackChecks write SetStackChecks;
352
 
    property SmartLinkUnit: Boolean read fSmartLinkUnit write SetSmartLinkUnit;
353
 
    property EmulatedFloatOpcodes: boolean read SetEmulatedFloatOpcodes
354
 
                                           write SetEmulatedFloatOpcodes;
355
 
    property HeapSize: Integer read fHeapSize write SetHeapSize;
356
 
    property VerifyObjMethodCall: boolean read FVerifyObjMethodCall
357
 
                                          write SetVerifyObjMethodCall;
358
 
    property SmallerCode: boolean read FSmallerCode write SetSmallerCode;
359
 
    property TargetCPU: string read fTargetCPU write SetTargetCPU; // general type
360
 
    property TargetProcessor: String read fTargetProc write SetTargetProc; // specific
361
 
    property TargetOS: string read fTargetOS write SetTargetOS;
362
 
    property VariablesInRegisters: Boolean read fVarsInReg write SetVarsInReg;
363
 
    property UncertainOptimizations: Boolean read fUncertainOpt write SetUncertainOpt;
364
 
    property OptimizationLevel: Integer read fOptLevel write SetOptLevel;
365
 
 
366
 
    // linking:
367
 
    property GenerateDebugInfo: Boolean read fGenDebugInfo write SetGenDebugInfo;
368
 
    property UseLineInfoUnit: Boolean read fUseLineInfoUnit write SetUseLineInfoUnit;
369
 
    property GenerateDwarf: Boolean read FGenerateDwarf write SetGenerateDwarf;
370
 
    property UseHeaptrc: Boolean read fUseHeaptrc write SetUseHeaptrc;
371
 
    property UseValgrind: Boolean read fUseValgrind write SetUseValgrind;
372
 
    property GenGProfCode: Boolean read fGenGProfCode write SetGenGProfCode;
373
 
    property StripSymbols: Boolean read fStripSymbols write SetStripSymbols;
374
 
    property LinkSmart: Boolean read fLinkSmart write SetLinkSmart;
375
 
    property PassLinkerOptions: Boolean read fPassLinkerOpt write SetPassLinkerOpt;
376
 
    property LinkerOptions: String read fLinkerOptions write SetLinkerOptions;
377
 
    property Win32GraphicApp: boolean read FWin32GraphicApp write SetWin32GraphicApp;
378
 
    property ExecutableType: TCompilationExecutableType
379
 
                                     read FExecutableType write SetExecutableType;
380
 
    property UseExternalDbgSyms: Boolean read FUseExternalDbgSyms write SetUseExternalDbgSyms;
381
 
 
382
 
    // messages:
383
 
    property ShowErrors: Boolean read fShowErrors write SetShowErrors;
384
 
    property ShowWarn: Boolean read fShowWarn write SetShowWarn;
385
 
    property ShowNotes: Boolean read fShowNotes write SetShowNotes;
386
 
    property ShowHints: Boolean read fShowHints write SetShowHints;
387
 
    property ShowGenInfo: Boolean read fShowGenInfo write SetShowGenInfo;
388
 
    property ShowLineNum: Boolean read fShowLineNum write SetShowLineNum;
389
 
    property ShowAll: Boolean read fShowAll write SetShowAll;
390
 
    property ShowAllProcsOnError: Boolean
391
 
      read fShowAllProcsOnError write SetShowAllProcsOnError;
392
 
    property ShowDebugInfo: Boolean read fShowDebugInfo write SetShowDebugInfo;
393
 
    property ShowUsedFiles: Boolean read fShowUsedFiles write SetShowUsedFiles;
394
 
    property ShowTriedFiles: Boolean read fShowTriedFiles write SetShowTriedFiles;
395
 
    property ShowDefMacros: Boolean read fShowDefMacros write SetShowDefMacros;
396
 
    property ShowCompProc: Boolean read fShowCompProc write SetShowCompProc;
397
 
    property ShowCond: Boolean read fShowCond write SetShowCond;
398
 
    property ShowExecInfo: Boolean read fShowExecInfo write SetShowExecInfo;
399
 
    property ShowNothing: Boolean read fShowNothing write SetShowNothing;
400
 
    property ShowSummary: Boolean read FShowSummary write SetShowSummary;
401
 
    property ShowHintsForUnusedUnitsInMainSrc: Boolean
402
 
      read fShowHintsForUnusedUnitsInMainSrc write SetShowHintsForUnusedUnitsInMainSrc;
403
 
    property ShowHintsForSenderNotUsed: Boolean
404
 
      read fShowHintsForSenderNotUsed write SetShowHintsForSenderNotUsed;
405
 
    property WriteFPCLogo: Boolean read fWriteFPCLogo write SetWriteFPCLogo;
406
 
    property StopAfterErrCount: integer
407
 
      read fStopAfterErrCount write SetStopAfterErrCount;
408
 
 
409
 
    // other
410
 
    property DontUseConfigFile: Boolean read fDontUseConfigFile
411
 
                                        write SetDontUseConfigFile;
412
 
    property CustomConfigFile: Boolean read fCustomConfigFile
413
 
                                       write SetCustomConfigFile;
414
 
    property ConfigFilePath: String read fConfigFilePath write SetConfigFilePath;
415
 
    property CustomOptions: string read GetCustomOptions write SetCustomOptions;
416
 
  end;
417
 
 
418
 
 
419
53
  { TLazProjectFile }
420
54
 
421
55
  TLazProjectFile = class(TPersistent)
489
123
    function GetResourceSource(const ResourceName: string): string; virtual;
490
124
    procedure Release;
491
125
    procedure Reference;
 
126
    function CheckOwner(Quiet: boolean): TModalResult; virtual;
492
127
    function CreateSource(const Filename, SourceName,
493
128
                          ResourceName: string): string; virtual;
494
129
    procedure UpdateDefaultPascalFileExtension(const DefPasExt: string); virtual;
 
130
    function Init(var NewFilename: string; NewOwner: TObject;
 
131
                  var NewSource: string; Quiet: boolean): TModalResult; virtual;
495
132
  public
496
133
    property Owner: TObject read FOwner write SetOwner; // project, package or nil
497
134
    property Name: string read FName write SetName;
542
179
                                ResourceName: string): string; virtual;
543
180
    function GetImplementationSource(const Filename, SourceName,
544
181
                                     ResourceName: string): string; virtual;
 
182
    function CheckOwner(Quiet: boolean): TModalResult; override;
545
183
    class function CompilerOptionsToUnitDirectives(CompOpts: TLazCompilerOptions): string;
546
184
  end;
547
185
 
594
232
 
595
233
type
596
234
  TCheckCompOptsAndMainSrcForNewUnitEvent =
597
 
    procedure(CompOpts: TLazCompilerOptions) of object;
 
235
    function(CompOpts: TLazCompilerOptions): TModalResult of object;
598
236
var
599
237
  CheckCompOptsAndMainSrcForNewUnitEvent: TCheckCompOptsAndMainSrcForNewUnitEvent; // set by the IDE
600
 
 
601
238
type
602
 
  TLazProject = class;
603
239
 
604
240
  { TProjectDescriptor - Template for initializing new projects }
605
241
 
606
242
  TProjectFlag = (
607
 
    pfSaveClosedUnits,     // save info about closed files (not part of project)
 
243
    pfSaveClosedUnits,     // save info about closed files (i.e. once closed the cursor position is lost)
608
244
    pfSaveOnlyProjectUnits, // save no info about foreign files (not part of project)
609
245
    pfMainUnitIsPascalSource,// main unit is pascal, even it does not end in .pas/.pp
610
246
    pfMainUnitHasUsesSectionForAllUnits,// add/remove pascal units to main uses section
612
248
    pfMainUnitHasTitleStatement,// add/remove Application.Title:= statements
613
249
    pfRunnable, // project can be run
614
250
    pfAlwaysBuild, // skip IDE's smart check if compilation is needed and always compile
 
251
    pfUseDesignTimePackages, // compile design time packages to project
615
252
    pfLRSFilesInOutputDirectory, // put .lrs files in output directory
616
 
    pfUseDefaultCompilerOptions // load users default compiler options
 
253
    pfUseDefaultCompilerOptions, // load users default compiler options
 
254
    pfSaveJumpHistory,
 
255
    pfSaveFoldState
617
256
    );
618
257
  TProjectFlags = set of TProjectFlag;
619
258
 
625
264
    );
626
265
  TProjectSessionStorages = set of TProjectSessionStorage;
627
266
 
 
267
const
 
268
  DefaultProjectCleanOutputFileMask = '*';
 
269
  DefaultProjectCleanSourcesFileMask = '*.ppu;*.ppl;*.o;*.or';
 
270
  DefaultProjectSessionStorage = pssInProjectInfo; // this value is not saved to the lpi file
 
271
  DefaultNewProjectSessionStorage = pssInProjectDir; // value used for new projects
 
272
 
 
273
type
 
274
  TLazProject = class;
628
275
  { TProjectDescriptor
629
276
    - to show an option dialog to the user override the DoInitDescriptor
630
277
    - to initialize project compiler settings and paths override InitProject
648
295
    function GetLocalizedDescription: string; virtual;
649
296
    procedure Release;
650
297
    procedure Reference;
651
 
    function InitDescriptor: TModalResult;
652
 
    function InitProject(AProject: TLazProject): TModalResult; virtual;
653
 
    function CreateStartFiles(AProject: TLazProject): TModalResult; virtual;
 
298
    function InitDescriptor: TModalResult; // called while old project is still there, you can start a dialog to ask for settings
 
299
    function InitProject(AProject: TLazProject): TModalResult; virtual; // called after old project was closed and new was created, you must now setup global flags and compiler options
 
300
    function CreateStartFiles(AProject: TLazProject): TModalResult; virtual; // called after all global settings are done, you can now create and open files
654
301
  public
655
302
    property Name: string read FName write SetName;
656
303
    property VisibleInNewDialog: boolean read FVisibleInNewDialog
674
321
    property Descriptor: TProjectDescriptor read FDescriptor write FDescriptor;
675
322
  end;
676
323
 
 
324
  TAbstractRunParamsOptions = class
 
325
  protected
 
326
    // local options
 
327
    fHostApplicationFilename: string;
 
328
    fCmdLineParams: string;
 
329
    fUseDisplay: boolean;
 
330
    fUseLaunchingApplication: boolean;
 
331
    fLaunchingApplicationPathPlusParams: string;
 
332
    fWorkingDirectory: string;
 
333
    fDisplay: string;
 
334
 
 
335
    // environment options
 
336
    fUserOverrides: TStringList;
 
337
    fIncludeSystemVariables: boolean;
 
338
  public
 
339
    procedure Clear; virtual; abstract;
 
340
    procedure AssignEnvironmentTo(Strings: TStrings); virtual; abstract;
 
341
 
 
342
    // local options
 
343
    property HostApplicationFilename: string
 
344
      Read fHostApplicationFilename Write fHostApplicationFilename;
 
345
    property CmdLineParams: string Read fCmdLineParams Write fCmdLineParams;
 
346
    property UseLaunchingApplication: boolean
 
347
      Read fUseLaunchingApplication Write fUseLaunchingApplication;
 
348
    property LaunchingApplicationPathPlusParams: string
 
349
      Read fLaunchingApplicationPathPlusParams Write fLaunchingApplicationPathPlusParams;
 
350
    property WorkingDirectory: string Read fWorkingDirectory Write fWorkingDirectory;
 
351
    property UseDisplay: boolean Read fUseDisplay Write FUseDisplay;
 
352
    property Display: string Read fDisplay Write fDisplay;
 
353
 
 
354
    // environment options
 
355
    property UserOverrides: TStringList Read fUserOverrides;
 
356
    property IncludeSystemVariables: boolean
 
357
      Read fIncludeSystemVariables Write fIncludeSystemVariables;
 
358
  end;
 
359
 
677
360
  { TLazProject - interface class to a Lazarus project }
678
361
 
679
362
  TProjectFileSearchFlag = (
694
377
 
695
378
  TLazProject = class(TAbstractIDEProjectOptions)
696
379
  private
 
380
    FCleanOutputFileMask: string;
 
381
    FCleanSourcesFileMask: string;
697
382
    FCustomData: TStringToStringTree;
698
383
    FCustomSessionData: TStringToStringTree;
699
384
    FExecutableType: TProjectExecutableType;
 
385
    FFPDocPackageName: string;
700
386
    fModified: boolean;
701
387
    FProjectSessionFile: string;
702
388
    FSessionModified: boolean;
703
389
    FTitle: String;
704
390
    FSessionStorage: TProjectSessionStorage;
705
 
    FLazDocPaths: string;
706
 
    procedure SetLazDocPaths(const AValue: string);
 
391
    FFPDocPaths: string;
 
392
    FUseAppBundle: Boolean;
 
393
    procedure SetCleanOutputFileMask(const AValue: string);
 
394
    procedure SetCleanSourcesFileMask(const AValue: string);
 
395
    procedure SetFPDocPackageName(AValue: string);
 
396
    procedure SetFPDocPaths(const AValue: string);
 
397
    procedure SetUseAppBundle(AValue: Boolean);
707
398
  protected
708
399
    FLazCompilerOptions: TLazCompilerOptions;
709
400
    FFlags: TProjectFlags;
 
401
    FResources: TObject;
 
402
    FRunParameters: TAbstractRunParamsOptions;
 
403
    function GetFileCount: integer; virtual; abstract;
 
404
    function GetFiles(Index: integer): TLazProjectFile; virtual; abstract;
710
405
    function GetMainFile: TLazProjectFile; virtual; abstract;
711
406
    function GetMainFileID: Integer; virtual; abstract;
 
407
    function GetModified: boolean; virtual;
 
408
    function GetProjectInfoFile: string; virtual; abstract;
 
409
    function GetUseManifest: boolean; virtual; abstract;
 
410
    procedure SetExecutableType(const AValue: TProjectExecutableType); virtual;
 
411
    procedure SetFlags(const AValue: TProjectFlags); virtual;
712
412
    procedure SetMainFileID(const AValue: Integer); virtual; abstract;
713
 
    function GetFiles(Index: integer): TLazProjectFile; virtual; abstract;
714
 
    procedure SetTitle(const AValue: String); virtual;
715
 
    procedure SetFlags(const AValue: TProjectFlags); virtual;
716
 
    function GetModified: boolean; virtual;
717
 
    function GetProjectInfoFile: string; virtual; abstract;
 
413
    procedure SetModified(const AValue: boolean); virtual;
718
414
    procedure SetProjectInfoFile(const NewFilename: string); virtual; abstract;
719
415
    procedure SetProjectSessionFile(const AValue: string); virtual;
 
416
    procedure SetSessionModified(const AValue: boolean); virtual;
720
417
    procedure SetSessionStorage(const AValue: TProjectSessionStorage); virtual;
721
 
    procedure SetModified(const AValue: boolean); virtual;
722
 
    procedure SetSessionModified(const AValue: boolean); virtual;
723
 
    procedure SetExecutableType(const AValue: TProjectExecutableType); virtual;
 
418
    procedure SetTitle(const AValue: String); virtual;
 
419
    procedure SetUseManifest(AValue: boolean); virtual; abstract;
724
420
  public
725
421
    constructor Create(ProjectDescription: TProjectDescriptor); virtual;
726
422
    destructor Destroy; override;
 
423
    procedure Clear; virtual;
 
424
    function IsVirtual: boolean; virtual; abstract;
727
425
    function CreateProjectFile(const Filename: string
728
426
                               ): TLazProjectFile; virtual; abstract;
729
427
    procedure AddFile(ProjectFile: TLazProjectFile;
730
428
                      AddToProjectUsesClause: boolean); virtual; abstract;
731
429
    procedure RemoveUnit(Index: integer; RemoveFromUsesSection: boolean = true); virtual; abstract;
732
 
    function GetFileCount: integer; virtual; abstract;
733
430
    procedure AddSrcPath(const SrcPathAddition: string); virtual; abstract;
734
431
    procedure AddPackageDependency(const PackageName: string); virtual; abstract;
735
 
    function ShortDescription: string;
736
432
    procedure ClearModifieds(ClearUnits: boolean);
737
433
    function FindFile(const AFilename: string;
738
434
                      SearchFlags: TProjectFileSearchFlags): TLazProjectFile; virtual; abstract;
739
435
    procedure UpdateExecutableType; virtual; abstract;
740
 
    procedure ShortenFilename(var AFilename: string); virtual; abstract;
741
 
    procedure LongenFilename(var AFilename: string); virtual; abstract;
 
436
    function GetShortFilename(const Filename: string; UseUp: boolean): string; virtual; abstract;
 
437
    procedure ConvertToLPIFilename(var AFilename: string); virtual; abstract;
 
438
    procedure ConvertFromLPIFilename(var AFilename: string); virtual; abstract;
 
439
    procedure LoadDefaultIcon; virtual;
 
440
    function GetFPDocPackageName: string;
 
441
    function GetTitle: string; virtual; abstract; // Title with macros resolved
 
442
    function GetDefaultTitle: string; // extract name from lpi file name
 
443
    function GetTitleOrName: string; // GetTitle, if this is '' then GetDefaultTitle
 
444
    function ShortDescription: string; deprecated; // since 0.9.31, use GetTitleOrName instead
742
445
  public
743
446
    property MainFileID: Integer read GetMainFileID write SetMainFileID;
744
447
    property Files[Index: integer]: TLazProjectFile read GetFiles;
762
465
                       write SetSessionModified;
763
466
                       // project session data (not units, data),
764
467
                       // units have their own SessionModified
765
 
    property LazDocPaths: string read FLazDocPaths write SetLazDocPaths;
 
468
    property FPDocPaths: string read FFPDocPaths write SetFPDocPaths;
 
469
    property FPDocPackageName: string read FFPDocPackageName write SetFPDocPackageName;
 
470
    property LazDocPaths: string read FFPDocPaths write SetFPDocPaths; deprecated;
 
471
    property CleanOutputFileMask: string read FCleanOutputFileMask write SetCleanOutputFileMask; // saved in session
 
472
    property CleanSourcesFileMask: string read FCleanSourcesFileMask write SetCleanSourcesFileMask; // saved in session
766
473
    property CustomData: TStringToStringTree read FCustomData;
767
474
    property CustomSessionData: TStringToStringTree read FCustomSessionData;
 
475
    property UseAppBundle: Boolean read FUseAppBundle write SetUseAppBundle;
 
476
    property Resources: TObject read FResources; // TAbstractProjectResources
 
477
    property UseManifest: boolean read GetUseManifest write SetUseManifest;
 
478
    property RunParameters: TAbstractRunParamsOptions read FRunParameters;
768
479
  end;
769
480
 
770
481
  TLazProjectClass = class of TLazProject;
805
516
                         pfMainUnitHasCreateFormStatements,
806
517
                         pfMainUnitHasTitleStatement,
807
518
                         pfRunnable,
808
 
                         pfAlwaysBuild,
809
 
                         pfLRSFilesInOutputDirectory];
 
519
                         pfLRSFilesInOutputDirectory,
 
520
                         pfSaveJumpHistory,
 
521
                         pfSaveFoldState];
810
522
  ProjectFlagNames : array[TProjectFlag] of string = (
811
523
      'SaveClosedFiles',
812
524
      'SaveOnlyProjectUnits',
816
528
      'MainUnitHasTitleStatement',
817
529
      'Runnable',
818
530
      'AlwaysBuild',
 
531
      'UseDesignTimePackages',
819
532
      'LRSInOutputDirectory',
820
 
      'UseDefaultCompilerOptions'
 
533
      'UseDefaultCompilerOptions',
 
534
      'SaveJumpHistory',
 
535
      'SaveFoldState'
821
536
    );
822
537
 
823
538
  ProjectSessionStorageNames: array[TProjectSessionStorage] of string = (
1068
783
  inc(FReferenceCount);
1069
784
end;
1070
785
 
 
786
function TProjectFileDescriptor.CheckOwner(Quiet: boolean): TModalResult;
 
787
begin
 
788
  Result:=mrOk;
 
789
end;
 
790
 
1071
791
function TProjectFileDescriptor.CreateSource(const Filename, SourceName,
1072
792
  ResourceName: string): string;
1073
793
begin
1084
804
    DefaultFilename:=ChangeFileExt(DefaultFilename,DefPasExt);
1085
805
end;
1086
806
 
 
807
function TProjectFileDescriptor.Init(var NewFilename: string;
 
808
  NewOwner: TObject; var NewSource: string; Quiet: boolean): TModalResult;
 
809
begin
 
810
  Result:=mrOk;
 
811
end;
 
812
 
1087
813
{ TFileDescPascalUnit }
1088
814
 
1089
815
constructor TFileDescPascalUnit.Create;
1153
879
  Result:='';
1154
880
end;
1155
881
 
 
882
function TFileDescPascalUnit.CheckOwner(Quiet: boolean): TModalResult;
 
883
begin
 
884
  Result:=inherited CheckOwner(Quiet);
 
885
  if Result<>mrOK then exit;
 
886
  if Owner=nil then exit;
 
887
  if Assigned(CheckCompOptsAndMainSrcForNewUnitEvent) then begin
 
888
    if Owner is TLazProject then
 
889
      Result:=CheckCompOptsAndMainSrcForNewUnitEvent(
 
890
                                         TLazProject(Owner).LazCompilerOptions);
 
891
  end;
 
892
end;
 
893
 
1156
894
class function TFileDescPascalUnit.CompilerOptionsToUnitDirectives(
1157
895
  CompOpts: TLazCompilerOptions): string;
1158
896
var
1160
898
begin
1161
899
  Result:='{$mode objfpc}{$H+}';
1162
900
  if CompOpts=nil then exit;
1163
 
  if Assigned(CheckCompOptsAndMainSrcForNewUnitEvent) then
1164
 
    CheckCompOptsAndMainSrcForNewUnitEvent(CompOpts);
1165
901
  SyntaxMode:=CompOpts.SyntaxMode;
1166
902
  if SyntaxMode<>'' then begin
1167
903
    Result:='{$mode '+lowercase(SyntaxMode)+'}';
1305
1041
begin
1306
1042
  if FFlags=AValue then exit;
1307
1043
  FFlags:=AValue;
 
1044
  Modified:=true;
1308
1045
end;
1309
1046
 
1310
1047
procedure TLazProject.SetSessionStorage(const AValue: TProjectSessionStorage);
1333
1070
  SessionModified:=true;
1334
1071
end;
1335
1072
 
1336
 
procedure TLazProject.SetLazDocPaths(const AValue: string);
1337
 
begin
1338
 
  if FLazDocPaths=AValue then exit;
1339
 
  FLazDocPaths:=AValue;
 
1073
procedure TLazProject.SetFPDocPaths(const AValue: string);
 
1074
begin
 
1075
  if FFPDocPaths=AValue then exit;
 
1076
  FFPDocPaths:=AValue;
 
1077
  Modified:=true;
 
1078
end;
 
1079
 
 
1080
procedure TLazProject.SetUseAppBundle(AValue: Boolean);
 
1081
begin
 
1082
  if FUseAppBundle=AValue then Exit;
 
1083
  FUseAppBundle:=AValue;
 
1084
  Modified:=true;
 
1085
end;
 
1086
 
 
1087
procedure TLazProject.SetCleanOutputFileMask(const AValue: string);
 
1088
begin
 
1089
  if FCleanOutputFileMask=AValue then exit;
 
1090
  FCleanOutputFileMask:=AValue;
 
1091
  SessionModified:=true;
 
1092
end;
 
1093
 
 
1094
procedure TLazProject.SetCleanSourcesFileMask(const AValue: string);
 
1095
begin
 
1096
  if FCleanSourcesFileMask=AValue then exit;
 
1097
  FCleanSourcesFileMask:=AValue;
 
1098
  SessionModified:=true;
 
1099
end;
 
1100
 
 
1101
procedure TLazProject.SetFPDocPackageName(AValue: string);
 
1102
begin
 
1103
  if FFPDocPackageName=AValue then Exit;
 
1104
  FFPDocPackageName:=AValue;
1340
1105
  Modified:=true;
1341
1106
end;
1342
1107
 
1362
1127
constructor TLazProject.Create(ProjectDescription: TProjectDescriptor);
1363
1128
begin
1364
1129
  inherited Create;
1365
 
  FSessionStorage:=pssInProjectInfo;
 
1130
  FSessionStorage:=DefaultNewProjectSessionStorage;
 
1131
  FCleanOutputFileMask:=DefaultProjectCleanOutputFileMask;
 
1132
  FCleanSourcesFileMask:=DefaultProjectCleanSourcesFileMask;
1366
1133
  FCustomData:=TStringToStringTree.Create(true);
1367
1134
  FCustomSessionData:=TStringToStringTree.Create(true);
1368
1135
end;
1374
1141
  inherited Destroy;
1375
1142
end;
1376
1143
 
 
1144
procedure TLazProject.Clear;
 
1145
begin
 
1146
  FCleanOutputFileMask:=DefaultProjectCleanOutputFileMask;
 
1147
  FCleanSourcesFileMask:=DefaultProjectCleanSourcesFileMask;
 
1148
  FCustomData.Clear;
 
1149
  FCustomSessionData.Clear;
 
1150
  FExecutableType:=petNone;
 
1151
  FTitle:='';
 
1152
  FSessionStorage:=DefaultNewProjectSessionStorage;
 
1153
  FFPDocPaths:='';
 
1154
  FFPDocPackageName:='';
 
1155
end;
 
1156
 
1377
1157
function TLazProject.ShortDescription: string;
1378
1158
begin
1379
 
  if Title<>'' then
1380
 
    Result:=Title
1381
 
  else
1382
 
    Result:=ExtractFileNameOnly(ProjectInfoFile);
 
1159
  Result:=GetTitleOrName;
1383
1160
end;
1384
1161
 
1385
1162
procedure TLazProject.ClearModifieds(ClearUnits: boolean);
1393
1170
      Files[i].ClearModifieds;
1394
1171
end;
1395
1172
 
 
1173
procedure TLazProject.LoadDefaultIcon;
 
1174
begin
 
1175
 
 
1176
end;
 
1177
 
 
1178
function TLazProject.GetFPDocPackageName: string;
 
1179
begin
 
1180
  if FPDocPackageName<>'' then
 
1181
    Result:=FPDocPackageName
 
1182
  else
 
1183
    Result:=ExtractFileNameOnly(ProjectInfoFile);
 
1184
end;
 
1185
 
 
1186
function TLazProject.GetDefaultTitle: string;
 
1187
begin
 
1188
  Result:=ExtractFileNameOnly(ProjectInfoFile);
 
1189
end;
 
1190
 
 
1191
function TLazProject.GetTitleOrName: string;
 
1192
begin
 
1193
  Result:=GetTitle;
 
1194
  if Result='' then Result:=GetDefaultTitle;
 
1195
end;
 
1196
 
1396
1197
{ TLazProjectFile }
1397
1198
 
1398
1199
procedure TLazProjectFile.SetIsPartOfProject(const AValue: boolean);
1413
1214
  inherited Destroy;
1414
1215
end;
1415
1216
 
1416
 
{ TLazCompilerOptions }
1417
 
 
1418
 
procedure TLazCompilerOptions.SetLCLWidgetType(const AValue: string);
1419
 
begin
1420
 
  if AValue=LCLWidgetType then exit;
1421
 
  fLCLWidgetType:=AValue;
1422
 
  IncreaseChangeStamp;
1423
 
end;
1424
 
 
1425
 
procedure TLazCompilerOptions.SetLinkSmart(const AValue: Boolean);
1426
 
begin
1427
 
  if fLinkSmart=AValue then exit;
1428
 
  fLinkSmart:=AValue;
1429
 
  IncreaseChangeStamp;
1430
 
end;
1431
 
 
1432
 
procedure TLazCompilerOptions.SetOptLevel(const AValue: Integer);
1433
 
begin
1434
 
  if fOptLevel=AValue then exit;
1435
 
  fOptLevel:=AValue;
1436
 
  IncreaseChangeStamp;
1437
 
end;
1438
 
 
1439
 
procedure TLazCompilerOptions.SetOverflowChecks(const AValue: Boolean);
1440
 
begin
1441
 
  if fOverflowChecks=AValue then exit;
1442
 
  fOverflowChecks:=AValue;
1443
 
  IncreaseChangeStamp;
1444
 
end;
1445
 
 
1446
 
procedure TLazCompilerOptions.SetPassLinkerOpt(const AValue: Boolean);
1447
 
begin
1448
 
  if fPassLinkerOpt=AValue then exit;
1449
 
  fPassLinkerOpt:=AValue;
1450
 
  IncreaseChangeStamp;
1451
 
end;
1452
 
 
1453
 
procedure TLazCompilerOptions.SetRangeChecks(const AValue: Boolean);
1454
 
begin
1455
 
  if fRangeChecks=AValue then exit;
1456
 
  fRangeChecks:=AValue;
1457
 
  IncreaseChangeStamp;
1458
 
end;
1459
 
 
1460
 
procedure TLazCompilerOptions.SetShowAll(const AValue: Boolean);
1461
 
begin
1462
 
  if fShowAll=AValue then exit;
1463
 
  fShowAll:=AValue;
1464
 
  IncreaseChangeStamp;
1465
 
end;
1466
 
 
1467
 
procedure TLazCompilerOptions.SetShowAllProcsOnError(const AValue: Boolean);
1468
 
begin
1469
 
  if fShowAllProcsOnError=AValue then exit;
1470
 
  fShowAllProcsOnError:=AValue;
1471
 
  IncreaseChangeStamp;
1472
 
end;
1473
 
 
1474
 
procedure TLazCompilerOptions.SetShowCompProc(const AValue: Boolean);
1475
 
begin
1476
 
  if fShowCompProc=AValue then exit;
1477
 
  fShowCompProc:=AValue;
1478
 
  IncreaseChangeStamp;
1479
 
end;
1480
 
 
1481
 
procedure TLazCompilerOptions.SetShowCond(const AValue: Boolean);
1482
 
begin
1483
 
  if fShowCond=AValue then exit;
1484
 
  fShowCond:=AValue;
1485
 
  IncreaseChangeStamp;
1486
 
end;
1487
 
 
1488
 
procedure TLazCompilerOptions.SetShowDebugInfo(const AValue: Boolean);
1489
 
begin
1490
 
  if fShowDebugInfo=AValue then exit;
1491
 
  fShowDebugInfo:=AValue;
1492
 
  IncreaseChangeStamp;
1493
 
end;
1494
 
 
1495
 
procedure TLazCompilerOptions.SetShowDefMacros(const AValue: Boolean);
1496
 
begin
1497
 
  if fShowDefMacros=AValue then exit;
1498
 
  fShowDefMacros:=AValue;
1499
 
  IncreaseChangeStamp;
1500
 
end;
1501
 
 
1502
 
procedure TLazCompilerOptions.SetShowErrors(const AValue: Boolean);
1503
 
begin
1504
 
  if fShowErrors=AValue then exit;
1505
 
  fShowErrors:=AValue;
1506
 
  IncreaseChangeStamp;
1507
 
end;
1508
 
 
1509
 
procedure TLazCompilerOptions.SetShowExecInfo(const AValue: Boolean);
1510
 
begin
1511
 
  if fShowExecInfo=AValue then exit;
1512
 
  fShowExecInfo:=AValue;
1513
 
  IncreaseChangeStamp;
1514
 
end;
1515
 
 
1516
 
procedure TLazCompilerOptions.SetShowGenInfo(const AValue: Boolean);
1517
 
begin
1518
 
  if fShowGenInfo=AValue then exit;
1519
 
  fShowGenInfo:=AValue;
1520
 
  IncreaseChangeStamp;
1521
 
end;
1522
 
 
1523
 
procedure TLazCompilerOptions.SetShowHints(const AValue: Boolean);
1524
 
begin
1525
 
  if fShowHints=AValue then exit;
1526
 
  fShowHints:=AValue;
1527
 
  IncreaseChangeStamp;
1528
 
end;
1529
 
 
1530
 
procedure TLazCompilerOptions.SetShowHintsForSenderNotUsed(const AValue: Boolean
1531
 
  );
1532
 
begin
1533
 
  if fShowHintsForSenderNotUsed=AValue then exit;
1534
 
  fShowHintsForSenderNotUsed:=AValue;
1535
 
  IncreaseChangeStamp;
1536
 
end;
1537
 
 
1538
 
procedure TLazCompilerOptions.SetShowHintsForUnusedUnitsInMainSrc(
1539
 
  const AValue: Boolean);
1540
 
begin
1541
 
  if fShowHintsForUnusedUnitsInMainSrc=AValue then exit;
1542
 
  fShowHintsForUnusedUnitsInMainSrc:=AValue;
1543
 
  IncreaseChangeStamp;
1544
 
end;
1545
 
 
1546
 
procedure TLazCompilerOptions.SetShowLineNum(const AValue: Boolean);
1547
 
begin
1548
 
  if fShowLineNum=AValue then exit;
1549
 
  fShowLineNum:=AValue;
1550
 
  IncreaseChangeStamp;
1551
 
end;
1552
 
 
1553
 
procedure TLazCompilerOptions.SetShowNotes(const AValue: Boolean);
1554
 
begin
1555
 
  if fShowNotes=AValue then exit;
1556
 
  fShowNotes:=AValue;
1557
 
  IncreaseChangeStamp;
1558
 
end;
1559
 
 
1560
 
procedure TLazCompilerOptions.SetShowNothing(const AValue: Boolean);
1561
 
begin
1562
 
  if fShowNothing=AValue then exit;
1563
 
  fShowNothing:=AValue;
1564
 
  IncreaseChangeStamp;
1565
 
end;
1566
 
 
1567
 
procedure TLazCompilerOptions.SetShowSummary(const AValue: Boolean);
1568
 
begin
1569
 
  if FShowSummary=AValue then exit;
1570
 
  FShowSummary:=AValue;
1571
 
  IncreaseChangeStamp;
1572
 
end;
1573
 
 
1574
 
procedure TLazCompilerOptions.SetShowTriedFiles(const AValue: Boolean);
1575
 
begin
1576
 
  if fShowTriedFiles=AValue then exit;
1577
 
  fShowTriedFiles:=AValue;
1578
 
  IncreaseChangeStamp;
1579
 
end;
1580
 
 
1581
 
procedure TLazCompilerOptions.SetShowUsedFiles(const AValue: Boolean);
1582
 
begin
1583
 
  if fShowUsedFiles=AValue then exit;
1584
 
  fShowUsedFiles:=AValue;
1585
 
  IncreaseChangeStamp;
1586
 
end;
1587
 
 
1588
 
procedure TLazCompilerOptions.SetShowWarn(const AValue: Boolean);
1589
 
begin
1590
 
  if fShowWarn=AValue then exit;
1591
 
  fShowWarn:=AValue;
1592
 
  IncreaseChangeStamp;
1593
 
end;
1594
 
 
1595
 
procedure TLazCompilerOptions.SetSmallerCode(const AValue: boolean);
1596
 
begin
1597
 
  if FSmallerCode=AValue then exit;
1598
 
  FSmallerCode:=AValue;
1599
 
  IncreaseChangeStamp;
1600
 
end;
1601
 
 
1602
 
procedure TLazCompilerOptions.SetSmartLinkUnit(const AValue: Boolean);
1603
 
begin
1604
 
  if fSmartLinkUnit=AValue then exit;
1605
 
  fSmartLinkUnit:=AValue;
1606
 
  IncreaseChangeStamp;
1607
 
end;
1608
 
 
1609
 
procedure TLazCompilerOptions.SetStackChecks(const AValue: Boolean);
1610
 
begin
1611
 
  if fStackChecks=AValue then exit;
1612
 
  fStackChecks:=AValue;
1613
 
  IncreaseChangeStamp;
1614
 
end;
1615
 
 
1616
 
procedure TLazCompilerOptions.SetAllowLabel(const AValue: Boolean);
1617
 
begin
1618
 
  if fAllowLabel=AValue then exit;
1619
 
  fAllowLabel:=AValue;
1620
 
  IncreaseChangeStamp;
1621
 
end;
1622
 
 
1623
 
procedure TLazCompilerOptions.SetAssemblerStyle(const AValue: Integer);
1624
 
begin
1625
 
  if fAssemblerStyle=AValue then exit;
1626
 
  fAssemblerStyle:=AValue;
1627
 
  IncreaseChangeStamp;
1628
 
end;
1629
 
 
1630
 
procedure TLazCompilerOptions.SetCMacros(const AValue: Boolean);
1631
 
begin
1632
 
  if fCMacros=AValue then exit;
1633
 
  fCMacros:=AValue;
1634
 
  IncreaseChangeStamp;
1635
 
end;
1636
 
 
1637
 
procedure TLazCompilerOptions.SetConfigFilePath(const AValue: String);
1638
 
begin
1639
 
  if fConfigFilePath=AValue then exit;
1640
 
  fConfigFilePath:=AValue;
1641
 
  IncreaseChangeStamp;
1642
 
end;
1643
 
 
1644
 
procedure TLazCompilerOptions.SetCPPInline(const AValue: Boolean);
1645
 
begin
1646
 
  if fCPPInline=AValue then exit;
1647
 
  fCPPInline:=AValue;
1648
 
  IncreaseChangeStamp;
1649
 
end;
1650
 
 
1651
 
procedure TLazCompilerOptions.SetCStyleOp(const AValue: Boolean);
1652
 
begin
1653
 
  if fCStyleOp=AValue then exit;
1654
 
  fCStyleOp:=AValue;
1655
 
  IncreaseChangeStamp;
1656
 
end;
1657
 
 
1658
 
procedure TLazCompilerOptions.SetCustomConfigFile(const AValue: Boolean);
1659
 
begin
1660
 
  if fCustomConfigFile=AValue then exit;
1661
 
  fCustomConfigFile:=AValue;
1662
 
  IncreaseChangeStamp;
1663
 
end;
1664
 
 
1665
 
procedure TLazCompilerOptions.SetDontUseConfigFile(const AValue: Boolean);
1666
 
begin
1667
 
  if fDontUseConfigFile=AValue then exit;
1668
 
  fDontUseConfigFile:=AValue;
1669
 
  IncreaseChangeStamp;
1670
 
end;
1671
 
 
1672
 
procedure TLazCompilerOptions.SetExecutableType(
1673
 
  const AValue: TCompilationExecutableType);
1674
 
begin
1675
 
  if FExecutableType=AValue then exit;
1676
 
  FExecutableType:=AValue;
1677
 
  IncreaseChangeStamp;
1678
 
end;
1679
 
 
1680
 
procedure TLazCompilerOptions.SetGenDebugInfo(const AValue: Boolean);
1681
 
begin
1682
 
  if fGenDebugInfo=AValue then exit;
1683
 
  fGenDebugInfo:=AValue;
1684
 
  IncreaseChangeStamp;
1685
 
end;
1686
 
 
1687
 
procedure TLazCompilerOptions.SetGenerateDwarf(const AValue: Boolean);
1688
 
begin
1689
 
  if FGenerateDwarf=AValue then exit;
1690
 
  FGenerateDwarf:=AValue;
1691
 
  IncreaseChangeStamp;
1692
 
end;
1693
 
 
1694
 
procedure TLazCompilerOptions.SetGenGProfCode(const AValue: Boolean);
1695
 
begin
1696
 
  if fGenGProfCode=AValue then exit;
1697
 
  fGenGProfCode:=AValue;
1698
 
  IncreaseChangeStamp;
1699
 
end;
1700
 
 
1701
 
procedure TLazCompilerOptions.SetHeapSize(const AValue: Integer);
1702
 
begin
1703
 
  if fHeapSize=AValue then exit;
1704
 
  fHeapSize:=AValue;
1705
 
  IncreaseChangeStamp;
1706
 
end;
1707
 
 
1708
 
procedure TLazCompilerOptions.SetIncludeAssertionCode(const AValue: Boolean);
1709
 
begin
1710
 
  if fIncludeAssertionCode=AValue then exit;
1711
 
  fIncludeAssertionCode:=AValue;
1712
 
  IncreaseChangeStamp;
1713
 
end;
1714
 
 
1715
 
procedure TLazCompilerOptions.SetInitConst(const AValue: Boolean);
1716
 
begin
1717
 
  if fInitConst=AValue then exit;
1718
 
  fInitConst:=AValue;
1719
 
  IncreaseChangeStamp;
1720
 
end;
1721
 
 
1722
 
procedure TLazCompilerOptions.SetIOChecks(const AValue: Boolean);
1723
 
begin
1724
 
  if fIOChecks=AValue then exit;
1725
 
  fIOChecks:=AValue;
1726
 
  IncreaseChangeStamp;
1727
 
end;
1728
 
 
1729
 
procedure TLazCompilerOptions.SetStaticKeyword(const AValue: Boolean);
1730
 
begin
1731
 
  if fStaticKeyword=AValue then exit;
1732
 
  fStaticKeyword:=AValue;
1733
 
  IncreaseChangeStamp;
1734
 
end;
1735
 
 
1736
 
procedure TLazCompilerOptions.SetStopAfterErrCount(const AValue: integer);
1737
 
begin
1738
 
  if fStopAfterErrCount=AValue then exit;
1739
 
  fStopAfterErrCount:=AValue;
1740
 
  IncreaseChangeStamp;
1741
 
end;
1742
 
 
1743
 
procedure TLazCompilerOptions.SetStripSymbols(const AValue: Boolean);
1744
 
begin
1745
 
  if fStripSymbols=AValue then exit;
1746
 
  fStripSymbols:=AValue;
1747
 
  IncreaseChangeStamp;
1748
 
end;
1749
 
 
1750
 
procedure TLazCompilerOptions.SetSyntaxMode(const AValue: string);
1751
 
begin
1752
 
  if FSyntaxMode=AValue then exit;
1753
 
  FSyntaxMode:=AValue;
1754
 
  IncreaseChangeStamp;
1755
 
end;
1756
 
 
1757
 
procedure TLazCompilerOptions.SetTargetFilenameAppplyConventions(
1758
 
  const AValue: boolean);
1759
 
begin
1760
 
  if FTargetFilenameAppplyConventions=AValue then exit;
1761
 
  FTargetFilenameAppplyConventions:=AValue;
1762
 
  IncreaseChangeStamp;
1763
 
end;
1764
 
 
1765
 
procedure TLazCompilerOptions.SetUncertainOpt(const AValue: Boolean);
1766
 
begin
1767
 
  if fUncertainOpt=AValue then exit;
1768
 
  fUncertainOpt:=AValue;
1769
 
  IncreaseChangeStamp;
1770
 
end;
1771
 
 
1772
 
procedure TLazCompilerOptions.SetUseAnsiStr(const AValue: Boolean);
1773
 
begin
1774
 
  if fUseAnsiStr=AValue then exit;
1775
 
  fUseAnsiStr:=AValue;
1776
 
  IncreaseChangeStamp;
1777
 
end;
1778
 
 
1779
 
procedure TLazCompilerOptions.SetUseExternalDbgSyms(const AValue: Boolean);
1780
 
begin
1781
 
  if FUseExternalDbgSyms=AValue then exit;
1782
 
  FUseExternalDbgSyms:=AValue;
1783
 
  IncreaseChangeStamp;
1784
 
end;
1785
 
 
1786
 
procedure TLazCompilerOptions.SetUseHeaptrc(const AValue: Boolean);
1787
 
begin
1788
 
  if fUseHeaptrc=AValue then exit;
1789
 
  fUseHeaptrc:=AValue;
1790
 
  IncreaseChangeStamp;
1791
 
end;
1792
 
 
1793
 
procedure TLazCompilerOptions.SetUseLineInfoUnit(const AValue: Boolean);
1794
 
begin
1795
 
  if fUseLineInfoUnit=AValue then exit;
1796
 
  fUseLineInfoUnit:=AValue;
1797
 
  IncreaseChangeStamp;
1798
 
end;
1799
 
 
1800
 
procedure TLazCompilerOptions.SetUseValgrind(const AValue: Boolean);
1801
 
begin
1802
 
  if fUseValgrind=AValue then exit;
1803
 
  fUseValgrind:=AValue;
1804
 
  IncreaseChangeStamp;
1805
 
end;
1806
 
 
1807
 
procedure TLazCompilerOptions.SetVarsInReg(const AValue: Boolean);
1808
 
begin
1809
 
  if fVarsInReg=AValue then exit;
1810
 
  fVarsInReg:=AValue;
1811
 
  IncreaseChangeStamp;
1812
 
end;
1813
 
 
1814
 
procedure TLazCompilerOptions.SetVerifyObjMethodCall(const AValue: boolean);
1815
 
begin
1816
 
  if FVerifyObjMethodCall=AValue then exit;
1817
 
  FVerifyObjMethodCall:=AValue;
1818
 
  IncreaseChangeStamp;
1819
 
end;
1820
 
 
1821
 
procedure TLazCompilerOptions.SetWin32GraphicApp(const AValue: boolean);
1822
 
begin
1823
 
  if FWin32GraphicApp=AValue then exit;
1824
 
  FWin32GraphicApp:=AValue;
1825
 
  IncreaseChangeStamp;
1826
 
end;
1827
 
 
1828
 
procedure TLazCompilerOptions.SetWriteFPCLogo(const AValue: Boolean);
1829
 
begin
1830
 
  if fWriteFPCLogo=AValue then exit;
1831
 
  fWriteFPCLogo:=AValue;
1832
 
  IncreaseChangeStamp;
1833
 
end;
1834
 
 
1835
 
function TLazCompilerOptions.GetModified: boolean;
1836
 
begin
1837
 
  Result:=(FSavedChangeStamp=InvalidChangeStamp)
1838
 
         or (FSavedChangeStamp<>FChangeStamp);
1839
 
end;
1840
 
 
1841
 
constructor TLazCompilerOptions.Create(const TheOwner: TObject);
1842
 
begin
1843
 
  inherited Create;
1844
 
  fOnChanged:=TMethodList.Create;
1845
 
  FChangeStamp:=InvalidChangeStamp;
1846
 
  FSavedChangeStamp:=FChangeStamp;
1847
 
  FTargetFilenameAppplyConventions:=true;
1848
 
  FOwner := TheOwner;
1849
 
end;
1850
 
 
1851
 
destructor TLazCompilerOptions.Destroy;
1852
 
begin
1853
 
  FreeAndNil(fOnChanged);
1854
 
  inherited Destroy;
1855
 
end;
1856
 
 
1857
 
function TLazCompilerOptions.IsActive: boolean;
1858
 
begin
1859
 
  Result:=false;
1860
 
end;
1861
 
 
1862
 
procedure TLazCompilerOptions.IncreaseChangeStamp;
1863
 
begin
1864
 
  if fChangeStamp<High(ChangeStamp) then
1865
 
    inc(fChangeStamp)
1866
 
  else
1867
 
    fChangeStamp:=Low(int64)+1;
1868
 
  if fOnChanged<>nil then fOnChanged.CallNotifyEvents(Self);
1869
 
end;
1870
 
 
1871
 
class function TLazCompilerOptions.InvalidChangeStamp: int64;
1872
 
begin
1873
 
  Result:=Low(int64);
1874
 
end;
1875
 
 
1876
 
procedure TLazCompilerOptions.AddOnChangedHandler(const Handler: TNotifyEvent);
1877
 
begin
1878
 
  fOnChanged.Add(TMethod(Handler));
1879
 
end;
1880
 
 
1881
 
procedure TLazCompilerOptions.RemoveOnChangedHandler(const Handler: TNotifyEvent
1882
 
  );
1883
 
begin
1884
 
  fOnChanged.Remove(TMethod(Handler));
1885
 
end;
1886
 
 
1887
1217
{ TNewItemProjectFile }
1888
1218
 
1889
1219
function TNewItemProjectFile.LocalizedName: string;
1922
1252
    FDescriptor:=TNewItemProject(Source).Descriptor;
1923
1253
end;
1924
1254
 
1925
 
{ TLazBuildMacros }
1926
 
 
1927
 
constructor TLazBuildMacros.Create(TheOwner: TObject);
1928
 
begin
1929
 
  FOwner:=TheOwner
1930
 
end;
1931
 
 
1932
1255
initialization
1933
1256
  ProjectFileDescriptors:=nil;
1934
1257