summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-22 00:38:17 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-22 00:38:17 +0200
commit0ff419560d5a567afaa0294968cc1f5b5e6b597b (patch)
tree03edeac0b7850348b9b910e0d39dd88a477afd75 /src/ui
parent15ff1d512b9e103396144bec1cd8004ecf4f7f9c (diff)
downloadcolobot-0ff419560d5a567afaa0294968cc1f5b5e6b597b.tar.gz
colobot-0ff419560d5a567afaa0294968cc1f5b5e6b597b.tar.bz2
colobot-0ff419560d5a567afaa0294968cc1f5b5e6b597b.zip
Event fixes & refactoring
- added new state tracking to Event - removed old fields from Event - fixed some issues with Events and fps counter
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/button.cpp8
-rw-r--r--src/ui/check.cpp4
-rw-r--r--src/ui/color.cpp6
-rw-r--r--src/ui/compass.cpp4
-rw-r--r--src/ui/control.cpp12
-rw-r--r--src/ui/displayinfo.cpp6
-rw-r--r--src/ui/edit.cpp48
-rw-r--r--src/ui/editvalue.cpp9
-rw-r--r--src/ui/gauge.cpp2
-rw-r--r--src/ui/interface.cpp2
-rw-r--r--src/ui/key.cpp7
-rw-r--r--src/ui/list.cpp6
-rw-r--r--src/ui/maindialog.cpp32
-rw-r--r--src/ui/map.cpp10
-rw-r--r--src/ui/scroll.cpp20
-rw-r--r--src/ui/shortcut.cpp4
-rw-r--r--src/ui/slider.cpp22
-rw-r--r--src/ui/studio.cpp6
-rw-r--r--src/ui/target.cpp14
-rw-r--r--src/ui/window.cpp16
20 files changed, 120 insertions, 118 deletions
diff --git a/src/ui/button.cpp b/src/ui/button.cpp
index d98e676..e3dbc30 100644
--- a/src/ui/button.cpp
+++ b/src/ui/button.cpp
@@ -101,11 +101,11 @@ bool CButton::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1 &&
+ event.mouseButton.button == MOUSE_BUTTON_LEFT &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
m_bCapture = true;
m_repeat = DELAY1;
@@ -125,10 +125,10 @@ bool CButton::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_UP && //left
- event.mouseButton.button == 1 &&
+ event.mouseButton.button == MOUSE_BUTTON_LEFT &&
m_bCapture )
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
if ( !m_bImmediat && !m_bRepeat )
{
diff --git a/src/ui/check.cpp b/src/ui/check.cpp
index 3b0fbc3..bc80b7c 100644
--- a/src/ui/check.cpp
+++ b/src/ui/check.cpp
@@ -73,11 +73,11 @@ bool CCheck::EventProcess(const Event &event)
CControl::EventProcess(event);
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1 &&
+ event.mouseButton.button == MOUSE_BUTTON_LEFT &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
Event newEvent = event;
newEvent.type = m_eventType;
diff --git a/src/ui/color.cpp b/src/ui/color.cpp
index 5668519..a727642 100644
--- a/src/ui/color.cpp
+++ b/src/ui/color.cpp
@@ -105,11 +105,11 @@ bool CColor::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1 &&
+ event.mouseButton.button == MOUSE_BUTTON_LEFT &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
m_repeat = DELAY1;
@@ -120,7 +120,7 @@ bool CColor::EventProcess(const Event &event)
}
}
- if ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == 1)
+ if ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == MOUSE_BUTTON_LEFT)
{
m_repeat = 0.0f;
}
diff --git a/src/ui/compass.cpp b/src/ui/compass.cpp
index c7d0068..1bc0f8c 100644
--- a/src/ui/compass.cpp
+++ b/src/ui/compass.cpp
@@ -60,9 +60,9 @@ bool CCompass::EventProcess(const Event &event)
CControl::EventProcess(event);
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1)
+ event.mouseButton.button == MOUSE_BUTTON_LEFT)
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
Event newEvent = event;
newEvent.type = m_eventType;
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index fbf7575..16769d1 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -304,9 +304,9 @@ bool CControl::EventProcess(const Event &event)
if ( event.type == EVENT_MOUSE_MOVE )
{
- m_glintMouse = event.mouseMove.pos;
+ m_glintMouse = event.mousePos;
- if ( Detect(event.mouseMove.pos) )
+ if ( Detect(event.mousePos) )
{
if ( (m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE ) )
@@ -321,9 +321,9 @@ bool CControl::EventProcess(const Event &event)
}
}
- if ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == 1)
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == MOUSE_BUTTON_LEFT)
{
- if ( Detect(event.mouseButton.pos) )
+ if ( Detect(event.mousePos) )
{
m_bCapture = true;
SetState(STATE_PRESS);
@@ -332,7 +332,7 @@ bool CControl::EventProcess(const Event &event)
if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
- if ( Detect(event.mouseMove.pos) )
+ if ( Detect(event.mousePos) )
{
SetState(STATE_PRESS);
}
@@ -342,7 +342,7 @@ bool CControl::EventProcess(const Event &event)
}
}
- if ( event.type == EVENT_MOUSE_BUTTON_UP && m_bCapture && event.mouseButton.button == 1)
+ if ( event.type == EVENT_MOUSE_BUTTON_UP && m_bCapture && event.mouseButton.button == MOUSE_BUTTON_LEFT)
{
m_bCapture = false;
ClearState(STATE_PRESS);
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index 173c100..9b49f68 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -103,7 +103,7 @@ bool CDisplayInfo::EventProcess(const Event &event)
toto = static_cast<CMotionToto*>(m_toto->GetMotion());
if ( toto != 0 )
{
- toto->SetMousePos(event.mouseMove.pos);
+ toto->SetMousePos(event.mousePos);
}
}
}
@@ -201,8 +201,8 @@ bool CDisplayInfo::EventProcess(const Event &event)
}
}
- if ( ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == 1 )||
- ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == 1 ))
+ if ( ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == MOUSE_BUTTON_LEFT )||
+ ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == MOUSE_BUTTON_LEFT ))
{
UpdateCopyButton();
}
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index e2baae9..674ed43 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -240,14 +240,14 @@ bool CEdit::EventProcess(const Event &event)
if (event.type == EVENT_MOUSE_WHEEL &&
event.mouseWheel.dir == WHEEL_UP &&
- Detect(event.pos) )
+ Detect(event.mousePos) )
{
Scroll(m_lineFirst-3, true);
return true;
}
if (event.type == EVENT_KEY_DOWN &&
event.mouseWheel.dir == WHEEL_DOWN &&
- Detect(event.mouseWheel.pos) )
+ Detect(event.mousePos) )
{
Scroll(m_lineFirst+3, true);
return true;
@@ -263,8 +263,8 @@ bool CEdit::EventProcess(const Event &event)
if ( event.type == EVENT_MOUSE_MOVE )
{
- if ( Detect(event.mouseMove.pos) &&
- event.mouseMove.pos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
+ if ( Detect(event.mousePos) &&
+ event.mousePos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
{
if ( m_bEdit )
{
@@ -272,7 +272,7 @@ bool CEdit::EventProcess(const Event &event)
}
else
{
- if ( IsLinkPos(event.mouseMove.pos) )
+ if ( IsLinkPos(event.mousePos) )
{
m_engine->SetMouseType(Gfx::ENG_MOUSE_HAND);
}
@@ -297,23 +297,23 @@ bool CEdit::EventProcess(const Event &event)
if ( event.type == EVENT_KEY_DOWN && m_bFocus )
{
- bShift = ( (event.trackedKeys & TRKEY_SHIFT) != 0 );
- bControl = ( (event.trackedKeys & TRKEY_CONTROL) != 0);
+ bShift = ( (event.kmodState & KEY_MOD(SHIFT) ) != 0 );
+ bControl = ( (event.kmodState & KEY_MOD(CTRL) ) != 0);
if ( (event.key.unicode == 'X' && !bShift && bControl) ||
- (event.key.key == KEY(DELETE) && bShift && !bControl) )
+ ((event.kmodState & KEY_MOD(CTRL)) != 0 && bShift && !bControl) )
{
Cut();
return true;
}
if ( (event.key.unicode == 'C' && !bShift && bControl) ||
- (event.key.key == KEY(INSERT) && !bShift && bControl) )
+ ((event.kmodState & KEY_MOD(CTRL)) != 0 && !bShift && bControl) )
{
Copy();
return true;
}
if ( (event.key.unicode == 'V' && !bShift && bControl) ||
- (event.param == KEY(INSERT) && bShift && !bControl) )
+ ((event.kmodState & KEY_MOD(CTRL)) != 0 && bShift && !bControl) )
{
Paste();
return true;
@@ -471,9 +471,9 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.type == EVENT_ACTIVE )
+ if ( event.type == EVENT_FOCUS )
{
- if ( event.param == m_eventType )
+ if ( event.customParam == m_eventType )
{
m_bFocus = true;
}
@@ -484,15 +484,15 @@ bool CEdit::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1)
+ event.mouseButton.button == MOUSE_BUTTON_LEFT)
{
- m_mouseFirstPos = event.pos;
- m_mouseLastPos = event.pos;
- if ( Detect(event.pos) )
+ m_mouseFirstPos = event.mousePos;
+ m_mouseLastPos = event.mousePos;
+ if ( Detect(event.mousePos) )
{
- if ( event.pos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
+ if ( event.mousePos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
{
- MouseClick(event.pos);
+ MouseClick(event.mousePos);
if ( m_bEdit || m_bHilite ) m_bCapture = true;
}
m_bFocus = true;
@@ -505,8 +505,8 @@ bool CEdit::EventProcess(const Event &event)
if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
- m_mouseLastPos = event.pos;
- MouseMove(event.pos);
+ m_mouseLastPos = event.mousePos;
+ MouseMove(event.mousePos);
}
if ( event.type == EVENT_FRAME && m_bCapture )
@@ -515,11 +515,11 @@ bool CEdit::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_UP &&
- event.mouseButton.button == 1)
+ event.mouseButton.button == MOUSE_BUTTON_LEFT)
{
- if ( Detect(event.pos) )
+ if ( Detect(event.mousePos) )
{
- if ( event.pos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
+ if ( event.mousePos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
{
MouseRelease(m_mouseFirstPos);
}
@@ -528,7 +528,7 @@ bool CEdit::EventProcess(const Event &event)
{
if ( m_timeLastClick+DELAY_DBCLICK > m_time ) // double-click ?
{
- MouseDoubleClick(event.pos);
+ MouseDoubleClick(event.mousePos);
}
m_timeLastClick = m_time;
m_bCapture = false;
diff --git a/src/ui/editvalue.cpp b/src/ui/editvalue.cpp
index 3b819b3..3cc856d 100644
--- a/src/ui/editvalue.cpp
+++ b/src/ui/editvalue.cpp
@@ -191,7 +191,7 @@ bool CEditValue::EventProcess(const Event &event)
if (event.type == EVENT_MOUSE_WHEEL &&
event.mouseWheel.dir == WHEEL_UP &&
- Detect(event.mouseWheel.pos))
+ Detect(event.mousePos))
{
value = GetValue()+m_stepValue;
if ( value > m_maxValue ) value = m_maxValue;
@@ -200,7 +200,7 @@ bool CEditValue::EventProcess(const Event &event)
}
if ( event.type == EVENT_KEY_DOWN &&
event.mouseWheel.dir == WHEEL_DOWN &&
- Detect(event.mouseWheel.pos))
+ Detect(event.mousePos))
{
value = GetValue()-m_stepValue;
if ( value < m_minValue ) value = m_minValue;
@@ -230,9 +230,8 @@ void CEditValue::HiliteValue(const Event &event)
m_edit->SetFocus(true);
Event newEvent = event;
- newEvent.type = EVENT_ACTIVE;
- newEvent.active.gain = true; // TODO not much pretty sure about it
- newEvent.param = m_edit->GetEventType();
+ newEvent.type = EVENT_FOCUS;
+ newEvent.customParam = m_edit->GetEventType();
m_event->AddEvent(newEvent); // defocus the other objects
}
diff --git a/src/ui/gauge.cpp b/src/ui/gauge.cpp
index b1ce31d..b1fa057 100644
--- a/src/ui/gauge.cpp
+++ b/src/ui/gauge.cpp
@@ -56,7 +56,7 @@ bool CGauge::EventProcess(const Event &event)
if ( event.type == EVENT_MOUSE_BUTTON_DOWN )
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
Event newEvent = event;
newEvent.type = m_eventType;
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 0745c9b..885cef4 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -282,7 +282,7 @@ bool CInterface::EventProcess(const Event &event)
if (m_camera == nullptr) {
m_camera = static_cast<Gfx::CCamera *>(m_iMan->SearchInstance(CLASS_CAMERA));
}
- m_engine->SetMouseType(m_camera->GetMouseDef(event.mouseMove.pos));
+ m_engine->SetMouseType(m_camera->GetMouseDef(event.mousePos));
}
for (int i = MAXCONTROL-1; i >= 0; i--) {
diff --git a/src/ui/key.cpp b/src/ui/key.cpp
index 2e627bd..26d99ac 100644
--- a/src/ui/key.cpp
+++ b/src/ui/key.cpp
@@ -82,8 +82,8 @@ bool CKey::EventProcess(const Event &event)
CControl::EventProcess(event);
if (event.type == EVENT_MOUSE_BUTTON_DOWN) {
- if (event.mouseButton.button == 1) // left
- m_bCatch = Detect(event.mouseButton.pos);
+ if (event.mouseButton.button == MOUSE_BUTTON_LEFT) // left
+ m_bCatch = Detect(event.mousePos);
}
if (event.type == EVENT_KEY_DOWN && m_bCatch) {
@@ -92,12 +92,13 @@ bool CKey::EventProcess(const Event &event)
if ( TestKey(event.key.key) ) { // impossible ?
m_sound->Play(SOUND_TZOING);
} else {
+ // TODO: test for virtual, joystick, etc.
if ( event.key.key == m_key[0] || event.key.key == m_key[1] ) {
m_key[0] = event.key.key;
m_key[1] = 0;
} else {
m_key[1] = m_key[0];
- m_key[0] = event.param;
+ m_key[0] = event.key.key;
}
m_sound->Play(SOUND_CLICK);
diff --git a/src/ui/list.cpp b/src/ui/list.cpp
index f62d0ea..4356ea4 100644
--- a/src/ui/list.cpp
+++ b/src/ui/list.cpp
@@ -257,7 +257,7 @@ bool CList::EventProcess(const Event &event)
if ((m_state & STATE_ENABLE) == 0)
return true;
- if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_UP && Detect(event.mouseWheel.pos)) {
+ if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_UP && Detect(event.mousePos)) {
if (m_firstLine > 0)
m_firstLine--;
UpdateScroll();
@@ -265,7 +265,7 @@ bool CList::EventProcess(const Event &event)
return true;
}
- if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_DOWN && Detect(event.mouseWheel.pos)) {
+ if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_DOWN && Detect(event.mousePos)) {
if (m_firstLine < m_totalLine - m_displayLine)
m_firstLine++;
UpdateScroll();
@@ -275,7 +275,7 @@ bool CList::EventProcess(const Event &event)
CControl::EventProcess(event);
- if (event.type == EVENT_MOUSE_MOVE && Detect(event.mouseMove.pos)) {
+ if (event.type == EVENT_MOUSE_MOVE && Detect(event.mousePos)) {
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
for (i = 0; i < m_displayLine; i++) {
if (i + m_firstLine >= m_totalLine)
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index 4bfce41..5a9e886 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -2096,8 +2096,8 @@ bool CMainDialog::EventProcess(const Event &event)
if ( event.type == EVENT_MOUSE_MOVE )
{
- m_glintMouse = event.pos;
- NiceParticle(event.pos, event.trackedKeys & TRKEY_NUM_LEFT);
+ m_glintMouse = event.mousePos;
+ NiceParticle(event.mousePos, event.mouseButtonsState & MOUSE_BUTTON_LEFT);
}
if ( m_bDialog ) // this dialogue?
@@ -2105,7 +2105,7 @@ bool CMainDialog::EventProcess(const Event &event)
m_interface->EventProcess(event);
if ( event.type == EVENT_DIALOG_OK ||
- (event.type == EVENT_KEY_DOWN && event.param == KEY(RETURN) ) )
+ (event.type == EVENT_KEY_DOWN && event.key.key == KEY(RETURN) ) )
{
StopDialog();
if ( m_phase == PHASE_NAME )
@@ -2131,7 +2131,7 @@ bool CMainDialog::EventProcess(const Event &event)
}
}
if ( event.type == EVENT_DIALOG_CANCEL ||
- (event.type == EVENT_KEY_DOWN && event.param == KEY(ESCAPE) ) )
+ (event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE) ) )
{
StopDialog();
}
@@ -2177,7 +2177,7 @@ bool CMainDialog::EventProcess(const Event &event)
switch( event.type )
{
case EVENT_KEY_DOWN:
- if ( event.param == KEY(ESCAPE) )
+ if ( event.key.key == KEY(ESCAPE) )
{
//? StartQuit(); // would you leave?
m_sound->Play(SOUND_TZOING);
@@ -2238,11 +2238,11 @@ bool CMainDialog::EventProcess(const Event &event)
switch( event.type )
{
case EVENT_KEY_DOWN:
- if ( event.param == KEY(RETURN) )
+ if ( event.key.key == KEY(RETURN) )
{
NameSelect();
}
- if ( event.param == KEY(ESCAPE) )
+ if ( event.key.key == KEY(ESCAPE) )
{
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) break;
@@ -2295,11 +2295,11 @@ bool CMainDialog::EventProcess(const Event &event)
switch( event.type )
{
case EVENT_KEY_DOWN:
- if ( event.param == KEY(RETURN) )
+ if ( event.key.key == KEY(RETURN) )
{
m_main->ChangePhase(PHASE_INIT);
}
- if ( event.param == KEY(ESCAPE) )
+ if ( event.key.key == KEY(ESCAPE) )
{
m_main->ChangePhase(PHASE_NAME);
}
@@ -2430,7 +2430,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( event.type == pw->GetEventTypeClose() ||
event.type == EVENT_INTERFACE_BACK ||
- (event.type == EVENT_KEY_DOWN && event.param == KEY(ESCAPE)) )
+ (event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
{
m_main->ChangePhase(PHASE_INIT);
return false;
@@ -2502,7 +2502,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( event.type == pw->GetEventTypeClose() ||
event.type == EVENT_INTERFACE_BACK ||
- (event.type == EVENT_KEY_DOWN && event.param == KEY(ESCAPE)) )
+ (event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
{
SetupMemorize();
m_engine->ApplyChange();
@@ -2548,7 +2548,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( event.type == pw->GetEventTypeClose() ||
event.type == EVENT_INTERFACE_BACK ||
- (event.type == EVENT_KEY_DOWN && event.param == KEY(ESCAPE)) )
+ (event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
{
SetupMemorize();
m_engine->ApplyChange();
@@ -2920,7 +2920,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( event.type == pw->GetEventTypeClose() ||
event.type == EVENT_INTERFACE_BACK ||
- (event.type == EVENT_KEY_DOWN && event.param == KEY(ESCAPE)) )
+ (event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
{
ChangePhase(m_phaseTerm);
}
@@ -2953,7 +2953,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( event.type == pw->GetEventTypeClose() ||
event.type == EVENT_INTERFACE_BACK ||
- (event.type == EVENT_KEY_DOWN && event.param == KEY(ESCAPE)) )
+ (event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
{
m_interface->DeleteControl(EVENT_WINDOW5);
ChangePhase(PHASE_SIMUL);
@@ -3027,7 +3027,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( event.type == EVENT_KEY_DOWN )
{
- if ( event.param == KEY(ESCAPE) )
+ if ( event.key.key == KEY(ESCAPE) )
{
ChangePhase(PHASE_INIT);
}
@@ -4822,6 +4822,8 @@ void CMainDialog::UpdateSceneChap(int &chap)
pl->SetCheck(j, bPassed);
pl->SetEnable(j, true);
+ continue;
+
if ( m_phase == PHASE_MISSION && !m_main->GetShowAll() && !bPassed )
{
j ++;
diff --git a/src/ui/map.cpp b/src/ui/map.cpp
index 3a3d30f..43d9b7b 100644
--- a/src/ui/map.cpp
+++ b/src/ui/map.cpp
@@ -187,15 +187,15 @@ bool CMap::EventProcess(const Event &event)
if ( event.type == EVENT_FRAME )
m_time += event.rTime;
- if ( event.type == EVENT_MOUSE_MOVE && Detect(event.pos) ) {
+ if ( event.type == EVENT_MOUSE_MOVE && Detect(event.mousePos) ) {
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
- if ( DetectObject(event.mouseMove.pos, bInMap) != 0 )
+ if ( DetectObject(event.mousePos, bInMap) != 0 )
m_engine->SetMouseType(Gfx::ENG_MOUSE_HAND);
}
- if ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == 1 ) {
- if ( CControl::Detect(event.mouseButton.pos) ) {
- SelectObject(event.mouseButton.pos);
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == MOUSE_BUTTON_LEFT ) {
+ if ( CControl::Detect(event.mousePos) ) {
+ SelectObject(event.mousePos);
return false;
}
}
diff --git a/src/ui/scroll.cpp b/src/ui/scroll.cpp
index d3d0ed2..17f210e 100644
--- a/src/ui/scroll.cpp
+++ b/src/ui/scroll.cpp
@@ -234,21 +234,21 @@ bool CScroll::EventProcess(const Event &event)
hButton = m_buttonUp?m_dim.x/0.75f:0.0f;
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1 &&
+ event.mouseButton.button == MOUSE_BUTTON_LEFT &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
pos.y = m_pos.y+hButton;
dim.y = m_dim.y-hButton*2.0f;
pos.y += dim.y*(1.0f-m_visibleRatio)*(1.0f-m_visibleValue);
dim.y *= m_visibleRatio;
- if ( event.mouseButton.pos.y < pos.y ||
- event.mouseButton.pos.y > pos.y+dim.y ) // click outside cabin?
+ if ( event.mousePos.y < pos.y ||
+ event.mousePos.y > pos.y+dim.y ) // click outside cabin?
{
h = (m_dim.y-hButton*2.0f)*(1.0f-m_visibleRatio);
- value = 1.0f-(event.mouseButton.pos.y-(m_pos.y+hButton+dim.y*0.5f))/h;
+ value = 1.0f-(event.mousePos.y-(m_pos.y+hButton+dim.y*0.5f))/h;
if ( value < 0.0f ) value = 0.0f;
if ( value > 1.0f ) value = 1.0f;
m_visibleValue = value;
@@ -259,7 +259,7 @@ bool CScroll::EventProcess(const Event &event)
m_event->AddEvent(newEvent);
}
m_bCapture = true;
- m_pressPos = event.mouseButton.pos;
+ m_pressPos = event.mousePos;
m_pressValue = m_visibleValue;
}
}
@@ -269,7 +269,7 @@ bool CScroll::EventProcess(const Event &event)
h = (m_dim.y-hButton*2.0f)*(1.0f-m_visibleRatio);
if ( h != 0 )
{
- value = m_pressValue - (event.mouseMove.pos.y-m_pressPos.y)/h;
+ value = m_pressValue - (event.mousePos.y-m_pressPos.y)/h;
if ( value < 0.0f ) value = 0.0f;
if ( value > 1.0f ) value = 1.0f;
@@ -286,7 +286,7 @@ bool CScroll::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_UP &&
- event.mouseButton.button == 1 &&
+ event.mouseButton.button == MOUSE_BUTTON_LEFT &&
m_bCapture )
{
m_bCapture = false;
@@ -294,7 +294,7 @@ bool CScroll::EventProcess(const Event &event)
if (event.type == EVENT_MOUSE_WHEEL &&
event.mouseWheel.dir == WHEEL_UP &&
- Detect(event.mouseWheel.pos) &&
+ Detect(event.mousePos) &&
m_buttonUp != 0)
{
Event newEvent = event;
@@ -303,7 +303,7 @@ bool CScroll::EventProcess(const Event &event)
}
if (event.type == EVENT_MOUSE_WHEEL &&
event.mouseWheel.dir == WHEEL_DOWN &&
- Detect(event.mouseWheel.pos) &&
+ Detect(event.mousePos) &&
m_buttonDown != 0)
{
Event newEvent = event;
diff --git a/src/ui/shortcut.cpp b/src/ui/shortcut.cpp
index c8d3890..18b8f31 100644
--- a/src/ui/shortcut.cpp
+++ b/src/ui/shortcut.cpp
@@ -67,9 +67,9 @@ bool CShortcut::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1)
+ event.mouseButton.button == MOUSE_BUTTON_LEFT)
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
Event newEvent = event;
newEvent.type = m_eventType;
diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp
index 70dd2cc..ca907fe 100644
--- a/src/ui/slider.cpp
+++ b/src/ui/slider.cpp
@@ -284,24 +284,24 @@ bool CSlider::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- (event.mouseButton.button == 1 ) &&
+ (event.mouseButton.button == MOUSE_BUTTON_LEFT ) &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
if ( m_bHoriz )
{
pos.x = m_pos.x+m_marginButton;
dim.x = m_dim.x-m_marginButton*2.0f;
- value = (event.mouseButton.pos.x-pos.x-CURSOR_WIDTH/2.0f);
+ value = (event.mousePos.x-pos.x-CURSOR_WIDTH/2.0f);
value /= (dim.x-CURSOR_WIDTH);
}
else
{
pos.y = m_pos.y+m_marginButton;
dim.y = m_dim.y-m_marginButton*2.0f;
- value = (event.mouseButton.pos.y-pos.y-CURSOR_WIDTH/2.0f);
+ value = (event.mousePos.y-pos.y-CURSOR_WIDTH/2.0f);
value /= (dim.y-CURSOR_WIDTH);
}
if ( value < 0.0f ) value = 0.0f;
@@ -314,7 +314,7 @@ bool CSlider::EventProcess(const Event &event)
m_event->AddEvent(newEvent);
m_bCapture = true;
- m_pressPos = event.mouseButton.pos;
+ m_pressPos = event.mousePos;
m_pressValue = m_visibleValue;
}
}
@@ -325,14 +325,14 @@ bool CSlider::EventProcess(const Event &event)
{
pos.x = m_pos.x+m_marginButton;
dim.x = m_dim.x-m_marginButton*2.0f;
- value = (event.mouseMove.pos.x-pos.x-CURSOR_WIDTH/2.0f);
+ value = (event.mousePos.x-pos.x-CURSOR_WIDTH/2.0f);
value /= (dim.x-CURSOR_WIDTH);
}
else
{
pos.y = m_pos.y+m_marginButton;
dim.y = m_dim.y-m_marginButton*2.0f;
- value = (event.mouseMove.pos.y-pos.y-CURSOR_WIDTH/2.0f);
+ value = (event.mousePos.y-pos.y-CURSOR_WIDTH/2.0f);
value /= (dim.y-CURSOR_WIDTH);
}
if ( value < 0.0f ) value = 0.0f;
@@ -350,7 +350,7 @@ bool CSlider::EventProcess(const Event &event)
}
if ( ( event.type == EVENT_MOUSE_BUTTON_UP ) &&
- ( event.mouseButton.button == 1 ) &&
+ ( event.mouseButton.button == MOUSE_BUTTON_LEFT ) &&
m_bCapture )
{
m_bCapture = false;
@@ -358,7 +358,7 @@ bool CSlider::EventProcess(const Event &event)
if (event.type == EVENT_MOUSE_WHEEL &&
event.mouseWheel.dir == WHEEL_UP &&
- Detect(event.mouseWheel.pos) &&
+ Detect(event.mousePos) &&
m_buttonLeft != 0)
{
Event newEvent = event;
@@ -367,8 +367,8 @@ bool CSlider::EventProcess(const Event &event)
}
if (event.type == EVENT_MOUSE_WHEEL &&
- event.mouseButton.button == WHEEL_DOWN &&
- Detect(event.mouseWheel.pos) &&
+ event.mouseWheel.dir == WHEEL_DOWN &&
+ Detect(event.mousePos) &&
m_buttonRight != 0)
{
Event newEvent = event;
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index c546c57..a581baa 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -242,7 +242,7 @@ bool CStudio::EventProcess(const Event &event)
if ( event.type == EVENT_KEY_DOWN )
{
if ( event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).key ||
- event.param == m_main->GetInputBinding(INPUT_SLOT_CBOT).joy )
+ event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).joy )
{
if ( m_helpFilename.length() > 0 )
{
@@ -1355,7 +1355,7 @@ bool CStudio::EventDialog(const Event &event)
}
if ( event.type == EVENT_DIALOG_OK ||
- (event.type == EVENT_KEY_DOWN && event.param == KEY(RETURN)) )
+ (event.type == EVENT_KEY_DOWN && event.key.key == KEY(RETURN)) )
{
if ( m_dialog == SD_OPEN )
{
@@ -1371,7 +1371,7 @@ bool CStudio::EventDialog(const Event &event)
}
if ( event.type == EVENT_DIALOG_CANCEL ||
- (event.type == EVENT_KEY_DOWN && event.param == KEY(ESCAPE)) ||
+ (event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) ||
event.type == pw->GetEventTypeClose() )
{
StopDialog();
diff --git a/src/ui/target.cpp b/src/ui/target.cpp
index f398e58..b47ba16 100644
--- a/src/ui/target.cpp
+++ b/src/ui/target.cpp
@@ -59,7 +59,7 @@ bool CTarget::EventProcess(const Event &event)
if ( event.type == EVENT_MOUSE_MOVE )
{
- if ( CControl::Detect(event.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
m_engine->SetMouseType(Gfx::ENG_MOUSE_TARGET);
Event newEvent = event;
@@ -70,11 +70,11 @@ bool CTarget::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1 &&
+ event.mouseButton.button == MOUSE_BUTTON_LEFT &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
- if ( CControl::Detect(event.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
Event newEvent = event;
newEvent.type = EVENT_OBJECT_FIRE;
@@ -96,9 +96,9 @@ bool CTarget::EventProcess(const Event &event)
{
m_main->SetFriendAim(false);
- if ( CControl::Detect(event.mouseMove.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
- pObj = DetectFriendObject(event.mouseMove.pos);
+ pObj = DetectFriendObject(event.mousePos);
if ( pObj == 0 )
{
m_engine->SetMouseType(Gfx::ENG_MOUSE_TARGET);
@@ -117,11 +117,11 @@ bool CTarget::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1 &&
+ event.mouseButton.button == MOUSE_BUTTON_LEFT &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
if ( !m_main->GetFriendAim() )
{
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index 4967795..97daf94 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -949,9 +949,9 @@ bool CWindow::EventProcess(const Event &event)
m_pressMouse = Gfx::ENG_MOUSE_NORM;
if ( m_name.length() > 0 && m_bMovable && // title bar?
- Detect(event.pos) )
+ Detect(event.mousePos) )
{
- flags = BorderDetect(event.pos);
+ flags = BorderDetect(event.mousePos);
if ( flags == -1 )
{
m_pressMouse = Gfx::ENG_MOUSE_MOVE; // +
@@ -1011,17 +1011,17 @@ bool CWindow::EventProcess(const Event &event)
}
if ( m_bTrashEvent && event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1)
+ event.mouseButton.button == MOUSE_BUTTON_LEFT)
{
- if ( Detect(event.pos) )
+ if ( Detect(event.mousePos) )
{
if ( m_name.length() > 0 && m_bMovable ) // title bar?
{
- m_pressFlags = BorderDetect(event.pos);
+ m_pressFlags = BorderDetect(event.mousePos);
if ( m_pressFlags != 0 )
{
m_bCapture = true;
- m_pressPos = event.pos;
+ m_pressPos = event.mousePos;
}
}
return false;
@@ -1030,7 +1030,7 @@ bool CWindow::EventProcess(const Event &event)
if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
- pos = event.pos;
+ pos = event.mousePos;
if ( m_pressFlags == -1 ) // all moves?
{
m_pos.x += pos.x-m_pressPos.x;
@@ -1081,7 +1081,7 @@ bool CWindow::EventProcess(const Event &event)
m_event->AddEvent(newEvent);
}
- if ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == 1 && m_bCapture )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == MOUSE_BUTTON_LEFT && m_bCapture )
{
m_bCapture = false;
}