From d77a22e2f934054c0dbd1f611071b55467a63e90 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 9 Feb 2010 17:06:40 +0000 Subject: [PATCH] Today is a sad day, LyXView has passed over... long live GuiView! git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33393 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/scons/scons_manifest.py | 1 - src/Buffer.cpp | 2 +- src/LyX.h | 4 -- src/Server.cpp | 2 +- src/frontends/Application.h | 14 ++--- src/frontends/LyXView.h | 91 ---------------------------- src/frontends/Makefile.am | 1 - src/frontends/WorkArea.h | 1 - src/frontends/qt4/Dialog.h | 2 +- src/frontends/qt4/GuiApplication.cpp | 12 +--- src/frontends/qt4/GuiApplication.h | 4 +- src/frontends/qt4/GuiView.cpp | 2 +- src/frontends/qt4/GuiView.h | 44 +++++++++++--- src/frontends/qt4/GuiWorkArea.h | 2 +- 14 files changed, 51 insertions(+), 131 deletions(-) delete mode 100644 src/frontends/LyXView.h diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index 0846246f76..61161b9533 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -653,7 +653,6 @@ src_frontends_header_files = Split(''' FontMetrics.h KeyModifier.h KeySymbol.h - LyXView.h mouse_state.h Painter.h Selection.h diff --git a/src/Buffer.cpp b/src/Buffer.cpp index c2072f8716..b2b0be1836 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -971,7 +971,7 @@ Buffer::ReadStatus Buffer::readFile(Lexer & lex, FileName const & filename, } -// Should probably be moved to somewhere else: BufferView? LyXView? +// Should probably be moved to somewhere else: BufferView? GuiView? bool Buffer::save() const { // We don't need autosaves in the immediate future. (Asger) diff --git a/src/LyX.h b/src/LyX.h index e9843eb399..f4b7a62241 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -38,7 +38,6 @@ extern bool use_gui; namespace frontend { class Application; -class LyXView; } namespace graphics { @@ -55,9 +54,6 @@ public: /// Execute LyX. int exec(int & argc, char * argv[]); - /// - frontend::LyXView * newLyXView(); - private: /// noncopyable LyX(LyX const &); diff --git a/src/Server.cpp b/src/Server.cpp index decea8ba62..7f514f19b3 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -1110,7 +1110,7 @@ void Server::callback(string const & msg) // The correct solution would be to have a // specialized (non-gui) BufferView. But how do // we do it now? Probably we should just let it - // connect to the lyxfunc in the single LyXView we + // connect to the lyxfunc in the single GuiView we // support currently. (Lgb) FuncRequest const fr(lyxaction.lookupFunc(cmd), arg); diff --git a/src/frontends/Application.h b/src/frontends/Application.h index 763bbeac67..5e1a12cdca 100644 --- a/src/frontends/Application.h +++ b/src/frontends/Application.h @@ -39,8 +39,6 @@ namespace frontend { class Clipboard; class FontLoader; -class Gui; -class LyXView; class Selection; /// The main application class @@ -59,7 +57,7 @@ initialisation should be done before the instanciation of this class. Application (this is the frontend really, should probably be renamed). | - LyXView-1 (one or more in case of split-view mode). + GuiView-1 (one or more in case of split-view mode). | | | | | | @@ -77,7 +75,7 @@ initialisation should be done before the instanciation of this class. | | | | - LyXView-2 (one or more in case of split-view mode). + GuiView-2 (one or more in case of split-view mode). | | | | | | @@ -136,14 +134,14 @@ initialisation should be done before the instanciation of this class. - etc. - 4) The Window: \c LyXView (and its qt4 specialisation \c GuiView) + 4) The Window: \c GuiView This is a full window containing a menubar, toolbars and a central - widget. A LyXView is in charge of creating and closing a View for a + widget. A GuiView is in charge of creating and closing a View for a given Buffer. In the qt4 specialisation, \c GuiView, the central widget is a tab widget. Each tab is reverved to the visualisation of one Buffer and - contains one WorkArea. In the qt4 frontend, one LyXView thus contains + contains one WorkArea. In the qt4 frontend, one GuiView thus contains multiple WorkAreas but this number can limited to one for another frontend. The idea is that the kernel should not know how a Buffer is displayed on screen; it's the frontend business. @@ -171,8 +169,6 @@ public: Application() {} /// virtual ~Application() {} - /// - virtual LyXView * currentWindow() = 0; /// LyX dispatcher: executes lyx actions and does necessary /// screen updates depending on results. diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h deleted file mode 100644 index 49d3619ffd..0000000000 --- a/src/frontends/LyXView.h +++ /dev/null @@ -1,91 +0,0 @@ -// -*- C++ -*- -/** - * \file LyXView.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Lars Gullik Bjønnes - * \author John Levon - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef LYXVIEW_H -#define LYXVIEW_H - -#include "support/strfwd.h" - -namespace lyx { - -namespace support { class FileName; } - -class Buffer; -class BufferView; -class Cursor; -class DispatchResult; -class FuncStatus; -class FuncRequest; -class Inset; - -namespace frontend { - -/** - * LyXView - main LyX window - * - * This class represents the main LyX window and provides - * accessor functions to its content. - * - * The eventual intention is that LyX will support a number - * of containing LyXViews. Currently a lot of code still - * relies on there being a single top-level view. - * - * Additionally we would like to support multiple views - * in a single LyXView. - */ -class LyXView -{ -public: - /// - virtual ~LyXView() {} - - /// \name Generic accessor functions - //@{ - /// The current BufferView refers to the BufferView that has the focus, - /// including for example the one that is created when you use the - /// advanced search and replace pane. - /// \return the currently selected buffer view. - virtual BufferView * currentBufferView() = 0; - virtual BufferView const * currentBufferView() const = 0; - - /// The document BufferView always refers to the view's main document - /// BufferView. So, even if the BufferView in e.g., the advanced - /// search and replace pane has the focus. - /// \return the current document buffer view. - virtual BufferView * documentBufferView() = 0; - virtual BufferView const * documentBufferView() const = 0; - //@} - - /// display a message in the view - virtual void message(docstring const &) = 0; - - /// - virtual bool getStatus(FuncRequest const & cmd, FuncStatus & flag) = 0; - /// dispatch command. - /// \return true if the \c FuncRequest has been dispatched. - virtual void dispatch(FuncRequest const & cmd, DispatchResult & dr) = 0; - - /// - virtual void restartCursor() = 0; - - /// Update the completion popup and the inline completion state. - /// If \c start is true, then a new completion might be started. - /// If \c keep is true, an active completion will be kept active - /// even though the cursor moved. The update flags of \c cur might - /// be changed. - virtual void updateCompletion(Cursor & cur, bool start, bool keep) = 0; -}; - -} // namespace frontend -} // namespace lyx - -#endif // LYXVIEW_H diff --git a/src/frontends/Makefile.am b/src/frontends/Makefile.am index 7dedcda8b6..ea0f09793f 100644 --- a/src/frontends/Makefile.am +++ b/src/frontends/Makefile.am @@ -16,7 +16,6 @@ liblyxfrontends_a_SOURCES = \ Delegates.h \ KeyModifier.h \ KeySymbol.h \ - LyXView.h \ Painter.h \ Clipboard.h \ Selection.h \ diff --git a/src/frontends/WorkArea.h b/src/frontends/WorkArea.h index c5aadfef6f..8e459ca375 100644 --- a/src/frontends/WorkArea.h +++ b/src/frontends/WorkArea.h @@ -15,7 +15,6 @@ #define BASE_WORKAREA_H #include "frontends/KeyModifier.h" -#include "frontends/LyXView.h" namespace lyx { diff --git a/src/frontends/qt4/Dialog.h b/src/frontends/qt4/Dialog.h index 304cd7d56b..1fd0500636 100644 --- a/src/frontends/qt4/Dialog.h +++ b/src/frontends/qt4/Dialog.h @@ -287,7 +287,7 @@ protected: private: /** The Dialog's name is the means by which a dialog identifies - * itself to the LyXView. + * itself to the GuiView. */ QString const name_; /// diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 8d7ce812b1..9b205ad09b 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -826,12 +826,6 @@ docstring GuiApplication::iconName(FuncRequest const & f, bool unknown) } -LyXView * GuiApplication::currentWindow() -{ - return current_view_; -} - - FuncStatus GuiApplication::getStatus(FuncRequest const & cmd) const { FuncStatus flag; @@ -857,7 +851,7 @@ FuncStatus GuiApplication::getStatus(FuncRequest const & cmd) const switch (cmd.action) { // This could be used for the no-GUI version. The GUI version is handled in - // LyXView::getStatus(). See above. + // GuiView::getStatus(). See above. /* case LFUN_BUFFER_WRITE: case LFUN_BUFFER_WRITE_AS: { @@ -1082,7 +1076,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd) void GuiApplication::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer) { - LyXView * lv = current_view_; + GuiView * lv = current_view_; LASSERT(lv, /**/); if (!theSession().bookmarks().isValid(idx)) return; @@ -1551,7 +1545,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr) if (lv == 0) return; - // Let the current LyXView dispatch its own actions. + // Let the current GuiView dispatch its own actions. lv->dispatch(cmd, dr); if (dr.dispatched() && lv ) return; diff --git a/src/frontends/qt4/GuiApplication.h b/src/frontends/qt4/GuiApplication.h index bc4cc17754..5355f9bd85 100644 --- a/src/frontends/qt4/GuiApplication.h +++ b/src/frontends/qt4/GuiApplication.h @@ -33,7 +33,6 @@ class KeySymbol; namespace frontend { class GuiView; -class LyXView; class GlobalMenuBar; class GuiWorkArea; class Menus; @@ -61,7 +60,6 @@ public: void dispatch(FuncRequest const &); void dispatch(FuncRequest const &, DispatchResult & dr); FuncStatus getStatus(FuncRequest const & cmd) const; - LyXView * currentWindow(); void dispatchDelayed(FuncRequest const &); void resetGui(); void restoreGuiSession(); @@ -161,7 +159,7 @@ private: /// void setGuiLanguage(); - /// This LyXView is the one receiving Clipboard and Selection + /// This GuiView is the one receiving Clipboard and Selection /// events GuiView * current_view_; diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 110ce63f11..5b3b72d6bc 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -3272,7 +3272,7 @@ bool isValidName(string const & name) void GuiView::resetDialogs() { - // Make sure that no LFUN uses any LyXView. + // Make sure that no LFUN uses any GuiView. guiApp->setCurrentView(0); saveLayout(); menuBar()->clear(); diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 6b1416e341..b77c3ad131 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -16,7 +16,6 @@ #define GUI_VIEW_H #include "frontends/Delegates.h" -#include "frontends/LyXView.h" #include "support/strfwd.h" @@ -31,7 +30,15 @@ class QShowEvent; namespace lyx { +namespace support { class FileName; } + +class Buffer; +class BufferView; class Cursor; +class DispatchResult; +class FuncStatus; +class FuncRequest; +class Inset; namespace frontend { @@ -44,15 +51,16 @@ class TocModels; class ToolbarInfo; /** - * GuiView - Qt4 implementation of LyXView + * GuiView - Qt4 main LyX window * - * qt4-private implementation of the main LyX window. + * This class represents the main LyX window and provides + * accessor functions to its content. * * Note: a QObject emits a destroyed(QObject *) Qt signal when it * is deleted. This might be useful for closing other dialogs * depending on a given GuiView. */ -class GuiView : public QMainWindow, public LyXView, public GuiBufferViewDelegate, +class GuiView : public QMainWindow, public GuiBufferViewDelegate, public GuiBufferDelegate { Q_OBJECT @@ -62,28 +70,50 @@ public: ~GuiView(); - /// \name LyXView inherited methods. - //@{ int id() const { return id_; } + void setBusy(bool); + + /// \name Generic accessor functions + //@{ + /// The current BufferView refers to the BufferView that has the focus, + /// including for example the one that is created when you use the + /// advanced search and replace pane. + /// \return the currently selected buffer view. BufferView * currentBufferView(); BufferView const * currentBufferView() const; + + /// The document BufferView always refers to the view's main document + /// BufferView. So, even if the BufferView in e.g., the advanced + /// search and replace pane has the focus. + /// \return the current document buffer view. BufferView * documentBufferView(); BufferView const * documentBufferView() const; + void newDocument(std::string const & filename, bool fromTemplate); + /// display a message in the view /// could be called from any thread void message(docstring const &); /// must be called from GUI thread void updateMessage(QString const & str); bool getStatus(FuncRequest const & cmd, FuncStatus & flag); + /// dispatch command. + /// \return true if the \c FuncRequest has been dispatched. void dispatch(FuncRequest const & cmd, DispatchResult & dr); + void restartCursor(); + /// Update the completion popup and the inline completion state. + /// If \c start is true, then a new completion might be started. + /// If \c keep is true, an active completion will be kept active + /// even though the cursor moved. The update flags of \c cur might + /// be changed. void updateCompletion(Cursor & cur, bool start, bool keep); + + /// void setFocus(); - //@} /// void focusInEvent(QFocusEvent * e); diff --git a/src/frontends/qt4/GuiWorkArea.h b/src/frontends/qt4/GuiWorkArea.h index 4ec0af11a9..d4a081898f 100644 --- a/src/frontends/qt4/GuiWorkArea.h +++ b/src/frontends/qt4/GuiWorkArea.h @@ -117,7 +117,7 @@ public: void setGuiView(GuiView &); /// void setFullScreen(bool full_screen); - /// is LyXView in fullscreen mode? + /// is GuiView in fullscreen mode? bool isFullScreen(); /// void scheduleRedraw() { schedule_redraw_ = true; }