|
|
|
@ -110,7 +110,7 @@ struct TypesetBookImpl : TypesetBook
|
|
|
|
|
Contents::iterator i = mContents.insert (mContents.end (), Content (text.first, text.second));
|
|
|
|
|
|
|
|
|
|
if (i->empty())
|
|
|
|
|
return Range (Utf8Point (NULL), Utf8Point (NULL));
|
|
|
|
|
return Range (Utf8Point (nullptr), Utf8Point (nullptr));
|
|
|
|
|
|
|
|
|
|
Utf8Point begin = &i->front ();
|
|
|
|
|
Utf8Point end = &i->front () + i->size ();
|
|
|
|
@ -148,7 +148,7 @@ struct TypesetBookImpl : TypesetBook
|
|
|
|
|
template <typename Visitor>
|
|
|
|
|
void visitRuns (int top, int bottom, Visitor const & visitor) const
|
|
|
|
|
{
|
|
|
|
|
visitRuns (top, bottom, NULL, visitor);
|
|
|
|
|
visitRuns (top, bottom, nullptr, visitor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// hit test with a margin for error. only hits on interactive text fragments are reported.
|
|
|
|
@ -176,7 +176,7 @@ struct TypesetBookImpl : TypesetBook
|
|
|
|
|
return hit;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StyleImpl * hitTest (int left, int top) const
|
|
|
|
@ -213,7 +213,7 @@ struct TypesetBookImpl : TypesetBook
|
|
|
|
|
for (Styles::iterator i = mStyles.begin (); i != mStyles.end (); ++i)
|
|
|
|
|
if (&*i == style)
|
|
|
|
|
return i->mFont;
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Typesetter;
|
|
|
|
@ -253,8 +253,8 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|
|
|
|
|
|
|
|
|
Typesetter (size_t width, size_t height) :
|
|
|
|
|
mPageWidth (width), mPageHeight(height),
|
|
|
|
|
mSection (NULL), mLine (NULL), mRun (NULL),
|
|
|
|
|
mCurrentContent (NULL),
|
|
|
|
|
mSection (nullptr), mLine (nullptr), mRun (nullptr),
|
|
|
|
|
mCurrentContent (nullptr),
|
|
|
|
|
mCurrentAlignment (AlignLeft)
|
|
|
|
|
{
|
|
|
|
|
mBook = std::make_shared <Book> ();
|
|
|
|
@ -342,7 +342,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|
|
|
|
|
|
|
|
|
void write (Style * style, size_t begin, size_t end)
|
|
|
|
|
{
|
|
|
|
|
assert (mCurrentContent != NULL);
|
|
|
|
|
assert (mCurrentContent != nullptr);
|
|
|
|
|
assert (end <= mCurrentContent->size ());
|
|
|
|
|
assert (begin <= mCurrentContent->size ());
|
|
|
|
|
|
|
|
|
@ -358,8 +358,8 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|
|
|
|
|
|
|
|
|
add_partial_text();
|
|
|
|
|
|
|
|
|
|
mRun = NULL;
|
|
|
|
|
mLine = NULL;
|
|
|
|
|
mRun = nullptr;
|
|
|
|
|
mLine = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sectionBreak (int margin)
|
|
|
|
@ -368,9 +368,9 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|
|
|
|
|
|
|
|
|
if (mBook->mSections.size () > 0)
|
|
|
|
|
{
|
|
|
|
|
mRun = NULL;
|
|
|
|
|
mLine = NULL;
|
|
|
|
|
mSection = NULL;
|
|
|
|
|
mRun = nullptr;
|
|
|
|
|
mLine = nullptr;
|
|
|
|
|
mSection = nullptr;
|
|
|
|
|
|
|
|
|
|
if (mBook->mRect.bottom < (mBook->mSections.back ().mRect.bottom + margin))
|
|
|
|
|
mBook->mRect.bottom = (mBook->mSections.back ().mRect.bottom + margin);
|
|
|
|
@ -381,7 +381,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|
|
|
|
{
|
|
|
|
|
add_partial_text();
|
|
|
|
|
|
|
|
|
|
if (mSection != NULL)
|
|
|
|
|
if (mSection != nullptr)
|
|
|
|
|
mSectionAlignment.back () = sectionAlignment;
|
|
|
|
|
mCurrentAlignment = sectionAlignment;
|
|
|
|
|
}
|
|
|
|
@ -491,7 +491,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|
|
|
|
{
|
|
|
|
|
add_partial_text();
|
|
|
|
|
stream.consume ();
|
|
|
|
|
mLine = NULL, mRun = NULL;
|
|
|
|
|
mLine = nullptr, mRun = nullptr;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -551,7 +551,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|
|
|
|
|
|
|
|
|
if (left + space_width + word_width > mPageWidth)
|
|
|
|
|
{
|
|
|
|
|
mLine = NULL, mRun = NULL, left = 0;
|
|
|
|
|
mLine = nullptr, mRun = nullptr, left = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -580,7 +580,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|
|
|
|
|
|
|
|
|
void append_run (StyleImpl * style, Utf8Stream::Point begin, Utf8Stream::Point end, int pc, int right, int bottom)
|
|
|
|
|
{
|
|
|
|
|
if (mSection == NULL)
|
|
|
|
|
if (mSection == nullptr)
|
|
|
|
|
{
|
|
|
|
|
mBook->mSections.push_back (Section ());
|
|
|
|
|
mSection = &mBook->mSections.back ();
|
|
|
|
@ -588,7 +588,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|
|
|
|
mSectionAlignment.push_back (mCurrentAlignment);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mLine == NULL)
|
|
|
|
|
if (mLine == nullptr)
|
|
|
|
|
{
|
|
|
|
|
mSection->mLines.push_back (Line ());
|
|
|
|
|
mLine = &mSection->mLines.back ();
|
|
|
|
@ -613,7 +613,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|
|
|
|
if (mLine->mRect.bottom < bottom)
|
|
|
|
|
mLine->mRect.bottom = bottom;
|
|
|
|
|
|
|
|
|
|
if (mRun == NULL || mRun->mStyle != style || mRun->mRange.second != begin)
|
|
|
|
|
if (mRun == nullptr || mRun->mStyle != style || mRun->mRange.second != begin)
|
|
|
|
|
{
|
|
|
|
|
int left = mRun ? mRun->mRight : mLine->mRect.left;
|
|
|
|
|
|
|
|
|
@ -843,17 +843,17 @@ protected:
|
|
|
|
|
TextFormat (MyGUI::IFont* id, PageDisplay * display) :
|
|
|
|
|
mFont (id),
|
|
|
|
|
mCountVertex (0),
|
|
|
|
|
mTexture (NULL),
|
|
|
|
|
mRenderItem (NULL),
|
|
|
|
|
mTexture (nullptr),
|
|
|
|
|
mRenderItem (nullptr),
|
|
|
|
|
mDisplay (display)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void createDrawItem (MyGUI::ILayerNode* node)
|
|
|
|
|
{
|
|
|
|
|
assert (mRenderItem == NULL);
|
|
|
|
|
assert (mRenderItem == nullptr);
|
|
|
|
|
|
|
|
|
|
if (mTexture != NULL)
|
|
|
|
|
if (mTexture != nullptr)
|
|
|
|
|
{
|
|
|
|
|
mRenderItem = node->addToRenderItem(mTexture, false, false);
|
|
|
|
|
mRenderItem->addDrawItem(this, mCountVertex);
|
|
|
|
@ -862,12 +862,12 @@ protected:
|
|
|
|
|
|
|
|
|
|
void destroyDrawItem (MyGUI::ILayerNode* node)
|
|
|
|
|
{
|
|
|
|
|
assert (mTexture != NULL ? mRenderItem != NULL : mRenderItem == NULL);
|
|
|
|
|
assert (mTexture != nullptr ? mRenderItem != nullptr : mRenderItem == nullptr);
|
|
|
|
|
|
|
|
|
|
if (mTexture != NULL)
|
|
|
|
|
if (mTexture != nullptr)
|
|
|
|
|
{
|
|
|
|
|
mRenderItem->removeDrawItem (this);
|
|
|
|
|
mRenderItem = NULL;
|
|
|
|
|
mRenderItem = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -920,9 +920,9 @@ public:
|
|
|
|
|
resetPage ();
|
|
|
|
|
mViewTop = 0;
|
|
|
|
|
mViewBottom = 0;
|
|
|
|
|
mFocusItem = NULL;
|
|
|
|
|
mFocusItem = nullptr;
|
|
|
|
|
mItemActive = false;
|
|
|
|
|
mNode = NULL;
|
|
|
|
|
mNode = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void dirtyFocusItem ()
|
|
|
|
@ -1053,7 +1053,7 @@ public:
|
|
|
|
|
|
|
|
|
|
for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (mNode != NULL)
|
|
|
|
|
if (mNode != nullptr)
|
|
|
|
|
i->second->destroyDrawItem (mNode);
|
|
|
|
|
i->second.reset();
|
|
|
|
|
}
|
|
|
|
@ -1089,7 +1089,7 @@ public:
|
|
|
|
|
else
|
|
|
|
|
if (mBook && isPageDifferent (newPage))
|
|
|
|
|
{
|
|
|
|
|
if (mNode != NULL)
|
|
|
|
|
if (mNode != nullptr)
|
|
|
|
|
for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i)
|
|
|
|
|
mNode->outOfDate(i->second->mRenderItem);
|
|
|
|
|
|
|
|
|
@ -1137,7 +1137,7 @@ public:
|
|
|
|
|
{
|
|
|
|
|
newBook->visitRuns (0, 0x7FFFFFFF, CreateActiveFormat (this));
|
|
|
|
|
|
|
|
|
|
if (mNode != NULL)
|
|
|
|
|
if (mNode != nullptr)
|
|
|
|
|
for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i)
|
|
|
|
|
i->second->createDrawItem (mNode);
|
|
|
|
|
}
|
|
|
|
@ -1238,7 +1238,7 @@ public:
|
|
|
|
|
{
|
|
|
|
|
_checkMargin();
|
|
|
|
|
|
|
|
|
|
if (mNode != NULL)
|
|
|
|
|
if (mNode != nullptr)
|
|
|
|
|
for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i)
|
|
|
|
|
mNode->outOfDate (i->second->mRenderItem);
|
|
|
|
|
}
|
|
|
|
@ -1247,7 +1247,7 @@ public:
|
|
|
|
|
{
|
|
|
|
|
_checkMargin ();
|
|
|
|
|
|
|
|
|
|
if (mNode != NULL)
|
|
|
|
|
if (mNode != nullptr)
|
|
|
|
|
for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i)
|
|
|
|
|
mNode->outOfDate (i->second->mRenderItem);
|
|
|
|
|
|
|
|
|
@ -1258,7 +1258,7 @@ public:
|
|
|
|
|
for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i)
|
|
|
|
|
i->second->destroyDrawItem (mNode);
|
|
|
|
|
|
|
|
|
|
mNode = NULL;
|
|
|
|
|
mNode = nullptr;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -1269,7 +1269,7 @@ MYGUI_RTTI_DERIVED(BookPage)
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
BookPageImpl()
|
|
|
|
|
: mPageDisplay(NULL)
|
|
|
|
|
: mPageDisplay(nullptr)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|