some minor fixes in the editor

This commit is contained in:
zueuk 2005-09-11 13:28:04 +00:00
parent 3e29c70519
commit 7a4d17f666
2 changed files with 36 additions and 39 deletions

View File

@ -53,7 +53,7 @@ object EditForm: TEditForm
TextHeight = 13 TextHeight = 13
object StatusBar: TStatusBar object StatusBar: TStatusBar
Left = 0 Left = 0
Top = 541 Top = 547
Width = 578 Width = 578
Height = 15 Height = 15
Panels = < Panels = <
@ -325,14 +325,14 @@ object EditForm: TEditForm
Left = 0 Left = 0
Top = 24 Top = 24
Width = 578 Width = 578
Height = 517 Height = 523
Align = alClient Align = alClient
TabOrder = 1 TabOrder = 1
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 396 Left = 396
Top = 1 Top = 1
Width = 9 Width = 9
Height = 515 Height = 521
Align = alRight Align = alRight
AutoSnap = False AutoSnap = False
Beveled = True Beveled = True
@ -343,7 +343,7 @@ object EditForm: TEditForm
Left = 1 Left = 1
Top = 1 Top = 1
Width = 395 Width = 395
Height = 515 Height = 521
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
Color = clBlack Color = clBlack
@ -353,7 +353,7 @@ object EditForm: TEditForm
Left = 0 Left = 0
Top = 0 Top = 0
Width = 395 Width = 395
Height = 515 Height = 521
Align = alClient Align = alClient
PopupMenu = EditPopup PopupMenu = EditPopup
OnDblClick = GraphImageDblClick OnDblClick = GraphImageDblClick
@ -366,7 +366,7 @@ object EditForm: TEditForm
Left = 405 Left = 405
Top = 1 Top = 1
Width = 172 Width = 172
Height = 515 Height = 521
Align = alRight Align = alRight
Alignment = taLeftJustify Alignment = taLeftJustify
BevelOuter = bvNone BevelOuter = bvNone
@ -406,7 +406,7 @@ object EditForm: TEditForm
Left = 0 Left = 0
Top = 136 Top = 136
Width = 172 Width = 172
Height = 379 Height = 385
Align = alClient Align = alClient
TabOrder = 0 TabOrder = 0
object lblTransform: TLabel object lblTransform: TLabel
@ -439,10 +439,10 @@ object EditForm: TEditForm
end end
object PageControl: TPageControl object PageControl: TPageControl
Left = 1 Left = 1
Top = 20 Top = 26
Width = 170 Width = 170
Height = 358 Height = 358
ActivePage = TabSheet4 ActivePage = tabVariations
Align = alBottom Align = alBottom
Anchors = [akLeft, akTop, akRight, akBottom] Anchors = [akLeft, akTop, akRight, akBottom]
MultiLine = True MultiLine = True

View File

@ -1229,31 +1229,32 @@ begin
if SelectMode then // look for point or triangle under cursor if SelectMode then // look for point or triangle under cursor
begin begin
for i := 0 to Transforms - 1 do for i := 0 to Transforms - 1 do
for j := 0 to 2 do for j := 0 to 2 do
begin
d := dist(fx, fy, MainTriangles[i].x[j], MainTriangles[i].y[j]);
if (d * GraphZoom * 50) < 4 then
begin begin
mouseOverTriangle:=i; d := dist(fx, fy, MainTriangles[i].x[j], MainTriangles[i].y[j]);
mouseOverCorner:=j; if (d * GraphZoom * 50) < 4 then
begin
mouseOverTriangle:=i;
mouseOverCorner:=j;
goto FoundCorner; goto FoundCorner;
end;
end; end;
end;
i := InsideTriangle(fx, fy); i := InsideTriangle(fx, fy);
if i >= 0 then // i > -1 if i >= 0 then // i > -1
begin begin
mouseOverTriangle:=i; mouseOverTriangle:=i;
end end
else begin else begin
mouseOverTriangle:=-2; mouseOverTriangle:=-2;
end; end;
mouseOverCorner:=-1; mouseOverCorner:=-1;
FoundCorner: FoundCorner:
end; // if selectmode end; // if SelectMode
if (mouseOverTriangle >= 0) and (SelectMode or (mouseOverTriangle = SelectedTriangle)) then if (mouseOverTriangle >= 0) and (SelectMode or (mouseOverTriangle = SelectedTriangle)) then
@ -1327,7 +1328,7 @@ FoundCorner:
HasChanged := True; HasChanged := True;
UpdateFlameX; UpdateFlameX;
// UpdateFlame(False); // UpdateFlame(False);
StatusBar.Refresh; StatusBar.Refresh;
exit; exit;
end end
else if TriangleCaught then { Modify a whole triangle } else if TriangleCaught then { Modify a whole triangle }
@ -1370,7 +1371,7 @@ StatusBar.Refresh;
HasChanged := True; HasChanged := True;
UpdateFlameX; UpdateFlameX;
// UpdateFlame(False); // UpdateFlame(False);
StatusBar.Refresh; StatusBar.Refresh;
exit; exit;
end; end;
if ((mt <> mouseOverTriangle) or (mc <> MouseOverCorner)) then if ((mt <> mouseOverTriangle) or (mc <> MouseOverCorner)) then
@ -1446,10 +1447,10 @@ begin
end; end;
end; end;
end; end;
// so user hasn't selected any vertices, // so user hasn't selected any corners,
// let's check for triangles then! // let's check for triangles then!
// // --Z-- // alt=rotate, ctrl=scale, shift=move // --Z-- // alt=rotate, ctrl=scale, shift=move
if SelectMode then if SelectMode then
begin begin
@ -1486,10 +1487,6 @@ end;
procedure TEditForm.GraphImageMouseUp(Sender: TObject; Button: TMouseButton; procedure TEditForm.GraphImageMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: integer); Shift: TShiftState; X, Y: integer);
//var
//fx, fy: double;
//i: integer;
//transformvalue: double;
begin begin
if Button = mbRight then // --Z-- panning if Button = mbRight then // --Z-- panning
begin begin
@ -2528,8 +2525,8 @@ begin
Allow := False; Allow := False;
end; end;
end; end;
NewVal := Round6(StrToFloat(VEVars.Values[VarNames[i]])); NewVal := Round6( StrToFloat(VEVars.Values[VarNames(i)]) );
VEVars.Values[VarNames[i]] := Format('%.6g', [NewVal]); VEVars.Values[VarNames(i)] := Format('%.6g', [NewVal]);
{ If it's not the same as the old value and it was valid } { If it's not the same as the old value and it was valid }
if (NewVal <> OldVal) and Allow then if (NewVal <> OldVal) and Allow then
@ -2537,7 +2534,7 @@ begin
MainForm.UpdateUndo; MainForm.UpdateUndo;
// EditedVariation := i; // EditedVariation := i;
cp.xform[SelectedTriangle].vars[i] := NewVal; cp.xform[SelectedTriangle].vars[i] := NewVal;
VEVars.Values[VarNames[i]] := Format('%.6g', [cp.xform[SelectedTriangle].vars[i]]); VEVars.Values[VarNames(i)] := Format('%.6g', [cp.xform[SelectedTriangle].vars[i]]);
ShowSelectedInfo; ShowSelectedInfo;
UpdateFlame(True); UpdateFlame(True);
end; end;