Fixed: View Form dialog shows the Form name instead of the Unit name
This commit is contained in:
parent
8c671457d7
commit
9b28c55963
@ -128,7 +128,11 @@ begin
|
||||
FTypeFilteredList := TUnSwUnitList.Create();
|
||||
FInputFilteredList := TUnSwUnitList.Create();
|
||||
FTypeFilter := TUnSwUnitTypeFilter.Create(FTypeFilteredList);
|
||||
FInputFilter := TUnSwUnitSimpleFilter.Create(FInputFilteredList);
|
||||
|
||||
if FFormsOnly then
|
||||
FInputFilter := TUnSwUnitSimpleFormNameFilter.Create(FInputFilteredList)
|
||||
else
|
||||
FInputFilter := TUnSwUnitSimpleNameFilter.Create(FInputFilteredList);
|
||||
try
|
||||
if not FFormsOnly then
|
||||
begin
|
||||
@ -185,7 +189,7 @@ procedure TfrmUnSwDialog.UpdateTypeFilter();
|
||||
begin
|
||||
FTypeFilter.IncludeUnits := not FFormsOnly;
|
||||
FTypeFilter.IncludeForms := (FFormsOnly or chkForms.Checked);
|
||||
FTypeFilter.IncludeDataModules := ((not FFormsOnly) and chkDataModules.Checked);
|
||||
FTypeFilter.IncludeDataModules := (FFormsOnly or chkDataModules.Checked);
|
||||
FTypeFilter.IncludeProjectSource := ((not FFormsOnly) and chkProjectSource.Checked);
|
||||
|
||||
FTypeFilteredList.Clone(FUnitList);
|
||||
@ -256,6 +260,10 @@ begin
|
||||
with TListBox(Control) do
|
||||
begin
|
||||
pUnit := FInputFilteredList[Index];
|
||||
if FFormsOnly and (pUnit is TUnSwModuleUnit) then
|
||||
sText := TUnSwModuleUnit(pUnit).FormName
|
||||
else
|
||||
sText := pUnit.Name;
|
||||
|
||||
if odSelected in State then
|
||||
begin
|
||||
@ -275,7 +283,6 @@ begin
|
||||
ilsTypes.Draw(Canvas, rText.Left, rText.Top, FIconVisitor.ImageIndex);
|
||||
|
||||
Inc(rText.Left, ilsTypes.Width + 4);
|
||||
sText := pUnit.Name;
|
||||
DrawText(Canvas.Handle, PChar(sText), Length(sText), rText, DT_SINGLELINE or
|
||||
DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS);
|
||||
end;
|
||||
|
@ -5,7 +5,7 @@ uses
|
||||
UnSwObjects;
|
||||
|
||||
type
|
||||
TUnSwUnitFilter = class(TUnSwNoRefIntfObject, IUnSwVisitor)
|
||||
TUnSwUnitFilter = class(TUnSwNoRefIntfObject, IUnSwVisitor)
|
||||
private
|
||||
FList: TUnSwUnitList;
|
||||
protected
|
||||
@ -20,18 +20,26 @@ type
|
||||
constructor Create(const AList: TUnSwUnitList); virtual;
|
||||
end;
|
||||
|
||||
TUnSwUnitSimpleFilter = class(TUnSwUnitFilter)
|
||||
TUnSwUnitSimpleFilter = class(TUnSwUnitFilter)
|
||||
private
|
||||
FFilter: String;
|
||||
|
||||
procedure SetFilter(const Value: String);
|
||||
protected
|
||||
procedure VisitUnit(const AUnit: TUnSwUnit); override;
|
||||
public
|
||||
property Filter: String read FFilter write SetFilter;
|
||||
end;
|
||||
|
||||
TUnSwUnitTypeFilter = class(TUnSwUnitFilter)
|
||||
TUnSwUnitSimpleNameFilter = class(TUnSwUnitSimpleFilter)
|
||||
protected
|
||||
procedure VisitUnit(const AUnit: TUnSwUnit); override;
|
||||
end;
|
||||
|
||||
TUnSwUnitSimpleFormNameFilter = class(TUnSwUnitSimpleNameFilter)
|
||||
protected
|
||||
procedure VisitModule(const AUnit: TUnSwModuleUnit); override;
|
||||
end;
|
||||
|
||||
TUnSwUnitTypeFilter = class(TUnSwUnitFilter)
|
||||
private
|
||||
FIncludeDataModules: Boolean;
|
||||
FIncludeForms: Boolean;
|
||||
@ -84,19 +92,30 @@ end;
|
||||
|
||||
|
||||
{ TUnSwUnitSimpleFilter }
|
||||
procedure TUnSwUnitSimpleFilter.VisitUnit(const AUnit: TUnSwUnit);
|
||||
begin
|
||||
if (Length(FFilter) > 0) and
|
||||
(AnsiPos(FFilter, LowerCase(AUnit.Name)) = 0) then
|
||||
FilterUnit(AUnit);
|
||||
end;
|
||||
|
||||
procedure TUnSwUnitSimpleFilter.SetFilter(const Value: String);
|
||||
begin
|
||||
FFilter := LowerCase(Value);
|
||||
end;
|
||||
|
||||
|
||||
{ TUnSwUnitSimpleNameFilter }
|
||||
procedure TUnSwUnitSimpleNameFilter.VisitUnit(const AUnit: TUnSwUnit);
|
||||
begin
|
||||
if (Length(Filter) > 0) and
|
||||
(AnsiPos(Filter, LowerCase(AUnit.Name)) = 0) then
|
||||
FilterUnit(AUnit);
|
||||
end;
|
||||
|
||||
|
||||
{ TUnSwUnitSimpleFormNameFilter }
|
||||
procedure TUnSwUnitSimpleFormNameFilter.VisitModule(const AUnit: TUnSwModuleUnit);
|
||||
begin
|
||||
if (Length(Filter) > 0) and
|
||||
(AnsiPos(Filter, LowerCase(AUnit.FormName)) = 0) then
|
||||
FilterUnit(AUnit);
|
||||
end;
|
||||
|
||||
|
||||
{ TUnSwUnitTypeFilter }
|
||||
constructor TUnSwUnitTypeFilter.Create(const AList: TUnSwUnitList);
|
||||
begin
|
||||
|
@ -73,8 +73,9 @@ type
|
||||
private
|
||||
FModule: IOTAModuleInfo;
|
||||
protected
|
||||
function GetName(): String; override;
|
||||
function GetFileName(): String; override;
|
||||
function GetFormName(): String;
|
||||
function GetName(): String; override;
|
||||
function GetUnitType(): TUnSwUnitType;
|
||||
public
|
||||
constructor Create(const AModule: IOTAModuleInfo);
|
||||
@ -82,6 +83,7 @@ type
|
||||
|
||||
procedure Activate(const ASource: Boolean); override;
|
||||
|
||||
property FormName: String read GetFormName;
|
||||
property UnitType: TUnSwUnitType read GetUnitType;
|
||||
end;
|
||||
|
||||
@ -194,6 +196,11 @@ begin
|
||||
Result := FModule.Name;
|
||||
end;
|
||||
|
||||
function TUnSwModuleUnit.GetFormName(): String;
|
||||
begin
|
||||
Result := FModule.FormName;
|
||||
end;
|
||||
|
||||
function TUnSwModuleUnit.GetFileName(): String;
|
||||
begin
|
||||
Result := FModule.FileName;
|
||||
|
Loading…
Reference in New Issue
Block a user