new doubleclick actions, modes and toolbar buttons in editor
This commit is contained in:
parent
3e30ef3a49
commit
3fb6744eba
File diff suppressed because it is too large
Load Diff
@ -28,13 +28,14 @@ uses
|
|||||||
Types, XForm;
|
Types, XForm;
|
||||||
|
|
||||||
const
|
const
|
||||||
// PixelCountMax = 32768;
|
crEditArrow = 20;
|
||||||
// WM_PTHREAD_COMPLETE = WM_APP + 5438;
|
crEditMove = 21;
|
||||||
|
|
||||||
crEditArrow = 20;
|
|
||||||
crEditMove = 21;
|
|
||||||
crEditRotate = 22;
|
crEditRotate = 22;
|
||||||
crEditScale = 23;
|
crEditScale = 23;
|
||||||
|
|
||||||
|
imgExtMove = 24;
|
||||||
|
imgExtRotate = 25;
|
||||||
|
imgExtScale = 26;
|
||||||
|
|
||||||
type
|
type
|
||||||
TEditForm = class(TForm)
|
TEditForm = class(TForm)
|
||||||
@ -120,10 +121,6 @@ type
|
|||||||
tbFlipHorz: TToolButton;
|
tbFlipHorz: TToolButton;
|
||||||
tbFlipVert: TToolButton;
|
tbFlipVert: TToolButton;
|
||||||
tbSelect: TToolButton;
|
tbSelect: TToolButton;
|
||||||
btTrgMoveLU: TSpeedButton;
|
|
||||||
btTrgMoveLD: TSpeedButton;
|
|
||||||
btTrgMoveRU: TSpeedButton;
|
|
||||||
btTrgMoveRD: TSpeedButton;
|
|
||||||
EditorTB: TImageList;
|
EditorTB: TImageList;
|
||||||
TabSheet4: TTabSheet;
|
TabSheet4: TTabSheet;
|
||||||
vleVariables: TValueListEditor;
|
vleVariables: TValueListEditor;
|
||||||
@ -174,11 +171,27 @@ type
|
|||||||
txtSymmetry: TEdit;
|
txtSymmetry: TEdit;
|
||||||
pnlWeight: TPanel;
|
pnlWeight: TPanel;
|
||||||
pnlSymmetry: TPanel;
|
pnlSymmetry: TPanel;
|
||||||
tbAutoEditMode: TToolButton;
|
tbExtendedEdit: TToolButton;
|
||||||
mnuResetTrgRotation: TMenuItem;
|
mnuResetTrgRotation: TMenuItem;
|
||||||
mnuResetTrgPosition: TMenuItem;
|
mnuResetTrgPosition: TMenuItem;
|
||||||
mnuResetTrgScale: TMenuItem;
|
mnuResetTrgScale: TMenuItem;
|
||||||
N7: TMenuItem;
|
N7: TMenuItem;
|
||||||
|
mnuExtendedEdit: TMenuItem;
|
||||||
|
N8: TMenuItem;
|
||||||
|
mnuAxisLock: TMenuItem;
|
||||||
|
tbAxisLock: TToolButton;
|
||||||
|
mnuSelectmode: TMenuItem;
|
||||||
|
ToolButton6: TToolButton;
|
||||||
|
ExtendedEditPopup: TPopupMenu;
|
||||||
|
mnuExtEditOff: TMenuItem;
|
||||||
|
mnuExtEditMove: TMenuItem;
|
||||||
|
mnuExtEditRotate: TMenuItem;
|
||||||
|
mnuExtEditScale: TMenuItem;
|
||||||
|
N9: TMenuItem;
|
||||||
|
tbPivotMode: TToolButton;
|
||||||
|
tbRotate90CCW: TToolButton;
|
||||||
|
tbRotate90CW: TToolButton;
|
||||||
|
chkAxisLock: TCheckBox;
|
||||||
procedure ValidateVariable;
|
procedure ValidateVariable;
|
||||||
procedure vleVariablesValidate(Sender: TObject; ACol, ARow: Integer; const KeyName, KeyValue: string);
|
procedure vleVariablesValidate(Sender: TObject; ACol, ARow: Integer; const KeyName, KeyValue: string);
|
||||||
procedure vleVariablesKeyPress(Sender: TObject; var Key: Char);
|
procedure vleVariablesKeyPress(Sender: TObject; var Key: Char);
|
||||||
@ -317,8 +330,10 @@ type
|
|||||||
procedure DragPanelDblClick(Sender: TObject);
|
procedure DragPanelDblClick(Sender: TObject);
|
||||||
procedure mnuResetTrgRotationClick(Sender: TObject);
|
procedure mnuResetTrgRotationClick(Sender: TObject);
|
||||||
procedure mnuResetTrgScaleClick(Sender: TObject);
|
procedure mnuResetTrgScaleClick(Sender: TObject);
|
||||||
procedure ResetEdgeRotation(n: integer);
|
procedure ResetAxisRotation(n: integer);
|
||||||
procedure ResetEdgeScale(n: integer);
|
procedure ResetAxisScale(n: integer);
|
||||||
|
procedure tbExtendedEditClick(Sender: TObject);
|
||||||
|
procedure tbAxisLockClick(Sender: TObject);
|
||||||
|
|
||||||
private
|
private
|
||||||
TriangleView: TCustomDrawControl;
|
TriangleView: TCustomDrawControl;
|
||||||
@ -326,7 +341,7 @@ type
|
|||||||
PreviewDensity: double;
|
PreviewDensity: double;
|
||||||
|
|
||||||
viewDragMode, viewDragged: boolean;
|
viewDragMode, viewDragged: boolean;
|
||||||
editMode, oldMode: (modeNone, modeMove, modeRotate, modeScale, modePick);
|
editMode, oldMode, widgetMode: (modeNone, modeMove, modeRotate, modeScale, modePick);
|
||||||
modeHack: boolean; // for mouseOverEdge...
|
modeHack: boolean; // for mouseOverEdge...
|
||||||
modeKey: word;
|
modeKey: word;
|
||||||
key_handled: boolean;
|
key_handled: boolean;
|
||||||
@ -345,6 +360,7 @@ type
|
|||||||
varDragPos, varDragOld: integer;
|
varDragPos, varDragOld: integer;
|
||||||
varMM: boolean; //hack?
|
varMM: boolean; //hack?
|
||||||
|
|
||||||
|
SelectMode, ExtendedEdit, AxisLock: boolean;
|
||||||
showVarPreview: boolean;
|
showVarPreview: boolean;
|
||||||
|
|
||||||
// --Z-- variables moved from outside
|
// --Z-- variables moved from outside
|
||||||
@ -354,12 +370,11 @@ type
|
|||||||
// SelectedTriangle: integer; // outside only for scripting (??)
|
// SelectedTriangle: integer; // outside only for scripting (??)
|
||||||
oldSelected: integer;
|
oldSelected: integer;
|
||||||
SelectedCorner: integer;
|
SelectedCorner: integer;
|
||||||
SelectMode: boolean;
|
|
||||||
HasChanged: boolean;
|
HasChanged: boolean;
|
||||||
|
|
||||||
oldx, oldy, olddist: double;
|
oldx, oldy, olddist: double;
|
||||||
Pivot, LocalPivot, WorldPivot: TSPoint;
|
Pivot, LocalPivot, WorldPivot: TSPoint;
|
||||||
PivotMode: (pivotLocal, pivotWorld);
|
PivotMode: (pivotLocal, pivotWorld);
|
||||||
VarsCache: array[0..64] of double; // hack: to prevent slow valuelist redraw
|
VarsCache: array[0..64] of double; // hack: to prevent slow valuelist redraw
|
||||||
|
|
||||||
pnlDragMode: boolean;
|
pnlDragMode: boolean;
|
||||||
@ -1191,7 +1206,7 @@ end;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
UpdateWidgets;
|
UpdateWidgets;
|
||||||
if AutoEditMode then begin
|
if ExtendedEdit then begin
|
||||||
n := GetTriangleColor(SelectedTriangle);// shr 1 and $7f7f7f;
|
n := GetTriangleColor(SelectedTriangle);// shr 1 and $7f7f7f;
|
||||||
if mouseOverTriangle <> SelectedTriangle then n := n shr 1 and $7f7f7f;
|
if mouseOverTriangle <> SelectedTriangle then n := n shr 1 and $7f7f7f;
|
||||||
Pen.Color := n;
|
Pen.Color := n;
|
||||||
@ -1410,7 +1425,6 @@ end;
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
// if EdgeCaught then
|
// if EdgeCaught then
|
||||||
if (mouseOverEdge >= 0) then // highlight edge under cursor
|
if (mouseOverEdge >= 0) then // highlight edge under cursor
|
||||||
@ -1428,6 +1442,7 @@ end;
|
|||||||
pen.Mode:=pmCopy;
|
pen.Mode:=pmCopy;
|
||||||
pen.Width:=1;
|
pen.Width:=1;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// draw pivot point
|
// draw pivot point
|
||||||
a := ToScreen(GetPivot.x, GetPivot.y);
|
a := ToScreen(GetPivot.x, GetPivot.y);
|
||||||
@ -1528,6 +1543,12 @@ begin
|
|||||||
|
|
||||||
SelectMode := true;
|
SelectMode := true;
|
||||||
editMode := modeMove;
|
editMode := modeMove;
|
||||||
|
AxisLock := TransformAxisLock;
|
||||||
|
tbAxisLock.Down := AxisLock;
|
||||||
|
ExtendedEdit := ExtEditEnabled;
|
||||||
|
// tbExtendedEdit.Down := ExtendedEdit;
|
||||||
|
widgetMode := modeRotate;
|
||||||
|
// tbExtendedEdit.ImageIndex := imgExtMove;
|
||||||
|
|
||||||
EdgeCaught := false;
|
EdgeCaught := false;
|
||||||
CornerCaught := false;
|
CornerCaught := false;
|
||||||
@ -1605,7 +1626,7 @@ begin
|
|||||||
|
|
||||||
// -- from MouseDown -- for highlighting:
|
// -- from MouseDown -- for highlighting:
|
||||||
// TODO: optimize...
|
// TODO: optimize...
|
||||||
if (j = 1) then //and ((rgPivot.ItemIndex = 1) or (rgPivot.ItemIndex = 4)) then
|
if (j = 1) then
|
||||||
begin
|
begin
|
||||||
if PivotMode = pivotLocal then begin
|
if PivotMode = pivotLocal then begin
|
||||||
Pivot.x := 0;
|
Pivot.x := 0;
|
||||||
@ -1636,7 +1657,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if AutoEditMode then //and (oldMode = modeNone) then
|
if ExtendedEdit then //and (oldMode = modeNone) then
|
||||||
begin
|
begin
|
||||||
for i := 0 to 3 do // -- detect 'widget' hit
|
for i := 0 to 3 do // -- detect 'widget' hit
|
||||||
for j := 0 to 1 do begin
|
for j := 0 to 1 do begin
|
||||||
@ -1813,6 +1834,13 @@ Skip1:
|
|||||||
vx := fx;
|
vx := fx;
|
||||||
vy := fy;
|
vy := fy;
|
||||||
end;
|
end;
|
||||||
|
if (SelectedCorner = 1) and AxisLock then with MainTriangles[SelectedTriangle] do
|
||||||
|
begin
|
||||||
|
x[0] := OldTriangle.x[0] + (vx - OldTriangle.x[1]);
|
||||||
|
y[0] := OldTriangle.y[0] + (vy - OldTriangle.y[1]);
|
||||||
|
x[2] := OldTriangle.x[2] + (vx - OldTriangle.x[1]);
|
||||||
|
y[2] := OldTriangle.y[2] + (vy - OldTriangle.y[1]);
|
||||||
|
end;
|
||||||
MainTriangles[SelectedTriangle].x[SelectedCorner] := vx;
|
MainTriangles[SelectedTriangle].x[SelectedCorner] := vx;
|
||||||
MainTriangles[SelectedTriangle].y[SelectedCorner] := vy;
|
MainTriangles[SelectedTriangle].y[SelectedCorner] := vy;
|
||||||
StatusBar.Panels[2].Text := Format('Move: %3.3f ; %3.3f', [vx-(Pivot.X+oldx), vy-(Pivot.Y+oldy)]);
|
StatusBar.Panels[2].Text := Format('Move: %3.3f ; %3.3f', [vx-(Pivot.X+oldx), vy-(Pivot.Y+oldy)]);
|
||||||
@ -1857,7 +1885,7 @@ Skip2:
|
|||||||
else if (editMode = modeScale) then // scale
|
else if (editMode = modeScale) then // scale
|
||||||
begin
|
begin
|
||||||
if olddist<>0 then begin
|
if olddist<>0 then begin
|
||||||
vy := (oldx*(fx-Pivot.X) + oldy*(fy-Pivot.Y))/(olddist*olddist);
|
vy := (oldx*(fx-Pivot.X) + oldy*(fy-Pivot.Y))/sqr(olddist);
|
||||||
|
|
||||||
if ssShift in Shift then // 'snapped' scale
|
if ssShift in Shift then // 'snapped' scale
|
||||||
begin
|
begin
|
||||||
@ -2014,14 +2042,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if AutoEditMode then //and (oldMode = modeNone) then
|
if ExtendedEdit then //and (oldMode = modeNone) then
|
||||||
begin
|
begin
|
||||||
for i := 0 to 3 do // -- detect 'widget' hit
|
for i := 0 to 3 do // -- detect 'widget' hit
|
||||||
for j := 0 to 1 do
|
for j := 0 to 1 do
|
||||||
begin
|
begin
|
||||||
if abs(line_dist(fx, fy, Widgets[i][j].x, Widgets[i][j].y,
|
if abs(line_dist(fx, fy, Widgets[i][j].x, Widgets[i][j].y,
|
||||||
Widgets[i][j+1].x, Widgets[i][j+1].y)
|
Widgets[i][j+1].x, Widgets[i][j+1].y)
|
||||||
) * GraphZoom * 50 < 3 then
|
) * GraphZoom * 50 < 3 then
|
||||||
begin
|
begin
|
||||||
// modeHack := true;
|
// modeHack := true;
|
||||||
if (oldMode = modeNone) then
|
if (oldMode = modeNone) then
|
||||||
@ -2052,7 +2080,8 @@ begin
|
|||||||
if j = 2 then
|
if j = 2 then
|
||||||
editMode := modeScale
|
editMode := modeScale
|
||||||
else
|
else
|
||||||
// editMode := modeRotate;
|
if AxisLock then editMode := modeRotate
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
// hacky...
|
// hacky...
|
||||||
CornerCaught := True;
|
CornerCaught := True;
|
||||||
@ -2225,7 +2254,7 @@ begin
|
|||||||
Registry.Free;
|
Registry.Free;
|
||||||
end;
|
end;
|
||||||
chkUseXFormColor.checked := UseTransformColors;
|
chkUseXFormColor.checked := UseTransformColors;
|
||||||
if AutoEditMode then tbAutoEditMode.Down := true
|
if ExtendedEdit then tbExtendedEdit.Down := true
|
||||||
else tbMove.Down := true;
|
else tbMove.Down := true;
|
||||||
UpdateDisplay;
|
UpdateDisplay;
|
||||||
end;
|
end;
|
||||||
@ -3534,20 +3563,30 @@ begin
|
|||||||
begin
|
begin
|
||||||
if mouseOverCorner >= 0 then begin
|
if mouseOverCorner >= 0 then begin
|
||||||
case mouseOverCorner of
|
case mouseOverCorner of
|
||||||
0: ResetEdgeScale(0); //btnXcoefsClick(Sender);
|
0: if editMode = modeRotate then ResetAxisRotation(0) else ResetAxisScale(0);
|
||||||
1: btnOcoefsClick(Sender);
|
1: if editMode = modeRotate then ResetAxisRotation(1)
|
||||||
2: ResetEdgeScale(2); //btnYcoefsClick(Sender);
|
else if editMode = modeScale then ResetAxisScale(1) else btnOcoefsClick(Sender);
|
||||||
|
2: if editMode = modeRotate then ResetAxisRotation(2) else ResetAxisScale(2);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else if mouseOverEdge >= 0 then begin
|
else if mouseOverEdge >= 0 then begin
|
||||||
case mouseOverEdge of
|
if AxisLock then begin
|
||||||
0: if editMode = modeScale then ResetEdgeScale(0) else ResetEdgeRotation(0);
|
if (editMode = modeScale) or (mouseOverEdge = 2)then
|
||||||
1: if editMode = modeScale then ResetEdgeScale(2) else ResetEdgeRotation(2);
|
mnuResetTrgScaleClick(Sender)
|
||||||
|
else
|
||||||
|
mnuResetTrgRotationClick(Sender);
|
||||||
|
end
|
||||||
|
else case mouseOverEdge of
|
||||||
|
0: if editMode = modeScale then ResetAxisScale(0) else ResetAxisRotation(0);
|
||||||
|
1: if editMode = modeScale then ResetAxisScale(2) else ResetAxisRotation(2);
|
||||||
2: mnuResetTrgScaleClick(Sender);
|
2: mnuResetTrgScaleClick(Sender);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else if mouseOverWidget >= 0 then begin
|
else if mouseOverWidget >= 0 then begin
|
||||||
mnuResetTrgRotationClick(Sender);
|
case editMode of
|
||||||
|
modeScale: mnuResetTrgScaleClick(Sender);
|
||||||
|
else mnuResetTrgRotationClick(Sender);
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else case editMode of
|
else case editMode of
|
||||||
//modeMove: Do Nothing
|
//modeMove: Do Nothing
|
||||||
@ -3565,7 +3604,7 @@ end;
|
|||||||
|
|
||||||
procedure TEditForm.tbEditModeClick(Sender: TObject);
|
procedure TEditForm.tbEditModeClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
AutoEditMode := (Sender = tbAutoEditMode);
|
// ExtendedEdit := (Sender = tbExtendedEdit);
|
||||||
if Sender = tbRotate then
|
if Sender = tbRotate then
|
||||||
begin
|
begin
|
||||||
editMode := modeRotate;
|
editMode := modeRotate;
|
||||||
@ -3584,6 +3623,21 @@ begin
|
|||||||
TriangleView.Invalidate;
|
TriangleView.Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TEditForm.tbExtendedEditClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ExtendedEdit := not ExtendedEdit;
|
||||||
|
tbExtendedEdit.Down := ExtendedEdit;
|
||||||
|
TriangleView.Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditForm.tbAxisLockClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if Sender = chkAxisLock then AxisLock := chkAxisLock.Checked
|
||||||
|
else AxisLock := not AxisLock;
|
||||||
|
tbAxisLock.Down := AxisLock;
|
||||||
|
chkAxisLock.Checked := AxisLock;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TEditForm.tbFullViewClick(Sender: TObject);
|
procedure TEditForm.tbFullViewClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
MainForm.mnuFullScreenClick(Sender);
|
MainForm.mnuFullScreenClick(Sender);
|
||||||
@ -3903,11 +3957,13 @@ begin
|
|||||||
with MainTriangles[SelectedTriangle] do begin
|
with MainTriangles[SelectedTriangle] do begin
|
||||||
PivotMode := pivotLocal;
|
PivotMode := pivotLocal;
|
||||||
btnPivotMode.Caption := 'Local Pivot';
|
btnPivotMode.Caption := 'Local Pivot';
|
||||||
|
tbPivotMode.Down := false;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
with MainTriangles[SelectedTriangle] do begin
|
with MainTriangles[SelectedTriangle] do begin
|
||||||
PivotMode := pivotWorld;
|
PivotMode := pivotWorld;
|
||||||
btnPivotMode.Caption := 'World Pivot';
|
btnPivotMode.Caption := 'World Pivot';
|
||||||
|
tbPivotMode.Down := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TriangleView.Invalidate;
|
TriangleView.Invalidate;
|
||||||
@ -4270,7 +4326,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEditForm.ResetEdgeRotation(n: integer);
|
procedure TEditForm.ResetAxisRotation(n: integer);
|
||||||
var
|
var
|
||||||
dx, dy, d: double;
|
dx, dy, d: double;
|
||||||
a: integer;
|
a: integer;
|
||||||
@ -4278,47 +4334,80 @@ var
|
|||||||
begin
|
begin
|
||||||
with MainTriangles[SelectedTriangle] do
|
with MainTriangles[SelectedTriangle] do
|
||||||
begin
|
begin
|
||||||
dx := x[n] - x[1];
|
if n = 1 then
|
||||||
dy := y[n] - y[1];
|
begin
|
||||||
a := round( arctan2(dy, dx) / (pi/2) );
|
d := Hypot(x[1], y[1]);
|
||||||
d := Hypot(dx, dy);
|
if d = 0 then exit;
|
||||||
// if xx*yy - yx*xy >= 0 then da := 1 else da := -1;
|
a := round( arctan2(y[1], x[1]) / (pi/2) );
|
||||||
// if ax = ay then ay := ay + da
|
nx := d*cos(a*pi/2);
|
||||||
// else if abs(ax-ay) = 2 then ay := ay - da;
|
ny := d*sin(a*pi/2);
|
||||||
|
if (x[1] = nx) and (y[1] = ny) then exit;
|
||||||
nx := x[1] + d*cos(a*pi/2);
|
MainForm.UpdateUndo;
|
||||||
ny := y[1] + d*sin(a*pi/2);
|
x[1] := nx;
|
||||||
if (x[n] = nx) and (y[n] = ny) then exit;
|
y[1] := ny;
|
||||||
MainForm.UpdateUndo;
|
x[0] := x[1] + xx;
|
||||||
x[n] := nx;
|
y[0] := y[1] + xy;
|
||||||
y[n] := ny;
|
x[2] := x[1] + yx;
|
||||||
UpdateFlame(True);
|
y[2] := y[1] + yy;
|
||||||
|
UpdateFlame(True);
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
dx := x[n] - x[1];
|
||||||
|
dy := y[n] - y[1];
|
||||||
|
a := round( arctan2(dy, dx) / (pi/2) );
|
||||||
|
d := Hypot(dx, dy);
|
||||||
|
nx := x[1] + d*cos(a*pi/2);
|
||||||
|
ny := y[1] + d*sin(a*pi/2);
|
||||||
|
if (x[n] = nx) and (y[n] = ny) then exit;
|
||||||
|
MainForm.UpdateUndo;
|
||||||
|
x[n] := nx;
|
||||||
|
y[n] := ny;
|
||||||
|
UpdateFlame(True);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEditForm.ResetEdgeScale(n: integer);
|
procedure TEditForm.ResetAxisScale(n: integer);
|
||||||
var
|
var
|
||||||
dx, dy, d: double;
|
dx, dy, d: double;
|
||||||
nx, ny: double;
|
nx, ny: double;
|
||||||
begin
|
begin
|
||||||
with MainTriangles[SelectedTriangle] do
|
with MainTriangles[SelectedTriangle] do
|
||||||
begin
|
begin
|
||||||
dx := x[n] - x[1];
|
if n = 1 then
|
||||||
dy := y[n] - y[1];
|
begin
|
||||||
d := Hypot(dx, dy);
|
d := Hypot(x[1], y[1]);
|
||||||
if d <> 0 then begin
|
if d = 0 then exit;
|
||||||
nx := x[1] + dx / d;
|
nx := x[1]/d;
|
||||||
ny := y[1] + dy / d;
|
ny := y[1]/d;
|
||||||
|
if (x[1] = nx) and (y[1] = ny) then exit;
|
||||||
|
MainForm.UpdateUndo;
|
||||||
|
x[1] := nx;
|
||||||
|
y[1] := ny;
|
||||||
|
x[0] := x[1] + xx;
|
||||||
|
y[0] := y[1] + xy;
|
||||||
|
x[2] := x[1] + yx;
|
||||||
|
y[2] := y[1] + yy;
|
||||||
|
UpdateFlame(True);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
nx := x[1] + ifthen(n=0, 1, 0);
|
dx := x[n] - x[1];
|
||||||
ny := y[1] + ifthen(n=2, 1, 0);
|
dy := y[n] - y[1];
|
||||||
|
d := Hypot(dx, dy);
|
||||||
|
if d <> 0 then begin
|
||||||
|
nx := x[1] + dx / d;
|
||||||
|
ny := y[1] + dy / d;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
nx := x[1] + ifthen(n=0, 1, 0);
|
||||||
|
ny := y[1] + ifthen(n=2, 1, 0);
|
||||||
|
end;
|
||||||
|
if (x[n] = nx) and (y[n] = ny) then exit;
|
||||||
|
MainForm.UpdateUndo;
|
||||||
|
x[n] := nx;
|
||||||
|
y[n] := ny;
|
||||||
|
UpdateFlame(True);
|
||||||
end;
|
end;
|
||||||
if (x[n] = nx) and (y[n] = ny) then exit;
|
|
||||||
MainForm.UpdateUndo;
|
|
||||||
x[n] := nx;
|
|
||||||
y[n] := ny;
|
|
||||||
UpdateFlame(True);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ var
|
|||||||
UseFlameBackground, UseTransformColors: boolean;
|
UseFlameBackground, UseTransformColors: boolean;
|
||||||
EditorBkgColor, ReferenceTriangleColor: integer;
|
EditorBkgColor, ReferenceTriangleColor: integer;
|
||||||
GridColor1, GridColor2, HelpersColor: integer;
|
GridColor1, GridColor2, HelpersColor: integer;
|
||||||
AutoEditMode: boolean;
|
ExtEditEnabled, TransformAxisLock: boolean;
|
||||||
{ Display }
|
{ Display }
|
||||||
defSampleDensity, defPreviewDensity: Double;
|
defSampleDensity, defPreviewDensity: Double;
|
||||||
defGamma, defBrightness, defVibrancy, defFilterRadius: Double;
|
defGamma, defBrightness, defVibrancy, defFilterRadius: Double;
|
||||||
|
@ -356,16 +356,26 @@ object OptionsForm: TOptionsForm
|
|||||||
'Wandering (old-style)')
|
'Wandering (old-style)')
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object chkAutoEditMode: TCheckBox
|
object chkExtendedEdit: TCheckBox
|
||||||
Left = 160
|
Left = 160
|
||||||
Top = 80
|
Top = 80
|
||||||
Width = 161
|
Width = 145
|
||||||
Height = 17
|
Height = 17
|
||||||
Caption = 'Prefer "Extended" edit mode'
|
Caption = 'Extended edit mode'
|
||||||
Checked = True
|
Checked = True
|
||||||
State = cbChecked
|
State = cbChecked
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
|
object chkAxisLock: TCheckBox
|
||||||
|
Left = 160
|
||||||
|
Top = 100
|
||||||
|
Width = 145
|
||||||
|
Height = 17
|
||||||
|
Caption = 'Lock transform axis'
|
||||||
|
Checked = True
|
||||||
|
State = cbChecked
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object DisplayPage: TTabSheet
|
object DisplayPage: TTabSheet
|
||||||
Caption = 'Display'
|
Caption = 'Display'
|
||||||
|
@ -201,10 +201,11 @@ type
|
|||||||
pnlGridColor2: TPanel;
|
pnlGridColor2: TPanel;
|
||||||
pnlHelpersColor: TPanel;
|
pnlHelpersColor: TPanel;
|
||||||
rgReferenceMode: TRadioGroup;
|
rgReferenceMode: TRadioGroup;
|
||||||
chkAutoEditMode: TCheckBox;
|
chkExtendedEdit: TCheckBox;
|
||||||
chkPlaysound: TCheckBox;
|
chkPlaysound: TCheckBox;
|
||||||
btnPlay: TSpeedButton;
|
btnPlay: TSpeedButton;
|
||||||
Label44: TLabel;
|
Label44: TLabel;
|
||||||
|
chkAxisLock: TCheckBox;
|
||||||
procedure btnCancelClick(Sender: TObject);
|
procedure btnCancelClick(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure btnOKClick(Sender: TObject);
|
procedure btnOKClick(Sender: TObject);
|
||||||
@ -295,7 +296,8 @@ begin
|
|||||||
cbNrTheads.ItemIndex := 0
|
cbNrTheads.ItemIndex := 0
|
||||||
else
|
else
|
||||||
cbNrTheads.text := intTostr(NrTreads);
|
cbNrTheads.text := intTostr(NrTreads);
|
||||||
chkAutoEditMode.Checked := AutoEditMode;
|
chkExtendedEdit.Checked := ExtEditEnabled;
|
||||||
|
chkAxisLock.Checked := TransformAxisLock;
|
||||||
|
|
||||||
chkPlaySound.Checked := PlaySoundOnRenderComplete;
|
chkPlaySound.Checked := PlaySoundOnRenderComplete;
|
||||||
txtSoundFile.Text := RenderCompleteSoundFile;
|
txtSoundFile.Text := RenderCompleteSoundFile;
|
||||||
@ -413,7 +415,8 @@ begin
|
|||||||
|
|
||||||
// Editor
|
// Editor
|
||||||
ReferenceMode := rgReferenceMode.ItemIndex;
|
ReferenceMode := rgReferenceMode.ItemIndex;
|
||||||
AutoEditMode := chkAutoEditMode.Checked;
|
ExtEditEnabled := chkExtendedEdit.Checked;
|
||||||
|
TransformAxisLock := chkAxisLock.Checked;
|
||||||
|
|
||||||
{ Display tab }
|
{ Display tab }
|
||||||
defSampleDensity := StrToFloat(txtSampleDensity.Text);
|
defSampleDensity := StrToFloat(txtSampleDensity.Text);
|
||||||
|
@ -285,14 +285,6 @@ begin
|
|||||||
SymmetryNVars := 12;
|
SymmetryNVars := 12;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// --- tmp fix for pre-d4 problem ---
|
|
||||||
|
|
||||||
if Registry.ValueExists('VariationOptions') then
|
|
||||||
if Registry.GetDataType('VariationOptions') <> rdInteger then
|
|
||||||
Registry.WriteInteger('VariationOptions', 262143);
|
|
||||||
|
|
||||||
// --- tmp fix for pre-d4 problem ---
|
|
||||||
|
|
||||||
if Registry.ValueExists('VariationOptions') then
|
if Registry.ValueExists('VariationOptions') then
|
||||||
begin
|
begin
|
||||||
VariationOptions := Registry.ReadInteger('VariationOptions');
|
VariationOptions := Registry.ReadInteger('VariationOptions');
|
||||||
@ -638,10 +630,12 @@ if Registry.ValueExists('VariationOptions') then
|
|||||||
ReferenceTriangleColor := Registry.ReadInteger('ReferenceTriangleColor')
|
ReferenceTriangleColor := Registry.ReadInteger('ReferenceTriangleColor')
|
||||||
else
|
else
|
||||||
ReferenceTriangleColor := $7f7f7f;
|
ReferenceTriangleColor := $7f7f7f;
|
||||||
if Registry.ValueExists('AutoEditMode') then
|
if Registry.ValueExists('ExtendedEdit') then
|
||||||
AutoEditMode := Registry.ReadBool('AutoEditMode')
|
ExtEditEnabled := Registry.ReadBool('ExtendedEdit')
|
||||||
else AutoEditMode := true;
|
else ExtEditEnabled := true;
|
||||||
|
if Registry.ValueExists('LockTransformAxis') then
|
||||||
|
TransformAxisLock := Registry.ReadBool('LockTransformAxis')
|
||||||
|
else TransformAxisLock := true;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
EditorBkgColor := $000000;
|
EditorBkgColor := $000000;
|
||||||
@ -1007,7 +1001,8 @@ begin
|
|||||||
Registry.WriteInteger('GridColor2', GridColor2);
|
Registry.WriteInteger('GridColor2', GridColor2);
|
||||||
Registry.WriteInteger('HelpersColor', HelpersColor);
|
Registry.WriteInteger('HelpersColor', HelpersColor);
|
||||||
Registry.WriteInteger('ReferenceTriangleColor', ReferenceTriangleColor);
|
Registry.WriteInteger('ReferenceTriangleColor', ReferenceTriangleColor);
|
||||||
Registry.WriteBool('AutoEditMode', AutoEditMode);
|
Registry.WriteBool('ExtendedEdit', ExtEditEnabled);
|
||||||
|
Registry.WriteBool('LockTransformAxis', TransformAxisLock);
|
||||||
end;
|
end;
|
||||||
{ Display }
|
{ Display }
|
||||||
if Registry.OpenKey('\Software\' + APP_NAME + '\Display', True) then
|
if Registry.OpenKey('\Software\' + APP_NAME + '\Display', True) then
|
||||||
|
Loading…
Reference in New Issue
Block a user