mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
shuffle some code around
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21636 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
bb5f33e4d9
commit
72e3177e3d
22
src/LyX.cpp
22
src/LyX.cpp
@ -48,7 +48,6 @@
|
||||
|
||||
#include "frontends/alert.h"
|
||||
#include "frontends/Application.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/Gui.h"
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
@ -380,18 +379,7 @@ Buffer const * LyX::updateInset(Inset const * inset) const
|
||||
{
|
||||
if (quitting || !inset)
|
||||
return 0;
|
||||
|
||||
Buffer const * buffer_ptr = 0;
|
||||
vector<int> const & view_ids = pimpl_->application_->gui().viewIds();
|
||||
vector<int>::const_iterator it = view_ids.begin();
|
||||
vector<int>::const_iterator const end = view_ids.end();
|
||||
for (; it != end; ++it) {
|
||||
Buffer const * ptr =
|
||||
pimpl_->application_->gui().view(*it).updateInset(inset);
|
||||
if (ptr)
|
||||
buffer_ptr = ptr;
|
||||
}
|
||||
return buffer_ptr;
|
||||
return application().gui().updateInset(inset);
|
||||
}
|
||||
|
||||
|
||||
@ -399,13 +387,7 @@ void LyX::hideDialogs(std::string const & name, Inset * inset) const
|
||||
{
|
||||
if (quitting || !use_gui)
|
||||
return;
|
||||
|
||||
vector<int> const & view_ids = pimpl_->application_->gui().viewIds();
|
||||
vector<int>::const_iterator it = view_ids.begin();
|
||||
vector<int>::const_iterator const end = view_ids.end();
|
||||
for (; it != end; ++it)
|
||||
pimpl_->application_->gui().view(*it).getDialogs().
|
||||
hide(name, inset);
|
||||
application().gui().hideDialogs(name, inset);
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,6 +137,7 @@ using support::prefixIs;
|
||||
namespace Alert = frontend::Alert;
|
||||
|
||||
extern bool quitting;
|
||||
extern bool use_gui;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -1560,9 +1561,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_DIALOG_HIDE:
|
||||
case LFUN_DIALOG_HIDE: {
|
||||
LyX::cref().hideDialogs(argument, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_DIALOG_TOGGLE: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
|
@ -150,6 +150,7 @@ public:
|
||||
|
||||
///
|
||||
virtual Gui & gui() = 0;
|
||||
virtual Gui const & gui() const = 0;
|
||||
|
||||
/// Start the main event loop.
|
||||
/// The batch command is programmed to be execute once
|
||||
|
@ -14,9 +14,16 @@
|
||||
#ifndef BASE_GUI_H
|
||||
#define BASE_GUI_H
|
||||
|
||||
#include "support/strfwd.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class Buffer;
|
||||
class Inset;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
class LyXView;
|
||||
@ -42,6 +49,11 @@ public:
|
||||
///
|
||||
std::vector<int> const & viewIds() { return view_ids_; }
|
||||
|
||||
///
|
||||
virtual void hideDialogs(std::string const & name, Inset * inset) const = 0;
|
||||
///
|
||||
virtual Buffer const * updateInset(Inset const * inset) const = 0;
|
||||
|
||||
protected:
|
||||
///
|
||||
std::vector<int> view_ids_;
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
virtual FontLoader & fontLoader() { return font_loader_; }
|
||||
virtual int exec();
|
||||
virtual Gui & gui() { return gui_; }
|
||||
virtual Gui const & gui() const { return gui_; }
|
||||
virtual void exit(int status);
|
||||
virtual bool event(QEvent * e);
|
||||
void syncEvents();
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "GuiImplementation.h"
|
||||
#include "GuiView.h"
|
||||
#include "Dialogs.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
@ -21,6 +22,7 @@
|
||||
|
||||
using std::map;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
@ -104,6 +106,29 @@ LyXView & GuiImplementation::view(int id) const
|
||||
}
|
||||
|
||||
|
||||
void GuiImplementation::hideDialogs(string const & name, Inset * inset) const
|
||||
{
|
||||
vector<int>::const_iterator it = view_ids_.begin();
|
||||
vector<int>::const_iterator const end = view_ids_.end();
|
||||
for (; it != end; ++it)
|
||||
view(*it).getDialogs().hide(name, inset);
|
||||
}
|
||||
|
||||
|
||||
Buffer const * GuiImplementation::updateInset(Inset const * inset) const
|
||||
{
|
||||
Buffer const * buffer_ptr = 0;
|
||||
vector<int>::const_iterator it = view_ids_.begin();
|
||||
vector<int>::const_iterator const end = view_ids_.end();
|
||||
for (; it != end; ++it) {
|
||||
Buffer const * ptr = view(*it).updateInset(inset);
|
||||
if (ptr)
|
||||
buffer_ptr = ptr;
|
||||
}
|
||||
return buffer_ptr;
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
|
@ -41,9 +41,12 @@ public:
|
||||
virtual bool unregisterView(int id);
|
||||
|
||||
virtual LyXView& view(int id) const;
|
||||
///
|
||||
virtual void hideDialogs(std::string const & name, Inset * inset) const;
|
||||
///
|
||||
virtual Buffer const * updateInset(Inset const * inset) const;
|
||||
|
||||
private:
|
||||
|
||||
/// Multiple views container.
|
||||
/**
|
||||
* Warning: This must not be a smart pointer as the destruction of the
|
||||
|
Loading…
Reference in New Issue
Block a user