This repository has been archived by the owner on Jan 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathPrinterSettings.h
174 lines (154 loc) · 5.06 KB
/
PrinterSettings.h
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
/*
* PrinterSettings.h
*
* Created on: 16.01.2015
* Author: Forsaken
*/
#ifndef PRINTERSETTINGS_H_
#define PRINTERSETTINGS_H_
#include <Windows.h>
#include <commctrl.h>
#include "winusbhelper.h"
#include "UpPrintSets.h"
#define IDC_LABEL_HEATER_TEMP 0x101
#define IDC_LABEL_HEATER_TEMP1 0x102
#define IDC_LABEL_HEATER_TEMP2 0x103
#define IDC_LABEL_HEATER_TEMP3 0x104
#define IDC_LABEL_PREHEAT_TIME 0x105
#define IDC_INPUT_HEATER_TEMP1 0x201
#define IDC_INPUT_HEATER_TEMP2 0x202
#define IDC_INPUT_HEATER_TEMP3 0x203
#define IDC_INPUT_PREHEAT_TIME 0x204
#define IDC_BUTTON_SET_TEMP 0x401
#define IDC_BUTTON_SEND_GCODE 0x402
#define IDC_BUTTON_PRINT_AGAIN 0x403
#define IDC_BUTTON_IMPORT 0x404
#define IDC_BUTTON_EXPORT 0x405
#define IDC_TAB_PRINTER_SETS 0x501
#define IDC_INPUT_NOZZLE_DIAMETER 0x601
#define IDC_INPUT_LAYER_THICKNESS 0x602
#define IDC_INPUT_SCAN_WIDTH 0x603
#define IDC_INPUT_SCAN_TIMES 0x604
#define IDC_INPUT_HATCH_WIDTH 0x605
#define IDC_INPUT_HATCH_SPACE 0x606
#define IDC_INPUT_HATCH_LAYER 0x607
#define IDC_INPUT_SUPPORT_WIDTH 0x608
#define IDC_INPUT_SUPPORT_SPACE 0x609
#define IDC_INPUT_SUPPORT_LAYER 0x60A
#define IDC_INPUT_SCAN_SPEED 0x60B
#define IDC_INPUT_HATCH_SPEED 0x60C
#define IDC_INPUT_SUPPORT_SPEED 0x60D
#define IDC_INPUT_JUMP_SPEED 0x60E
#define IDC_INPUT_SCAN_SCALE 0x60F
#define IDC_INPUT_HATCH_SCALE 0x610
#define IDC_INPUT_SUPPORT_SCALE 0x611
#define IDC_INPUT_FEED_SCALE 0x612
#define PRINTER_SETTING_VERSION 0x0105
namespace Core {
struct PrinterSettingsStruct {
ULONG heaterTemp1;
ULONG heaterTemp2;
ULONG heaterTemp3;
BOOL heaterTempOverride1;
BOOL heaterTempOverride2;
BOOL heaterTempOverride3;
ULONG preheatTime;
BOOL preheatDelay;
UP_PRINT_SET_STRUCT customPrintSets[8];
};
class PrinterSettings {
private:
static PrinterSettings *instance;
HINSTANCE hInstDll;
HWND hWindow;
WINUSB_INTERFACE_HANDLE hUsbInterface;
ULONG lPreheatTimer;
unsigned int iPrintSetIndex;
unsigned int iPrintSetCount;
// Current setup
struct PrinterSettingsStruct settings;
// Printer status
// Window elements
HWND hLabelHeaterTemp;
HWND hLabelHeaterTemp1;
HWND hLabelHeaterTemp2;
HWND hLabelHeaterTemp3;
HWND hEditHeaterTemp1;
HWND hEditHeaterTemp2;
HWND hEditHeaterTemp3;
HWND hLabelPreheatTime;
HWND hEditPreheatTime;
HWND hButtonImport;
HWND hButtonExport;
HWND hButtonSetTemp;
HWND hButtonSendGcode;
HWND hButtonPrintAgain;
HWND hTabPrinterSets;
HWND hLabelNozzleDiameter;
HWND hEditNozzleDiameter;
HWND hLabelLayerThickness;
HWND hEditLayerThickness;
HWND hLabelScanWidth;
HWND hEditScanWidth;
HWND hLabelScanTimes;
HWND hEditScanTimes;
HWND hLabelHatchWidth;
HWND hEditHatchWidth;
HWND hLabelHatchSpace;
HWND hEditHatchSpace;
HWND hLabelHatchLayer;
HWND hEditHatchLayer;
HWND hLabelSupportWidth;
HWND hEditSupportWidth;
HWND hLabelSupportSpace;
HWND hEditSupportSpace;
HWND hLabelSupportLayer;
HWND hEditSupportLayer;
HWND hLabelScanSpeed;
HWND hEditScanSpeed;
HWND hLabelHatchSpeed;
HWND hEditHatchSpeed;
HWND hLabelSupportSpeed;
HWND hEditSupportSpeed;
HWND hLabelJumpSpeed;
HWND hEditJumpSpeed;
HWND hLabelScanScale;
HWND hEditScanScale;
HWND hLabelHatchScale;
HWND hEditHatchScale;
HWND hLabelSupportScale;
HWND hEditSupportScale;
HWND hLabelFeedScale;
HWND hEditFeedScale;
static LRESULT CALLBACK PrinterSetTabWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
WNDPROC origWndProc;
public:
PrinterSettings(HINSTANCE hInstance);
virtual ~PrinterSettings();
static PrinterSettings* getInstance();
static PrinterSettings* getInstanceNew(HINSTANCE hInstance);
LRESULT handleWndMessage(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT handlePrintSetTabWndMessage(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void applyHeaterTemperature();
UP_PRINT_SET_STRUCT* getCustomPrintSet(USHORT index);
USHORT getHeaterTemperature(USHORT layer);
ULONG getPreheatTime();
BOOL getPreheatDelayPrint();
void setHWnd(HWND hWnd);
void setHeaterTemperature(USHORT layer, USHORT newTemp);
void setHeaterTemperature(USHORT layer, USHORT newTemp, BOOL override);
void setPreheatTimer(ULONG preheatSeconds);
void setUsbHandle(WINUSB_INTERFACE_HANDLE newHandle);
void readSettingsFromConfig(HWND hWnd);
void readSettingsFromConfig(HWND hWnd, char* sFilename);
void resetHeaterTemperature();
void updatePreheatTimer(ULONG newTime);
void updatePrintSet();
void updatePrintSet(unsigned int index, UP_PRINT_SET_STRUCT* printSet);
void updatePrintSetGUI(unsigned int index);
void updateWindowTitle();
void writeSettingsToConfig();
void writeSettingsToConfig(char* sFilename);
};
} /* namespace Core */
#endif /* PRINTERSETTINGS_H_ */