From cf08a74f8451a150e51f6a5ac3d892a01f4c38a1 Mon Sep 17 00:00:00 2001 From: zueuk Date: Sun, 23 Oct 2005 09:19:13 +0000 Subject: [PATCH] variation preview depth added --- 2.10/Source/Editor.dfm | 45 +++++++++++++++++++++++++++++------------- 2.10/Source/Editor.pas | 22 ++++++++++++++++----- 2 files changed, 48 insertions(+), 19 deletions(-) diff --git a/2.10/Source/Editor.dfm b/2.10/Source/Editor.dfm index ddabd6a..5154724 100644 --- a/2.10/Source/Editor.dfm +++ b/2.10/Source/Editor.dfm @@ -1,8 +1,8 @@ object EditForm: TEditForm Left = 279 - Top = 240 + Top = 234 Width = 586 - Height = 576 + Height = 582 Caption = 'Transform Editor' Color = clBtnFace Constraints.MinHeight = 400 @@ -54,7 +54,7 @@ object EditForm: TEditForm TextHeight = 13 object StatusBar: TStatusBar Left = 0 - Top = 527 + Top = 539 Width = 578 Height = 15 Panels = < @@ -289,14 +289,14 @@ object EditForm: TEditForm Left = 0 Top = 24 Width = 578 - Height = 503 + Height = 515 Align = alClient TabOrder = 1 object Splitter1: TSplitter Left = 396 Top = 1 Width = 9 - Height = 501 + Height = 513 Align = alRight AutoSnap = False Beveled = True @@ -307,7 +307,7 @@ object EditForm: TEditForm Left = 1 Top = 1 Width = 395 - Height = 501 + Height = 513 Align = alClient BevelOuter = bvNone Color = clAppWorkSpace @@ -317,7 +317,7 @@ object EditForm: TEditForm Left = 405 Top = 1 Width = 172 - Height = 501 + Height = 513 Align = alRight Alignment = taLeftJustify BevelOuter = bvNone @@ -356,7 +356,7 @@ object EditForm: TEditForm Left = 0 Top = 138 Width = 172 - Height = 363 + Height = 375 Align = alClient TabOrder = 0 object lblTransform: TLabel @@ -387,10 +387,10 @@ object EditForm: TEditForm end object PageControl: TPageControl Left = 1 - Top = 24 + Top = 30 Width = 170 - Height = 338 - ActivePage = tabVariations + Height = 344 + ActivePage = TriangleTab Align = alBottom Anchors = [akLeft, akTop, akRight, akBottom] MultiLine = True @@ -402,7 +402,7 @@ object EditForm: TEditForm Left = 0 Top = 0 Width = 162 - Height = 292 + Height = 298 HorzScrollBar.Visible = False VertScrollBar.Smooth = True VertScrollBar.Style = ssFlat @@ -1279,7 +1279,7 @@ object EditForm: TEditForm Left = 0 Top = 0 Width = 162 - Height = 292 + Height = 298 Align = alClient ScrollBars = ssVertical TabOrder = 0 @@ -1484,7 +1484,7 @@ object EditForm: TEditForm object trkVarPreviewDensity: TTrackBar Left = 8 Top = 184 - Width = 129 + Width = 65 Height = 25 Max = 5 Min = 1 @@ -1504,6 +1504,7 @@ object EditForm: TEditForm Height = 25 Min = 1 ParentShowHint = False + PageSize = 1 Position = 2 ShowHint = True TabOrder = 8 @@ -1511,6 +1512,22 @@ object EditForm: TEditForm ThumbLength = 15 OnChange = trkVarPreviewRangeChange end + object trkVarPreviewDepth: TTrackBar + Left = 72 + Top = 184 + Width = 65 + Height = 25 + Max = 5 + Min = 1 + ParentShowHint = False + PageSize = 1 + Position = 1 + ShowHint = True + TabOrder = 9 + TabStop = False + ThumbLength = 15 + OnChange = trkVarPreviewDepthChange + end end end end diff --git a/2.10/Source/Editor.pas b/2.10/Source/Editor.pas index af03c2b..fb6e63d 100644 --- a/2.10/Source/Editor.pas +++ b/2.10/Source/Editor.pas @@ -157,6 +157,7 @@ type trkVarPreviewRange: TTrackBar; ToolButton2: TToolButton; tbVarPreview: TToolButton; + trkVarPreviewDepth: TTrackBar; procedure ValidateVariable; procedure vleVariablesValidate(Sender: TObject; ACol, ARow: Integer; const KeyName, KeyValue: string); procedure vleVariablesKeyPress(Sender: TObject; var Key: Char); @@ -284,6 +285,7 @@ type procedure tbVarPreviewClick(Sender: TObject); procedure trkVarPreviewRangeChange(Sender: TObject); procedure trkVarPreviewDensityChange(Sender: TObject); + procedure trkVarPreviewDepthChange(Sender: TObject); private TriangleView: TCustomDrawControl; @@ -955,7 +957,7 @@ var end; end; var - i, tc: integer; + i, n, tc: integer; d, d1: double; tx, ty: double; @@ -1072,16 +1074,17 @@ begin cp.xform[SelectedTriangle].prepare; //for i := 0 to Transforms-1 do cp.xform[i].prepare; - i := trkVarPreviewRange.position * trkVarPreviewDensity.position * 5; + n := trkVarPreviewRange.position * trkVarPreviewDensity.position * 5; d1 := trkVarPreviewDensity.position * 5; tc := GetTriangleColor(SelectedTriangle); - for ax := -i to i do - for ay := -i to i do + for ax := -n to n do + for ay := -n to n do begin tx := ax / d1; ty := ay / d1; //cp.xform[random(Transforms)].nextpoint(tx,ty,d); - cp.xform[SelectedTriangle].NextPoint(tx, ty, d); // d used as dummy var + for i := 1 to trkVarPreviewDepth.position do + cp.xform[SelectedTriangle].NextPoint(tx, ty, d); // d used as dummy var a := toscreen(tx,-ty); Pixels[a.x, a.Y] := {Pixels[a.x, a.Y] xor} tc;//$ffffff; end; @@ -1873,6 +1876,8 @@ begin trkVarPreviewRange.Position := Registry.ReadInteger('VariationPreviewRange'); if Registry.ValueExists('VariationPreviewDensity') then trkVarPreviewDensity.Position := Registry.ReadInteger('VariationPreviewDensity'); + if Registry.ValueExists('VariationPreviewDepth') then + trkVarPreviewDepth.Position := Registry.ReadInteger('VariationPreviewDepth'); end else begin UseTransformColors := False; @@ -2175,6 +2180,7 @@ begin Registry.WriteBool('VariationPreview', tbVarPreview.Down); Registry.WriteInteger('VariationPreviewRange', trkVarPreviewRange.Position); Registry.WriteInteger('VariationPreviewDensity', trkVarPreviewDensity.Position); + Registry.WriteInteger('VariationPreviewDepth', trkVarPreviewDepth.Position); { Size and position } if EditForm.WindowState <> wsMaximized then begin Registry.WriteInteger('Top', EditForm.Top); @@ -3520,5 +3526,11 @@ begin TriangleView.Invalidate; end; +procedure TEditForm.trkVarPreviewDepthChange(Sender: TObject); +begin + trkVarPreviewDepth.Hint := Format('Depth: %d', [trkVarPreviewDepth.position]); + TriangleView.Invalidate; +end; + end.