mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-02 07:32:37 +02:00
This commit is contained in:
parent
c0aab03941
commit
e9b2eb209a
@ -2825,6 +2825,7 @@ resourcestring
|
||||
lisPLDOnlinePackagesCannotBeDeleted = 'Online packages cannot be deleted';
|
||||
lisPESortFilesAlphabetically = 'Sort files alphabetically';
|
||||
lisPEShowDirectoryHierarchy = 'Show directory hierarchy';
|
||||
lisClearFilter = 'Clear filter';
|
||||
dlgCaseSensitive = '&Case sensitive';
|
||||
lisDistinguishBigAndSmallLettersEGAAndA = 'Distinguish big and small letters e.g. A and a';
|
||||
dlgWholeWordsOnly = '&Whole words only';
|
||||
|
@ -3352,6 +3352,7 @@ var
|
||||
LFMClassName: String;
|
||||
anUnitName: String;
|
||||
LFMCode: TCodeBuffer;
|
||||
AlreadyOpen: Boolean;
|
||||
begin
|
||||
if Project1=nil then exit(mrCancel);
|
||||
MainIDE.GetCurrentUnit(ActiveSourceEditor, ActiveUnitInfo);
|
||||
@ -3360,6 +3361,7 @@ begin
|
||||
CurUnitInfo:=Project1.Units[i];
|
||||
if not CurUnitInfo.IsPartOfProject then
|
||||
Continue;
|
||||
AlreadyOpen := CurUnitInfo.OpenEditorInfoCount > 0;
|
||||
if ItemType in [piComponent, piFrame] then
|
||||
begin
|
||||
// add all form names of project
|
||||
@ -3368,7 +3370,7 @@ begin
|
||||
if (ItemType = piComponent) or
|
||||
((ItemType = piFrame) and (CurUnitInfo.ResourceBaseClass = pfcbcFrame)) then
|
||||
ItemList.Add(CurUnitInfo.ComponentName,
|
||||
CurUnitInfo.Filename, i, CurUnitInfo = ActiveUnitInfo);
|
||||
CurUnitInfo.Filename, i, CurUnitInfo = ActiveUnitInfo, AlreadyOpen);
|
||||
end else if FilenameIsAbsolute(CurUnitInfo.Filename)
|
||||
and FilenameIsPascalSource(CurUnitInfo.Filename)
|
||||
and FileExistsCached(CurUnitInfo.Filename) then
|
||||
@ -3385,7 +3387,7 @@ begin
|
||||
if anUnitName='' then
|
||||
anUnitName:=ExtractFileNameOnly(LFMFilename);
|
||||
ItemList.Add(LFMComponentName, CurUnitInfo.Filename,
|
||||
i, CurUnitInfo = ActiveUnitInfo);
|
||||
i, CurUnitInfo = ActiveUnitInfo, AlreadyOpen);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -3397,7 +3399,7 @@ begin
|
||||
AUnitName := ExtractFileName(CurUnitInfo.Filename);
|
||||
if ItemList.Find(AUnitName) = nil then
|
||||
ItemList.Add(AUnitName, CurUnitInfo.Filename,
|
||||
i, CurUnitInfo = ActiveUnitInfo);
|
||||
i, CurUnitInfo = ActiveUnitInfo, AlreadyOpen);
|
||||
end
|
||||
else
|
||||
if Project1.MainUnitID = i then
|
||||
@ -3409,7 +3411,7 @@ begin
|
||||
if (AUnitName <> '') and (ItemList.Find(AUnitName) = nil) then
|
||||
begin
|
||||
ItemList.Add(AUnitName, MainUnitInfo.Filename,
|
||||
i, MainUnitInfo = ActiveUnitInfo);
|
||||
i, MainUnitInfo = ActiveUnitInfo, MainUnitInfo.OpenEditorInfoCount > 0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -3556,7 +3558,7 @@ begin
|
||||
for S2SItem in UnitToFilename do begin
|
||||
AnUnitName:=S2SItem^.Name;
|
||||
AFilename:=S2SItem^.Value;
|
||||
UnitList.Add(AnUnitName,AFilename,i,false);
|
||||
UnitList.Add(AnUnitName,AFilename,i,false,false);
|
||||
inc(i);
|
||||
end;
|
||||
// show dialog
|
||||
@ -3595,7 +3597,7 @@ Begin
|
||||
if (AnUnitInfo.IsPartOfProject) and (i<>Project1.MainUnitID) then
|
||||
begin
|
||||
AName := Project1.RemoveProjectPathFromFilename(AnUnitInfo.FileName);
|
||||
ViewUnitEntries.Add(AName,AnUnitInfo.FileName,i,false);
|
||||
ViewUnitEntries.Add(AName,AnUnitInfo.FileName,i,false,false);
|
||||
end;
|
||||
end;
|
||||
if ShowViewUnitsDlg(ViewUnitEntries,true,lisRemoveFromProject,piUnit) <> mrOk then
|
||||
|
@ -1,7 +1,7 @@
|
||||
object ViewUnitDialog: TViewUnitDialog
|
||||
Left = 330
|
||||
Left = 308
|
||||
Height = 386
|
||||
Top = 280
|
||||
Top = 275
|
||||
Width = 378
|
||||
HorzScrollBar.Page = 377
|
||||
HorzScrollBar.Range = 112
|
||||
@ -16,11 +16,11 @@ object ViewUnitDialog: TViewUnitDialog
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.7'
|
||||
LCLVersion = '2.3.0.0'
|
||||
object Listbox: TListBox
|
||||
Left = 6
|
||||
Height = 272
|
||||
Top = 41
|
||||
Height = 279
|
||||
Top = 35
|
||||
Width = 366
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
@ -36,8 +36,8 @@ object ViewUnitDialog: TViewUnitDialog
|
||||
end
|
||||
object ButtonPanel: TButtonPanel
|
||||
Left = 6
|
||||
Height = 35
|
||||
Top = 345
|
||||
Height = 34
|
||||
Top = 346
|
||||
Width = 366
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
@ -56,19 +56,19 @@ object ViewUnitDialog: TViewUnitDialog
|
||||
end
|
||||
object BtnPanel: TPanel
|
||||
Left = 6
|
||||
Height = 29
|
||||
Height = 23
|
||||
Top = 6
|
||||
Width = 366
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 29
|
||||
ClientHeight = 23
|
||||
ClientWidth = 366
|
||||
TabOrder = 0
|
||||
object SortAlphabeticallySpeedButton: TSpeedButton
|
||||
Left = 0
|
||||
Height = 29
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 25
|
||||
Align = alLeft
|
||||
@ -82,13 +82,14 @@ object ViewUnitDialog: TViewUnitDialog
|
||||
end
|
||||
object FilterEdit: TListFilterEdit
|
||||
Left = 31
|
||||
Height = 29
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 335
|
||||
ButtonHint = 'Clear Filter'
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
Align = alClient
|
||||
BorderSpacing.Left = 6
|
||||
NumGlyphs = 1
|
||||
MaxLength = 0
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
@ -98,7 +99,7 @@ object ViewUnitDialog: TViewUnitDialog
|
||||
object ProgressBar1: TProgressBar
|
||||
Left = 6
|
||||
Height = 20
|
||||
Top = 319
|
||||
Top = 320
|
||||
Width = 366
|
||||
Align = alBottom
|
||||
BorderSpacing.Left = 6
|
||||
@ -107,8 +108,8 @@ object ViewUnitDialog: TViewUnitDialog
|
||||
Visible = False
|
||||
end
|
||||
object popListBox: TPopupMenu
|
||||
left = 144
|
||||
top = 112
|
||||
Left = 144
|
||||
Top = 112
|
||||
object mniMultiSelect: TMenuItem
|
||||
AutoCheck = True
|
||||
Caption = 'Multi Select'
|
||||
|
@ -70,8 +70,9 @@ type
|
||||
Name: string;
|
||||
ID: integer;
|
||||
Selected: boolean;
|
||||
Open: boolean;
|
||||
Filename: string;
|
||||
constructor Create(const AName, AFilename: string; AnID: integer; ASelected: boolean);
|
||||
constructor Create(const AName, AFilename: string; AnID: integer; ASelected, AOpen: boolean);
|
||||
end;
|
||||
|
||||
{ TViewUnitsEntryEnumerator }
|
||||
@ -96,7 +97,7 @@ type
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
function Add(AName, AFilename: string; AnID: integer; ASelected: boolean): TViewUnitsEntry;
|
||||
function Add(AName, AFilename: string; AnID: integer; ASelected, AOpen: boolean): TViewUnitsEntry;
|
||||
function Find(const aName: string): TViewUnitsEntry; inline;
|
||||
function Count: integer; inline;
|
||||
function GetFiles: TStringList;
|
||||
@ -277,7 +278,7 @@ begin
|
||||
end;
|
||||
|
||||
function TViewUnitEntries.Add(AName, AFilename: string; AnID: integer;
|
||||
ASelected: boolean): TViewUnitsEntry;
|
||||
ASelected, AOpen: boolean): TViewUnitsEntry;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -287,19 +288,20 @@ begin
|
||||
inc(i);
|
||||
AName:=AName+'('+IntToStr(i)+')';
|
||||
end;
|
||||
Result:=TViewUnitsEntry.Create(AName,AFilename,AnID,ASelected);
|
||||
Result:=TViewUnitsEntry.Create(AName,AFilename,AnID,ASelected,AOpen);
|
||||
fItems[AName]:=Result;
|
||||
end;
|
||||
|
||||
{ TViewUnitsEntry }
|
||||
|
||||
constructor TViewUnitsEntry.Create(const AName, AFilename: string;
|
||||
AnID: integer; ASelected: boolean);
|
||||
AnID: integer; ASelected, AOpen: boolean);
|
||||
begin
|
||||
inherited Create;
|
||||
Name := AName;
|
||||
ID := AnID;
|
||||
Selected := ASelected;
|
||||
Open := AOpen;
|
||||
Filename := AFilename;
|
||||
end;
|
||||
|
||||
@ -317,6 +319,7 @@ begin
|
||||
ButtonPanel.HelpButton.Caption:=lisMenuHelp;
|
||||
ButtonPanel.CancelButton.Caption:=lisCancel;
|
||||
SortAlphabeticallySpeedButton.Hint:=lisPESortFilesAlphabetically;
|
||||
FilterEdit.ButtonHint:=lisClearFilter;
|
||||
IDEImages.AssignImage(SortAlphabeticallySpeedButton, 'pkg_sortalphabetically');
|
||||
end;
|
||||
|
||||
@ -348,6 +351,7 @@ begin
|
||||
mniMultiselect.Checked := EnableMultiSelect;
|
||||
ListBox.MultiSelect := mniMultiselect.Enabled;
|
||||
ShowEntries;
|
||||
FilterEdit.SimpleSelection := true;
|
||||
|
||||
if aStartFilename<>'' then begin
|
||||
// init search for units
|
||||
@ -382,6 +386,8 @@ begin
|
||||
IDEImages.Images_16.Draw(Canvas, 1, aTop, FImageIndex);
|
||||
aTop := (ARect.Bottom + ARect.Top - Canvas.TextHeight('Šj9')) div 2;
|
||||
Canvas.TextRect(ARect, ARect.Left + IDEImages.Images_16.Width + Scale96ToFont(4), aTop, Items[Index]);
|
||||
if Items.Objects[Index] <> nil then // already open indicator
|
||||
Canvas.TextRect(ARect, ARect.Right - Scale96ToFont(8), aTop, '•');
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -519,13 +525,18 @@ end;
|
||||
procedure TViewUnitDialog.ShowEntries;
|
||||
var
|
||||
UEntry: TViewUnitsEntry;
|
||||
flags: PtrInt;
|
||||
begin
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TViewUnitDialog.ShowEntries'){$ENDIF};
|
||||
try
|
||||
// Data items
|
||||
FilterEdit.Items.Clear;
|
||||
for UEntry in fEntries do
|
||||
FilterEdit.Items.Add(UEntry.Name);
|
||||
for UEntry in fEntries do begin
|
||||
flags := PtrInt(UEntry.Selected);
|
||||
if UEntry.Open then
|
||||
flags := flags or 2;
|
||||
FilterEdit.Items.AddObject(UEntry.Name, TObject(flags));
|
||||
end;
|
||||
FilterEdit.InvalidateFilter;
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TViewUnitDialog.ShowEntries'){$ENDIF};
|
||||
@ -538,7 +549,7 @@ var
|
||||
begin
|
||||
fEntries.Clear;
|
||||
for F2SItem in fFoundFiles do
|
||||
fEntries.Add(F2SItem^.Value,F2SItem^.Name,-1,false);
|
||||
fEntries.Add(F2SItem^.Value,F2SItem^.Name,-1,false,false);
|
||||
ShowEntries;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user