mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 14:36:39 +00:00
Use field for columns count instead of out integer
This commit is contained in:
parent
7a986f38da
commit
e300a16b24
3 changed files with 14 additions and 14 deletions
|
@ -157,7 +157,7 @@ MWGui::BookTypesetter::Utf8Span to_utf8_span (char const * text)
|
||||||
typedef TypesetBook::Ptr book;
|
typedef TypesetBook::Ptr book;
|
||||||
|
|
||||||
JournalBooks::JournalBooks (JournalViewModel::Ptr model, ToUTF8::FromType encoding) :
|
JournalBooks::JournalBooks (JournalViewModel::Ptr model, ToUTF8::FromType encoding) :
|
||||||
mModel (model), mEncoding(encoding)
|
mModel (model), mEncoding(encoding), mIndexPagesCount(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,23 +218,23 @@ book JournalBooks::createQuestBook (const std::string& questName)
|
||||||
return typesetter->complete ();
|
return typesetter->complete ();
|
||||||
}
|
}
|
||||||
|
|
||||||
book JournalBooks::createTopicIndexBook (int& columnsCount)
|
book JournalBooks::createTopicIndexBook ()
|
||||||
{
|
{
|
||||||
bool isRussian = (mEncoding == ToUTF8::WINDOWS_1251);
|
bool isRussian = (mEncoding == ToUTF8::WINDOWS_1251);
|
||||||
|
|
||||||
BookTypesetter::Ptr typesetter = isRussian ? createCyrillicJournalIndex(columnsCount) : createLatinJournalIndex(columnsCount);
|
BookTypesetter::Ptr typesetter = isRussian ? createCyrillicJournalIndex() : createLatinJournalIndex();
|
||||||
|
|
||||||
return typesetter->complete ();
|
return typesetter->complete ();
|
||||||
}
|
}
|
||||||
|
|
||||||
BookTypesetter::Ptr JournalBooks::createLatinJournalIndex (int& columnsCount)
|
BookTypesetter::Ptr JournalBooks::createLatinJournalIndex ()
|
||||||
{
|
{
|
||||||
BookTypesetter::Ptr typesetter = BookTypesetter::create (92, 260);
|
BookTypesetter::Ptr typesetter = BookTypesetter::create (92, 260);
|
||||||
|
|
||||||
typesetter->setSectionAlignment (BookTypesetter::AlignCenter);
|
typesetter->setSectionAlignment (BookTypesetter::AlignCenter);
|
||||||
|
|
||||||
// Latin journal index always has two columns for now.
|
// Latin journal index always has two columns for now.
|
||||||
columnsCount = 2;
|
mIndexPagesCount = 2;
|
||||||
|
|
||||||
char ch = 'A';
|
char ch = 'A';
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ BookTypesetter::Ptr JournalBooks::createLatinJournalIndex (int& columnsCount)
|
||||||
return typesetter;
|
return typesetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
BookTypesetter::Ptr JournalBooks::createCyrillicJournalIndex (int& columnsCount)
|
BookTypesetter::Ptr JournalBooks::createCyrillicJournalIndex ()
|
||||||
{
|
{
|
||||||
BookTypesetter::Ptr typesetter = BookTypesetter::create (92, 260);
|
BookTypesetter::Ptr typesetter = BookTypesetter::create (92, 260);
|
||||||
|
|
||||||
|
@ -273,11 +273,11 @@ BookTypesetter::Ptr JournalBooks::createCyrillicJournalIndex (int& columnsCount)
|
||||||
|
|
||||||
// for small font size split alphabet to two columns (2x15 characers), for big font size split it to three colums (3x10 characters).
|
// for small font size split alphabet to two columns (2x15 characers), for big font size split it to three colums (3x10 characters).
|
||||||
int sectionBreak = 10;
|
int sectionBreak = 10;
|
||||||
columnsCount = 3;
|
mIndexPagesCount = 3;
|
||||||
if (fontHeight < 18)
|
if (fontHeight < 18)
|
||||||
{
|
{
|
||||||
sectionBreak = 15;
|
sectionBreak = 15;
|
||||||
columnsCount = 2;
|
mIndexPagesCount = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char ch[2] = {0xd0, 0x90}; // CYRILLIC CAPITAL A is a 0xd090 in UTF-8
|
unsigned char ch[2] = {0xd0, 0x90}; // CYRILLIC CAPITAL A is a 0xd090 in UTF-8
|
||||||
|
|
|
@ -22,14 +22,15 @@ namespace MWGui
|
||||||
Book createTopicBook (uintptr_t topicId);
|
Book createTopicBook (uintptr_t topicId);
|
||||||
Book createTopicBook (const std::string& topicId);
|
Book createTopicBook (const std::string& topicId);
|
||||||
Book createQuestBook (const std::string& questName);
|
Book createQuestBook (const std::string& questName);
|
||||||
Book createTopicIndexBook (int& columnsCount);
|
Book createTopicIndexBook ();
|
||||||
|
|
||||||
ToUTF8::FromType mEncoding;
|
ToUTF8::FromType mEncoding;
|
||||||
|
int mIndexPagesCount;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BookTypesetter::Ptr createTypesetter ();
|
BookTypesetter::Ptr createTypesetter ();
|
||||||
BookTypesetter::Ptr createLatinJournalIndex (int& columnsCount);
|
BookTypesetter::Ptr createLatinJournalIndex ();
|
||||||
BookTypesetter::Ptr createCyrillicJournalIndex (int& columnsCount);
|
BookTypesetter::Ptr createCyrillicJournalIndex ();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -465,11 +465,10 @@ namespace
|
||||||
{
|
{
|
||||||
setOptionsMode ();
|
setOptionsMode ();
|
||||||
|
|
||||||
int pagesCount;
|
|
||||||
if (!mTopicIndexBook)
|
if (!mTopicIndexBook)
|
||||||
mTopicIndexBook = createTopicIndexBook (pagesCount);
|
mTopicIndexBook = createTopicIndexBook ();
|
||||||
|
|
||||||
if (pagesCount == 3)
|
if (mIndexPagesCount == 3)
|
||||||
{
|
{
|
||||||
getPage (LeftTopicIndex)->showPage (mTopicIndexBook, 0);
|
getPage (LeftTopicIndex)->showPage (mTopicIndexBook, 0);
|
||||||
getPage (CenterTopicIndex)->showPage (mTopicIndexBook, 1);
|
getPage (CenterTopicIndex)->showPage (mTopicIndexBook, 1);
|
||||||
|
|
Loading…
Reference in a new issue