4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS.
16 #include "frontends/Application.h"
17 #include "frontends/Delegates.h"
18 #include "support/docstring.h"
24 namespace support { class FileName; }
40 * LyXView - main LyX window
42 * This class represents the main LyX window and provides
43 * accessor functions to its content.
45 * The eventual intention is that LyX will support a number
46 * of containing LyXViews. Currently a lot of code still
47 * relies on there being a single top-level view.
49 * Additionally we would like to support multiple views
50 * in a single LyXView.
53 : public GuiBufferViewDelegate, public GuiBufferDelegate
61 int id() const { return id_; }
63 virtual void close() = 0;
65 virtual void setFocus() = 0;
68 virtual WorkArea * workArea(Buffer & buffer) = 0;
70 virtual WorkArea * addWorkArea(Buffer & buffer) = 0;
72 virtual void setCurrentWorkArea(WorkArea * work_area) = 0;
74 virtual void removeWorkArea(WorkArea * work_area) = 0;
75 /// return the current WorkArea (the one that has the focus).
76 virtual WorkArea const * currentWorkArea() const = 0;
77 /// FIXME: This non-const access is needed because of
78 /// a mis-designed \c ControlSpellchecker.
79 virtual WorkArea * currentWorkArea() = 0;
82 * This is called after the concrete view has been created.
83 * We have to have the toolbar and the other stuff created
84 * before we can populate it with this call.
86 virtual void init() = 0;
91 HorizontallyMaximized,
96 virtual void setGeometry(
101 unsigned int iconSizeXY,
102 const std::string & geometryArg) = 0;
104 /// save the geometry state in the session manager.
105 virtual void saveGeometry() = 0;
108 virtual void setBusy(bool) = 0;
110 //@{ generic accessor functions
112 /// \return the current buffer view.
115 /// \return the buffer currently shown in this window
117 Buffer const * buffer() const;
120 virtual void openLayoutList() = 0;
122 virtual bool isToolbarVisible(std::string const & id) = 0;
124 virtual void showMiniBuffer(bool visible) = 0;
125 virtual void openMenu(docstring const & name) = 0;
127 /// get access to the dialogs
128 Dialogs & getDialogs() { return *dialogs_; }
130 Dialogs const & getDialogs() const { return *dialogs_; }
134 /// load a buffer into the current workarea.
135 Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
136 bool tolastfiles = true); ///< append to the "Open recent" menu?
138 /// set a buffer to the current workarea.
139 void setBuffer(Buffer * b); ///< \c Buffer to set.
141 /// updates the possible layouts selectable
142 virtual void updateLayoutChoice(bool force) = 0;
144 /// update the toolbar
145 virtual void updateToolbars() = 0;
147 virtual ToolbarInfo * getToolbarInfo(std::string const & name) = 0;
148 /// toggle toolbar state
149 virtual void toggleToolbarState(std::string const & name, bool allowauto) = 0;
150 /// update the status bar
151 virtual void updateStatusBar() = 0;
153 /// display a message in the view
154 virtual void message(docstring const &) = 0;
156 /// clear any temporary message and replace with current status
157 virtual void clearMessage() = 0;
159 /// reset autosave timer
160 void resetAutosaveTimer();
162 /// dispatch to current BufferView
163 void dispatch(FuncRequest const & cmd);
165 /** redraw \c inset in all the BufferViews in which it is currently
166 * visible. If successful return a pointer to the owning Buffer.
168 Buffer const * updateInset(Inset const *);
170 /// returns true if this view has the focus.
171 virtual bool hasFocus() const = 0;
173 /// show the error list to the user
174 void showErrorList(std::string const &);
180 /// This function is called when the buffer structure is changed.
181 void structureChanged() { updateToc(); }
182 /// This function is called when some parsing error shows up.
183 void errors(std::string const & err) { showErrorList(err); }
184 /// Reset autosave timers for all users.
185 void resetAutosaveTimers() { resetAutosaveTimer(); }
187 /// connect to signals in the given BufferView
188 void connectBufferView(BufferView & bv);
189 /// disconnect from signals in the given BufferView
190 void disconnectBufferView();
191 /// connect to signals in the given buffer
192 void connectBuffer(Buffer & buf);
193 /// disconnect from signals in the given buffer
194 void disconnectBuffer();
198 LyXView(LyXView const &);
199 void operator=(LyXView const &);
201 /// called on timeout
204 /// auto-saving of buffers
205 Timeout * const autosave_timeout_;
206 /// dialogs for this view
209 /// Bind methods for BufferView messages signal connection
211 void showDialog(std::string const & name);
212 void showDialogWithData(std::string const & name,
213 std::string const & data);
214 void showInsetDialog(std::string const & name,
215 std::string const & data, Inset * inset);
216 void updateDialog(std::string const & name,
217 std::string const & data);
224 void updateEmbeddedFiles();
230 } // namespace frontend