fixed a scrollbar bug,

disabled postcoefs (again)
This commit is contained in:
zueuk 2006-03-18 18:05:15 +00:00
parent a9aeab94ad
commit ff2002f7d2
2 changed files with 45 additions and 21 deletions

View File

@ -1229,8 +1229,10 @@ object EditForm: TEditForm
Height = 21 Height = 21
Hint = 'Reset vector X' Hint = 'Reset vector X'
Caption = 'X' Caption = 'X'
Enabled = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
Visible = False
OnClick = btnXpostClick OnClick = btnXpostClick
end end
object btnYpost: TSpeedButton object btnYpost: TSpeedButton
@ -1240,8 +1242,10 @@ object EditForm: TEditForm
Height = 21 Height = 21
Hint = 'Reset vector Y' Hint = 'Reset vector Y'
Caption = 'Y' Caption = 'Y'
Enabled = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
Visible = False
OnClick = btnYpostClick OnClick = btnYpostClick
end end
object btnOpost: TSpeedButton object btnOpost: TSpeedButton
@ -1251,8 +1255,10 @@ object EditForm: TEditForm
Height = 21 Height = 21
Hint = 'Reset vector O' Hint = 'Reset vector O'
Caption = 'O' Caption = 'O'
Enabled = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
Visible = False
OnClick = btnOpostClick OnClick = btnOpostClick
end end
object btnResetPostXForm: TSpeedButton object btnResetPostXForm: TSpeedButton
@ -1262,8 +1268,10 @@ object EditForm: TEditForm
Height = 22 Height = 22
Hint = 'Reset post-transform vectors to defaults' Hint = 'Reset post-transform vectors to defaults'
Caption = 'Reset post-transform' Caption = 'Reset post-transform'
Enabled = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
Visible = False
OnClick = btnResetPostXFormClick OnClick = btnResetPostXFormClick
end end
object btnSwapXforms: TSpeedButton object btnSwapXforms: TSpeedButton
@ -1273,6 +1281,7 @@ object EditForm: TEditForm
Height = 22 Height = 22
Hint = 'Swap Xform with PostXform' Hint = 'Swap Xform with PostXform'
Caption = '[ Xform <-> PostXform ]' Caption = '[ Xform <-> PostXform ]'
Enabled = False
Flat = True Flat = True
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
@ -1282,6 +1291,7 @@ object EditForm: TEditForm
ParentFont = False ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
Visible = False
OnClick = btnSwapXformsClick OnClick = btnSwapXformsClick
end end
object pnlWeight: TPanel object pnlWeight: TPanel
@ -1393,8 +1403,10 @@ object EditForm: TEditForm
Top = 188 Top = 188
Width = 57 Width = 57
Height = 21 Height = 21
Enabled = False
TabOrder = 8 TabOrder = 8
Text = '0' Text = '0'
Visible = False
OnExit = PostCoefValidate OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress OnKeyPress = PostCoefKeypress
end end
@ -1403,8 +1415,10 @@ object EditForm: TEditForm
Top = 188 Top = 188
Width = 57 Width = 57
Height = 21 Height = 21
Enabled = False
TabOrder = 9 TabOrder = 9
Text = '0' Text = '0'
Visible = False
OnExit = PostCoefValidate OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress OnKeyPress = PostCoefKeypress
end end
@ -1413,8 +1427,10 @@ object EditForm: TEditForm
Top = 212 Top = 212
Width = 57 Width = 57
Height = 21 Height = 21
Enabled = False
TabOrder = 10 TabOrder = 10
Text = '0' Text = '0'
Visible = False
OnExit = PostCoefValidate OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress OnKeyPress = PostCoefKeypress
end end
@ -1423,8 +1439,10 @@ object EditForm: TEditForm
Top = 212 Top = 212
Width = 57 Width = 57
Height = 21 Height = 21
Enabled = False
TabOrder = 11 TabOrder = 11
Text = '0' Text = '0'
Visible = False
OnExit = PostCoefValidate OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress OnKeyPress = PostCoefKeypress
end end
@ -1433,8 +1451,10 @@ object EditForm: TEditForm
Top = 236 Top = 236
Width = 57 Width = 57
Height = 21 Height = 21
Enabled = False
TabOrder = 12 TabOrder = 12
Text = '0' Text = '0'
Visible = False
OnExit = PostCoefValidate OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress OnKeyPress = PostCoefKeypress
end end
@ -1443,8 +1463,10 @@ object EditForm: TEditForm
Top = 236 Top = 236
Width = 57 Width = 57
Height = 21 Height = 21
Enabled = False
TabOrder = 13 TabOrder = 13
Text = '0' Text = '0'
Visible = False
OnExit = PostCoefValidate OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress OnKeyPress = PostCoefKeypress
end end

View File

@ -314,7 +314,6 @@ type
private private
TriangleView: TCustomDrawControl; TriangleView: TCustomDrawControl;
cmap: TColorMap; cmap: TColorMap;
// cp1: TControlPoint;
PreviewDensity: double; PreviewDensity: double;
// --Z-- // --Z--
@ -322,6 +321,7 @@ type
editMode, oldMode: (modeNone, modeMove, modeRotate, modeScale, modePick); editMode, oldMode: (modeNone, modeMove, modeRotate, modeScale, modePick);
modeKey: word; modeKey: word;
key_handled: boolean; key_handled: boolean;
updating: boolean;
MousePos: TPoint; // in screen coordinates MousePos: TPoint; // in screen coordinates
mouseOverTriangle, mouseOverCorner: integer; mouseOverTriangle, mouseOverCorner: integer;
@ -670,6 +670,8 @@ var
v: double; v: double;
strval: string; strval: string;
begin begin
updating := true;
if (SelectedTriangle > LastTriangle) then SelectedTriangle := LastTriangle; if (SelectedTriangle > LastTriangle) then SelectedTriangle := LastTriangle;
cbTransforms.ItemIndex := SelectedTriangle; cbTransforms.ItemIndex := SelectedTriangle;
@ -761,6 +763,8 @@ begin
end; end;
PageControl.Refresh; PageControl.Refresh;
updating := false;
end; end;
procedure TEditForm.Scale(var fx, fy: double; x, y: integer); procedure TEditForm.Scale(var fx, fy: double; x, y: integer);
@ -782,7 +786,7 @@ begin
yminz := 0; yminz := 0;
xmaxz := 0; xmaxz := 0;
ymaxz := 0; ymaxz := 0;
for i := -1 to Transforms - 1 do for i := -1 to LastTriangle do
begin begin
for j := 0 to 2 do for j := 0 to 2 do
begin begin
@ -810,19 +814,6 @@ procedure TEditForm.UpdateFlameX;
var var
i: integer; i: integer;
begin begin
for i := 0 to Transforms do
begin
// CP_compute(cp1, Triangles[i], Triangles[-1], i);
solve3(MainTriangles[-1].x[0], MainTriangles[-1].y[0], MainTriangles[i].x[0],
MainTriangles[-1].x[1], MainTriangles[-1].y[1], MainTriangles[i].x[1],
MainTriangles[-1].x[2], MainTriangles[-1].y[2], MainTriangles[i].x[2],
cp.xform[i].c[0][0], cp.xform[i].c[1][0], cp.xform[i].c[2][0]);
solve3(MainTriangles[-1].x[0], MainTriangles[-1].y[0], MainTriangles[i].y[0],
MainTriangles[-1].x[1], MainTriangles[-1].y[1], MainTriangles[i].y[1],
MainTriangles[-1].x[2], MainTriangles[-1].y[2], MainTriangles[i].y[2],
cp.xform[i].c[0][1], cp.xform[i].c[1][1], cp.xform[i].c[2][1]);
end;
cp.GetFromTriangles(MainTriangles, Transforms); cp.GetFromTriangles(MainTriangles, Transforms);
if not chkPreserve.checked then cp.ComputeWeights(MainTriangles, Transforms); if not chkPreserve.checked then cp.ComputeWeights(MainTriangles, Transforms);
DrawPreview; DrawPreview;
@ -2008,9 +1999,13 @@ begin
MainForm.UpdateUndo; MainForm.UpdateUndo;
MainTriangles[Transforms+1] := MainTriangles[Transforms]; MainTriangles[Transforms+1] := MainTriangles[Transforms];
cp.xform[Transforms+1].Assign(cp.xform[Transforms]); cp.xform[Transforms+1].Assign(cp.xform[Transforms]);
MainTriangles[Transforms] := MainTriangles[SelectedTriangle]; if SelectedTriangle <> Transforms then
cp.xform[Transforms].Assign(cp.xform[SelectedTriangle]); begin
SelectedTriangle := Transforms; MainTriangles[Transforms] := MainTriangles[SelectedTriangle];
cp.xform[Transforms].Assign(cp.xform[SelectedTriangle]);
SelectedTriangle := Transforms;
end
else cp.xform[Transforms].density := 0.5;
Inc(Transforms); Inc(Transforms);
cbTransforms.clear; cbTransforms.clear;
for i := 1 to Transforms do cbTransforms.Items.Add(IntToStr(i)); for i := 1 to Transforms do cbTransforms.Items.Add(IntToStr(i));
@ -2526,6 +2521,8 @@ procedure TEditForm.scrlXFormColorChange(Sender: TObject);
var var
v: double; v: double;
begin begin
if updating then exit;
v := (scrlXFormColor.Position) / scrlXFormColor.Max; v := (scrlXFormColor.Position) / scrlXFormColor.Max;
cp.xform[SelectedTriangle].color := v; cp.xform[SelectedTriangle].color := v;
pnlXFormColor.color := ColorValToColor(MainCp.cmap, v); pnlXFormColor.color := ColorValToColor(MainCp.cmap, v);
@ -3812,7 +3809,8 @@ begin
pnlDragPos := 0; pnlDragPos := 0;
pnlDragOld := x; pnlDragOld := x;
varMM := false; varMM := false;
SetCaptureControl(TControl(Sender)); //SetCaptureControl(TControl(Sender));
Screen.Cursor := crHSplit; Screen.Cursor := crHSplit;
GetCursorPos(mousepos); // hmmm GetCursorPos(mousepos); // hmmm
HasChanged := false; HasChanged := false;
@ -3862,9 +3860,12 @@ begin
else if v > 1 then v := 1; else if v > 1 then v := 1;
cp.xform[SelectedTriangle].color := v; cp.xform[SelectedTriangle].color := v;
pnlXFormColor.Color := ColorValToColor(cp.cmap, v); pnlXFormColor.Color := ColorValToColor(cp.cmap, v);
updating := true;
scrlXformColor.Position := round(v*1000); scrlXformColor.Position := round(v*1000);
pEdit := @txtXformColor; pEdit := @txtXformColor;
end; updating := false;
end
else assert(false);
pEdit^.Text := FloatToStr(v); // Format('%.6g', [v]) pEdit^.Text := FloatToStr(v); // Format('%.6g', [v])
//pEdit.Refresh; //pEdit.Refresh;
HasChanged := True; HasChanged := True;
@ -3879,7 +3880,8 @@ begin
if pnlDragMode then if pnlDragMode then
begin begin
SetCaptureControl(nil); //SetCaptureControl(nil);
pnlDragMode := false; pnlDragMode := false;
Screen.Cursor := crDefault; Screen.Cursor := crDefault;