mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 19:10:25 +02:00
ide: add delete all button in resource options
git-svn-id: trunk@43229 -
This commit is contained in:
parent
a616abdfe9
commit
86a162998f
@ -31,11 +31,12 @@ object ResourcesOptionsFrame: TResourcesOptionsFrame
|
|||||||
end
|
end
|
||||||
item
|
item
|
||||||
Caption = 'Resource'
|
Caption = 'Resource'
|
||||||
Width = 658
|
Width = 508
|
||||||
end>
|
end>
|
||||||
RowSelect = True
|
RowSelect = True
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
ViewStyle = vsReport
|
ViewStyle = vsReport
|
||||||
|
OnInsert = lbResourcesInsert
|
||||||
OnSelectItem = lbResourcesSelectItem
|
OnSelectItem = lbResourcesSelectItem
|
||||||
end
|
end
|
||||||
object ToolBar1: TToolBar
|
object ToolBar1: TToolBar
|
||||||
@ -61,6 +62,13 @@ object ResourcesOptionsFrame: TResourcesOptionsFrame
|
|||||||
Enabled = False
|
Enabled = False
|
||||||
OnClick = btnDeleteClick
|
OnClick = btnDeleteClick
|
||||||
end
|
end
|
||||||
|
object btnClear: TToolButton
|
||||||
|
Left = 108
|
||||||
|
Top = 0
|
||||||
|
Caption = 'btnClear'
|
||||||
|
Enabled = False
|
||||||
|
OnClick = btnClearClick
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object dlgOpen: TOpenDialog
|
object dlgOpen: TOpenDialog
|
||||||
left = 146
|
left = 146
|
||||||
|
@ -6,7 +6,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Graphics, Forms, Controls, ComCtrls, Dialogs, LCLProc,
|
Classes, SysUtils, FileUtil, Graphics, Forms, Controls, ComCtrls, Dialogs, LCLProc,
|
||||||
IDEOptionsIntf, IDEImagesIntf,
|
IDEOptionsIntf, IDEImagesIntf, IDEDialogs,
|
||||||
Project, ProjectUserResources, LCLStrConsts, LazarusIDEStrConsts;
|
Project, ProjectUserResources, LCLStrConsts, LazarusIDEStrConsts;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -19,8 +19,11 @@ type
|
|||||||
ToolBar1: TToolBar;
|
ToolBar1: TToolBar;
|
||||||
btnAdd: TToolButton;
|
btnAdd: TToolButton;
|
||||||
btnDelete: TToolButton;
|
btnDelete: TToolButton;
|
||||||
|
btnClear: TToolButton;
|
||||||
procedure btnAddClick(Sender: TObject);
|
procedure btnAddClick(Sender: TObject);
|
||||||
|
procedure btnClearClick(Sender: TObject);
|
||||||
procedure btnDeleteClick(Sender: TObject);
|
procedure btnDeleteClick(Sender: TObject);
|
||||||
|
procedure lbResourcesInsert(Sender: TObject; Item: TListItem);
|
||||||
procedure lbResourcesSelectItem(Sender: TObject; Item: TListItem;
|
procedure lbResourcesSelectItem(Sender: TObject; Item: TListItem;
|
||||||
Selected: Boolean);
|
Selected: Boolean);
|
||||||
private
|
private
|
||||||
@ -46,6 +49,13 @@ begin
|
|||||||
AddResource(dlgOpen.FileName);
|
AddResource(dlgOpen.FileName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TResourcesOptionsFrame.btnClearClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if IDEMessageDialog(lisConfirmDelete, rsResourceClear, mtConfirmation, [mbYes, mbNo]) = mrYes then
|
||||||
|
lbResources.Items.Clear;
|
||||||
|
btnClear.Enabled := lbResources.Items.Count > 0;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TResourcesOptionsFrame.btnDeleteClick(Sender: TObject);
|
procedure TResourcesOptionsFrame.btnDeleteClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
Index: Integer;
|
Index: Integer;
|
||||||
@ -53,6 +63,13 @@ begin
|
|||||||
Index := lbResources.ItemIndex;
|
Index := lbResources.ItemIndex;
|
||||||
if (Index <> -1) then
|
if (Index <> -1) then
|
||||||
lbResources.Items.Delete(Index);
|
lbResources.Items.Delete(Index);
|
||||||
|
btnClear.Enabled := lbResources.Items.Count > 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TResourcesOptionsFrame.lbResourcesInsert(Sender: TObject;
|
||||||
|
Item: TListItem);
|
||||||
|
begin
|
||||||
|
btnClear.Enabled := lbResources.Items.Count > 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TResourcesOptionsFrame.lbResourcesSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
|
procedure TResourcesOptionsFrame.lbResourcesSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
|
||||||
@ -102,6 +119,8 @@ begin
|
|||||||
btnDelete.Caption := lisBtnDelete;
|
btnDelete.Caption := lisBtnDelete;
|
||||||
btnAdd.ImageIndex := IDEImages.LoadImage(16, 'laz_add');
|
btnAdd.ImageIndex := IDEImages.LoadImage(16, 'laz_add');
|
||||||
btnDelete.ImageIndex := IDEImages.LoadImage(16, 'laz_delete');
|
btnDelete.ImageIndex := IDEImages.LoadImage(16, 'laz_delete');
|
||||||
|
btnClear.Caption := lisDeleteAll;
|
||||||
|
btnClear.ImageIndex := IDEImages.LoadImage(16, 'menu_clean');
|
||||||
// system resources can be:
|
// system resources can be:
|
||||||
// 1. Graphic files
|
// 1. Graphic files
|
||||||
// 2. Font files
|
// 2. Font files
|
||||||
@ -117,8 +136,14 @@ var
|
|||||||
begin
|
begin
|
||||||
lbResources.Items.Clear;
|
lbResources.Items.Clear;
|
||||||
List := Project.ProjResources.UserResources.List;
|
List := Project.ProjResources.UserResources.List;
|
||||||
|
lbResources.Items.BeginUpdate;
|
||||||
|
try
|
||||||
for I := 0 to List.Count - 1 do
|
for I := 0 to List.Count - 1 do
|
||||||
AddResourceItem(List[I]^.FileName, List[I]^.ResType, List[I]^.ResName);
|
AddResourceItem(List[I]^.FileName, List[I]^.ResType, List[I]^.ResName);
|
||||||
|
finally
|
||||||
|
lbResources.Items.EndUpdate;
|
||||||
|
end;
|
||||||
|
btnClear.Enabled := lbResources.Items.Count > 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TResourcesOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
procedure TResourcesOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||||
|
@ -2281,6 +2281,7 @@ resourcestring
|
|||||||
rsResourceFileName = 'File name';
|
rsResourceFileName = 'File name';
|
||||||
rsResourceType = 'Type';
|
rsResourceType = 'Type';
|
||||||
rsResource = 'Resource';
|
rsResource = 'Resource';
|
||||||
|
rsResourceClear = 'Delete all resources?';
|
||||||
dlgPOMisc = 'Miscellaneous';
|
dlgPOMisc = 'Miscellaneous';
|
||||||
dlgPOI18n = 'i18n';
|
dlgPOI18n = 'i18n';
|
||||||
rsEnableI18n = 'Enable i18n';
|
rsEnableI18n = 'Enable i18n';
|
||||||
|
Loading…
Reference in New Issue
Block a user