1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 04:45:34 +00:00

drop the leading 'I' from the book page control interfaces

This commit is contained in:
Nathan Jeffords 2013-03-06 09:25:50 -08:00
parent 4c22afc29b
commit 36a6806faf
8 changed files with 134 additions and 134 deletions

View file

@ -15,9 +15,9 @@
namespace MWGui namespace MWGui
{ {
struct TypesetBook; struct TypesetBookImpl;
struct PageDisplay; struct PageDisplay;
struct BookPage; struct BookPageImpl;
} }
using namespace MyGUI; using namespace MyGUI;
@ -27,16 +27,16 @@ static bool ucs_space (int code_point);
static bool ucs_line_break (int code_point); static bool ucs_line_break (int code_point);
static bool ucs_breaking_space (int code_point); static bool ucs_breaking_space (int code_point);
struct IBookTypesetter::IStyle { virtual ~IStyle () {} }; struct BookTypesetter::Style { virtual ~Style () {} };
struct MWGui::TypesetBook : ITypesetBook struct MWGui::TypesetBookImpl : TypesetBook
{ {
typedef std::vector <uint8_t> content; typedef std::vector <uint8_t> content;
typedef std::list <content> contents; typedef std::list <content> contents;
typedef utf8_stream::point utf8_point; typedef utf8_stream::point utf8_point;
typedef std::pair <utf8_point, utf8_point> range; typedef std::pair <utf8_point, utf8_point> range;
struct Style : IBookTypesetter::IStyle struct StyleImpl : BookTypesetter::Style
{ {
IFont* mFont; IFont* mFont;
Colour mHotColour; Colour mHotColour;
@ -66,11 +66,11 @@ struct MWGui::TypesetBook : ITypesetBook
} }
}; };
typedef std::list <Style> styles; typedef std::list <StyleImpl> styles;
struct Run struct Run
{ {
Style* mStyle; StyleImpl* mStyle;
range mRange; range mRange;
int mLeft, mRight; int mLeft, mRight;
int mPrintableChars; int mPrintableChars;
@ -103,9 +103,9 @@ struct MWGui::TypesetBook : ITypesetBook
styles mStyles; styles mStyles;
IntRect mRect; IntRect mRect;
virtual ~TypesetBook () {} virtual ~TypesetBookImpl () {}
range addContent (IBookTypesetter::utf8_span Text) range addContent (BookTypesetter::utf8_span Text)
{ {
contents::iterator i = mContents.insert (mContents.end (), content (Text.first, Text.second)); contents::iterator i = mContents.insert (mContents.end (), content (Text.first, Text.second));
@ -151,7 +151,7 @@ struct MWGui::TypesetBook : ITypesetBook
visitRuns (top, bottom, NULL, Visitor); visitRuns (top, bottom, NULL, Visitor);
} }
Style * hitTest (int left, int top) const StyleImpl * hitTest (int left, int top) const
{ {
for (sections::const_iterator i = mSections.begin (); i != mSections.end (); ++i) for (sections::const_iterator i = mSections.begin (); i != mSections.end (); ++i)
{ {
@ -180,7 +180,7 @@ struct MWGui::TypesetBook : ITypesetBook
return nullptr; return nullptr;
} }
IFont* affectedFont (Style* Style) IFont* affectedFont (StyleImpl* Style)
{ {
for (styles::iterator i = mStyles.begin (); i != mStyles.end (); ++i) for (styles::iterator i = mStyles.begin (); i != mStyles.end (); ++i)
if (&*i == Style) if (&*i == Style)
@ -191,9 +191,9 @@ struct MWGui::TypesetBook : ITypesetBook
struct Typesetter; struct Typesetter;
}; };
struct TypesetBook::Typesetter : IBookTypesetter struct TypesetBookImpl::Typesetter : BookTypesetter
{ {
typedef TypesetBook book; typedef TypesetBookImpl book;
typedef boost::shared_ptr <book> book_ptr; typedef boost::shared_ptr <book> book_ptr;
int mPageWidth; int mPageWidth;
@ -222,13 +222,13 @@ struct TypesetBook::Typesetter : IBookTypesetter
{ {
} }
IStyle * createStyle (char const * FontName, Colour FontColour) Style * createStyle (char const * FontName, Colour FontColour)
{ {
for (styles::iterator i = mBook->mStyles.begin (); i != mBook->mStyles.end (); ++i) for (styles::iterator i = mBook->mStyles.begin (); i != mBook->mStyles.end (); ++i)
if (i->match (FontName, FontColour, FontColour, FontColour, 0)) if (i->match (FontName, FontColour, FontColour, FontColour, 0))
return &*i; return &*i;
Style & style = *mBook->mStyles.insert (mBook->mStyles.end (), Style ()); StyleImpl & style = *mBook->mStyles.insert (mBook->mStyles.end (), StyleImpl ());
style.mFont = FontManager::getInstance().getByName(FontName); style.mFont = FontManager::getInstance().getByName(FontName);
style.mHotColour = FontColour; style.mHotColour = FontColour;
@ -239,16 +239,16 @@ struct TypesetBook::Typesetter : IBookTypesetter
return &style; return &style;
} }
IStyle* createHotStyle (IStyle * _BaseStyle, coulour NormalColour, coulour HoverColour, coulour ActiveColour, interactive_id Id, bool Unique) Style* createHotStyle (Style* _BaseStyle, coulour NormalColour, coulour HoverColour, coulour ActiveColour, interactive_id Id, bool Unique)
{ {
Style* BaseStyle = dynamic_cast <Style*> (_BaseStyle); StyleImpl* BaseStyle = dynamic_cast <StyleImpl*> (_BaseStyle);
if (!Unique) if (!Unique)
for (styles::iterator i = mBook->mStyles.begin (); i != mBook->mStyles.end (); ++i) for (styles::iterator i = mBook->mStyles.begin (); i != mBook->mStyles.end (); ++i)
if (i->match (BaseStyle->mFont, HoverColour, ActiveColour, NormalColour, Id)) if (i->match (BaseStyle->mFont, HoverColour, ActiveColour, NormalColour, Id))
return &*i; return &*i;
Style & style = *mBook->mStyles.insert (mBook->mStyles.end (), Style ()); StyleImpl & style = *mBook->mStyles.insert (mBook->mStyles.end (), StyleImpl ());
style.mFont = BaseStyle->mFont; style.mFont = BaseStyle->mFont;
style.mHotColour = HoverColour; style.mHotColour = HoverColour;
@ -259,11 +259,11 @@ struct TypesetBook::Typesetter : IBookTypesetter
return &style; return &style;
} }
void write (IStyle * _Style, utf8_span Text) void write (Style * _Style, utf8_span Text)
{ {
range text = mBook->addContent (Text); range text = mBook->addContent (Text);
write_impl (dynamic_cast <Style*> (_Style), text.first, text.second); write_impl (dynamic_cast <StyleImpl*> (_Style), text.first, text.second);
} }
intptr_t add_content (utf8_span Text, bool Select) intptr_t add_content (utf8_span Text, bool Select)
@ -281,7 +281,7 @@ struct TypesetBook::Typesetter : IBookTypesetter
mCurrentContent = reinterpret_cast <content const *> (contentHandle); mCurrentContent = reinterpret_cast <content const *> (contentHandle);
} }
void write (IStyle * style, size_t begin, size_t end) void write (Style * style, size_t begin, size_t end)
{ {
assert (mCurrentContent != NULL); assert (mCurrentContent != NULL);
assert (end <= mCurrentContent->size ()); assert (end <= mCurrentContent->size ());
@ -290,7 +290,7 @@ struct TypesetBook::Typesetter : IBookTypesetter
utf8_point begin_ = &mCurrentContent->front () + begin; utf8_point begin_ = &mCurrentContent->front () + begin;
utf8_point end_ = &mCurrentContent->front () + end ; utf8_point end_ = &mCurrentContent->front () + end ;
write_impl (dynamic_cast <Style*> (style), begin_, end_); write_impl (dynamic_cast <StyleImpl*> (style), begin_, end_);
} }
void lineBreak (float margin) void lineBreak (float margin)
@ -321,7 +321,7 @@ struct TypesetBook::Typesetter : IBookTypesetter
mCurrentAlignment = sectionAlignment; mCurrentAlignment = sectionAlignment;
} }
ITypesetBook::ptr complete () TypesetBook::ptr complete ()
{ {
int curPageStart = 0; int curPageStart = 0;
int curPageStop = 0; int curPageStop = 0;
@ -381,7 +381,7 @@ struct TypesetBook::Typesetter : IBookTypesetter
return mBook; return mBook;
} }
void write_impl (Style * Style, utf8_stream::point _begin, utf8_stream::point _end) void write_impl (StyleImpl * Style, utf8_stream::point _begin, utf8_stream::point _end)
{ {
int line_height = Style->mFont->getDefaultHeight (); int line_height = Style->mFont->getDefaultHeight ();
@ -443,7 +443,7 @@ struct TypesetBook::Typesetter : IBookTypesetter
} }
} }
void append_run (Style * style, utf8_stream::point begin, utf8_stream::point end, int pc, int right, int bottom) void append_run (StyleImpl * style, utf8_stream::point begin, utf8_stream::point end, int pc, int right, int bottom)
{ {
if (mSection == NULL) if (mSection == NULL)
{ {
@ -501,9 +501,9 @@ struct TypesetBook::Typesetter : IBookTypesetter
} }
}; };
IBookTypesetter::ptr IBookTypesetter::create (int pageWidth, int pageHeight) BookTypesetter::ptr BookTypesetter::create (int pageWidth, int pageHeight)
{ {
return boost::make_shared <TypesetBook::Typesetter> (pageWidth, pageHeight); return boost::make_shared <TypesetBookImpl::Typesetter> (pageWidth, pageHeight);
} }
namespace namespace
@ -684,9 +684,9 @@ class MWGui::PageDisplay : public ISubWidgetText
MYGUI_RTTI_DERIVED(PageDisplay) MYGUI_RTTI_DERIVED(PageDisplay)
protected: protected:
typedef TypesetBook::Section Section; typedef TypesetBookImpl::Section Section;
typedef TypesetBook::Line Line; typedef TypesetBookImpl::Line Line;
typedef TypesetBook::Run Run; typedef TypesetBookImpl::Run Run;
struct TextFormat : ISubWidget struct TextFormat : ISubWidget
{ {
@ -739,7 +739,7 @@ protected:
public: public:
typedef TypesetBook::Style style; typedef TypesetBookImpl::StyleImpl style;
typedef std::map <TextFormat::id, TextFormat*> active_text_formats; typedef std::map <TextFormat::id, TextFormat*> active_text_formats;
int mViewTop; int mViewTop;
@ -751,7 +751,7 @@ public:
boost::function <void (intptr_t)> mLinkClicked; boost::function <void (intptr_t)> mLinkClicked;
boost::shared_ptr <TypesetBook> mBook; boost::shared_ptr <TypesetBookImpl> mBook;
size_t mPage; size_t mPage;
ILayerNode* mNode; ILayerNode* mNode;
@ -865,9 +865,9 @@ public:
} }
} }
void showPage (ITypesetBook::ptr _Book, size_t newPage) void showPage (TypesetBook::ptr _Book, size_t newPage)
{ {
boost::shared_ptr <TypesetBook> newBook = boost::dynamic_pointer_cast <TypesetBook> (_Book); boost::shared_ptr <TypesetBookImpl> newBook = boost::dynamic_pointer_cast <TypesetBookImpl> (_Book);
if (mBook != newBook) if (mBook != newBook)
{ {
@ -956,7 +956,7 @@ public:
} }
}; };
void createActiveFormats (boost::shared_ptr <TypesetBook> newBook) void createActiveFormats (boost::shared_ptr <TypesetBookImpl> newBook)
{ {
newBook->visitRuns (0, 0x7FFFFFFF, createActiveFormat (this)); newBook->visitRuns (0, 0x7FFFFFFF, createActiveFormat (this));
@ -1080,13 +1080,13 @@ public:
}; };
class MWGui::BookPage : public IBookPage class MWGui::BookPageImpl : public BookPage
{ {
MYGUI_RTTI_DERIVED(BookPage) MYGUI_RTTI_DERIVED(BookPage)
public: public:
void showPage (ITypesetBook::ptr Book, size_t Page) void showPage (TypesetBook::ptr Book, size_t Page)
{ {
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ())) if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
pd->showPage (Book, Page); pd->showPage (Book, Page);
@ -1152,11 +1152,11 @@ protected:
} }
}; };
void IBookPage::registerMyGUIComponents () void BookPage::registerMyGUIComponents ()
{ {
FactoryManager & factory = FactoryManager::getInstance(); FactoryManager & factory = FactoryManager::getInstance();
factory.registerFactory<BookPage>("Widget"); factory.registerFactory<BookPageImpl>("Widget");
factory.registerFactory<PageDisplay>("BasisSkin"); factory.registerFactory<PageDisplay>("BasisSkin");
} }

View file

@ -13,9 +13,9 @@ namespace MWGui
{ {
/// A formatted and paginated document to be used with /// A formatted and paginated document to be used with
/// the book page widget. /// the book page widget.
struct ITypesetBook struct TypesetBook
{ {
typedef boost::shared_ptr <ITypesetBook> ptr; typedef boost::shared_ptr <TypesetBook> ptr;
typedef intptr_t interactive_id; typedef intptr_t interactive_id;
/// Returns the number of pages in the document. /// Returns the number of pages in the document.
@ -31,10 +31,10 @@ namespace MWGui
}; };
/// A factory class for creating a typeset book instance. /// A factory class for creating a typeset book instance.
struct IBookTypesetter struct BookTypesetter
{ {
typedef boost::shared_ptr <IBookTypesetter> ptr; typedef boost::shared_ptr <BookTypesetter> ptr;
typedef ITypesetBook::interactive_id interactive_id; typedef TypesetBook::interactive_id interactive_id;
typedef MyGUI::Colour coulour; typedef MyGUI::Colour coulour;
typedef uint8_t const * utf8_point; typedef uint8_t const * utf8_point;
typedef std::pair <utf8_point, utf8_point> utf8_span; typedef std::pair <utf8_point, utf8_point> utf8_span;
@ -49,18 +49,18 @@ namespace MWGui
/// of text added to a typeset book. Their lifetime is equal /// of text added to a typeset book. Their lifetime is equal
/// to the lifetime of the book-typesetter instance that created /// to the lifetime of the book-typesetter instance that created
/// them. /// them.
struct IStyle; struct Style;
/// A factory function for creating the default implementation of a book typesetter /// A factory function for creating the default implementation of a book typesetter
static ptr create (int pageWidth, int pageHeight); static ptr create (int pageWidth, int pageHeight);
/// Create a simple text style consisting of a font and a text color. /// Create a simple text style consisting of a font and a text color.
virtual IStyle* createStyle (char const * Font, coulour Colour) = 0; virtual Style* createStyle (char const * Font, coulour Colour) = 0;
/// Create a hyper-link style with a user-defined identifier based on an /// Create a hyper-link style with a user-defined identifier based on an
/// existing style. The unique flag forces a new instance of this style /// existing style. The unique flag forces a new instance of this style
/// to be created even if an existing instance is present. /// to be created even if an existing instance is present.
virtual IStyle* createHotStyle (IStyle * BaseStyle, coulour NormalColour, coulour HoverColour, coulour ActiveColour, interactive_id Id, bool Unique = true) = 0; virtual Style* createHotStyle (Style * BaseStyle, coulour NormalColour, coulour HoverColour, coulour ActiveColour, interactive_id Id, bool Unique = true) = 0;
/// Insert a line break into the document. Newline characters in the input /// Insert a line break into the document. Newline characters in the input
/// text have the same affect. The margin parameter adds additional space /// text have the same affect. The margin parameter adds additional space
@ -77,7 +77,7 @@ namespace MWGui
virtual void setSectionAlignment (alignment sectionAlignment) = 0; virtual void setSectionAlignment (alignment sectionAlignment) = 0;
// Layout a block of text with the specified style into the document. // Layout a block of text with the specified style into the document.
virtual void write (IStyle * Style, utf8_span Text) = 0; virtual void write (Style * Style, utf8_span Text) = 0;
/// Adds a content block to the document without laying it out. An /// Adds a content block to the document without laying it out. An
/// identifier is returned that can be used to refer to it. If select /// identifier is returned that can be used to refer to it. If select
@ -89,23 +89,23 @@ namespace MWGui
/// Layout a span of the selected content block into the document /// Layout a span of the selected content block into the document
/// using the specified style. /// using the specified style.
virtual void write (IStyle * Style, size_t Begin, size_t End) = 0; virtual void write (Style * Style, size_t Begin, size_t End) = 0;
/// Finalize the document layout, and return a pointer to it. /// Finalize the document layout, and return a pointer to it.
virtual ITypesetBook::ptr complete () = 0; virtual TypesetBook::ptr complete () = 0;
}; };
/// An interface to the BookPage widget. /// An interface to the BookPage widget.
class IBookPage : public MyGUI::Widget class BookPage : public MyGUI::Widget
{ {
MYGUI_RTTI_DERIVED(IBookPage) MYGUI_RTTI_DERIVED(BookPage)
public: public:
typedef ITypesetBook::interactive_id interactive_id; typedef TypesetBook::interactive_id interactive_id;
typedef boost::function <void (interactive_id)> click_callback; typedef boost::function <void (interactive_id)> click_callback;
/// Make the widget display the specified page from the specified book. /// Make the widget display the specified page from the specified book.
virtual void showPage (ITypesetBook::ptr Book, size_t Page) = 0; virtual void showPage (TypesetBook::ptr Book, size_t Page) = 0;
/// Set the callback for a clicking a hyper-link in the document. /// Set the callback for a clicking a hyper-link in the document.
virtual void adviseLinkClicked (click_callback callback) = 0; virtual void adviseLinkClicked (click_callback callback) = 0;

View file

@ -4,13 +4,13 @@ using namespace MWGui;
namespace namespace
{ {
IBookTypesetter::utf8_span to_utf8_span (char const * Text) BookTypesetter::utf8_span to_utf8_span (char const * Text)
{ {
typedef IBookTypesetter::utf8_point point; typedef BookTypesetter::utf8_point point;
point begin = reinterpret_cast <point> (Text); point begin = reinterpret_cast <point> (Text);
return IBookTypesetter::utf8_span (begin, begin + strlen (Text)); return BookTypesetter::utf8_span (begin, begin + strlen (Text));
} }
const MyGUI::Colour linkHot (0.40f, 0.40f, 0.80f); const MyGUI::Colour linkHot (0.40f, 0.40f, 0.80f);
@ -19,10 +19,10 @@ namespace
struct addContent struct addContent
{ {
IBookTypesetter::ptr typesetter; BookTypesetter::ptr typesetter;
IBookTypesetter::IStyle* body_style; BookTypesetter::Style* body_style;
addContent (IBookTypesetter::ptr typesetter, IBookTypesetter::IStyle* body_style) : addContent (BookTypesetter::ptr typesetter, BookTypesetter::Style* body_style) :
typesetter (typesetter), body_style (body_style) typesetter (typesetter), body_style (body_style)
{ {
} }
@ -30,14 +30,14 @@ namespace
struct addSpan : addContent struct addSpan : addContent
{ {
addSpan (IBookTypesetter::ptr typesetter, IBookTypesetter::IStyle* body_style) : addSpan (BookTypesetter::ptr typesetter, BookTypesetter::Style* body_style) :
addContent (typesetter, body_style) addContent (typesetter, body_style)
{ {
} }
void operator () (intptr_t topicId, size_t begin, size_t end) void operator () (intptr_t topicId, size_t begin, size_t end)
{ {
IBookTypesetter::IStyle* style = body_style; BookTypesetter::Style* style = body_style;
if (topicId) if (topicId)
style = typesetter->createHotStyle (body_style, linkNormal, linkHot, linkActive, topicId); style = typesetter->createHotStyle (body_style, linkNormal, linkHot, linkActive, topicId);
@ -48,10 +48,10 @@ namespace
struct addEntry struct addEntry
{ {
IBookTypesetter::ptr typesetter; BookTypesetter::ptr typesetter;
IBookTypesetter::IStyle* body_style; BookTypesetter::Style* body_style;
addEntry (IBookTypesetter::ptr typesetter, IBookTypesetter::IStyle* body_style) : addEntry (BookTypesetter::ptr typesetter, BookTypesetter::Style* body_style) :
typesetter (typesetter), body_style (body_style) typesetter (typesetter), body_style (body_style)
{ {
} }
@ -67,10 +67,10 @@ namespace
struct addJournalEntry : addEntry struct addJournalEntry : addEntry
{ {
bool add_header; bool add_header;
IBookTypesetter::IStyle* header_style; BookTypesetter::Style* header_style;
addJournalEntry (IBookTypesetter::ptr typesetter, IBookTypesetter::IStyle* body_style, addJournalEntry (BookTypesetter::ptr typesetter, BookTypesetter::Style* body_style,
IBookTypesetter::IStyle* header_style, bool add_header) : BookTypesetter::Style* header_style, bool add_header) :
addEntry (typesetter, body_style), addEntry (typesetter, body_style),
header_style (header_style), header_style (header_style),
add_header (add_header) add_header (add_header)
@ -94,10 +94,10 @@ namespace
struct addTopicEntry : addEntry struct addTopicEntry : addEntry
{ {
intptr_t contentId; intptr_t contentId;
IBookTypesetter::IStyle* header_style; BookTypesetter::Style* header_style;
addTopicEntry (IBookTypesetter::ptr typesetter, IBookTypesetter::IStyle* body_style, addTopicEntry (BookTypesetter::ptr typesetter, BookTypesetter::Style* body_style,
IBookTypesetter::IStyle* header_style, intptr_t contentId) : BookTypesetter::Style* header_style, intptr_t contentId) :
addEntry (typesetter, body_style), header_style (header_style), contentId (contentId) addEntry (typesetter, body_style), header_style (header_style), contentId (contentId)
{ {
} }
@ -118,7 +118,7 @@ namespace
struct addTopicName : addContent struct addTopicName : addContent
{ {
addTopicName (IBookTypesetter::ptr typesetter, IBookTypesetter::IStyle* style) : addTopicName (BookTypesetter::ptr typesetter, BookTypesetter::Style* style) :
addContent (typesetter, style) addContent (typesetter, style)
{ {
} }
@ -132,7 +132,7 @@ namespace
struct addQuestName : addContent struct addQuestName : addContent
{ {
addQuestName (IBookTypesetter::ptr typesetter, IBookTypesetter::IStyle* style) : addQuestName (BookTypesetter::ptr typesetter, BookTypesetter::Style* style) :
addContent (typesetter, style) addContent (typesetter, style)
{ {
} }
@ -146,14 +146,14 @@ namespace
struct addTopicLink : addContent struct addTopicLink : addContent
{ {
addTopicLink (IBookTypesetter::ptr typesetter, IBookTypesetter::IStyle* style) : addTopicLink (BookTypesetter::ptr typesetter, BookTypesetter::Style* style) :
addContent (typesetter, style) addContent (typesetter, style)
{ {
} }
void operator () (IJournalViewModel::topic_id topicId, IJournalViewModel::utf8_span name) void operator () (IJournalViewModel::topic_id topicId, IJournalViewModel::utf8_span name)
{ {
IBookTypesetter::IStyle* link = typesetter->createHotStyle (body_style, MyGUI::Colour::Black, linkHot, linkActive, topicId); BookTypesetter::Style* link = typesetter->createHotStyle (body_style, MyGUI::Colour::Black, linkHot, linkActive, topicId);
typesetter->write (link, name); typesetter->write (link, name);
typesetter->lineBreak (); typesetter->lineBreak ();
@ -162,14 +162,14 @@ namespace
struct addQuestLink : addContent struct addQuestLink : addContent
{ {
addQuestLink (IBookTypesetter::ptr typesetter, IBookTypesetter::IStyle* style) : addQuestLink (BookTypesetter::ptr typesetter, BookTypesetter::Style* style) :
addContent (typesetter, style) addContent (typesetter, style)
{ {
} }
void operator () (IJournalViewModel::quest_id id, IJournalViewModel::utf8_span name) void operator () (IJournalViewModel::quest_id id, IJournalViewModel::utf8_span name)
{ {
IBookTypesetter::IStyle* style = typesetter->createHotStyle (body_style, MyGUI::Colour::Black, linkHot, linkActive, id); BookTypesetter::Style* style = typesetter->createHotStyle (body_style, MyGUI::Colour::Black, linkHot, linkActive, id);
typesetter->write (style, name); typesetter->write (style, name);
typesetter->lineBreak (); typesetter->lineBreak ();
@ -177,7 +177,7 @@ namespace
}; };
} }
typedef ITypesetBook::ptr book; typedef TypesetBook::ptr book;
JournalBooks::JournalBooks (IJournalViewModel::ptr Model) : JournalBooks::JournalBooks (IJournalViewModel::ptr Model) :
Model (Model) Model (Model)
@ -186,17 +186,17 @@ JournalBooks::JournalBooks (IJournalViewModel::ptr Model) :
book JournalBooks::createEmptyJournalBook () book JournalBooks::createEmptyJournalBook ()
{ {
IBookTypesetter::ptr typesetter = createTypesetter (); BookTypesetter::ptr typesetter = createTypesetter ();
IBookTypesetter::IStyle* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f)); BookTypesetter::Style* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f));
IBookTypesetter::IStyle* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black); BookTypesetter::Style* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
typesetter->write (header, to_utf8_span ("You have no journal entries!")); typesetter->write (header, to_utf8_span ("You have no journal entries!"));
typesetter->lineBreak (); typesetter->lineBreak ();
typesetter->write (body, to_utf8_span ("You should have gone though the starting quest and got an initial quest.")); typesetter->write (body, to_utf8_span ("You should have gone though the starting quest and got an initial quest."));
IBookTypesetter::IStyle* big = typesetter->createStyle ("EB Garamond 24", MyGUI::Colour::Black); BookTypesetter::Style* big = typesetter->createStyle ("EB Garamond 24", MyGUI::Colour::Black);
IBookTypesetter::IStyle* test = typesetter->createStyle ("MonoFont", MyGUI::Colour::Blue); BookTypesetter::Style* test = typesetter->createStyle ("MonoFont", MyGUI::Colour::Blue);
typesetter->sectionBreak (20); typesetter->sectionBreak (20);
typesetter->write (body, to_utf8_span ( typesetter->write (body, to_utf8_span (
@ -228,10 +228,10 @@ book JournalBooks::createEmptyJournalBook ()
book JournalBooks::createJournalBook () book JournalBooks::createJournalBook ()
{ {
IBookTypesetter::ptr typesetter = createTypesetter (); BookTypesetter::ptr typesetter = createTypesetter ();
IBookTypesetter::IStyle* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f)); BookTypesetter::Style* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f));
IBookTypesetter::IStyle* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black); BookTypesetter::Style* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
Model->visitJournalEntries (0, addJournalEntry (typesetter, body, header, true)); Model->visitJournalEntries (0, addJournalEntry (typesetter, body, header, true));
@ -240,10 +240,10 @@ book JournalBooks::createJournalBook ()
book JournalBooks::createTopicBook (uintptr_t topicId) book JournalBooks::createTopicBook (uintptr_t topicId)
{ {
IBookTypesetter::ptr typesetter = createTypesetter (); BookTypesetter::ptr typesetter = createTypesetter ();
IBookTypesetter::IStyle* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f)); BookTypesetter::Style* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f));
IBookTypesetter::IStyle* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black); BookTypesetter::Style* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
Model->visitTopicName (topicId, addTopicName (typesetter, header)); Model->visitTopicName (topicId, addTopicName (typesetter, header));
@ -256,10 +256,10 @@ book JournalBooks::createTopicBook (uintptr_t topicId)
book JournalBooks::createQuestBook (uintptr_t questId) book JournalBooks::createQuestBook (uintptr_t questId)
{ {
IBookTypesetter::ptr typesetter = createTypesetter (); BookTypesetter::ptr typesetter = createTypesetter ();
IBookTypesetter::IStyle* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f)); BookTypesetter::Style* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f));
IBookTypesetter::IStyle* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black); BookTypesetter::Style* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
Model->visitQuestName (questId, addQuestName (typesetter, header)); Model->visitQuestName (questId, addQuestName (typesetter, header));
@ -270,11 +270,11 @@ book JournalBooks::createQuestBook (uintptr_t questId)
book JournalBooks::createTopicIndexBook () book JournalBooks::createTopicIndexBook ()
{ {
IBookTypesetter::ptr typesetter = IBookTypesetter::create (92, 250); BookTypesetter::ptr typesetter = BookTypesetter::create (92, 250);
typesetter->setSectionAlignment (IBookTypesetter::alignCenter); typesetter->setSectionAlignment (BookTypesetter::alignCenter);
IBookTypesetter::IStyle* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black); BookTypesetter::Style* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
for (int i = 0; i < 26; ++i) for (int i = 0; i < 26; ++i)
{ {
@ -284,7 +284,7 @@ book JournalBooks::createTopicIndexBook ()
sprintf (buffer, "( %c )", ch); sprintf (buffer, "( %c )", ch);
IBookTypesetter::IStyle* style = typesetter->createHotStyle (body, MyGUI::Colour::Black, linkHot, linkActive, ch); BookTypesetter::Style* style = typesetter->createHotStyle (body, MyGUI::Colour::Black, linkHot, linkActive, ch);
if (i == 13) if (i == 13)
typesetter->sectionBreak (); typesetter->sectionBreak ();
@ -298,8 +298,8 @@ book JournalBooks::createTopicIndexBook ()
book JournalBooks::createTopicIndexBook (char character) book JournalBooks::createTopicIndexBook (char character)
{ {
IBookTypesetter::ptr typesetter = IBookTypesetter::create (0x7FFFFFFF, 0x7FFFFFFF); BookTypesetter::ptr typesetter = BookTypesetter::create (0x7FFFFFFF, 0x7FFFFFFF);
IBookTypesetter::IStyle* style = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black); BookTypesetter::Style* style = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
Model->visitTopicNamesStartingWith (character, addTopicLink (typesetter, style)); Model->visitTopicNamesStartingWith (character, addTopicLink (typesetter, style));
@ -308,16 +308,16 @@ book JournalBooks::createTopicIndexBook (char character)
book JournalBooks::createQuestIndexBook (bool activeOnly) book JournalBooks::createQuestIndexBook (bool activeOnly)
{ {
IBookTypesetter::ptr typesetter = IBookTypesetter::create (0x7FFFFFFF, 0x7FFFFFFF); BookTypesetter::ptr typesetter = BookTypesetter::create (0x7FFFFFFF, 0x7FFFFFFF);
IBookTypesetter::IStyle* base = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black); BookTypesetter::Style* base = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
Model->visitQuestNames (activeOnly, addQuestLink (typesetter, base)); Model->visitQuestNames (activeOnly, addQuestLink (typesetter, base));
return typesetter->complete (); return typesetter->complete ();
} }
IBookTypesetter::ptr JournalBooks::createTypesetter () BookTypesetter::ptr JournalBooks::createTypesetter ()
{ {
//TODO: determine page size from layout... //TODO: determine page size from layout...
return IBookTypesetter::create (240, 300); return BookTypesetter::create (240, 300);
} }

View file

@ -8,7 +8,7 @@ namespace MWGui
{ {
struct JournalBooks struct JournalBooks
{ {
typedef ITypesetBook::ptr book; typedef TypesetBook::ptr book;
IJournalViewModel::ptr Model; IJournalViewModel::ptr Model;
JournalBooks (IJournalViewModel::ptr Model); JournalBooks (IJournalViewModel::ptr Model);
@ -22,7 +22,7 @@ namespace MWGui
book createQuestIndexBook (bool showAll); book createQuestIndexBook (bool showAll);
private: private:
IBookTypesetter::ptr createTypesetter (); BookTypesetter::ptr createTypesetter ();
}; };
} }

View file

@ -47,7 +47,7 @@ namespace
static char const LeftTopicIndex [] = "LeftTopicIndex"; static char const LeftTopicIndex [] = "LeftTopicIndex";
static char const RightTopicIndex [] = "RightTopicIndex"; static char const RightTopicIndex [] = "RightTopicIndex";
struct JournalWindow : WindowBase, JournalBooks, IJournalWindow struct JournalWindowImpl : WindowBase, JournalBooks, JournalWindow
{ {
struct DisplayState struct DisplayState
{ {
@ -83,40 +83,40 @@ namespace
setVisible (visible); setVisible (visible);
} }
void adviseButtonClick (char const * name, void (JournalWindow::*Handler) (Widget* _sender)) void adviseButtonClick (char const * name, void (JournalWindowImpl::*Handler) (Widget* _sender))
{ {
getWidget <MWGui::ImageButton> (name) -> getWidget <MWGui::ImageButton> (name) ->
eventMouseButtonClick += newDelegate(this, Handler); eventMouseButtonClick += newDelegate(this, Handler);
} }
MWGui::IBookPage* getPage (char const * name) MWGui::BookPage* getPage (char const * name)
{ {
return getWidget <MWGui::IBookPage> (name); return getWidget <MWGui::BookPage> (name);
} }
JournalWindow (IJournalViewModel::ptr Model) JournalWindowImpl (IJournalViewModel::ptr Model)
: WindowBase("openmw_journal.layout"), JournalBooks (Model) : WindowBase("openmw_journal.layout"), JournalBooks (Model)
{ {
mMainWidget->setVisible(false); mMainWidget->setVisible(false);
center(); center();
adviseButtonClick (OptionsBTN, &JournalWindow::notifyOptions ); adviseButtonClick (OptionsBTN, &JournalWindowImpl::notifyOptions );
adviseButtonClick (PrevPageBTN, &JournalWindow::notifyPrevPage ); adviseButtonClick (PrevPageBTN, &JournalWindowImpl::notifyPrevPage );
adviseButtonClick (NextPageBTN, &JournalWindow::notifyNextPage ); adviseButtonClick (NextPageBTN, &JournalWindowImpl::notifyNextPage );
adviseButtonClick (CloseBTN, &JournalWindow::notifyClose ); adviseButtonClick (CloseBTN, &JournalWindowImpl::notifyClose );
adviseButtonClick (JournalBTN, &JournalWindow::notifyJournal ); adviseButtonClick (JournalBTN, &JournalWindowImpl::notifyJournal );
adviseButtonClick (TopicsBTN, &JournalWindow::notifyTopics ); adviseButtonClick (TopicsBTN, &JournalWindowImpl::notifyTopics );
adviseButtonClick (QuestsBTN, &JournalWindow::notifyQuests ); adviseButtonClick (QuestsBTN, &JournalWindowImpl::notifyQuests );
adviseButtonClick (CancelBTN, &JournalWindow::notifyCancel ); adviseButtonClick (CancelBTN, &JournalWindowImpl::notifyCancel );
adviseButtonClick (ShowAllBTN, &JournalWindow::notifyShowAll ); adviseButtonClick (ShowAllBTN, &JournalWindowImpl::notifyShowAll );
adviseButtonClick (ShowActiveBTN, &JournalWindow::notifyShowActive); adviseButtonClick (ShowActiveBTN, &JournalWindowImpl::notifyShowActive);
{ {
IBookPage::click_callback callback; BookPage::click_callback callback;
callback = boost::bind (&JournalWindow::notifyTopicClicked, this, _1); callback = boost::bind (&JournalWindowImpl::notifyTopicClicked, this, _1);
getPage (TopicsPage)->adviseLinkClicked (callback); getPage (TopicsPage)->adviseLinkClicked (callback);
getPage (LeftBookPage)->adviseLinkClicked (callback); getPage (LeftBookPage)->adviseLinkClicked (callback);
@ -124,18 +124,18 @@ namespace
} }
{ {
IBookPage::click_callback callback; BookPage::click_callback callback;
callback = boost::bind (&JournalWindow::notifyIndexLinkClicked, this, _1); callback = boost::bind (&JournalWindowImpl::notifyIndexLinkClicked, this, _1);
getPage (LeftTopicIndex)->adviseLinkClicked (callback); getPage (LeftTopicIndex)->adviseLinkClicked (callback);
getPage (RightTopicIndex)->adviseLinkClicked (callback); getPage (RightTopicIndex)->adviseLinkClicked (callback);
} }
{ {
IBookPage::click_callback callback; BookPage::click_callback callback;
callback = boost::bind (&JournalWindow::notifyQuestClicked, this, _1); callback = boost::bind (&JournalWindowImpl::notifyQuestClicked, this, _1);
getPage (QuestsPage)->adviseLinkClicked (callback); getPage (QuestsPage)->adviseLinkClicked (callback);
} }
@ -328,7 +328,7 @@ namespace
getWidget <ScrollView> (ListId)->setCanvasSize (size.first, size.second); getWidget <ScrollView> (ListId)->setCanvasSize (size.first, size.second);
} }
void notifyIndexLinkClicked (ITypesetBook::interactive_id character) void notifyIndexLinkClicked (TypesetBook::interactive_id character)
{ {
setVisible (LeftTopicIndex, false); setVisible (LeftTopicIndex, false);
setVisible (RightTopicIndex, false); setVisible (RightTopicIndex, false);
@ -420,7 +420,7 @@ namespace
} }
// glue the implementation to the interface // glue the implementation to the interface
IJournalWindow * MWGui::IJournalWindow::create (IJournalViewModel::ptr Model) IJournalWindow * MWGui::JournalWindow::create (IJournalViewModel::ptr Model)
{ {
return new JournalWindow (Model); return new JournalWindowImpl (Model);
} }

View file

@ -10,13 +10,13 @@ namespace MWGui
{ {
struct IJournalViewModel; struct IJournalViewModel;
struct IJournalWindow struct JournalWindow
{ {
/// construct a new instance of the one JournalWindow implementation /// construct a new instance of the one JournalWindow implementation
static IJournalWindow * create (boost::shared_ptr <IJournalViewModel> Model); static JournalWindow * create (boost::shared_ptr <IJournalViewModel> Model);
/// destroy this instance of the JournalWindow implementation /// destroy this instance of the JournalWindow implementation
virtual ~IJournalWindow () {}; virtual ~JournalWindow () {};
/// show/hide the journal window /// show/hide the journal window
virtual void setVisible (bool newValue) = 0; virtual void setVisible (bool newValue) = 0;

View file

@ -148,7 +148,7 @@ namespace MWGui
mMap = new MapWindow(cacheDir); mMap = new MapWindow(cacheDir);
mStatsWindow = new StatsWindow(); mStatsWindow = new StatsWindow();
mConsole = new Console(w,h, consoleOnlyScripts); mConsole = new Console(w,h, consoleOnlyScripts);
mJournal = IJournalWindow::create(IJournalViewModel::create ()); mJournal = JournalWindow::create(IJournalViewModel::create ());
mMessageBoxManager = new MessageBoxManager(); mMessageBoxManager = new MessageBoxManager();
mInventoryWindow = new InventoryWindow(mDragAndDrop); mInventoryWindow = new InventoryWindow(mDragAndDrop);
mTradeWindow = new TradeWindow(); mTradeWindow = new TradeWindow();

View file

@ -51,7 +51,7 @@ namespace MWGui
class MainMenu; class MainMenu;
class StatsWindow; class StatsWindow;
class InventoryWindow; class InventoryWindow;
class IJournalWindow; class JournalWindow;
class CharacterCreation; class CharacterCreation;
class DragAndDrop; class DragAndDrop;
class ToolTips; class ToolTips;
@ -253,7 +253,7 @@ namespace MWGui
StatsWindow *mStatsWindow; StatsWindow *mStatsWindow;
MessageBoxManager *mMessageBoxManager; MessageBoxManager *mMessageBoxManager;
Console *mConsole; Console *mConsole;
IJournalWindow* mJournal; JournalWindow* mJournal;
DialogueWindow *mDialogueWindow; DialogueWindow *mDialogueWindow;
ContainerWindow *mContainerWindow; ContainerWindow *mContainerWindow;
DragAndDrop* mDragAndDrop; DragAndDrop* mDragAndDrop;