-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path!touch.txt
399 lines (365 loc) · 11.9 KB
/
!touch.txt
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
##### Click ####################################################################
==> tritt auf, wenn auf das GRID geklickt wird oder z.B. ein Element per
Pfeitasten gewählt wird
procedure TForm1.SgFilesClick(Sender: TObject);
begin
SgFiles.Options:= SgFiles.Options - [goEditing, goAlwaysShowEditor];
TouchKeyboardOff;
end;
procedure TForm1.SgJobDefaultsClick(Sender: TObject);
begin
with SgJobDefaults do
Options:= Options - [goEditing, goAlwaysShowEditor];
TouchKeyboardOff;
// if SgJobDefaults.Row > 7 then
// adapt parameters also after leaving cell by click to other cell
OpenFilesInGrid;
NeedsRedraw:= true;
ListBlocks;
end;
procedure TForm1.SgAppDefaultsClick(Sender: TObject);
begin
with SgAppDefaults do
Options:= Options - [goEditing, goAlwaysShowEditor];
// TouchKeyboardOff;
end;
##### Exit #####################################################################
==> tritt auf, wenn das GRID verlassen wird
procedure TForm1.SgFilesExit(Sender: TObject);
begin
TouchKeyboardOff;
end;
procedure TForm1.SgJobDefaultsExit(Sender: TObject);
begin
with SgJobDefaults do
Options:= Options - [goEditing, goAlwaysShowEditor];
TouchKeyboardOff;
OpenFilesInGrid;
NeedsRedraw:= true;
ListBlocks;
end;
procedure TForm1.SgPensExit(Sender: TObject);
begin
with SgPens do
Options:= Options - [goEditing, goAlwaysShowEditor];
TouchKeyboardOff;
end;
procedure TForm1.SgGrblSettingsExit(Sender: TObject);
begin
with SgGrblSettings do
Options:= Options - [goEditing, goAlwaysShowEditor];
TouchKeyboardOff;
BtnSendGrblSettingsClick(Sender);
end;
procedure TForm1.SgAppDefaultsExit(Sender: TObject);
begin
with SgAppDefaults do
Options:= Options - [goEditing, goAlwaysShowEditor];
TouchKeyboardOff;
DefaultsGridListToJob;
end;
##### Keypressed ###############################################################
==> tritt auf, wenn eine Taste gedrückt wird
procedure TForm1.SgFilesKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #27) then SgFilesExit(Sender);
if (Key = #13) or (Key = #10) then
with SgFiles do begin
job.fileDelimStrings[Row-1]:= ShortString(Rows[Row].DelimitedText);
TouchKeyboardOff;
Repaint;
OpenFilesInGrid;
end;
end;
procedure TForm1.SgJobDefaultsKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #27) then TouchKeyboardOff;
if (Key = #13) or (Key = #10) then begin
SgJobDefaultsExit(Sender);
TouchKeyboardOff;
end;
end;
procedure TForm1.SgPensKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #13) or (Key = #10) then begin
SgPens.Repaint;
PenGridListToJob;
apply_pen_change;
GLSneedsRedrawTimeout:= 2;
GLSneedsATCupdateTimeout:= 3;
TouchKeyboardOff;
end;
end;
procedure TForm1.SgGrblSettingsKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #27) then SgGrblSettingsExit(Sender);
if (Key = #13) or (Key = #10) then begin
SgGrblSettingsExit(Sender);
end;
end;
procedure TForm1.SgAppDefaultsKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #27) then SgAppDefaultsExit(Sender);
if (Key = #13) or (Key = #10) then begin
SgAppDefaultsExit(Sender);;
end;
end;
##### MouseDown ################################################################
==> tritt auf, wenn der Nutzer mit der Maus klickt
procedure TForm1.SgFilesMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var R: TRect;
org: TPoint;
i: Integer;
my_row, my_col: integer;
my_ext: String;
begin
SgFiles.MouseToCell( X,Y, my_col, my_row );
if (my_row < 1) then
exit;
with SgFiles do begin
Options:= Options - [goEditing, goAlwaysShowEditor];
TouchKeyboardOff;
case Col of
0:
begin
UnHilite;
OpenFileDialog.FilterIndex:= 0;
if OpenFileDialog.Execute then begin
Cells[0, Row]:= OpenFileDialog.Filename;
job.fileDelimStrings[Row-1]:= ShortString(Rows[Row].DelimitedText);
UnHilite;
my_ext:= AnsiUpperCase(ExtractFileExt(OpenFileDialog.Filename));
if (my_ext = '.GBR') or (my_ext = '.GBL') or (my_ext = '.GTL') then begin
sgFiles.Cells[0, Row]:= '';
ConvertedFileName:='';
GerberFileName:= OpenFileDialog.Filename;
GerberFileNumber:= Row;
FormGerber.ShowModal;
end else
OpenFilesInGrid;
end;
end;
1:
begin
R := SgFiles.CellRect(my_Col, my_Row);
org := self.ScreenToClient(self.ClientToScreen(R.TopLeft));
perform( WM_CANCELMODE, 0, 0 ); // verhindert Mausaktion in Stringgrid
with ComboBox1 do begin
SetBounds(org.X-10, org.Y-2, R.Right-R.Left+10, Form1.Height);
ItemIndex := Items.IndexOf('Pen '+SgFiles.Cells[my_Col, my_Row]);
if ItemIndex < 0 then
ItemIndex:= 1;
Show;
BringToFront;
SetFocus;
DroppedDown := true;
end;
end;
2:
begin
if Cells[2, my_Row] = '0°' then
Cells[2, my_Row]:= '90°'
else if Cells[2, my_Row] = '90°' then
Cells[2, my_Row]:= '180°'
else if Cells[2, my_Row] = '180°' then
Cells[2, my_Row]:= '270°'
else
Cells[2, my_Row]:= '0°';
Repaint;
OpenFilesInGrid;
end;
3:
begin
if Cells[3, my_Row] = 'ON' then
Cells[3, my_Row]:= 'OFF'
else
Cells[3, my_Row]:= 'ON';
Repaint;
OpenFilesInGrid;
end;
4,5,6,7:
begin
Options:= Options + [goEditing, goAlwaysShowEditor];
TouchKeyboardOn(SgFiles,my_col,my_row,true)
end;
8:
begin
UnHilite;
Rows[my_Row].DelimitedText:= '"",-1,0°,OFF,0,0,100,100,0,""';
for i:= 0 to c_numOfPens do job.pens[i].used:= false;
OpenFilesInGrid;
end;
9:
begin
Options:= Options + [goEditing, goAlwaysShowEditor];
TouchKeyboardOn(SgFiles,my_col,my_row,false)
end;
end;
job.fileDelimStrings[my_Row-1]:= ShortString(Rows[my_Row].DelimitedText);
end;
end;
procedure TForm1.SgJobDefaultsMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
// wird vor SgJobDefaultsClick aufgerufen!
var
my_row, my_col, i: integer;
begin
SgJobDefaults.MouseToCell( X,Y, my_col, my_row );
if (my_row < 1) or (my_col < 1) then
exit;
with SgJobDefaults do begin
Options:= Options - [goEditing, goAlwaysShowEditor];
TouchKeyboardOff;
if my_Col = 1 then begin
if Cells[1, my_row] = 'ON' then begin
Cells[1, my_row]:= 'OFF';
OpenFilesInGrid;
end else if Cells[1, my_row] = 'OFF' then begin
Cells[1, my_row]:= 'ON';
end else if (my_row = 4) then begin // Material
for i:= 0 to PopupMenuMaterial.Items.Count - 1 do // set focus
PopupMenuMaterial.Items[i].Checked:= job.Material = i;
// start menu
PopupMenuMaterial.Popup(X+left+Form1.left, Y+ top+Form1.top);
end else begin
Options:= Options + [goEditing, goAlwaysShowEditor];
TouchKeyboardOn(SgJobDefaults,my_col,my_row,true);
end;
end;
end;
end;
procedure TForm1.SgPensMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
my_row, my_col: integer;
T: integer;
begin
SgPens.MouseToCell( X,Y, my_col, my_row );
if (my_row < 1) or (my_col < 1) then
exit;
SgPens.Col := my_col;
SgPens.Row := my_row;
UnHilite;
T:= gettickcount; // check for doubleclick
if T - SgPenT0 < 500 then begin
FormParamAssist.ShowModal(my_row-1); // start dialog
SgJobDefaults.Cells[1,4]:= string(Materials[Job.material].Name);//update GUI
JobToPenGridList;
SgPens.Cells[3,my_row]:= FloatToStr(job.pens[my_row-1].diameter);
SgPens.Cells[13,my_row]:= IntToStr(job.pens[my_row-1].blades);
end;
SgPenT0 := T;
with SgPens do begin
Options:= Options - [goEditing, goAlwaysShowEditor];
TouchKeyboardOff;
case my_Col of
1: // Color
begin
// Options:= Options - [goEditing]; oben schon passiert
ColorDialog1.Color:= job.pens[my_row-1].color;
if not ColorDialog1.Execute then Exit;
Cells[1,my_row]:= IntToStr(ColorDialog1.Color);
end;
2: // Enable
begin
// Options:= Options - [goEditing]; oben schon passiert
job.pens[my_row-1].enable:= not job.pens[my_row-1].enable;
if job.pens[my_row-1].enable then
Cells[2,my_row]:= 'ON'
else
Cells[2,my_row]:= 'OFF';
end;
// 3: // Diameter
// begin
// Options:= Options + [goEditing];
// end;
3, 4, 5, 6, 7, 10, 13: // Diameter, Z, F, Xofs, Yofs, Z/Cycle, Blades
begin
Options:= Options + [goEditing];
end;
8: // Scale
begin
Options:= Options + [goEditing];
job.pens[my_row-1].Scale:= StrToFloatDef(Cells[8,my_row],100);
end;
9: // Shapes
if my_row > 0 then begin
perform( WM_CANCELMODE, 0, 0 ); // verhindert Mausaktion in Stringgrid
uncheck_ms;
PopupMenuShape.Items[ord(job.pens[Row-1].shape)].Checked:= true;
PopupMenuShape.Popup(X+left+Form1.left, Y+ top+Form1.top);
end;
12: // Tooltip
if my_row > 0 then begin
perform( WM_CANCELMODE, 0, 0 ); // verhindert Mausaktion in Stringgrid
uncheck_mtt;
PopupMenuTooltip.Items[ord(job.pens[Row-1].tooltip)].Checked:= true;
PopupMenuTooltip.Popup(X+left+Form1.left, Y+ top+Form1.top);
end;
end; //case
if goEditing in Options then TouchKeyboardOn(SgPens,my_col,my_row,true);
PenGridListToJob;
apply_pen_change; // setzt Timeouts über ListBlocks auf 1
Repaint;
if (my_Col = 1) or (my_Col = 9) then begin
Form4.FormRefresh(nil); // sofortiges Update für Enable und Shape
end;
end;
end;
procedure TForm1.SgGrblSettingsMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var my_row, my_col: integer;
begin
SgGrblSettings.MouseToCell( X,Y, my_col, my_row );
if (my_row < 1) or (my_col < 1) then
exit;
with SgGrblSettings do begin
Options:= Options - [goEditing];
TouchKeyboardOff;
if Col = 1 then begin
Options:= Options + [goEditing, goAlwaysShowEditor];
TouchKeyboardOn(SgGrblSettings,my_col,my_row,true);
end;
end;
// DefaultsGridListToJob;
end;
procedure TForm1.SgAppDefaultsMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var pt: TPoint;
my_row, my_col: integer;
begin
SgAppDefaults.MouseToCell( X,Y, my_col, my_row );
if (my_row < 1) or (my_col < 1) then
exit;
pt.X:= X;
pt.Y:= Y;
with SgAppDefaults do begin
Options:= Options - [goEditing];
TouchKeyboardOff;
if Col = 1 then begin
if Cells[1, my_Row] = 'ON' then
Cells[1, my_Row]:= 'OFF'
else if Cells[1, my_Row] = 'OFF' then begin
Cells[1, my_Row]:= 'ON';
end else begin
Options:= Options + [goEditing, goAlwaysShowEditor];
TouchKeyboardOn(SgAppDefaults,my_col,my_row,true);
end;
end;
end;
DefaultsGridListToJob;
end;
##### Sonstiges ################################################################
goEditing: Zellen können bearbeitet werden
goAlwaysShowEditor: Zellen können editiert werden, ohne den Editor mit Eingabe
oder F2 zu starten
Maßnahmen:
goAlwaysShowEditor bei Create aktivieren, danach nicht mehr ändern
Zelle: 1,11
Höhe: 695
Y0: 532 561
Y1: 561 590
touch: 240
TopRow 1 1 2 3
Row 15 16 17 16