Beispiel #1
0
  bool onProcessMessage(ui::Message* msg) override {
    switch (msg->type()) {

      case ui::kOpenMessage:
        load_window_pos(this, "UndoHistory");

        m_ctx->addObserver(this);
        m_ctx->documents().addObserver(this);
        if (m_ctx->activeDocument()) {
          m_frame = m_ctx->activeSite().frame();

          attachDocument(
            static_cast<app::Document*>(m_ctx->activeDocument()));
        }
        break;

      case ui::kCloseMessage:
        save_window_pos(this, "UndoHistory");

        if (m_document)
          detachDocument();
        m_ctx->documents().removeObserver(this);
        m_ctx->removeObserver(this);
        break;
    }
    return app::gen::UndoHistory::onProcessMessage(msg);
  }
  // ContextObserver
  void onActiveSiteChange(const doc::Site& site) override {
    if (m_document == site.document())
      return;

    attachDocument(
      static_cast<app::Document*>(
        const_cast<doc::Document*>(site.document())));
  }