-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCutterPreviewWindow.h
More file actions
102 lines (81 loc) · 3.17 KB
/
CutterPreviewWindow.h
File metadata and controls
102 lines (81 loc) · 3.17 KB
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
#pragma once
#include "Kernel/Cut.h"
#include "Kernel/Position.h"
#include "Kernel/CutterSimulation.h"
#include "Kernel/CutStructure.h"
// CutterPreviewWindow
class CutterSimulationOutputDevice;
// Note, needs to be a CFrameWnd to support toolbars etc.
class CutterPreviewWindow : public CFrameWnd, public PointPlotter
{
DECLARE_DYNAMIC(CutterPreviewWindow)
public:
CutterPreviewWindow(CWnd* parentWindow,const Cut* cut, const CutterGeometry* geometry, const CutStructure::Context& context);
virtual ~CutterPreviewWindow();
void runCut();
protected:
Cut cut;
CutterSimulation* simulation;
CutterSimulationOutputDevice* device;
CutStructure::Context context;
const int DEFAULT_STEPS_PER_SEC = 50;
CString windowClass;
LARGE_INTEGER plotTime; // Track speed of plot
LARGE_INTEGER stepTime; // allow this time between steps
CBitmap* bitmap;
int nWidth; // of bitmap and window client size
int nHeight; // ditto
boolean isCutting; // true if a cut is in progress (may be paused)
boolean isPaused; // true if a cut is paused
boolean terminate; // set true to terminate a cut
boolean bitmapDirty; // is set true if the bitmap has been written into by a plot.
LARGE_INTEGER counterFrequency; // use for timing to control speed of cut.
// Store information to make drawing point flicker.
boolean hasFlash;
Position<int> previousFlash;
DWORD leftFlashColour, rightFlashColour;
const int flashSize = 5; // pixels
double xStepsPerMM;
double yStepsPerMM;
double xTravel;
double yTravel;
// These variables are required for horizontal scrolling.
int xMinScroll; // minimum horizontal scroll value
int xCurrentScroll; // current horizontal scroll value
int xMaxScroll; // maximum horizontal scroll value
// These variables are required for vertical scrolling.
int yMinScroll; // minimum vertical scroll value
int yCurrentScroll; // current vertical scroll value
int yMaxScroll; // maximum vertical scroll value
const double border = 10; //mm
CToolBar toolbar;
void createBitmap(CDC* pdc);
DECLARE_MESSAGE_MAP()
void drawFlash(CDC* pdc);
void unflash(CDC* pdc);
void flash(CDC* pdc, const Position<long long>& axes, DWORD leftColour, DWORD rightColour);
// override PointPlotter::plot
virtual bool plot(Position<long long> axes);
virtual void setResolution(double xStepsPerMM, double yStepsPerMM);
virtual void setCutterBounds(double xTravel, double yTravel);
void processMessages();
public:
virtual void PostNcDestroy();
afx_msg void OnPaint();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnDestroy();
afx_msg void OnControlcutterStart();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnControlcutterPause();
afx_msg void OnControlcutterStop();
afx_msg void OnUpdateControlcutterPause(CCmdUI* pCmdUI);
afx_msg void OnUpdateControlcutterStart(CCmdUI* pCmdUI);
afx_msg void OnUpdateControlcutterStop(CCmdUI* pCmdUI);
afx_msg void OnSpeedFull();
afx_msg void OnSpeedX1();
afx_msg void OnSpeedX10();
afx_msg void OnSpeedX2();
afx_msg void OnSpeedX5();
};