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
|
|
|
|
|
2007-10-02 18:27:20 +00:00
|
|
|
|
#include "frontends/Delegates.h"
|
2007-11-12 23:23:19 +00:00
|
|
|
|
#include "support/strfwd.h"
|
2007-08-23 16:31:58 +00:00
|
|
|
|
|
2006-10-23 16:29:24 +00:00
|
|
|
|
#include <vector>
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
|
namespace support { class FileName; }
|
|
|
|
|
|
2001-07-03 15:19:04 +00:00
|
|
|
|
class Buffer;
|
2000-04-08 17:02:02 +00:00
|
|
|
|
class BufferView;
|
2007-08-14 09:54:59 +00:00
|
|
|
|
class FuncRequest;
|
|
|
|
|
class Inset;
|
2007-09-19 22:37:22 +00:00
|
|
|
|
class ToolbarInfo;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
|
class Dialogs;
|
|
|
|
|
class WorkArea;
|
2004-05-19 15:11:37 +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.
|
|
|
|
|
*/
|
2007-11-12 22:35:43 +00:00
|
|
|
|
class LyXView
|
|
|
|
|
: public GuiBufferViewDelegate, public GuiBufferDelegate
|
2007-10-02 18:27:20 +00:00
|
|
|
|
{
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
2007-09-19 21:28:11 +00:00
|
|
|
|
///
|
2007-11-12 23:23:19 +00:00
|
|
|
|
LyXView(int id) : id_(id) {}
|
2007-09-19 21:28:11 +00:00
|
|
|
|
///
|
2001-07-03 15:19:04 +00:00
|
|
|
|
virtual ~LyXView();
|
2007-09-19 21:28:11 +00:00
|
|
|
|
///
|
2007-09-16 10:36:57 +00:00
|
|
|
|
int id() const { return id_; }
|
2007-09-19 21:28:11 +00:00
|
|
|
|
///
|
2006-10-23 16:29:24 +00:00
|
|
|
|
virtual void close() = 0;
|
2007-09-19 21:28:11 +00:00
|
|
|
|
///
|
2006-12-23 17:09:50 +00:00
|
|
|
|
virtual void setFocus() = 0;
|
|
|
|
|
|
2007-08-21 07:33:46 +00:00
|
|
|
|
///
|
|
|
|
|
virtual WorkArea * workArea(Buffer & buffer) = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual WorkArea * addWorkArea(Buffer & buffer) = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual void setCurrentWorkArea(WorkArea * work_area) = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual void removeWorkArea(WorkArea * work_area) = 0;
|
2007-01-05 13:31:34 +00:00
|
|
|
|
/// return the current WorkArea (the one that has the focus).
|
2007-08-21 07:33:46 +00:00
|
|
|
|
virtual WorkArea const * currentWorkArea() const = 0;
|
2007-05-28 22:27:45 +00:00
|
|
|
|
/// FIXME: This non-const access is needed because of
|
2007-01-05 13:31:34 +00:00
|
|
|
|
/// a mis-designed \c ControlSpellchecker.
|
2007-08-21 07:33:46 +00:00
|
|
|
|
virtual WorkArea * currentWorkArea() = 0;
|
2007-01-05 13:31:34 +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.
|
|
|
|
|
*/
|
2006-09-29 23:10:17 +00:00
|
|
|
|
virtual void init() = 0;
|
|
|
|
|
|
2007-03-17 12:28:26 +00:00
|
|
|
|
enum Maximized {
|
|
|
|
|
NotMaximized,
|
|
|
|
|
VerticallyMaximized,
|
|
|
|
|
HorizontallyMaximized,
|
|
|
|
|
CompletelyMaximized
|
|
|
|
|
};
|
|
|
|
|
|
2006-10-23 16:29:24 +00:00
|
|
|
|
///
|
2006-09-29 23:10:17 +00:00
|
|
|
|
virtual void setGeometry(
|
|
|
|
|
unsigned int width,
|
|
|
|
|
unsigned int height,
|
|
|
|
|
int posx, int posy,
|
2007-03-17 12:28:26 +00:00
|
|
|
|
int maximize,
|
2006-11-29 16:45:38 +00:00
|
|
|
|
unsigned int iconSizeXY,
|
|
|
|
|
const std::string & geometryArg) = 0;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2006-10-23 16:29:24 +00:00
|
|
|
|
/// save the geometry state in the session manager.
|
|
|
|
|
virtual void saveGeometry() = 0;
|
|
|
|
|
|
2003-02-14 14:49:51 +00:00
|
|
|
|
/// show busy cursor
|
2007-10-23 21:41:17 +00:00
|
|
|
|
virtual void setBusy(bool) = 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
|
|
|
|
|
2007-08-21 07:33:46 +00:00
|
|
|
|
/// \return the current buffer view.
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual BufferView * view() = 0;
|
2000-07-25 10:46:18 +00:00
|
|
|
|
|
2007-08-21 07:33:46 +00:00
|
|
|
|
/// \return the buffer currently shown in this window
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual Buffer * buffer() = 0;
|
|
|
|
|
virtual Buffer const * buffer() const = 0;
|
|
|
|
|
/// set a buffer to the current workarea.
|
|
|
|
|
virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-08-13 14:40:38 +00:00
|
|
|
|
///
|
2007-10-01 20:45:50 +00:00
|
|
|
|
virtual void openLayoutList() = 0;
|
2007-08-23 12:21:47 +00:00
|
|
|
|
///
|
2007-10-01 20:45:50 +00:00
|
|
|
|
virtual bool isToolbarVisible(std::string const & id) = 0;
|
2007-08-23 12:21:47 +00:00
|
|
|
|
///
|
|
|
|
|
virtual void showMiniBuffer(bool visible) = 0;
|
2007-08-23 12:44:21 +00:00
|
|
|
|
virtual void openMenu(docstring const & name) = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/// get access to the dialogs
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual Dialogs & getDialogs() = 0;
|
2002-08-13 14:40:38 +00:00
|
|
|
|
///
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual Dialogs const & getDialogs() const = 0;
|
2000-06-12 11:27:15 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
//@}
|
|
|
|
|
|
2007-06-19 14:56:52 +00:00
|
|
|
|
/// load a buffer into the current workarea.
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
|
|
|
|
|
bool tolastfiles = true) = 0; ///< append to the "Open recent" menu?
|
2006-07-13 16:37:55 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// updates the possible layouts selectable
|
2007-11-10 00:21:42 +00:00
|
|
|
|
virtual void updateLayoutChoice(bool force) = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// update the toolbar
|
2007-10-01 20:45:50 +00:00
|
|
|
|
virtual void updateToolbars() = 0;
|
2007-07-09 20:33:32 +00:00
|
|
|
|
/// get toolbar info
|
2007-10-01 20:45:50 +00:00
|
|
|
|
virtual ToolbarInfo * getToolbarInfo(std::string const & name) = 0;
|
2006-11-02 16:01:36 +00:00
|
|
|
|
/// toggle toolbar state
|
2007-10-01 20:45:50 +00:00
|
|
|
|
virtual void toggleToolbarState(std::string const & name, bool allowauto) = 0;
|
2006-07-13 16:37:55 +00:00
|
|
|
|
/// update the status bar
|
|
|
|
|
virtual void updateStatusBar() = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// display a message in the view
|
2006-10-21 00:16:43 +00:00
|
|
|
|
virtual void message(docstring 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
|
|
|
|
/// reset autosave timer
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual void resetAutosaveTimer() = 0;
|
2002-06-12 11:34:13 +00:00
|
|
|
|
|
2002-08-13 17:43:40 +00:00
|
|
|
|
/// dispatch to current BufferView
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual void dispatch(FuncRequest const & cmd) = 0;
|
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.
|
|
|
|
|
*/
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual Buffer const * updateInset(Inset const *) = 0;
|
2003-10-14 21:30:23 +00:00
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
|
/// returns true if this view has the focus.
|
2004-11-16 10:46:23 +00:00
|
|
|
|
virtual bool hasFocus() const = 0;
|
|
|
|
|
|
2006-07-14 21:47:48 +00:00
|
|
|
|
/// show the error list to the user
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual void showErrorList(std::string const &) = 0;
|
2006-07-14 21:47:48 +00:00
|
|
|
|
|
2007-10-02 18:27:20 +00:00
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GuiBufferDelegate
|
|
|
|
|
//
|
|
|
|
|
/// This function is called when the buffer structure is changed.
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual void structureChanged() = 0;
|
2007-10-02 18:27:20 +00:00
|
|
|
|
/// This function is called when some parsing error shows up.
|
|
|
|
|
void errors(std::string const & err) { showErrorList(err); }
|
|
|
|
|
/// Reset autosave timers for all users.
|
|
|
|
|
void resetAutosaveTimers() { resetAutosaveTimer(); }
|
|
|
|
|
|
2006-09-19 13:36:20 +00:00
|
|
|
|
/// connect to signals in the given BufferView
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual void connectBufferView(BufferView & bv) = 0;
|
2006-09-19 13:36:20 +00:00
|
|
|
|
/// disconnect from signals in the given BufferView
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual void disconnectBufferView() = 0;
|
2007-08-21 07:33:46 +00:00
|
|
|
|
/// connect to signals in the given buffer
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual void connectBuffer(Buffer & buf) = 0;
|
2007-08-21 07:33:46 +00:00
|
|
|
|
/// disconnect from signals in the given buffer
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual void disconnectBuffer() = 0;
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
1999-10-25 14:18:30 +00:00
|
|
|
|
private:
|
2007-11-12 22:35:43 +00:00
|
|
|
|
/// noncopyable
|
|
|
|
|
LyXView(LyXView const &);
|
|
|
|
|
void operator=(LyXView const &);
|
|
|
|
|
|
2007-11-12 23:37:34 +00:00
|
|
|
|
///
|
2006-10-23 16:29:24 +00:00
|
|
|
|
int id_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
|
} // namespace frontend
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
#endif // LYXVIEW_H
|