1 #pragma once
2 
3 #include "lc_array.h"
4 #include "lc_math.h"
5 
6 #define LC_MAX_COLOR_NAME 64
7 #define LC_COLOR_DIRECT 0x80000000
8 #define LC_COLOR_NOCOLOR 0xffffffff
9 
10 struct lcColor
11 {
12 	quint32 Code;
13 	int Group;
14 	bool Translucent = false;
15 	bool Adjusted = false;
16 	lcVector4 Value;
17 	lcVector4 Edge;
18 	char Name[LC_MAX_COLOR_NAME];
19 	char SafeName[LC_MAX_COLOR_NAME];
20 };
21 
22 enum
23 {
24 	LC_COLORGROUP_SOLID,
25 	LC_COLORGROUP_TRANSLUCENT,
26 	LC_COLORGROUP_SPECIAL,
27 	LC_NUM_COLORGROUPS
28 };
29 
30 struct lcColorGroup
31 {
32 	std::vector<int> Colors;
33 	QString Name;
34 };
35 
36 enum lcInterfaceColor
37 {
38 	LC_COLOR_SELECTED,
39 	LC_COLOR_FOCUSED,
40 	LC_COLOR_CAMERA,
41 	LC_COLOR_LIGHT,
42 	LC_COLOR_CONTROL_POINT,
43 	LC_COLOR_CONTROL_POINT_FOCUSED,
44 	LC_NUM_INTERFACECOLORS
45 };
46 
47 extern lcVector4 gInterfaceColors[LC_NUM_INTERFACECOLORS];
48 extern std::vector<lcColor> gColorList;
49 extern lcColorGroup gColorGroups[LC_NUM_COLORGROUPS];
50 extern int gEdgeColor;
51 extern int gDefaultColor;
52 
53 void lcLoadDefaultColors(lcStudStyle StudStyle);
54 bool lcLoadColorFile(lcFile& File, lcStudStyle StudStyle);
55 int lcGetColorIndex(quint32 ColorCode);
56 
lcGetColorCodeFromExtendedColor(int Color)57 inline quint32 lcGetColorCodeFromExtendedColor(int Color)
58 {
59 	const quint32 ConversionTable[] = { 4, 12, 2, 10, 1, 9, 14, 15, 8, 0, 6, 13, 13, 334, 36, 44, 34, 42, 33, 41, 46, 47, 7, 382, 6, 13, 11, 383 };
60 	return ConversionTable[Color];
61 }
62 
lcGetColorCodeFromOriginalColor(int Color)63 inline quint32 lcGetColorCodeFromOriginalColor(int Color)
64 {
65 	const quint32 ConversionTable[] = { 0, 2, 4, 9, 7, 6, 22, 8, 10, 11, 14, 16, 18, 9, 21, 20, 22, 8, 10, 11 };
66 	return lcGetColorCodeFromExtendedColor(ConversionTable[Color]);
67 }
68 
lcGetColorCode(int ColorIndex)69 inline quint32 lcGetColorCode(int ColorIndex)
70 {
71 	return gColorList[ColorIndex].Code;
72 }
73 
lcIsColorTranslucent(size_t ColorIndex)74 inline bool lcIsColorTranslucent(size_t ColorIndex)
75 {
76 	return gColorList[ColorIndex].Translucent;
77 }
78