IDE: Simplify the publish module dialog more and rename it.

git-svn-id: trunk@58804 -
This commit is contained in:
juha 2018-08-30 11:16:09 +00:00
parent c01e05aaf0
commit 066994a334
9 changed files with 177 additions and 367 deletions

4
.gitattributes vendored
View File

@ -7037,8 +7037,8 @@ ide/projectuserresources.pas svneol=native#text/pascal
ide/projectwizarddlg.lfm svneol=native#text/plain
ide/projectwizarddlg.pas svneol=native#text/plain
ide/publishmodule.pas svneol=native#text/pascal
ide/publishprojectdlg.lfm svneol=native#text/plain
ide/publishprojectdlg.pas svneol=native#text/pascal
ide/publishmoduledlg.lfm svneol=native#text/plain
ide/publishmoduledlg.pas svneol=native#text/pascal
ide/qfinitlocalvardlg.lfm svneol=native#text/plain
ide/qfinitlocalvardlg.pas svneol=native#text/plain
ide/raw_window.pas svneol=native#text/plain

View File

@ -363,7 +363,7 @@ begin
P.Sources.AddSrc('projectresources.pas');
P.Sources.AddSrc('projectwizarddlg.pas');
P.Sources.AddSrc('publishmodule.pas');
P.Sources.AddSrc('publishprojectdlg.pas');
P.Sources.AddSrc('publishmoduledlg.pas');
P.Sources.AddSrc('restrictionbrowser.pas');
P.Sources.AddSrc('runparamsopts.pas');
P.Sources.AddSrc('searchfrm.pas');

View File

@ -55,10 +55,8 @@ uses
const
// these are the names of the various history lists in the IDE:
hlPublishProjectDestDirs = 'PublishProjectDestinationDirectories';
//hlPublishProjectCommandsAfter = 'PublishProjectCommmandsAfter';
hlPublishProjectIncludeFileFilter = 'PublishProjectIncludeFileFilter';
hlPublishProjectExcludeFileFilter = 'PublishProjectExcludeFileFilter';
hlPublishModuleDestDirs = 'PublishModuleDestinationDirectories';
hlPublishModuleFileFilter = 'PublishModuleFileFilter';
hlMakeResourceStringSections = 'MakeResourceStringSections';
hlMakeResourceStringPrefixes = 'MakeResourceStringPrefixes';
hlMakeResourceStringLengths = 'MakeResourceStringLengths';

View File

@ -1262,34 +1262,6 @@ resourcestring
dlgObjInsp = 'Object Inspector';
dlgEnvFiles = 'Files';
// Publish project / package
lisDestinationDirectory = 'Destination directory';
lisChooseDirectory = 'Choose directory';
lisCompress = 'Compress';
lisCompressHint = 'The resulting directory will be compressed into a ZIP file.';
lisPublishModuleNote = 'Files belonging to project / package will be included automatically.';
lisSimpleSyntax = 'Simple syntax';
lisNormallyTheFilterIsARegularExpressionInSimpleSynta = 'Normally the '
+'filter is a regular expression. In simple syntax a . is a normal '
+'character, a * stands for anything, a ? stands for any character, and '
+'comma and semicolon separates alternatives. For example: Simple '
+'syntax *.pas;*.pp corresponds to ^(.*\.pas|.*\.pp)$';
lisUseFiltersForExtraFiles = 'Use filters for extra files';
lisIncludeFilter = 'Include filter';
lisExcludeFilter = 'Exclude filter';
lisInvalidPublishingDirectory = 'Invalid publishing Directory';
lisSourceDirectoryAndDestinationDirectoryAreTheSameMa = 'Source directory "%s"'
+'%sand destination directory "%s"'
+'%sare the same. Maybe you misunderstand this feature.'
+'%sIt will clean/recreate the destination directory and copy the package/project into it.';
lisClearDirectory = 'Clear Directory?';
lisInOrderToCreateACleanCopyOfTheProjectPackageAllFil = 'In order to create '
+'a clean copy of the project/package, all files in the following '
+'directory will be deleted and all its content will be lost.'
+'%sDelete all files in "%s"?';
lisUnableToCleanUpDestinationDirectory = 'Unable to clean up destination directory';
lisUnableToCleanUpPleaseCheckPermissions = 'Unable to clean up "%s".%sPlease check permissions.';
//
dlgEnvBckup = 'Backup';
dlgNaming = 'Naming';
@ -2773,12 +2745,6 @@ resourcestring
lisShowPackages = 'Show packages';
lisShowUnits = 'Show units';
lisShowIdentifiers = 'Show identifiers';
lisFilter = 'Filter';
lisCreateFilter = 'Create Filter';
lisIssues = 'Issues';
lisRegularExpression = 'Regular expression';
lisInvalidFilter = 'Invalid filter';
lisInvalidExpression = 'Invalid expression:%s%s%s%s';
lisPrivate = 'Private';
lisProtected = 'Protected';
lisEMDPublic = 'Public';
@ -3898,9 +3864,39 @@ resourcestring
lisSortSelIgnoreSpace = 'Ignore Space';
lisSortSelSort = 'Accept';
// publish project dialog
lisPublProjInvalidIncludeFilter = 'Invalid include filter';
lisPublProjInvalidExcludeFilter = 'Invalid exclude filter';
// Publish project/package + Add dir to package
lisDestinationDirectory = 'Destination directory';
lisChooseDirectory = 'Choose directory';
lisCompress = 'Compress';
lisCompressHint = 'The resulting directory will be compressed into a ZIP file.';
lisPublishModuleNote = 'Files belonging to project / package will be included automatically.';
lisSimpleSyntax = 'Simple syntax';
lisNormallyTheFilterIsARegularExpressionInSimpleSynta = 'Normally the '
+'filter is a regular expression. In simple syntax a . is a normal '
+'character, a * stands for anything, a ? stands for any character, and '
+'comma and semicolon separates alternatives. For example: Simple '
+'syntax *.pas;*.pp corresponds to ^(.*\.pas|.*\.pp)$';
lisUseFilterForExtraFiles = 'Use filter for extra files';
lisIncludeFilter = 'Include filter';
lisExcludeFilter = 'Exclude filter';
lisInvalidPublishingDirectory = 'Invalid publishing Directory';
lisSourceDirectoryAndDestinationDirectoryAreTheSameMa = 'Source directory "%s"'
+'%sand destination directory "%s"'
+'%sare the same. Maybe you misunderstand this feature.'
+'%sIt will clean/recreate the destination directory and copy the package/project into it.';
lisClearDirectory = 'Clear Directory?';
lisInOrderToCreateACleanCopyOfTheProjectPackageAllFil = 'In order to create '
+'a clean copy of the project/package, all files in the following '
+'directory will be deleted and all its content will be lost.'
+'%sDelete all files in "%s"?';
lisUnableToCleanUpDestinationDirectory = 'Unable to clean up destination directory';
lisUnableToCleanUpPleaseCheckPermissions = 'Unable to clean up "%s".%sPlease check permissions.';
lisFilter = 'Filter';
lisCreateFilter = 'Create Filter';
lisIssues = 'Issues';
lisRegularExpression = 'Regular expression';
lisInvalidFilter = 'Invalid filter';
lisInvalidExpression = 'Invalid expression:%s%s%s%s';
// project options
lisProjOptsUnableToChangeTheAutoCreateFormList = 'Unable to change the auto '

View File

@ -90,7 +90,7 @@ uses
ExtTools, ExtToolsIDE,
// projects
ProjectResources, Project, ProjectDefs, NewProjectDlg,
PublishProjectDlg, ProjectInspector, PackageDefs, ProjectDescriptors,
PublishModuleDlg, ProjectInspector, PackageDefs, ProjectDescriptors,
// help manager
IDEContextHelpEdit, IDEHelpIntf, IDEHelpManager, CodeHelp, HelpOptions,
// designer

View File

@ -50,28 +50,21 @@ type
private
FCompressFinally: boolean;
FDestinationDirectory: string;
FExcludeFileFilter: string;
FExcludeFilterRegExpr: TRegExpr;
FExcludeFilterSimpleSyntax: boolean;
FExcludeFilterValid: boolean;
FIncludeFileFilter: string;
FIncludeFilterRegExpr: TRegExpr;
FIncludeFilterSimpleSyntax: boolean;
FIncludeFilterValid: boolean;
FFileFilter: string;
FFilterRegExpr: TRegExpr;
FFilterSimpleSyntax: boolean;
FFilterValid: boolean;
FModified: boolean;
FModifiedLock: integer;
FOwner: TObject;
FUseFileFilters: boolean;
procedure SetCompressFinally(const AValue: boolean);
procedure SetDestinationDirectory(const AValue: string);
procedure SetExcludeFileFilter(const AValue: string);
procedure SetExcludeFilterSimpleSyntax(const AValue: boolean);
procedure SetIncludeFileFilter(const AValue: string);
procedure SetIncludeFilterSimpleSyntax(const AValue: boolean);
procedure SetFileFilter(const AValue: string);
procedure SetFilterSimpleSyntax(const AValue: boolean);
procedure SetModified(const AValue: boolean);
procedure SetUseFileFilters(const AValue: boolean);
procedure UpdateIncludeFilter;
procedure UpdateExcludeFilter;
procedure UpdateFilter;
protected
procedure DoOnModifyChange; virtual;
public
@ -93,28 +86,20 @@ type
// destination
property DestinationDirectory: string
read FDestinationDirectory write SetDestinationDirectory;
read FDestinationDirectory write SetDestinationDirectory;
property CompressFinally: boolean read FCompressFinally write SetCompressFinally;
property UseFileFilters: boolean read FUseFileFilters write SetUseFileFilters;
// Include Filter
property IncludeFilterSimpleSyntax: boolean
read FIncludeFilterSimpleSyntax write SetIncludeFilterSimpleSyntax;
property IncludeFileFilter: string
read FIncludeFileFilter write SetIncludeFileFilter;
property IncludeFilterValid: boolean read FIncludeFilterValid;
// Exclude Filter
property ExcludeFilterSimpleSyntax: boolean
read FExcludeFilterSimpleSyntax write SetExcludeFilterSimpleSyntax;
property ExcludeFileFilter: string
read FExcludeFileFilter write SetExcludeFileFilter;
property ExcludeFilterValid: boolean read FExcludeFilterValid;
// Filter
property FilterSimpleSyntax: boolean read FFilterSimpleSyntax write SetFilterSimpleSyntax;
property FileFilter: string read FFileFilter write SetFileFilter;
property FilterValid: boolean read FFilterValid;
end;
const
PublishModulOptsVersion = 2;
DefPublModIncFilter = '*.(pas|pp|inc|lpr|lfm|lrs|lpi|lpk|xml|sh)';
DefPublModExcFilter = '*.(bak|ppu|ppl|a|o|so);*~;backup';
//DefPublModExcFilter = '*.(bak|ppu|ppl|a|o|so);*~;backup';
function RealPublishDir(AOptions: TPublishModuleOptions): string;
@ -151,35 +136,19 @@ begin
Modified:=true;
end;
procedure TPublishModuleOptions.SetExcludeFileFilter(const AValue: string);
procedure TPublishModuleOptions.SetFileFilter(const AValue: string);
begin
if FExcludeFileFilter=AValue then exit;
FExcludeFileFilter:=AValue;
UpdateExcludeFilter;
if FFileFilter=AValue then exit;
FFileFilter:=AValue;
UpdateFilter;
Modified:=true;
end;
procedure TPublishModuleOptions.SetExcludeFilterSimpleSyntax(const AValue: boolean);
procedure TPublishModuleOptions.SetFilterSimpleSyntax(const AValue: boolean);
begin
if FExcludeFilterSimpleSyntax=AValue then exit;
FExcludeFilterSimpleSyntax:=AValue;
UpdateExcludeFilter;
Modified:=true;
end;
procedure TPublishModuleOptions.SetIncludeFileFilter(const AValue: string);
begin
if FIncludeFileFilter=AValue then exit;
FIncludeFileFilter:=AValue;
UpdateIncludeFilter;
Modified:=true;
end;
procedure TPublishModuleOptions.SetIncludeFilterSimpleSyntax(const AValue: boolean);
begin
if FIncludeFilterSimpleSyntax=AValue then exit;
FIncludeFilterSimpleSyntax:=AValue;
UpdateIncludeFilter;
if FFilterSimpleSyntax=AValue then exit;
FFilterSimpleSyntax:=AValue;
UpdateFilter;
Modified:=true;
end;
@ -198,44 +167,23 @@ begin
Modified:=true;
end;
procedure TPublishModuleOptions.UpdateIncludeFilter;
procedure TPublishModuleOptions.UpdateFilter;
var
Expr: string;
begin
if FIncludeFilterRegExpr=nil then
FIncludeFilterRegExpr:=TRegExpr.Create;
if IncludeFilterSimpleSyntax then
Expr:=SimpleSyntaxToRegExpr(FIncludeFileFilter)
if FFilterRegExpr=nil then
FFilterRegExpr:=TRegExpr.Create;
if FilterSimpleSyntax then
Expr:=SimpleSyntaxToRegExpr(FFileFilter)
else
Expr:=FIncludeFileFilter;
Expr:=FFileFilter;
try
FIncludeFilterRegExpr.Expression:=Expr;
FIncludeFilterValid:=true;
FFilterRegExpr.Expression:=Expr;
FFilterValid:=true;
except
on E: Exception do begin
DebugLn('Invalid Include File Expression ',Expr,' ',E.Message);
FIncludeFilterValid:=false;
end;
end;
end;
procedure TPublishModuleOptions.UpdateExcludeFilter;
var
Expr: string;
begin
if FExcludeFilterRegExpr=nil then
FExcludeFilterRegExpr:=TRegExpr.Create;
if ExcludeFilterSimpleSyntax then
Expr:=SimpleSyntaxToRegExpr(FExcludeFileFilter)
else
Expr:=FExcludeFileFilter;
try
FExcludeFilterRegExpr.Expression:=Expr;
FExcludeFilterValid:=true;
except
on E: Exception do begin
DebugLn('Invalid Exclude File Expression ',Expr,' ',E.Message);
FExcludeFilterValid:=false;
DebugLn('Invalid File Expression ',Expr,' ',E.Message);
FFilterValid:=false;
end;
end;
end;
@ -254,8 +202,7 @@ end;
destructor TPublishModuleOptions.Destroy;
begin
Clear;
FIncludeFilterRegExpr.Free;
FExcludeFilterRegExpr.Free;
FFilterRegExpr.Free;
inherited Destroy;
end;
@ -269,10 +216,8 @@ begin
DestinationDirectory:=GetDefaultDestinationDir;
CompressFinally:=true;
UseFileFilters:=true;
IncludeFilterSimpleSyntax:=true;
IncludeFileFilter:=DefPublModIncFilter;
ExcludeFilterSimpleSyntax:=true;
ExcludeFileFilter:=DefPublModExcFilter;
FilterSimpleSyntax:=true;
FileFilter:=DefPublModIncFilter;
end;
procedure TPublishModuleOptions.LoadFromXMLConfig(XMLConfig: TXMLConfig;
@ -291,14 +236,9 @@ begin
GetDefaultDestinationDir));
CompressFinally:=XMLConfig.GetValue(APath+'CompressFinally/Value',true);
UseFileFilters:=XMLConfig.GetValue(APath+'UseFileFilters/Value',false);
IncludeFilterSimpleSyntax:=XMLConfig.GetValue(APath+'IncludeFilterSimpleSyntax/Value',true);
ExcludeFilterSimpleSyntax:=XMLConfig.GetValue(APath+'ExcludeFilterSimpleSyntax/Value',true);
if XMLVersion>=2 then begin
IncludeFileFilter:=XMLConfig.GetValue(APath+'IncludeFileFilter/Value',
DefPublModIncFilter);
ExcludeFileFilter:=XMLConfig.GetValue(APath+'ExcludeFileFilter/Value',
DefPublModExcFilter);
end;
FilterSimpleSyntax:=XMLConfig.GetValue(APath+'FilterSimpleSyntax/Value',true);
if XMLVersion>=2 then
FileFilter:=XMLConfig.GetValue(APath+'FileFilter/Value',DefPublModIncFilter);
end;
procedure TPublishModuleOptions.SaveToXMLConfig(XMLConfig: TXMLConfig;
@ -316,31 +256,14 @@ begin
f(GetDefaultDestinationDir));
XMLConfig.SetDeleteValue(APath+'CompressFinally/Value',CompressFinally,true);
XMLConfig.SetDeleteValue(APath+'UseFileFilters/Value',UseFileFilters,false);
XMLConfig.SetDeleteValue(APath+'IncludeFilterSimpleSyntax/Value',
IncludeFilterSimpleSyntax,true);
XMLConfig.SetDeleteValue(APath+'IncludeFileFilter/Value',IncludeFileFilter,
DefPublModIncFilter);
XMLConfig.SetDeleteValue(APath+'ExcludeFilterSimpleSyntax/Value',
ExcludeFilterSimpleSyntax,true);
XMLConfig.SetDeleteValue(APath+'ExcludeFileFilter/Value',ExcludeFileFilter,
DefPublModExcFilter);
XMLConfig.SetDeleteValue(APath+'FilterSimpleSyntax/Value',FilterSimpleSyntax,true);
XMLConfig.SetDeleteValue(APath+'FileFilter/Value',FileFilter,DefPublModIncFilter);
end;
function TPublishModuleOptions.FileCanBePublished(const AFilename: string): boolean;
begin
Result:=false;
// check include filter
if (FIncludeFilterRegExpr<>nil)
and (not FIncludeFilterRegExpr.Exec(ExtractFilename(AFilename))) then
exit;
// check exclude filter
if (FExcludeFilterRegExpr<>nil)
and (FExcludeFilterRegExpr.Exec(ExtractFilename(AFilename))) then
exit;
// check binaries
//if IgnoreBinaries and (not DirPathExists(AFilename))
//and (not FileIsText(AFilename)) then exit;
Result:=true;
// check file filter
Result := (FFilterRegExpr=nil) or FFilterRegExpr.Exec(ExtractFilename(AFilename));
end;
procedure TPublishModuleOptions.LockModified;

View File

@ -1,11 +1,11 @@
object PublishProjectDialog: TPublishProjectDialog
object PublishModuleDialog: TPublishModuleDialog
Left = 391
Height = 442
Height = 320
Top = 56
Width = 642
BorderIcons = [biSystemMenu]
Caption = 'Publish Project'
ClientHeight = 442
Caption = 'Publish Module'
ClientHeight = 320
ClientWidth = 642
OnClose = FormClose
OnCreate = FormCreate
@ -52,15 +52,15 @@ object PublishProjectDialog: TPublishProjectDialog
end
end
object OptionsGroupbox: TGroupBox
AnchorSideTop.Control = FiltersPanel
AnchorSideTop.Control = FilterCombobox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 53
Top = 279
Top = 203
Width = 628
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
BorderSpacing.Around = 18
Caption = 'Options'
ChildSizing.TopBottomSpacing = 6
ClientHeight = 33
@ -93,7 +93,7 @@ object PublishProjectDialog: TPublishProjectDialog
object ButtonPanel1: TButtonPanel
Left = 6
Height = 26
Top = 410
Top = 288
Width = 630
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
@ -103,7 +103,7 @@ object PublishProjectDialog: TPublishProjectDialog
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 3
TabOrder = 2
ShowBevel = False
end
object UseFiltersCheckbox: TCheckBox
@ -111,114 +111,12 @@ object PublishProjectDialog: TPublishProjectDialog
AnchorSideTop.Side = asrBottom
Left = 6
Height = 21
Top = 103
Width = 174
BorderSpacing.Around = 6
Caption = 'Use filters for extra files'
Top = 115
Width = 168
BorderSpacing.Around = 18
Caption = 'Use filter for extra files'
OnClick = UseFiltersCheckboxClick
TabOrder = 4
end
object FiltersPanel: TPanel
AnchorSideLeft.Control = UseFiltersCheckbox
AnchorSideTop.Control = UseFiltersCheckbox
AnchorSideTop.Side = asrBottom
Left = 21
Height = 143
Top = 130
Width = 615
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Left = 15
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ClientHeight = 143
ClientWidth = 615
TabOrder = 2
TabStop = True
object IncFilterSimpleSyntaxCheckbox: TCheckBox
AnchorSideLeft.Control = IncludeFilterCombobox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = IncludeFilterCombobox
AnchorSideTop.Side = asrCenter
Left = 462
Height = 21
Top = 37
Width = 111
BorderSpacing.Around = 6
Caption = 'Simple Syntax'
ParentShowHint = False
ShowHint = True
TabOrder = 0
end
object IncludeFilterCombobox: TComboBox
AnchorSideLeft.Control = IncludeFilterLabel
AnchorSideTop.Control = IncludeFilterLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 7
Height = 31
Top = 32
Width = 449
Anchors = [akTop, akLeft, akRight]
AutoSize = False
ItemHeight = 0
TabOrder = 1
Text = 'IncludeFilterCombobox'
end
object IncludeFilterLabel: TLabel
AnchorSideLeft.Control = FiltersPanel
AnchorSideTop.Control = FiltersPanel
Left = 7
Height = 19
Top = 7
Width = 112
BorderSpacing.Around = 6
Caption = 'IncludeFilterLabel'
ParentColor = False
end
object ExcludeFilterLabel: TLabel
AnchorSideLeft.Control = FiltersPanel
AnchorSideTop.Control = IncludeFilterCombobox
AnchorSideTop.Side = asrBottom
Left = 7
Height = 19
Top = 80
Width = 113
BorderSpacing.Top = 11
BorderSpacing.Around = 6
Caption = 'ExcludeFilterLabel'
ParentColor = False
end
object ExcludeFilterCombobox: TComboBox
AnchorSideLeft.Control = ExcludeFilterLabel
AnchorSideTop.Control = ExcludeFilterLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = IncludeFilterCombobox
AnchorSideRight.Side = asrBottom
Left = 7
Height = 31
Top = 105
Width = 449
Anchors = [akTop, akLeft, akRight]
ItemHeight = 0
TabOrder = 2
Text = 'ExcludeFilterCombobox'
end
object ExcFilterSimpleSyntaxCheckbox: TCheckBox
AnchorSideLeft.Control = ExcludeFilterCombobox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ExcludeFilterCombobox
AnchorSideTop.Side = asrCenter
Left = 462
Height = 21
Top = 110
Width = 111
BorderSpacing.Around = 6
Caption = 'Simple Syntax'
ParentShowHint = False
ShowHint = True
TabOrder = 3
end
TabOrder = 3
end
object NoteLabel: TLabel
AnchorSideTop.Control = DestDirGroupBox
@ -234,4 +132,35 @@ object PublishProjectDialog: TPublishProjectDialog
ParentColor = False
ParentFont = False
end
object FilterCombobox: TComboBox
AnchorSideLeft.Control = UseFiltersCheckbox
AnchorSideTop.Control = UseFiltersCheckbox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = FilterSimpleSyntaxCheckbox
Left = 24
Height = 31
Top = 154
Width = 462
Anchors = [akTop, akLeft, akRight]
AutoSize = False
BorderSpacing.Left = 18
ItemHeight = 0
TabOrder = 4
Text = 'FilterCombobox'
end
object FilterSimpleSyntaxCheckbox: TCheckBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = FilterCombobox
AnchorSideTop.Side = asrCenter
Left = 499
Height = 21
Top = 159
Width = 111
Anchors = [akTop, akRight]
BorderSpacing.Around = 13
Caption = 'Simple Syntax'
ParentShowHint = False
ShowHint = True
TabOrder = 5
end
end

View File

@ -1,9 +1,4 @@
{ /***************************************************************************
publishprojectdlg.pp - Lazarus IDE unit
-----------------------------------------
***************************************************************************/
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
@ -26,11 +21,11 @@
Author: Juha Manninen
Abstract:
- TPublishProjectDialog
- TPublishModuleDialog
The dialog for TPublishModuleOptions to publish projects and packages.
}
unit PublishProjectDlg;
unit PublishModuleDlg;
{$mode objfpc}{$H+}
@ -49,20 +44,15 @@ uses
LazarusIDEStrConsts, IDEProcs, EnvironmentOpts;
type
{ TPublishProjectDialog }
{ TPublishModuleDialog }
TPublishProjectDialog = class(TForm)
TPublishModuleDialog = class(TForm)
ButtonPanel1: TButtonPanel;
DestDirGroupBox: TGroupBox;
DestDirComboBox: TComboBox;
BrowseDestDirBitBtn: TBitBtn;
ExcFilterSimpleSyntaxCheckbox: TCheckBox;
ExcludeFilterCombobox: TComboBox;
ExcludeFilterLabel: TLabel;
FiltersPanel: TPanel;
IncFilterSimpleSyntaxCheckbox: TCheckBox;
IncludeFilterCombobox: TComboBox;
IncludeFilterLabel: TLabel;
FilterCombobox: TComboBox;
FilterSimpleSyntaxCheckbox: TCheckBox;
Label1: TLabel;
NoteLabel: TLabel;
OptionsGroupbox: TGroupBox;
@ -132,10 +122,10 @@ implementation
function ShowPublishDialog(AOptions: TPublishModuleOptions): TModalResult;
var
PublishProjectDialog: TPublishProjectDialog;
PublishModuleDialog: TPublishModuleDialog;
begin
PublishProjectDialog:=TPublishProjectDialog.Create(nil);
with PublishProjectDialog do
PublishModuleDialog:=TPublishModuleDialog.Create(nil);
with PublishModuleDialog do
begin
Options:=AOptions;
Result:=ShowModal;
@ -428,42 +418,34 @@ begin
IDEMessageDialog(lisSuccess, 'Published to '+FDestDir, mtInformation,[mbOk]);
end;
{ TPublishProjectDialog }
{ TPublishModuleDialog }
constructor TPublishProjectDialog.Create(TheOwner: TComponent);
constructor TPublishModuleDialog.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
Position:=poScreenCenter;
IDEDialogLayoutList.ApplyLayout(Self, 600, 400);
IDEDialogLayoutList.ApplyLayout(Self, 600, 350);
LoadHistoryLists;
end;
destructor TPublishProjectDialog.Destroy;
destructor TPublishModuleDialog.Destroy;
begin
SaveHistoryLists;
inherited Destroy;
end;
procedure TPublishProjectDialog.FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure TPublishModuleDialog.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
IDEDialogLayoutList.SaveLayout(Self);
end;
procedure TPublishProjectDialog.FormCreate(Sender: TObject);
procedure TPublishModuleDialog.FormCreate(Sender: TObject);
begin
DestDirGroupBox.Caption:=lisDestinationDirectory;
NoteLabel.Caption:=lisPublishModuleNote;
UseFiltersCheckbox.Caption:=lisUseFiltersForExtraFiles;
IncludeFilterLabel.Caption:=lisIncludeFilter;
IncFilterSimpleSyntaxCheckbox.Caption:=lisSimpleSyntax;
IncFilterSimpleSyntaxCheckbox.Hint:=
lisNormallyTheFilterIsARegularExpressionInSimpleSynta;
ExcludeFilterLabel.Caption:=lisExcludeFilter;
ExcFilterSimpleSyntaxCheckbox.Caption:=lisSimpleSyntax;
ExcFilterSimpleSyntaxCheckbox.Hint:=
lisNormallyTheFilterIsARegularExpressionInSimpleSynta;
UseFiltersCheckbox.Caption:=lisUseFilterForExtraFiles;
FilterSimpleSyntaxCheckbox.Caption:=lisSimpleSyntax;
FilterSimpleSyntaxCheckbox.Hint:=lisNormallyTheFilterIsARegularExpressionInSimpleSynta;
OptionsGroupbox.Caption:=lisOptions;
CompressCheckbox.Caption:=lisCompress;
@ -471,7 +453,6 @@ begin
ButtonPanel1.OkButton.Caption := lisMenuOk;
ButtonPanel1.OKButton.OnClick := @OkButtonCLICK;
ButtonPanel1.CloseButton.Caption := lisSaveSettings;
ButtonPanel1.CloseButton.ModalResult := mrNone;
ButtonPanel1.CloseButton.Kind := bkCustom;
@ -479,11 +460,10 @@ begin
if ButtonPanel1.CloseButton.Glyph.Empty then
IDEImages.AssignImage(ButtonPanel1.CloseButton, 'laz_save');
ButtonPanel1.CloseButton.OnClick := @SaveSettingsButtonCLICK;
ButtonPanel1.HelpButton.OnClick := @HelpButtonClick;
end;
procedure TPublishProjectDialog.BrowseDestDirBitBtnCLICK(Sender: TObject);
procedure TPublishModuleDialog.BrowseDestDirBitBtnCLICK(Sender: TObject);
var
SelectDirDialog: TSelectDirectoryDialog;
NewDir: String;
@ -498,78 +478,71 @@ begin
SelectDirDialog.Free;
end;
procedure TPublishProjectDialog.HelpButtonClick(Sender: TObject);
procedure TPublishModuleDialog.HelpButtonClick(Sender: TObject);
begin
LazarusHelp.ShowHelpForIDEControl(Self);
end;
procedure TPublishProjectDialog.OkButtonCLICK(Sender: TObject);
procedure TPublishModuleDialog.OkButtonCLICK(Sender: TObject);
begin
if not CheckFilter then exit;
if Options<>nil then SaveToOptions(Options);
if Options<>nil then
SaveToOptions(Options);
end;
procedure TPublishProjectDialog.SaveSettingsButtonClick(Sender: TObject);
procedure TPublishModuleDialog.SaveSettingsButtonClick(Sender: TObject);
begin
if not CheckFilter then exit;
if Options<>nil then SaveToOptions(Options);
if Options<>nil then
SaveToOptions(Options);
end;
procedure TPublishProjectDialog.UseFiltersCheckboxClick(Sender: TObject);
procedure TPublishModuleDialog.UseFiltersCheckboxClick(Sender: TObject);
begin
FiltersPanel.Enabled := (Sender as TCheckBox).Checked;
FilterCombobox.Enabled := (Sender as TCheckBox).Checked;
FilterSimpleSyntaxCheckbox.Enabled := FilterCombobox.Enabled;
end;
procedure TPublishProjectDialog.SetComboBox(AComboBox: TComboBox;
procedure TPublishModuleDialog.SetComboBox(AComboBox: TComboBox;
const NewText: string; MaxItemCount: integer);
begin
AComboBox.AddHistoryItem(NewText,MaxItemCount,true,false);
end;
procedure TPublishProjectDialog.LoadHistoryLists;
procedure TPublishModuleDialog.LoadHistoryLists;
var
hl: THistoryList;
begin
// destination directories
hl:=InputHistories.HistoryLists.GetList(hlPublishProjectDestDirs,true,rltFile);
hl:=InputHistories.HistoryLists.GetList(hlPublishModuleDestDirs,true,rltFile);
hl.AppendEntry(GetForcedPathDelims('$(TestDir)/publishedproject/'));
hl.AppendEntry(GetForcedPathDelims('$(TestDir)/publishedpackage/'));
hl.AppendEntry(GetForcedPathDelims('$(ProjPath)/published/'));
DestDirComboBox.Items.Assign(hl);
// file filters
hl:=InputHistories.HistoryLists.GetList(hlPublishProjectIncludeFileFilter,
true,rltFile);
// file filter
hl:=InputHistories.HistoryLists.GetList(hlPublishModuleFileFilter,true,rltFile);
if hl.Count=0 then
hl.Add(DefPublModIncFilter);
IncludeFilterCombobox.Items.Assign(hl);
hl:=InputHistories.HistoryLists.GetList(hlPublishProjectExcludeFileFilter,
true,rltFile);
if hl.Count=0 then
hl.Add(DefPublModExcFilter);
ExcludeFilterCombobox.Items.Assign(hl);
FilterCombobox.Items.Assign(hl);
end;
procedure TPublishProjectDialog.SaveHistoryLists;
procedure TPublishModuleDialog.SaveHistoryLists;
var
hl: THistoryList;
begin
// destination directories
SetComboBox(DestDirComboBox,DestDirComboBox.Text,20);
hl:=InputHistories.HistoryLists.GetList(hlPublishProjectDestDirs,true,rltFile);
hl:=InputHistories.HistoryLists.GetList(hlPublishModuleDestDirs,true,rltFile);
hl.Assign(DestDirComboBox.Items);
// file filters
SetComboBox(IncludeFilterCombobox,IncludeFilterCombobox.Text,20);
hl:=InputHistories.HistoryLists.GetList(hlPublishProjectIncludeFileFilter,true,rltFile);
hl.Assign(IncludeFilterCombobox.Items);
SetComboBox(ExcludeFilterCombobox,ExcludeFilterCombobox.Text,20);
hl:=InputHistories.HistoryLists.GetList(hlPublishProjectExcludeFileFilter,true,rltFile);
hl.Assign(ExcludeFilterCombobox.Items);
SetComboBox(FilterCombobox,FilterCombobox.Text,20);
hl:=InputHistories.HistoryLists.GetList(hlPublishModuleFileFilter,true,rltFile);
hl.Assign(FilterCombobox.Items);
end;
procedure TPublishProjectDialog.SetOptions(const AValue: TPublishModuleOptions);
procedure TPublishModuleDialog.SetOptions(const AValue: TPublishModuleOptions);
begin
if FOptions=AValue then exit;
FOptions:=AValue;
@ -580,25 +553,20 @@ begin
LoadFromOptions(FOptions);
end;
function TPublishProjectDialog.CheckFilter: boolean;
function TPublishModuleDialog.CheckFilter: boolean;
begin
Result:=false;
if Options<>nil then begin
if not Options.IncludeFilterValid then begin
if IDEMessageDialog(lisCCOErrorCaption, lisPublProjInvalidIncludeFilter,
if not Options.FilterValid then begin
if IDEMessageDialog(lisCCOErrorCaption, lisInvalidFilter,
mtError, [mbIgnore,mbCancel]) = mrCancel
then exit;
end;
if not Options.ExcludeFilterValid then begin
if IDEMessageDialog(lisCCOErrorCaption, lisPublProjInvalidExcludeFilter,
mtError, [mbIgnore,mbCancel]) = mrCancel
then exit;
end;
end;
Result:=true;
end;
procedure TPublishProjectDialog.LoadFromOptions(SrcOpts: TPublishModuleOptions);
procedure TPublishModuleDialog.LoadFromOptions(SrcOpts: TPublishModuleOptions);
begin
// destination
SeTComboBox(DestDirComboBox,SrcOpts.DestinationDirectory,20);
@ -606,13 +574,11 @@ begin
// file filters
CompressCheckbox.Checked:=SrcOpts.CompressFinally;
UseFiltersCheckbox.Checked:=SrcOpts.UseFileFilters;
IncFilterSimpleSyntaxCheckbox.Checked:=SrcOpts.IncludeFilterSimpleSyntax;
SeTComboBox(IncludeFilterCombobox,SrcOpts.IncludeFileFilter,20);
ExcFilterSimpleSyntaxCheckbox.Checked:=SrcOpts.ExcludeFilterSimpleSyntax;
SeTComboBox(ExcludeFilterCombobox,SrcOpts.ExcludeFileFilter,20);
FilterSimpleSyntaxCheckbox.Checked:=SrcOpts.FilterSimpleSyntax;
SeTComboBox(FilterCombobox,SrcOpts.FileFilter,20);
end;
procedure TPublishProjectDialog.SaveToOptions(DestOpts: TPublishModuleOptions);
procedure TPublishModuleDialog.SaveToOptions(DestOpts: TPublishModuleOptions);
begin
// destination
DestOpts.DestinationDirectory:=DestDirComboBox.Text;
@ -620,10 +586,8 @@ begin
// file filters
DestOpts.CompressFinally:=CompressCheckbox.Checked;
DestOpts.UseFileFilters:=UseFiltersCheckbox.Checked;
DestOpts.IncludeFilterSimpleSyntax:=IncFilterSimpleSyntaxCheckbox.Checked;
DestOpts.IncludeFileFilter:=IncludeFilterCombobox.Text;
DestOpts.ExcludeFilterSimpleSyntax:=ExcFilterSimpleSyntaxCheckbox.Checked;
DestOpts.ExcludeFileFilter:=ExcludeFilterCombobox.Text;
DestOpts.FilterSimpleSyntax:=FilterSimpleSyntaxCheckbox.Checked;
DestOpts.FileFilter:=FilterCombobox.Text;
end;
end.

View File

@ -68,7 +68,7 @@ uses
PkgGraphExplorer, BrokenDependenciesDlg, CompilerOptions, IDETranslations,
TransferMacros, BuildLazDialog, NewDialog, FindInFilesDlg, ProjectInspector,
SourceEditor, ProjPackChecks, AddFileToAPackageDlg, LazarusPackageIntf,
PublishProjectDlg, PkgLinksDlg, InterPkgConflictFiles, InstallPkgSetDlg,
PublishModuleDlg, PkgLinksDlg, InterPkgConflictFiles, InstallPkgSetDlg,
ConfirmPkgListDlg, NewPkgComponentDlg, BaseBuildManager, BasePkgManager,
MainBar, MainIntf, MainBase, ModeMatrixOpts;