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
|
|
|
|
|
2006-09-22 09:47:39 +00:00
|
|
|
|
#include "frontends/Application.h"
|
2007-10-02 18:27:20 +00:00
|
|
|
|
#include "frontends/Delegates.h"
|
2007-09-19 22:37:22 +00:00
|
|
|
|
#include "support/docstring.h"
|
2007-08-23 16:31:58 +00:00
|
|
|
|
|
2007-09-30 15:47:00 +00:00
|
|
|
|
#include <boost/noncopyable.hpp>
|
2002-05-29 16:21:03 +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; }
|
|
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
|
class Font;
|
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;
|
2002-02-18 19:13:48 +00:00
|
|
|
|
class Timeout;
|
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-10-02 18:27:20 +00:00
|
|
|
|
class LyXView : boost::noncopyable,
|
|
|
|
|
public GuiBufferViewDelegate, public GuiBufferDelegate
|
|
|
|
|
{
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
2007-09-19 21:28:11 +00:00
|
|
|
|
///
|
2006-10-23 16:29:24 +00:00
|
|
|
|
LyXView(int 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
|
2006-10-26 13:29:10 +00:00
|
|
|
|
virtual void busy(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.
|
|
|
|
|
BufferView * view();
|
2000-07-25 10:46:18 +00:00
|
|
|
|
|
2007-08-21 07:33:46 +00:00
|
|
|
|
/// \return the buffer currently shown in this window
|
|
|
|
|
Buffer * buffer();
|
|
|
|
|
Buffer const * buffer() const;
|
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-09-19 21:28:11 +00:00
|
|
|
|
Dialogs & getDialogs() { return *dialogs_; }
|
2002-08-13 14:40:38 +00:00
|
|
|
|
///
|
2007-09-19 21:28:11 +00:00
|
|
|
|
Dialogs const & getDialogs() const { return *dialogs_; }
|
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-08-21 07:33:46 +00:00
|
|
|
|
Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
|
|
|
|
|
bool tolastfiles = true); ///< append to the "Open recent" menu?
|
2007-06-19 14:56:52 +00:00
|
|
|
|
|
|
|
|
|
/// set a buffer to the current workarea.
|
2007-08-21 07:33:46 +00:00
|
|
|
|
void setBuffer(Buffer * b); ///< \c Buffer to set.
|
2006-07-13 16:37:55 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// updates the possible layouts selectable
|
2007-10-01 20:45:50 +00:00
|
|
|
|
virtual void updateLayoutChoice() = 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
|
|
|
|
/// 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.
|
|
|
|
|
*/
|
2007-09-16 10:36:57 +00:00
|
|
|
|
Buffer const * updateInset(Inset const *);
|
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
|
|
|
|
|
void showErrorList(std::string const &);
|
|
|
|
|
|
2007-10-02 18:27:20 +00:00
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GuiBufferDelegate
|
|
|
|
|
//
|
|
|
|
|
/// This function is called when the buffer structure is changed.
|
|
|
|
|
void structureChanged() { updateToc(); }
|
|
|
|
|
/// This function is called when an embedded file is changed
|
|
|
|
|
void embeddingChanged() { updateEmbeddedFiles(); }
|
|
|
|
|
/// This function is called when some parsing error shows up.
|
|
|
|
|
void errors(std::string const & err) { showErrorList(err); }
|
|
|
|
|
/// This function is called when the buffer busy status change.
|
|
|
|
|
//void busy(bool);
|
|
|
|
|
/// This function is called when the buffer readonly status change.
|
|
|
|
|
void readonly(bool on) { showReadonly(on); }
|
|
|
|
|
/// Update window titles of all users.
|
|
|
|
|
void updateTitles() { updateWindowTitle(); }
|
|
|
|
|
/// Reset autosave timers for all users.
|
|
|
|
|
void resetAutosaveTimers() { resetAutosaveTimer(); }
|
|
|
|
|
|
2006-09-19 13:36:20 +00:00
|
|
|
|
/// connect to signals in the given BufferView
|
|
|
|
|
void connectBufferView(BufferView & bv);
|
|
|
|
|
/// disconnect from signals in the given BufferView
|
|
|
|
|
void disconnectBufferView();
|
2007-08-21 07:33:46 +00:00
|
|
|
|
/// connect to signals in the given buffer
|
|
|
|
|
void connectBuffer(Buffer & buf);
|
|
|
|
|
/// disconnect from signals in the given buffer
|
|
|
|
|
void disconnectBuffer();
|
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
|
|
|
|
|
*/
|
2006-10-21 00:16:43 +00:00
|
|
|
|
virtual void setWindowTitle(docstring const & t, docstring const & it) = 0;
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
2002-08-13 14:40:38 +00:00
|
|
|
|
/// called on timeout
|
|
|
|
|
void autoSave();
|
|
|
|
|
|
|
|
|
|
/// auto-saving of buffers
|
2007-09-19 21:28:11 +00:00
|
|
|
|
Timeout * const autosave_timeout_;
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/// dialogs for this view
|
2007-09-19 21:28:11 +00:00
|
|
|
|
Dialogs * dialogs_;
|
2002-08-14 09:52:30 +00:00
|
|
|
|
|
2006-09-19 13:36:20 +00:00
|
|
|
|
/// Bind methods for BufferView messages signal connection
|
|
|
|
|
//@{
|
|
|
|
|
void showDialog(std::string const & name);
|
|
|
|
|
void showDialogWithData(std::string const & name,
|
|
|
|
|
std::string const & data);
|
|
|
|
|
void showInsetDialog(std::string const & name,
|
2007-04-29 13:39:47 +00:00
|
|
|
|
std::string const & data, Inset * inset);
|
2006-09-19 13:36:20 +00:00
|
|
|
|
void updateDialog(std::string const & name,
|
|
|
|
|
std::string const & data);
|
|
|
|
|
//@}
|
|
|
|
|
|
2006-07-14 21:47:48 +00:00
|
|
|
|
/// notify readonly status
|
|
|
|
|
void showReadonly(bool);
|
|
|
|
|
|
2002-08-14 09:52:30 +00:00
|
|
|
|
protected:
|
2007-03-12 11:23:41 +00:00
|
|
|
|
///
|
|
|
|
|
void updateToc();
|
2007-09-04 14:34:42 +00:00
|
|
|
|
///
|
|
|
|
|
void updateEmbeddedFiles();
|
2007-03-12 11:23:41 +00:00
|
|
|
|
|
2006-10-23 16:29:24 +00:00
|
|
|
|
private:
|
|
|
|
|
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
|