863 DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable) ? 6 : 4, (*(bool*)pe->variable) ? FR_LOWERED : 0); |
863 DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable) ? 6 : 4, (*(bool*)pe->variable) ? FR_LOWERED : 0); |
864 else |
864 else |
865 DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable) ? 7 : 9, (*(bool*)pe->variable) ? FR_LOWERED : 0); |
865 DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable) ? 7 : 9, (*(bool*)pe->variable) ? FR_LOWERED : 0); |
866 SetDParam(0, *(bool*)pe->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF); |
866 SetDParam(0, *(bool*)pe->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF); |
867 } else { |
867 } else { |
868 DrawFrameRect(x+5, y+1, x+5+9, y+9, 3, clk == i*2+1 ? FR_LOWERED : 0); |
868 /* Draw [<][>] boxes for settings of an integer-type */ |
869 DrawFrameRect(x+15, y+1, x+15+9, y+9, 3, clk == i*2+2 ? FR_LOWERED : 0); |
869 DrawArrowButtons(x, y, 3, clk - (i * 2), editable); |
870 if (!editable) { |
|
871 int color = PALETTE_MODIFIER_GREYOUT | _color_list[3].unk2; |
|
872 GfxFillRect(x+6, y+2, x+6+8, y+9, color); |
|
873 GfxFillRect(x+16, y+2, x+16+8, y+9, color); |
|
874 } |
|
875 DrawStringCentered(x+10, y+1, STR_6819, 0); |
|
876 DrawStringCentered(x+20, y+1, STR_681A, 0); |
|
877 |
870 |
878 val = ReadPE(pe); |
871 val = ReadPE(pe); |
879 if (pe->type == PE_CURRENCY) val /= _currency->rate; |
872 if (pe->type == PE_CURRENCY) val /= _currency->rate; |
880 disabled = ((val == 0) && (pe->flags & PF_0ISDIS)); |
873 disabled = ((val == 0) && (pe->flags & PF_0ISDIS)); |
881 if (disabled) { |
874 if (disabled) { |
1298 w->vscroll.count = count; |
1291 w->vscroll.count = count; |
1299 w->vscroll.pos = 0; |
1292 w->vscroll.pos = 0; |
1300 w->disabled_state = (1 << 5) | (1 << 6) | (1 << 7); |
1293 w->disabled_state = (1 << 5) | (1 << 6) | (1 << 7); |
1301 } |
1294 } |
1302 |
1295 |
1303 /* state: 0 = none clicked, 0x01 = first clicked, 0x02 = second clicked */ |
1296 /** Draw [<][>] boxes |
1304 void DrawArrowButtons(int x, int y, int state) |
1297 * state: 0 = none clicked, 1 = first clicked, 2 = second clicked */ |
1305 { |
1298 void DrawArrowButtons(int x, int y, int ctab, byte state, bool enabled) |
1306 DrawFrameRect(x, y+1, x+9, y+9, 3, (state & 0x01) ? FR_LOWERED : 0); |
1299 { |
1307 DrawFrameRect(x+10, y+1, x+19, y+9, 3, (state & 0x02) ? FR_LOWERED : 0); |
1300 DrawFrameRect(x, y+1, x + 9, y+9, ctab, (state == 1) ? FR_LOWERED : 0); |
1308 DrawStringCentered(x+5, y+1, STR_6819, 0); |
1301 DrawFrameRect(x+10, y+1, x +19, y+9, ctab, (state == 2) ? FR_LOWERED : 0); |
1309 DrawStringCentered(x+15, y+1, STR_681A, 0); |
1302 DrawStringCentered(x+ 5, y+1, STR_6819, 0); // [<] |
|
1303 DrawStringCentered(x+15, y+1, STR_681A, 0); // [>] |
|
1304 |
|
1305 if (!enabled) { |
|
1306 int color = PALETTE_MODIFIER_GREYOUT | _color_list[3].unk2; |
|
1307 GfxFillRect(x+ 1, y+1, x+ 1+8, y+8, color); |
|
1308 GfxFillRect(x+11, y+1, x+11+8, y+8, color); |
|
1309 } |
1310 } |
1310 } |
1311 |
1311 |
1312 static char _str_separator[2]; |
1312 static char _str_separator[2]; |
1313 |
1313 |
1314 static void CustCurrencyWndProc(Window *w, WindowEvent *e) |
1314 static void CustCurrencyWndProc(Window *w, WindowEvent *e) |
1318 int x=35, y=20, i=0; |
1318 int x=35, y=20, i=0; |
1319 int clk = WP(w,def_d).data_1; |
1319 int clk = WP(w,def_d).data_1; |
1320 DrawWindowWidgets(w); |
1320 DrawWindowWidgets(w); |
1321 |
1321 |
1322 // exchange rate |
1322 // exchange rate |
1323 DrawArrowButtons(10, y, (clk >> (i*2)) & 0x03); |
1323 DrawArrowButtons(10, y, 3, (clk >> (i*2)) & 0x03, true); |
1324 SetDParam(0, 1); |
1324 SetDParam(0, 1); |
1325 SetDParam(1, 1); |
1325 SetDParam(1, 1); |
1326 DrawString(x, y + 1, STR_CURRENCY_EXCHANGE_RATE, 0); |
1326 DrawString(x, y + 1, STR_CURRENCY_EXCHANGE_RATE, 0); |
1327 x = 35; |
1327 x = 35; |
1328 y+=12; |
1328 y+=12; |
1351 x = 35; |
1351 x = 35; |
1352 y+=12; |
1352 y+=12; |
1353 i++; |
1353 i++; |
1354 |
1354 |
1355 // switch to euro |
1355 // switch to euro |
1356 DrawArrowButtons(10, y, (clk >> (i*2)) & 0x03); |
1356 DrawArrowButtons(10, y, 3, (clk >> (i*2)) & 0x03, true); |
1357 SetDParam(0, _custom_currency.to_euro); |
1357 SetDParam(0, _custom_currency.to_euro); |
1358 DrawString(x, y + 1, (_custom_currency.to_euro != CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER, 0); |
1358 DrawString(x, y + 1, (_custom_currency.to_euro != CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER, 0); |
1359 x = 35; |
1359 x = 35; |
1360 y+=12; |
1360 y+=12; |
1361 i++; |
1361 i++; |