sl@6
|
1 |
|
sl@6
|
2 |
|
sl@6
|
3 |
#ifndef MAIN_WINDOW_H
|
sl@6
|
4 |
#define MAIN_WINDOW_H
|
sl@6
|
5 |
|
sl@6
|
6 |
#include <fx.h>
|
sl@6
|
7 |
#include "hidapi.h"
|
sl@6
|
8 |
#include "mac_support.h"
|
sl@6
|
9 |
#include <string.h>
|
sl@6
|
10 |
#include <stdlib.h>
|
sl@6
|
11 |
#include <limits.h>
|
sl@9
|
12 |
#include "FutabaVfd.h"
|
sl@6
|
13 |
|
sl@6
|
14 |
#ifdef _WIN32
|
sl@6
|
15 |
// Thanks Microsoft, but I know how to use strncpy().
|
sl@6
|
16 |
#pragma warning(disable:4996)
|
sl@6
|
17 |
#endif
|
sl@6
|
18 |
|
sl@6
|
19 |
class MainWindow : public FXMainWindow {
|
sl@6
|
20 |
FXDECLARE(MainWindow)
|
sl@6
|
21 |
|
sl@6
|
22 |
public:
|
sl@6
|
23 |
enum {
|
sl@6
|
24 |
ID_FIRST = FXMainWindow::ID_LAST,
|
sl@6
|
25 |
ID_CONNECT,
|
sl@6
|
26 |
ID_DISCONNECT,
|
sl@6
|
27 |
ID_RESCAN,
|
sl@6
|
28 |
ID_SEND_OUTPUT_REPORT,
|
sl@6
|
29 |
ID_SEND_FEATURE_REPORT,
|
sl@6
|
30 |
ID_GET_FEATURE_REPORT,
|
sl@6
|
31 |
ID_CLEAR,
|
sl@6
|
32 |
ID_TIMER,
|
sl@6
|
33 |
ID_MAC_TIMER,
|
sl@6
|
34 |
ID_FUTABA_CLEAR_DISPLAY,
|
sl@6
|
35 |
ID_FUTABA_DIMMING,
|
sl@6
|
36 |
ID_FUTABA_DISPLAY_DATA_INPUT,
|
sl@6
|
37 |
ID_FUTABA_READ_ID,
|
sl@6
|
38 |
ID_FUTABA_READ_FIRMWARE_REVISION,
|
sl@6
|
39 |
ID_FUTABA_POWER_SUPPLY_MONITOR,
|
sl@6
|
40 |
ID_FUTABA_SET_PIXEL,
|
sl@6
|
41 |
ID_FUTABA_RESET_PIXEL,
|
sl@6
|
42 |
ID_FUTABA_SET_ALL_PIXELS,
|
sl@6
|
43 |
ID_SELECT_FONT,
|
sl@6
|
44 |
ID_LAST
|
sl@6
|
45 |
};
|
sl@6
|
46 |
|
sl@6
|
47 |
size_t getDataFromTextField(FXTextField *tf, char *buf, size_t len);
|
sl@6
|
48 |
int getLengthFromTextField(FXTextField *tf);
|
sl@6
|
49 |
|
sl@6
|
50 |
protected:
|
sl@6
|
51 |
MainWindow() {};
|
sl@6
|
52 |
public:
|
sl@6
|
53 |
MainWindow(FXApp *a);
|
sl@6
|
54 |
~MainWindow();
|
sl@6
|
55 |
virtual void create();
|
sl@6
|
56 |
|
sl@6
|
57 |
long onConnect(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
58 |
long onDisconnect(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
59 |
long onRescan(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
60 |
long onSendOutputReport(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
61 |
long onSendFeatureReport(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
62 |
long onGetFeatureReport(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
63 |
long onClear(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
64 |
//
|
sl@6
|
65 |
long onFutabaClearDisplay(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
66 |
long onFutabaDimming(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
67 |
long onFutabaDisplayDataInput(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
68 |
long onFutabaReadId(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
69 |
long onFutabaReadFirmwareRevision(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
70 |
long onFutabaPowerSupplyMonitor(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
71 |
long onFutabaSetAllPixels(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
72 |
long onFutabaSetPixel(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
73 |
long onFutabaResetPixel(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
74 |
//
|
sl@6
|
75 |
long onSelectFont(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
76 |
//
|
sl@6
|
77 |
long onTimeout(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
78 |
long onMacTimeout(FXObject *sender, FXSelector sel, void *ptr);
|
sl@6
|
79 |
//
|
sl@6
|
80 |
void SetPixel(int aX, int aY, unsigned char aValue);
|
sl@6
|
81 |
void SetPixelBlock(int aX, int aY, int aHeight, int aSize, unsigned char aValue);
|
sl@6
|
82 |
|
sl@6
|
83 |
private:
|
sl@6
|
84 |
FXList *device_list;
|
sl@6
|
85 |
FXButton *connect_button;
|
sl@6
|
86 |
FXButton *disconnect_button;
|
sl@6
|
87 |
FXButton *rescan_button;
|
sl@6
|
88 |
FXButton *output_button;
|
sl@6
|
89 |
FXLabel *connected_label;
|
sl@6
|
90 |
FXTextField *output_text;
|
sl@6
|
91 |
FXTextField *output_len;
|
sl@6
|
92 |
FXButton *feature_button;
|
sl@6
|
93 |
FXButton *get_feature_button;
|
sl@6
|
94 |
FXTextField *feature_text;
|
sl@6
|
95 |
FXTextField *feature_len;
|
sl@6
|
96 |
FXTextField *get_feature_text;
|
sl@6
|
97 |
FXText *input_text;
|
sl@6
|
98 |
FXFont *title_font;
|
sl@6
|
99 |
//Futaba VFD control
|
sl@6
|
100 |
FXButton *iButtonClearDisplay;
|
sl@6
|
101 |
FXButton *iButtonDimming;
|
sl@6
|
102 |
FXButton *iButtonDisplayDataInput;
|
sl@6
|
103 |
FXButton *iButtonReadId;
|
sl@6
|
104 |
FXButton *iButtonReadFirmwareRevision;
|
sl@6
|
105 |
FXButton *iButtonPowerSupplyMonitor;
|
sl@6
|
106 |
FXTextField *iTextFieldX;
|
sl@6
|
107 |
FXTextField *iTextFieldY;
|
sl@6
|
108 |
FXButton *iButtonSetPixel;
|
sl@6
|
109 |
FXButton *iButtonResetPixel;
|
sl@6
|
110 |
FXButton *iButtonSetAllPixels;
|
sl@6
|
111 |
//Font
|
sl@6
|
112 |
FXButton *iButtonSelectFont;
|
sl@6
|
113 |
|
sl@6
|
114 |
unsigned char* iOutputReportBuffer;
|
sl@6
|
115 |
unsigned char iDimming; //Current VFD dimming
|
sl@6
|
116 |
FXFontDesc iCurrentFontDesc;
|
sl@7
|
117 |
FXFont* iCurrentFont;
|
sl@8
|
118 |
FXTGAImage* iFontImage;
|
sl@6
|
119 |
|
sl@6
|
120 |
struct hid_device_info *devices;
|
sl@6
|
121 |
hid_device *connected_device;
|
sl@6
|
122 |
};
|
sl@6
|
123 |
|
sl@6
|
124 |
#endif // |