1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file LyXView.h
|
2002-09-05 15:14:23 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-06-12 02:54:19 +00:00
|
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-06-12 02:54:19 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef LYXVIEW_H
|
|
|
|
|
#define LYXVIEW_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2002-08-02 09:21:50 +00:00
|
|
|
|
#include <boost/shared_ptr.hpp>
|
2004-09-26 14:19:47 +00:00
|
|
|
|
#include <boost/signal.hpp>
|
2002-05-29 16:21:03 +00:00
|
|
|
|
#include <boost/signals/trackable.hpp>
|
2004-09-26 14:19:47 +00:00
|
|
|
|
#include <boost/utility.hpp>
|
2002-05-29 16:21:03 +00:00
|
|
|
|
|
2001-07-03 15:19:04 +00:00
|
|
|
|
class Buffer;
|
2004-04-29 09:54:59 +00:00
|
|
|
|
class Toolbars;
|
2004-04-13 13:10:33 +00:00
|
|
|
|
class InsetBase;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
class Intl;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
class Menubar;
|
|
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
|
class BufferView;
|
2000-06-12 11:27:15 +00:00
|
|
|
|
class Dialogs;
|
2001-07-03 15:19:04 +00:00
|
|
|
|
class LyXFunc;
|
2002-06-12 02:54:19 +00:00
|
|
|
|
class LyXFont;
|
2002-02-18 19:13:48 +00:00
|
|
|
|
class Timeout;
|
2002-08-13 17:43:40 +00:00
|
|
|
|
class FuncRequest;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
class ControlCommandBuffer;
|
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2002-05-29 16:21:03 +00:00
|
|
|
|
class LyXView : public boost::signals::trackable, boost::noncopyable {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
2002-06-12 11:34:13 +00:00
|
|
|
|
|
2001-07-03 15:19:04 +00:00
|
|
|
|
LyXView();
|
2002-06-12 11:34:13 +00:00
|
|
|
|
|
2001-07-03 15:19:04 +00:00
|
|
|
|
virtual ~LyXView();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-06-24 20:28:12 +00:00
|
|
|
|
/**
|
2002-06-18 15:44:30 +00:00
|
|
|
|
* This is called after the concrete view has been created.
|
|
|
|
|
* We have to have the toolbar and the other stuff created
|
|
|
|
|
* before we can populate it with this call.
|
|
|
|
|
*/
|
2002-06-12 11:34:13 +00:00
|
|
|
|
void init();
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2003-02-14 14:49:51 +00:00
|
|
|
|
/// show busy cursor
|
|
|
|
|
virtual void busy(bool) const = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
//@{ generic accessor functions
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-08-02 09:21:50 +00:00
|
|
|
|
/** return the current buffer view
|
|
|
|
|
Returned as a shared_ptr so that anything wanting to cache the
|
|
|
|
|
buffer view can do so safely using a boost::weak_ptr.
|
|
|
|
|
*/
|
|
|
|
|
boost::shared_ptr<BufferView> const & view() const;
|
2000-07-25 10:46:18 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// return the buffer currently shown in this window
|
|
|
|
|
Buffer * buffer() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-08-13 14:40:38 +00:00
|
|
|
|
/// return the LyX function handler for this view
|
2005-05-06 20:00:31 +00:00
|
|
|
|
LyXFunc & getLyXFunc() { return *lyxfunc_.get(); }
|
2002-08-13 14:40:38 +00:00
|
|
|
|
///
|
2005-05-06 20:00:31 +00:00
|
|
|
|
LyXFunc const & getLyXFunc() const { return *lyxfunc_.get(); }
|
2002-08-13 14:40:38 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// return the toolbar for this view
|
2004-04-29 09:54:59 +00:00
|
|
|
|
Toolbars & getToolbars() { return *toolbars_.get(); }
|
2002-08-13 14:40:38 +00:00
|
|
|
|
///
|
2004-09-27 20:52:39 +00:00
|
|
|
|
Toolbars const & getToolbars() const { return *toolbars_.get(); }
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/// return the menubar for this view
|
2002-08-13 14:40:38 +00:00
|
|
|
|
Menubar & getMenubar() { return *menubar_.get(); }
|
|
|
|
|
///
|
|
|
|
|
Menubar const & getMenubar() const { return *menubar_.get(); }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/// get access to the dialogs
|
2002-08-13 14:40:38 +00:00
|
|
|
|
Dialogs & getDialogs() { return *dialogs_.get(); }
|
|
|
|
|
///
|
|
|
|
|
Dialogs const & getDialogs() const { return *dialogs_.get(); }
|
2000-06-12 11:27:15 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// get this view's keyboard map handler
|
2002-08-13 14:40:38 +00:00
|
|
|
|
Intl & getIntl() { return *intl_.get(); }
|
|
|
|
|
///
|
|
|
|
|
Intl const & getIntl() const { return *intl_.get(); }
|
2002-06-12 11:34:13 +00:00
|
|
|
|
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
/// sets the layout in the toolbar layout selection
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void setLayout(std::string const & layout);
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// updates the possible layouts selectable
|
1999-09-27 18:44:28 +00:00
|
|
|
|
void updateLayoutChoice();
|
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// update the toolbar
|
2004-04-29 09:54:59 +00:00
|
|
|
|
void updateToolbars();
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// update the menubar
|
|
|
|
|
void updateMenubar();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
|
/// focus the command buffer (minibuffer)
|
2004-09-26 14:19:47 +00:00
|
|
|
|
boost::signal<void()> focus_command_buffer;
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2002-07-17 04:13:41 +00:00
|
|
|
|
/// view state string changed
|
2004-09-26 14:19:47 +00:00
|
|
|
|
boost::signal<void()> view_state_changed;
|
2002-07-17 04:13:41 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// display a message in the view
|
2003-10-06 15:43:21 +00:00
|
|
|
|
virtual void message(std::string const &) = 0;
|
2002-06-18 15:44:30 +00:00
|
|
|
|
|
2003-04-07 16:57:38 +00:00
|
|
|
|
/// clear any temporary message and replace with current status
|
|
|
|
|
virtual void clearMessage() = 0;
|
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// updates the title of the window
|
|
|
|
|
void updateWindowTitle();
|
2000-07-20 11:39:14 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// reset autosave timer
|
1999-09-27 18:44:28 +00:00
|
|
|
|
void resetAutosaveTimer();
|
2002-06-12 11:34:13 +00:00
|
|
|
|
|
2002-08-13 17:43:40 +00:00
|
|
|
|
/// dispatch to current BufferView
|
2004-01-15 17:34:44 +00:00
|
|
|
|
void dispatch(FuncRequest const & cmd);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2003-10-14 21:30:23 +00:00
|
|
|
|
/** redraw \c inset in all the BufferViews in which it is currently
|
|
|
|
|
* visible. If successful return a pointer to the owning Buffer.
|
|
|
|
|
*/
|
2004-04-13 13:10:33 +00:00
|
|
|
|
Buffer const * const updateInset(InsetBase const *) const;
|
2003-10-14 21:30:23 +00:00
|
|
|
|
|
2004-11-16 10:46:23 +00:00
|
|
|
|
// returns true if this view has the focus.
|
|
|
|
|
virtual bool hasFocus() const = 0;
|
|
|
|
|
|
2001-07-03 15:19:04 +00:00
|
|
|
|
protected:
|
2002-08-13 17:43:40 +00:00
|
|
|
|
/// view of a buffer. Eventually there will be several.
|
2002-08-02 09:21:50 +00:00
|
|
|
|
boost::shared_ptr<BufferView> bufferview_;
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
|
|
|
|
/// view's menubar
|
|
|
|
|
boost::scoped_ptr<Menubar> menubar_;
|
|
|
|
|
|
1999-10-25 14:18:30 +00:00
|
|
|
|
private:
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* setWindowTitle - set title of window
|
|
|
|
|
* @param t main window title
|
|
|
|
|
* @param it iconified (short) title
|
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
|
virtual void setWindowTitle(std::string const & t, std::string const & it) = 0;
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
2002-08-13 14:40:38 +00:00
|
|
|
|
/// called on timeout
|
|
|
|
|
void autoSave();
|
|
|
|
|
|
2004-04-29 09:54:59 +00:00
|
|
|
|
/// view's toolbar
|
|
|
|
|
boost::scoped_ptr<Toolbars> toolbars_;
|
2002-08-13 14:40:38 +00:00
|
|
|
|
/// keyboard mapping object
|
|
|
|
|
boost::scoped_ptr<Intl> const intl_;
|
|
|
|
|
/// auto-saving of buffers
|
|
|
|
|
boost::scoped_ptr<Timeout> const autosave_timeout_;
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/// our function handler
|
|
|
|
|
boost::scoped_ptr<LyXFunc> lyxfunc_;
|
|
|
|
|
/// dialogs for this view
|
|
|
|
|
boost::scoped_ptr<Dialogs> dialogs_;
|
2002-08-14 09:52:30 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
/// view's command buffer controller
|
|
|
|
|
// this has to be declared _after_ lyxfunc_ as its initialization depends
|
|
|
|
|
// on it!
|
2004-05-19 15:11:37 +00:00
|
|
|
|
typedef boost::scoped_ptr<lyx::frontend::ControlCommandBuffer>
|
|
|
|
|
CommandBufferPtr;
|
|
|
|
|
|
|
|
|
|
CommandBufferPtr const controlcommand_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
|
|
|
|
#endif // LYXVIEW_H
|