mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
new LFUN_WINDOW_CLOSE
* LyXFunc: - dispatch(): transfer assertion on lyx_view_ to each LFUN on a case by case basis. - dispatch(): new LFUN_WINDOW_CLOSE - getStatus(): special treatment for LFUN_LYX_QUIT * LyX: - views_, addLyXView(): deleted - quit(): call saveGeometry() on each LyXView before exiting. * GuiApplication: - is now a QObject. - quitLyX(): new Qt slot for lastWindowClosed signal. * Gui.h: - destroyView(), destroyWorkArea(): deleted - viewIds(): new method * GuiImplementation: - implement above changes. - GuiImplementation is now a QObject - cleanupViews(): new private slot. - buildViewIds(): new helper method - views_ and work_areas_ are now maps of raw pointers instead of schared_ptr. * LyXView - now stores its id. - dispatch(): special treatment for LFUN_WINDOW_CLOSE. - workAreaIds(): new method. - close(): new pure virtual method. - saveGeometry(): new pure virtual method. * GuiView: - implements above changes. - GuiView(): set WA_DeleteOnClose and Qt::WA_QuitOnClose to let Qt manage the destruction on close(). - closeEvent(): session stuff transfered to saveGeometry() * WorkArea - now store its id. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15514 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dcc3f7f151
commit
f4857dab04
@ -429,9 +429,9 @@ src_frontends_header_files = Split('''
|
||||
Alert.h
|
||||
Alert_pimpl.h
|
||||
Application.h
|
||||
Clipboard.h
|
||||
NoGuiFontLoader.h
|
||||
NoGuiFontMetrics.h
|
||||
Clipboard.h
|
||||
NoGuiFontLoader.h
|
||||
NoGuiFontMetrics.h
|
||||
Dialogs.h
|
||||
FileDialog.h
|
||||
FontLoader.h
|
||||
|
@ -33,6 +33,7 @@ Menuset
|
||||
|
||||
Menu "file"
|
||||
Item "New Window|W" "window-new"
|
||||
Item "Close Window|d" "window-close"
|
||||
Item "New|N" "buffer-new"
|
||||
Item "New from Template...|m" "buffer-new-template"
|
||||
Item "Open...|O" "file-open"
|
||||
|
@ -363,6 +363,7 @@ void LyXAction::init()
|
||||
{ LFUN_PARAGRAPH_MOVE_DOWN, "paragraph-move-down", Noop },
|
||||
{ LFUN_PARAGRAPH_MOVE_UP, "paragraph-move-up", Noop },
|
||||
{ LFUN_WINDOW_NEW, "window-new", NoBuffer },
|
||||
{ LFUN_WINDOW_CLOSE, "window-close", NoBuffer },
|
||||
{ LFUN_UNICODE_INSERT, "unicode-insert", Noop },
|
||||
|
||||
{ LFUN_NOACTION, "", Noop }
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -40,19 +41,20 @@ public:
|
||||
virtual int newView() = 0;
|
||||
///
|
||||
virtual LyXView & view(int id) = 0;
|
||||
///
|
||||
virtual void destroyView(int id) = 0;
|
||||
|
||||
///
|
||||
virtual int newWorkArea(unsigned int width, unsigned int height, int view_id) = 0;
|
||||
///
|
||||
virtual WorkArea & workArea(int id) = 0;
|
||||
|
||||
///
|
||||
virtual void destroyWorkArea(int id) = 0;
|
||||
std::vector<int> const & viewIds() { return view_ids_; };
|
||||
|
||||
protected:
|
||||
/// view of a buffer. Eventually there will be several.
|
||||
std::map<int, boost::shared_ptr<BufferView> > buffer_views_;
|
||||
|
||||
std::vector<int> view_ids_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -67,8 +67,8 @@ using lyx::frontend::ControlCommandBuffer;
|
||||
string current_layout;
|
||||
|
||||
|
||||
LyXView::LyXView()
|
||||
: work_area_(0),
|
||||
LyXView::LyXView(int id)
|
||||
: id_(id), work_area_(0),
|
||||
toolbars_(new Toolbars(*this)),
|
||||
autosave_timeout_(new Timeout(5000)),
|
||||
dialogs_(new Dialogs(*this)),
|
||||
@ -88,9 +88,12 @@ LyXView::~LyXView()
|
||||
}
|
||||
|
||||
|
||||
// FIXME, there's only one WorkArea per LyXView possible for now.
|
||||
void LyXView::setWorkArea(WorkArea * work_area)
|
||||
{
|
||||
work_area_ = work_area;
|
||||
work_area_ids_.clear();
|
||||
work_area_ids_.push_back(work_area_->id());
|
||||
}
|
||||
|
||||
|
||||
@ -363,6 +366,12 @@ void LyXView::updateWindowTitle()
|
||||
|
||||
void LyXView::dispatch(FuncRequest const & cmd)
|
||||
{
|
||||
if (cmd.action == LFUN_WINDOW_CLOSE) {
|
||||
close();
|
||||
closed(id_);
|
||||
return;
|
||||
}
|
||||
|
||||
theLyXFunc().setLyXView(this);
|
||||
lyx::dispatch(cmd);
|
||||
}
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <boost/signals/trackable.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class Buffer;
|
||||
@ -58,12 +60,21 @@ class ControlCommandBuffer;
|
||||
class LyXView : public boost::signals::trackable, boost::noncopyable {
|
||||
public:
|
||||
|
||||
LyXView();
|
||||
LyXView(int id);
|
||||
|
||||
virtual ~LyXView();
|
||||
|
||||
int const id() const { return id_; }
|
||||
|
||||
virtual void close() = 0;
|
||||
|
||||
std::vector<int> const & workAreaIds() const { return work_area_ids_; }
|
||||
|
||||
void setWorkArea(frontend::WorkArea * work_area);
|
||||
|
||||
/// This signal is emitted with the LyXView id when it is closed.
|
||||
boost::signal<void(int)> closed;
|
||||
|
||||
/**
|
||||
* This is called after the concrete view has been created.
|
||||
* We have to have the toolbar and the other stuff created
|
||||
@ -71,12 +82,16 @@ public:
|
||||
*/
|
||||
virtual void init() = 0;
|
||||
|
||||
///
|
||||
virtual void setGeometry(
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
int posx, int posy,
|
||||
bool maximize) = 0;
|
||||
|
||||
/// save the geometry state in the session manager.
|
||||
virtual void saveGeometry() = 0;
|
||||
|
||||
/// show busy cursor
|
||||
virtual void busy(bool) const = 0;
|
||||
|
||||
@ -243,6 +258,10 @@ protected:
|
||||
CommandBufferPtr;
|
||||
|
||||
CommandBufferPtr const controlcommand_;
|
||||
|
||||
private:
|
||||
int id_;
|
||||
std::vector<int> work_area_ids_;
|
||||
};
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -70,8 +70,8 @@ boost::signals::connection timecon;
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
WorkArea::WorkArea(LyXView & lyx_view)
|
||||
: buffer_view_(0), lyx_view_(lyx_view), greyed_out_(true),
|
||||
WorkArea::WorkArea(int id, LyXView & lyx_view)
|
||||
: id_(id), buffer_view_(0), lyx_view_(lyx_view), greyed_out_(true),
|
||||
cursor_visible_(false), cursor_timeout_(400)
|
||||
{
|
||||
// Start loading the pixmap as soon as possible
|
||||
|
@ -54,10 +54,12 @@ enum CursorShape {
|
||||
*/
|
||||
class WorkArea : public boost::signals::trackable {
|
||||
public:
|
||||
WorkArea(LyXView & lyx_view);
|
||||
WorkArea(int id, LyXView & lyx_view);
|
||||
|
||||
virtual ~WorkArea() {}
|
||||
|
||||
int const id() const { return id_; }
|
||||
|
||||
void setBufferView(BufferView * buffer_view);
|
||||
|
||||
///
|
||||
@ -119,6 +121,8 @@ protected:
|
||||
bool greyed_out_;
|
||||
|
||||
private:
|
||||
///
|
||||
int id_;
|
||||
///
|
||||
void displayMessage(docstring const &);
|
||||
/// buffer messages signal connection
|
||||
|
@ -27,7 +27,9 @@
|
||||
#include "BufferView.h"
|
||||
#include "Color.h"
|
||||
#include "debug.h"
|
||||
#include "funcrequest.h"
|
||||
#include "lyx_main.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "lyxrc.h"
|
||||
|
||||
#include <QApplication>
|
||||
@ -149,10 +151,24 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
|
||||
|
||||
LoaderQueue::setPriority(10,100);
|
||||
|
||||
setQuitOnLastWindowClosed(false);
|
||||
QObject::connect(this, SIGNAL(lastWindowClosed()),
|
||||
this, SLOT(quitLyX()));
|
||||
|
||||
guiApp = this;
|
||||
}
|
||||
|
||||
|
||||
void GuiApplication::quitLyX()
|
||||
{
|
||||
theLyXFunc().setLyXView(0);
|
||||
|
||||
// trigger LFUN_LYX_QUIT instead of QApplication::quit() directly
|
||||
// since LFUN_LYX_QUIT may have more cleanup stuff
|
||||
dispatch(FuncRequest(LFUN_LYX_QUIT));
|
||||
}
|
||||
|
||||
|
||||
Clipboard& GuiApplication::clipboard()
|
||||
{
|
||||
return clipboard_;
|
||||
@ -374,3 +390,5 @@ bool GuiApplication::macEventFilter(EventRef event)
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "GuiApplication_moc.cpp"
|
||||
|
@ -50,6 +50,8 @@ comon to all frontends.
|
||||
*/
|
||||
class GuiApplication : public QApplication, public Application
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiApplication(int & argc, char ** argv);
|
||||
///
|
||||
@ -81,6 +83,10 @@ public:
|
||||
///
|
||||
GuiFontLoader & guiFontLoader() { return font_loader_; }
|
||||
|
||||
private Q_SLOTS:
|
||||
/// request an LFUN_LYX_QUIT
|
||||
void quitLyX();
|
||||
|
||||
private:
|
||||
///
|
||||
GuiImplementation gui_;
|
||||
|
@ -20,12 +20,15 @@
|
||||
#include "GuiWorkArea.h"
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "funcrequest.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
using boost::shared_ptr;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
GuiImplementation::GuiImplementation(): max_view_id_(0), max_wa_id_(0)
|
||||
{
|
||||
}
|
||||
@ -36,7 +39,11 @@ int GuiImplementation::newView()
|
||||
size_t const id = max_view_id_;
|
||||
++max_view_id_;
|
||||
|
||||
views_[id].reset(new GuiView());
|
||||
views_[id] = new GuiView(id);
|
||||
view_ids_.push_back(id);
|
||||
|
||||
QObject::connect(views_[id], SIGNAL(destroyed(QObject *)),
|
||||
this, SLOT(cleanupViews(QObject *)));
|
||||
|
||||
return id;
|
||||
}
|
||||
@ -46,13 +53,39 @@ LyXView& GuiImplementation::view(int id)
|
||||
{
|
||||
BOOST_ASSERT(views_.find(id) != views_.end());
|
||||
|
||||
return *views_[id].get();
|
||||
return *views_[id];
|
||||
}
|
||||
|
||||
|
||||
void GuiImplementation::destroyView(int id)
|
||||
void GuiImplementation::cleanupViews(QObject * qobj)
|
||||
{
|
||||
views_.erase(id);
|
||||
GuiView * view = static_cast<GuiView *>(qobj);
|
||||
std::map<int, GuiView *>::iterator I;
|
||||
|
||||
for (I = views_.begin(); I != views_.end(); ++I) {
|
||||
if (I->second == view) {
|
||||
views_.erase(I->first);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
buildViewIds();
|
||||
|
||||
if (views_.empty()) {
|
||||
theLyXFunc().setLyXView(0);
|
||||
// dispatch(FuncRequest(LFUN_LYX_QUIT));
|
||||
return;
|
||||
}
|
||||
theLyXFunc().setLyXView(views_.begin()->second);
|
||||
}
|
||||
|
||||
|
||||
void GuiImplementation::buildViewIds()
|
||||
{
|
||||
view_ids_.clear();
|
||||
std::map<int, GuiView *>::const_iterator I;
|
||||
for (I = views_.begin(); I != views_.end(); ++I)
|
||||
view_ids_.push_back(I->first);
|
||||
}
|
||||
|
||||
|
||||
@ -61,16 +94,16 @@ int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int view_id)
|
||||
size_t const id = max_wa_id_;
|
||||
++max_wa_id_;
|
||||
|
||||
GuiView * view = views_[view_id].get();
|
||||
GuiView * view = views_[view_id];
|
||||
|
||||
work_areas_[id].reset(new GuiWorkArea(w, h, *view));
|
||||
work_areas_[id] = new GuiWorkArea(w, h, id, *view);
|
||||
|
||||
// FIXME BufferView creation should be independant of WorkArea creation
|
||||
buffer_views_[id].reset(new BufferView);
|
||||
work_areas_[id]->setBufferView(buffer_views_[id].get());
|
||||
view->setWorkArea(work_areas_[id].get());
|
||||
view->setWorkArea(work_areas_[id]);
|
||||
|
||||
view->setCentralWidget(work_areas_[id].get());
|
||||
view->setCentralWidget(work_areas_[id]);
|
||||
|
||||
return id;
|
||||
}
|
||||
@ -80,14 +113,11 @@ WorkArea& GuiImplementation::workArea(int id)
|
||||
{
|
||||
BOOST_ASSERT(work_areas_.find(id) != work_areas_.end());
|
||||
|
||||
return *work_areas_[id].get();
|
||||
return *work_areas_[id];
|
||||
}
|
||||
|
||||
|
||||
void GuiImplementation::destroyWorkArea(int id)
|
||||
{
|
||||
work_areas_.erase(id);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "GuiImplementation_moc.cpp"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "frontends/Gui.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <QObject>
|
||||
|
||||
#include <map>
|
||||
|
||||
@ -30,25 +30,41 @@ class GuiView;
|
||||
/**
|
||||
* The GuiImplementation class is the interface to all Qt4 components.
|
||||
*/
|
||||
class GuiImplementation: public Gui
|
||||
class GuiImplementation: public QObject, public Gui
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiImplementation();
|
||||
virtual ~GuiImplementation() {}
|
||||
|
||||
int newView();
|
||||
LyXView& view(int id);
|
||||
void destroyView(int id);
|
||||
int newWorkArea(unsigned int width, unsigned int height, int view_id);
|
||||
WorkArea& workArea(int id);
|
||||
void destroyWorkArea(int id);
|
||||
|
||||
private Q_SLOTS:
|
||||
///
|
||||
void cleanupViews(QObject * view);
|
||||
|
||||
private:
|
||||
///
|
||||
std::map<int, boost::shared_ptr<GuiView> > views_;
|
||||
///
|
||||
std::map<int, boost::shared_ptr<GuiWorkArea> > work_areas_;
|
||||
void buildViewIds();
|
||||
|
||||
/// Multiple views container.
|
||||
/**
|
||||
* Warning: This must not be a smart pointer as the destruction of the
|
||||
* object is handled by Qt when the view is closed
|
||||
* \sa Qt::WA_DeleteOnClose attribute.
|
||||
*/
|
||||
std::map<int, GuiView *> views_;
|
||||
|
||||
/// Multiple workareas container.
|
||||
/**
|
||||
* Warning: This must not be a smart pointer as the destruction of the
|
||||
* object is handled by Qt when its parent view is closed.
|
||||
*/
|
||||
std::map<int, GuiWorkArea *> work_areas_;
|
||||
///
|
||||
size_t max_view_id_;
|
||||
///
|
||||
|
@ -67,9 +67,12 @@ int const statusbar_timer_value = 3000;
|
||||
} // namespace anon
|
||||
|
||||
|
||||
GuiView::GuiView()
|
||||
: QMainWindow(), LyXView(), commandbuffer_(0)
|
||||
GuiView::GuiView(int id)
|
||||
: QMainWindow(), LyXView(id), commandbuffer_(0)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
setAttribute(Qt::WA_QuitOnClose, true);
|
||||
|
||||
// setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
// setIconSize(QSize(12,12));
|
||||
|
||||
@ -90,6 +93,12 @@ GuiView::~GuiView()
|
||||
}
|
||||
|
||||
|
||||
void GuiView::close()
|
||||
{
|
||||
QMainWindow::close();
|
||||
}
|
||||
|
||||
|
||||
void GuiView::init()
|
||||
{
|
||||
menubar_.reset(new QLMenubar(this, menubackend));
|
||||
@ -110,6 +119,33 @@ void GuiView::init()
|
||||
}
|
||||
|
||||
|
||||
void GuiView::saveGeometry()
|
||||
{
|
||||
// FIXME:
|
||||
// change the ifdef to 'geometry = normalGeometry();' only
|
||||
// when Trolltech has fixed the broken normalGeometry on X11:
|
||||
// http://www.trolltech.com/developer/task-tracker/index_html?id=119684+&method=entry
|
||||
// Then also the moveEvent, resizeEvent, and the
|
||||
// code for floatingGeometry_ can be removed;
|
||||
// adjust GuiView::setGeometry()
|
||||
#ifdef Q_OS_WIN32
|
||||
QRect geometry = normalGeometry();
|
||||
#else
|
||||
updateFloatingGeometry();
|
||||
QRect geometry = floatingGeometry_;
|
||||
#endif
|
||||
|
||||
// save windows size and position
|
||||
Session & session = LyX::ref().session();
|
||||
session.saveSessionInfo("WindowWidth", convert<string>(geometry.width()));
|
||||
session.saveSessionInfo("WindowHeight", convert<string>(geometry.height()));
|
||||
session.saveSessionInfo("WindowIsMaximized", (isMaximized() ? "yes" : "no"));
|
||||
if (lyxrc.geometry_xysaved) {
|
||||
session.saveSessionInfo("WindowPosX", convert<string>(geometry.x()));
|
||||
session.saveSessionInfo("WindowPosY", convert<string>(geometry.y()));
|
||||
}
|
||||
}
|
||||
|
||||
void GuiView::setGeometry(unsigned int width,
|
||||
unsigned int height,
|
||||
int posx, int posy,
|
||||
@ -230,32 +266,7 @@ void GuiView::moveEvent(QMoveEvent *)
|
||||
|
||||
void GuiView::closeEvent(QCloseEvent *)
|
||||
{
|
||||
// FIXME:
|
||||
// change the ifdef to 'geometry = normalGeometry();' only
|
||||
// when Trolltech has fixed the broken normalGeometry on X11:
|
||||
// http://www.trolltech.com/developer/task-tracker/index_html?id=119684+&method=entry
|
||||
// Then also the moveEvent, resizeEvent, and the
|
||||
// code for floatingGeometry_ can be removed;
|
||||
// adjust GuiView::setGeometry()
|
||||
#ifdef Q_OS_WIN32
|
||||
QRect geometry = normalGeometry();
|
||||
#else
|
||||
updateFloatingGeometry();
|
||||
QRect geometry = floatingGeometry_;
|
||||
#endif
|
||||
|
||||
// save windows size and position
|
||||
Session & session = LyX::ref().session();
|
||||
session.saveSessionInfo("WindowWidth", convert<string>(geometry.width()));
|
||||
session.saveSessionInfo("WindowHeight", convert<string>(geometry.height()));
|
||||
session.saveSessionInfo("WindowIsMaximized", (isMaximized() ? "yes" : "no"));
|
||||
if (lyxrc.geometry_xysaved) {
|
||||
session.saveSessionInfo("WindowPosX", convert<string>(geometry.x()));
|
||||
session.saveSessionInfo("WindowPosY", convert<string>(geometry.y()));
|
||||
}
|
||||
// trigger LFUN_LYX_QUIT instead of quit directly
|
||||
// since LFUN_LYX_QUIT may have more cleanup stuff
|
||||
dispatch(FuncRequest(LFUN_LYX_QUIT));
|
||||
saveGeometry();
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,45 +47,37 @@ class GuiView : public QMainWindow, public LyXView {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/// create a main window of the given dimensions
|
||||
GuiView();
|
||||
GuiView(int id);
|
||||
|
||||
~GuiView();
|
||||
|
||||
/// initialize the object
|
||||
virtual void init();
|
||||
|
||||
///
|
||||
virtual void close();
|
||||
virtual void setGeometry(
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
int posx, int posy,
|
||||
bool maximize);
|
||||
virtual void saveGeometry();
|
||||
virtual void busy(bool) const;
|
||||
Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const & tbb);
|
||||
virtual void updateStatusBar();
|
||||
virtual void message(lyx::docstring const & str);
|
||||
virtual void clearMessage();
|
||||
virtual bool hasFocus() const;
|
||||
|
||||
/// show - display the top-level window
|
||||
void show();
|
||||
|
||||
/// show busy cursor
|
||||
virtual void busy(bool) const;
|
||||
|
||||
Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const & tbb);
|
||||
|
||||
/// display a status message
|
||||
virtual void message(lyx::docstring const & str);
|
||||
|
||||
/// clear status message
|
||||
virtual void clearMessage();
|
||||
|
||||
/// update the status bar
|
||||
virtual void updateStatusBar();
|
||||
|
||||
/// add the command buffer
|
||||
void addCommandBuffer(QToolBar * toolbar);
|
||||
|
||||
/// menu item has been selected
|
||||
void activated(FuncRequest const &);
|
||||
|
||||
/// returns true if this view has the focus.
|
||||
virtual bool hasFocus() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void closing(int);
|
||||
|
||||
public Q_SLOTS:
|
||||
/// idle timeout
|
||||
|
@ -180,8 +180,8 @@ SyntheticMouseEvent::SyntheticMouseEvent()
|
||||
{}
|
||||
|
||||
|
||||
GuiWorkArea::GuiWorkArea(int w, int h, LyXView & lyx_view)
|
||||
: WorkArea(lyx_view)
|
||||
GuiWorkArea::GuiWorkArea(int w, int h, int id, LyXView & lyx_view)
|
||||
: WorkArea(id, lyx_view)
|
||||
{
|
||||
cursor_ = new frontend::CursorWidget(this);
|
||||
cursor_->hide();
|
||||
|
@ -91,7 +91,7 @@ class GuiWorkArea : public QAbstractScrollArea, public WorkArea
|
||||
|
||||
public:
|
||||
///
|
||||
GuiWorkArea(int width, int height, LyXView & lyx_view);
|
||||
GuiWorkArea(int width, int height, int id, LyXView & lyx_view);
|
||||
|
||||
/// return the width of the content pane
|
||||
virtual int width() const { return viewport()->width(); }
|
||||
|
@ -34,7 +34,6 @@ libqt4_la_SOURCES = \
|
||||
ColorCache.h ColorCache.C \
|
||||
Dialogs.C \
|
||||
FileDialog.C \
|
||||
GuiApplication.C GuiApplication.h \
|
||||
GuiClipboard.h GuiClipboard.C \
|
||||
GuiFontLoader.h GuiFontLoader.C \
|
||||
GuiFontMetrics.h GuiFontMetrics.C \
|
||||
|
@ -78,6 +78,7 @@ MOCFILES = \
|
||||
emptytable.C emptytable.h \
|
||||
FileDialog_private.C FileDialog_private.h \
|
||||
FloatPlacement.C FloatPlacement.h \
|
||||
GuiApplication.C GuiApplication.h \
|
||||
GuiView.C GuiView.h \
|
||||
GuiWorkArea.C GuiWorkArea.h \
|
||||
iconpalette.C iconpalette.h \
|
||||
|
@ -370,6 +370,7 @@ enum kb_action {
|
||||
LFUN_INSET_DISSOLVE, // jspitzm 20060807
|
||||
LFUN_CHANGE_NEXT,
|
||||
LFUN_WINDOW_NEW, // Abdel 20061021
|
||||
LFUN_WINDOW_CLOSE, // Abdel 20061023
|
||||
LFUN_UNICODE_INSERT, // Lgb 20061022
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
#include "frontends/Alert.h"
|
||||
#include "frontends/Application.h"
|
||||
#include "frontends/Gui.h"
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
#include "support/environment.h"
|
||||
@ -284,11 +285,6 @@ kb_keymap const & LyX::topLevelKeymap() const
|
||||
return *pimpl_->toplevel_keymap_.get();
|
||||
}
|
||||
|
||||
void LyX::addLyXView(LyXView * lyxview)
|
||||
{
|
||||
views_.push_back(lyxview);
|
||||
}
|
||||
|
||||
|
||||
Buffer const * const LyX::updateInset(InsetBase const * inset) const
|
||||
{
|
||||
@ -296,10 +292,12 @@ Buffer const * const LyX::updateInset(InsetBase const * inset) const
|
||||
return 0;
|
||||
|
||||
Buffer const * buffer_ptr = 0;
|
||||
ViewList::const_iterator it = views_.begin();
|
||||
ViewList::const_iterator const end = views_.end();
|
||||
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 = (*it)->updateInset(inset);
|
||||
Buffer const * ptr =
|
||||
pimpl_->application_->gui().view(*it).updateInset(inset);
|
||||
if (ptr)
|
||||
buffer_ptr = ptr;
|
||||
}
|
||||
@ -403,6 +401,13 @@ void LyX::quit(bool noask)
|
||||
if (!noask && !pimpl_->buffer_list_.quitWriteAll())
|
||||
return;
|
||||
|
||||
// The LyXView Geometry settings are stored when LyXView::close
|
||||
// is called explicitely but a straight quit() command would not
|
||||
// guarante that. So we make sure this is done here:
|
||||
vector<int> const & view_ids = pimpl_->application_->gui().viewIds();
|
||||
for (size_t i = 0; i < view_ids.size(); ++i)
|
||||
pimpl_->application_->gui().view(view_ids[i]).saveGeometry();
|
||||
|
||||
pimpl_->session_->writeFile();
|
||||
}
|
||||
|
||||
@ -515,6 +520,9 @@ void LyX::restoreGuiSession(vector<string> const & files)
|
||||
|
||||
LyXView * LyX::newLyXView()
|
||||
{
|
||||
if (!lyx::use_gui)
|
||||
return 0;
|
||||
|
||||
// determine windows size and position, from lyxrc and/or session
|
||||
// initial geometry
|
||||
unsigned int width = 690;
|
||||
@ -555,7 +563,6 @@ LyXView * LyX::newLyXView()
|
||||
}
|
||||
// create the main window
|
||||
LyXView * view = &pimpl_->application_->createView(width, height, posx, posy, maximize);
|
||||
ref().addLyXView(view);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -123,9 +122,6 @@ private:
|
||||
/// Create a View and restore GUI Session.
|
||||
void restoreGuiSession(std::vector<std::string> const & files);
|
||||
|
||||
///
|
||||
void addLyXView(LyXView * lyxview);
|
||||
|
||||
/// Initialize RC font for the GUI.
|
||||
void initGuiFont();
|
||||
|
||||
@ -163,9 +159,6 @@ private:
|
||||
/// Use the Pimpl idiom to hide the internals.
|
||||
struct Singletons;
|
||||
boost::scoped_ptr<Singletons> pimpl_;
|
||||
///
|
||||
typedef std::list<LyXView *> ViewList;
|
||||
ViewList views_;
|
||||
|
||||
///
|
||||
bool geometryOption_;
|
||||
|
@ -78,6 +78,7 @@
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/FileDialog.h"
|
||||
#include "frontends/FontLoader.h"
|
||||
#include "frontends/Gui.h"
|
||||
#include "frontends/LyXKeySym.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Menubar.h"
|
||||
@ -346,6 +347,13 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
{
|
||||
//lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
|
||||
FuncStatus flag;
|
||||
|
||||
if (cmd.action == LFUN_LYX_QUIT) {
|
||||
flag.message(from_utf8(N_("Exiting")));
|
||||
flag.enabled(true);
|
||||
return flag;
|
||||
}
|
||||
|
||||
LCursor & cur = view()->cursor();
|
||||
|
||||
/* In LyX/Mac, when a dialog is open, the menus of the
|
||||
@ -580,7 +588,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
case LFUN_BUFFER_UPDATE:
|
||||
case LFUN_BUFFER_VIEW:
|
||||
case LFUN_BUFFER_IMPORT:
|
||||
case LFUN_LYX_QUIT:
|
||||
case LFUN_TOC_VIEW:
|
||||
case LFUN_BUFFER_AUTO_SAVE:
|
||||
case LFUN_RECONFIGURE:
|
||||
@ -619,6 +626,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
case LFUN_BUFFER_NEXT:
|
||||
case LFUN_BUFFER_PREVIOUS:
|
||||
case LFUN_WINDOW_NEW:
|
||||
case LFUN_WINDOW_CLOSE:
|
||||
// these are handled in our dispatch()
|
||||
break;
|
||||
|
||||
@ -716,7 +724,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new);
|
||||
|
||||
void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
{
|
||||
BOOST_ASSERT(view());
|
||||
string const argument = to_utf8(cmd.argument());
|
||||
kb_action const action = cmd.action;
|
||||
|
||||
@ -744,6 +751,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_WORD_FIND_FORWARD:
|
||||
case LFUN_WORD_FIND_BACKWARD: {
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->view());
|
||||
static string last_search;
|
||||
string searched_string;
|
||||
|
||||
@ -765,15 +773,18 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_COMMAND_PREFIX:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->message(from_utf8(keyseq->printOptions()));
|
||||
break;
|
||||
|
||||
case LFUN_COMMAND_EXECUTE:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->getToolbars().display("minibuffer", true);
|
||||
lyx_view_->focus_command_buffer();
|
||||
break;
|
||||
|
||||
case LFUN_CANCEL:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->view());
|
||||
keyseq->reset();
|
||||
meta_fake_bit = key_modifier::none;
|
||||
if (view()->buffer())
|
||||
@ -788,6 +799,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_TOGGLE_READ_ONLY:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->view() && lyx_view_->buffer());
|
||||
if (lyx_view_->buffer()->lyxvc().inUse())
|
||||
lyx_view_->buffer()->lyxvc().toggleReadOnly();
|
||||
else
|
||||
@ -810,6 +822,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_WRITE:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
if (!lyx_view_->buffer()->isUnnamed()) {
|
||||
docstring const str = bformat(_("Saving document %1$s..."),
|
||||
makeDisplayPath(lyx_view_->buffer()->fileName()));
|
||||
@ -822,11 +835,13 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_WRITE_AS:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
writeAs(lyx_view_->buffer(), argument);
|
||||
updateFlags = Update::None;
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_RELOAD: {
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
docstring const file = makeDisplayPath(view()->buffer()->fileName(), 20);
|
||||
docstring text = bformat(_("Any changes will be lost. Are you sure "
|
||||
"you want to revert to the saved version of the document %1$s?"), file);
|
||||
@ -839,22 +854,27 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_BUFFER_UPDATE:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
Exporter::Export(lyx_view_->buffer(), argument, true);
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_VIEW:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
Exporter::preview(lyx_view_->buffer(), argument);
|
||||
break;
|
||||
|
||||
case LFUN_BUILD_PROGRAM:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
Exporter::Export(lyx_view_->buffer(), "program", true);
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_CHKTEX:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
lyx_view_->buffer()->runChktex();
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_EXPORT:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
if (argument == "custom")
|
||||
lyx_view_->getDialogs().show("sendto");
|
||||
else {
|
||||
@ -863,6 +883,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_EXPORT_CUSTOM: {
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
string format_name;
|
||||
string command = split(argument, format_name, ' ');
|
||||
Format const * format = formats.getFormat(format_name);
|
||||
@ -905,6 +926,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_BUFFER_PRINT: {
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
string target;
|
||||
string target_name;
|
||||
string command = split(split(argument, target, ' '),
|
||||
@ -1000,7 +1022,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_LYX_QUIT:
|
||||
if (view()->buffer()) {
|
||||
if (lyx_view_ && lyx_view_->view()->buffer()) {
|
||||
// save cursor Position for opened files to .lyx/session
|
||||
LyX::ref().session().saveFilePosition(lyx_view_->buffer()->fileName(),
|
||||
boost::tie(view()->cursor().pit(), view()->cursor().pos()) );
|
||||
@ -1011,6 +1033,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_TOC_VIEW: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
InsetCommandParams p("tableofcontents");
|
||||
string const data = InsetCommandMailer::params2string("toc", p);
|
||||
lyx_view_->getDialogs().show("toc", data, 0);
|
||||
@ -1026,6 +1049,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_HELP_OPEN: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
string const arg = argument;
|
||||
if (arg.empty()) {
|
||||
setErrorMessage(_("Missing argument"));
|
||||
@ -1045,6 +1069,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
|
||||
// --- version control -------------------------------
|
||||
case LFUN_VC_REGISTER:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
if (!ensureBufferClean(view()))
|
||||
break;
|
||||
if (!lyx_view_->buffer()->lyxvc().inUse()) {
|
||||
@ -1054,6 +1079,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_VC_CHECK_IN:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
if (!ensureBufferClean(view()))
|
||||
break;
|
||||
if (lyx_view_->buffer()->lyxvc().inUse()
|
||||
@ -1064,6 +1090,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_VC_CHECK_OUT:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
if (!ensureBufferClean(view()))
|
||||
break;
|
||||
if (lyx_view_->buffer()->lyxvc().inUse()
|
||||
@ -1074,46 +1101,56 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_VC_REVERT:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
lyx_view_->buffer()->lyxvc().revert();
|
||||
view()->reload();
|
||||
break;
|
||||
|
||||
case LFUN_VC_UNDO_LAST:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
lyx_view_->buffer()->lyxvc().undoLast();
|
||||
view()->reload();
|
||||
break;
|
||||
|
||||
// --- buffers ----------------------------------------
|
||||
case LFUN_BUFFER_SWITCH:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->setBuffer(theBufferList().getBuffer(argument));
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_NEXT:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->setBuffer(theBufferList().next(view()->buffer()));
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_PREVIOUS:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->setBuffer(theBufferList().previous(view()->buffer()));
|
||||
break;
|
||||
|
||||
case LFUN_FILE_NEW:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
newFile(view(), argument);
|
||||
break;
|
||||
|
||||
case LFUN_FILE_OPEN:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
open(argument);
|
||||
break;
|
||||
|
||||
case LFUN_DROP_LAYOUTS_CHOICE:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->getToolbars().openLayoutList();
|
||||
break;
|
||||
|
||||
case LFUN_MENU_OPEN:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->getMenubar().openByName(from_utf8(argument));
|
||||
break;
|
||||
|
||||
// --- lyxserver commands ----------------------------
|
||||
case LFUN_SERVER_GET_NAME:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
setMessage(from_utf8(lyx_view_->buffer()->fileName()));
|
||||
lyxerr[Debug::INFO] << "FNAME["
|
||||
<< lyx_view_->buffer()->fileName()
|
||||
@ -1126,6 +1163,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_SERVER_GOTO_FILE_ROW: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
string file_name;
|
||||
int row;
|
||||
istringstream is(argument);
|
||||
@ -1154,6 +1192,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_DIALOG_SHOW: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
string const name = cmd.getArg(0);
|
||||
string data = trim(to_utf8(cmd.argument()).substr(name.size()));
|
||||
|
||||
@ -1184,6 +1223,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
string const name = cmd.getArg(0);
|
||||
string data = trim(to_utf8(cmd.argument()).substr(name.size()));
|
||||
if (name == "bibitem" ||
|
||||
@ -1236,6 +1276,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_DIALOG_UPDATE: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
string const & name = argument;
|
||||
// Can only update a dialog connected to an existing inset
|
||||
InsetBase * inset = lyx_view_->getDialogs().getOpenInset(name);
|
||||
@ -1255,11 +1296,13 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_DIALOG_DISCONNECT_INSET:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->getDialogs().disconnect(argument);
|
||||
break;
|
||||
|
||||
|
||||
case LFUN_CITATION_INSERT: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
if (!argument.empty()) {
|
||||
// we can have one optional argument, delimited by '|'
|
||||
// citation-insert <key>|<text_before>
|
||||
@ -1283,6 +1326,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_BUFFER_CHILD_OPEN: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
string const filename =
|
||||
makeAbsPath(argument, lyx_view_->buffer()->filePath());
|
||||
// FIXME Should use bformat
|
||||
@ -1302,22 +1346,27 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_TOGGLE_CURSOR_FOLLOWS_SCROLLBAR:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
|
||||
break;
|
||||
|
||||
case LFUN_KEYMAP_OFF:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->view()->getIntl().keyMapOn(false);
|
||||
break;
|
||||
|
||||
case LFUN_KEYMAP_PRIMARY:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->view()->getIntl().keyMapPrim();
|
||||
break;
|
||||
|
||||
case LFUN_KEYMAP_SECONDARY:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->view()->getIntl().keyMapSec();
|
||||
break;
|
||||
|
||||
case LFUN_KEYMAP_TOGGLE:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->view()->getIntl().toggleKeyMap();
|
||||
break;
|
||||
|
||||
@ -1354,6 +1403,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_SCREEN_FONT_UPDATE:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
// handle the screen font changes.
|
||||
lyxrc.set_font_norm_type();
|
||||
theFontLoader().update();
|
||||
@ -1397,10 +1447,12 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_MESSAGE:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->message(from_utf8(argument));
|
||||
break;
|
||||
|
||||
case LFUN_EXTERNAL_EDIT: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
FuncRequest fr(action, argument);
|
||||
InsetExternal().dispatch(view()->cursor(), fr);
|
||||
break;
|
||||
@ -1413,6 +1465,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_INSET_APPLY: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
string const name = cmd.getArg(0);
|
||||
InsetBase * inset = lyx_view_->getDialogs().getOpenInset(name);
|
||||
if (inset) {
|
||||
@ -1429,6 +1482,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_ALL_INSETS_TOGGLE: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
string action;
|
||||
string const name = split(argument, action, ' ');
|
||||
InsetBase::Code const inset_code =
|
||||
@ -1453,6 +1507,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_BUFFER_LANGUAGE: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
Buffer & buffer = *lyx_view_->buffer();
|
||||
Language const * oldL = buffer.params().language;
|
||||
Language const * newL = languages.getLanguage(argument);
|
||||
@ -1495,6 +1550,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_BUFFER_PARAMS_APPLY: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
biblio::CiteEngine const engine =
|
||||
lyx_view_->buffer()->params().cite_engine;
|
||||
|
||||
@ -1526,6 +1582,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_TEXTCLASS_APPLY: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
Buffer * buffer = lyx_view_->buffer();
|
||||
|
||||
textclass_type const old_class =
|
||||
@ -1583,10 +1640,18 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_WINDOW_NEW:
|
||||
BOOST_ASSERT(theApp);
|
||||
LyX::ref().newLyXView();
|
||||
break;
|
||||
|
||||
case LFUN_WINDOW_CLOSE:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
BOOST_ASSERT(theApp);
|
||||
lyx_view_->close();
|
||||
// We return here because lyx_view does not exists anymore.
|
||||
return;
|
||||
|
||||
default: {
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
view()->cursor().dispatch(cmd);
|
||||
updateFlags = view()->cursor().result().update();
|
||||
if (!view()->cursor().result().dispatched())
|
||||
@ -1596,7 +1661,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
}
|
||||
|
||||
if (view()->buffer()) {
|
||||
if (lyx_view_ && view()->buffer()) {
|
||||
// Redraw screen unless explicitly told otherwise.
|
||||
// This also initializes the position cache for all insets
|
||||
// in (at least partially) visible top-level paragraphs.
|
||||
|
Loading…
Reference in New Issue
Block a user