|
|
|
@ -193,6 +193,9 @@ namespace MWGui
|
|
|
|
|
MyGUI::Gui::getInstance().destroyWidget(parent->getChildAt(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mTextStyle = TextStyle();
|
|
|
|
|
mBlockStyle = BlockStyle();
|
|
|
|
|
|
|
|
|
|
MyGUI::Widget * paper = parent->createWidget<MyGUI::Widget>("Widget", MyGUI::IntCoord(0, 0, pag.getPageWidth(), pag.getPageHeight()), MyGUI::Align::Left | MyGUI::Align::Top);
|
|
|
|
|
paper->setNeedMouseFocus(false);
|
|
|
|
|
|
|
|
|
@ -207,8 +210,25 @@ namespace MWGui
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
std::string plainText = parser.getReadyText();
|
|
|
|
|
|
|
|
|
|
// for cases when linebreaks are used to cause a shift to the next page
|
|
|
|
|
// if the split text block ends in an empty line, proceeding text block(s) should have leading empty lines removed
|
|
|
|
|
if (pag.getIgnoreLeadingEmptyLines())
|
|
|
|
|
{
|
|
|
|
|
while (!plainText.empty())
|
|
|
|
|
{
|
|
|
|
|
if (plainText[0] == '\n')
|
|
|
|
|
plainText.erase(plainText.begin());
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pag.setIgnoreLeadingEmptyLines(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (plainText.empty())
|
|
|
|
|
brBeforeLastTag = false;
|
|
|
|
|
brBeforeLastTag = true;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Each block of text (between two tags / boundary and tag) will be displayed in a separate editbox widget,
|
|
|
|
@ -252,6 +272,8 @@ namespace MWGui
|
|
|
|
|
{
|
|
|
|
|
case BookTextParser::Event_ImgTag:
|
|
|
|
|
{
|
|
|
|
|
pag.setIgnoreLeadingEmptyLines(false);
|
|
|
|
|
|
|
|
|
|
const BookTextParser::Attributes & attr = parser.getAttributes();
|
|
|
|
|
|
|
|
|
|
if (attr.find("src") == attr.end() || attr.find("width") == attr.end() || attr.find("height") == attr.end())
|
|
|
|
@ -331,9 +353,7 @@ namespace MWGui
|
|
|
|
|
if (attr.find("face") != attr.end())
|
|
|
|
|
{
|
|
|
|
|
std::string face = attr.at("face");
|
|
|
|
|
|
|
|
|
|
if (face != "Magic Cards")
|
|
|
|
|
mTextStyle.mFont = face;
|
|
|
|
|
mTextStyle.mFont = face;
|
|
|
|
|
}
|
|
|
|
|
if (attr.find("size") != attr.end())
|
|
|
|
|
{
|
|
|
|
@ -408,13 +428,18 @@ namespace MWGui
|
|
|
|
|
// first empty lines that would go to the next page should be ignored
|
|
|
|
|
// unfortunately, getLineInfo method won't be available until 3.2.2
|
|
|
|
|
#if (MYGUI_VERSION >= MYGUI_DEFINE_VERSION(3, 2, 2))
|
|
|
|
|
mPaginator.setIgnoreLeadingEmptyLines(true);
|
|
|
|
|
|
|
|
|
|
const MyGUI::VectorLineInfo & lines = mEditBox->getSubWidgetText()->castType<MyGUI::EditText>()->getLineInfo();
|
|
|
|
|
for (unsigned int i = lastLine; i < lines.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (lines[i].width == 0)
|
|
|
|
|
ret += lineHeight;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mPaginator.setIgnoreLeadingEmptyLines(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return ret;
|
|
|
|
|