gamma threshold is displayed relative to brightness

This commit is contained in:
zueuk 2008-09-29 08:47:49 +00:00
parent fdca7e4134
commit bebba6acc3
2 changed files with 22 additions and 69 deletions

View File

@ -418,7 +418,9 @@ object AdjustForm: TAdjustForm
Height = 15 Height = 15
LargeChange = 100 LargeChange = 100
Max = 10000 Max = 10000
Min = 1
PageSize = 0 PageSize = 0
Position = 100
TabOrder = 2 TabOrder = 2
OnChange = scrollBrightnessChange OnChange = scrollBrightnessChange
OnScroll = scrollBrightnessScroll OnScroll = scrollBrightnessScroll

View File

@ -407,7 +407,7 @@ begin
Resetting := False; Resetting := False;
editPPU.Text := Format('%.6g', [100*cp.pixels_per_unit/PreviewImage.Width]); editPPU.Text := Format('%.6g', [100*cp.pixels_per_unit/PreviewImage.Width]);
txtGammaThreshold.Text := Format('%.3g', [cp.gamma_threshold]); txtGammaThreshold.Text := Format('%.3g', [cp.gammaThreshRelative]);
end; //*** end; //***
DrawPreview; DrawPreview;
end; end;
@ -623,17 +623,7 @@ begin
if ((key = #13) and (EditBoxValue <> txtZoom.Text)) then if ((key = #13) and (EditBoxValue <> txtZoom.Text)) then
begin begin
key := #0; key := #0;
try txtZoomExit(sender);
v := Trunc(StrToFloat(txtZoom.Text) * 1000);
if v > scrollZoom.Max then v := scrollZoom.Max;
if v < scrollZoom.Min then v := scrollZoom.Min;
if v <> ScrollZoom.Position then begin
ScrollZoom.Position := v;
UpdateFlame;
EditBoxValue := txtZoom.Text;
end;
except on EConvertError do
end;
end; end;
end; end;
@ -651,7 +641,7 @@ begin
UpdateFlame; UpdateFlame;
end; end;
except on EConvertError do except on EConvertError do
txtZoom.Text := FloatToStr(cp.zoom) txtZoom.Text := FloatToStr(cp.zoom)
end; end;
end; end;
@ -667,15 +657,7 @@ begin
if ((key = #13) and (EditBoxValue <> txtCenterX.Text)) then if ((key = #13) and (EditBoxValue <> txtCenterX.Text)) then
begin begin
key := #0; key := #0;
try txtCenterXExit(sender);
v := Trunc(StrToFloat(txtCenterX.Text) * 1000);
if v > scrollCenterX.Max then v := scrollCenterX.Max;
if v < scrollCenterX.Min then v := scrollCenterX.Min;
ScrollCenterX.Position := v;
UpdateFlame;
EditBoxValue := txtCenterX.Text;
except on EConvertError do
end;
end; end;
end; end;
@ -691,7 +673,7 @@ begin
ScrollCenterX.Position := v; ScrollCenterX.Position := v;
UpdateFlame; UpdateFlame;
except on EConvertError do except on EConvertError do
txtCenterX.Text := FloatToStr(cp.center[0]); txtCenterX.Text := FloatToStr(cp.center[0]);
end; end;
end; end;
@ -707,15 +689,7 @@ begin
if ((key = #13) and (EditBoxValue <> txtCenterY.Text)) then if ((key = #13) and (EditBoxValue <> txtCenterY.Text)) then
begin begin
key := #0; key := #0;
try txtCenterYExit(sender);
v := Trunc(StrToFloat(txtCenterY.Text) * 1000);
if v > ScrollCenterY.Max then v := ScrollCenterY.Max;
if v < ScrollCenterY.Min then v := ScrollCenterY.Min;
ScrollCenterY.Position := v;
UpdateFlame;
EditBoxValue := txtCenterY.Text;
except on EConvertError do
end;
end; end;
end; end;
@ -731,7 +705,7 @@ begin
ScrollCenterY.Position := v; ScrollCenterY.Position := v;
UpdateFlame; UpdateFlame;
except on EConvertError do except on EConvertError do
txtCenterY.Text := FloatToStr(cp.center[1]); txtCenterY.Text := FloatToStr(cp.center[1]);
end; end;
end; end;
@ -752,7 +726,7 @@ begin
ScrollGamma.Position := v; ScrollGamma.Position := v;
UpdateFlame; UpdateFlame;
except on EConvertError do except on EConvertError do
txtGamma.Text := FloatToStr(cp.gamma); txtGamma.Text := FloatToStr(cp.gamma);
end; end;
end; end;
@ -763,15 +737,7 @@ begin
if ((key = #13) and (txtGamma.Text <> EditBoxValue)) then if ((key = #13) and (txtGamma.Text <> EditBoxValue)) then
begin begin
key := #0; key := #0;
try txtGammaExit(sender);
v := Trunc(StrToFloat(txtGamma.Text) * 100);
if v > scrollGamma.Max then v := scrollGamma.Max;
if v < scrollGamma.Min then v := scrollGamma.Min;
ScrollGamma.Position := v;
UpdateFlame;
EditBoxValue := txtGamma.Text;
except on EConvertError do
end;
end; end;
end; end;
@ -792,7 +758,7 @@ begin
ScrollBrightness.Position := v; ScrollBrightness.Position := v;
UpdateFlame; UpdateFlame;
except on EConvertError do except on EConvertError do
txtBrightness.Text := FloatToStr(cp.brightness); txtBrightness.Text := FloatToStr(cp.brightness);
end; end;
end; end;
@ -804,15 +770,7 @@ begin
if ((key = #13) and (txtBrightness.Text <> EditBoxValue)) then if ((key = #13) and (txtBrightness.Text <> EditBoxValue)) then
begin begin
key := #0; key := #0;
try txtBrightnessExit(sender);
v := Trunc(StrToFloat(txtBrightness.Text) * 100);
if v > scrollBrightness.Max then v := scrollBrightness.Max;
if v < scrollBrightness.Min then v := scrollBrightness.Min;
ScrollBrightness.Position := v;
UpdateFlame;
EditBoxValue := txtBrightness.Text;
except on EConvertError do
end;
end; end;
end; end;
@ -828,15 +786,7 @@ begin
if ((key = #13) and (txtVibrancy.Text <> EditBoxValue)) then if ((key = #13) and (txtVibrancy.Text <> EditBoxValue)) then
begin begin
key := #0; key := #0;
try txtVibrancyExit(sender);
v := Trunc(StrToFloat(txtVibrancy.Text) * 100);
if v > scrollVibrancy.Max then v := scrollVibrancy.Max;
if v < scrollVibrancy.Min then v := scrollVibrancy.Min;
ScrollVibrancy.Position := v;
UpdateFlame;
EditBoxValue := txtVibrancy.Text;
except on EConvertError do
end;
end; end;
end; end;
@ -1977,7 +1927,7 @@ begin
else if (Sender = pnlVibrancy) then else if (Sender = pnlVibrancy) then
pnlDragValue := cp.vibrancy pnlDragValue := cp.vibrancy
else if (Sender = pnlGammaThreshold) then else if (Sender = pnlGammaThreshold) then
pnlDragValue := cp.gamma_threshold pnlDragValue := cp.gammaThreshRelative
else assert(false); else assert(false);
pnlDragMode := true; pnlDragMode := true;
@ -2054,8 +2004,8 @@ begin
else if (Sender = pnlGammaThreshold) then else if (Sender = pnlGammaThreshold) then
begin begin
if v < 0 then v := 0; if v < 0 then v := 0;
cp.gamma_threshold := v; cp.gammaThreshRelative := v;
txtGammaThreshold.Text := FloattoStr(v); txtGammaThreshold.Text := FloattoStr(cp.gammaThreshRelative);
end; end;
//pEdit^.Text := FloatToStr(v); //pEdit^.Text := FloatToStr(v);
//pEdit.Refresh; //pEdit.Refresh;
@ -2125,8 +2075,8 @@ begin
end end
else if (Sender = pnlGammaThreshold) then else if (Sender = pnlGammaThreshold) then
begin begin
if cp.gamma_threshold = defGammaThreshold then exit; if cp.gammaThreshRelative = defGammaThreshold then exit;
cp.gamma_threshold := defGammaThreshold; cp.gammaThreshRelative := defGammaThreshold;
txtGammaThreshold.Text := FloatToStr(defGammaThreshold); txtGammaThreshold.Text := FloatToStr(defGammaThreshold);
end end
else assert(false); else assert(false);
@ -2256,9 +2206,10 @@ begin
exit; exit;
end; end;
if v < 0 then v := 0; if v < 0 then v := 0;
if v <> cp.gamma_threshold then begin if v <> cp.gammaThreshRelative then begin
MainForm.UpdateUndo; MainForm.UpdateUndo;
cp.gamma_threshold := v; cp.gammaThreshRelative := v;
txtGammaThreshold.Text := FloatToStr(cp.gammaThreshRelative);
UpdateFlame; UpdateFlame;
EditBoxValue := txtGammaThreshold.Text; EditBoxValue := txtGammaThreshold.Text;
end; end;