bool KHTMLReader::parse_ul(DOM::Element e) { _list_depth++; bool popstateneeded = false; for (DOM::Node items = e.firstChild();!items.isNull();items = items.nextSibling()) { if (items.nodeName().string().toLower() == "li") { if (popstateneeded) { popState(); //popstateneeded = false; } pushNewState(); startNewLayout(); popstateneeded = true; _writer->layoutAttribute(state()->paragraph, "COUNTER", "numberingtype", "1"); _writer->layoutAttribute(state()->paragraph, "COUNTER", "righttext", "."); if (e.tagName().string().toLower() == "ol") { _writer->layoutAttribute(state()->paragraph, "COUNTER", "type", "1"); _writer->layoutAttribute(state()->paragraph, "COUNTER", "numberingtype", "1"); _writer->layoutAttribute(state()->paragraph, "COUNTER", "righttext", "."); } else { _writer->layoutAttribute(state()->paragraph, "COUNTER", "type", "10"); _writer->layoutAttribute(state()->paragraph, "COUNTER", "numberingtype", ""); _writer->layoutAttribute(state()->paragraph, "COUNTER", "righttext", ""); } _writer->layoutAttribute(state()->paragraph, "COUNTER", "depth", QString("%1").arg(_list_depth - 1)); } parseNode(items); } if (popstateneeded) popState(); _list_depth--; return false; }
void RTF::Reader::insertUnicodeSymbol(qint32 value) { m_cursor.insertText(QChar(value)); for (int i = m_state.skip; i > 0;) { m_token.readNext(); if (m_token.type() == TextToken) { int len = m_token.text().count(); if (len > i) { m_cursor.insertText(m_codec->toUnicode(m_token.text().mid(i))); break; } else { i -= len; } } else if (m_token.type() == ControlWordToken) { --i; } else if (m_token.type() == StartGroupToken) { pushState(); break; } else if (m_token.type() == EndGroupToken) { popState(); break; } } }
void Game::executeStackChanges() { // Parameters expected in mStackAction and mStackParam. switch (rStackAction) { case SAID::POP: { popState(); break; } case SAID::PUSH: { pushState(rStackParam); break; } case SAID::SWAP: { swapState(rStackParam); break; } case SAID::RETURN_TO: { returnToState(rStackParam); break; } case SAID::CLEAR: { clearStateStack(); break; } default: break; } // Finally, reset stack action requests: rStackAction = SAID::NOTHING; }
void StateManager::changeState(State *state) { // pop the current state popState(); // push the new state pushState(state); }
void Game::changeState(GameState* state) { if(!this->states.empty()) popState(); pushState(state); return; }
Game::~Game() { while (!states.empty()) { popState(); } }
void App::changeState(AppState* state) { if(!this->states.empty()) popState(); pushState(state); return; }
void StateMachine::popStateOrRevert() { if(!popState()) { pushState(previousState); } }
void CursorDropdown::onStateDeactivate(StateEvent* event) { if (!_deactivated) { auto game = Game::getInstance(); auto mouse = game->mouse(); // workaround to get rid of cursor disappearing issues std::vector<unsigned int> icons; while (mouse->states()->size() > _initialMouseStack) { icons.push_back(mouse->state()); mouse->popState(); } if (icons.size() > 0) { icons.pop_back(); // remove empty icon from CursorDropdown state // place only new icons back in stack for (auto it = icons.rbegin(); it != icons.rend(); it++) { mouse->pushState(*it); } } mouse->setX(_initialX); mouse->setY(_initialY); _deactivated = true; } }
GameManager::~GameManager() { while (!gameState.empty()) { popState(); //Delete happens in pop. } }
void KHTMLReader::parseNode(DOM::Node node) { // check if this is a text node. DOM::Text t = node; if (!t.isNull()) { _writer->addText(state()->paragraph, t.data().string(), 1, state()->in_pre_mode); return; // no children anymore... } // is this really needed ? it can't do harm anyway. state()->format = _writer->currentFormat(state()->paragraph, true); state()->layout = _writer->currentLayout(state()->paragraph); pushNewState(); DOM::Element e = node; bool go_recursive = true; if (!e.isNull()) { // get the CSS information parseStyle(e); // get the tag information go_recursive = parseTag(e); } if (go_recursive) { for (DOM::Node q = node.firstChild(); !q.isNull(); q = q.nextSibling()) { parseNode(q); } } popState(); }
void NextLevelState::keyPressed (const OIS::KeyEvent &e) { // Tecla p --> Estado anterior. if (e.key == OIS::KC_P or e.key == OIS::KC_ESCAPE) { popState(); } }
/***************************************************************************************************************************************************************** * changeState() removes the top state, and completely replaces it * param1 : a state to push to the end of the state stack **************************************************************************************************************************************************************/ void StateHandler::changeState(const statePtr& state) { while( !mStates.empty( ) ) { popState(); } mStates.emplace( state ); }
void GameManager::changeState(GameState* state) { if (!gameState.empty()) { popState(); } pushState(state); }
void Game::changeState(GameState* state) { if (!states.empty()) { popState(); } pushState(state); }
void StateManager::popAllStates() { if (!states.empty()) { popState(); popAllStates(); } }
void PauseState::keyPressed (const OIS::KeyEvent &e) { // Tecla p --> Estado anterior. if (e.key == OIS::KC_P) { popState(); } }
void Turnstile_pop_state(Context* ctxt) { SatsukiKeyboard *keyboard = reinterpret_cast<SatsukiKeyboard*>(ctxt); printf("pop state!!!!!!!!!\n"); popState(&(keyboard->mSatsukiContext)); if ((keyboard->mSatsukiContext._state)->Exit != NULL) { (keyboard->mSatsukiContext._state)->Exit(&keyboard->mSatsukiContext); } };
/** * Pops all the states currently in stack and pushes in the new state. * A shortcut for cleaning up all the old states when they're not necessary * like in one-way transitions. * @param state Pointer to the new state. */ void Game::setState(State *state) { while (!_states.empty()) { popState(); } pushState(state); _init = false; }
//TODO: this destroys the stack if you try to pop to a state not in it, should just use a list instead of a stack void StateManager::popToState(GameState *state) { while (state != activeState()) { if (_states.empty()) { throw std::runtime_error("Can't pop to state not in the stack."); } else { popState(); } } }
StateManager::~StateManager() { while (!states.empty()) { popState(); } }
void GameEngine::changeState(GameState* state) { if (!states.empty()) { popState(); } pushState(state); peekState()->Init(this); }
bool StateManager::resetStates( GameState *newState ) { while( !m_stateStack.empty() ) popState(); if( newState != nullptr ) return pushState( newState ); return true; }
void BitshiftUIState::update(unsigned long ms) { if(timeout != 0 && timeout + 2000 < ms) { Serial.println("POP"); Serial.println(timeout); Serial.println(ms); popState(); } }
void CursorDropdown::onLeftButtonUp(MouseEvent* event) { auto game = Game::getInstance(); game->popState(); if (!_onlyShowIcon) { game->locationState()->handleAction(object(), _icons.at(_currentIcon)); event->setHandled(true); } }
bool PauseState::keyPressed(const OIS::KeyEvent &e) { // Tecla p --> Estado anterior. if (e.key == OIS::KC_P) // Con P otra vez reanudamos el PlayState { popState(); } return true; }
bool RecordsState::frameEnded (const Ogre::FrameEvent& evt) { if (_volver) { delete _rec; popState(); } return true; }
void CPauseState::update(float timeSinceLastFrame) { if(mQuit) { mQuit=false; popState(); } GUIManager::getSingletonPtr()->update(timeSinceLastFrame); }
bool PauseState::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) { int x = e.state.X.abs; int y = e.state.Y.abs; if (btn_resume->_checkPoint(x,y)) { sounds::getInstance()->play_effect("push"); popState(); } return true; }
bool EndState::frameEnded(const Ogre::FrameEvent& evt) { if(_exitGame) return false; if(_save){ popState(); changeState(MenuState::getSingletonPtr()); } return true; }