CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { CPDF_Dictionary* pDict = new CPDF_Dictionary; pDict->SetAtName("Type", "Page"); FX_DWORD dwObjNum = AddIndirectObject(pDict); if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { ReleaseIndirectObject(dwObjNum); return NULL; } return pDict; }
CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool); pDict->SetNameFor("Type", "Page"); uint32_t dwObjNum = AddIndirectObject(pDict); if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { ReleaseIndirectObject(dwObjNum); return nullptr; } return pDict; }
void Window_Message::StartMessageProcessing() { contents->Clear(); text.clear(); for (const std::string& line : Game_Message::texts) { text.append(Utils::DecodeUTF32(line)).append(1, U'\n'); } Game_Message::texts.clear(); item_max = min(4, Game_Message::choice_max); text_index = text.end(); end = text.end(); if (!text.empty()) { // Move on first valid char --text_index; // Apply commands that insert text while (std::distance(text_index, text.begin()) <= -1) { switch (tolower(*text_index--)) { case 'n': case 'v': { if (*text_index != escape_char) { continue; } ++text_index; auto start_code = text_index - 1; bool success; std::u32string command_result = Utils::DecodeUTF32(ParseCommandCode(success)); if (!success) { text_index = start_code - 2; continue; } text.replace(start_code, text_index + 1, command_result); // Start from the beginning, the inserted text might add new commands text_index = text.end(); end = text.end(); // Move on first valid char --text_index; break; } default: break; } } } text_index = text.begin(); InsertNewPage(); }
void Window_Message::StartMessageProcessing() { contents->Clear(); text.clear(); for (size_t i = 0; i < Game_Message::texts.size(); ++i) { std::string const line = Game_Message::texts[i]; text.append(line + "\n"); } item_max = Game_Message::choice_max; text_index = boost::u8_to_u32_iterator<std::string::const_iterator>(text.begin(), text.begin(), text.end()); end = boost::u8_to_u32_iterator<std::string::const_iterator>(text.end(), text.begin(), text.end()); InsertNewPage(); }
void Window_Message::WaitForInput() { active = true; // Enables the Pause arrow if (Input::IsTriggered(Input::DECISION) || Input::IsTriggered(Input::CANCEL)) { active = false; pause = false; if (text.empty()) { TerminateMessage(); } else if (text_index != end && new_page_after_pause) { new_page_after_pause = false; InsertNewPage(); } } }
void Window_Message::StartMessageProcessing() { contents->Clear(); if (Game_Message::is_word_wrapped) { std::u32string wrapped_text; for (const std::string& line : Game_Message::texts) { /* TODO: don't take commands like \> \< into account when word-wrapping */ if (Game_Message::is_word_wrapped) { // since ApplyTextInsertingCommands works for the text variable, // we store line into text and use wrapped_text for the real 'text' text = Utils::DecodeUTF32(line); ApplyTextInsertingCommands(); Game_Message::WordWrap( Utils::EncodeUTF(text), width - 24, [&wrapped_text](const std::string& wrapped_line) { wrapped_text.append(Utils::DecodeUTF32(wrapped_line)).append(1, U'\n'); } ); text = wrapped_text; } } } else { text.clear(); for (const std::string& line : Game_Message::texts) { text.append(Utils::DecodeUTF32(line)).append(1, U'\n'); } } Game_Message::texts.clear(); item_max = min(4, Game_Message::choice_max); ApplyTextInsertingCommands(); text_index = text.begin(); InsertNewPage(); }