4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjornes
9 * \author Abdelrazak Younes
10 * \author Peter Kümmel
12 * Full author contact details are available in file CREDITS.
18 #include "frontends/LyXView.h"
20 #include <QMainWindow>
24 class QDragEnterEvent;
38 QWidget * mainWindow();
41 * GuiView - Qt4 implementation of LyXView
43 * qt4-private implementation of the main LyX window.
45 * Note: a QObject emits a destroyed(QObject *) Qt signal when it
46 * is deleted. This might be useful for closing other dialogs
47 * depending on a given GuiView.
49 class GuiView : public QMainWindow, public LyXView
53 /// create a main window of the given dimensions
60 virtual void setFocus();
61 virtual void setGeometry(
66 unsigned int iconSizeXY,
67 const std::string & geometryArg);
68 /// save the geometry state in the session manager.
69 virtual void saveGeometry();
70 virtual void setBusy(bool);
71 /// add toolbar, if newline==true, add a toolbar break before the toolbar
72 GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline);
73 virtual void updateStatusBar();
74 virtual void message(docstring const & str);
75 virtual void clearMessage();
76 virtual bool hasFocus() const;
77 void showMiniBuffer(bool);
78 void openMenu(docstring const &);
79 void openLayoutList();
80 void updateLayoutChoice(bool force);
81 bool isToolbarVisible(std::string const & id);
82 void updateToolbars();
83 ToolbarInfo * getToolbarInfo(std::string const & name);
84 void toggleToolbarState(std::string const & name, bool allowauto);
86 /// show - display the top-level window
89 /// menu item has been selected
90 void activated(FuncRequest const &);
93 QMenu * createPopupMenu();
96 void addTabWorkArea();
98 /// dispatch to current BufferView
99 void dispatch(FuncRequest const & cmd);
101 /// \return the buffer currently shown in this window
103 Buffer const * buffer() const;
104 /// set a buffer to the current workarea.
105 void setBuffer(Buffer * b); ///< \c Buffer to set.
112 void update_view_state_qt();
115 void updateWindowTitle(GuiWorkArea * wa);
118 void on_currentWorkAreaChanged(GuiWorkArea *);
120 /// slots to change the icon size
121 void smallSizedIcons();
122 void normalSizedIcons();
123 void bigSizedIcons();
128 /// make sure we quit cleanly
129 virtual void closeEvent(QCloseEvent * e);
131 virtual void resizeEvent(QResizeEvent * e);
133 virtual void moveEvent(QMoveEvent * e);
135 /// \return the \c Workarea associated to \p Buffer
136 /// \retval 0 if no \c WorkArea is found.
137 GuiWorkArea * workArea(Buffer & buffer);
139 /// Add a \c WorkArea
140 /// \return the \c Workarea associated to \p Buffer
141 /// \retval 0 if no \c WorkArea is found.
142 GuiWorkArea * addWorkArea(Buffer & buffer);
144 void setCurrentWorkArea(GuiWorkArea * work_area);
146 void removeWorkArea(GuiWorkArea * work_area);
147 /// return the current WorkArea (the one that has the focus).
148 GuiWorkArea const * currentWorkArea() const;
149 /// FIXME: This non-const access is needed because of
150 /// a mis-designed \c ControlSpellchecker.
151 GuiWorkArea * currentWorkArea();
153 /// GuiBufferDelegate.
155 void resetAutosaveTimers();
156 void errors(std::string const &);
157 void structureChanged() { updateToc(); }
161 /// connect to signals in the given BufferView
162 void connectBufferView(BufferView & bv);
163 /// disconnect from signals in the given BufferView
164 void disconnectBufferView();
165 /// connect to signals in the given buffer
166 void connectBuffer(Buffer & buf);
167 /// disconnect from signals in the given buffer
168 void disconnectBuffer();
171 void showDialog(std::string const & name);
172 void showDialogWithData(std::string const & name,
173 std::string const & data);
174 void showInsetDialog(std::string const & name,
175 std::string const & data, Inset * inset);
176 void updateDialog(std::string const & name,
177 std::string const & data);
183 void dragEnterEvent(QDragEnterEvent * ev);
185 void dropEvent(QDropEvent * ev);
187 /// in order to catch Tab key press.
188 bool event(QEvent * e);
189 bool focusNextPrevChild(bool);
191 QRect updateFloatingGeometry();
192 /// called on timeout
195 void updateEmbeddedFiles();
197 /// \return the current buffer view.
200 /// get access to the dialogs
201 Dialogs & getDialogs() { return *dialogs_; }
203 Dialogs const & getDialogs() const { return *dialogs_; }
207 /// load a buffer into the current workarea.
208 Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
209 bool tolastfiles = true); ///< append to the "Open recent" menu?
211 /** redraw \c inset in all the BufferViews in which it is currently
212 * visible. If successful return a pointer to the owning Buffer.
214 Buffer const * updateInset(Inset const *);
216 void restartCursor();
221 struct GuiViewPrivate;
225 QTimer statusbar_timer_;
227 /// are we quitting by the menu?
228 bool quitting_by_menu_;
231 QRect floatingGeometry_;
233 void setIconSize(unsigned int size);
242 ToolbarSize toolbarSize_;
244 /// auto-saving of buffers
245 Timeout * const autosave_timeout_;
246 /// dialogs for this view
251 } // namespace frontend