mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 03:15:32 +00:00
Split the JournalBooks::createTopicIndexBook()
This commit is contained in:
parent
a391990f2a
commit
ce5bdd6361
2 changed files with 44 additions and 2 deletions
|
@ -217,19 +217,59 @@ book JournalBooks::createQuestBook (const std::string& questName)
|
|||
}
|
||||
|
||||
book JournalBooks::createTopicIndexBook ()
|
||||
{
|
||||
// TODO: determine actual index alphabet
|
||||
bool isRussian = true;
|
||||
|
||||
BookTypesetter::Ptr typesetter = isRussian ? createCyrillicJournalIndex() : createLatinJournalIndex();
|
||||
|
||||
return typesetter->complete ();
|
||||
}
|
||||
|
||||
BookTypesetter::Ptr JournalBooks::createLatinJournalIndex ()
|
||||
{
|
||||
BookTypesetter::Ptr typesetter = BookTypesetter::create (92, 250);
|
||||
|
||||
typesetter->setSectionAlignment (BookTypesetter::AlignCenter);
|
||||
|
||||
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
|
||||
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
|
||||
for (int i = 0; i < 26; ++i)
|
||||
{
|
||||
char ch = 'A' + i;
|
||||
char buffer [32];
|
||||
|
||||
sprintf (buffer, "( %c )", ch);
|
||||
|
||||
// TODO: find a way to store a multibyte character in the InteractiveId (this is a intptr_t)
|
||||
const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
||||
BookTypesetter::Style* style = typesetter->createHotStyle (body, textColours.journalTopic,
|
||||
textColours.journalTopicOver,
|
||||
textColours.journalTopicPressed, i+1);
|
||||
|
||||
if (i == 13)
|
||||
typesetter->sectionBreak ();
|
||||
|
||||
typesetter->write (style, to_utf8_span (buffer));
|
||||
typesetter->lineBreak ();
|
||||
}
|
||||
|
||||
return typesetter;
|
||||
}
|
||||
|
||||
BookTypesetter::Ptr JournalBooks::createCyrillicJournalIndex ()
|
||||
{
|
||||
BookTypesetter::Ptr typesetter = BookTypesetter::create (92, 250);
|
||||
|
||||
typesetter->setSectionAlignment (BookTypesetter::AlignCenter);
|
||||
|
||||
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
char buffer [32];
|
||||
|
||||
sprintf(buffer, "( %c%c )", 0xd0, 0x90 + i); // CYRILLIC CAPITAL A is a 0xd090 in UTF-8
|
||||
|
||||
// TODO: find a way to store a multibyte character in the InteractiveId (this is a intptr_t)
|
||||
const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
||||
BookTypesetter::Style* style = typesetter->createHotStyle (body, textColours.journalTopic,
|
||||
textColours.journalTopicOver,
|
||||
|
@ -246,7 +286,7 @@ book JournalBooks::createTopicIndexBook ()
|
|||
typesetter->lineBreak ();
|
||||
}
|
||||
|
||||
return typesetter->complete ();
|
||||
return typesetter;
|
||||
}
|
||||
|
||||
BookTypesetter::Ptr JournalBooks::createTypesetter ()
|
||||
|
|
|
@ -24,6 +24,8 @@ namespace MWGui
|
|||
|
||||
private:
|
||||
BookTypesetter::Ptr createTypesetter ();
|
||||
BookTypesetter::Ptr createLatinJournalIndex ();
|
||||
BookTypesetter::Ptr createCyrillicJournalIndex ();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue