here's a feature I wanted to make LONG time ago: variation preview in editor!!!

(still not sure if it will be MUCH useful... for an ordinary user... hmm... :)
This commit is contained in:
zueuk 2005-10-22 15:03:59 +00:00
parent 144fe058f6
commit 71923637a4
2 changed files with 202 additions and 103 deletions

View File

@ -81,7 +81,7 @@ object EditForm: TEditForm
object EditorToolBar: TToolBar
Left = 1
Top = 1
Width = 376
Width = 408
Height = 22
Align = alLeft
ButtonWidth = 25
@ -264,6 +264,25 @@ object EditForm: TEditForm
ParentShowHint = False
ShowHint = True
end
object ToolButton2: TToolButton
Left = 374
Top = 0
Width = 8
Caption = 'ToolButton2'
ImageIndex = 14
Style = tbsSeparator
end
object tbVarPreview: TToolButton
Left = 382
Top = 0
Hint = 'Show/hide variation preview'
Caption = 'Variation Preview'
ImageIndex = 14
ParentShowHint = False
ShowHint = True
Style = tbsCheck
OnClick = tbVarPreviewClick
end
end
end
object EditPnl: TPanel
@ -1312,14 +1331,14 @@ object EditForm: TEditForm
Left = 8
Top = 2
Width = 145
Height = 70
Height = 71
Caption = 'Transform color'
TabOrder = 0
object scrlXFormColor: TScrollBar
Left = 8
Top = 44
Top = 46
Width = 129
Height = 17
Height = 15
LargeChange = 10
Max = 1000
PageSize = 0
@ -1349,41 +1368,48 @@ object EditForm: TEditForm
Left = 8
Top = 77
Width = 145
Height = 217
Height = 212
Caption = 'Graph'
TabOrder = 1
object Label20: TLabel
Left = 8
Top = 56
Width = 82
Width = 56
Height = 13
Caption = 'Background color'
Caption = 'Background'
end
object Label21: TLabel
Left = 8
Top = 176
Width = 89
Top = 96
Width = 50
Height = 13
Caption = 'Reference triangle'
Caption = 'Reference'
end
object Label8: TLabel
Left = 8
Top = 96
Left = 75
Top = 56
Width = 50
Height = 13
Caption = 'Grid colors'
end
object Label10: TLabel
Left = 75
Top = 96
Width = 36
Height = 13
Caption = 'Helpers'
end
object Label1: TLabel
Left = 8
Top = 136
Width = 62
Width = 83
Height = 13
Caption = 'Helpers color'
Caption = 'Variation preview'
end
object pnlBackColor: TPanel
Left = 8
Top = 72
Width = 129
Width = 62
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
@ -1405,7 +1431,7 @@ object EditForm: TEditForm
Top = 36
Width = 129
Height = 17
Caption = 'Enable helpers'
Caption = 'Helper lines'
Checked = True
State = cbChecked
TabOrder = 2
@ -1413,8 +1439,8 @@ object EditForm: TEditForm
end
object pnlReference: TPanel
Left = 8
Top = 192
Width = 129
Top = 112
Width = 62
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
@ -1423,9 +1449,9 @@ object EditForm: TEditForm
OnClick = pnlReferenceClick
end
object pnlGridColor1: TPanel
Left = 8
Top = 112
Width = 62
Left = 75
Top = 72
Width = 29
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
@ -1434,9 +1460,9 @@ object EditForm: TEditForm
OnClick = pnlGridColor1Click
end
object pnlGridColor2: TPanel
Left = 75
Top = 112
Width = 62
Left = 108
Top = 72
Width = 29
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
@ -1445,9 +1471,9 @@ object EditForm: TEditForm
OnClick = pnlGridColor2Click
end
object pnlHelpersColor: TPanel
Left = 8
Top = 152
Width = 129
Left = 75
Top = 112
Width = 62
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
@ -1455,6 +1481,36 @@ object EditForm: TEditForm
TabOrder = 6
OnClick = pnlHelpersColorClick
end
object trkVarPreviewDensity: TTrackBar
Left = 8
Top = 184
Width = 129
Height = 25
Hint = 'Variation preview density'
Min = 1
ParentShowHint = False
Position = 10
ShowHint = True
TabOrder = 7
TabStop = False
ThumbLength = 15
OnChange = tbVarPreviewClick
end
object trkVarPreviewRange: TTrackBar
Left = 8
Top = 152
Width = 129
Height = 25
Hint = 'Variation preview range'
Min = 1
ParentShowHint = False
Position = 1
ShowHint = True
TabOrder = 8
TabStop = False
ThumbLength = 15
OnChange = tbVarPreviewClick
end
end
end
end
@ -1575,7 +1631,7 @@ object EditForm: TEditForm
Left = 353
Top = 80
Bitmap = {
494C01010E001300040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
494C01010F001300040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000005000000001002000000000000050
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -1718,111 +1774,111 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000049004B00000000000000000049004B00000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
0000000000000000000049004B00000000000000000049004B00000000000000
000000000000000000000000000049004B000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000049004B000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000049004B0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
00000000000000000000EBEBEB00A0A0A000A0A0A000EBEBEB00000000000000
000000000000000000000000000049004B000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000EBEBEB00EBEBEB00EBEBEB000000000000000000EBEBEB00EBEBEB00EBEB
EB00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000008000800080008000800080008000
8000000000000000000080008000800080008000800080008000800080008000
8000800080008000800080008000800080000000000000000000000000000000
0000EBEBEB00EBEBEB00EBEBEB000000000000000000EBEBEB00EBEBEB00EBEB
EB00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
00000000000000000000EBEBEB00A0A0A000A0A0A000EBEBEB00000000000000
000000000000000000000000000049004B000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000049004B000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000049004B0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
0000000000000000000049004B00000000000000000049004B00000000000000
000000000000000000000000000049004B000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000049004B00000000000000000049004B00000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -2223,11 +2279,11 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000FF7FFFFF00000000FF7FFFFF00000000
FF7FFFFF00000000E00FF3E700000000E007E1E700000000FF63C0E700000000
FF73F3E700000000FF73F3E700000000FB73000000000000F363F3E700000000
E007F3E700000000E00FF1C700000000F37FF80F00000000FB7FFC1F00000000
FF7FFFFF00000000FF7FFFFF00000000FFFFFFFFFFFFFFFFF0070001FEFF8003
00000000000000000000000000000000FF7FFFFFFFFF0000FF7FFFFFFDBF0000
FF7FFFFFEFF70000E00FF3E77DBE0000E007E1E7F7EF0000FF63C0E7DC3B0000
FF73F3E7700E0000FF73F3E7E0070000FB730000E0070000F363F3E7700E0000
E007F3E7DC3B0000E00FF1C7F7EF0000F37FF80F7DBE0000FB7FFC1FEFF70000
FF7FFFFFFDBF0000FF7FFFFFFFFF0000FFFFFFFFFFFFFFFFF0070001FEFF8003
F9F79FFD7FFDCFE7FCF7C8053EF9E7CFF277E4F51FF1F39FEF37F2754EE5F93F
EF97F93567CDFC7FDFC7FC95729DFEFFDFE7FE45793D5555DFF7FF25729DFEFF
DFFFFF9567CDFC7FEFC3FFCD4EE5F93FEFF3FFE51FF1F39FF3CBFFF13EF9E7CF
@ -2239,7 +2295,6 @@ object EditForm: TEditForm
C003E001E001E001C003F1F9F1F9F1F9C003F8F90009D8D9C003FC7980098C09
C003F239C609C619C003F319E309E219C003F389F189F009C003F3C1F8C1F8C1
C0030021FC41F061C0070031FE01E231C00FF3F9FF09C719C01FF3FDFF8D8F8D
C03FF3FFFFCFDFDFFFFFF3FFFFEFFFFF00000000000000000000000000000000
000000000000}
C03FF3FFFFCFDFDFFFFFF3FFFFEFFFFF}
end
end

View File

@ -152,6 +152,11 @@ type
btnCoefsRect: TSpeedButton;
btnCoefsPolar: TSpeedButton;
chkPreserve: TCheckBox;
Label1: TLabel;
trkVarPreviewDensity: TTrackBar;
trkVarPreviewRange: TTrackBar;
ToolButton2: TToolButton;
tbVarPreview: TToolButton;
procedure ValidateVariable;
procedure vleVariablesValidate(Sender: TObject; ACol, ARow: Integer; const KeyName, KeyValue: string);
procedure vleVariablesKeyPress(Sender: TObject; var Key: Char);
@ -276,6 +281,7 @@ type
procedure btnYcoefsClick(Sender: TObject);
procedure btnOcoefsClick(Sender: TObject);
procedure btnCoefsModeClick(Sender: TObject);
procedure tbVarPreviewClick(Sender: TObject);
private
TriangleView: TCustomDrawControl;
@ -298,10 +304,12 @@ type
varDragPos, varDragOld: integer;
varMM: boolean; //hack?
{
spinnerMode: boolean;
spinnerOld, spinnerPos: integer;
spinnerValue: double;
SpinnerAssoc: TEdit;
}
// --Z-- variables moved from outside
GraphZoom: double;
@ -1055,6 +1063,26 @@ begin
TextOut(a.x+2, a.y+1, 'A');
end;
if tbVarPreview.Down then
begin
assert(trkVarPreviewRange.position > 0);
assert(trkVarPreviewDensity.position > 0);
cp.xform[SelectedTriangle].prepare;
//for i := 0 to Transforms-1 do cp.xform[i].prepare;
i := trkVarPreviewRange.position * trkVarPreviewDensity.position;
d1 := trkVarPreviewDensity.position;
for ax := -i to i do
for ay := -i to i 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
a := toscreen(tx,-ty);
Pixels[a.x, a.Y] := GetTriangleColor(SelectedTriangle);//$ffffff;
end;
end;
if (TriangleCaught or CornerCaught) then // if dragging, draw pivot axis
begin
@ -1834,6 +1862,14 @@ begin
mnuResetLoc.checked := Registry.ReadBool('ResetLocation')
else mnuResetLoc.checked := true;
//tbResetLoc.Down := mnuResetLoc.checked;
if Registry.ValueExists('VariationPreview') then
tbVarPreview.Down := Registry.ReadBool('VariationPreview')
else tbVarPreview.Down := false;
if Registry.ValueExists('VariationPreviewRange') then
trkVarPreviewRange.Position := Registry.ReadInteger('VariationPreviewRange');
if Registry.ValueExists('VariationPreviewDensity') then
trkVarPreviewDensity.Position := Registry.ReadInteger('VariationPreviewDensity');
end
else begin
UseTransformColors := False;
@ -2133,6 +2169,9 @@ begin
Registry.WriteInteger('HelpersColor', HelpersColor);
Registry.WriteInteger('ReferenceTriangleColor', ReferenceTriangleColor);
Registry.WriteBool('ResetLocation', mnuResetLoc.checked);
Registry.WriteBool('VariationPreview', tbVarPreview.Down);
Registry.WriteInteger('VariationPreviewRange', trkVarPreviewRange.Position);
Registry.WriteInteger('VariationPreviewDensity', trkVarPreviewDensity.Position);
{ Size and position }
if EditForm.WindowState <> wsMaximized then begin
Registry.WriteInteger('Top', EditForm.Top);
@ -3461,5 +3500,10 @@ begin
ShowSelectedInfo;
end;
procedure TEditForm.tbVarPreviewClick(Sender: TObject);
begin
TriangleView.Invalidate;
end;
end.