浏览代码

rename methods to better express what they do

Lulu 1 年之前
父节点
当前提交
8986667679
共有 3 个文件被更改,包括 19 次插入12 次删除
  1. 1 1
      lazpaint/dialog/uchoosecolorinterface.pas
  2. 13 7
      lazpaint/lazpaintinstance.pas
  3. 5 4
      lazpaint/lazpainttype.pas

+ 1 - 1
lazpaint/dialog/uchoosecolorinterface.pas

@@ -302,7 +302,7 @@ begin
         Bitmap.RoundRectAntialias(Left, Top, Right - 1, Bottom - 1,
             previewSize/6, previewSize/6, BGRA(0,0,0,192), bmpCursorWidth, c, []);
         c := GetCurrentColor;
-        s := FLazPaintInstance.GetDigitFromColorsBindToKey(c);
+        s := FLazPaintInstance.GetKeyAssociatedToColor(c);
         if Length(s) > 0 then
         begin
           if GetLightness(c)/65535 > 0.5 then

+ 13 - 7
lazpaint/lazpaintinstance.pas

@@ -7,7 +7,7 @@ interface
 
 uses
   Classes, SysUtils, LazPaintType, BGRABitmap, BGRABitmapTypes, BGRALayers, LCVectorialFill,
-  Menus, Forms, Controls, fgl,
+  Menus, Forms, Controls, fgl, LCLType,
 
   LazPaintMainForm, UMainFormLayout,
 
@@ -240,7 +240,7 @@ type
     procedure ColorToFChooseColor; override;
     procedure ExitColorEditor; override;
     function ColorEditorActive: boolean; override;
-    procedure FChooseColorSimpleRedraw; override;
+    procedure NotifyColorBinding; override;
     function ShowSaveOptionDlg({%H-}AParameters: TVariableSet; AOutputFilenameUTF8: string;
       ASkipOptions: boolean; AExport: boolean): boolean; override;
     function ShowColorIntensityDlg(AParameters: TVariableSet): TScriptResult; override;
@@ -290,15 +290,16 @@ type
     procedure UpdateEditPicture(ADelayed: boolean); override;
     procedure AddColorToPalette(AColor: TBGRAPixel); override;
     procedure RemoveColorFromPalette(AColor: TBGRAPixel); override;
-    function GetDigitFromColorsBindToKey(const AColor: TBGRAPixel): string; override;
+    function GetKeyAssociatedToColor(const AColor: TBGRAPixel): string; override;
     property Initialized: boolean read GetInitialized;
     procedure SendKeyDownEventToMainForm(var Key: Word; Shift: TShiftState); override;
     procedure SendKeyUpEventToMainForm(var Key: Word; Shift: TShiftState); override;
+    procedure SendUTF8KeyPressEventToMainForm(var UTF8Key: TUTF8Char); override;
   end;
 
 implementation
 
-uses LCLType, Types, Dialogs, FileUtil, StdCtrls, LCLIntf, BGRAUTF8, UTranslation,
+uses Types, Dialogs, FileUtil, StdCtrls, LCLIntf, BGRAUTF8, UTranslation,
 
      URadialBlur, UMotionBlur, UEmboss, UTwirl, UWaveDisplacement,
      unewimage, uresample, UPixelate, unoisefilter, ufilters,
@@ -1985,7 +1986,7 @@ begin
     else result := false;
 end;
 
-procedure TLazPaintInstance.FChooseColorSimpleRedraw;
+procedure TLazPaintInstance.NotifyColorBinding;
 begin
   if Assigned(FChooseColor) then FChooseColor.SimpleRedraw;
 end;
@@ -2204,11 +2205,11 @@ begin
   if Assigned(FMain) then FMain.Layout.RemoveColorFromPalette(AColor);
 end;
 
-function TLazPaintInstance.GetDigitFromColorsBindToKey(const AColor: TBGRAPixel): string;
+function TLazPaintInstance.GetKeyAssociatedToColor(const AColor: TBGRAPixel): string;
 begin
   if Assigned(FMain) and
      Assigned(FMain.Layout) and
-     Assigned(FMain.Layout.PaletteToolbar) then Result := FMain.Layout.PaletteToolbar.GetDigitFromColorsBindToKey(AColor)
+     Assigned(FMain.Layout.PaletteToolbar) then Result := FMain.Layout.PaletteToolbar.GetKeyAssociatedToColor(AColor)
   else Result := '';
 end;
 
@@ -2222,5 +2223,10 @@ begin
   if Assigned(FMain) then FMain.FormKeyUp(FMain, key, Shift);
 end;
 
+procedure TLazPaintInstance.SendUTF8KeyPressEventToMainForm(var UTF8Key: TUTF8Char);
+begin
+  if Assigned(FMain) then FMain.FormUTF8KeyPress(FMain, UTF8Key);
+end;
+
 end.
 

+ 5 - 4
lazpaint/lazpainttype.pas

@@ -7,7 +7,7 @@ interface
 
 uses
   Classes, SysUtils, Inifiles, BGRABitmap, BGRABitmapTypes, UConfig, UImage, UTool, Forms, BGRALayers, Graphics, Menus,
-  UScripting, Dialogs, Controls
+  UScripting, Dialogs, Controls, LCLType
   {$IFDEF LINUX}, InterfaceBase{$ENDIF};
 
 const
@@ -271,7 +271,7 @@ type
     procedure ColorToFChooseColor; virtual; abstract;
     procedure ExitColorEditor; virtual; abstract;
     function ColorEditorActive: boolean; virtual; abstract;
-    procedure FChooseColorSimpleRedraw; virtual; abstract;
+    procedure NotifyColorBinding; virtual; abstract;
     function GetColor(ATarget: TColorTarget): TBGRAPixel;
     procedure SetColor(ATarget: TColorTarget; AColor: TBGRAPixel);
     function ShowSaveOptionDlg(AParameters: TVariableSet; AOutputFilenameUTF8: string;
@@ -314,7 +314,7 @@ type
     procedure Wait(ACheckActive: TCheckFunction; ADelayMs: integer); virtual; abstract;
     procedure AddColorToPalette(AColor: TBGRAPixel); virtual; abstract;
     procedure RemoveColorFromPalette(AColor: TBGRAPixel); virtual; abstract;
-    function GetDigitFromColorsBindToKey(const AColor: TBGRAPixel): string; virtual; abstract;
+    function GetKeyAssociatedToColor(const AColor: TBGRAPixel): string; virtual; abstract;
 
     property BlackAndWhite: boolean read FBlackAndWhite write SetBlackAndWhite;
 
@@ -347,6 +347,7 @@ type
     procedure MoveImageListWindowTo(X,Y: integer); virtual; abstract;
     procedure SendKeyDownEventToMainForm(var Key: Word; Shift: TShiftState); virtual; abstract;
     procedure SendKeyUpEventToMainForm(var Key: Word; Shift: TShiftState); virtual; abstract;
+    procedure SendUTF8KeyPressEventToMainForm(var UTF8Key: TUTF8Char); virtual; abstract;
     property ImageListWindowWidth: integer read GetImageListWindowWidth write SetImageListWindowWidth;
     property ImageListWindowHeight: integer read GetImageListWindowHeight write SetImageListWindowHeight;
     property ImageListWindowVisible: boolean read GetImageListWindowVisible write SetImageListWindowVisible;
@@ -393,7 +394,7 @@ function CSSToPascalCase(AIdentifier: string): string;
 
 implementation
 
-uses LCLType, BGRAUTF8, LCLIntf, FileUtil, UResourceStrings, LCVectorialFill;
+uses BGRAUTF8, LCLIntf, FileUtil, UResourceStrings, LCVectorialFill;
 
 function LazPaintVersionStr: string;
 var numbers: TStringList;