mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-06 15:47:18 +02:00
IDE: New look for ImportExportCompOpts, use ComboBox. Issue #28291, patch from Alexey Torgashin.
git-svn-id: trunk@49330 -
This commit is contained in:
parent
a30d79092d
commit
baa112f0e4
@ -30,40 +30,6 @@ object ImExportCompOptsDlg: TImExportCompOptsDlg
|
|||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
ShowButtons = [pbOK, pbCancel, pbHelp]
|
ShowButtons = [pbOK, pbCancel, pbHelp]
|
||||||
end
|
end
|
||||||
object HistoryLabel: TLabel
|
|
||||||
AnchorSideTop.Control = FileNameEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = FileNameEdit
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 407
|
|
||||||
Height = 15
|
|
||||||
Top = 54
|
|
||||||
Width = 38
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
BorderSpacing.Top = 6
|
|
||||||
Caption = 'History'
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object HistoryButton: TButton
|
|
||||||
AnchorSideLeft.Control = HistoryLabel
|
|
||||||
AnchorSideTop.Control = HistoryLabel
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = HistoryLabel
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 410
|
|
||||||
Height = 25
|
|
||||||
Hint = 'Recent files'
|
|
||||||
Top = 75
|
|
||||||
Width = 35
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
BorderSpacing.Top = 6
|
|
||||||
Caption = '>>'
|
|
||||||
OnClick = HistoryButtonClick
|
|
||||||
ParentShowHint = False
|
|
||||||
PopupMenu = RecentPopupMenu
|
|
||||||
ShowHint = True
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
object FileLabel: TLabel
|
object FileLabel: TLabel
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
@ -76,33 +42,7 @@ object ImExportCompOptsDlg: TImExportCompOptsDlg
|
|||||||
Caption = 'File'
|
Caption = 'File'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object FileNameEdit: TFileNameEdit
|
|
||||||
AnchorSideLeft.Control = FileLabel
|
|
||||||
AnchorSideTop.Control = FileLabel
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 6
|
|
||||||
Height = 23
|
|
||||||
Top = 25
|
|
||||||
Width = 439
|
|
||||||
DialogOptions = [ofExtensionDifferent, ofEnableSizing, ofViewDetail]
|
|
||||||
Filter = 'XML file (*.xml)|*.xml|Project file (*.lpi)|*.lpi|Package file (*.lpk)|*.lpk|Session file (*.lps)|*.lps|All files (*)|*'
|
|
||||||
FilterIndex = 0
|
|
||||||
HideDirectories = False
|
|
||||||
ButtonWidth = 45
|
|
||||||
NumGlyphs = 1
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
BorderSpacing.Right = 6
|
|
||||||
MaxLength = 0
|
|
||||||
ParentShowHint = False
|
|
||||||
PopupMenu = RecentPopupMenu
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object ExportRadioGroup: TRadioGroup
|
object ExportRadioGroup: TRadioGroup
|
||||||
AnchorSideLeft.Control = FileNameEdit
|
|
||||||
AnchorSideTop.Control = FileNameEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 66
|
Height = 66
|
||||||
@ -125,13 +65,48 @@ object ImExportCompOptsDlg: TImExportCompOptsDlg
|
|||||||
'Current build mode'
|
'Current build mode'
|
||||||
'All build modes'
|
'All build modes'
|
||||||
)
|
)
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object FileNameEdit: TComboBox
|
||||||
|
AnchorSideLeft.Control = FileLabel
|
||||||
|
AnchorSideTop.Control = FileLabel
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 6
|
||||||
|
Height = 23
|
||||||
|
Top = 25
|
||||||
|
Width = 378
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
BorderSpacing.Right = 6
|
||||||
|
ItemHeight = 15
|
||||||
|
OnChange = FileNameEditChange
|
||||||
|
ParentShowHint = False
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object ButtonBrowse: TButton
|
||||||
|
AnchorSideLeft.Control = FileNameEdit
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = FileNameEdit
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 390
|
||||||
|
Height = 25
|
||||||
|
Top = 25
|
||||||
|
Width = 55
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Right = 6
|
||||||
|
Caption = '...'
|
||||||
|
OnClick = ButtonBrowseClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object RecentPopupMenu: TPopupMenu
|
object OpenDlg: TOpenDialog
|
||||||
left = 256
|
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
|
||||||
top = 96
|
left = 304
|
||||||
object MenuItem1: TMenuItem
|
top = 88
|
||||||
Caption = 'New Item1'
|
end
|
||||||
end
|
object SaveDlg: TSaveDialog
|
||||||
|
left = 349
|
||||||
|
top = 88
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -33,7 +33,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons,
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons,
|
||||||
Menus, ExtCtrls, EditBtn, ButtonPanel,
|
Menus, ExtCtrls, ButtonPanel,
|
||||||
IDEProcs, FileUtil, Laz2_XMLCfg, LazFileCache, LCLType, LazarusIDEStrConsts,
|
IDEProcs, FileUtil, Laz2_XMLCfg, LazFileCache, LCLType, LazarusIDEStrConsts,
|
||||||
IDEOptionsIntf, InputHistory, Project, CompilerOptions;
|
IDEOptionsIntf, InputHistory, Project, CompilerOptions;
|
||||||
|
|
||||||
@ -41,27 +41,23 @@ type
|
|||||||
{ TImExportCompOptsDlg }
|
{ TImExportCompOptsDlg }
|
||||||
|
|
||||||
TImExportCompOptsDlg = class(TForm)
|
TImExportCompOptsDlg = class(TForm)
|
||||||
|
ButtonBrowse: TButton;
|
||||||
ButtonPanel1: TButtonPanel;
|
ButtonPanel1: TButtonPanel;
|
||||||
ExportRadioGroup: TRadioGroup;
|
ExportRadioGroup: TRadioGroup;
|
||||||
FileLabel: TLabel;
|
FileLabel: TLabel;
|
||||||
FileNameEdit: TFileNameEdit;
|
FileNameEdit: TComboBox;
|
||||||
HistoryLabel: TLabel;
|
OpenDlg: TOpenDialog;
|
||||||
MenuItem1: TMenuItem;
|
SaveDlg: TSaveDialog;
|
||||||
HistoryButton: TButton;
|
procedure ButtonBrowseClick(Sender: TObject);
|
||||||
RecentPopupMenu: TPopupMenu;
|
procedure FileNameEditChange(Sender: TObject);
|
||||||
procedure FileNameEditChangeImport(Sender: TObject);
|
|
||||||
procedure FileNameEditChangeExport(Sender: TObject);
|
|
||||||
procedure ImExportCompOptsDlgCLOSE(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
procedure ImExportCompOptsDlgCLOSE(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
||||||
procedure ImExportCompOptsDlgCREATE(Sender: TObject);
|
procedure ImExportCompOptsDlgCREATE(Sender: TObject);
|
||||||
procedure OpenButtonCLICK(Sender: TObject);
|
procedure OpenButtonCLICK(Sender: TObject);
|
||||||
procedure PopupClick(Sender: TObject);
|
|
||||||
procedure HistoryButtonClick(Sender: TObject);
|
|
||||||
//procedure RecentSaveButton1Click(Sender: TObject);
|
|
||||||
procedure SaveButtonCLICK(Sender: TObject);
|
procedure SaveButtonCLICK(Sender: TObject);
|
||||||
private
|
private
|
||||||
FFilename: string;
|
FFilename: string;
|
||||||
FParentDialog: TAbstractOptionsEditorDialog;
|
FParentDialog: TAbstractOptionsEditorDialog;
|
||||||
procedure HideRadioButtons;
|
FExport: boolean;
|
||||||
procedure InitExport;
|
procedure InitExport;
|
||||||
procedure InitImport;
|
procedure InitImport;
|
||||||
procedure LoadRecentList;
|
procedure LoadRecentList;
|
||||||
@ -249,16 +245,16 @@ end;
|
|||||||
|
|
||||||
{ TImExportCompOptsDlg }
|
{ TImExportCompOptsDlg }
|
||||||
|
|
||||||
procedure TImExportCompOptsDlg.HideRadioButtons;
|
|
||||||
begin
|
|
||||||
ExportRadioGroup.Enabled:=False; // Enabled is better than visible, nicer dialog
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TImExportCompOptsDlg.InitImport;
|
procedure TImExportCompOptsDlg.InitImport;
|
||||||
begin
|
begin
|
||||||
|
FExport:=false;
|
||||||
Caption:=lisIECOImportCompilerOptions;
|
Caption:=lisIECOImportCompilerOptions;
|
||||||
HideRadioButtons;
|
// ToDo: Later when the XML file is selected, ExportRadioGroup can be made
|
||||||
FileNameEdit.Filter:= Format(
|
// Visible but disabled. Then ItemIndex must be set according to file contents.
|
||||||
|
// If file contains one mode -> ItemIndex:=0. If more modes -> ItemIndex:=1.
|
||||||
|
ExportRadioGroup.Visible:=False;
|
||||||
|
|
||||||
|
OpenDlg.Filter:=Format(
|
||||||
'%s|*.xml|'
|
'%s|*.xml|'
|
||||||
+'%s|*.lpi|'
|
+'%s|*.lpi|'
|
||||||
+'%s|*.lpk|'
|
+'%s|*.lpk|'
|
||||||
@ -270,8 +266,6 @@ begin
|
|||||||
dlgFilterLazarusSession,
|
dlgFilterLazarusSession,
|
||||||
dlgFilterAll, GetAllFilesMask]);
|
dlgFilterAll, GetAllFilesMask]);
|
||||||
|
|
||||||
FileNameEdit.DialogOptions:=FileNameEdit.DialogOptions+[ofFileMustExist];
|
|
||||||
FileNameEdit.OnChange:=@FileNameEditChangeImport;
|
|
||||||
with ButtonPanel1 do begin
|
with ButtonPanel1 do begin
|
||||||
OKButton.Caption:=lisIECOLoadFromFile;
|
OKButton.Caption:=lisIECOLoadFromFile;
|
||||||
OKButton.LoadGlyphFromStock(idButtonOpen);
|
OKButton.LoadGlyphFromStock(idButtonOpen);
|
||||||
@ -284,12 +278,13 @@ end;
|
|||||||
|
|
||||||
procedure TImExportCompOptsDlg.InitExport;
|
procedure TImExportCompOptsDlg.InitExport;
|
||||||
begin
|
begin
|
||||||
|
FExport:=true;
|
||||||
Caption:=lisIECOExportCompilerOptions;
|
Caption:=lisIECOExportCompilerOptions;
|
||||||
FileNameEdit.Filter:='XML file (*.xml)|*.xml|All files (*)|*';
|
SaveDlg.Filter:=Format('%s|*.xml|%s|%s',
|
||||||
FileNameEdit.DialogKind:=dkSave;
|
[dlgFilterXML, dlgFilterAll, GetAllFilesMask]);
|
||||||
FileNameEdit.OnChange:=@FileNameEditChangeExport;
|
|
||||||
if Project1.BuildModes.Count <= 1 then
|
if Project1.BuildModes.Count <= 1 then
|
||||||
HideRadioButtons;
|
ExportRadioGroup.Enabled:=False;
|
||||||
with ButtonPanel1 do begin
|
with ButtonPanel1 do begin
|
||||||
OKButton.Caption:=lisIECOSaveToFile;
|
OKButton.Caption:=lisIECOSaveToFile;
|
||||||
OKButton.LoadGlyphFromStock(idButtonSave);
|
OKButton.LoadGlyphFromStock(idButtonSave);
|
||||||
@ -302,8 +297,6 @@ end;
|
|||||||
|
|
||||||
procedure TImExportCompOptsDlg.ImExportCompOptsDlgCREATE(Sender: TObject);
|
procedure TImExportCompOptsDlg.ImExportCompOptsDlgCREATE(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
HistoryLabel.Caption:=lisIECORecentFiles;
|
|
||||||
HistoryLabel.Hint:=lisIECORecentFiles;
|
|
||||||
FileLabel.Caption:=lisFile;
|
FileLabel.Caption:=lisFile;
|
||||||
ExportRadioGroup.Caption:=lisIECOCompilerOptionsOf;
|
ExportRadioGroup.Caption:=lisIECOCompilerOptionsOf;
|
||||||
ExportRadioGroup.Items.Strings[0]:=lisIECOCurrentBuildMode;
|
ExportRadioGroup.Items.Strings[0]:=lisIECOCurrentBuildMode;
|
||||||
@ -311,39 +304,40 @@ begin
|
|||||||
LoadRecentList;
|
LoadRecentList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImExportCompOptsDlg.FileNameEditChangeImport(Sender: TObject);
|
procedure TImExportCompOptsDlg.ButtonBrowseClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
Dlg: TFileDialog;
|
||||||
begin
|
begin
|
||||||
ButtonPanel1.OKButton.Enabled := FileExistsUTF8((Sender as TFileNameEdit).FileName);
|
if FExport then Dlg:= SaveDlg
|
||||||
|
else Dlg:= OpenDlg;
|
||||||
|
|
||||||
|
with Dlg do
|
||||||
|
begin
|
||||||
|
FileName := '';
|
||||||
|
if Execute then
|
||||||
|
begin
|
||||||
|
FileNameEdit.Text := FileName;
|
||||||
|
FileNameEditChange(nil);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImExportCompOptsDlg.FileNameEditChangeExport(Sender: TObject);
|
procedure TImExportCompOptsDlg.FileNameEditChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ButtonPanel1.OKButton.Enabled := (Sender as TFileNameEdit).FileName <> '';
|
if FExport then
|
||||||
|
ButtonPanel1.OKButton.Enabled := FileNameEdit.Text <> ''
|
||||||
|
else
|
||||||
|
ButtonPanel1.OKButton.Enabled := FileExistsUTF8(FileNameEdit.Text);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImExportCompOptsDlg.OpenButtonCLICK(Sender: TObject);
|
procedure TImExportCompOptsDlg.OpenButtonCLICK(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DoOpenFile(CleanAndExpandFilename(FileNameEdit.FileName));
|
DoOpenFile(CleanAndExpandFilename(FileNameEdit.Text));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImExportCompOptsDlg.PopupClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
FileNameEdit.Text := (Sender as TMenuItem).Caption;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TImExportCompOptsDlg.HistoryButtonClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
RecentPopupMenu.PopUp;
|
|
||||||
end;
|
|
||||||
{
|
|
||||||
procedure TImExportCompOptsDlg.RecentSaveButton1Click(Sender: TObject);
|
|
||||||
begin
|
|
||||||
RecentPopupMenu.PopUp;
|
|
||||||
end;
|
|
||||||
}
|
|
||||||
procedure TImExportCompOptsDlg.SaveButtonCLICK(Sender: TObject);
|
procedure TImExportCompOptsDlg.SaveButtonCLICK(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DoSaveFile(CleanAndExpandFilename(FileNameEdit.FileName));
|
DoSaveFile(CleanAndExpandFilename(FileNameEdit.Text));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImExportCompOptsDlg.ImExportCompOptsDlgCLOSE(Sender: TObject; var CloseAction: TCloseAction);
|
procedure TImExportCompOptsDlg.ImExportCompOptsDlgCLOSE(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
@ -352,32 +346,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImExportCompOptsDlg.LoadRecentList;
|
procedure TImExportCompOptsDlg.LoadRecentList;
|
||||||
var
|
|
||||||
sl: TStringList;
|
|
||||||
mi: TMenuItem;
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
sl := TStringList.Create;
|
FileNameEdit.Items.Assign(
|
||||||
try
|
InputHistories.HistoryLists.GetList(hlCompilerOptsImExport,true,rltFile));
|
||||||
RecentPopupMenu.Items.Clear;
|
|
||||||
sl.Assign(InputHistories.HistoryLists.GetList(hlCompilerOptsImExport,true,rltFile));
|
|
||||||
for i := 0 to sl.Count-1 do begin
|
|
||||||
mi := TMenuItem.Create(RecentPopupMenu);
|
|
||||||
mi.Caption:=sl[i];
|
|
||||||
mi.OnClick:=@PopupClick;
|
|
||||||
RecentPopupMenu.Items.Add(mi);
|
|
||||||
end;
|
|
||||||
HistoryLabel.Visible := sl.Count > 0;
|
|
||||||
HistoryButton.Visible := HistoryLabel.Visible;
|
|
||||||
finally
|
|
||||||
sl.Free;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
{
|
{
|
||||||
procedure TImExportCompOptsDlg.SaveRecentList;
|
procedure TImExportCompOptsDlg.SaveRecentList;
|
||||||
begin
|
begin
|
||||||
InputHistories.HistoryLists.GetList(hlCompilerOptsImExport,true,rltFile).Assign(
|
InputHistories.HistoryLists.GetList(hlCompilerOptsImExport,true,rltFile).Assign(
|
||||||
RecentListbox.Items);
|
FileNameEdit.Items);
|
||||||
InputHistories.Save;
|
InputHistories.Save;
|
||||||
end;
|
end;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user