Changed the behaviour of the edit boxes in the Adjust dialog - now the flame is updated only after user really *changed* the value being edited.

This commit is contained in:
utak3r 2005-04-29 22:57:18 +00:00
parent 64c10b31d2
commit 9d2a30e3ac
2 changed files with 62 additions and 6 deletions

View File

@ -135,6 +135,7 @@ object AdjustForm: TAdjustForm
Height = 21 Height = 21
TabOrder = 1 TabOrder = 1
Text = '0' Text = '0'
OnEnter = txtGammaEnter
OnExit = txtGammaExit OnExit = txtGammaExit
OnKeyPress = txtGammaKeyPress OnKeyPress = txtGammaKeyPress
end end
@ -157,6 +158,7 @@ object AdjustForm: TAdjustForm
Height = 21 Height = 21
TabOrder = 3 TabOrder = 3
Text = '0' Text = '0'
OnEnter = txtBrightnessEnter
OnExit = txtBrightnessExit OnExit = txtBrightnessExit
OnKeyPress = txtBrightnessKeyPress OnKeyPress = txtBrightnessKeyPress
end end
@ -178,6 +180,7 @@ object AdjustForm: TAdjustForm
Height = 21 Height = 21
TabOrder = 5 TabOrder = 5
Text = '0' Text = '0'
OnEnter = txtVibrancyEnter
OnExit = txtVibrancyExit OnExit = txtVibrancyExit
OnKeyPress = txtVibrancyKeyPress OnKeyPress = txtVibrancyKeyPress
end end
@ -243,6 +246,7 @@ object AdjustForm: TAdjustForm
Height = 21 Height = 21
TabOrder = 1 TabOrder = 1
Text = '0' Text = '0'
OnEnter = txtZoomEnter
OnExit = txtZoomExit OnExit = txtZoomExit
OnKeyPress = txtZoomKeyPress OnKeyPress = txtZoomKeyPress
end end
@ -266,6 +270,7 @@ object AdjustForm: TAdjustForm
Height = 21 Height = 21
TabOrder = 3 TabOrder = 3
Text = '0' Text = '0'
OnEnter = txtCenterXEnter
OnExit = txtCenterXExit OnExit = txtCenterXExit
OnKeyPress = txtCenterXKeyPress OnKeyPress = txtCenterXKeyPress
end end
@ -289,6 +294,7 @@ object AdjustForm: TAdjustForm
Height = 21 Height = 21
TabOrder = 5 TabOrder = 5
Text = '0' Text = '0'
OnEnter = txtCenterYEnter
OnExit = txtCenterYExit OnExit = txtCenterYExit
OnKeyPress = txtCenterYKeyPress OnKeyPress = txtCenterYKeyPress
end end

View File

@ -101,10 +101,17 @@ type
procedure ColorPanelClick(Sender: TObject); procedure ColorPanelClick(Sender: TObject);
procedure scrollContrastScroll(Sender: TObject; procedure scrollContrastScroll(Sender: TObject;
ScrollCode: TScrollCode; var ScrollPos: Integer); ScrollCode: TScrollCode; var ScrollPos: Integer);
procedure txtGammaEnter(Sender: TObject);
procedure txtBrightnessEnter(Sender: TObject);
procedure txtVibrancyEnter(Sender: TObject);
procedure txtZoomEnter(Sender: TObject);
procedure txtCenterXEnter(Sender: TObject);
procedure txtCenterYEnter(Sender: TObject);
private private
Resetting: boolean; Resetting: boolean;
Render: TRenderer; Render: TRenderer;
bm: TBitmap; bm: TBitmap;
EditBoxValue: string;
public public
PreviewDensity: double; PreviewDensity: double;
cp: TControlPoint; cp: TControlPoint;
@ -312,10 +319,15 @@ begin
DrawPreview; DrawPreview;
end; end;
procedure TAdjustForm.txtZoomEnter(Sender: TObject);
begin
EditBoxValue := txtZoom.Text;
end;
procedure TAdjustForm.txtZoomKeyPress(Sender: TObject; var Key: Char); procedure TAdjustForm.txtZoomKeyPress(Sender: TObject; var Key: Char);
var v: integer; var v: integer;
begin begin
if key = #13 then if ((key = #13) and (EditBoxValue <> txtZoom.Text)) then
begin begin
key := #0; key := #0;
try try
@ -325,6 +337,7 @@ begin
if v <> ScrollZoom.Position then begin if v <> ScrollZoom.Position then begin
ScrollZoom.Position := v; ScrollZoom.Position := v;
UpdateFlame; UpdateFlame;
EditBoxValue := txtZoom.Text;
end; end;
except on EConvertError do except on EConvertError do
end; end;
@ -335,6 +348,7 @@ procedure TAdjustForm.txtZoomExit(Sender: TObject);
var var
v: integer; v: integer;
begin begin
if (EditBoxValue <> txtZoom.Text) then
try try
v := Trunc(StrToFloat(txtZoom.Text) * 100); v := Trunc(StrToFloat(txtZoom.Text) * 100);
if v > scrollZoom.Max then v := scrollZoom.Max; if v > scrollZoom.Max then v := scrollZoom.Max;
@ -348,11 +362,16 @@ begin
end; end;
end; end;
procedure TAdjustForm.txtCenterXEnter(Sender: TObject);
begin
EditBoxValue := txtCenterX.Text;
end;
procedure TAdjustForm.txtCenterXKeyPress(Sender: TObject; var Key: Char); procedure TAdjustForm.txtCenterXKeyPress(Sender: TObject; var Key: Char);
var var
v: integer; v: integer;
begin begin
if key = #13 then if ((key = #13) and (EditBoxValue <> txtCenterX.Text)) then
begin begin
key := #0; key := #0;
try try
@ -360,6 +379,8 @@ begin
if v > scrollCenterX.Max then v := scrollCenterX.Max; if v > scrollCenterX.Max then v := scrollCenterX.Max;
if v < scrollCenterX.Min then v := scrollCenterX.Min; if v < scrollCenterX.Min then v := scrollCenterX.Min;
ScrollCenterX.Position := v; ScrollCenterX.Position := v;
UpdateFlame;
EditBoxValue := txtCenterX.Text;
except on EConvertError do except on EConvertError do
end; end;
end; end;
@ -369,6 +390,7 @@ procedure TAdjustForm.txtCenterXExit(Sender: TObject);
var var
v: integer; v: integer;
begin begin
if (EditBoxValue <> txtCenterX.Text) then
try try
v := Trunc(StrToFloat(txtCenterX.Text) * 100); v := Trunc(StrToFloat(txtCenterX.Text) * 100);
if v > scrollCenterX.Max then v := scrollCenterX.Max; if v > scrollCenterX.Max then v := scrollCenterX.Max;
@ -380,11 +402,16 @@ begin
end; end;
end; end;
procedure TAdjustForm.txtCenterYEnter(Sender: TObject);
begin
EditBoxValue := txtCenterY.Text;
end;
procedure TAdjustForm.txtCenterYKeyPress(Sender: TObject; var Key: Char); procedure TAdjustForm.txtCenterYKeyPress(Sender: TObject; var Key: Char);
var var
v: integer; v: integer;
begin begin
if key = #13 then if ((key = #13) and (EditBoxValue <> txtCenterY.Text)) then
begin begin
key := #0; key := #0;
try try
@ -393,6 +420,7 @@ begin
if v < ScrollCenterY.Min then v := ScrollCenterY.Min; if v < ScrollCenterY.Min then v := ScrollCenterY.Min;
ScrollCenterY.Position := v; ScrollCenterY.Position := v;
UpdateFlame; UpdateFlame;
EditBoxValue := txtCenterY.Text;
except on EConvertError do except on EConvertError do
end; end;
end; end;
@ -402,6 +430,7 @@ procedure TAdjustForm.txtCenterYExit(Sender: TObject);
var var
v: integer; v: integer;
begin begin
if (EditBoxValue <> txtCenterY.Text) then
try try
v := Trunc(StrToFloat(txtCenterY.Text) * 100); v := Trunc(StrToFloat(txtCenterY.Text) * 100);
if v > ScrollCenterY.Max then v := ScrollCenterY.Max; if v > ScrollCenterY.Max then v := ScrollCenterY.Max;
@ -413,10 +442,16 @@ begin
end; end;
end; end;
procedure TAdjustForm.txtGammaEnter(Sender: TObject);
begin
EditBoxValue := txtGamma.Text;
end;
procedure TAdjustForm.txtGammaExit(Sender: TObject); procedure TAdjustForm.txtGammaExit(Sender: TObject);
var var
v: integer; v: integer;
begin begin
if (txtGamma.Text <> EditBoxValue) then
try try
v := Trunc(StrToFloat(txtGamma.Text) * 100); v := Trunc(StrToFloat(txtGamma.Text) * 100);
if v > scrollGamma.Max then v := scrollGamma.Max; if v > scrollGamma.Max then v := scrollGamma.Max;
@ -432,7 +467,7 @@ procedure TAdjustForm.txtGammaKeyPress(Sender: TObject; var Key: Char);
var var
v: integer; v: integer;
begin begin
if key = #13 then if ((key = #13) and (txtGamma.Text <> EditBoxValue)) then
begin begin
key := #0; key := #0;
try try
@ -441,15 +476,22 @@ begin
if v < scrollGamma.Min then v := scrollGamma.Min; if v < scrollGamma.Min then v := scrollGamma.Min;
ScrollGamma.Position := v; ScrollGamma.Position := v;
UpdateFlame; UpdateFlame;
EditBoxValue := txtGamma.Text;
except on EConvertError do except on EConvertError do
end; end;
end; end;
end; end;
procedure TAdjustForm.txtBrightnessEnter(Sender: TObject);
begin
EditBoxValue := txtBrightness.Text;
end;
procedure TAdjustForm.txtBrightnessExit(Sender: TObject); procedure TAdjustForm.txtBrightnessExit(Sender: TObject);
var var
v: integer; v: integer;
begin begin
if (txtBrightness.Text <> EditBoxValue) then
try try
v := Trunc(StrToFloat(txtBrightness.Text) * 100); v := Trunc(StrToFloat(txtBrightness.Text) * 100);
if v > scrollBrightness.Max then v := scrollBrightness.Max; if v > scrollBrightness.Max then v := scrollBrightness.Max;
@ -466,7 +508,7 @@ procedure TAdjustForm.txtBrightnessKeyPress(Sender: TObject;
var var
v: integer; v: integer;
begin begin
if key = #13 then if ((key = #13) and (txtBrightness.Text <> EditBoxValue)) then
begin begin
key := #0; key := #0;
try try
@ -475,16 +517,22 @@ begin
if v < scrollBrightness.Min then v := scrollBrightness.Min; if v < scrollBrightness.Min then v := scrollBrightness.Min;
ScrollBrightness.Position := v; ScrollBrightness.Position := v;
UpdateFlame; UpdateFlame;
EditBoxValue := txtBrightness.Text;
except on EConvertError do except on EConvertError do
end; end;
end; end;
end; end;
procedure TAdjustForm.txtVibrancyEnter(Sender: TObject);
begin
EditBoxValue := txtVibrancy.Text;
end;
procedure TAdjustForm.txtVibrancyKeyPress(Sender: TObject; var Key: Char); procedure TAdjustForm.txtVibrancyKeyPress(Sender: TObject; var Key: Char);
var var
v: integer; v: integer;
begin begin
if key = #13 then if ((key = #13) and (txtVibrancy.Text <> EditBoxValue)) then
begin begin
key := #0; key := #0;
try try
@ -493,6 +541,7 @@ begin
if v < scrollVibrancy.Min then v := scrollVibrancy.Min; if v < scrollVibrancy.Min then v := scrollVibrancy.Min;
ScrollVibrancy.Position := v; ScrollVibrancy.Position := v;
UpdateFlame; UpdateFlame;
EditBoxValue := txtVibrancy.Text;
except on EConvertError do except on EConvertError do
end; end;
end; end;
@ -502,6 +551,7 @@ procedure TAdjustForm.txtVibrancyExit(Sender: TObject);
var var
v: integer; v: integer;
begin begin
if (txtVibrancy.Text <> EditBoxValue) then
try try
v := Trunc(StrToFloat(txtVibrancy.Text) * 100); v := Trunc(StrToFloat(txtVibrancy.Text) * 100);
if v > scrollVibrancy.Max then v := scrollVibrancy.Max; if v > scrollVibrancy.Max then v := scrollVibrancy.Max;