Moved window position and font size storage from CRobotMain to CSettings

master
krzys-h 2015-08-04 13:09:34 +02:00
parent a4f12f1b11
commit 3f48e4699d
7 changed files with 190 additions and 172 deletions

View File

@ -39,6 +39,15 @@ CSettings::CSettings()
m_movies = true; m_movies = true;
m_niceReset = true; m_niceReset = true;
m_himselfDamage = true; m_himselfDamage = true;
m_fontSize = 19.0f;
m_windowPos = Math::Point(0.15f, 0.17f);
m_windowDim = Math::Point(0.70f, 0.66f);
m_IOPublic = false;
m_IODim = Math::Point(320.0f/640.0f, (121.0f+18.0f*8)/480.0f);
m_IOPos.x = (1.0f-m_IODim.x)/2.0f; // in the middle
m_IOPos.y = (1.0f-m_IODim.y)/2.0f;
} }
void CSettings::SaveResolutionSettings(const Gfx::DeviceConfig& config) void CSettings::SaveResolutionSettings(const Gfx::DeviceConfig& config)
@ -108,6 +117,20 @@ void CSettings::SaveSettings()
CInput::GetInstancePointer()->SaveKeyBindings(); CInput::GetInstancePointer()->SaveKeyBindings();
GetConfigFile().SetFloatProperty("Edit", "FontSize", m_fontSize);
GetConfigFile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x);
GetConfigFile().SetFloatProperty("Edit", "WindowPosY", m_windowPos.y);
GetConfigFile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x);
GetConfigFile().SetFloatProperty("Edit", "WindowDimY", m_windowDim.y);
GetConfigFile().SetIntProperty("Edit", "IOPublic", m_IOPublic);
GetConfigFile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x);
GetConfigFile().SetFloatProperty("Edit", "IOPosY", m_IOPos.y);
GetConfigFile().SetFloatProperty("Edit", "IODimX", m_IODim.x);
GetConfigFile().SetFloatProperty("Edit", "IODimY", m_IODim.y);
GetConfigFile().Save(); GetConfigFile().Save();
} }
@ -285,6 +308,20 @@ void CSettings::LoadSettings()
} }
CInput::GetInstancePointer()->LoadKeyBindings(); CInput::GetInstancePointer()->LoadKeyBindings();
if (GetConfigFile().GetFloatProperty("Edit", "FontSize", fValue)) m_fontSize = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "WindowDimX", fValue)) m_windowDim.x = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "WindowDimY", fValue)) m_windowDim.y = fValue;
if (GetConfigFile().GetIntProperty ("Edit", "IOPublic", iValue)) m_IOPublic = iValue;
if (GetConfigFile().GetFloatProperty("Edit", "IOPosX", fValue)) m_IOPos.x = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "IOPosY", fValue)) m_IOPos.y = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "IODimX", fValue)) m_IODim.x = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "IODimY", fValue)) m_IODim.y = fValue;
} }
void CSettings::SetTooltips(bool tooltips) void CSettings::SetTooltips(bool tooltips)
@ -349,3 +386,80 @@ bool CSettings::GetHimselfDamage()
{ {
return m_himselfDamage; return m_himselfDamage;
} }
void CSettings::SetFontSize(float size)
{
m_fontSize = size;
GetConfigFile().SetFloatProperty("Edit", "FontSize", m_fontSize);
GetConfigFile().Save();
}
float CSettings::GetFontSize()
{
return m_fontSize;
}
void CSettings::SetWindowPos(Math::Point pos)
{
m_windowPos = pos;
GetConfigFile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x);
GetConfigFile().SetFloatProperty("Edit", "WindowPosY", m_windowPos.y);
GetConfigFile().Save();
}
Math::Point CSettings::GetWindowPos()
{
return m_windowPos;
}
void CSettings::SetWindowDim(Math::Point dim)
{
m_windowDim = dim;
GetConfigFile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x);
GetConfigFile().SetFloatProperty("Edit", "WindowDimY", m_windowDim.y);
GetConfigFile().Save();
}
Math::Point CSettings::GetWindowDim()
{
return m_windowDim;
}
void CSettings::SetIOPublic(bool mode)
{
m_IOPublic = mode;
GetConfigFile().SetIntProperty("Edit", "IOPublic", m_IOPublic);
GetConfigFile().Save();
}
bool CSettings::GetIOPublic()
{
return m_IOPublic;
}
void CSettings::SetIOPos(Math::Point pos)
{
m_IOPos = pos;
GetConfigFile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x);
GetConfigFile().SetFloatProperty("Edit", "IOPosY", m_IOPos.y);
GetConfigFile().Save();
}
Math::Point CSettings::GetIOPos()
{
return m_IOPos;
}
void CSettings::SetIODim(Math::Point dim)
{
m_IODim = dim;
GetConfigFile().SetFloatProperty("Edit", "IODimX", m_IODim.x);
GetConfigFile().SetFloatProperty("Edit", "IODimY", m_IODim.y);
GetConfigFile().Save();
}
Math::Point CSettings::GetIODim()
{
return m_IODim;
}

View File

@ -20,6 +20,8 @@
#include "common/singleton.h" #include "common/singleton.h"
#include "math/point.h"
namespace Gfx namespace Gfx
{ {
struct DeviceConfig; struct DeviceConfig;
@ -33,6 +35,7 @@ public:
void SaveSettings(); void SaveSettings();
void LoadSettings(); void LoadSettings();
void SetTooltips(bool tooltips); void SetTooltips(bool tooltips);
bool GetTooltips(); bool GetTooltips();
@ -54,6 +57,34 @@ public:
void SetHimselfDamage(bool himselfDamage); void SetHimselfDamage(bool himselfDamage);
bool GetHimselfDamage(); bool GetHimselfDamage();
//! Managing the size of the default fonts
//@{
void SetFontSize(float size);
float GetFontSize();
//@}
//! Managing the size of the default window
//@{
void SetWindowPos(Math::Point pos);
Math::Point GetWindowPos();
void SetWindowDim(Math::Point dim);
Math::Point GetWindowDim();
//@}
//! Managing windows open/save
//@{
void SetIOPublic(bool mode);
bool GetIOPublic();
void SetIOPos(Math::Point pos);
Math::Point GetIOPos();
void SetIODim(Math::Point dim);
Math::Point GetIODim();
//@}
protected: protected:
bool m_tooltips; bool m_tooltips;
bool m_interfaceGlint; bool m_interfaceGlint;
@ -62,4 +93,12 @@ protected:
bool m_movies; bool m_movies;
bool m_niceReset; bool m_niceReset;
bool m_himselfDamage; bool m_himselfDamage;
float m_fontSize;
Math::Point m_windowPos;
Math::Point m_windowDim;
bool m_IOPublic;
Math::Point m_IOPos;
Math::Point m_IODim;
}; };

View File

@ -300,30 +300,6 @@ void CRobotMain::Create()
FlushDisplayInfo(); FlushDisplayInfo();
m_fontSize = 19.0f;
m_windowPos = Math::Point(0.15f, 0.17f);
m_windowDim = Math::Point(0.70f, 0.66f);
float fValue;
int iValue;
if (GetConfigFile().GetFloatProperty("Edit", "FontSize", fValue)) m_fontSize = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "WindowDimX", fValue)) m_windowDim.x = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "WindowDimY", fValue)) m_windowDim.y = fValue;
m_IOPublic = false;
m_IODim = Math::Point(320.0f/640.0f, (121.0f+18.0f*8)/480.0f);
m_IOPos.x = (1.0f-m_IODim.x)/2.0f; // in the middle
m_IOPos.y = (1.0f-m_IODim.y)/2.0f;
if (GetConfigFile().GetIntProperty ("Edit", "IOPublic", iValue)) m_IOPublic = iValue;
if (GetConfigFile().GetFloatProperty("Edit", "IOPosX", fValue)) m_IOPos.x = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "IOPosY", fValue)) m_IOPos.y = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "IODimX", fValue)) m_IODim.x = fValue;
if (GetConfigFile().GetFloatProperty("Edit", "IODimY", fValue)) m_IODim.y = fValue;
InitEye(); InitEye();
m_engine->SetTracePrecision(1.0f); m_engine->SetTracePrecision(1.0f);
@ -414,16 +390,6 @@ void CRobotMain::CreateConfigFile()
m_settings->SaveSettings(); m_settings->SaveSettings();
m_settings->SaveResolutionSettings(m_app->GetVideoConfig()); m_settings->SaveResolutionSettings(m_app->GetVideoConfig());
GetConfigFile().SetFloatProperty("Edit", "FontSize", m_fontSize);
GetConfigFile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x);
GetConfigFile().SetFloatProperty("Edit", "WindowPosY", m_windowPos.y);
GetConfigFile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x);
GetConfigFile().SetFloatProperty("Edit", "WindowDimY", m_windowDim.y);
GetConfigFile().SetIntProperty("Edit", "IOPublic", m_IOPublic);
GetConfigFile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x);
GetConfigFile().SetFloatProperty("Edit", "IOPosY", m_IOPos.y);
GetConfigFile().SetFloatProperty("Edit", "IODimX", m_IODim.x);
GetConfigFile().SetFloatProperty("Edit", "IODimY", m_IODim.y);
GetConfigFile().Save(); GetConfigFile().Save();
} }
@ -1554,89 +1520,6 @@ float CRobotMain::GetGameTime()
} }
//! Managing the size of the default fonts
void CRobotMain::SetFontSize(float size)
{
m_fontSize = size;
GetConfigFile().SetFloatProperty("Edit", "FontSize", m_fontSize);
GetConfigFile().Save();
}
float CRobotMain::GetFontSize()
{
return m_fontSize;
}
//! Managing the size of the default window
void CRobotMain::SetWindowPos(Math::Point pos)
{
m_windowPos = pos;
GetConfigFile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x);
GetConfigFile().SetFloatProperty("Edit", "WindowPosY", m_windowPos.y);
GetConfigFile().Save();
}
Math::Point CRobotMain::GetWindowPos()
{
return m_windowPos;
}
void CRobotMain::SetWindowDim(Math::Point dim)
{
m_windowDim = dim;
GetConfigFile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x);
GetConfigFile().SetFloatProperty("Edit", "WindowDimY", m_windowDim.y);
GetConfigFile().Save();
}
Math::Point CRobotMain::GetWindowDim()
{
return m_windowDim;
}
//! Managing windows open/save
void CRobotMain::SetIOPublic(bool mode)
{
m_IOPublic = mode;
GetConfigFile().SetIntProperty("Edit", "IOPublic", m_IOPublic);
GetConfigFile().Save();
}
bool CRobotMain::GetIOPublic()
{
return m_IOPublic;
}
void CRobotMain::SetIOPos(Math::Point pos)
{
m_IOPos = pos;
GetConfigFile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x);
GetConfigFile().SetFloatProperty("Edit", "IOPosY", m_IOPos.y);
GetConfigFile().Save();
}
Math::Point CRobotMain::GetIOPos()
{
return m_IOPos;
}
void CRobotMain::SetIODim(Math::Point dim)
{
m_IODim = dim;
GetConfigFile().SetFloatProperty("Edit", "IODimX", m_IODim.x);
GetConfigFile().SetFloatProperty("Edit", "IODimY", m_IODim.y);
GetConfigFile().Save();
}
Math::Point CRobotMain::GetIODim()
{
return m_IODim;
}
//! Start of the visit instead of an error //! Start of the visit instead of an error
void CRobotMain::StartDisplayVisit(EventType event) void CRobotMain::StartDisplayVisit(EventType event)
{ {

View File

@ -222,20 +222,6 @@ public:
float GetGameTime(); float GetGameTime();
void SetFontSize(float size);
float GetFontSize();
void SetWindowPos(Math::Point pos);
Math::Point GetWindowPos();
void SetWindowDim(Math::Point dim);
Math::Point GetWindowDim();
void SetIOPublic(bool mode);
bool GetIOPublic();
void SetIOPos(Math::Point pos);
Math::Point GetIOPos();
void SetIODim(Math::Point dim);
Math::Point GetIODim();
char* GetTitle(); char* GetTitle();
char* GetResume(); char* GetResume();
char* GetScriptName(); char* GetScriptName();
@ -540,14 +526,6 @@ protected:
std::map<int, std::string> m_teamNames; std::map<int, std::string> m_teamNames;
float m_fontSize;
Math::Point m_windowPos;
Math::Point m_windowDim;
bool m_IOPublic;
Math::Point m_IOPos;
Math::Point m_IODim;
NewScriptName m_newScriptName[MAXNEWSCRIPTNAME]; NewScriptName m_newScriptName[MAXNEWSCRIPTNAME];
float m_cameraPan; float m_cameraPan;

View File

@ -24,6 +24,7 @@
#include "common/misc.h" #include "common/misc.h"
#include "common/restext.h" #include "common/restext.h"
#include "common/settings.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include "graphics/core/light.h" #include "graphics/core/light.h"
@ -159,30 +160,30 @@ bool CDisplayInfo::EventProcess(const Event &event)
if ( event.type == EVENT_HYPER_SIZE1 ) // size 1? if ( event.type == EVENT_HYPER_SIZE1 ) // size 1?
{ {
m_main->SetFontSize(9.0f); CSettings::GetInstancePointer()->SetFontSize(9.0f);
slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE)); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); if ( slider != 0 ) slider->SetVisibleValue((CSettings::GetInstancePointer()->GetFontSize()-9.0f)/15.0f);
ViewDisplayInfo(); ViewDisplayInfo();
} }
if ( event.type == EVENT_HYPER_SIZE2 ) // size 2? if ( event.type == EVENT_HYPER_SIZE2 ) // size 2?
{ {
m_main->SetFontSize(14.0f); CSettings::GetInstancePointer()->SetFontSize(14.0f);
slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE)); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); if ( slider != 0 ) slider->SetVisibleValue((CSettings::GetInstancePointer()->GetFontSize()-9.0f)/15.0f);
ViewDisplayInfo(); ViewDisplayInfo();
} }
if ( event.type == EVENT_HYPER_SIZE3 ) // size 3? if ( event.type == EVENT_HYPER_SIZE3 ) // size 3?
{ {
m_main->SetFontSize(19.0f); CSettings::GetInstancePointer()->SetFontSize(19.0f);
slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE)); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); if ( slider != 0 ) slider->SetVisibleValue((CSettings::GetInstancePointer()->GetFontSize()-9.0f)/15.0f);
ViewDisplayInfo(); ViewDisplayInfo();
} }
if ( event.type == EVENT_HYPER_SIZE4 ) // size 4? if ( event.type == EVENT_HYPER_SIZE4 ) // size 4?
{ {
m_main->SetFontSize(24.0f); CSettings::GetInstancePointer()->SetFontSize(24.0f);
slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE)); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); if ( slider != 0 ) slider->SetVisibleValue((CSettings::GetInstancePointer()->GetFontSize()-9.0f)/15.0f);
ViewDisplayInfo(); ViewDisplayInfo();
} }
@ -190,7 +191,7 @@ bool CDisplayInfo::EventProcess(const Event &event)
{ {
slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE)); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider == 0 ) return false; if ( slider == 0 ) return false;
m_main->SetFontSize(9.0f+slider->GetVisibleValue()*15.0f); CSettings::GetInstancePointer()->SetFontSize(9.0f+slider->GetVisibleValue()*15.0f);
ViewDisplayInfo(); ViewDisplayInfo();
} }
@ -423,7 +424,7 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc
button->SetState(STATE_SHADOW); button->SetState(STATE_SHADOW);
slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE); slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE);
slider->SetState(STATE_SHADOW); slider->SetState(STATE_SHADOW);
slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); slider->SetVisibleValue((CSettings::GetInstancePointer()->GetFontSize()-9.0f)/15.0f);
button = pw->CreateButton(pos, dim, 61, EVENT_HYPER_COPY); button = pw->CreateButton(pos, dim, 61, EVENT_HYPER_COPY);
button->SetState(STATE_SHADOW); button->SetState(STATE_SHADOW);
HyperUpdate(); HyperUpdate();
@ -909,7 +910,7 @@ void CDisplayInfo::ViewDisplayInfo()
if ( edit == 0 ) return; if ( edit == 0 ) return;
dim = m_engine->GetWindowSize(); dim = m_engine->GetWindowSize();
edit->SetFontSize(m_main->GetFontSize()/(dim.x / 640.0f)); edit->SetFontSize(CSettings::GetInstancePointer()->GetFontSize()/(dim.x / 640.0f));
} }
// Returns the object human. // Returns the object human.

View File

@ -27,6 +27,7 @@
#include "common/event.h" #include "common/event.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/misc.h" #include "common/misc.h"
#include "common/settings.h"
#include "common/resources/resourcemanager.h" #include "common/resources/resourcemanager.h"
@ -77,6 +78,7 @@ CStudio::CStudio()
m_interface = m_main->GetInterface(); m_interface = m_main->GetInterface();
m_camera = m_main->GetCamera(); m_camera = m_main->GetCamera();
m_pause = CPauseManager::GetInstancePointer(); m_pause = CPauseManager::GetInstancePointer();
m_settings = CSettings::GetInstancePointer();
m_bEditMaximized = false; m_bEditMaximized = false;
m_bEditMinimized = false; m_bEditMinimized = false;
@ -172,7 +174,7 @@ bool CStudio::EventProcess(const Event &event)
{ {
slider = static_cast< CSlider* >(pw->SearchControl(EVENT_STUDIO_SIZE)); slider = static_cast< CSlider* >(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider == nullptr ) return false; if ( slider == nullptr ) return false;
m_main->SetFontSize(9.0f+slider->GetVisibleValue()*15.0f); m_settings->SetFontSize(9.0f+slider->GetVisibleValue()*15.0f);
ViewEditScript(); ViewEditScript();
} }
@ -247,16 +249,16 @@ bool CStudio::EventProcess(const Event &event)
{ {
m_editActualPos = m_editFinalPos = pw->GetPos(); m_editActualPos = m_editFinalPos = pw->GetPos();
m_editActualDim = m_editFinalDim = pw->GetDim(); m_editActualDim = m_editFinalDim = pw->GetDim();
m_main->SetWindowPos(m_editActualPos); m_settings->SetWindowPos(m_editActualPos);
m_main->SetWindowDim(m_editActualDim); m_settings->SetWindowDim(m_editActualDim);
AdjustEditScript(); AdjustEditScript();
} }
if ( event.type == pw->GetEventTypeReduce() ) if ( event.type == pw->GetEventTypeReduce() )
{ {
if ( m_bEditMinimized ) if ( m_bEditMinimized )
{ {
m_editFinalPos = m_main->GetWindowPos(); m_editFinalPos = m_settings->GetWindowPos();
m_editFinalDim = m_main->GetWindowDim(); m_editFinalDim = m_settings->GetWindowDim();
m_bEditMinimized = false; m_bEditMinimized = false;
m_bEditMaximized = false; m_bEditMaximized = false;
} }
@ -281,8 +283,8 @@ bool CStudio::EventProcess(const Event &event)
{ {
if ( m_bEditMaximized ) if ( m_bEditMaximized )
{ {
m_editFinalPos = m_main->GetWindowPos(); m_editFinalPos = m_settings->GetWindowPos();
m_editFinalDim = m_main->GetWindowDim(); m_editFinalDim = m_settings->GetWindowDim();
m_bEditMinimized = false; m_bEditMinimized = false;
m_bEditMaximized = false; m_bEditMaximized = false;
} }
@ -566,8 +568,8 @@ void CStudio::StartEditScript(CScript *script, std::string name, Program* progra
m_bRealTime = m_bRunning; m_bRealTime = m_bRunning;
m_script->SetStepMode(!m_bRealTime); m_script->SetStepMode(!m_bRealTime);
pos = m_editFinalPos = m_editActualPos = m_main->GetWindowPos(); pos = m_editFinalPos = m_editActualPos = m_settings->GetWindowPos();
dim = m_editFinalDim = m_editActualDim = m_main->GetWindowDim(); dim = m_editFinalDim = m_editActualDim = m_settings->GetWindowDim();
pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3); pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3);
if (pw == nullptr) if (pw == nullptr)
return; return;
@ -627,7 +629,7 @@ void CStudio::StartEditScript(CScript *script, std::string name, Program* progra
button->SetState(STATE_SHADOW); button->SetState(STATE_SHADOW);
slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE); slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE);
slider->SetState(STATE_SHADOW); slider->SetState(STATE_SHADOW);
slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); slider->SetVisibleValue((m_settings->GetFontSize()-9.0f)/15.0f);
pw->CreateGroup(pos, dim, 19, EVENT_LABEL1); // SatCom logo pw->CreateGroup(pos, dim, 19, EVENT_LABEL1); // SatCom logo
button = pw->CreateButton(pos, dim, 128+57, EVENT_STUDIO_TOOL); button = pw->CreateButton(pos, dim, 128+57, EVENT_STUDIO_TOOL);
button->SetState(STATE_SHADOW); button->SetState(STATE_SHADOW);
@ -948,7 +950,7 @@ void CStudio::ViewEditScript()
if ( edit == 0 ) return; if ( edit == 0 ) return;
dim = m_engine->GetWindowSize(); dim = m_engine->GetWindowSize();
edit->SetFontSize(m_main->GetFontSize()/(dim.x/640.0f)); edit->SetFontSize(m_settings->GetFontSize()/(dim.x/640.0f));
} }
@ -1104,8 +1106,8 @@ void CStudio::StartDialog(StudioDialog type)
if ( m_dialog == SD_OPEN || if ( m_dialog == SD_OPEN ||
m_dialog == SD_SAVE ) m_dialog == SD_SAVE )
{ {
pos = m_main->GetIOPos(); pos = m_settings->GetIOPos();
dim = m_main->GetIODim(); dim = m_settings->GetIODim();
} }
//? pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW9); //? pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW9);
pw = m_interface->CreateWindows(pos, dim, m_dialog==SD_OPEN?14:13, EVENT_WINDOW9); pw = m_interface->CreateWindows(pos, dim, m_dialog==SD_OPEN?14:13, EVENT_WINDOW9);
@ -1359,8 +1361,8 @@ bool CStudio::EventDialog(const Event &event)
{ {
wpos = pw->GetPos(); wpos = pw->GetPos();
wdim = pw->GetDim(); wdim = pw->GetDim();
m_main->SetIOPos(wpos); m_settings->SetIOPos(wpos);
m_main->SetIODim(wdim); m_settings->SetIODim(wdim);
AdjustDialog(); AdjustDialog();
} }
@ -1378,13 +1380,13 @@ bool CStudio::EventDialog(const Event &event)
if ( event.type == EVENT_DIALOG_CHECK1 ) // private? if ( event.type == EVENT_DIALOG_CHECK1 ) // private?
{ {
m_main->SetIOPublic(false); m_settings->SetIOPublic(false);
UpdateDialogPublic(); UpdateDialogPublic();
UpdateDialogList(); UpdateDialogList();
} }
if ( event.type == EVENT_DIALOG_CHECK2 ) // public? if ( event.type == EVENT_DIALOG_CHECK2 ) // public?
{ {
m_main->SetIOPublic(true); m_settings->SetIOPublic(true);
UpdateDialogPublic(); UpdateDialogPublic();
UpdateDialogList(); UpdateDialogList();
} }
@ -1532,13 +1534,13 @@ void CStudio::UpdateDialogPublic()
pc = static_cast< CCheck* >(pw->SearchControl(EVENT_DIALOG_CHECK1)); pc = static_cast< CCheck* >(pw->SearchControl(EVENT_DIALOG_CHECK1));
if ( pc != 0 ) if ( pc != 0 )
{ {
pc->SetState(STATE_CHECK, !m_main->GetIOPublic()); pc->SetState(STATE_CHECK, !m_settings->GetIOPublic());
} }
pc = static_cast< CCheck* >(pw->SearchControl(EVENT_DIALOG_CHECK2)); pc = static_cast< CCheck* >(pw->SearchControl(EVENT_DIALOG_CHECK2));
if ( pc != 0 ) if ( pc != 0 )
{ {
pc->SetState(STATE_CHECK, m_main->GetIOPublic()); pc->SetState(STATE_CHECK, m_settings->GetIOPublic());
} }
pl = static_cast< CLabel* >(pw->SearchControl(EVENT_DIALOG_LABEL1)); pl = static_cast< CLabel* >(pw->SearchControl(EVENT_DIALOG_LABEL1));
@ -1582,7 +1584,7 @@ void CStudio::UpdateDialogList()
std::string CStudio::SearchDirectory(bool bCreate) std::string CStudio::SearchDirectory(bool bCreate)
{ {
std::string dir; std::string dir;
if ( m_main->GetIOPublic() ) if ( m_settings->GetIOPublic() )
{ {
dir = "program"; dir = "program";
} }

View File

@ -32,6 +32,7 @@
class CEventQueue; class CEventQueue;
class CScript; class CScript;
class CSoundInterface; class CSoundInterface;
class CSettings;
struct Program; struct Program;
namespace Ui namespace Ui
@ -97,6 +98,7 @@ protected:
CInterface* m_interface; CInterface* m_interface;
CApplication* m_app; CApplication* m_app;
CPauseManager* m_pause; CPauseManager* m_pause;
CSettings* m_settings;
Program* m_program; Program* m_program;
CScript* m_script; CScript* m_script;
@ -122,4 +124,3 @@ protected:
} // namespace Ui } // namespace Ui