mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Support "right" alignment in books
This commit is contained in:
parent
a13039ad1f
commit
4829b1f9cc
1 changed files with 11 additions and 1 deletions
|
@ -310,6 +310,8 @@ namespace MWGui
|
||||||
mBlockStyle.mAlign = MyGUI::Align::HCenter;
|
mBlockStyle.mAlign = MyGUI::Align::HCenter;
|
||||||
else if (Misc::StringUtils::ciEqual(align, "left"))
|
else if (Misc::StringUtils::ciEqual(align, "left"))
|
||||||
mBlockStyle.mAlign = MyGUI::Align::Left;
|
mBlockStyle.mAlign = MyGUI::Align::Left;
|
||||||
|
else if (Misc::StringUtils::ciEqual(align, "right"))
|
||||||
|
mBlockStyle.mAlign = MyGUI::Align::Right;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookFormatter::handleFont(const BookTextParser::Attributes & attr)
|
void BookFormatter::handleFont(const BookTextParser::Attributes & attr)
|
||||||
|
@ -424,8 +426,16 @@ namespace MWGui
|
||||||
: GraphicElement(parent, pag, blockStyle),
|
: GraphicElement(parent, pag, blockStyle),
|
||||||
mImageHeight(height)
|
mImageHeight(height)
|
||||||
{
|
{
|
||||||
|
int left = 0;
|
||||||
|
if (mBlockStyle.mAlign.isHCenter())
|
||||||
|
left += (pag.getPageWidth() - width) / 2;
|
||||||
|
else if (mBlockStyle.mAlign.isLeft())
|
||||||
|
left = 0;
|
||||||
|
else if (mBlockStyle.mAlign.isRight())
|
||||||
|
left += pag.getPageWidth() - width;
|
||||||
|
|
||||||
mImageBox = parent->createWidget<MyGUI::ImageBox> ("ImageBox",
|
mImageBox = parent->createWidget<MyGUI::ImageBox> ("ImageBox",
|
||||||
MyGUI::IntCoord(0, pag.getCurrentTop(), width, mImageHeight), mBlockStyle.mAlign | MyGUI::Align::Top,
|
MyGUI::IntCoord(left, pag.getCurrentTop(), width, mImageHeight), MyGUI::Align::Left | MyGUI::Align::Top,
|
||||||
parent->getName() + boost::lexical_cast<std::string>(parent->getChildCount()));
|
parent->getName() + boost::lexical_cast<std::string>(parent->getChildCount()));
|
||||||
|
|
||||||
std::string image = Misc::ResourceHelpers::correctBookartPath(src, width, mImageHeight);
|
std::string image = Misc::ResourceHelpers::correctBookartPath(src, width, mImageHeight);
|
||||||
|
|
Loading…
Reference in a new issue