forked from mirror/openmw-tes3mp
Removed using namespace
This commit is contained in:
parent
757a26794a
commit
b5071ced23
4 changed files with 132 additions and 130 deletions
|
@ -15,13 +15,9 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
struct TypesetBookImpl;
|
||||
struct PageDisplay;
|
||||
struct BookPageImpl;
|
||||
}
|
||||
|
||||
using namespace MyGUI;
|
||||
using namespace MWGui;
|
||||
struct TypesetBookImpl;
|
||||
struct PageDisplay;
|
||||
struct BookPageImpl;
|
||||
|
||||
static bool ucsSpace (int codePoint);
|
||||
static bool ucsLineBreak (int codePoint);
|
||||
|
@ -29,7 +25,7 @@ static bool ucsBreakingSpace (int codePoint);
|
|||
|
||||
struct BookTypesetter::Style { virtual ~Style () {} };
|
||||
|
||||
struct MWGui::TypesetBookImpl : TypesetBook
|
||||
struct TypesetBookImpl : TypesetBook
|
||||
{
|
||||
typedef std::vector <uint8_t> Content;
|
||||
typedef std::list <Content> Contents;
|
||||
|
@ -38,25 +34,28 @@ struct MWGui::TypesetBookImpl : TypesetBook
|
|||
|
||||
struct StyleImpl : BookTypesetter::Style
|
||||
{
|
||||
IFont* mFont;
|
||||
Colour mHotColour;
|
||||
Colour mActiveColour;
|
||||
Colour mNormalColour;
|
||||
MyGUI::IFont* mFont;
|
||||
MyGUI::Colour mHotColour;
|
||||
MyGUI::Colour mActiveColour;
|
||||
MyGUI::Colour mNormalColour;
|
||||
InteractiveId mInteractiveId;
|
||||
|
||||
bool match (IFont* tstFont, Colour tstHotColour, Colour tstActiveColour, Colour tstNormalColour, intptr_t tstInteractiveId)
|
||||
bool match (MyGUI::IFont* tstFont, MyGUI::Colour tstHotColour, MyGUI::Colour tstActiveColour,
|
||||
MyGUI::Colour tstNormalColour, intptr_t tstInteractiveId)
|
||||
{
|
||||
return (mFont == tstFont) &&
|
||||
partal_match (tstHotColour, tstActiveColour, tstNormalColour, tstInteractiveId);
|
||||
}
|
||||
|
||||
bool match (char const * tstFont, Colour tstHotColour, Colour tstActiveColour, Colour tstNormalColour, intptr_t tstInteractiveId)
|
||||
bool match (char const * tstFont, MyGUI::Colour tstHotColour, MyGUI::Colour tstActiveColour,
|
||||
MyGUI::Colour tstNormalColour, intptr_t tstInteractiveId)
|
||||
{
|
||||
return (mFont->getResourceName () == tstFont) &&
|
||||
partal_match (tstHotColour, tstActiveColour, tstNormalColour, tstInteractiveId);
|
||||
}
|
||||
|
||||
bool partal_match (Colour tstHotColour, Colour tstActiveColour, Colour tstNormalColour, intptr_t tstInteractiveId)
|
||||
bool partal_match (MyGUI::Colour tstHotColour, MyGUI::Colour tstActiveColour,
|
||||
MyGUI::Colour tstNormalColour, intptr_t tstInteractiveId)
|
||||
{
|
||||
return
|
||||
(mHotColour == tstHotColour ) &&
|
||||
|
@ -81,7 +80,7 @@ struct MWGui::TypesetBookImpl : TypesetBook
|
|||
struct Line
|
||||
{
|
||||
Runs mRuns;
|
||||
IntRect mRect;
|
||||
MyGUI::IntRect mRect;
|
||||
};
|
||||
|
||||
typedef std::vector <Line> Lines;
|
||||
|
@ -89,7 +88,7 @@ struct MWGui::TypesetBookImpl : TypesetBook
|
|||
struct Section
|
||||
{
|
||||
Lines mLines;
|
||||
IntRect mRect;
|
||||
MyGUI::IntRect mRect;
|
||||
};
|
||||
|
||||
typedef std::vector <Section> Sections;
|
||||
|
@ -101,7 +100,7 @@ struct MWGui::TypesetBookImpl : TypesetBook
|
|||
Sections mSections;
|
||||
Contents mContents;
|
||||
Styles mStyles;
|
||||
IntRect mRect;
|
||||
MyGUI::IntRect mRect;
|
||||
|
||||
virtual ~TypesetBookImpl () {}
|
||||
|
||||
|
@ -126,7 +125,7 @@ struct MWGui::TypesetBookImpl : TypesetBook
|
|||
}
|
||||
|
||||
template <typename Visitor>
|
||||
void visitRuns (int top, int bottom, IFont* Font, Visitor const & visitor) const
|
||||
void visitRuns (int top, int bottom, MyGUI::IFont* Font, Visitor const & visitor) const
|
||||
{
|
||||
for (Sections::const_iterator i = mSections.begin (); i != mSections.end (); ++i)
|
||||
{
|
||||
|
@ -180,7 +179,7 @@ struct MWGui::TypesetBookImpl : TypesetBook
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
IFont* affectedFont (StyleImpl* style)
|
||||
MyGUI::IFont* affectedFont (StyleImpl* style)
|
||||
{
|
||||
for (Styles::iterator i = mStyles.begin (); i != mStyles.end (); ++i)
|
||||
if (&*i == style)
|
||||
|
@ -230,7 +229,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
|
||||
StyleImpl & style = *mBook->mStyles.insert (mBook->mStyles.end (), StyleImpl ());
|
||||
|
||||
style.mFont = FontManager::getInstance().getByName(fontName);
|
||||
style.mFont = MyGUI::FontManager::getInstance().getByName(fontName);
|
||||
style.mHotColour = fontColour;
|
||||
style.mActiveColour = fontColour;
|
||||
style.mNormalColour = fontColour;
|
||||
|
@ -405,7 +404,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
|
||||
while (!stream.eof () && !ucsLineBreak (stream.peek ()) && ucsBreakingSpace (stream.peek ()))
|
||||
{
|
||||
GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
|
||||
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
|
||||
space_width += gi->advance;
|
||||
stream.consume ();
|
||||
}
|
||||
|
@ -414,7 +413,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
|
||||
while (!stream.eof () && !ucsLineBreak (stream.peek ()) && !ucsBreakingSpace (stream.peek ()))
|
||||
{
|
||||
GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
|
||||
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
|
||||
word_width += gi->advance + gi->bearingX;
|
||||
word_height = line_height;
|
||||
++character_count;
|
||||
|
@ -449,7 +448,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
{
|
||||
mBook->mSections.push_back (Section ());
|
||||
mSection = &mBook->mSections.back ();
|
||||
mSection->mRect = IntRect (0, mBook->mRect.bottom, 0, mBook->mRect.bottom);
|
||||
mSection->mRect = MyGUI::IntRect (0, mBook->mRect.bottom, 0, mBook->mRect.bottom);
|
||||
mSectionAlignment.push_back (mCurrentAlignment);
|
||||
}
|
||||
|
||||
|
@ -457,7 +456,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
{
|
||||
mSection->mLines.push_back (Line ());
|
||||
mLine = &mSection->mLines.back ();
|
||||
mLine->mRect = IntRect (0, mSection->mRect.bottom, 0, mBook->mRect.bottom);
|
||||
mLine->mRect = MyGUI::IntRect (0, mSection->mRect.bottom, 0, mBook->mRect.bottom);
|
||||
}
|
||||
|
||||
if (mBook->mRect.right < right)
|
||||
|
@ -527,7 +526,7 @@ namespace
|
|||
float hOffset;
|
||||
float vOffset;
|
||||
|
||||
RenderXform (ICroppedRectangle* croppedParent, RenderTargetInfo const & renderTargetInfo)
|
||||
RenderXform (MyGUI::ICroppedRectangle* croppedParent, MyGUI::RenderTargetInfo const & renderTargetInfo)
|
||||
{
|
||||
clipTop = croppedParent->_getMarginTop ();
|
||||
clipLeft = croppedParent->_getMarginLeft ();
|
||||
|
@ -545,7 +544,7 @@ namespace
|
|||
vOffset = renderTargetInfo.vOffset;
|
||||
}
|
||||
|
||||
bool clip (FloatRect & vr, FloatRect & tr)
|
||||
bool clip (MyGUI::FloatRect & vr, MyGUI::FloatRect & tr)
|
||||
{
|
||||
if (vr.bottom <= clipTop || vr.right <= clipLeft ||
|
||||
vr.left >= clipRight || vr.top >= clipBottom )
|
||||
|
@ -578,7 +577,7 @@ namespace
|
|||
return true;
|
||||
}
|
||||
|
||||
FloatPoint operator () (FloatPoint pt)
|
||||
MyGUI::FloatPoint operator () (MyGUI::FloatPoint pt)
|
||||
{
|
||||
pt.left = absoluteLeft - leftOffset + pt.left;
|
||||
pt.top = absoluteTop - topOffset + pt.top;
|
||||
|
@ -594,32 +593,32 @@ namespace
|
|||
{
|
||||
float mZ;
|
||||
uint32_t mC;
|
||||
IFont* mFont;
|
||||
FloatPoint mOrigin;
|
||||
FloatPoint mCursor;
|
||||
Vertex* mVertices;
|
||||
MyGUI::IFont* mFont;
|
||||
MyGUI::FloatPoint mOrigin;
|
||||
MyGUI::FloatPoint mCursor;
|
||||
MyGUI::Vertex* mVertices;
|
||||
RenderXform mRenderXform;
|
||||
MyGUI::VertexColourType mVertexColourType;
|
||||
|
||||
GlyphStream (IFont* font, float left, float top, float Z,
|
||||
Vertex* vertices, RenderXform const & renderXform) :
|
||||
GlyphStream (MyGUI::IFont* font, float left, float top, float Z,
|
||||
MyGUI::Vertex* vertices, RenderXform const & renderXform) :
|
||||
mZ(Z), mOrigin (left, top),
|
||||
mFont (font), mVertices (vertices),
|
||||
mRenderXform (renderXform)
|
||||
{
|
||||
mVertexColourType = RenderManager::getInstance().getVertexFormat();
|
||||
mVertexColourType = MyGUI::RenderManager::getInstance().getVertexFormat();
|
||||
}
|
||||
|
||||
~GlyphStream ()
|
||||
{
|
||||
}
|
||||
|
||||
Vertex* end () const { return mVertices; }
|
||||
MyGUI::Vertex* end () const { return mVertices; }
|
||||
|
||||
void reset (float left, float top, Colour colour)
|
||||
void reset (float left, float top, MyGUI::Colour colour)
|
||||
{
|
||||
mC = texture_utility::toColourARGB(colour) | 0xFF000000;
|
||||
texture_utility::convertColour(mC, mVertexColourType);
|
||||
mC = MyGUI::texture_utility::toColourARGB(colour) | 0xFF000000;
|
||||
MyGUI::texture_utility::convertColour(mC, mVertexColourType);
|
||||
|
||||
mCursor.left = mOrigin.left + left;
|
||||
mCursor.top = mOrigin.top + top;
|
||||
|
@ -627,16 +626,16 @@ namespace
|
|||
|
||||
void emitGlyph (wchar_t ch)
|
||||
{
|
||||
GlyphInfo* gi = mFont->getGlyphInfo (ch);
|
||||
MyGUI::GlyphInfo* gi = mFont->getGlyphInfo (ch);
|
||||
|
||||
FloatRect vr;
|
||||
MyGUI::FloatRect vr;
|
||||
|
||||
vr.left = mCursor.left + gi->bearingX;
|
||||
vr.top = mCursor.top + gi->bearingY;
|
||||
vr.right = vr.left + gi->width;
|
||||
vr.bottom = vr.top + gi->height;
|
||||
|
||||
FloatRect tr = gi->uvRect;
|
||||
MyGUI::FloatRect tr = gi->uvRect;
|
||||
|
||||
if (mRenderXform.clip (vr, tr))
|
||||
quad (vr, tr);
|
||||
|
@ -646,14 +645,14 @@ namespace
|
|||
|
||||
void emitSpace (wchar_t ch)
|
||||
{
|
||||
GlyphInfo* gi = mFont->getGlyphInfo (ch);
|
||||
MyGUI::GlyphInfo* gi = mFont->getGlyphInfo (ch);
|
||||
|
||||
mCursor.left += gi->bearingX + gi->advance;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void quad (const FloatRect& vr, const FloatRect& tr)
|
||||
void quad (const MyGUI::FloatRect& vr, const MyGUI::FloatRect& tr)
|
||||
{
|
||||
vertex (vr.left, vr.top, tr.left, tr.top);
|
||||
vertex (vr.right, vr.top, tr.right, tr.top);
|
||||
|
@ -665,7 +664,7 @@ namespace
|
|||
|
||||
void vertex (float x, float y, float u, float v)
|
||||
{
|
||||
FloatPoint pt = mRenderXform (FloatPoint (x, y));
|
||||
MyGUI::FloatPoint pt = mRenderXform (MyGUI::FloatPoint (x, y));
|
||||
|
||||
mVertices->x = pt.left;
|
||||
mVertices->y = pt.top ;
|
||||
|
@ -679,7 +678,7 @@ namespace
|
|||
};
|
||||
}
|
||||
|
||||
class MWGui::PageDisplay : public ISubWidgetText
|
||||
class PageDisplay : public MyGUI::ISubWidgetText
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(PageDisplay)
|
||||
protected:
|
||||
|
@ -690,15 +689,15 @@ protected:
|
|||
|
||||
struct TextFormat : ISubWidget
|
||||
{
|
||||
typedef IFont* Id;
|
||||
typedef MyGUI::IFont* Id;
|
||||
|
||||
Id mFont;
|
||||
int mCountVertex;
|
||||
ITexture* mTexture;
|
||||
RenderItem* mRenderItem;
|
||||
MyGUI::ITexture* mTexture;
|
||||
MyGUI::RenderItem* mRenderItem;
|
||||
PageDisplay * mDisplay;
|
||||
|
||||
TextFormat (IFont* id, PageDisplay * display) :
|
||||
TextFormat (MyGUI::IFont* id, PageDisplay * display) :
|
||||
mFont (id),
|
||||
mTexture (NULL),
|
||||
mRenderItem (NULL),
|
||||
|
@ -707,7 +706,7 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
void createDrawItem (ILayerNode* node)
|
||||
void createDrawItem (MyGUI::ILayerNode* node)
|
||||
{
|
||||
assert (mRenderItem == NULL);
|
||||
|
||||
|
@ -718,7 +717,7 @@ protected:
|
|||
}
|
||||
}
|
||||
|
||||
void destroyDrawItem (ILayerNode* node)
|
||||
void destroyDrawItem (MyGUI::ILayerNode* node)
|
||||
{
|
||||
assert (mTexture != NULL ? mRenderItem != NULL : mRenderItem == NULL);
|
||||
|
||||
|
@ -733,7 +732,7 @@ protected:
|
|||
|
||||
// this isn't really a sub-widget, its just a "drawitem" which
|
||||
// should have its own interface
|
||||
void createDrawItem(ITexture* _texture, ILayerNode* _node) {}
|
||||
void createDrawItem(MyGUI::ITexture* _texture, MyGUI::ILayerNode* _node) {}
|
||||
void destroyDrawItem() {};
|
||||
};
|
||||
|
||||
|
@ -747,14 +746,14 @@ public:
|
|||
|
||||
Style* mFocusItem;
|
||||
bool mItemActive;
|
||||
MouseButton mLastDown;
|
||||
MyGUI::MouseButton mLastDown;
|
||||
boost::function <void (intptr_t)> mLinkClicked;
|
||||
|
||||
|
||||
boost::shared_ptr <TypesetBookImpl> mBook;
|
||||
size_t mPage;
|
||||
|
||||
ILayerNode* mNode;
|
||||
MyGUI::ILayerNode* mNode;
|
||||
ActiveTextFormats mActiveTextFormats;
|
||||
|
||||
PageDisplay ()
|
||||
|
@ -766,7 +765,7 @@ public:
|
|||
{
|
||||
if (mFocusItem != 0)
|
||||
{
|
||||
IFont* Font = mBook->affectedFont (mFocusItem);
|
||||
MyGUI::IFont* Font = mBook->affectedFont (mFocusItem);
|
||||
|
||||
ActiveTextFormats::iterator i = mActiveTextFormats.find (Font);
|
||||
|
||||
|
@ -795,7 +794,7 @@ public:
|
|||
|
||||
Style * Hit = mBook->hitTest (left, mViewTop + top);
|
||||
|
||||
if (mLastDown == MouseButton::None)
|
||||
if (mLastDown == MyGUI::MouseButton::None)
|
||||
{
|
||||
if (Hit != mFocusItem)
|
||||
{
|
||||
|
@ -821,7 +820,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void onMouseButtonPressed (int left, int top, MouseButton id)
|
||||
void onMouseButtonPressed (int left, int top, MyGUI::MouseButton id)
|
||||
{
|
||||
if (!mBook)
|
||||
return;
|
||||
|
@ -829,7 +828,7 @@ public:
|
|||
left -= mCroppedParent->getAbsoluteLeft ();
|
||||
top -= mCroppedParent->getAbsoluteTop ();
|
||||
|
||||
if (mLastDown == MouseButton::None)
|
||||
if (mLastDown == MyGUI::MouseButton::None)
|
||||
{
|
||||
mFocusItem = mBook->hitTest (left, mViewTop + top);
|
||||
mItemActive = true;
|
||||
|
@ -840,7 +839,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void onMouseButtonReleased(int left, int top, MouseButton id)
|
||||
void onMouseButtonReleased(int left, int top, MyGUI::MouseButton id)
|
||||
{
|
||||
if (!mBook)
|
||||
return;
|
||||
|
@ -858,7 +857,7 @@ public:
|
|||
|
||||
dirtyFocusItem ();
|
||||
|
||||
mLastDown = MouseButton::None;
|
||||
mLastDown = MyGUI::MouseButton::None;
|
||||
|
||||
if (clicked && mLinkClicked && mItem && mItem->mInteractiveId != 0)
|
||||
mLinkClicked (mItem->mInteractiveId);
|
||||
|
@ -939,7 +938,7 @@ public:
|
|||
|
||||
void operator () (Section const & section, Line const & line, Run const & run) const
|
||||
{
|
||||
IFont* Font = run.mStyle->mFont;
|
||||
MyGUI::IFont* Font = run.mStyle->mFont;
|
||||
|
||||
ActiveTextFormats::iterator j = this_->mActiveTextFormats.find (Font);
|
||||
|
||||
|
@ -975,7 +974,7 @@ public:
|
|||
if (mVisible)
|
||||
{
|
||||
// reset input state
|
||||
mLastDown = MouseButton::None;
|
||||
mLastDown = MyGUI::MouseButton::None;
|
||||
mFocusItem = nullptr;
|
||||
mItemActive = 0;
|
||||
}
|
||||
|
@ -987,7 +986,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void createDrawItem(ITexture* texture, ILayerNode* node)
|
||||
void createDrawItem(MyGUI::ITexture* texture, MyGUI::ILayerNode* node)
|
||||
{
|
||||
//test ();
|
||||
|
||||
|
@ -1011,7 +1010,7 @@ public:
|
|||
{
|
||||
bool isActive = run.mStyle->mInteractiveId && (run.mStyle == this_->mFocusItem);
|
||||
|
||||
Colour colour = isActive ? (this_->mItemActive ? run.mStyle->mActiveColour: run.mStyle->mHotColour) : run.mStyle->mNormalColour;
|
||||
MyGUI::Colour colour = isActive ? (this_->mItemActive ? run.mStyle->mActiveColour: run.mStyle->mHotColour) : run.mStyle->mNormalColour;
|
||||
|
||||
glyphStream.reset (section.mRect.left + line.mRect.left + run.mLeft, line.mRect.top, colour);
|
||||
|
||||
|
@ -1037,7 +1036,7 @@ public:
|
|||
if (!mVisible)
|
||||
return;
|
||||
|
||||
Vertex* vertices = textFormat.mRenderItem->getCurrentVertexBuffer();
|
||||
MyGUI::Vertex* vertices = textFormat.mRenderItem->getCurrentVertexBuffer();
|
||||
|
||||
RenderXform renderXform (mCroppedParent, textFormat.mRenderItem->getRenderTarget()->getInfo());
|
||||
|
||||
|
@ -1080,7 +1079,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class MWGui::BookPageImpl : public BookPage
|
||||
class BookPageImpl : public BookPage
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(BookPage)
|
||||
public:
|
||||
|
@ -1131,7 +1130,7 @@ protected:
|
|||
Widget::onMouseMove (left, top);
|
||||
}
|
||||
|
||||
void onMouseButtonPressed (int left, int top, MouseButton id)
|
||||
void onMouseButtonPressed (int left, int top, MyGUI::MouseButton id)
|
||||
{
|
||||
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
||||
{
|
||||
|
@ -1141,7 +1140,7 @@ protected:
|
|||
Widget::onMouseButtonPressed (left, top, id);
|
||||
}
|
||||
|
||||
void onMouseButtonReleased(int left, int top, MouseButton id)
|
||||
void onMouseButtonReleased(int left, int top, MyGUI::MouseButton id)
|
||||
{
|
||||
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
||||
{
|
||||
|
@ -1154,7 +1153,7 @@ protected:
|
|||
|
||||
void BookPage::registerMyGUIComponents ()
|
||||
{
|
||||
FactoryManager & factory = FactoryManager::getInstance();
|
||||
MyGUI::FactoryManager & factory = MyGUI::FactoryManager::getInstance();
|
||||
|
||||
factory.registerFactory<BookPageImpl>("Widget");
|
||||
factory.registerFactory<PageDisplay>("BasisSkin");
|
||||
|
@ -1224,3 +1223,5 @@ static bool ucsBreakingSpace (int codePoint)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
#include "journalbooks.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
namespace
|
||||
{
|
||||
BookTypesetter::Utf8Span to_utf8_span (char const * text)
|
||||
MWGui::BookTypesetter::Utf8Span to_utf8_span (char const * text)
|
||||
{
|
||||
typedef BookTypesetter::Utf8Point point;
|
||||
typedef MWGui::BookTypesetter::Utf8Point point;
|
||||
|
||||
point begin = reinterpret_cast <point> (text);
|
||||
|
||||
return BookTypesetter::Utf8Span (begin, begin + strlen (text));
|
||||
return MWGui::BookTypesetter::Utf8Span (begin, begin + strlen (text));
|
||||
}
|
||||
|
||||
const MyGUI::Colour linkHot (0.40f, 0.40f, 0.80f);
|
||||
|
@ -19,10 +17,10 @@ namespace
|
|||
|
||||
struct AddContent
|
||||
{
|
||||
BookTypesetter::Ptr mTypesetter;
|
||||
BookTypesetter::Style* mBodyStyle;
|
||||
MWGui::BookTypesetter::Ptr mTypesetter;
|
||||
MWGui::BookTypesetter::Style* mBodyStyle;
|
||||
|
||||
AddContent (BookTypesetter::Ptr typesetter, BookTypesetter::Style* body_style) :
|
||||
AddContent (MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* body_style) :
|
||||
mTypesetter (typesetter), mBodyStyle (body_style)
|
||||
{
|
||||
}
|
||||
|
@ -30,14 +28,14 @@ namespace
|
|||
|
||||
struct AddSpan : AddContent
|
||||
{
|
||||
AddSpan (BookTypesetter::Ptr typesetter, BookTypesetter::Style* body_style) :
|
||||
AddSpan (MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* body_style) :
|
||||
AddContent (typesetter, body_style)
|
||||
{
|
||||
}
|
||||
|
||||
void operator () (intptr_t topicId, size_t begin, size_t end)
|
||||
{
|
||||
BookTypesetter::Style* style = mBodyStyle;
|
||||
MWGui::BookTypesetter::Style* style = mBodyStyle;
|
||||
|
||||
if (topicId)
|
||||
style = mTypesetter->createHotStyle (mBodyStyle, linkNormal, linkHot, linkActive, topicId);
|
||||
|
@ -48,15 +46,15 @@ namespace
|
|||
|
||||
struct AddEntry
|
||||
{
|
||||
BookTypesetter::Ptr mTypesetter;
|
||||
BookTypesetter::Style* mBodyStyle;
|
||||
MWGui::BookTypesetter::Ptr mTypesetter;
|
||||
MWGui::BookTypesetter::Style* mBodyStyle;
|
||||
|
||||
AddEntry (BookTypesetter::Ptr typesetter, BookTypesetter::Style* body_style) :
|
||||
AddEntry (MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* body_style) :
|
||||
mTypesetter (typesetter), mBodyStyle (body_style)
|
||||
{
|
||||
}
|
||||
|
||||
void operator () (JournalViewModel::Entry const & entry)
|
||||
void operator () (MWGui::JournalViewModel::Entry const & entry)
|
||||
{
|
||||
mTypesetter->addContent (entry.body ());
|
||||
|
||||
|
@ -67,17 +65,17 @@ namespace
|
|||
struct AddJournalEntry : AddEntry
|
||||
{
|
||||
bool mAddHeader;
|
||||
BookTypesetter::Style* mHeaderStyle;
|
||||
MWGui::BookTypesetter::Style* mHeaderStyle;
|
||||
|
||||
AddJournalEntry (BookTypesetter::Ptr typesetter, BookTypesetter::Style* body_style,
|
||||
BookTypesetter::Style* header_style, bool add_header) :
|
||||
AddJournalEntry (MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* body_style,
|
||||
MWGui::BookTypesetter::Style* header_style, bool add_header) :
|
||||
AddEntry (typesetter, body_style),
|
||||
mHeaderStyle (header_style),
|
||||
mAddHeader (add_header)
|
||||
{
|
||||
}
|
||||
|
||||
void operator () (JournalViewModel::JournalEntry const & entry)
|
||||
void operator () (MWGui::JournalViewModel::JournalEntry const & entry)
|
||||
{
|
||||
if (mAddHeader)
|
||||
{
|
||||
|
@ -94,15 +92,15 @@ namespace
|
|||
struct AddTopicEntry : AddEntry
|
||||
{
|
||||
intptr_t mContentId;
|
||||
BookTypesetter::Style* mHeaderStyle;
|
||||
MWGui::BookTypesetter::Style* mHeaderStyle;
|
||||
|
||||
AddTopicEntry (BookTypesetter::Ptr typesetter, BookTypesetter::Style* body_style,
|
||||
BookTypesetter::Style* header_style, intptr_t contentId) :
|
||||
AddTopicEntry (MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* body_style,
|
||||
MWGui::BookTypesetter::Style* header_style, intptr_t contentId) :
|
||||
AddEntry (typesetter, body_style), mHeaderStyle (header_style), mContentId (contentId)
|
||||
{
|
||||
}
|
||||
|
||||
void operator () (JournalViewModel::TopicEntry const & entry)
|
||||
void operator () (MWGui::JournalViewModel::TopicEntry const & entry)
|
||||
{
|
||||
mTypesetter->write (mBodyStyle, entry.source ());
|
||||
mTypesetter->write (mBodyStyle, 0, 3);// begin
|
||||
|
@ -118,12 +116,12 @@ namespace
|
|||
|
||||
struct AddTopicName : AddContent
|
||||
{
|
||||
AddTopicName (BookTypesetter::Ptr typesetter, BookTypesetter::Style* style) :
|
||||
AddTopicName (MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* style) :
|
||||
AddContent (typesetter, style)
|
||||
{
|
||||
}
|
||||
|
||||
void operator () (JournalViewModel::Utf8Span topicName)
|
||||
void operator () (MWGui::JournalViewModel::Utf8Span topicName)
|
||||
{
|
||||
mTypesetter->write (mBodyStyle, topicName);
|
||||
mTypesetter->sectionBreak (10);
|
||||
|
@ -132,12 +130,12 @@ namespace
|
|||
|
||||
struct AddQuestName : AddContent
|
||||
{
|
||||
AddQuestName (BookTypesetter::Ptr typesetter, BookTypesetter::Style* style) :
|
||||
AddQuestName (MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* style) :
|
||||
AddContent (typesetter, style)
|
||||
{
|
||||
}
|
||||
|
||||
void operator () (JournalViewModel::Utf8Span topicName)
|
||||
void operator () (MWGui::JournalViewModel::Utf8Span topicName)
|
||||
{
|
||||
mTypesetter->write (mBodyStyle, topicName);
|
||||
mTypesetter->sectionBreak (10);
|
||||
|
@ -146,14 +144,14 @@ namespace
|
|||
|
||||
struct AddTopicLink : AddContent
|
||||
{
|
||||
AddTopicLink (BookTypesetter::Ptr typesetter, BookTypesetter::Style* style) :
|
||||
AddTopicLink (MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* style) :
|
||||
AddContent (typesetter, style)
|
||||
{
|
||||
}
|
||||
|
||||
void operator () (JournalViewModel::TopicId topicId, JournalViewModel::Utf8Span name)
|
||||
void operator () (MWGui::JournalViewModel::TopicId topicId, MWGui::JournalViewModel::Utf8Span name)
|
||||
{
|
||||
BookTypesetter::Style* link = mTypesetter->createHotStyle (mBodyStyle, MyGUI::Colour::Black, linkHot, linkActive, topicId);
|
||||
MWGui::BookTypesetter::Style* link = mTypesetter->createHotStyle (mBodyStyle, MyGUI::Colour::Black, linkHot, linkActive, topicId);
|
||||
|
||||
mTypesetter->write (link, name);
|
||||
mTypesetter->lineBreak ();
|
||||
|
@ -162,14 +160,14 @@ namespace
|
|||
|
||||
struct AddQuestLink : AddContent
|
||||
{
|
||||
AddQuestLink (BookTypesetter::Ptr typesetter, BookTypesetter::Style* style) :
|
||||
AddQuestLink (MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* style) :
|
||||
AddContent (typesetter, style)
|
||||
{
|
||||
}
|
||||
|
||||
void operator () (JournalViewModel::QuestId id, JournalViewModel::Utf8Span name)
|
||||
void operator () (MWGui::JournalViewModel::QuestId id, MWGui::JournalViewModel::Utf8Span name)
|
||||
{
|
||||
BookTypesetter::Style* style = mTypesetter->createHotStyle (mBodyStyle, MyGUI::Colour::Black, linkHot, linkActive, id);
|
||||
MWGui::BookTypesetter::Style* style = mTypesetter->createHotStyle (mBodyStyle, MyGUI::Colour::Black, linkHot, linkActive, id);
|
||||
|
||||
mTypesetter->write (style, name);
|
||||
mTypesetter->lineBreak ();
|
||||
|
@ -177,6 +175,9 @@ namespace
|
|||
};
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
typedef TypesetBook::Ptr book;
|
||||
|
||||
JournalBooks::JournalBooks (JournalViewModel::Ptr model) :
|
||||
|
@ -321,3 +322,5 @@ BookTypesetter::Ptr JournalBooks::createTypesetter ()
|
|||
//TODO: determine page size from layout...
|
||||
return BookTypesetter::create (240, 300);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,14 +16,13 @@
|
|||
|
||||
#include "keywordsearch.hpp"
|
||||
|
||||
namespace MWGui {
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
namespace MWGui { struct JournalViewModelImpl; }
|
||||
struct JournalViewModelImpl;
|
||||
|
||||
static void injectMonthName (std::ostream & os, int month);
|
||||
|
||||
struct MWGui::JournalViewModelImpl : JournalViewModel
|
||||
struct JournalViewModelImpl : JournalViewModel
|
||||
{
|
||||
typedef KeywordSearch <std::string, intptr_t> KeywordSearchT;
|
||||
|
||||
|
@ -386,3 +385,5 @@ JournalViewModel::Ptr JournalViewModel::create ()
|
|||
{
|
||||
return boost::make_shared <JournalViewModelImpl> ();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
#include "journalviewmodel.hpp"
|
||||
#include "journalbooks.hpp"
|
||||
|
||||
using namespace MyGUI;
|
||||
using namespace MWGui;
|
||||
|
||||
namespace
|
||||
{
|
||||
static char const OptionsOverlay [] = "OptionsOverlay";
|
||||
|
@ -47,7 +44,7 @@ namespace
|
|||
static char const LeftTopicIndex [] = "LeftTopicIndex";
|
||||
static char const RightTopicIndex [] = "RightTopicIndex";
|
||||
|
||||
struct JournalWindowImpl : WindowBase, JournalBooks, JournalWindow
|
||||
struct JournalWindowImpl : MWGui::WindowBase, MWGui::JournalBooks, MWGui::JournalWindow
|
||||
{
|
||||
struct DisplayState
|
||||
{
|
||||
|
@ -73,17 +70,17 @@ namespace
|
|||
template <typename value_type>
|
||||
void setText (char const * name, value_type const & value)
|
||||
{
|
||||
getWidget <TextBox> (name) ->
|
||||
getWidget <MyGUI::TextBox> (name) ->
|
||||
setCaption (boost::lexical_cast <std::string> (value));
|
||||
}
|
||||
|
||||
void setVisible (char const * name, bool visible)
|
||||
{
|
||||
getWidget <Widget> (name) ->
|
||||
getWidget <MyGUI::Widget> (name) ->
|
||||
setVisible (visible);
|
||||
}
|
||||
|
||||
void adviseButtonClick (char const * name, void (JournalWindowImpl::*Handler) (Widget* _sender))
|
||||
void adviseButtonClick (char const * name, void (JournalWindowImpl::*Handler) (MyGUI::Widget* _sender))
|
||||
{
|
||||
getWidget <MWGui::ImageButton> (name) ->
|
||||
eventMouseButtonClick += newDelegate(this, Handler);
|
||||
|
@ -94,7 +91,7 @@ namespace
|
|||
return getWidget <MWGui::BookPage> (name);
|
||||
}
|
||||
|
||||
JournalWindowImpl (JournalViewModel::Ptr Model)
|
||||
JournalWindowImpl (MWGui::JournalViewModel::Ptr Model)
|
||||
: WindowBase("openmw_journal.layout"), JournalBooks (Model)
|
||||
{
|
||||
mMainWidget->setVisible(false);
|
||||
|
@ -114,7 +111,7 @@ namespace
|
|||
adviseButtonClick (ShowActiveBTN, &JournalWindowImpl::notifyShowActive);
|
||||
|
||||
{
|
||||
BookPage::ClickCallback callback;
|
||||
MWGui::BookPage::ClickCallback callback;
|
||||
|
||||
callback = boost::bind (&JournalWindowImpl::notifyTopicClicked, this, _1);
|
||||
|
||||
|
@ -124,7 +121,7 @@ namespace
|
|||
}
|
||||
|
||||
{
|
||||
BookPage::ClickCallback callback;
|
||||
MWGui::BookPage::ClickCallback callback;
|
||||
|
||||
callback = boost::bind (&JournalWindowImpl::notifyIndexLinkClicked, this, _1);
|
||||
|
||||
|
@ -133,7 +130,7 @@ namespace
|
|||
}
|
||||
|
||||
{
|
||||
BookPage::ClickCallback callback;
|
||||
MWGui::BookPage::ClickCallback callback;
|
||||
|
||||
callback = boost::bind (&JournalWindowImpl::notifyQuestClicked, this, _1);
|
||||
|
||||
|
@ -312,7 +309,7 @@ namespace
|
|||
setVisible (JournalBTN, true);
|
||||
}
|
||||
|
||||
void notifyOptions(Widget* _sender)
|
||||
void notifyOptions(MyGUI::Widget* _sender)
|
||||
{
|
||||
setOptionsMode ();
|
||||
|
||||
|
@ -323,7 +320,7 @@ namespace
|
|||
getPage (RightTopicIndex)->showPage (mTopicIndexBook, 1);
|
||||
}
|
||||
|
||||
void notifyJournal(Widget* _sender)
|
||||
void notifyJournal(MyGUI::Widget* _sender)
|
||||
{
|
||||
assert (mStates.size () > 1);
|
||||
popBook ();
|
||||
|
@ -335,10 +332,10 @@ namespace
|
|||
|
||||
getPage (pageId)->showPage (book, 0);
|
||||
|
||||
getWidget <ScrollView> (listId)->setCanvasSize (size.first, size.second);
|
||||
getWidget <MyGUI::ScrollView> (listId)->setCanvasSize (size.first, size.second);
|
||||
}
|
||||
|
||||
void notifyIndexLinkClicked (TypesetBook::InteractiveId character)
|
||||
void notifyIndexLinkClicked (MWGui::TypesetBook::InteractiveId character)
|
||||
{
|
||||
setVisible (LeftTopicIndex, false);
|
||||
setVisible (RightTopicIndex, false);
|
||||
|
@ -347,7 +344,7 @@ namespace
|
|||
showList (TopicsList, TopicsPage, createTopicIndexBook ((char)character));
|
||||
}
|
||||
|
||||
void notifyTopics(Widget* _sender)
|
||||
void notifyTopics(MyGUI::Widget* _sender)
|
||||
{
|
||||
mQuestMode = false;
|
||||
setVisible (LeftTopicIndex, true);
|
||||
|
@ -358,7 +355,7 @@ namespace
|
|||
setVisible (ShowActiveBTN, false);
|
||||
}
|
||||
|
||||
void notifyQuests(Widget* _sender)
|
||||
void notifyQuests(MyGUI::Widget* _sender)
|
||||
{
|
||||
mQuestMode = true;
|
||||
setVisible (LeftTopicIndex, false);
|
||||
|
@ -371,7 +368,7 @@ namespace
|
|||
showList (QuestsList, QuestsPage, createQuestIndexBook (!mAllQuests));
|
||||
}
|
||||
|
||||
void notifyShowAll(Widget* _sender)
|
||||
void notifyShowAll(MyGUI::Widget* _sender)
|
||||
{
|
||||
mAllQuests = true;
|
||||
setVisible (ShowAllBTN, !mAllQuests);
|
||||
|
@ -379,7 +376,7 @@ namespace
|
|||
showList (QuestsList, QuestsPage, createQuestIndexBook (!mAllQuests));
|
||||
}
|
||||
|
||||
void notifyShowActive(Widget* _sender)
|
||||
void notifyShowActive(MyGUI::Widget* _sender)
|
||||
{
|
||||
mAllQuests = false;
|
||||
setVisible (ShowAllBTN, !mAllQuests);
|
||||
|
@ -387,18 +384,18 @@ namespace
|
|||
showList (QuestsList, QuestsPage, createQuestIndexBook (!mAllQuests));
|
||||
}
|
||||
|
||||
void notifyCancel(Widget* _sender)
|
||||
void notifyCancel(MyGUI::Widget* _sender)
|
||||
{
|
||||
setBookMode ();
|
||||
}
|
||||
|
||||
void notifyClose(Widget* _sender)
|
||||
void notifyClose(MyGUI::Widget* _sender)
|
||||
{
|
||||
|
||||
MWBase::Environment::get().getWindowManager ()->popGuiMode ();
|
||||
}
|
||||
|
||||
void notifyNextPage(Widget* _sender)
|
||||
void notifyNextPage(MyGUI::Widget* _sender)
|
||||
{
|
||||
if (!mStates.empty ())
|
||||
{
|
||||
|
@ -413,7 +410,7 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
void notifyPrevPage(Widget* _sender)
|
||||
void notifyPrevPage(MyGUI::Widget* _sender)
|
||||
{
|
||||
if (!mStates.empty ())
|
||||
{
|
||||
|
@ -430,7 +427,7 @@ namespace
|
|||
}
|
||||
|
||||
// glue the implementation to the interface
|
||||
JournalWindow * MWGui::JournalWindow::create (JournalViewModel::Ptr Model)
|
||||
MWGui::JournalWindow * MWGui::JournalWindow::create (JournalViewModel::Ptr Model)
|
||||
{
|
||||
return new JournalWindowImpl (Model);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue