From 056f779334baf1857686453a8b382daf079311de Mon Sep 17 00:00:00 2001 From: frosch Date: Fri, 1 Jun 2012 14:41:09 +0000 Subject: (svn r24310) -Codechange: Add named constants for the dimensions of settings buttons, and generally make their usage more consistent. --- src/industry_gui.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/industry_gui.cpp') diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 8b182dbd9..5a180bef5 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -749,7 +749,7 @@ public: SetDParam(1, i->last_month_production[j]); SetDParamStr(2, cargo_suffix[j]); SetDParam(3, ToPercent8(i->last_month_pct_transported[j])); - uint x = left + WD_FRAMETEXT_LEFT + (this->editable == EA_RATE ? 30 : 0); + uint x = left + WD_FRAMETEXT_LEFT + (this->editable == EA_RATE ? SETTING_BUTTON_WIDTH + 10 : 0); DrawString(x, right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_VIEW_TRANSPORTED); /* Let's put out those buttons.. */ if (this->editable == EA_RATE) { @@ -764,7 +764,7 @@ public: y += WD_PAR_VSEP_WIDE; this->production_offset_y = y; SetDParam(0, RoundDivSU(i->prod_level * 100, PRODLEVEL_DEFAULT)); - uint x = left + WD_FRAMETEXT_LEFT + 30; + uint x = left + WD_FRAMETEXT_LEFT + SETTING_BUTTON_WIDTH + 10; DrawString(x, right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_VIEW_PRODUCTION_LEVEL); DrawArrowButtons(left + WD_FRAMETEXT_LEFT, y, COLOUR_YELLOW, (this->clicked_line == IL_MULTIPLIER) ? this->clicked_button : 0, i->prod_level > PRODLEVEL_MINIMUM, i->prod_level < PRODLEVEL_MAXIMUM); @@ -838,9 +838,9 @@ public: NWidgetBase *nwi = this->GetWidget(widget); int left = nwi->pos_x + WD_FRAMETEXT_LEFT; int right = nwi->pos_x + nwi->current_x - 1 - WD_FRAMERECT_RIGHT; - if (IsInsideMM(pt.x, left, left + 20)) { + if (IsInsideMM(pt.x, left, left + SETTING_BUTTON_WIDTH)) { /* Clicked buttons, decrease or increase production */ - byte button = (pt.x < left + 10) ? 1 : 2; + byte button = (pt.x < left + SETTING_BUTTON_WIDTH / 2) ? 1 : 2; switch (this->editable) { case EA_MULTIPLIER: if (button == 1) { @@ -872,7 +872,7 @@ public: this->SetTimeout(); this->clicked_line = line; this->clicked_button = button; - } else if (IsInsideMM(pt.x, left + 30, right)) { + } else if (IsInsideMM(pt.x, left + SETTING_BUTTON_WIDTH + 10, right)) { /* clicked the text */ this->editbox_line = line; switch (this->editable) { -- cgit v1.2.3-54-g00ecf