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();
|
FTypeFilteredList := TUnSwUnitList.Create();
|
||||||
FInputFilteredList := TUnSwUnitList.Create();
|
FInputFilteredList := TUnSwUnitList.Create();
|
||||||
FTypeFilter := TUnSwUnitTypeFilter.Create(FTypeFilteredList);
|
FTypeFilter := TUnSwUnitTypeFilter.Create(FTypeFilteredList);
|
||||||
FInputFilter := TUnSwUnitSimpleFilter.Create(FInputFilteredList);
|
|
||||||
|
if FFormsOnly then
|
||||||
|
FInputFilter := TUnSwUnitSimpleFormNameFilter.Create(FInputFilteredList)
|
||||||
|
else
|
||||||
|
FInputFilter := TUnSwUnitSimpleNameFilter.Create(FInputFilteredList);
|
||||||
try
|
try
|
||||||
if not FFormsOnly then
|
if not FFormsOnly then
|
||||||
begin
|
begin
|
||||||
@ -185,7 +189,7 @@ procedure TfrmUnSwDialog.UpdateTypeFilter();
|
|||||||
begin
|
begin
|
||||||
FTypeFilter.IncludeUnits := not FFormsOnly;
|
FTypeFilter.IncludeUnits := not FFormsOnly;
|
||||||
FTypeFilter.IncludeForms := (FFormsOnly or chkForms.Checked);
|
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);
|
FTypeFilter.IncludeProjectSource := ((not FFormsOnly) and chkProjectSource.Checked);
|
||||||
|
|
||||||
FTypeFilteredList.Clone(FUnitList);
|
FTypeFilteredList.Clone(FUnitList);
|
||||||
@ -256,6 +260,10 @@ begin
|
|||||||
with TListBox(Control) do
|
with TListBox(Control) do
|
||||||
begin
|
begin
|
||||||
pUnit := FInputFilteredList[Index];
|
pUnit := FInputFilteredList[Index];
|
||||||
|
if FFormsOnly and (pUnit is TUnSwModuleUnit) then
|
||||||
|
sText := TUnSwModuleUnit(pUnit).FormName
|
||||||
|
else
|
||||||
|
sText := pUnit.Name;
|
||||||
|
|
||||||
if odSelected in State then
|
if odSelected in State then
|
||||||
begin
|
begin
|
||||||
@ -275,7 +283,6 @@ begin
|
|||||||
ilsTypes.Draw(Canvas, rText.Left, rText.Top, FIconVisitor.ImageIndex);
|
ilsTypes.Draw(Canvas, rText.Left, rText.Top, FIconVisitor.ImageIndex);
|
||||||
|
|
||||||
Inc(rText.Left, ilsTypes.Width + 4);
|
Inc(rText.Left, ilsTypes.Width + 4);
|
||||||
sText := pUnit.Name;
|
|
||||||
DrawText(Canvas.Handle, PChar(sText), Length(sText), rText, DT_SINGLELINE or
|
DrawText(Canvas.Handle, PChar(sText), Length(sText), rText, DT_SINGLELINE or
|
||||||
DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS);
|
DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS);
|
||||||
end;
|
end;
|
||||||
|
@ -25,12 +25,20 @@ type
|
|||||||
FFilter: String;
|
FFilter: String;
|
||||||
|
|
||||||
procedure SetFilter(const Value: String);
|
procedure SetFilter(const Value: String);
|
||||||
protected
|
|
||||||
procedure VisitUnit(const AUnit: TUnSwUnit); override;
|
|
||||||
public
|
public
|
||||||
property Filter: String read FFilter write SetFilter;
|
property Filter: String read FFilter write SetFilter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
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)
|
TUnSwUnitTypeFilter = class(TUnSwUnitFilter)
|
||||||
private
|
private
|
||||||
FIncludeDataModules: Boolean;
|
FIncludeDataModules: Boolean;
|
||||||
@ -84,19 +92,30 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{ TUnSwUnitSimpleFilter }
|
{ 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);
|
procedure TUnSwUnitSimpleFilter.SetFilter(const Value: String);
|
||||||
begin
|
begin
|
||||||
FFilter := LowerCase(Value);
|
FFilter := LowerCase(Value);
|
||||||
end;
|
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 }
|
{ TUnSwUnitTypeFilter }
|
||||||
constructor TUnSwUnitTypeFilter.Create(const AList: TUnSwUnitList);
|
constructor TUnSwUnitTypeFilter.Create(const AList: TUnSwUnitList);
|
||||||
begin
|
begin
|
||||||
|
@ -73,8 +73,9 @@ type
|
|||||||
private
|
private
|
||||||
FModule: IOTAModuleInfo;
|
FModule: IOTAModuleInfo;
|
||||||
protected
|
protected
|
||||||
function GetName(): String; override;
|
|
||||||
function GetFileName(): String; override;
|
function GetFileName(): String; override;
|
||||||
|
function GetFormName(): String;
|
||||||
|
function GetName(): String; override;
|
||||||
function GetUnitType(): TUnSwUnitType;
|
function GetUnitType(): TUnSwUnitType;
|
||||||
public
|
public
|
||||||
constructor Create(const AModule: IOTAModuleInfo);
|
constructor Create(const AModule: IOTAModuleInfo);
|
||||||
@ -82,6 +83,7 @@ type
|
|||||||
|
|
||||||
procedure Activate(const ASource: Boolean); override;
|
procedure Activate(const ASource: Boolean); override;
|
||||||
|
|
||||||
|
property FormName: String read GetFormName;
|
||||||
property UnitType: TUnSwUnitType read GetUnitType;
|
property UnitType: TUnSwUnitType read GetUnitType;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -194,6 +196,11 @@ begin
|
|||||||
Result := FModule.Name;
|
Result := FModule.Name;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TUnSwModuleUnit.GetFormName(): String;
|
||||||
|
begin
|
||||||
|
Result := FModule.FormName;
|
||||||
|
end;
|
||||||
|
|
||||||
function TUnSwModuleUnit.GetFileName(): String;
|
function TUnSwModuleUnit.GetFileName(): String;
|
||||||
begin
|
begin
|
||||||
Result := FModule.FileName;
|
Result := FModule.FileName;
|
||||||
|
Loading…
Reference in New Issue
Block a user