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
|
|
|
|
*
|
|
|
|
* \author Lars Gullik Bjornes <larsbj@lyx.org>
|
|
|
|
* \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-05-29 16:21:03 +00:00
|
|
|
#include <boost/signals/trackable.hpp>
|
|
|
|
|
2001-07-03 15:19:04 +00:00
|
|
|
class Buffer;
|
1999-09-27 18:44:28 +00:00
|
|
|
class Toolbar;
|
|
|
|
class MiniBuffer;
|
|
|
|
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;
|
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-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-06-12 11:34:13 +00:00
|
|
|
/// return the current buffer view
|
|
|
|
BufferView * 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 11:34:13 +00:00
|
|
|
/// return the minibuffer for this view
|
|
|
|
/// FIXME: I'm not at all sure that LyXFunc should be
|
|
|
|
/// aware of a mini buffer as such
|
|
|
|
MiniBuffer * getMiniBuffer() 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-06-12 11:34:13 +00:00
|
|
|
/// display a message in the view
|
|
|
|
void message(string const &);
|
|
|
|
/// push a message onto the history, and show it
|
|
|
|
void messagePush(string const & str);
|
|
|
|
/// pop the last message pushed
|
|
|
|
void messagePop();
|
|
|
|
/// show state (font etc.) in minibuffer
|
2000-07-20 11:39:14 +00:00
|
|
|
void showState();
|
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-06-12 02:54:19 +00:00
|
|
|
/// view of a buffer. Eventually there will be several.
|
|
|
|
boost::scoped_ptr<BufferView> bufferview_;
|
|
|
|
|
|
|
|
/// view's menubar
|
|
|
|
boost::scoped_ptr<Menubar> menubar_;
|
|
|
|
/// view's toolbar
|
|
|
|
boost::scoped_ptr<Toolbar> toolbar_;
|
|
|
|
/// view's minibuffer
|
|
|
|
boost::scoped_ptr<MiniBuffer> minibuffer_;
|
|
|
|
|
|
|
|
/// 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
|