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

« back to all changes in this revision

Viewing changes to ide/cleandirdlg.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:
31
31
 
32
32
uses
33
33
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Buttons,
34
 
  StdCtrls, FileUtil, LCLProc, Laz_XMLCfg, SynRegExpr, IDEContextHelpEdit,
35
 
  LazarusIDEStrConsts, LazConf, IDEProcs, TransferMacros, InputHistory,
36
 
  ButtonPanel, ShowDeletingFilesDlg;
 
34
  StdCtrls, FileUtil, Laz2_XMLCfg, LCLProc, SynRegExpr, ButtonPanel,
 
35
  IDEWindowIntf, IDEHelpIntf, LazarusIDEStrConsts, LazConf, IDEProcs,
 
36
  TransferMacros, InputHistory, ShowDeletingFilesDlg;
37
37
 
38
38
type
39
39
 
52
52
    DirCombobox: TCOMBOBOX;
53
53
    DirGroupbox: TGROUPBOX;
54
54
    RemoveGroupbox: TGROUPBOX;
 
55
    procedure CleanDirectoryDialogCreate(Sender: TObject);
 
56
    procedure FormDestroy(Sender: TObject);
55
57
    procedure HelpButtonClick(Sender: TObject);
56
 
    procedure CleanDirectoryDialogCreate(Sender: TObject);
57
58
    procedure DirBrowseButtonClick(Sender: TObject);
58
59
    procedure OkButtonClick(Sender: TObject);
59
60
  private
65
66
    function GetConfigFilename: string;
66
67
    function SearchFilesToDelete(var List: TStrings): boolean;
67
68
    function DeleteFiles(List: TStrings): boolean;
68
 
    procedure AddDirectory(const Directory: string);
69
69
    property Macros: TTransferMacroList read FMacros write SetMacros;
70
70
  end;
71
71
  
88
88
  CleanDirectoryDialog:=TCleanDirectoryDialog.Create(nil);
89
89
  CleanDirectoryDialog.Macros:=Macros;
90
90
  CleanDirectoryDialog.LoadSettings;
91
 
  CleanDirectoryDialog.AddDirectory(DefaultDirectory);
 
91
  AddToRecentList(DefaultDirectory,CleanDirectoryDialog.DirCombobox.Items,20,rltFile);
 
92
  CleanDirectoryDialog.DirComboBox.ItemIndex:=0;
92
93
  Result:=CleanDirectoryDialog.ShowModal;
93
94
  CleanDirectoryDialog.Free;
94
95
end;
99
100
var
100
101
  List: TStrings;
101
102
begin
 
103
  ModalResult:=mrNone;
102
104
  SaveSettings;
103
105
  if not SearchFilesToDelete(List) then exit;
104
106
  try
126
128
  SimpleSyntaxKeepCheckbox.Caption:=lisClDirSimpleSyntaxEGInsteadOf;
127
129
  KeepTextFilesCheckbox.Caption:=lisClDirKeepAllTextFiles;
128
130
 
129
 
  ButtonPanel.OKButton.Caption:=lisOk;
 
131
  ButtonPanel.OKButton.Caption:=lisClDirClean;
130
132
  ButtonPanel.HelpButton.Caption:=lisMenuHelp;
131
 
  ButtonPanel.CancelButton.Caption:=dlgCancel;
 
133
  ButtonPanel.CancelButton.Caption:=lisCancel;
132
134
 
133
135
  ButtonPanel.OKButton.OnClick := @OKButtonClick;
134
136
  ButtonPanel.HelpButton.OnClick := @HelpButtonClick;
 
137
 
 
138
  IDEDialogLayoutList.ApplyLayout(Self);
 
139
end;
 
140
 
 
141
procedure TCleanDirectoryDialog.FormDestroy(Sender: TObject);
 
142
begin
 
143
  IDEDialogLayoutList.SaveLayout(Self);
135
144
end;
136
145
 
137
146
procedure TCleanDirectoryDialog.HelpButtonClick(Sender: TObject);
138
147
begin
139
 
  ShowContextHelpForIDE(Self);
 
148
  LazarusHelp.ShowHelpForIDEControl(Self);
140
149
end;
141
150
 
142
151
procedure TCleanDirectoryDialog.DirBrowseButtonClick(Sender: TObject);
153
162
var
154
163
  XMLConfig: TXMLConfig;
155
164
 
156
 
  procedure LoadComboList(AComboBox: TComboBox; const Path: string);
 
165
  procedure LoadComboList(AComboBox: TComboBox; const Path: string;
 
166
    ListType: TRecentListType);
157
167
  var
158
168
    List: TStringList;
159
169
  begin
160
170
    List:=TStringList.Create;
161
 
    LoadRecentList(XMLConfig,List,Path+'Directories');
 
171
    LoadRecentList(XMLConfig,List,Path,ListType);
162
172
    AComboBox.Items.Assign(List);
 
173
    if AComboBox.Items.Count > 0 then
 
174
      AComboBox.ItemIndex := 0;
163
175
    List.Free;
164
176
  end;
165
177
  
188
200
      
189
201
      SubDirsCheckbox.Checked:=XMLConfig.GetValue(
190
202
                                             Path+'SubDirectories/Value',false);
191
 
      LoadComboList(DirCombobox,Path+'Directories');
192
 
      LoadComboList(RemoveCombobox,Path+'RemoveFilters');
 
203
      LoadComboList(DirCombobox,Path+'Directories',rltFile);
 
204
      LoadComboList(RemoveCombobox,Path+'RemoveFilters',rltFile);
193
205
      SimpleSyntaxRemoveCheckbox.Checked:=XMLConfig.GetValue(
194
206
                                         Path+'RemoveFilter/SimpleSyntax',true);
195
 
      LoadComboList(KeepCombobox,Path+'KeepFilters');
 
207
      LoadComboList(KeepCombobox,Path+'KeepFilters',rltFile);
196
208
      SimpleSyntaxKeepCheckbox.Checked:=XMLConfig.GetValue(
197
209
                                           Path+'KeepFilter/SimpleSyntax',true);
198
210
      KeepTextFilesCheckbox.Checked:=XMLConfig.GetValue(
222
234
  Filename: String;
223
235
  Path: String;
224
236
begin
225
 
  AddToRecentList(DirCombobox.Text, DirCombobox.Items, 20);
226
 
  AddToRecentList(RemoveCombobox.Text, RemoveCombobox.Items, 20);
227
 
  AddToRecentList(KeepCombobox.Text, KeepCombobox.Items, 20);
 
237
  AddComboTextToRecentList(DirCombobox, 20,rltFile);
 
238
  AddComboTextToRecentList(RemoveCombobox, 20,rltFile);
 
239
  AddComboTextToRecentList(KeepCombobox, 20,rltFile);
228
240
  try
229
241
    InvalidateFileStateCache;
230
242
    Filename:=GetConfigFilename;
322
334
    const FilterAsText: string): boolean;
323
335
  var
324
336
    Expr: String;
 
337
    s: String;
325
338
  begin
326
339
    Result:=false;
327
340
    if FilterAsText='' then begin
336
349
      Expr:=FilterAsText;
337
350
    try
338
351
      Filter.Expression:=Expr;
 
352
      // do a simple test
 
353
      Filter.Exec('test.file');
339
354
      Result:=true;
340
355
    except
341
356
      on E: Exception do begin
342
 
        MessageDlg('Invalid Mask',
343
 
          'The mask "'+FilterAsText+'" is not a valid expression.',
344
 
          mtError,[mbCancel],0);
 
357
        if SimpleSyntax then
 
358
          s:=Format(lisTheFileMaskIsInvalid, [FilterAsText])
 
359
        else
 
360
          s:=Format(lisTheFileMaskIsNotAValidRegularExpression, [FilterAsText]);
 
361
        MessageDlg(lisInvalidMask, s, mtError, [mbCancel], 0);
345
362
      end;
346
363
    end;
347
364
  end;
361
378
    Directory:=AppendPathDelim(Directory);
362
379
 
363
380
    // setup filters
364
 
    SetupFilter(RemoveFilterRegExpr,SimpleSyntaxRemoveCheckbox.Checked,
365
 
      RemoveCombobox.Text);
366
 
    SetupFilter(KeepFilterRegExpr,SimpleSyntaxKeepCheckbox.Checked,
367
 
      KeepCombobox.Text);
 
381
    if not SetupFilter(RemoveFilterRegExpr,SimpleSyntaxRemoveCheckbox.Checked,
 
382
      RemoveCombobox.Text) then exit;
 
383
    if not SetupFilter(KeepFilterRegExpr,SimpleSyntaxKeepCheckbox.Checked,
 
384
      KeepCombobox.Text) then exit;
368
385
 
369
386
    // search files
370
387
    List:=TStringList.Create;
432
449
  Result:=true;
433
450
end;
434
451
 
435
 
procedure TCleanDirectoryDialog.AddDirectory(const Directory: string);
436
 
begin
437
 
  AddToRecentList(Directory,DirCombobox.Items,20);
438
 
end;
439
 
 
440
452
end.
441
453