1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/inc/MainWindow.h Thu May 22 07:16:55 2014 +0200
1.3 @@ -0,0 +1,128 @@
1.4 +
1.5 +
1.6 +#ifndef MAIN_WINDOW_H
1.7 +#define MAIN_WINDOW_H
1.8 +
1.9 +#include <fx.h>
1.10 +#include "hidapi.h"
1.11 +#include "mac_support.h"
1.12 +#include <string.h>
1.13 +#include <stdlib.h>
1.14 +#include <limits.h>
1.15 +#include "FutabaVfd.h"
1.16 +
1.17 +#ifdef _WIN32
1.18 +// Thanks Microsoft, but I know how to use strncpy().
1.19 +#pragma warning(disable:4996)
1.20 +#endif
1.21 +
1.22 +class MainWindow : public FXMainWindow {
1.23 + FXDECLARE(MainWindow)
1.24 +
1.25 +public:
1.26 + enum {
1.27 + ID_FIRST = FXMainWindow::ID_LAST,
1.28 + ID_CONNECT,
1.29 + ID_DISCONNECT,
1.30 + ID_RESCAN,
1.31 + ID_SEND_OUTPUT_REPORT,
1.32 + ID_SEND_FEATURE_REPORT,
1.33 + ID_GET_FEATURE_REPORT,
1.34 + ID_CLEAR,
1.35 + ID_TIMER,
1.36 + ID_MAC_TIMER,
1.37 + ID_FUTABA_CLEAR_DISPLAY,
1.38 + ID_FUTABA_DIMMING,
1.39 + ID_FUTABA_DISPLAY_DATA_INPUT,
1.40 + ID_FUTABA_READ_ID,
1.41 + ID_FUTABA_READ_FIRMWARE_REVISION,
1.42 + ID_FUTABA_POWER_SUPPLY_MONITOR,
1.43 + ID_FUTABA_SET_PIXEL,
1.44 + ID_FUTABA_RESET_PIXEL,
1.45 + ID_FUTABA_SET_ALL_PIXELS,
1.46 + ID_SELECT_FONT,
1.47 + ID_LAST
1.48 + };
1.49 +
1.50 + size_t getDataFromTextField(FXTextField *tf, char *buf, size_t len);
1.51 + int getLengthFromTextField(FXTextField *tf);
1.52 +
1.53 +protected:
1.54 + MainWindow() {};
1.55 +public:
1.56 + MainWindow(FXApp *a);
1.57 + ~MainWindow();
1.58 + virtual void create();
1.59 +
1.60 + long onConnect(FXObject *sender, FXSelector sel, void *ptr);
1.61 + long onDisconnect(FXObject *sender, FXSelector sel, void *ptr);
1.62 + long onRescan(FXObject *sender, FXSelector sel, void *ptr);
1.63 + long onSendOutputReport(FXObject *sender, FXSelector sel, void *ptr);
1.64 + long onSendFeatureReport(FXObject *sender, FXSelector sel, void *ptr);
1.65 + long onGetFeatureReport(FXObject *sender, FXSelector sel, void *ptr);
1.66 + long onClear(FXObject *sender, FXSelector sel, void *ptr);
1.67 + //
1.68 + long onFutabaClearDisplay(FXObject *sender, FXSelector sel, void *ptr);
1.69 + long onFutabaDimming(FXObject *sender, FXSelector sel, void *ptr);
1.70 + long onFutabaDisplayDataInput(FXObject *sender, FXSelector sel, void *ptr);
1.71 + long onFutabaReadId(FXObject *sender, FXSelector sel, void *ptr);
1.72 + long onFutabaReadFirmwareRevision(FXObject *sender, FXSelector sel, void *ptr);
1.73 + long onFutabaPowerSupplyMonitor(FXObject *sender, FXSelector sel, void *ptr);
1.74 + long onFutabaSetAllPixels(FXObject *sender, FXSelector sel, void *ptr);
1.75 + long onFutabaSetPixel(FXObject *sender, FXSelector sel, void *ptr);
1.76 + long onFutabaResetPixel(FXObject *sender, FXSelector sel, void *ptr);
1.77 + //
1.78 + long onSelectFont(FXObject *sender, FXSelector sel, void *ptr);
1.79 + //
1.80 + long onTimeout(FXObject *sender, FXSelector sel, void *ptr);
1.81 + long onMacTimeout(FXObject *sender, FXSelector sel, void *ptr);
1.82 + //
1.83 + void SetPixel(int aX, int aY, unsigned char aValue);
1.84 + void SetPixelBlock(int aX, int aY, int aHeight, int aSize, unsigned char aValue);
1.85 +
1.86 +private:
1.87 + FXList *device_list;
1.88 + FXButton *connect_button;
1.89 + FXButton *disconnect_button;
1.90 + FXButton *rescan_button;
1.91 + FXButton *output_button;
1.92 + FXLabel *connected_label;
1.93 + FXTextField *output_text;
1.94 + FXTextField *output_len;
1.95 + FXButton *feature_button;
1.96 + FXButton *get_feature_button;
1.97 + FXTextField *feature_text;
1.98 + FXTextField *feature_len;
1.99 + FXTextField *get_feature_text;
1.100 + FXText *input_text;
1.101 + FXFont *title_font;
1.102 + //Futaba VFD control
1.103 + FXButton *iButtonClearDisplay;
1.104 + FXButton *iButtonDimming;
1.105 + FXButton *iButtonDisplayDataInput;
1.106 + FXButton *iButtonReadId;
1.107 + FXButton *iButtonReadFirmwareRevision;
1.108 + FXButton *iButtonPowerSupplyMonitor;
1.109 + FXTextField *iTextFieldX;
1.110 + FXTextField *iTextFieldY;
1.111 + FXButton *iButtonSetPixel;
1.112 + FXButton *iButtonResetPixel;
1.113 + FXButton *iButtonSetAllPixels;
1.114 + //Font
1.115 + FXButton *iButtonSelectFont;
1.116 +
1.117 + unsigned char* iOutputReportBuffer;
1.118 + unsigned char iDimming; //Current VFD dimming
1.119 + FXFontDesc iCurrentFontDesc;
1.120 + FXFont* iCurrentFont;
1.121 + FXTGAImage* iFontImage;
1.122 +
1.123 + struct hid_device_info *devices;
1.124 + hid_device *connected_device;
1.125 +
1.126 + //Futaba
1.127 + GP1212A01A iVfd01;
1.128 +
1.129 +};
1.130 +
1.131 +#endif //
1.132 \ No newline at end of file