Esempio n. 1
0
/**
 * \brief Do an action on the model.
 */
bool bf::model_history::do_action( model_action* action )
{
  if ( !action->is_identity(*m_model) )
    {
      clear_future();

      action->execute( *m_model );

      if ( m_past.size() == m_max_history )
        {
          if ( m_max_history == 0 )
            delete action;
          else
            {
              if ( m_past.front() == m_saved_action )
                m_saved_action = NULL;

              delete m_past.front();
              m_past.push_back(action);
            }
        }
      else
        m_past.push_back(action);

      return true;
    }
  else
    {
      delete action;
      return false;
    }
} // model_history::do_action()
Esempio n. 2
0
static void jump_to_page(int newpage)
{
    newpage = fz_clampi(newpage, 0, fz_count_pages(ctx, doc) - 1);
    clear_future();
    push_history();
    currentpage = newpage;
    push_history();
}
Esempio n. 3
0
/**
 * \brief Destructor.
 */
bf::model_history::~model_history()
{
  clear_past();
  clear_future();
  delete m_model;
} // model_history::~model_history()