Put LyXView on a diet, step 2: get rid of menubar direct access from the core. Menubar handling is a frontend thing.

* LyXView:
- getMenubars(): deleted.
- menubar_: transfered to GuiView::private.
- updateMenubar(): deleted, QLMenubar::update() is a void method anyway (to be deleted soon).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19750 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-08-23 12:44:21 +00:00
parent 674632104f
commit 77d4d1256d
6 changed files with 15 additions and 26 deletions

View File

@ -1298,7 +1298,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
case LFUN_MENU_OPEN:
BOOST_ASSERT(lyx_view_);
lyx_view_->getMenubar().openByName(from_utf8(argument));
lyx_view_->openMenu(from_utf8(argument));
break;
// --- lyxserver commands ----------------------------
@ -1927,7 +1927,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
}
}
if (!quitting && lyx_view_) {
lyx_view_->updateMenubar();
lyx_view_->updateToolbars();
// Some messages may already be translated, so we cannot use _()
sendDispatchMessage(translateIfPossible(getMessage()), cmd);

View File

@ -308,9 +308,7 @@ void LyXView::updateToolbars()
} else
toolbars_->update(false, false, false);
// update redaonly status of open dialogs. This could also be in
// updateMenubar(), but since updateToolbars() and updateMenubar()
// are always called together it is only here.
// update redaonly status of open dialogs.
getDialogs().checkStatus();
}
@ -335,12 +333,6 @@ void LyXView::toggleToolbarState(string const & name, bool allowauto)
}
void LyXView::updateMenubar()
{
menubar_->update();
}
void LyXView::autoSave()
{
LYXERR(Debug::INFO) << "Running autoSave()" << endl;

View File

@ -41,7 +41,6 @@ namespace frontend {
class ControlCommandBuffer;
class Dialogs;
class Menubar;
class WorkArea;
/**
@ -130,11 +129,7 @@ public:
bool isToolbarVisible(std::string const & id);
///
virtual void showMiniBuffer(bool visible) = 0;
/// return the menubar for this view
Menubar & getMenubar() { return *menubar_.get(); }
///
Menubar const & getMenubar() const { return *menubar_.get(); }
virtual void openMenu(docstring const & name) = 0;
/// get access to the dialogs
Dialogs & getDialogs() { return *dialogs_.get(); }
@ -159,8 +154,6 @@ public:
ToolbarInfo * getToolbarInfo(std::string const & name);
/// toggle toolbar state
void toggleToolbarState(std::string const & name, bool allowauto);
/// update the menubar
void updateMenubar();
/// update the status bar
virtual void updateStatusBar() = 0;
@ -200,8 +193,6 @@ protected:
/// disconnect from signals in the given buffer
void disconnectBuffer();
/// view's menubar
boost::scoped_ptr<Menubar> menubar_;
/// view's toolbar
boost::scoped_ptr<Toolbars> toolbars_;

View File

@ -219,7 +219,6 @@ void WorkArea::dispatch(FuncRequest const & cmd0, key_modifier::state k)
// Skip these when selecting
if (cmd.action != LFUN_MOUSE_MOTION) {
lyx_view_->updateLayoutChoice();
lyx_view_->updateMenubar();
lyx_view_->updateToolbars();
}

View File

@ -140,6 +140,8 @@ struct GuiView::GuiViewPrivate
TabWidget * tab_widget_;
QStackedWidget * stack_widget_;
BackgroundWidget * bg_widget_;
/// view's menubar
QLMenubar * menubar_;
GuiViewPrivate() : posx_offset(0), posy_offset(0)
{}
@ -278,7 +280,7 @@ GuiView::GuiView(int id)
GuiView::~GuiView()
{
menubar_.reset();
delete d.menubar_;
delete &d;
}
@ -306,7 +308,7 @@ QMenu* GuiView::createPopupMenu()
void GuiView::init()
{
menubar_.reset(new QLMenubar(this, menubackend));
d.menubar_ = new QLMenubar(this, menubackend);
QObject::connect(menuBar(), SIGNAL(triggered(QAction *)),
this, SLOT(updateMenu(QAction *)));
@ -561,7 +563,7 @@ void GuiView::setGeometry(unsigned int width,
void GuiView::updateMenu(QAction * /*action*/)
{
menubar_->update();
d.menubar_->update();
}
@ -658,7 +660,6 @@ void GuiView::currentTabChanged(int i)
// hidden. This should go here because some dialogs (eg ToC)
// require bv_->text.
getDialogs().updateBufferDependent(true);
updateMenubar();
updateToolbars();
updateLayoutChoice();
updateWindowTitle();
@ -947,6 +948,12 @@ void GuiView::showMiniBuffer(bool visible)
commandbuffer_->focus_command();
}
void GuiView::openMenu(docstring const & name)
{
d.menubar_->openByName(name);
}
} // namespace frontend
} // namespace lyx

View File

@ -72,6 +72,7 @@ public:
virtual void clearMessage();
virtual bool hasFocus() const;
void showMiniBuffer(bool);
void openMenu(docstring const &);
/// show - display the top-level window
void show();