Skip to content

Commit 365c1c2

Browse files
committed
UI fixes
1 parent 153b8a8 commit 365c1c2

3 files changed

Lines changed: 18 additions & 24 deletions

File tree

‎src/Geoscape/GraphsState.cpp‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ GraphsState::GraphsState(Game *game) : State(game), _butRegionsOffset(0), _butCo
101101
// initially add the GRAPH_MAX_BUTTONS having the first regions information
102102
if(offset < GRAPH_MAX_BUTTONS)
103103
{
104-
_btnRegions.push_back(new ToggleTextButton(80, 11, 0, offset*11, true));
104+
_btnRegions.push_back(new ToggleTextButton(80, 11, 0, offset*11));
105105
_btnRegions.at(offset)->setColor(Palette::blockOffset(9)+7);
106106
_btnRegions.at(offset)->setInvertColor(-42 + (4*offset));
107107
_btnRegions.at(offset)->setText(tr((*iter)->getRules()->getType()));
@@ -119,9 +119,9 @@ GraphsState::GraphsState(Game *game) : State(game), _butRegionsOffset(0), _butCo
119119
}
120120

121121
if(_regionToggles.size() < GRAPH_MAX_BUTTONS)
122-
_btnRegionTotal = new ToggleTextButton(80, 11, 0, _regionToggles.size()*11, true);
122+
_btnRegionTotal = new ToggleTextButton(80, 11, 0, _regionToggles.size()*11);
123123
else
124-
_btnRegionTotal = new ToggleTextButton(80, 11, 0, GRAPH_MAX_BUTTONS*11, true);
124+
_btnRegionTotal = new ToggleTextButton(80, 11, 0, GRAPH_MAX_BUTTONS*11);
125125
_regionToggles.push_back(new GraphButInfo(tr("STR_TOTAL_UC"), 22));
126126
_btnRegionTotal->onMousePress((ActionHandler)&GraphsState::btnRegionListClick);
127127
_btnRegionTotal->setColor(Palette::blockOffset(9)+7);
@@ -141,7 +141,7 @@ GraphsState::GraphsState(Game *game) : State(game), _butRegionsOffset(0), _butCo
141141
// initially add the GRAPH_MAX_BUTTONS having the first countries information
142142
if(offset < GRAPH_MAX_BUTTONS)
143143
{
144-
_btnCountries.push_back(new ToggleTextButton(80, 11, 0, offset*11, true));
144+
_btnCountries.push_back(new ToggleTextButton(80, 11, 0, offset*11));
145145
_btnCountries.at(offset)->setColor(Palette::blockOffset(9)+7);
146146
_btnCountries.at(offset)->setInvertColor(-42 + (4*offset));
147147
_btnCountries.at(offset)->setText(tr((*iter)->getRules()->getType()));
@@ -161,9 +161,9 @@ GraphsState::GraphsState(Game *game) : State(game), _butRegionsOffset(0), _butCo
161161
}
162162

163163
if(_countryToggles.size() < GRAPH_MAX_BUTTONS)
164-
_btnCountryTotal = new ToggleTextButton(80, 11, 0, _countryToggles.size()*11, true);
164+
_btnCountryTotal = new ToggleTextButton(80, 11, 0, _countryToggles.size()*11);
165165
else
166-
_btnCountryTotal = new ToggleTextButton(80, 11, 0, GRAPH_MAX_BUTTONS*11, true);
166+
_btnCountryTotal = new ToggleTextButton(80, 11, 0, GRAPH_MAX_BUTTONS*11);
167167
_countryToggles.push_back(new GraphButInfo(tr("STR_TOTAL_UC"), 22));
168168
_btnCountryTotal->onMousePress((ActionHandler)&GraphsState::btnCountryListClick);
169169
_btnCountryTotal->setColor(Palette::blockOffset(9)+7);
@@ -467,7 +467,7 @@ void GraphsState::btnFinanceClick(Action *)
467467
*/
468468
void GraphsState::btnRegionListClick(Action * action)
469469
{
470-
size_t number = (action->getSender()->getY()-Screen::getDY())/11;
470+
size_t number = (action->getSender()->getY()-_game->getScreen()->getDY())/11;
471471
ToggleTextButton *button = 0;
472472

473473
if ((_regionToggles.size() <= GRAPH_MAX_BUTTONS + 1 && number == _regionToggles.size()-1)||(_regionToggles.size() > GRAPH_MAX_BUTTONS + 1 && number == GRAPH_MAX_BUTTONS))
@@ -489,7 +489,7 @@ void GraphsState::btnRegionListClick(Action * action)
489489
*/
490490
void GraphsState::btnCountryListClick(Action * action)
491491
{
492-
size_t number = (action->getSender()->getY()-Screen::getDY())/11;
492+
size_t number = (action->getSender()->getY()-_game->getScreen()->getDY())/11;
493493
ToggleTextButton *button = 0;
494494

495495
if ((_countryToggles.size() <= GRAPH_MAX_BUTTONS + 1 && number == _countryToggles.size()-1)||(_countryToggles.size() > GRAPH_MAX_BUTTONS + 1 && number == GRAPH_MAX_BUTTONS))
@@ -511,7 +511,7 @@ void GraphsState::btnCountryListClick(Action * action)
511511
*/
512512
void GraphsState::btnFinanceListClick(Action *action)
513513
{
514-
size_t number = (action->getSender()->getY()-Screen::getDY())/11;
514+
size_t number = (action->getSender()->getY()-_game->getScreen()->getDY())/11;
515515
ToggleTextButton *button = _btnFinances.at(number);
516516

517517
_financeLines.at(number)->setVisible(!_financeToggles.at(number));

‎src/Geoscape/MonthlyReportState.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "MonthlyReportState.h"
2121
#include <sstream>
2222
#include <cmath>
23-
#include "../Engine/RNG.h"
2423
#include "../Engine/Game.h"
2524
#include "../Resource/ResourcePack.h"
2625
#include "../Engine/Language.h"

‎src/Interface/Window.cpp‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Sound *Window::soundPopup[3] = {0, 0, 0};
3939
* @param y Y position in pixels.
4040
* @param popup Popup animation.
4141
*/
42-
Window::Window(State *state, int width, int height, int x, int y, WindowPopup popup) : Surface(width, height, x, y), _bg(0), _color(0), _popup(popup), _popupStep(0.0), _state(state), _contrast(false), _screen(false)
42+
Window::Window(State *state, int width, int height, int x, int y, WindowPopup popup) : Surface(width, height, x, y), _dx(-x), _dy(-y), _bg(0), _color(0), _popup(popup), _popupStep(0.0), _state(state), _contrast(false), _screen(false)
4343
{
4444
_timer = new Timer(10);
4545
_timer->onTimer((SurfaceHandler)&Window::popup);
@@ -50,6 +50,7 @@ Window::Window(State *state, int width, int height, int x, int y, WindowPopup po
5050
}
5151
else
5252
{
53+
setHidden(true);
5354
_timer->start();
5455
if (_state != 0)
5556
{
@@ -74,12 +75,6 @@ Window::~Window()
7475
*/
7576
void Window::setBackground(Surface *bg)
7677
{
77-
if (_popupStep < 1.0)
78-
{
79-
_state->hideAll();
80-
setHidden(false);
81-
}
82-
8378
_bg = bg;
8479
_redraw = true;
8580
}
@@ -90,12 +85,6 @@ void Window::setBackground(Surface *bg)
9085
*/
9186
void Window::setColor(Uint8 color)
9287
{
93-
if (_popupStep < 1.0)
94-
{
95-
_state->hideAll();
96-
setHidden(false);
97-
}
98-
9988
_color = color;
10089
_redraw = true;
10190
}
@@ -125,6 +114,12 @@ void Window::setHighContrast(bool contrast)
125114
*/
126115
void Window::think()
127116
{
117+
if (_hidden && _popupStep < 1.0)
118+
{
119+
_state->hideAll();
120+
setHidden(false);
121+
}
122+
128123
_timer->think(0, this);
129124
}
130125

@@ -133,7 +128,7 @@ void Window::think()
133128
*/
134129
void Window::popup()
135130
{
136-
if ( AreSame(_popupStep, 0.0) )
131+
if (AreSame(_popupStep, 0.0))
137132
{
138133
int sound = RNG::generate(0, 2);
139134
if (soundPopup[sound] != 0)

0 commit comments

Comments
 (0)