mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
Put LyXView on a diet, step 1: get rid of toolbars direct access from the core. Toolbar handling is a frontend thing; the goal is to progressively transfer that to the frontend.
* LyXView: - getToolbars(): deleted. - toolbars_: now protected. The goal is to transfer that to GuiView. - openLayoutList(): new method. The core should not know how this list is displayed. - showMiniBuffer(): new pure virtual method to show the mini-buffer. - focus_command_buffer: deleted. * GuiView: - focus_command_widget(): deleted. - showMiniBuffer(): implemented. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19748 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a2022b1950
commit
674632104f
@ -666,7 +666,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
break;
|
||||
|
||||
case LFUN_TOOLBAR_TOGGLE: {
|
||||
bool const current = lyx_view_->getToolbars().visible(cmd.getArg(0));
|
||||
bool const current = lyx_view_->isToolbarVisible(cmd.getArg(0));
|
||||
flag.setOnOff(current);
|
||||
break;
|
||||
}
|
||||
@ -888,8 +888,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_COMMAND_EXECUTE:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->getToolbars().display("minibuffer", true);
|
||||
lyx_view_->focus_command_buffer();
|
||||
lyx_view_->showMiniBuffer(true);
|
||||
break;
|
||||
|
||||
case LFUN_CANCEL:
|
||||
@ -1294,7 +1293,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_DROP_LAYOUTS_CHOICE:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->getToolbars().openLayoutList();
|
||||
lyx_view_->openLayoutList();
|
||||
break;
|
||||
|
||||
case LFUN_MENU_OPEN:
|
||||
|
@ -431,5 +431,17 @@ Buffer const * const LyXView::updateInset(Inset const * inset)
|
||||
return &work_area->bufferView().buffer();
|
||||
}
|
||||
|
||||
|
||||
void LyXView::openLayoutList()
|
||||
{
|
||||
toolbars_->openLayoutList();
|
||||
}
|
||||
|
||||
|
||||
bool LyXView::isToolbarVisible(std::string const & id)
|
||||
{
|
||||
return toolbars_->visible(id);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
@ -124,10 +124,12 @@ public:
|
||||
Buffer * buffer();
|
||||
Buffer const * buffer() const;
|
||||
|
||||
/// return the toolbar for this view
|
||||
Toolbars & getToolbars() { return *toolbars_.get(); }
|
||||
///
|
||||
Toolbars const & getToolbars() const { return *toolbars_.get(); }
|
||||
void openLayoutList();
|
||||
///
|
||||
bool isToolbarVisible(std::string const & id);
|
||||
///
|
||||
virtual void showMiniBuffer(bool visible) = 0;
|
||||
|
||||
/// return the menubar for this view
|
||||
Menubar & getMenubar() { return *menubar_.get(); }
|
||||
@ -162,9 +164,6 @@ public:
|
||||
/// update the status bar
|
||||
virtual void updateStatusBar() = 0;
|
||||
|
||||
/// focus the command buffer (minibuffer)
|
||||
boost::signal<void()> focus_command_buffer;
|
||||
|
||||
/// display a message in the view
|
||||
virtual void message(docstring const &) = 0;
|
||||
|
||||
@ -203,6 +202,8 @@ protected:
|
||||
|
||||
/// view's menubar
|
||||
boost::scoped_ptr<Menubar> menubar_;
|
||||
/// view's toolbar
|
||||
boost::scoped_ptr<Toolbars> toolbars_;
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -215,8 +216,6 @@ private:
|
||||
/// called on timeout
|
||||
void autoSave();
|
||||
|
||||
/// view's toolbar
|
||||
boost::scoped_ptr<Toolbars> toolbars_;
|
||||
/// auto-saving of buffers
|
||||
boost::scoped_ptr<Timeout> const autosave_timeout_;
|
||||
/// our function handler
|
||||
|
@ -87,7 +87,7 @@ docstring const ControlCommandBuffer::getCurrentState() const
|
||||
|
||||
void ControlCommandBuffer::hide() const
|
||||
{
|
||||
lv_.getToolbars().display("minibuffer", false);
|
||||
lv_.showMiniBuffer(false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -310,7 +310,7 @@ void GuiView::init()
|
||||
QObject::connect(menuBar(), SIGNAL(triggered(QAction *)),
|
||||
this, SLOT(updateMenu(QAction *)));
|
||||
|
||||
getToolbars().init();
|
||||
toolbars_->init();
|
||||
|
||||
statusBar()->setSizeGripEnabled(true);
|
||||
|
||||
@ -445,7 +445,7 @@ void GuiView::saveGeometry()
|
||||
session.sessionInfo().save("WindowPosX", convert<string>(normal_geometry.x() + d.posx_offset));
|
||||
session.sessionInfo().save("WindowPosY", convert<string>(normal_geometry.y() + d.posy_offset));
|
||||
}
|
||||
getToolbars().saveToolbarInfo();
|
||||
toolbars_->saveToolbarInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -579,7 +579,6 @@ void GuiView::setWindowTitle(docstring const & t, docstring const & it)
|
||||
void GuiView::addCommandBuffer(QToolBar * toolbar)
|
||||
{
|
||||
commandbuffer_ = new QCommandBuffer(this, *controlcommand_);
|
||||
focus_command_buffer.connect(boost::bind(&GuiView::focus_command_widget, this));
|
||||
toolbar->addWidget(commandbuffer_);
|
||||
}
|
||||
|
||||
@ -623,13 +622,6 @@ void GuiView::bigSizedIcons()
|
||||
}
|
||||
|
||||
|
||||
void GuiView::focus_command_widget()
|
||||
{
|
||||
if (commandbuffer_)
|
||||
commandbuffer_->focus_command();
|
||||
}
|
||||
|
||||
|
||||
void GuiView::update_view_state_qt()
|
||||
{
|
||||
if (!hasFocus())
|
||||
@ -946,6 +938,15 @@ void GuiView::removeWorkArea(WorkArea * work_area)
|
||||
}
|
||||
|
||||
|
||||
void GuiView::showMiniBuffer(bool visible)
|
||||
{
|
||||
if (!commandbuffer_)
|
||||
return;
|
||||
|
||||
toolbars_->display("minibuffer", visible);
|
||||
commandbuffer_->focus_command();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
virtual void message(docstring const & str);
|
||||
virtual void clearMessage();
|
||||
virtual bool hasFocus() const;
|
||||
void showMiniBuffer(bool);
|
||||
|
||||
/// show - display the top-level window
|
||||
void show();
|
||||
@ -130,9 +131,6 @@ private:
|
||||
///
|
||||
void dropEvent(QDropEvent * ev);
|
||||
|
||||
/// focus the command buffer widget
|
||||
void focus_command_widget();
|
||||
|
||||
/**
|
||||
* setWindowTitle - set title of window
|
||||
* @param t main window title
|
||||
|
Loading…
Reference in New Issue
Block a user