IdeIntf: Make translated texts fit in ImageList editor buttons. Issue #33775, patch from FTurtle.

git-svn-id: trunk@58020 -
This commit is contained in:
juha 2018-05-24 08:51:10 +00:00
parent edb623c267
commit d5a918a748
2 changed files with 199 additions and 121 deletions

View File

@ -1,49 +1,60 @@
object ImageListEditorDlg: TImageListEditorDlg
Left = 453
Height = 424
Height = 484
Top = 144
Width = 671
Width = 617
BorderIcons = [biSystemMenu, biHelp]
Caption = 'ImagesList Editor'
ClientHeight = 424
ClientWidth = 671
Constraints.MinHeight = 345
Constraints.MinWidth = 520
ClientHeight = 484
ClientWidth = 617
Constraints.MinHeight = 394
Constraints.MinWidth = 560
OnClose = FormClose
OnCreate = FormCreate
OnResize = FormResize
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.9.0.0'
object GroupBoxR: TGroupBox
AnchorSideLeft.Control = GroupBoxL
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BtnPanel
Left = 376
Height = 380
Left = 364
Height = 440
Top = 6
Width = 289
Width = 247
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'Selected Image'
ClientHeight = 360
ClientWidth = 285
ClientHeight = 422
ClientWidth = 243
TabOrder = 1
object LabelTransparent: TLabel
Left = 110
Height = 15
Top = 253
Width = 97
Anchors = [akLeft, akBottom]
BorderSpacing.Around = 6
AnchorSideLeft.Control = RadioGroup
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = RadioGroup
Left = 86
Height = 14
Top = 316
Width = 91
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Left = 6
Caption = 'Transparent Color:'
ParentColor = False
end
object Preview: TScrollBox
AnchorSideLeft.Control = GroupBoxR
AnchorSideTop.Control = GroupBoxR
AnchorSideRight.Control = GroupBoxR
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = RadioGroup
Left = 6
Height = 238
Height = 304
Top = 6
Width = 272
Width = 231
HorzScrollBar.Increment = 1
HorzScrollBar.Page = 1
HorzScrollBar.Smooth = True
@ -53,30 +64,35 @@ object ImageListEditorDlg: TImageListEditorDlg
VertScrollBar.Smooth = True
VertScrollBar.Tracking = True
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 4
BorderSpacing.Around = 6
Color = clDefault
ParentColor = False
TabOrder = 0
end
object RadioGroup: TRadioGroup
Left = 7
Height = 105
Top = 250
Width = 96
AnchorSideLeft.Control = GroupBoxR
AnchorSideBottom.Control = GroupBoxR
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 100
Top = 316
Width = 74
Anchors = [akLeft, akBottom]
AutoFill = True
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Adjustment'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.TopBottomSpacing = 4
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousSpaceResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 85
ClientWidth = 92
ClientHeight = 82
ClientWidth = 70
Enabled = False
ItemIndex = 0
Items.Strings = (
@ -89,14 +105,16 @@ object ImageListEditorDlg: TImageListEditorDlg
TabOrder = 1
end
object ColorBoxTransparent: TColorBox
AnchorSideLeft.Control = LabelTransparent
AnchorSideTop.Control = LabelTransparent
AnchorSideTop.Side = asrBottom
Left = 110
Left = 86
Height = 22
Top = 274
Top = 334
Width = 96
Selected = clFuchsia
Style = [cbStandardColors, cbExtendedColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
BorderSpacing.Top = 4
Enabled = False
ItemHeight = 16
OnChange = ColorBoxTransparentClick
@ -108,142 +126,157 @@ object ImageListEditorDlg: TImageListEditorDlg
AnchorSideTop.Control = Owner
AnchorSideBottom.Control = BtnPanel
Left = 6
Height = 380
Height = 440
Top = 6
Width = 364
Width = 352
Anchors = [akTop, akLeft, akBottom]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Images'
ClientHeight = 360
ClientWidth = 360
ClientHeight = 422
ClientWidth = 348
TabOrder = 0
object BtnAdd: TButton
Tag = 1
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GroupBoxL
AnchorSideRight.Control = GroupBoxL
AnchorSideTop.Control = ImageListBox
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 4
Width = 156
Anchors = [akTop, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 4
Top = 6
Width = 57
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Right = 6
Caption = 'Add...'
OnClick = BtnAddClick
TabOrder = 0
end
object BtnClear: TButton
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnDelete
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 139
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 141
Width = 51
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = 'Clear'
OnClick = BtnClearClick
TabOrder = 3
end
object BtnDelete: TButton
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnReplaceAll
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 112
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 114
Width = 57
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = '&Delete'
OnClick = BtnDeleteClick
TabOrder = 2
end
object BtnMoveUp: TButton
Tag = -1
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnClear
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 166
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 168
Width = 68
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = 'Move Up'
OnClick = BtnMoveUpClick
TabOrder = 4
end
object BtnMoveDown: TButton
Tag = 1
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnMoveUp
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 193
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 195
Width = 82
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = 'Move Down'
OnClick = BtnMoveUpClick
TabOrder = 5
end
object BtnSave: TButton
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnMoveDown
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 220
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 222
Width = 62
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = 'Save...'
OnClick = BtnSaveClick
TabOrder = 6
end
object btnSaveAll: TButton
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnSave
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 247
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 249
Width = 76
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = 'Save All...'
OnClick = btnSaveAllClick
TabOrder = 7
end
object BtnReplace: TButton
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnAddMoreResolutions
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 58
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 60
Width = 76
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = '&Replace...'
OnClick = BtnReplaceClick
TabOrder = 1
@ -251,12 +284,14 @@ object ImageListEditorDlg: TImageListEditorDlg
object ImageListBox: TListBox
AnchorSideLeft.Control = GroupBoxL
AnchorSideTop.Control = GroupBoxL
Left = 4
Height = 351
Top = 4
Width = 188
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 4
AnchorSideBottom.Control = GroupBoxL
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 410
Top = 6
Width = 186
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Around = 6
ItemHeight = 0
OnDrawItem = ImageListBoxDrawItem
OnSelectionChange = ImageListBoxSelectionChange
@ -265,66 +300,74 @@ object ImageListEditorDlg: TImageListEditorDlg
TabOrder = 8
end
object btnAddNewResolution: TButton
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnSaveAll
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 274
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 276
Width = 130
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = 'Add new resolution...'
OnClick = btnAddNewResolutionClick
TabOrder = 9
end
object BtnReplaceAll: TButton
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnReplace
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 85
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 87
Width = 144
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = '&Replace all resolutions...'
OnClick = BtnReplaceClick
TabOrder = 10
end
object BtnAddMoreResolutions: TButton
Tag = 1
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BtnAdd
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 31
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 33
Width = 139
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = 'Add more resolutions...'
OnClick = BtnAddClick
TabOrder = 11
end
object btnDeleteResolution: TButton
AnchorSideLeft.Control = BtnAdd
AnchorSideLeft.Control = ImageListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnAddNewResolution
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BtnAdd
AnchorSideRight.Side = asrBottom
Left = 200
Left = 198
Height = 23
Top = 301
Width = 156
Anchors = [akTop, akLeft, akRight]
Top = 303
Width = 122
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 4
BorderSpacing.Right = 6
Caption = 'Delete resolution ...'
OnClick = btnDeleteResolutionClick
TabOrder = 12
@ -333,8 +376,8 @@ object ImageListEditorDlg: TImageListEditorDlg
object BtnPanel: TButtonPanel
Left = 6
Height = 26
Top = 392
Width = 659
Top = 452
Width = 605
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
@ -347,19 +390,19 @@ object ImageListEditorDlg: TImageListEditorDlg
ShowBevel = False
end
object ImageList: TImageList
Left = 216
Top = 246
left = 84
top = 211
end
object OpenDialog: TOpenPictureDialog
FilterIndex = 0
Options = [ofAllowMultiSelect, ofFileMustExist, ofEnableSizing, ofViewDetail, ofAutoPreview]
Left = 216
Top = 209
left = 84
top = 103
end
object SaveDialog: TSavePictureDialog
FilterIndex = 0
Options = [ofEnableSizing, ofViewDetail, ofAutoPreview]
Left = 252
Top = 209
left = 84
top = 159
end
end

View File

@ -86,6 +86,7 @@ type
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ImageListBoxDrawItem(Control: TWinControl; Index: Integer;
ARect: TRect; {%H-}State: TOwnerDrawState);
procedure btnAddNewResolutionClick(Sender: TObject);
@ -135,6 +136,23 @@ implementation
{$R *.lfm}
procedure AlignButtons(AButtons: array of TControl);
var
Button: TControl;
MaxWidth: Integer;
begin
// In designer:
// Left sides of buttons anchored to TListBox
// Right sides of buttons are not anchored
// Buttons, GroupBox: AutoSize=True
MaxWidth:=0;
for Button in AButtons do
if Button.Width > MaxWidth then
MaxWidth:=Button.Width;
for Button in AButtons do
Button.Constraints.MinWidth:=MaxWidth;
end;
function EditImageList(AImageList: TImageList): Boolean;
var
ImageListEditorDlg: TImageListEditorDlg;
@ -594,6 +612,23 @@ begin
SaveToImageList;
end;
procedure TImageListEditorDlg.FormShow(Sender: TObject);
begin
AlignButtons([
BtnAdd,
BtnAddMoreResolutions,
BtnReplace,
BtnReplaceAll,
BtnDelete,
BtnClear,
BtnMoveUp,
BtnMoveDown,
BtnSave,
btnSaveAll,
btnAddNewResolution,
btnDeleteResolution]);
end;
procedure TImageListEditorDlg.UpdatePreviewImage;
procedure DisablePreview;
begin