summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-10-19 15:45:59 +0200
committerkrzys-h <krzys_h@interia.pl>2014-10-19 15:45:59 +0200
commitd7ef0a1a5f7cee44eb8faaafefb7bb78e69be1f6 (patch)
tree98e0be6f344413586db89fbd4edf49f31ab6c68d /src
parentc001c46cb53b3aedc7cbb0670f1c475679cf3d3d (diff)
downloadcolobot-d7ef0a1a5f7cee44eb8faaafefb7bb78e69be1f6.tar.gz
colobot-d7ef0a1a5f7cee44eb8faaafefb7bb78e69be1f6.tar.bz2
colobot-d7ef0a1a5f7cee44eb8faaafefb7bb78e69be1f6.zip
Implemented "Apply changes" button (issue #141)
Diffstat (limited to 'src')
-rw-r--r--src/app/app.cpp6
-rw-r--r--src/ui/maindialog.cpp72
-rw-r--r--src/ui/maindialog.h2
3 files changed, 16 insertions, 64 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp
index adc7ea3..77930ed 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -116,7 +116,7 @@ CApplication::CApplication()
m_debugModes = 0;
m_customDataPath = false;
- m_windowTitle = "COLOBOT GOLD";
+ m_windowTitle = "COLOBOT: Gold Edition";
m_simulationSuspended = false;
@@ -672,7 +672,7 @@ bool CApplication::ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig)
std::string(SDL_GetError()) + std::string("\n") +
std::string("Previous mode will be restored");
GetLogger()->Error(error.c_str());
- GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBT - Error", error);
+ GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBOT - Error", error);
restore = true;
ChangeVideoConfig(m_lastDeviceConfig);
@@ -685,7 +685,7 @@ bool CApplication::ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig)
std::string error = std::string("SDL error while restoring previous video mode:\n") +
std::string(SDL_GetError());
GetLogger()->Error(error.c_str());
- GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBT - Fatal Error", error);
+ GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBOT - Fatal Error", error);
// Fatal error, so post the quit event
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index 41e5bc2..c0656a6 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -2309,7 +2309,6 @@ bool CMainDialog::EventProcess(const Event &event)
{
switch( event.type )
{
- case EVENT_LIST1:
case EVENT_LIST2:
UpdateApply();
break;
@@ -2341,8 +2340,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( pb == 0 ) break;
pb->ClearState(STATE_PRESS);
pb->ClearState(STATE_HILIGHT);
- // TODO: uncomment when changing display is implemented
- //ChangeDisplay();
+ ChangeDisplay();
UpdateApply();
break;
@@ -4745,43 +4743,6 @@ void CMainDialog::UpdateSceneResume(int rank)
pe->SetText(name);
}
-// Updates the list of devices.
-
-void CMainDialog::UpdateDisplayDevice()
-{
- CWindow* pw;
- CList* pl;
- char bufDevices[1000];
- //char bufModes[5000];
- int i, j;
-
- pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
- if ( pw == 0 ) return;
- pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1));
- if ( pl == 0 ) return;
- pl->Flush();
-
- //bufModes[0] = 0;
- /* TODO: remove device choice
- m_engine->EnumDevices(bufDevices, 1000,
- bufModes, 5000,
- totalDevices, selectDevices,
- totalModes, selectModes);*/
-
- i = 0;
- j = 0;
- while ( bufDevices[i] != 0 )
- {
- pl->SetItemName(j++, bufDevices+i);
- while ( bufDevices[i++] != 0 );
- }
-
- pl->SetSelect(0);
- pl->ShowSelect(false);
-
- m_setupSelDevice = 0;
-}
-
// Updates the list of modes.
void CMainDialog::UpdateDisplayMode()
@@ -4817,31 +4778,30 @@ void CMainDialog::ChangeDisplay()
CWindow* pw;
CList* pl;
CCheck* pc;
- //char* device;
- //char* mode;
bool bFull;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return;
- pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1));
- if ( pl == 0 ) return;
- m_setupSelDevice = pl->GetSelect();
- //device = pl->GetItemName(m_setupSelDevice);
-
pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2));
if ( pl == 0 ) return;
m_setupSelMode = pl->GetSelect();
- //mode = pl->GetItemName(m_setupSelMode);
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
if ( pc == 0 ) return;
bFull = pc->TestState(STATE_CHECK);
m_setupFull = bFull;
+
+
+ std::vector<Math::IntPoint> modes;
+ m_app->GetVideoResolutionList(modes, true, true);
+
+ Gfx::GLDeviceConfig config = m_app->GetVideoConfig();
+ config.size = modes[m_setupSelMode];
+ config.fullScreen = bFull;
+ m_app->ChangeVideoConfig(config);
- // TODO: remove device choice
- // m_engine->ChangeDevice(device, mode, bFull);
-
+
if ( m_bSimulSetup )
{
m_main->ChangeColor();
@@ -4859,18 +4819,13 @@ void CMainDialog::UpdateApply()
CButton* pb;
CList* pl;
CCheck* pc;
- int sel1, sel2;
+ int sel2;
bool bFull;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return;
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_APPLY));
- if ( pb == 0 ) return;
-
- pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1));
- if ( pl == 0 ) return;
- sel1 = pl->GetSelect();
pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2));
if ( pl == 0 ) return;
@@ -4879,8 +4834,7 @@ void CMainDialog::UpdateApply()
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
bFull = pc->TestState(STATE_CHECK);
- if ( sel1 == m_setupSelDevice &&
- sel2 == m_setupSelMode &&
+ if ( sel2 == m_setupSelMode &&
bFull == m_setupFull )
{
pb->ClearState(STATE_ENABLE);
diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h
index 1f15176..0cf8db4 100644
--- a/src/ui/maindialog.h
+++ b/src/ui/maindialog.h
@@ -172,7 +172,6 @@ protected:
void UpdateSceneChap(int &chap);
void UpdateSceneList(int chap, int &sel);
void UpdateSceneResume(int rank);
- void UpdateDisplayDevice();
void UpdateDisplayMode();
void ChangeDisplay();
void UpdateApply();
@@ -232,7 +231,6 @@ protected:
int m_shotDelay; // number of frames before copy
std::string m_shotName; // generate a file name
- int m_setupSelDevice;
int m_setupSelMode;
bool m_setupFull;