This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI_ButtonActions.pde
189 lines (141 loc) · 3.91 KB
/
GUI_ButtonActions.pde
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*
By Chris Eugene Mills
*/
// Elements
// Button Pass-on ////////////////////////////////////////////////////////////
boolean buttonLoad=false;
boolean buttonStart=false;
boolean buttonStop=false;
boolean buttonPause=false;
boolean toggleYFlip=false;
boolean toggleYFlipValue=false;
boolean toggleXFlip=false;
boolean toggleXFlipValue=false;
boolean buttonApplyQueueModReady=false;
float tempQueueStart = -1;
float tempQueueEnd = -1;
boolean buttonApplyQueueModPushed=false;
boolean buttonUp=false;
boolean buttonDown=false;
boolean buttonLeft=false;
boolean buttonRight=false;
boolean buttonConnect=false;
boolean buttonPen=false;
boolean buttonAlignment=false;
boolean buttonHome=false;
int tempPenDown = -1;
int tempPenUp = -1;
int tempPenDownSpeed = -1;
int tempPenUpSpeed = -1;
int tempDrawingSpeed = -1;
int tempRapidSpeed = -1;
boolean buttonReset=false;
boolean buttonApplyReady = false;
boolean buttonApplyPushed = false;
boolean buttonHelp = false; //No button
/*
Workaround, synchronizing calls to draw on main canvas, when this is called.
Trigger these vars as true to trigger the associated action.
*/
void checkActions() {
if (buttonLoad) {
if (!qRunner.isRunning()) loadFile();
buttonLoad = false;
}
if (buttonStart) {
qRunner.start();
buttonStart = false;
}
if (buttonStop) {
qRunner.stop();
buttonStop = false;
}
if (buttonPause) {
qRunner.pause();
buttonPause = false;
}
if (toggleYFlip) {
qRunner.setFlipYFix(toggleYFlipValue);
toggleYFlip = false;
}
if (toggleXFlip) {
qRunner.setFlipXFix(toggleXFlipValue);
toggleXFlip = false;
}
if (buttonApplyQueueModPushed) {
if (!qRunner.isRunning())
{
if ( tempQueueStart != -1 && tempQueueEnd != -1)
//TODO add mod code
buttonApplyQueueModReady = false;
tempQueueStart = -1;
tempQueueEnd = -1;
}
buttonApplyQueueModPushed = false;
}
int buttonMoveMM = 10; //mm
if (buttonUp) {
if (!qRunner.isRunning()) axidraw.moveRelativeUnits(0, -buttonMoveMM);
buttonUp = false;
}
if (buttonDown) {
if (!qRunner.isRunning()) axidraw.moveRelativeUnits(0, buttonMoveMM);
buttonDown = false;
}
if (buttonLeft) {
if (!qRunner.isRunning()) axidraw.moveRelativeUnits(-buttonMoveMM, 0);
buttonLeft = false;
}
if (buttonRight) {
if (!qRunner.isRunning()) axidraw.moveRelativeUnits(buttonMoveMM, 0);
buttonRight = false;
}
if (buttonConnect) {
if (!qRunner.isRunning()) axidraw.connect();
buttonConnect = false;
}
if (buttonPen) {
if (!qRunner.isRunning()) axidraw.togglePen();
buttonPen = false;
}
if (buttonAlignment) {
if (!qRunner.isRunning()) axidraw.alignmentMode();
buttonAlignment = false;
}
if (buttonHome) {
if (!qRunner.isRunning()) axidraw.goHome();
buttonHome = false;
}
if (buttonApplyPushed) {
if (!qRunner.isRunning())
{
if ( tempPenDown != -1 && tempPenUp != -1)
axidraw.configPenHeights( tempPenDown, tempPenUp );
if ( tempPenDownSpeed != -1 && tempPenUpSpeed != -1)
axidraw.configPenSpeeds( tempPenDownSpeed, tempPenUpSpeed );
if ( tempDrawingSpeed != -1 && tempRapidSpeed != -1)
axidraw.configMotorSpeeds( tempDrawingSpeed, tempRapidSpeed );
dummy.clone(axidraw);
buttonApplyReady = false;
tempPenDown = -1;
tempPenUp = -1;
tempPenDownSpeed = -1;
tempPenUpSpeed = -1;
tempDrawingSpeed = -1;
tempRapidSpeed = -1;
}
buttonApplyPushed = false;
}
if (buttonReset) {
penHeightsRange.setRangeValues(settingsOnStart[0],settingsOnStart[1]);
penDownSpeedSlider.setValue(settingsOnStart[2]);
penUpSpeedSlider.setValue(settingsOnStart[3]);
drawingSpeedSlider.setValue(settingsOnStart[4]);
rapidSpeedSlider.setValue(settingsOnStart[5]);
buttonReset = false;
}
if (buttonHelp) {
printHelp();
buttonHelp = false;
}
}