mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-08 06:57:29 +00:00
Merge pull request #6465 from keymanapp/feat/developer/2749-icon-editor-clear-all-button
feat(developer): add Clear All button to icon editor
This commit is contained in:
commit
551dbe4cdf
2 changed files with 37 additions and 18 deletions
|
|
@ -6,8 +6,8 @@ object frameBitmapEditor: TframeBitmapEditor
|
|||
TabOrder = 0
|
||||
TabStop = True
|
||||
object imgTransparent: TImage
|
||||
Left = 280
|
||||
Top = 252
|
||||
Left = 494
|
||||
Top = 251
|
||||
Width = 23
|
||||
Height = 23
|
||||
AutoSize = True
|
||||
|
|
@ -28,7 +28,7 @@ object frameBitmapEditor: TframeBitmapEditor
|
|||
Visible = False
|
||||
end
|
||||
object lblPixel: TLabel
|
||||
Left = 232
|
||||
Left = 302
|
||||
Top = 256
|
||||
Width = 3
|
||||
Height = 13
|
||||
|
|
@ -316,7 +316,7 @@ object frameBitmapEditor: TframeBitmapEditor
|
|||
'$00999999'
|
||||
'$00666666'
|
||||
'$00333333')
|
||||
HintFormat =
|
||||
HintFormat =
|
||||
'RGB(%r, %g, %b) '#13'Hex: %hex Click for foreground Shift+Click for ' +
|
||||
'background'
|
||||
AutoHeight = True
|
||||
|
|
@ -848,7 +848,6 @@ object frameBitmapEditor: TframeBitmapEditor
|
|||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
TabOrder = 7
|
||||
ExplicitTop = 7
|
||||
object ppReadOnlyIcons: TPaintPanel
|
||||
Left = 0
|
||||
Top = 154
|
||||
|
|
@ -857,10 +856,8 @@ object frameBitmapEditor: TframeBitmapEditor
|
|||
OnPaint = ppReadOnlyIconsPaint
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
ExplicitLeft = 10
|
||||
ExplicitTop = 146
|
||||
ExplicitWidth = 519
|
||||
ExplicitHeight = 101
|
||||
ExplicitLeft = -85
|
||||
ExplicitTop = 249
|
||||
end
|
||||
object panReadOnlyIconsTop: TPanel
|
||||
Left = 0
|
||||
|
|
@ -879,7 +876,7 @@ object frameBitmapEditor: TframeBitmapEditor
|
|||
Width = 492
|
||||
Height = 41
|
||||
AutoSize = False
|
||||
Caption =
|
||||
Caption =
|
||||
'This icon file is read only because it either contains multiple ' +
|
||||
'image resources, has a size other than 16x16 pixels, or a colour' +
|
||||
' depth > 256 pixels'
|
||||
|
|
@ -895,6 +892,15 @@ object frameBitmapEditor: TframeBitmapEditor
|
|||
end
|
||||
end
|
||||
end
|
||||
object cmdClearAll: TButton
|
||||
Left = 224
|
||||
Top = 252
|
||||
Width = 73
|
||||
Height = 25
|
||||
Caption = '&Clear all'
|
||||
TabOrder = 8
|
||||
OnClick = cmdClearAllClick
|
||||
end
|
||||
object ilCmds: TImageList
|
||||
Left = 84
|
||||
Top = 36
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ type
|
|||
memoReadOnlyIcons: TMemo;
|
||||
ppReadOnlyIcons: TPaintPanel;
|
||||
panReadOnlyIconsTop: TPanel;
|
||||
cmdClearAll: TButton;
|
||||
procedure panEditMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure panEditMouseMove(Sender: TObject; Shift: TShiftState; X,
|
||||
|
|
@ -120,6 +121,7 @@ type
|
|||
procedure cmdExportClick(Sender: TObject);
|
||||
procedure cmdImportClick(Sender: TObject);
|
||||
procedure ppReadOnlyIconsPaint(Sender: TObject);
|
||||
procedure cmdClearAllClick(Sender: TObject);
|
||||
private
|
||||
FReadOnlyIcons: array of TGraphic;
|
||||
FRSP21318IsPngIcon: Boolean;
|
||||
|
|
@ -542,6 +544,11 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TframeBitmapEditor.cmdClearAllClick(Sender: TObject);
|
||||
begin
|
||||
ClearSelection;
|
||||
end;
|
||||
|
||||
procedure TframeBitmapEditor.cmdClick(Sender: TObject);
|
||||
begin
|
||||
FEdit.IsTemp := False;
|
||||
|
|
@ -1156,7 +1163,7 @@ begin
|
|||
except
|
||||
on E:Exception do // I3147 - I don't want to use E:Exception but see http://marc.durdin.net/2012/01/how-not-to-do-exception-classes-in.html // I3508
|
||||
begin
|
||||
ShowMessage('The image file could not be imported because it is not a valid PNG file.');
|
||||
ShowMessage('The image file could not be imported because it is not a valid PNG file: '+E.Message);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
|
@ -1238,21 +1245,27 @@ end;
|
|||
|
||||
procedure TframeBitmapEditor.Clear;
|
||||
begin
|
||||
Modified := False;
|
||||
FBitmaps[bebEdit].Canvas.Brush.Color := BGColour;
|
||||
FBitmaps[bebEdit].Canvas.FillRect(Rect(0,0,16,16));
|
||||
ClearSelection;
|
||||
FEdit.IsTemp := False;
|
||||
panEdit.RePaint;
|
||||
panPreview.RePaint;
|
||||
SaveUndoBitmap;
|
||||
end;
|
||||
|
||||
procedure TframeBitmapEditor.ClearSelection;
|
||||
var
|
||||
hObject: THandle;
|
||||
FColor: DWord;
|
||||
begin
|
||||
Modified := True;
|
||||
SaveUndoBitmap;
|
||||
FBitmaps[bebEdit].Canvas.Brush.Color := BGColour;
|
||||
FBitmaps[bebEdit].Canvas.FillRect(Rect(0,0,16,16));
|
||||
|
||||
if BGColour = clTransparent
|
||||
then FColor := TransparentReplacementColour
|
||||
else FColor := BGColour;
|
||||
|
||||
hObject := CreateSolidBrush(FColor);
|
||||
Windows.FillRect(FBitmaps[bebEdit].Canvas.Handle, Rect(0,0,16,16), hObject);
|
||||
DeleteObject(hObject);
|
||||
|
||||
panEdit.RePaint;
|
||||
panPreview.RePaint;
|
||||
end;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue