~ubuntu-branches/ubuntu/vivid/lazarus/vivid

« back to all changes in this revision

Viewing changes to ide/codeexplopts.pas

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Paul Gevers
  • Date: 2014-02-22 10:25:57 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140222102557-ors9d31r84nz31jq
Tags: 1.2~rc2+dfsg-1
[ Abou Al Montacir ]
* New upstream pre-release.
  + Moved ideintf to components directory.
  + Added new package cairocanvas.
* Remove usage of depreciated parameters form of find. (Closes: Bug#724776)
* Bumped standard version to 3.9.5.
* Clean the way handling make files generation and removal.

[ Paul Gevers ]
* Remove nearly obsolete bzip compression for binary packages
  (See https://lists.debian.org/debian-devel/2014/01/msg00542.html)
* Update d/copyright for newly added dir in examples and components
* Update Vcs-* fields with new packaging location
* Update d/watch file to properly (Debian way) change upstreams versions
* Prevent 46MB of package size by sym linking duplicate files
* Patches
  - refresh to remove fuzz
  - add more Lintian found spelling errors
  - new patch to add shbang to two scripts in lazarus-src
* Drop lcl-# from Provides list of lcl-units-#
* Make lazarus-ide-qt4-# an arch all until it really contains stuff
* Make all metapackages arch all as the usecase for arch any doesn't
  seem to warrant the addition archive hit
* Fix permissions of non-scripts in lazarus-src-#

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
type
44
44
  { TCodeExplorerOptions }
45
45
  
 
46
  TCodeExplorerPage = (
 
47
    cepNone,
 
48
    cepCode,
 
49
    cepDirectives
 
50
    );
 
51
 
46
52
  TCodeExplorerRefresh = (
47
53
    cerManual,  // only via refresh button
48
54
    cerSwitchEditorPage,// everytime the source editor switches to another page
90
96
  DefaultCodeExplorerCategories = [cecUses,
91
97
               cecTypes,cecVariables,cecConstants,cecProcedures];
92
98
  cefcAll = [low(TCEObserverCategory)..high(TCEObserverCategory)];
 
99
  DefaultCodeExplorerPage = cepCode;
93
100
  DefaultCodeObserverCategories = [
94
101
    cefcLongProcs,
95
102
    cefcEmptyProcs,
143
150
    FMode : TCodeExplorerMode;
144
151
    FObserverIgnoreConstants: TAvgLvlTree;// tree of AnsiString
145
152
    FOptionsFilename: string;
 
153
    FPage: TCodeExplorerPage;
146
154
    FRefresh: TCodeExplorerRefresh;
 
155
    FSavedChangeStep: integer;
 
156
    function GetModified: boolean;
147
157
    procedure SetCategories(const AValue: TCodeExplorerCategories);
148
158
    procedure SetFollowCursor(const AValue: boolean);
149
159
    procedure SetLongParamListCount(const AValue: integer);
150
160
    procedure SetLongProcLineCount(const AValue: integer);
151
161
    procedure SetMode(const AValue: TCodeExplorerMode);
 
162
    procedure SetModified(AValue: boolean);
152
163
    procedure SetNestedProcCount(const AValue: integer);
153
164
    procedure SetObserveCharConst(const AValue: boolean);
154
165
    procedure SetObserverCategories(const AValue: TCEObserverCategories);
 
166
    procedure SetPage(AValue: TCodeExplorerPage);
155
167
    procedure SetRefresh(const AValue: TCodeExplorerRefresh);
156
168
  public
157
169
    class function GetGroupCaption:string; override;
167
179
    procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
168
180
    procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
169
181
    procedure IncreaseChangeStep;
 
182
    property Modified: boolean read GetModified write SetModified;
170
183
  public
171
184
    // observer: ignore constants
172
185
    function CreateListOfCOIgnoreConstants: TStrings;
193
206
    property OptionsFilename: string read FOptionsFilename write FOptionsFilename;
194
207
    property FollowCursor: boolean read FFollowCursor write SetFollowCursor default true;
195
208
    property Categories: TCodeExplorerCategories read FCategories write SetCategories default DefaultCodeExplorerCategories;
 
209
    property Page: TCodeExplorerPage read FPage write SetPage default DefaultCodeExplorerPage;
196
210
    property ChangeStep: integer read FChangeStep write FChangeStep;
197
211
  public
198
212
    // Observer
210
224
 
211
225
  cerDefault = cerSwitchEditorPage;
212
226
 
 
227
  CodeExplorerPageNames: array[TCodeExplorerPage] of string = (
 
228
    '?',
 
229
    'Code',
 
230
    'Directives'
 
231
    );
213
232
  CodeExplorerRefreshNames: array[TCodeExplorerRefresh] of string = (
214
233
    'Manual',
215
234
    'SwitchEditorPage',
248
267
var
249
268
  CodeExplorerOptions: TCodeExplorerOptions = nil; // set by the IDE
250
269
 
 
270
function CodeExplorerPageNameToEnum(const s: string): TCodeExplorerPage;
251
271
function CodeExplorerRefreshNameToEnum(const s: string): TCodeExplorerRefresh;
252
272
function CodeExplorerModeNameToEnum(const s: string): TCodeExplorerMode;
253
273
function CodeExplorerCategoryNameToEnum(const s: string): TCodeExplorerCategory;
258
278
 
259
279
implementation
260
280
 
 
281
function CodeExplorerPageNameToEnum(const s: string): TCodeExplorerPage;
 
282
begin
 
283
  for Result:=Low(TCodeExplorerPage) to High(TCodeExplorerPage) do
 
284
    if SysUtils.CompareText(CodeExplorerPageNames[Result],s)=0 then exit;
 
285
  Result:=DefaultCodeExplorerPage;
 
286
end;
261
287
 
262
288
function CodeExplorerRefreshNameToEnum(const s: string): TCodeExplorerRefresh;
263
289
begin
342
368
  IncreaseChangeStep;
343
369
end;
344
370
 
 
371
procedure TCodeExplorerOptions.SetModified(AValue: boolean);
 
372
begin
 
373
  if AValue then
 
374
    IncreaseChangeStep
 
375
  else
 
376
    FSavedChangeStep:=FChangeStep;
 
377
end;
 
378
 
345
379
procedure TCodeExplorerOptions.SetNestedProcCount(const AValue: integer);
346
380
begin
347
381
  if FNestedProcCount=AValue then exit;
364
398
  IncreaseChangeStep;
365
399
end;
366
400
 
 
401
procedure TCodeExplorerOptions.SetPage(AValue: TCodeExplorerPage);
 
402
begin
 
403
  if FPage=AValue then Exit;
 
404
  FPage:=AValue;
 
405
  IncreaseChangeStep;
 
406
end;
 
407
 
367
408
procedure TCodeExplorerOptions.SetFollowCursor(const AValue: boolean);
368
409
begin
369
410
  if FFollowCursor=AValue then exit;
393
434
  IncreaseChangeStep;
394
435
end;
395
436
 
 
437
function TCodeExplorerOptions.GetModified: boolean;
 
438
begin
 
439
  Result:=FSavedChangeStep<>FChangeStep;
 
440
end;
 
441
 
396
442
constructor TCodeExplorerOptions.Create;
397
443
begin
398
444
  FOptionsFilename:=
434
480
  FMode:=cemCategory;
435
481
  FRefresh:=cerDefault;
436
482
  FFollowCursor:=true;
 
483
  FPage:=DefaultCodeExplorerPage;
437
484
  FCategories:=DefaultCodeExplorerCategories;
438
485
  FObserverCategories:=DefaultCodeObserverCategories;
439
486
  FLongProcLineCount:=DefaultCOLongProcLineCount;
455
502
    FRefresh:=Src.Refresh;
456
503
    FMode:=Src.Mode;
457
504
    FFollowCursor:=Src.FollowCursor;
 
505
    FPage:=Src.Page;
458
506
    FCategories:=Src.Categories;
459
507
    FObserverCategories:=Src.ObserverCategories;
460
508
    FLongProcLineCount:=Src.LongProcLineCount;
505
553
var
506
554
  XMLConfig: TXMLConfig;
507
555
begin
 
556
  if FileExistsCached(FOptionsFilename) and not Modified then exit;
508
557
  try
509
558
    InvalidateFileStateCache;
510
559
    XMLConfig:=TXMLConfig.CreateClean(FOptionsFilename);
513
562
    SaveToXMLConfig(XMLConfig,'CodeExplorer/');
514
563
    XMLConfig.Flush;
515
564
    XMLConfig.Free;
 
565
    Modified:=false;
516
566
  except
517
567
    on E: Exception do begin
518
568
      DebugLn('[TCodeExplorerOptions.Save]  error writing "',FOptionsFilename,'" ',E.Message);
535
585
  FMode:=CodeExplorerModeNameToEnum(
536
586
                                   XMLConfig.GetValue(Path+'Mode/Value',''));
537
587
  FFollowCursor:=XMLConfig.GetValue(Path+'FollowCursor',true);
538
 
  
 
588
  FPage:=CodeExplorerPageNameToEnum(XMLConfig.GetValue(Path+'Page/Value',''));
 
589
 
539
590
  FCategories:=[];
540
591
  for c:=FirstCodeExplorerCategory to high(TCodeExplorerCategory) do
541
592
    if XMLConfig.GetValue(Path+'Categories/'+CodeExplorerCategoryNames[c],
606
657
                           CodeExplorerModeNames[FMode],
607
658
                           CodeExplorerModeNames[cemCategory]);
608
659
  XMLConfig.SetDeleteValue(Path+'FollowCursor',FFollowCursor,true);
609
 
  
 
660
  XMLConfig.SetDeleteValue(Path+'Page/Value',CodeExplorerPageNames[FPage],
 
661
                           CodeExplorerPageNames[DefaultCodeExplorerPage]);
 
662
 
610
663
  for c:=FirstCodeExplorerCategory to high(TCodeExplorerCategory) do
611
664
    XMLConfig.SetDeleteValue(Path+'Categories/'+CodeExplorerCategoryNames[c],
612
665
      c in FCategories,c in DefaultCodeExplorerCategories);
660
713
      end;
661
714
    end;
662
715
  end;
663
 
 
664
716
end;
665
717
 
666
718
procedure TCodeExplorerOptions.IncreaseChangeStep;