Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions Source/PythonTools.IOTAUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ TIOTAUtils = class
class function ModuleIsPas(const AModule: IOTAModule): boolean;
class function ModuleIsCpp(const AModule: IOTAModule): boolean;
class function ModuleIsForm(const AModule: IOTAModule): boolean;
class function ModuleIsExportable(const AModule: IOTAModule): boolean;

class procedure EnumComps(const AFormEditor: IOTAFormEditor; const ACallback: TProc<TComponent>);
class function GetFormCaption(const AComponent: TComponent): string;
Expand Down Expand Up @@ -103,7 +104,7 @@ class procedure TIOTAUtils.EnumForms(const AProc: TProc<TIOTAFormInfo>);
LModule := LModuleServices.Modules[I];
LEditor := GetFormEditorFromModule(LModule);

if not ((ModuleIsPas(LModule) or ModuleIsCpp(LModule)) and ModuleIsForm(LModule)) then
if not ModuleIsExportable(LModule) then
Continue;

LDesigner := (LEditor as INTAFormEditor).FormDesigner;
Expand Down Expand Up @@ -306,20 +307,12 @@ class function TIOTAUtils.HasForms: boolean;
LModuleServices := (BorlandIDEServices as IOTAModuleServices);
for I := 0 to LModuleServices.ModuleCount - 1 do begin
LModule := LModuleServices.Modules[I];
if (ModuleIsPas(LModule) or ModuleIsCpp(LModule)) and ModuleIsForm(LModule) then
if ModuleIsExportable(LModule) then
Exit(true);
end;
Result := false;
end;

class function TIOTAUtils.ModuleIsCpp(const AModule: IOTAModule): boolean;
begin
if SameText(ExtractFileExt(AModule.FileName), '.cpp') then
Result := true
else
Result := false;
end;

class function TIOTAUtils.ModuleIsForm(const AModule: IOTAModule): boolean;
var
LEditor: IOTAFormEditor;
Expand Down Expand Up @@ -347,10 +340,19 @@ class function TIOTAUtils.ModuleIsForm(const AModule: IOTAModule): boolean;

class function TIOTAUtils.ModuleIsPas(const AModule: IOTAModule): boolean;
begin
if SameText(ExtractFileExt(AModule.FileName), '.pas') then
Result := true
else
Result := false;
Result := SameText(ExtractFileExt(AModule.FileName), '.pas');
end;

class function TIOTAUtils.ModuleIsCpp(const AModule: IOTAModule): boolean;
begin
Result := SameText(ExtractFileExt(AModule.FileName), '.cpp');
end;

class function TIOTAUtils.ModuleIsExportable(
const AModule: IOTAModule): boolean;
begin
Result := (ModuleIsPas(AModule) or ModuleIsCpp(AModule))
and ModuleIsForm(AModule);
end;

class procedure TIOTAUtils.EnumComps(const AFormEditor: IOTAFormEditor;
Expand Down