21 #include "file.h" |
21 #include "file.h" |
22 #include "misc.h" |
22 #include "misc.h" |
23 #include "gui.h" |
23 #include "gui.h" |
24 #include <qcolor.h> |
24 #include <qcolor.h> |
25 |
25 |
26 static color* g_LDColors[MAX_COLORS]; |
26 static LDColor* g_LDColors[MAX_COLORS]; |
27 |
27 |
28 void initColors() |
28 void initColors() |
29 { |
29 { |
30 print( "%1: initializing color information.\n", __func__ ); |
30 print( "%1: initializing color information.\n", __func__ ); |
31 |
31 |
32 color* col; |
32 LDColor* col; |
33 |
33 |
34 // Always make sure there's 16 and 24 available. They're special like that. |
34 // Always make sure there's 16 and 24 available. They're special like that. |
35 col = new color; |
35 col = new LDColor; |
36 col->hexcode = "#AAAAAA"; |
36 col->hexcode = "#AAAAAA"; |
37 col->faceColor = col->hexcode; |
37 col->faceColor = col->hexcode; |
38 col->edgeColor = Qt::black; |
38 col->edgeColor = Qt::black; |
39 g_LDColors[maincolor] = col; |
39 g_LDColors[maincolor] = col; |
40 |
40 |
41 col = new color; |
41 col = new LDColor; |
42 col->hexcode = "#000000"; |
42 col->hexcode = "#000000"; |
43 col->edgeColor = col->faceColor = Qt::black; |
43 col->edgeColor = col->faceColor = Qt::black; |
44 g_LDColors[edgecolor] = col; |
44 g_LDColors[edgecolor] = col; |
45 |
45 |
46 parseLDConfig(); |
46 parseLDConfig(); |
47 } |
47 } |
48 |
48 |
49 // ============================================================================= |
49 // ============================================================================= |
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
51 // ============================================================================= |
51 // ============================================================================= |
52 color* getColor( short colnum ) |
52 LDColor* getColor( short colnum ) |
53 { |
53 { |
54 // Check bounds |
54 // Check bounds |
55 if( colnum < 0 || colnum >= MAX_COLORS ) |
55 if( colnum < 0 || colnum >= MAX_COLORS ) |
56 return null; |
56 return null; |
57 |
57 |
141 |
141 |
142 // Parse alpha if given. |
142 // Parse alpha if given. |
143 if( parseLDConfigTag( pars, "ALPHA", valuestr )) |
143 if( parseLDConfigTag( pars, "ALPHA", valuestr )) |
144 alpha = clamp<short> ( valuestr.toShort(), 0, 255 ); |
144 alpha = clamp<short> ( valuestr.toShort(), 0, 255 ); |
145 |
145 |
146 color* col = new color; |
146 LDColor* col = new LDColor; |
147 col->name = name; |
147 col->name = name; |
148 col->faceColor = faceColor; |
148 col->faceColor = faceColor; |
149 col->edgeColor = edgeColor; |
149 col->edgeColor = edgeColor; |
150 col->hexcode = facename; |
150 col->hexcode = facename; |
151 col->faceColor.setAlpha( alpha ); |
151 col->faceColor.setAlpha( alpha ); |