more resolution switching fixes

actorid
scrawl 13 years ago
parent e1ee45a6d6
commit 0a17d6d710

@ -50,6 +50,8 @@ namespace MWGui
void ConfirmationDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
{
eventCancelClicked();
close();
}

@ -17,6 +17,7 @@ namespace MWGui
signature : void method()\n
*/
EventHandle_Void eventOkClicked;
EventHandle_Void eventCancelClicked;
private:
MyGUI::EditBox* mMessage;

@ -43,6 +43,7 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
, mDragAndDrop(dragAndDrop)
, mCellNameTimer(0.0f)
, mCellNameBox(NULL)
, mMapVisible(true)
{
setCoord(0,0, width, height);
@ -234,6 +235,7 @@ void HUD::setBottomRightVisibility(bool effectBoxVisible, bool minimapBoxVisible
if (!minimapBoxVisible)
effectsDx = minimapBoxBaseRight - effectBoxBaseRight;
mMapVisible = minimapBoxVisible;
minimapBox->setVisible(minimapBoxVisible);
effectBox->setPosition(effectBoxBaseRight - effectBox->getWidth() + effectsDx, effectBox->getTop());
effectBox->setVisible(effectBoxVisible);
@ -337,7 +339,7 @@ void HUD::setCellName(const std::string& cellName)
mCellName = cellName;
mCellNameBox->setCaption(mCellName);
mCellNameBox->setVisible(true);
mCellNameBox->setVisible(mMapVisible);
}
}

@ -57,6 +57,8 @@ namespace MWGui
std::string mCellName;
float mCellNameTimer;
bool mMapVisible;
void onWorldClicked(MyGUI::Widget* _sender);
void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);

@ -113,6 +113,8 @@ namespace MWGui
dialog->open("#{sNotifyMessage67}");
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &SettingsWindow::onResolutionAccept);
dialog->eventCancelClicked.clear();
dialog->eventCancelClicked += MyGUI::newDelegate(this, &SettingsWindow::onResolutionAccept);
}
void SettingsWindow::onResolutionAccept()
@ -130,6 +132,12 @@ namespace MWGui
Settings::Manager::setInt("resolution y", "Video", resY);
apply();
mResolutionList->setIndexSelected(MyGUI::ITEM_NONE);
}
void SettingsWindow::onResolutionCancel()
{
mResolutionList->setIndexSelected(MyGUI::ITEM_NONE);
}
void SettingsWindow::onButtonToggled(MyGUI::Widget* _sender)
@ -150,8 +158,36 @@ namespace MWGui
if (_sender == mFullscreenButton)
{
Settings::Manager::setBool("fullscreen", "Video", newState);
apply();
// check if this resolution is supported in fullscreen
bool supported = false;
for (unsigned int i=0; i<mResolutionList->getItemCount(); ++i)
{
std::string resStr = mResolutionList->getItemNameAt(i);
size_t xPos = resStr.find("x");
std::string resXStr = resStr.substr(0, xPos-1);
Ogre::StringUtil::trim(resXStr);
std::string resYStr = resStr.substr(xPos+2, resStr.size()-(xPos+2));
Ogre::StringUtil::trim(resYStr);
int resX = boost::lexical_cast<int>(resXStr);
int resY = boost::lexical_cast<int>(resYStr);
if (resX == Settings::Manager::getInt("resolution x", "Video")
&& resY == Settings::Manager::getInt("resolution y", "Video"))
supported = true;
}
if (!supported)
{
std::string msg = "This resolution is not supported in Fullscreen mode. Please select a resolution from the list.";
MWBase::Environment::get().getWindowManager()->
messageBox(msg, std::vector<std::string>());
_sender->castType<MyGUI::Button>()->setCaption(off);
}
else
{
Settings::Manager::setBool("fullscreen", "Video", newState);
apply();
}
}
else if (_sender == mVSyncButton)
{

@ -41,6 +41,7 @@ namespace MWGui
void onButtonToggled(MyGUI::Widget* _sender);
void onResolutionSelected(MyGUI::ListBox* _sender, size_t index);
void onResolutionAccept();
void onResolutionCancel();
void apply();
};

Loading…
Cancel
Save