From 7a4d17f666740c9d6cc8c9ffdae3cf8b23504890 Mon Sep 17 00:00:00 2001
From: zueuk <zueuk>
Date: Sun, 11 Sep 2005 13:28:04 +0000
Subject: [PATCH] some minor fixes in the editor

---
 2.10/Source/Editor.dfm | 18 ++++++-------
 2.10/Source/Editor.pas | 57 ++++++++++++++++++++----------------------
 2 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/2.10/Source/Editor.dfm b/2.10/Source/Editor.dfm
index 19f2772..e6845ab 100644
--- a/2.10/Source/Editor.dfm
+++ b/2.10/Source/Editor.dfm
@@ -53,7 +53,7 @@ object EditForm: TEditForm
   TextHeight = 13
   object StatusBar: TStatusBar
     Left = 0
-    Top = 541
+    Top = 547
     Width = 578
     Height = 15
     Panels = <
@@ -325,14 +325,14 @@ object EditForm: TEditForm
     Left = 0
     Top = 24
     Width = 578
-    Height = 517
+    Height = 523
     Align = alClient
     TabOrder = 1
     object Splitter1: TSplitter
       Left = 396
       Top = 1
       Width = 9
-      Height = 515
+      Height = 521
       Align = alRight
       AutoSnap = False
       Beveled = True
@@ -343,7 +343,7 @@ object EditForm: TEditForm
       Left = 1
       Top = 1
       Width = 395
-      Height = 515
+      Height = 521
       Align = alClient
       BevelOuter = bvNone
       Color = clBlack
@@ -353,7 +353,7 @@ object EditForm: TEditForm
         Left = 0
         Top = 0
         Width = 395
-        Height = 515
+        Height = 521
         Align = alClient
         PopupMenu = EditPopup
         OnDblClick = GraphImageDblClick
@@ -366,7 +366,7 @@ object EditForm: TEditForm
       Left = 405
       Top = 1
       Width = 172
-      Height = 515
+      Height = 521
       Align = alRight
       Alignment = taLeftJustify
       BevelOuter = bvNone
@@ -406,7 +406,7 @@ object EditForm: TEditForm
         Left = 0
         Top = 136
         Width = 172
-        Height = 379
+        Height = 385
         Align = alClient
         TabOrder = 0
         object lblTransform: TLabel
@@ -439,10 +439,10 @@ object EditForm: TEditForm
         end
         object PageControl: TPageControl
           Left = 1
-          Top = 20
+          Top = 26
           Width = 170
           Height = 358
-          ActivePage = TabSheet4
+          ActivePage = tabVariations
           Align = alBottom
           Anchors = [akLeft, akTop, akRight, akBottom]
           MultiLine = True
diff --git a/2.10/Source/Editor.pas b/2.10/Source/Editor.pas
index 00cfeed..55ecba5 100644
--- a/2.10/Source/Editor.pas
+++ b/2.10/Source/Editor.pas
@@ -1229,31 +1229,32 @@ begin
 
   if SelectMode then // look for point or triangle under cursor
   begin
-  for i := 0 to Transforms - 1 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
+    for i := 0 to Transforms - 1 do
+      for j := 0 to 2 do
       begin
-        mouseOverTriangle:=i;
-        mouseOverCorner:=j;
+        d := dist(fx, fy, MainTriangles[i].x[j], MainTriangles[i].y[j]);
+        if (d * GraphZoom * 50) < 4 then
+        begin
+          mouseOverTriangle:=i;
+          mouseOverCorner:=j;
 
-        goto FoundCorner;
+          goto FoundCorner;
+        end;
       end;
-    end;
 
-  i := InsideTriangle(fx, fy);
-  if i >= 0 then // i > -1
-  begin
-    mouseOverTriangle:=i;
-  end
-  else begin
-    mouseOverTriangle:=-2;
-  end;
-  mouseOverCorner:=-1;
+    i := InsideTriangle(fx, fy);
+    if i >= 0 then // i > -1
+    begin
+      mouseOverTriangle:=i;
+    end
+    else begin
+      mouseOverTriangle:=-2;
+    end;
+    mouseOverCorner:=-1;
+
 FoundCorner:
 
-  end; // if selectmode
+  end; // if SelectMode
 
 
   if  (mouseOverTriangle >= 0) and (SelectMode or (mouseOverTriangle = SelectedTriangle)) then
@@ -1327,7 +1328,7 @@ FoundCorner:
     HasChanged := True;
     UpdateFlameX;
 //    UpdateFlame(False);
-StatusBar.Refresh;
+    StatusBar.Refresh;
     exit;
   end
   else if TriangleCaught then { Modify a whole triangle }
@@ -1370,7 +1371,7 @@ StatusBar.Refresh;
     HasChanged := True;
     UpdateFlameX;
 //    UpdateFlame(False);
-  StatusBar.Refresh;
+    StatusBar.Refresh;
     exit;
   end;
   if ((mt <> mouseOverTriangle) or (mc <> MouseOverCorner)) then
@@ -1446,10 +1447,10 @@ begin
           end;
         end;
     end;
-      // so user hasn't selected any vertices,
+      // so user hasn't selected any corners,
       // let's check for triangles then!
 
-//      // --Z-- // alt=rotate, ctrl=scale, shift=move
+// --Z-- // alt=rotate, ctrl=scale, shift=move
 
     if SelectMode then
     begin
@@ -1486,10 +1487,6 @@ end;
 
 procedure TEditForm.GraphImageMouseUp(Sender: TObject; Button: TMouseButton;
   Shift: TShiftState; X, Y: integer);
-//var
-//fx, fy: double;
-//i: integer;
-//transformvalue: double;
 begin
   if Button = mbRight then // --Z-- panning
   begin
@@ -2528,8 +2525,8 @@ begin
       Allow := False;
     end;
   end;
-  NewVal := Round6(StrToFloat(VEVars.Values[VarNames[i]]));
-  VEVars.Values[VarNames[i]] := Format('%.6g', [NewVal]);
+  NewVal := Round6( StrToFloat(VEVars.Values[VarNames(i)]) );
+  VEVars.Values[VarNames(i)] := Format('%.6g', [NewVal]);
 
 { If it's not the same as the old value and it was valid }
   if (NewVal <> OldVal) and Allow then
@@ -2537,7 +2534,7 @@ begin
     MainForm.UpdateUndo;
 //    EditedVariation := i;
     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;
     UpdateFlame(True);
   end;