-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui_elements.h
More file actions
135 lines (95 loc) · 3.51 KB
/
gui_elements.h
File metadata and controls
135 lines (95 loc) · 3.51 KB
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
#pragma once
#if defined(__arm__)
#define IMGUI_IMPL_OPENGL_ES2 // RPI
#endif
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include <stdio.h>
#if defined(IMGUI_IMPL_OPENGL_ES2)
#include <GLES2/gl2.h>
#endif
#include <GLFW/glfw3.h> // Will drag system OpenGL headers
#include "advatek_manager.h"
#include "portable-file-dialogs.h"
#define Version "1.0.0"
bool SliderInt8(const char* label, int* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
bool SliderInt16(const char* label, int* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
bool SliderInt8(const char* label, uint8_t* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
bool SliderInt16(const char* label, uint16_t* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
struct updateRequest {
int openTabs = 0;
int poll = 0;
int refreshAdaptors = 0;
int newVirtualDevice = 0;
int pasteToNewVirtualDevice = 0;
int connectedDevicesToVirtualDevices = 0;
int clearVirtualDevices = 0;
int clearVirtualDeviceIndex = -1;
int clearConnectedDeviceIndex = -1;
};
struct myTabBarFlags {
ImGuiTabItemFlags network = ImGuiTabItemFlags_None;
ImGuiTabItemFlags ethernet = ImGuiTabItemFlags_None;
ImGuiTabItemFlags dmx512 = ImGuiTabItemFlags_None;
ImGuiTabItemFlags leds = ImGuiTabItemFlags_None;
ImGuiTabItemFlags test = ImGuiTabItemFlags_None;
ImGuiTabItemFlags misc = ImGuiTabItemFlags_None;
void select_network();
void select_ethernet();
void select_dmx512();
void select_leds();
void select_test();
void select_misc();
void Clear();
};
struct loopVar {
bool logOpen = true;
bool b_testPixelsReady = true;
int window_w = 800;
int window_h = 600;
int open_action = -1;
int selectedNewImportIndex = -1;
int current_sync_type = 0;
double currTime = 0;
double lastTime = 0;
double lastPoll = 0;
float rePollTime = 3;
float testCycleSpeed = 0.5;
float scale = 1;
float xscale = 1;
float yscale = 1;
JSON_TYPE pt_json_device;
};
struct AppLog {
ImGuiTextBuffer Buf;
ImGuiTextFilter Filter;
ImVector<int> LineOffsets; // Index to lines offset. We maintain this with AddLog() calls.
bool AutoScroll; // Keep scrolling if already at the bottom.
AppLog();
void Clear();
void AddLog(const char* fmt, ...);
void Draw(const char* title, bool* p_open = NULL);
};
extern myTabBarFlags s_myTabBarFlags;
extern loopVar s_loopVar;
extern AppLog applog;
extern float eness_colourcode_ouptput[16][4];
extern uint32_t COL_GREY, COL_LIGHTGREY, COL_GREEN, COL_RED;
extern std::string adaptor_string, json_device_string, vDeviceString, result, vDeviceData;
extern std::vector<sAdvatekDevice*> foundDevices;
extern std::vector<std::pair<sAdvatekDevice*, sAdvatekDevice*>> syncDevices;
extern advatek_manager adv;
extern sImportOptions userImportOptions, virtualImportOptions;
void setupWindow(GLFWwindow*& window);
void scaleToScreenDPI(ImGuiIO& io);
void showResult(std::string& result);
void button_update_controller_settings(sAdvatekDevice* device);
void button_open_close_all();
void colouredText(const char* txt, uint32_t color);
void importUI(sAdvatekDevice* device, sImportOptions& importOptions);
void button_import_export_JSON(sAdvatekDevice* device);
void showDevices(std::vector<sAdvatekDevice*>& devices, bool isConnected);
void showSyncDevice(sAdvatekDevice* vdevice, bool& canSyncAll, bool& inSyncAll);
void showWindow(GLFWwindow*& window);
void processUpdateRequests();