-
Notifications
You must be signed in to change notification settings - Fork 0
/
drawingsetframe1.pas
151 lines (122 loc) · 3.82 KB
/
drawingsetframe1.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
//Copyright (c) 2012 by Donald R. Ziesig
//
//Donald.at.Ziesig.org
//
//This file is part of MagicTracks.
//
//MagicTracks is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//MagicTracks is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with MagicTracks. If not, see <http://www.gnu.org/licenses/>.
unit DrawingSetFrame1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, ExtCtrls,
DrawingCommon1, Drawing1, DrawingFrame1;
type
{ TDrawingSetFrame }
TDrawingSetFrame = class(TFrame)
DrawingFrameYZ: TDrawingFrame;
DrawingFrameXZ: TDrawingFrame;
DrawingFrameXY: TDrawingFrame;
Panel1: TPanel;
Panel10: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel5: TPanel;
Panel6: TPanel;
Panel7: TPanel;
Panel8: TPanel;
Panel9: TPanel;
Splitter1: TSplitter;
Splitter2: TSplitter;
procedure FrameResize(Sender: TObject);
procedure Splitter1Moved(Sender: TObject);
private
{ private declarations }
fDrawing : TDrawing;
vVSplit, vHSplit : Integer;
procedure SetDrawing(const AValue: TDrawing);
public
{ public declarations }
constructor Create(TheOwner: TComponent); override;
procedure MoveTo( X, Y, Z : Double ); // Units in Microns
procedure LineTo( X, Y, Z : Double );
procedure PositionLowerLeft;
procedure Invalidate; override;
property Drawing : TDrawing read fDrawing write SetDrawing;
end;
implementation
{$R *.lfm}
uses
UnitConversion1;
{ TDrawingSetFrame }
procedure TDrawingSetFrame.Splitter1Moved(Sender: TObject);
begin
vVSplit := (Panel1.Width *100) div Width;
vHSplit := (Panel3.Height * 100) div Height;
end;
procedure TDrawingSetFrame.FrameResize(Sender: TObject);
begin
Panel1.Width := (Width * vVsplit) div 100;
Panel3.Height := (Height * vHsplit) div 100;
end;
procedure TDrawingSetFrame.Invalidate;
begin
DrawingFrameXY.Invalidate;
DrawingFrameXZ.Invalidate;
DrawingFrameYZ.Invalidate;
end;
procedure TDrawingSetFrame.SetDrawing(const AValue: TDrawing);
begin
fDrawing:=AValue;
DrawingFrameXY.Drawing := fDrawing;
DrawingFrameXZ.Drawing := fDrawing;
DrawingFrameYZ.Drawing := fDrawing;
DrawingFrameXY.BoxType := XY;
DrawingFrameXZ.BoxType := XZ;
DrawingFrameYZ.BoxType := YZ;
end;
constructor TDrawingSetFrame.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
vVSplit := 50;
vHSplit := 50;
Panel1.Width := (Width * vVsplit) div 100;
Panel3.Height := (Height * vHsplit) div 100;
end;
procedure TDrawingSetFrame.MoveTo(X, Y, Z: Double);
var
XX, YY : Integer;
begin
XX := MicronsToPixels( X - DrawingFrameXY.Drawing.MinX[XY], DrawingFrameXY.Drawing.Preferences );
YY := MicronsToPixels( Y - DrawingFrameXY.Drawing.MinY[XY], DrawingFrameXY.Drawing.Preferences );
XX := 0; YY := 0;
DrawingFrameXY.PaintBox1.Canvas.MoveTo( XX, YY );
end;
procedure TDrawingSetFrame.LineTo(X, Y, Z: Double);
var
XX, YY : Integer;
begin
XX := MicronsToPixels( X - DrawingFrameXY.Drawing.MinX[XY], DrawingFrameXY.Drawing.Preferences );
YY := MicronsToPixels( Y - DrawingFrameXY.Drawing.MinY[XY], DrawingFrameXY.Drawing.Preferences );
XX := DrawingFrameXY.Canvas.Width;
yy := drawingframexy.canvas.height;
DrawingFrameXY.PaintBox1.Canvas.LineTo( XX, YY );
end;
procedure TDrawingSetFrame.PositionLowerLeft;
begin
DrawingFrameXY.PositionLowerLeft;
DrawingFrameXZ.PositionLowerLeft;
DrawingFrameYZ.PositionLowerLeft;
end;
end.