-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdlgSetPosition.cpp
77 lines (59 loc) · 2.28 KB
/
dlgSetPosition.cpp
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
//--------------------------------------
// A dialog set zero positions
//--------------------------------------
#include "dlgSetPosition.h"
#include "gApp.h"
#include <gActions.h> // FluidNC_extensions
dlgSetPosition dlg_position;
//----------------------------------------------------------------------
// WINDOW DEFINITION
//----------------------------------------------------------------------
#define ID_SET_ALL (0x0001 | ID_TYPE_TEXT | ID_TYPE_BUTTON)
#define ID_SET_X (0x0002 | ID_TYPE_TEXT | ID_TYPE_BUTTON)
#define ID_SET_Y (0x0003 | ID_TYPE_TEXT | ID_TYPE_BUTTON)
#define ID_SET_Z (0x0004 | ID_TYPE_TEXT | ID_TYPE_BUTTON)
static uiMutable clear_mesh = {"Clear", COLOR_DARKGREEN, COLOR_WHITE, FONT_NORMAL };
static const uiElement set_position_elements[] =
{
{ ID_SET_ALL, 30, 45, 110, 33, V("Zero All"), COLOR_DARKGREEN, COLOR_WHITE, FONT_NORMAL, JUST_CENTER},
{ ID_SET_X, 30, 83, 110, 33, V("X Zero"), COLOR_DARKGREEN, COLOR_WHITE, FONT_NORMAL, JUST_CENTER},
{ ID_SET_Y, 30, 121, 110, 33, V("Y Zero"), COLOR_DARKGREEN, COLOR_WHITE, FONT_NORMAL, JUST_CENTER},
{ ID_SET_Z, 30, 159, 110, 33, V("Z Zero"), COLOR_DARKGREEN, COLOR_WHITE, FONT_NORMAL, JUST_CENTER},
};
//-----------------------
// implementation
//-----------------------
dlgSetPosition::dlgSetPosition() :
uiWindow(set_position_elements,sizeof(set_position_elements)/sizeof(uiElement))
{
}
void dlgSetPosition::begin()
{
the_app.setTitle("Set Position");
uiWindow::begin();
}
void dlgSetPosition::update()
{
uiWindow::update();
}
void dlgSetPosition::onButton(const uiElement *ele, bool pressed)
{
if (!pressed) // = released
{
switch (ele->id_type)
{
case ID_SET_ALL :
gActions::pushGrblText("G10 L20 x0 y0 z0\r\n");
break;
case ID_SET_X :
gActions::pushGrblText("G10 L20 x0\r\n");
break;
case ID_SET_Y :
gActions::pushGrblText("G10 L20 y0\r\n");
break;
case ID_SET_Z :
gActions::pushGrblText("G10 L20 z0\r\n");
break;
}
}
}