1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file LyXView.h
|
|
|
|
|
* Copyright 1995-2002 the LyX Team
|
|
|
|
|
* Read the file COPYING
|
|
|
|
|
*
|
2002-08-02 09:21:50 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes <larsbj@lyx.org>
|
2002-06-12 02:54:19 +00:00
|
|
|
|
* \author John Levon <moz@compsoc.man.ac.uk>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef LYXVIEW_H
|
|
|
|
|
#define LYXVIEW_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
#include "LString.h"
|
2002-05-29 16:21:03 +00:00
|
|
|
|
|
2001-11-29 17:12:21 +00:00
|
|
|
|
#include "support/types.h"
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
|
#include <boost/utility.hpp>
|
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>
|
2002-05-29 16:21:03 +00:00
|
|
|
|
#include <boost/signals/trackable.hpp>
|
2002-07-17 04:13:41 +00:00
|
|
|
|
#include <boost/signals/signal0.hpp>
|
2002-05-29 16:21:03 +00:00
|
|
|
|
|
2001-07-03 15:19:04 +00:00
|
|
|
|
class Buffer;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
class Toolbar;
|
|
|
|
|
class Intl;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
class Menubar;
|
2002-07-19 20:56:31 +00:00
|
|
|
|
class ControlCommandBuffer;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
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;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
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
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// start modal operation
|
|
|
|
|
virtual void prohibitInput() const = 0;
|
|
|
|
|
/// end modal operation
|
|
|
|
|
virtual void allowInput() 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 LyX function handler for this view
|
2000-04-08 17:02:02 +00:00
|
|
|
|
LyXFunc * getLyXFunc() const;
|
1999-09-27 18:44:28 +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-06-12 11:34:13 +00:00
|
|
|
|
/// return the toolbar for this view
|
|
|
|
|
Toolbar * getToolbar() const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/// return the menubar for this view
|
2000-07-24 13:53:19 +00:00
|
|
|
|
Menubar * getMenubar() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/// get access to the dialogs
|
|
|
|
|
Dialogs * getDialogs() { 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
|
|
|
|
|
Intl * getIntl() const;
|
|
|
|
|
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
/// sets the layout in the toolbar layout selection
|
|
|
|
|
void setLayout(string const & layout);
|
|
|
|
|
/// 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
|
|
|
|
|
void updateToolbar();
|
|
|
|
|
/// 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)
|
|
|
|
|
boost::signal0<void> focus_command_buffer;
|
|
|
|
|
|
2002-07-17 04:13:41 +00:00
|
|
|
|
/// view state string changed
|
|
|
|
|
boost::signal0<void> view_state_changed;
|
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// display a message in the view
|
2002-07-19 20:56:31 +00:00
|
|
|
|
virtual void message(string const &) = 0;
|
2002-06-18 15:44:30 +00:00
|
|
|
|
|
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
|
|
|
|
|
2001-07-03 15:19:04 +00:00
|
|
|
|
protected:
|
2002-08-07 08:11:41 +00:00
|
|
|
|
/// view of a buffer. FuncRequestually 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_;
|
|
|
|
|
/// view's toolbar
|
|
|
|
|
boost::scoped_ptr<Toolbar> toolbar_;
|
2002-07-19 20:56:31 +00:00
|
|
|
|
/// view's command buffer controller
|
|
|
|
|
boost::scoped_ptr<ControlCommandBuffer> controlcommand_;
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
|
|
|
|
/// keyboard mapping object
|
|
|
|
|
boost::scoped_ptr<Intl> intl_;
|
|
|
|
|
|
|
|
|
|
/// auto-saving of buffers
|
|
|
|
|
boost::scoped_ptr<Timeout> autosave_timeout_;
|
|
|
|
|
|
|
|
|
|
/// called on timeout
|
2002-06-12 11:34:13 +00:00
|
|
|
|
void autoSave();
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
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
|
|
|
|
|
*/
|
|
|
|
|
virtual void setWindowTitle(string const & t, string const & it) = 0;
|
|
|
|
|
|
|
|
|
|
/// our function handler
|
|
|
|
|
boost::scoped_ptr<LyXFunc> lyxfunc_;
|
|
|
|
|
/// dialogs for this view
|
|
|
|
|
boost::scoped_ptr<Dialogs> dialogs_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
|
|
|
|
#endif // LYXVIEW_H
|