Parcourir la source

added preview functionality to dialog Color Intensity/Brightness

Lulu il y a 2 ans
Parent
commit
110ca6b261

+ 22 - 15
lazpaint/dialog/color/ucolorintensity.lfm

@@ -1,31 +1,31 @@
 object FColorIntensity: TFColorIntensity
 object FColorIntensity: TFColorIntensity
   Left = 405
   Left = 405
-  Height = 109
+  Height = 128
   Top = 187
   Top = 187
   Width = 472
   Width = 472
   BorderIcons = [biSystemMenu]
   BorderIcons = [biSystemMenu]
   BorderStyle = bsDialog
   BorderStyle = bsDialog
   Caption = 'Intensity'
   Caption = 'Intensity'
-  ClientHeight = 109
+  ClientHeight = 128
   ClientWidth = 472
   ClientWidth = 472
   Font.Height = -12
   Font.Height = -12
   OnCreate = FormCreate
   OnCreate = FormCreate
   OnShow = FormShow
   OnShow = FormShow
   Position = poOwnerFormCenter
   Position = poOwnerFormCenter
-  LCLVersion = '1.0.10.0'
+  LCLVersion = '2.2.4.0'
   object Label_Multiply: TLabel
   object Label_Multiply: TLabel
     Left = 8
     Left = 8
-    Height = 16
+    Height = 15
     Top = 46
     Top = 46
-    Width = 45
+    Width = 44
     Caption = 'Multiply'
     Caption = 'Multiply'
     ParentColor = False
     ParentColor = False
   end
   end
   object Label_Shift: TLabel
   object Label_Shift: TLabel
     Left = 8
     Left = 8
-    Height = 16
+    Height = 15
     Top = 13
     Top = 13
-    Width = 25
+    Width = 24
     Caption = 'Shift'
     Caption = 'Shift'
     ParentColor = False
     ParentColor = False
   end
   end
@@ -50,9 +50,9 @@ object FColorIntensity: TFColorIntensity
   object Button_OK: TButton
   object Button_OK: TButton
     Left = 165
     Left = 165
     Height = 22
     Height = 22
-    Top = 80
+    Top = 96
     Width = 59
     Width = 59
-    Caption = 'OK'
+    Caption = 'rsOK'
     Default = True
     Default = True
     ModalResult = 1
     ModalResult = 1
     OnClick = Button_OKClick
     OnClick = Button_OKClick
@@ -61,10 +61,10 @@ object FColorIntensity: TFColorIntensity
   object Button_Cancel: TButton
   object Button_Cancel: TButton
     Left = 229
     Left = 229
     Height = 22
     Height = 22
-    Top = 80
+    Top = 96
     Width = 72
     Width = 72
     Cancel = True
     Cancel = True
-    Caption = 'Cancel'
+    Caption = 'rsCancel'
     ModalResult = 2
     ModalResult = 2
     TabOrder = 3
     TabOrder = 3
   end
   end
@@ -74,12 +74,10 @@ object FColorIntensity: TFColorIntensity
     Top = 8
     Top = 8
     Width = 72
     Width = 72
     DecimalPlaces = 3
     DecimalPlaces = 3
-    Increment = 1
     MaxValue = 1
     MaxValue = 1
     MinValue = -1
     MinValue = -1
     OnChange = FloatSpinEdit_ShiftChange
     OnChange = FloatSpinEdit_ShiftChange
     TabOrder = 4
     TabOrder = 4
-    Value = 0
   end
   end
   object FloatSpinEdit_Factor: TFloatSpinEdit
   object FloatSpinEdit_Factor: TFloatSpinEdit
     Left = 392
     Left = 392
@@ -87,11 +85,20 @@ object FColorIntensity: TFColorIntensity
     Top = 43
     Top = 43
     Width = 72
     Width = 72
     DecimalPlaces = 3
     DecimalPlaces = 3
-    Increment = 1
     MaxValue = 2
     MaxValue = 2
     MinValue = -2
     MinValue = -2
     OnChange = FloatSpinEdit_FactorChange
     OnChange = FloatSpinEdit_FactorChange
     TabOrder = 5
     TabOrder = 5
-    Value = 0
+  end
+  object CheckBox_Preview: TCheckBox
+    Left = 8
+    Height = 19
+    Top = 80
+    Width = 70
+    Caption = 'rsPreview'
+    Checked = True
+    OnChange = CheckBox_PreviewChange
+    State = cbChecked
+    TabOrder = 6
   end
   end
 end
 end

+ 3 - 2
lazpaint/dialog/color/ucolorintensity.lrj

@@ -2,6 +2,7 @@
 {"hash":180736233,"name":"tfcolorintensity.caption","sourcebytes":[73,110,116,101,110,115,105,116,121],"value":"Intensity"},
 {"hash":180736233,"name":"tfcolorintensity.caption","sourcebytes":[73,110,116,101,110,115,105,116,121],"value":"Intensity"},
 {"hash":205194361,"name":"tfcolorintensity.label_multiply.caption","sourcebytes":[77,117,108,116,105,112,108,121],"value":"Multiply"},
 {"hash":205194361,"name":"tfcolorintensity.label_multiply.caption","sourcebytes":[77,117,108,116,105,112,108,121],"value":"Multiply"},
 {"hash":5894100,"name":"tfcolorintensity.label_shift.caption","sourcebytes":[83,104,105,102,116],"value":"Shift"},
 {"hash":5894100,"name":"tfcolorintensity.label_shift.caption","sourcebytes":[83,104,105,102,116],"value":"Shift"},
-{"hash":1339,"name":"tfcolorintensity.button_ok.caption","sourcebytes":[79,75],"value":"OK"},
-{"hash":77089212,"name":"tfcolorintensity.button_cancel.caption","sourcebytes":[67,97,110,99,101,108],"value":"Cancel"}
+{"hash":497723,"name":"tfcolorintensity.button_ok.caption","sourcebytes":[114,115,79,75],"value":"rsOK"},
+{"hash":127421996,"name":"tfcolorintensity.button_cancel.caption","sourcebytes":[114,115,67,97,110,99,101,108],"value":"rsCancel"},
+{"hash":126662215,"name":"tfcolorintensity.checkbox_preview.caption","sourcebytes":[114,115,80,114,101,118,105,101,119],"value":"rsPreview"}
 ]}
 ]}

+ 20 - 0
lazpaint/dialog/color/ucolorintensity.pas

@@ -18,6 +18,7 @@ type
   TFColorIntensity = class(TForm)
   TFColorIntensity = class(TForm)
     Button_Cancel: TButton;
     Button_Cancel: TButton;
     Button_OK: TButton;
     Button_OK: TButton;
+    CheckBox_Preview: TCheckBox;
     FloatSpinEdit_Shift: TFloatSpinEdit;
     FloatSpinEdit_Shift: TFloatSpinEdit;
     FloatSpinEdit_Factor: TFloatSpinEdit;
     FloatSpinEdit_Factor: TFloatSpinEdit;
     Label_Multiply: TLabel;
     Label_Multiply: TLabel;
@@ -25,6 +26,7 @@ type
     TrackBar_Multiply: TTrackBar;
     TrackBar_Multiply: TTrackBar;
     TrackBar_Shift: TTrackBar;
     TrackBar_Shift: TTrackBar;
     procedure Button_OKClick(Sender: TObject);
     procedure Button_OKClick(Sender: TObject);
+    procedure CheckBox_PreviewChange(Sender: TObject);
     procedure FloatSpinEdit_FactorChange(Sender: TObject);
     procedure FloatSpinEdit_FactorChange(Sender: TObject);
     procedure FloatSpinEdit_ShiftChange(Sender: TObject);
     procedure FloatSpinEdit_ShiftChange(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
@@ -92,6 +94,15 @@ begin
   FFilterConnector.Parameters.Floats['Shift'] := FloatSpinEdit_Shift.Value;
   FFilterConnector.Parameters.Floats['Shift'] := FloatSpinEdit_Shift.Value;
 end;
 end;
 
 
+procedure TFColorIntensity.CheckBox_PreviewChange(Sender: TObject);
+begin
+  if not FInitialized then exit;
+  if CheckBox_Preview.Checked then
+    ApplyChosenIntensity
+  else
+   FFilterConnector.RestoreBackup;
+end;
+
 procedure TFColorIntensity.FloatSpinEdit_FactorChange(Sender: TObject);
 procedure TFColorIntensity.FloatSpinEdit_FactorChange(Sender: TObject);
 begin
 begin
   FUpdatingSpinEdit := true;
   FUpdatingSpinEdit := true;
@@ -198,6 +209,11 @@ begin
     if FFilterConnector.Parameters.IsDefined('Shift') then
     if FFilterConnector.Parameters.IsDefined('Shift') then
       ChosenShift := FFilterConnector.Parameters.Floats['Shift'];
       ChosenShift := FFilterConnector.Parameters.Floats['Shift'];
     UpdateSpinEdit;
     UpdateSpinEdit;
+
+    Button_OK.Caption := rsOK;
+    Button_Cancel.Caption := rsCancel;
+    CheckBox_Preview.Caption := rsPreview;
+    CheckBox_Preview.Checked := True;
     FInitialized := OldInitialized;
     FInitialized := OldInitialized;
   end;
   end;
 end;
 end;
@@ -272,6 +288,10 @@ begin
     ciIntensity: FilterIntensity(FFilterConnector, ChosenFactor,ChosenShift);
     ciIntensity: FilterIntensity(FFilterConnector, ChosenFactor,ChosenShift);
     ciLightness: FilterLightness(FFilterConnector, ChosenFactor,ChosenShift);
     ciLightness: FilterLightness(FFilterConnector, ChosenFactor,ChosenShift);
   end;
   end;
+
+  FInitialized := False;
+  CheckBox_Preview.Checked := True;
+  FInitialized := True;
 end;
 end;
 
 
 {$R *.lfm}
 {$R *.lfm}