Procházet zdrojové kódy

change modifier keys depending on OS, init variables on create

circular17 před 6 roky
rodič
revize
fd052b7afe

+ 3 - 3
lazpaint/lazpaintinstance.pas

@@ -113,7 +113,7 @@ type
     procedure Init(AEmbedded: boolean);
     procedure SetBlackAndWhite(AValue: boolean); override;
     procedure OnStackChanged({%H-}sender: TLazPaintImage; AScrollIntoView: boolean);
-    procedure OnToolPopup({%H-}sender: TToolManager; AMessage: TToolPopupMessage);
+    procedure OnToolPopup({%H-}sender: TToolManager; AMessage: TToolPopupMessage; AKey: Word);
 
     function GetImageListWindowHeight: integer; override;
     function GetImageListWindowWidth: integer; override;
@@ -484,7 +484,7 @@ begin
     FLayerStack.InvalidateStack(AScrollIntoView);
 end;
 
-procedure TLazPaintInstance.OnToolPopup(sender: TToolManager; AMessage: TToolPopupMessage);
+procedure TLazPaintInstance.OnToolPopup(sender: TToolManager; AMessage: TToolPopupMessage; AKey: Word);
 var messageStr: string;
     idx: integer;
 begin
@@ -496,7 +496,7 @@ begin
     else
       exit;
   end;
-  messageStr := ToolPopupMessageToStr(AMessage);
+  messageStr := ToolPopupMessageToStr(AMessage, AKey);
   if messageStr <> '' then
     MessagePopup(messageStr,4000);
 end;

+ 37 - 6
lazpaint/lazpaintmainform.pas

@@ -715,7 +715,7 @@ type
     initialized: boolean;
     shouldArrangeOnResize: boolean;
     btnLeftDown, btnRightDown, btnMiddleDown: boolean;
-    spacePressed: boolean;
+    spacePressed, altPressed, snapPressed, shiftPressed: boolean;
     FormMouseMovePos: TPoint;
     InFormMouseMove: boolean;
     InFormPaint: boolean;
@@ -796,6 +796,7 @@ type
     procedure LabelAutosize(ALabel: TLabel);
     procedure AskMergeSelection(ACaption: string);
     procedure ReleaseMouseButtons(Shift: TShiftState);
+    procedure UpdateSpecialKeys({%H-}Shift: TShiftState);
     procedure UpdateCurveModeToolbar;
     function ShowOpenTextureDialog: boolean;
     procedure ShowNoPicture;
@@ -910,6 +911,10 @@ begin
   btnRightDown := false;
   btnMiddleDown:= false;
   FTablet := TLazTablet.Create(self);
+  spacePressed:= false;
+  altPressed:= false;
+  snapPressed:= false;
+  shiftPressed:= false;
 
   //recursive calls
   InFormMouseMove:= false;
@@ -1138,8 +1143,6 @@ end;
 
 procedure TFMain.FormMouseDown(Sender: TObject; Button: TMouseButton;
   Shift: TShiftState; X, Y: Integer);
-var
-  switchButton: Boolean;
 begin
   if not Assigned(FImageView) then exit;
   ReleaseMouseButtons(Shift);
@@ -1155,10 +1158,9 @@ begin
   if Button = mbMiddle then
   begin
     btnMiddleDown:= true;
-    if not ToolManager.ToolSleeping then ToolManager.ToolSleep;
+    if not ToolManager.ToolSleeping and not (ssAlt in Shift) then ToolManager.ToolSleep;
   end;
-  switchButton := ssAlt in Shift;
-  if ToolManager.ToolDown(FImageView.FormToBitmap(X,Y),btnRightDown xor switchButton,CurrentPressure) then
+  if ToolManager.ToolDown(FImageView.FormToBitmap(X,Y),btnRightDown,CurrentPressure) then
       PaintPictureNow;
   UpdateToolbar;
 end;
@@ -1174,6 +1176,7 @@ begin
   if not Assigned(FImageView) then exit;
 
   ReleaseMouseButtons(Shift);
+  UpdateSpecialKeys(Shift);
   HidePenPreview;
   if LazPaintInstance.TopMostHasFocus then
   begin
@@ -1641,6 +1644,9 @@ procedure TFMain.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
   );
 begin
   try
+    if Key = VK_MENU then altPressed:= true
+    else if (Key = VK_SNAP) or (Key = VK_SNAP2) then snapPressed:= true
+    else if Key = VK_SHIFT then shiftPressed:= true;
     if Zoom.EditingZoom then exit;
     if not ((CurrentTool = ptText) and TextSpinEditFocused and (Key = VK_BACK)) and ToolManager.ToolKeyDown(Key) then
     begin
@@ -2026,6 +2032,9 @@ end;
 
 procedure TFMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
 begin
+  if Key = VK_MENU then altPressed:= false
+  else if (Key = VK_SNAP) or (Key = VK_SNAP2) then snapPressed:= false
+  else if Key = VK_SHIFT then shiftPressed:= false;
   if ToolManager.ToolKeyUp(Key) then
   begin
     DelayedPaintPicture := True;
@@ -3310,6 +3319,28 @@ begin
   end;
 end;
 
+procedure TFMain.UpdateSpecialKeys(Shift: TShiftState);
+  procedure UpdateKey(AShift: TShiftStateEnum; ACode: Word; var APressed: boolean);
+  begin
+    if (AShift in Shift) and not APressed then
+    begin
+      if ToolManager.ToolKeyDown(ACode) then PaintPictureNow;
+      APressed:= true;
+    end else
+    if not (AShift in Shift) and APressed then
+    begin
+      if ToolManager.ToolKeyUp(ACode) then PaintPictureNow;
+      APressed:= false;
+    end;
+  end;
+begin
+  {$IFDEF DARWIN}
+  UpdateKey(ssSnap, VK_SNAP, snapPressed);
+  UpdateKey(ssAlt, VK_MENU, altPressed);
+  UpdateKey(ssShift, VK_SHIFT, shiftPressed);
+  {$ENDIF}
+end;
+
 function TFMain.ShowOpenTextureDialog: boolean;
 var newTex: TBGRABitmap;
   texFilename: string;

+ 12 - 12
lazpaint/release/bin/i18n/lazpaint.ar.po

@@ -1558,9 +1558,9 @@ msgstr "الكل"
 msgid "All supported filetypes"
 msgstr "كل الملفات المدعمة"
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
-msgstr "إضغط ALT او SHIFT للتحريف"
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
+msgstr "إضغط %1 او %2 للتحريف"
 
 #: uresourcestrings.rsanimatedgif
 msgid "Animated GIF"
@@ -1675,9 +1675,9 @@ msgstr "جيب التمام"
 msgid "Crop"
 msgstr "محصول"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
-msgstr "إضغط CTRL لتقييد زاوية الدوران"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
+msgstr "إضغط %1 لتقييد زاوية الدوران"
 
 #: uresourcestrings.rscurvemodehint
 msgid "Press S or X to set the curve mode of the last point"
@@ -1840,13 +1840,13 @@ msgstr ""
 msgid "Half-cosine"
 msgstr "نصف - جيب التمام"
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
-msgstr "إضغط CTRL لالتقاط إلى بكسل"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
+msgstr "إضغط %1 لالتقاط إلى بكسل"
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
-msgstr "إضغط على SHIFT لرسم مربع او دائرة"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
+msgstr "إضغط على %1 لرسم مربع او دائرة"
 
 #: uresourcestrings.rshotspot
 msgctxt "uresourcestrings.rshotspot"

+ 12 - 12
lazpaint/release/bin/i18n/lazpaint.cs.po

@@ -1555,9 +1555,9 @@ msgstr "všechny"
 msgid "All supported filetypes"
 msgstr "Všechny podporované formáty souborů"
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
-msgstr "Držte ALT nebo SHIFT pro měřítko "
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
+msgstr "Držte %1 nebo %2 pro měřítko "
 
 #: uresourcestrings.rsanimatedgif
 msgid "Animated GIF"
@@ -1672,9 +1672,9 @@ msgstr "Kosinus"
 msgid "Crop"
 msgstr "Oříznout"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
-msgstr "Přidržte CTRL pro omezení úhlu otočení"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
+msgstr "Přidržte %1 pro omezení úhlu otočení"
 
 #: uresourcestrings.rscurvemodehint
 msgid "Press S or X to set the curve mode of the last point"
@@ -1837,13 +1837,13 @@ msgstr ""
 msgid "Half-cosine"
 msgstr "Poloviční-kosinus"
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
-msgstr "Přidržte CTRL pro přichycení k bodům"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
+msgstr "Přidržte %1 pro přichycení k bodům"
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
-msgstr "Přidržte SHIFT pro kreslení čtverce nebo kruhu"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
+msgstr "Přidržte %1 pro kreslení čtverce nebo kruhu"
 
 #: uresourcestrings.rshotspot
 msgctxt "uresourcestrings.rshotspot"

+ 28 - 12
lazpaint/release/bin/i18n/lazpaint.de.po

@@ -1571,9 +1571,13 @@ msgstr "alle"
 msgid "All supported filetypes"
 msgstr "Alle unterstützten Dateitypen"
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
-msgstr "Halten Sie ALT oder UMSCHALT zum Skalieren"
+#: uresourcestrings.rsalt
+msgid "ALT"
+msgstr "ALT"
+
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
+msgstr "Halten Sie %1 oder %2 zum Skalieren"
 
 #: uresourcestrings.rsanimatedgif
 msgid "Animated GIF"
@@ -1688,9 +1692,17 @@ msgstr "Kosinus"
 msgid "Crop"
 msgstr "Beschneiden"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
-msgstr "Halten Sie STRG für stufenweise Drehung"
+#: uresourcestrings.rsctrl
+msgid "CTRL"
+msgstr "STRG"
+
+#: uresourcestrings.rscmd
+msgid "CMD"
+msgstr "CMD"
+
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
+msgstr "Halten Sie %1 für stufenweise Drehung"
 
 #: uresourcestrings.rscurvemodehint
 msgid "Press S or X to set the curve mode of the last point"
@@ -1853,13 +1865,17 @@ msgstr "Grün"
 msgid "Half-cosine"
 msgstr "Halber Kosinus"
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
-msgstr "Halten Sie STRG zum Ausrichten am raster"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
+msgstr "Halten Sie %1 zum Ausrichten am raster"
+
+#: uresourcestrings.rsshift
+msgid "SHIFT"
+msgstr "UMSCHALT"
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
-msgstr "Halten Sie UMSCHALT für ein Quadrat / einen Kreis"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
+msgstr "Halten Sie %2 für ein Quadrat / einen Kreis"
 
 #: uresourcestrings.rshotspot
 msgctxt "uresourcestrings.rshotspot"

+ 12 - 12
lazpaint/release/bin/i18n/lazpaint.es.po

@@ -1549,9 +1549,9 @@ msgstr "todo"
 msgid "All supported filetypes"
 msgstr "Todos los tipos soportados"
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
-msgstr "Manten ALT o SHIFT para escalar"
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
+msgstr "Manten %1 o %2 para escalar"
 
 #: uresourcestrings.rsanimatedgif
 msgid "Animated GIF"
@@ -1669,9 +1669,9 @@ msgstr "Coseno"
 msgid "Crop"
 msgstr "Cortar"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
-msgstr "Manten CTRL para restringir el ángulo de rotación"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
+msgstr "Manten %1 para restringir el ángulo de rotación"
 
 #: uresourcestrings.rscurvemodehint
 msgid "Press S or X to set the curve mode of the last point"
@@ -1840,13 +1840,13 @@ msgctxt "uresourcestrings.rshalfcosine"
 msgid "Half-cosine"
 msgstr "Medio-coseno"
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
-msgstr "Manten CTRL para ajustar a los pixeles"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
+msgstr "Manten %1 para ajustar a los pixeles"
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
-msgstr "Manten SHIFT para dibujar un cuadrado o un circulo"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
+msgstr "Manten %1 para dibujar un cuadrado o un circulo"
 
 #: uresourcestrings.rshotspot
 msgctxt "uresourcestrings.rshotspot"

+ 8 - 8
lazpaint/release/bin/i18n/lazpaint.fi.po

@@ -1546,8 +1546,8 @@ msgstr "kaikki"
 msgid "All supported filetypes"
 msgstr "Kaikki tuetut tiedostotyypit"
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %A to scale"
 msgstr ""
 
 #: uresourcestrings.rsanimatedgif
@@ -1663,8 +1663,8 @@ msgstr ""
 msgid "Crop"
 msgstr ""
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
 msgstr ""
 
 #: uresourcestrings.rscurvemodehint
@@ -1828,12 +1828,12 @@ msgstr "Vihreä"
 msgid "Half-cosine"
 msgstr ""
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
 msgstr ""
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
 msgstr ""
 
 #: uresourcestrings.rshotspot

+ 28 - 12
lazpaint/release/bin/i18n/lazpaint.fr.po

@@ -1559,9 +1559,13 @@ msgstr "tout"
 msgid "All supported filetypes"
 msgstr "Tous les formats connus"
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
-msgstr "Appuyez sur ALT et MAJ pour étirer"
+#: uresourcestrings.rsalt
+msgid "ALT"
+msgstr "ALT"
+
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
+msgstr "Appuyez sur %1 et %2 pour étirer"
 
 #: uresourcestrings.rsanimatedgif
 msgid "Animated GIF"
@@ -1679,9 +1683,17 @@ msgstr "Cosinus"
 msgid "Crop"
 msgstr "Recadrer"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
-msgstr "Maintenir CTRL pour restreindre l'angle de rotation"
+#: uresourcestrings.rsctrl
+msgid "CTRL"
+msgstr "CTRL"
+
+#: uresourcestrings.rscmd
+msgid "CMD"
+msgstr "CMD"
+
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
+msgstr "Maintenir %1 pour restreindre l'angle de rotation"
 
 #: uresourcestrings.rscurvemodehint
 msgid "Press S or X to set the curve mode of the last point"
@@ -1850,13 +1862,17 @@ msgctxt "uresourcestrings.rshalfcosine"
 msgid "Half-cosine"
 msgstr "Semi-cosinus"
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
-msgstr "Maintenir CTRL pour aligner aux pixels"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
+msgstr "Maintenir %1 pour aligner aux pixels"
+
+#: uresourcestrings.rsshift
+msgid "SHIFT"
+msgstr "MAJ"
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
-msgstr "Maintenir MAJ pour dessiner un carré ou un cercle"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
+msgstr "Maintenir %1 pour dessiner un carré ou un cercle"
 
 #: uresourcestrings.rshotspot
 msgctxt "uresourcestrings.rshotspot"

+ 8 - 8
lazpaint/release/bin/i18n/lazpaint.ja.po

@@ -1558,8 +1558,8 @@ msgstr ""
 msgid "All supported filetypes"
 msgstr ""
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
 msgstr ""
 
 #: uresourcestrings.rsanimatedgif
@@ -1675,8 +1675,8 @@ msgstr "コサイン"
 msgid "Crop"
 msgstr "切り抜く"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
 msgstr ""
 
 #: uresourcestrings.rscurvemodehint
@@ -1840,12 +1840,12 @@ msgstr ""
 msgid "Half-cosine"
 msgstr "Half-cosine"
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
 msgstr ""
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
 msgstr ""
 
 #: uresourcestrings.rshotspot

+ 12 - 12
lazpaint/release/bin/i18n/lazpaint.lv.po

@@ -1556,9 +1556,9 @@ msgstr "visi"
 msgid "All supported filetypes"
 msgstr "Visi atbalstītie failu formāti"
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
-msgstr "Turi [ALT] vai [SHIFT] lai mērogotu"
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
+msgstr "Turi %1 vai %2 lai mērogotu"
 
 #: uresourcestrings.rsanimatedgif
 msgid "Animated GIF"
@@ -1673,9 +1673,9 @@ msgstr ""
 msgid "Crop"
 msgstr "Apcirpt"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
-msgstr "Turi [CTRL] lai izmantotu noteiktus leņķus"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
+msgstr "Turi %1 lai izmantotu noteiktus leņķus"
 
 #: uresourcestrings.rscurvemodehint
 msgid "Press S or X to set the curve mode of the last point"
@@ -1838,13 +1838,13 @@ msgstr "Zaļš"
 msgid "Half-cosine"
 msgstr ""
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
-msgstr "Turi [CTRL], lai pieliptu pikseļiem"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
+msgstr "Turi %1, lai pieliptu pikseļiem"
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
-msgstr "Turi [SHIFT} lai zīmētu kvadrātu vai apli"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
+msgstr "Turi %1 lai zīmētu kvadrātu vai apli"
 
 #: uresourcestrings.rshotspot
 msgctxt "uresourcestrings.rshotspot"

+ 12 - 12
lazpaint/release/bin/i18n/lazpaint.nl.po

@@ -1588,9 +1588,9 @@ msgstr "alles"
 msgid "All supported filetypes"
 msgstr "Alle ondersteunde bestandstypes"
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
-msgstr "Houd ALT of SHIFT vast om te schalen"
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
+msgstr "Houd %1 of %2 vast om te schalen"
 
 #: uresourcestrings.rsanimatedgif
 msgid "Animated GIF"
@@ -1705,9 +1705,9 @@ msgstr "Cosinus"
 msgid "Crop"
 msgstr "Bijsnijden"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
-msgstr "Houd CTRL ingedrukt om rotatiehoek te beperken"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
+msgstr "Houd %2 ingedrukt om rotatiehoek te beperken"
 
 #: uresourcestrings.rscurvemodehint
 msgid "Press S or X to set the curve mode of the last point"
@@ -1870,13 +1870,13 @@ msgstr "Groen"
 msgid "Half-cosine"
 msgstr "Half-cosinus"
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
-msgstr "Houd CTRL ingedrukt om op pixels vast te kleven"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
+msgstr "Houd %1 ingedrukt om op pixels vast te kleven"
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
-msgstr "Houd SHIFT ingedrukt om een vierkant of cirkel te tekenen"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
+msgstr "Houd %1 ingedrukt om een vierkant of cirkel te tekenen"
 
 #: uresourcestrings.rshotspot
 msgctxt "uresourcestrings.rshotspot"

+ 8 - 8
lazpaint/release/bin/i18n/lazpaint.po

@@ -1538,8 +1538,8 @@ msgstr ""
 msgid "All supported filetypes"
 msgstr ""
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
 msgstr ""
 
 #: uresourcestrings.rsanimatedgif
@@ -1655,8 +1655,8 @@ msgstr ""
 msgid "Crop"
 msgstr ""
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
 msgstr ""
 
 #: uresourcestrings.rscurvemodehint
@@ -1820,12 +1820,12 @@ msgstr ""
 msgid "Half-cosine"
 msgstr ""
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
 msgstr ""
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
 msgstr ""
 
 #: uresourcestrings.rshotspot

+ 12 - 12
lazpaint/release/bin/i18n/lazpaint.pt_BR.po

@@ -1560,9 +1560,9 @@ msgstr "todos"
 msgid "All supported filetypes"
 msgstr ""
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
-msgstr "Pressione ALT ou SHIFT para alongar"
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
+msgstr "Pressione %1 ou %2 para alongar"
 
 #: uresourcestrings.rsanimatedgif
 msgid "Animated GIF"
@@ -1677,9 +1677,9 @@ msgstr "Co-seno"
 msgid "Crop"
 msgstr "Cortar"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
-msgstr "Segurar Ctrl para restringir o ângulo de rotação"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
+msgstr "Segurar %1 para restringir o ângulo de rotação"
 
 #: uresourcestrings.rscurvemodehint
 msgid "Press S or X to set the curve mode of the last point"
@@ -1842,13 +1842,13 @@ msgstr ""
 msgid "Half-cosine"
 msgstr "Meio-cosseno"
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
-msgstr "Segurar CTRL para tirar pixels"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
+msgstr "Segurar %1 para tirar pixels"
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
-msgstr "Segurar SHIFT para desenhar um quadrado ou um círculo"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
+msgstr "Segurar %1 para desenhar um quadrado ou um círculo"
 
 #: uresourcestrings.rshotspot
 msgctxt "uresourcestrings.rshotspot"

+ 12 - 12
lazpaint/release/bin/i18n/lazpaint.ru.po

@@ -1556,9 +1556,9 @@ msgstr "все"
 msgid "All supported filetypes"
 msgstr ""
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
-msgstr "Удерживайте ALT или SHIFT для масштабирования"
+#: uresourcestrings.rsohldkeysscalemode
+msgid "Hold %1 or %2 to scale"
+msgstr "Удерживайте %1 или %2 для масштабирования"
 
 #: uresourcestrings.rsanimatedgif
 msgid "Animated GIF"
@@ -1673,9 +1673,9 @@ msgstr "Косинус"
 msgid "Crop"
 msgstr "Обрезать"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
-msgstr "Удерживайте CTRL для ограничения угла поворота"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
+msgstr "Удерживайте %1 для ограничения угла поворота"
 
 #: uresourcestrings.rscurvemodehint
 msgid "Press S or X to set the curve mode of the last point"
@@ -1838,13 +1838,13 @@ msgstr ""
 msgid "Half-cosine"
 msgstr "Полу-косинус"
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
-msgstr "Удерживайте CTRL для привязки к пикселям"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
+msgstr "Удерживайте %1 для привязки к пикселям"
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
-msgstr "Удерживайте SHIFT для рисования квадрата или круга"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
+msgstr "Удерживайте %1 для рисования квадрата или круга"
 
 #: uresourcestrings.rshotspot
 msgctxt "uresourcestrings.rshotspot"

+ 8 - 8
lazpaint/release/bin/i18n/lazpaint.sv.po

@@ -1542,8 +1542,8 @@ msgstr ""
 msgid "All supported filetypes"
 msgstr ""
 
-#: uresourcestrings.rsaltshiftscalemode
-msgid "Hold ALT or SHIFT to scale"
+#: uresourcestrings.rsholdkeysscalemode
+msgid "Hold %1 or %2 to scale"
 msgstr ""
 
 #: uresourcestrings.rsanimatedgif
@@ -1659,8 +1659,8 @@ msgstr "Cosine"
 msgid "Crop"
 msgstr "Beskär"
 
-#: uresourcestrings.rsctrlrestrictrotation
-msgid "Hold CTRL to restrict rotation angle"
+#: uresourcestrings.rsholdkeyrestrictrotation
+msgid "Hold %1 to restrict rotation angle"
 msgstr ""
 
 #: uresourcestrings.rscurvemodehint
@@ -1824,12 +1824,12 @@ msgstr ""
 msgid "Half-cosine"
 msgstr "Halv-cosine"
 
-#: uresourcestrings.rsholdctrlsnaptopixel
-msgid "Hold CTRL to snap to pixels"
+#: uresourcestrings.rsholdkeysnaptopixel
+msgid "Hold %1 to snap to pixels"
 msgstr ""
 
-#: uresourcestrings.rsholdshiftforsquare
-msgid "Hold SHIFT to draw a square or a circle"
+#: uresourcestrings.rsholdkeyforsquare
+msgid "Hold %1 to draw a square or a circle"
 msgstr ""
 
 #: uresourcestrings.rshotspot

+ 28 - 13
lazpaint/tools/utool.pas

@@ -9,6 +9,11 @@ uses
   ULayerAction, LCLType, Controls, UBrushType, UConfig, LCVectorPolyShapes,
   BGRAGradientScanner, BGRALayerOriginal, LCVectorRectShapes;
 
+const
+  VK_SNAP = {$IFDEF DARWIN}VK_LWIN{$ELSE}VK_CONTROL{$ENDIF};
+  VK_SNAP2 = {$IFDEF DARWIN}VK_RWIN{$ELSE}VK_CONTROL{$ENDIF};
+  ssSnap = {$IFDEF DARWIN}ssMeta{$ELSE}ssCtrl{$ENDIF};
+
 type TPaintToolType = (ptHand,ptHotSpot, ptMoveLayer,ptRotateLayer,ptZoomLayer,
                    ptPen, ptBrush, ptClone, ptColorPicker, ptEraser,
                    ptEditShape, ptRect, ptEllipse, ptPolygon, ptSpline,
@@ -120,13 +125,13 @@ type
 
   TToolClass = class of TGenericTool;
 
-  TToolPopupMessage= (tpmNone,tpmHoldShiftForSquare, tpmHoldCtrlSnapToPixel,
-    tpmReturnValides, tpmBackspaceRemoveLastPoint, tpmCtrlRestrictRotation,
-    tpmAltShiftScaleMode, tpmCurveModeHint, tpmBlendOpBackground,
+  TToolPopupMessage= (tpmNone,tpmHoldKeyForSquare, tpmHoldKeySnapToPixel,
+    tpmReturnValides, tpmBackspaceRemoveLastPoint, tpmHoldKeyRestrictRotation,
+    tpmHoldKeysScaleMode, tpmCurveModeHint, tpmBlendOpBackground,
     tpmRightClickForSource);
 
   TOnToolChangedHandler = procedure(sender: TToolManager; ANewToolType: TPaintToolType) of object;
-  TOnPopupToolHandler = procedure(sender: TToolManager; APopupMessage: TToolPopupMessage) of object;
+  TOnPopupToolHandler = procedure(sender: TToolManager; APopupMessage: TToolPopupMessage; AKey: Word) of object;
 
   TShapeOption = (toAliasing, toDrawShape, toFillShape, toCloseShape);
   TShapeOptions = set of TShapeOption;
@@ -289,7 +294,7 @@ type
     procedure ToolOpen;
     function ToolUpdate: boolean;
     function ToolUpdateNeeded: boolean;
-    procedure ToolPopup(AMessage: TToolPopupMessage);
+    procedure ToolPopup(AMessage: TToolPopupMessage; AKey: Word = 0);
     procedure HintReturnValidates;
 
     function IsSelectingTool: boolean;
@@ -371,7 +376,7 @@ type
    end;
 
 procedure RegisterTool(ATool: TPaintToolType; AClass: TToolClass);
-function ToolPopupMessageToStr(AMessage :TToolPopupMessage): string;
+function ToolPopupMessageToStr(AMessage :TToolPopupMessage; AKey: Word = 0): string;
 
 implementation
 
@@ -424,15 +429,25 @@ begin
   PaintTools[ATool] := AClass;
 end;
 
-function ToolPopupMessageToStr(AMessage: TToolPopupMessage): string;
+function ReplaceKey(AText: string; AKey: Word; AParam: integer = 1): string;
+begin
+  if AKey = VK_SHIFT then result := StringReplace(AText, '%'+inttostr(AParam), rsShift, []) else
+  if AKey = VK_CONTROL then result := StringReplace(AText, '%'+inttostr(AParam), rsCtrl, []) else
+  if AKey = VK_MENU then result := StringReplace(AText, '%'+inttostr(AParam), rsAlt, []) else
+  if AKey = VK_LWIN then result := StringReplace(AText, '%'+inttostr(AParam), rsCmd, []) else
+    result := AText;
+
+end;
+
+function ToolPopupMessageToStr(AMessage: TToolPopupMessage; AKey: Word = 0): string;
 begin
   case AMessage of
-  tpmHoldShiftForSquare: result := rsHoldShiftForSquare;
-  tpmHoldCtrlSnapToPixel: result := rsHoldCtrlSnapToPixel;
+  tpmHoldKeyForSquare: result := ReplaceKey(rsHoldKeyForSquare, AKey);
+  tpmHoldKeySnapToPixel: result := ReplaceKey(rsHoldKeySnapToPixel, AKey);
   tpmReturnValides: result := rsReturnValides;
   tpmBackspaceRemoveLastPoint: result := rsBackspaceRemoveLastPoint;
-  tpmCtrlRestrictRotation: result := rsCtrlRestrictRotation;
-  tpmAltShiftScaleMode: result := rsAltShiftScaleMode;
+  tpmHoldKeyRestrictRotation: result := ReplaceKey(rsHoldKeyRestrictRotation, AKey);
+  tpmHoldKeysScaleMode: result := ReplaceKey(ReplaceKey(rsHoldKeysScaleMode, AKey, 2), VK_MENU);
   tpmCurveModeHint: result := rsCurveModeHint;
   tpmBlendOpBackground: result := rsBlendOpNotUsedForBackground;
   tpmRightClickForSource: result := rsRightClickForSource;
@@ -1822,10 +1837,10 @@ begin
     result := true;
 end;
 
-procedure TToolManager.ToolPopup(AMessage: TToolPopupMessage);
+procedure TToolManager.ToolPopup(AMessage: TToolPopupMessage; AKey: Word = 0);
 begin
   if Assigned(FOnPopupToolHandler) then
-    FOnPopupToolHandler(self, AMessage);
+    FOnPopupToolHandler(self, AMessage, AKey);
 end;
 
 function TToolManager.IsSelectingTool: boolean;

+ 12 - 5
lazpaint/tools/utoolbasic.pas

@@ -23,6 +23,7 @@ type
     procedure DoToolMoveAfter(pt: TPoint; {%H-}ptF: TPointF); override;
     function GetStatusText: string; override;
   public
+    constructor Create(AManager: TToolManager); override;
     function ToolUp: TRect; override;
   end;
 
@@ -305,12 +306,11 @@ begin
     result := EmptyRect;
 end;
 
-function TToolPen.DoToolMove(toolDest: TBGRABitmap; pt: TPoint; ptF: TPointF
-  ): TRect;
+function TToolPen.DoToolMove(toolDest: TBGRABitmap; pt: TPoint; ptF: TPointF): TRect;
 begin
   if (manager.PenWidth <= 3) and not HintShowed then
   begin
-    Manager.ToolPopup(tpmHoldCtrlSnapToPixel);
+    Manager.ToolPopup(tpmHoldKeySnapToPixel, VK_SNAP);
     HintShowed:= true;
   end;
   if snapToPixel then ptF := PointF(pt.X,pt.Y);
@@ -326,11 +326,12 @@ end;
 constructor TToolPen.Create(AManager: TToolManager);
 begin
   inherited Create(AManager);
+  snapToPixel:= false;
 end;
 
 function TToolPen.ToolKeyDown(var key: Word): TRect;
 begin
-  if key = VK_CONTROL then
+  if key = VK_SNAP then
   begin
     snapToPixel := true;
     Key := 0;
@@ -340,7 +341,7 @@ end;
 
 function TToolPen.ToolKeyUp(var key: Word): TRect;
 begin
-  if key = VK_CONTROL then
+  if key = VK_SNAP then
   begin
     snapToPixel := false;
     key := 0;
@@ -479,6 +480,12 @@ begin
   end;
 end;
 
+constructor TToolHand.Create(AManager: TToolManager);
+begin
+  inherited Create(AManager);
+  handMoving := false;
+end;
+
 function TToolHand.ToolUp: TRect;
 begin
   handMoving := false;

+ 3 - 3
lazpaint/tools/utooldeformationgrid.pas

@@ -398,7 +398,7 @@ var n: integer;
 begin
   if not FHintShowed then
   begin
-    Manager.ToolPopup(tpmAltShiftScaleMode);
+    Manager.ToolPopup(tpmHoldKeysScaleMode, VK_SHIFT);
     FHintShowed:= true;
   end;
   result := EmptyRect;
@@ -576,7 +576,7 @@ begin
     key := 0;
   end
   else
-  if Key = VK_CONTROL then
+  if Key = VK_SNAP then
   begin
     snapToPixel:= true;
     key := 0;
@@ -614,7 +614,7 @@ end;
 function TToolTextureMapping.ToolKeyUp(var key: Word): TRect;
 begin
   result := EmptyRect;
-  if Key = VK_CONTROL then
+  if Key = VK_SNAP then
   begin
     snapToPixel:= false;
     key := 0;

+ 9 - 9
lazpaint/tools/utoollayer.pas

@@ -63,7 +63,7 @@ type
     FPreviousFilter: TResampleFilter;
     FTransforming: boolean;
     FPreviousMousePos: TPointF;
-    FCtrlDown: boolean;
+    FSnapDown: boolean;
     FLastUpdateRect: TRect;
     FLastUpdateRectDefined: boolean;
     FOriginalBounds: TRect;
@@ -402,7 +402,7 @@ begin
   begin
     FTransforming := true;
     FPreviousMousePos := ptF;
-    if FCtrlDown then
+    if FSnapDown then
     begin
       result := UpdateTransform;
       if IsRectEmpty(result) then result := OnlyRenderChange;
@@ -491,7 +491,7 @@ end;
 constructor TToolTransformLayer.Create(AManager: TToolManager);
 begin
   inherited Create(AManager);
-  FCtrlDown:= false;
+  FSnapDown:= false;
   FTransformCenterDefined := false;
   FLastUpdateRectDefined:= false;
 end;
@@ -531,9 +531,9 @@ end;
 
 function TToolTransformLayer.ToolKeyDown(var key: Word): TRect;
 begin
-  if key = VK_CONTROL then
+  if (key = VK_SNAP) or (KEY = VK_SNAP2) then
   begin
-    FCtrlDown:= true;
+    FSnapDown:= true;
     if FTransforming and CtrlChangesTransform then
     begin
       result := UpdateTransform;
@@ -560,9 +560,9 @@ end;
 
 function TToolTransformLayer.ToolKeyUp(var key: Word): TRect;
 begin
-  if key = VK_CONTROL then
+  if (key = VK_SNAP) or (KEY = VK_SNAP2) then
   begin
-    FCtrlDown := false;
+    FSnapDown := false;
     if FTransforming and CtrlChangesTransform then
     begin
       result := UpdateTransform;
@@ -652,7 +652,7 @@ var
   baseZoom: single;
   invZoom: boolean;
 begin
-  if FCtrlDown then
+  if FSnapDown then
   begin
     logZoom := ln(FZoom)/ln(2);
     if logZoom < 0 then
@@ -742,7 +742,7 @@ end;
 
 function TToolRotateLayer.GetActualAngle: single;
 begin
-  if FCtrlDown then
+  if FSnapDown then
     result := round(FAngle/15)*15
   else
     result := FAngle;

+ 3 - 3
lazpaint/tools/utoolselect.pas

@@ -395,7 +395,7 @@ var angleDiff: single;
 begin
   if not HintShowed then
   begin
-    Manager.ToolPopup(tpmCtrlRestrictRotation);
+    Manager.ToolPopup(tpmHoldKeyRestrictRotation, VK_SNAP);
     HintShowed:= true;
   end;
   if handMoving and ((handOrigin.X <> ptF.X) or (handOrigin.Y <> ptF.Y)) then
@@ -439,7 +439,7 @@ end;
 function TToolRotateSelection.ToolKeyDown(var key: Word): TRect;
 begin
   result := EmptyRect;
-  if key = VK_CONTROL then
+  if key = VK_SNAP then
   begin
     if not snapRotate then
     begin
@@ -469,7 +469,7 @@ end;
 
 function TToolRotateSelection.ToolKeyUp(var key: Word): TRect;
 begin
-  if key = VK_CONTROL then
+  if key = VK_SNAP then
   begin
     snapRotate := false;
     Key := 0;

+ 6 - 0
lazpaint/tools/utoolvectorial.pas

@@ -951,6 +951,7 @@ var
   handled: boolean;
 begin
   Result:= EmptyRect;
+  if (Key = VK_SNAP) or (Key = VK_SNAP2) then Key := VK_CONTROL;
   if key = VK_SHIFT then
   begin
     include(FShiftState, ssShift);
@@ -1013,6 +1014,7 @@ var
   handled: boolean;
 begin
   Result:= EmptyRect;
+  if (Key = VK_SNAP) or (Key = VK_SNAP2) then Key := VK_CONTROL;
   if key = VK_SHIFT then
   begin
     exclude(FShiftState, ssShift);
@@ -1636,6 +1638,8 @@ begin
       FShape.OnEditingChange:=@ShapeEditingChange;
       FShape.OnRemoveQuery:= @ShapeRemoveQuery;
       result := RectUnion(result, UpdateShape(toolDest));
+      if FShape is TCustomRectShape then
+        Manager.ToolPopup(tpmHoldKeyForSquare, VK_SHIFT);
     end;
   end;
 end;
@@ -1741,6 +1745,7 @@ var
   handled: boolean;
 begin
   result := EmptyRect;
+  if (Key = VK_SNAP) or (Key = VK_SNAP2) then Key := VK_CONTROL;
   if Key = VK_SHIFT then
   begin
     if FQuickDefine then
@@ -1798,6 +1803,7 @@ var
   handled: boolean;
 begin
   result := EmptyRect;
+  if (Key = VK_SNAP) or (Key = VK_SNAP2) then Key := VK_CONTROL;
   if Key = VK_SHIFT then
   begin
     if FQuickDefine then

+ 8 - 4
lazpaint/uresourcestrings.pas

@@ -73,12 +73,16 @@ resourcestring
   rsLatestVersion = 'The latest version of LazPaint available online is';
   rsMustReleaseSelection = 'You must first release the selection';
   rsMustShowLayer = 'You must first make the layer visible';
-  rsHoldShiftForSquare = 'Hold SHIFT to draw a square or a circle';
-  rsHoldCtrlSnapToPixel = 'Hold CTRL to snap to pixels';
+  rsCtrl = 'CTRL';
+  rsAlt = 'ALT';
+  rsShift = 'SHIFT';
+  rsCmd = 'CMD';
+  rsHoldKeyForSquare = 'Hold %1 to draw a square or a circle';
+  rsHoldKeySnapToPixel = 'Hold %1 to snap to pixels';
   rsReturnValides = 'Press ENTER to validate';
   rsBackspaceRemoveLastPoint = 'Press BACKSPACE to remove last point';
-  rsCtrlRestrictRotation = 'Hold CTRL to restrict rotation angle';
-  rsAltShiftScaleMode = 'Hold ALT or SHIFT to scale';
+  rsHoldKeyRestrictRotation = 'Hold %1 to restrict rotation angle';
+  rsHoldKeysScaleMode = 'Hold %1 or %2 to scale';
   rsCurveModeHint = 'Press S or X to set the curve mode of the last point';
   rsBlendOpNotUsedForBackground = 'The blend operation is applied only if there is a layer underneath';
   rsRightClickForSource = 'Use RIGHT click to define source';