mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-23 16:40:08 +00:00
Fix journal for not installed tribunal (Options button should become Topics). Don't log an error when optional journal buttons (Tribunal) are not found.
This commit is contained in:
parent
bf5529819d
commit
9e2b1942fc
3 changed files with 24 additions and 10 deletions
|
@ -42,12 +42,13 @@ namespace MWGui
|
||||||
ImageBox::onMouseButtonPressed(_left, _top, _id);
|
ImageBox::onMouseButtonPressed(_left, _top, _id);
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::IntSize ImageButton::getRequestedSize()
|
MyGUI::IntSize ImageButton::getRequestedSize(bool logError)
|
||||||
{
|
{
|
||||||
Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().getByName(mImageNormal);
|
Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().getByName(mImageNormal);
|
||||||
if (texture.isNull())
|
if (texture.isNull())
|
||||||
{
|
{
|
||||||
std::cerr << "ImageButton: can't find " << mImageNormal << std::endl;
|
if (logError)
|
||||||
|
std::cerr << "ImageButton: can't find " << mImageNormal << std::endl;
|
||||||
return MyGUI::IntSize(0,0);
|
return MyGUI::IntSize(0,0);
|
||||||
}
|
}
|
||||||
return MyGUI::IntSize (texture->getWidth(), texture->getHeight());
|
return MyGUI::IntSize (texture->getWidth(), texture->getHeight());
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace MWGui
|
||||||
MYGUI_RTTI_DERIVED(ImageButton)
|
MYGUI_RTTI_DERIVED(ImageButton)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyGUI::IntSize getRequestedSize();
|
MyGUI::IntSize getRequestedSize(bool logError = true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
|
virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
|
||||||
|
|
|
@ -137,15 +137,28 @@ namespace
|
||||||
getPage (QuestsPage)->adviseLinkClicked (callback);
|
getPage (QuestsPage)->adviseLinkClicked (callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustButton(OptionsBTN);
|
adjustButton(OptionsBTN, true);
|
||||||
adjustButton(PrevPageBTN);
|
adjustButton(PrevPageBTN);
|
||||||
adjustButton(NextPageBTN);
|
adjustButton(NextPageBTN);
|
||||||
adjustButton(CloseBTN);
|
adjustButton(CloseBTN);
|
||||||
adjustButton(CancelBTN);
|
adjustButton(CancelBTN);
|
||||||
adjustButton(ShowAllBTN);
|
adjustButton(ShowAllBTN, true);
|
||||||
adjustButton(ShowActiveBTN);
|
adjustButton(ShowActiveBTN, true);
|
||||||
adjustButton(JournalBTN);
|
adjustButton(JournalBTN);
|
||||||
|
|
||||||
|
MWGui::ImageButton* optionsButton = getWidget<MWGui::ImageButton>(OptionsBTN);
|
||||||
|
if (optionsButton->getWidth() == 0)
|
||||||
|
{
|
||||||
|
// If tribunal is not installed (-> no options button), we still want the Topics button available,
|
||||||
|
// so place it where the options button would have been
|
||||||
|
MWGui::ImageButton* topicsButton = getWidget<MWGui::ImageButton>(TopicsBTN);
|
||||||
|
topicsButton->detachFromWidget();
|
||||||
|
topicsButton->attachToWidget(optionsButton->getParent());
|
||||||
|
topicsButton->setPosition(optionsButton->getPosition());
|
||||||
|
topicsButton->eventMouseButtonClick.clear();
|
||||||
|
topicsButton->eventMouseButtonClick += MyGUI::newDelegate(this, &JournalWindowImpl::notifyOptions);
|
||||||
|
}
|
||||||
|
|
||||||
MWGui::ImageButton* nextButton = getWidget<MWGui::ImageButton>(NextPageBTN);
|
MWGui::ImageButton* nextButton = getWidget<MWGui::ImageButton>(NextPageBTN);
|
||||||
if (nextButton->getSize().width == 64)
|
if (nextButton->getSize().width == 64)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +168,7 @@ namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustButton(TopicsBTN);
|
adjustButton(TopicsBTN);
|
||||||
adjustButton(QuestsBTN);
|
adjustButton(QuestsBTN, true);
|
||||||
int width = getWidget<MyGUI::Widget>(TopicsBTN)->getSize().width + getWidget<MyGUI::Widget>(QuestsBTN)->getSize().width;
|
int width = getWidget<MyGUI::Widget>(TopicsBTN)->getSize().width + getWidget<MyGUI::Widget>(QuestsBTN)->getSize().width;
|
||||||
int topicsWidth = getWidget<MyGUI::Widget>(TopicsBTN)->getSize().width;
|
int topicsWidth = getWidget<MyGUI::Widget>(TopicsBTN)->getSize().width;
|
||||||
int pageWidth = getWidget<MyGUI::Widget>(RightBookPage)->getSize().width;
|
int pageWidth = getWidget<MyGUI::Widget>(RightBookPage)->getSize().width;
|
||||||
|
@ -167,12 +180,12 @@ namespace
|
||||||
mAllQuests = false;
|
mAllQuests = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void adjustButton (char const * name)
|
void adjustButton (char const * name, bool optional = false)
|
||||||
{
|
{
|
||||||
MWGui::ImageButton* button = getWidget<MWGui::ImageButton>(name);
|
MWGui::ImageButton* button = getWidget<MWGui::ImageButton>(name);
|
||||||
|
|
||||||
MyGUI::IntSize diff = button->getSize() - button->getRequestedSize();
|
MyGUI::IntSize diff = button->getSize() - button->getRequestedSize(!optional);
|
||||||
button->setSize(button->getRequestedSize());
|
button->setSize(button->getRequestedSize(!optional));
|
||||||
|
|
||||||
if (button->getAlign().isRight())
|
if (button->getAlign().isRight())
|
||||||
button->setPosition(button->getPosition() + MyGUI::IntPoint(diff.width,0));
|
button->setPosition(button->getPosition() + MyGUI::IntPoint(diff.width,0));
|
||||||
|
|
Loading…
Reference in a new issue