2006-03-05 17:24:44 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
2006-06-20 09:33:01 +00:00
|
|
|
|
* \file GuiView.h
|
2006-03-05 17:24:44 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bjornes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Abdelrazak Younes
|
2006-11-29 10:04:35 +00:00
|
|
|
|
* \author Peter K<EFBFBD>mmel
|
2006-03-05 17:24:44 +00:00
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
|
#ifndef GUI_VIEW_H
|
|
|
|
|
#define GUI_VIEW_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
#include "frontends/LyXView.h"
|
|
|
|
|
|
2007-08-14 13:20:16 +00:00
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
#include <QTimer>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-11-12 23:23:19 +00:00
|
|
|
|
class QCloseEvent;
|
2007-08-14 13:20:16 +00:00
|
|
|
|
class QDragEnterEvent;
|
|
|
|
|
class QDropEvent;
|
2006-11-08 23:10:46 +00:00
|
|
|
|
class QMenu;
|
2007-11-12 23:23:19 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
2007-11-12 23:23:19 +00:00
|
|
|
|
|
|
|
|
|
class Timeout;
|
2007-11-13 14:49:50 +00:00
|
|
|
|
class ToolbarInfo;
|
2007-11-12 23:23:19 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-10-01 20:45:50 +00:00
|
|
|
|
class GuiToolbar;
|
2007-10-06 15:48:58 +00:00
|
|
|
|
class GuiWorkArea;
|
2007-10-01 20:45:50 +00:00
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
QWidget * mainWindow();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2006-06-20 09:33:01 +00:00
|
|
|
|
* GuiView - Qt4 implementation of LyXView
|
2006-03-05 17:24:44 +00:00
|
|
|
|
*
|
2006-06-26 16:55:35 +00:00
|
|
|
|
* qt4-private implementation of the main LyX window.
|
2006-10-24 15:01:07 +00:00
|
|
|
|
*
|
2007-08-31 05:53:55 +00:00
|
|
|
|
* Note: a QObject emits a destroyed(QObject *) Qt signal when it
|
|
|
|
|
* is deleted. This might be useful for closing other dialogs
|
|
|
|
|
* depending on a given GuiView.
|
2006-03-05 17:24:44 +00:00
|
|
|
|
*/
|
2007-11-05 13:52:37 +00:00
|
|
|
|
class GuiView : public QMainWindow, public LyXView
|
2007-09-05 20:33:29 +00:00
|
|
|
|
{
|
2006-03-05 17:24:44 +00:00
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2006-06-26 16:55:35 +00:00
|
|
|
|
/// create a main window of the given dimensions
|
2007-11-05 13:52:37 +00:00
|
|
|
|
GuiView(int id);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-11-05 13:52:37 +00:00
|
|
|
|
~GuiView();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
|
virtual void init();
|
2006-10-23 16:29:24 +00:00
|
|
|
|
virtual void close();
|
2006-12-23 17:09:50 +00:00
|
|
|
|
virtual void setFocus();
|
2006-09-29 23:10:17 +00:00
|
|
|
|
virtual void setGeometry(
|
|
|
|
|
unsigned int width,
|
|
|
|
|
unsigned int height,
|
|
|
|
|
int posx, int posy,
|
2007-11-13 10:31:37 +00:00
|
|
|
|
Maximized maximized,
|
2006-11-29 16:45:38 +00:00
|
|
|
|
unsigned int iconSizeXY,
|
|
|
|
|
const std::string & geometryArg);
|
2007-11-13 09:52:28 +00:00
|
|
|
|
/// save the geometry state in the session manager.
|
2006-10-23 16:29:24 +00:00
|
|
|
|
virtual void saveGeometry();
|
2007-10-23 21:41:17 +00:00
|
|
|
|
virtual void setBusy(bool);
|
2007-01-31 02:39:46 +00:00
|
|
|
|
/// add toolbar, if newline==true, add a toolbar break before the toolbar
|
2007-10-01 20:45:50 +00:00
|
|
|
|
GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline);
|
2006-10-23 16:29:24 +00:00
|
|
|
|
virtual void updateStatusBar();
|
2007-04-25 16:39:21 +00:00
|
|
|
|
virtual void message(docstring const & str);
|
2006-10-23 16:29:24 +00:00
|
|
|
|
virtual bool hasFocus() const;
|
2007-08-23 12:21:47 +00:00
|
|
|
|
void showMiniBuffer(bool);
|
2007-11-10 00:21:42 +00:00
|
|
|
|
void updateLayoutChoice(bool force);
|
2007-10-01 20:45:50 +00:00
|
|
|
|
bool isToolbarVisible(std::string const & id);
|
|
|
|
|
void updateToolbars();
|
2007-11-12 23:23:19 +00:00
|
|
|
|
///
|
|
|
|
|
QMenu * createPopupMenu();
|
2006-11-08 23:10:46 +00:00
|
|
|
|
|
2007-11-12 23:23:19 +00:00
|
|
|
|
/// dispatch to current BufferView
|
|
|
|
|
void dispatch(FuncRequest const & cmd);
|
|
|
|
|
|
|
|
|
|
/// \return the buffer currently shown in this window
|
|
|
|
|
Buffer * buffer();
|
|
|
|
|
Buffer const * buffer() const;
|
|
|
|
|
/// set a buffer to the current workarea.
|
|
|
|
|
void setBuffer(Buffer * b); ///< \c Buffer to set.
|
|
|
|
|
|
2007-11-13 14:04:32 +00:00
|
|
|
|
/// GuiBufferDelegate.
|
|
|
|
|
///@{
|
|
|
|
|
void resetAutosaveTimers();
|
|
|
|
|
void errors(std::string const &);
|
|
|
|
|
void structureChanged() { updateToc(); }
|
|
|
|
|
///@}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-11-13 14:04:32 +00:00
|
|
|
|
////
|
|
|
|
|
void showDialog(std::string const & name);
|
|
|
|
|
void showDialogWithData(std::string const & name,
|
|
|
|
|
std::string const & data);
|
|
|
|
|
void showInsetDialog(std::string const & name,
|
|
|
|
|
std::string const & data, Inset * inset);
|
|
|
|
|
void updateDialog(std::string const & name,
|
|
|
|
|
std::string const & data);
|
|
|
|
|
|
|
|
|
|
/// called on timeout
|
|
|
|
|
void autoSave();
|
2007-11-11 22:30:21 +00:00
|
|
|
|
///
|
2007-11-13 14:04:32 +00:00
|
|
|
|
void updateEmbeddedFiles();
|
2007-11-11 22:30:21 +00:00
|
|
|
|
|
2007-11-13 14:04:32 +00:00
|
|
|
|
/// \return the current buffer view.
|
|
|
|
|
BufferView * view();
|
2006-10-31 14:12:46 +00:00
|
|
|
|
|
2007-11-13 14:04:32 +00:00
|
|
|
|
/// get access to the dialogs
|
|
|
|
|
Dialogs & getDialogs() { return *dialogs_; }
|
|
|
|
|
///
|
|
|
|
|
Dialogs const & getDialogs() const { return *dialogs_; }
|
2006-11-29 10:04:35 +00:00
|
|
|
|
|
2007-11-13 14:04:32 +00:00
|
|
|
|
/// load a buffer into the current workarea.
|
|
|
|
|
Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
|
|
|
|
|
bool tolastfiles = true); ///< append to the "Open recent" menu?
|
2007-11-13 09:52:28 +00:00
|
|
|
|
|
2007-11-13 14:04:32 +00:00
|
|
|
|
/** redraw \c inset in all the BufferViews in which it is currently
|
|
|
|
|
* visible. If successful return a pointer to the owning Buffer.
|
|
|
|
|
*/
|
|
|
|
|
Buffer const * updateInset(Inset const *);
|
2006-06-21 10:30:32 +00:00
|
|
|
|
///
|
2007-11-13 14:04:32 +00:00
|
|
|
|
void restartCursor();
|
2006-06-21 10:30:32 +00:00
|
|
|
|
|
2007-08-21 07:33:46 +00:00
|
|
|
|
/// \return the \c Workarea associated to \p Buffer
|
|
|
|
|
/// \retval 0 if no \c WorkArea is found.
|
2007-11-13 09:52:28 +00:00
|
|
|
|
GuiWorkArea * workArea(Buffer & buffer);
|
2007-08-21 07:33:46 +00:00
|
|
|
|
|
|
|
|
|
/// Add a \c WorkArea
|
|
|
|
|
/// \return the \c Workarea associated to \p Buffer
|
|
|
|
|
/// \retval 0 if no \c WorkArea is found.
|
2007-11-13 09:52:28 +00:00
|
|
|
|
GuiWorkArea * addWorkArea(Buffer & buffer);
|
2007-11-12 23:23:19 +00:00
|
|
|
|
///
|
2007-11-13 09:52:28 +00:00
|
|
|
|
void setCurrentWorkArea(GuiWorkArea * work_area);
|
2007-11-12 23:23:19 +00:00
|
|
|
|
///
|
2007-11-13 09:52:28 +00:00
|
|
|
|
void removeWorkArea(GuiWorkArea * work_area);
|
|
|
|
|
/// return the current WorkArea (the one that has the focus).
|
|
|
|
|
GuiWorkArea const * currentWorkArea() const;
|
|
|
|
|
|
2007-11-13 14:04:32 +00:00
|
|
|
|
Q_SIGNALS:
|
|
|
|
|
void closing(int);
|
2007-11-13 09:52:28 +00:00
|
|
|
|
|
2007-11-13 14:04:32 +00:00
|
|
|
|
public Q_SLOTS:
|
|
|
|
|
/// idle timeout.
|
|
|
|
|
/// clear any temporary message and replace with current status.
|
|
|
|
|
void clearMessage();
|
|
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
|
///
|
|
|
|
|
void updateWindowTitle(GuiWorkArea * wa);
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void on_currentWorkAreaChanged(GuiWorkArea *);
|
|
|
|
|
|
|
|
|
|
/// slots to change the icon size
|
|
|
|
|
void smallSizedIcons();
|
|
|
|
|
void normalSizedIcons();
|
|
|
|
|
void bigSizedIcons();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
///
|
|
|
|
|
void addTabWorkArea();
|
2007-11-13 09:52:28 +00:00
|
|
|
|
|
|
|
|
|
/// connect to signals in the given BufferView
|
2007-11-12 23:23:19 +00:00
|
|
|
|
void connectBufferView(BufferView & bv);
|
2007-11-13 09:52:28 +00:00
|
|
|
|
/// disconnect from signals in the given BufferView
|
2007-11-12 23:23:19 +00:00
|
|
|
|
void disconnectBufferView();
|
2007-11-13 09:52:28 +00:00
|
|
|
|
/// connect to signals in the given buffer
|
|
|
|
|
void connectBuffer(Buffer & buf);
|
|
|
|
|
/// disconnect from signals in the given buffer
|
|
|
|
|
void disconnectBuffer();
|
2007-11-12 23:23:19 +00:00
|
|
|
|
///
|
|
|
|
|
void updateToc();
|
2007-08-14 13:14:47 +00:00
|
|
|
|
///
|
|
|
|
|
void dragEnterEvent(QDragEnterEvent * ev);
|
|
|
|
|
///
|
|
|
|
|
void dropEvent(QDropEvent * ev);
|
2007-11-13 14:04:32 +00:00
|
|
|
|
/// make sure we quit cleanly
|
|
|
|
|
virtual void closeEvent(QCloseEvent * e);
|
|
|
|
|
///
|
|
|
|
|
virtual void resizeEvent(QResizeEvent * e);
|
|
|
|
|
///
|
|
|
|
|
virtual void moveEvent(QMoveEvent * e);
|
2007-08-14 13:14:47 +00:00
|
|
|
|
|
2006-12-20 21:28:05 +00:00
|
|
|
|
/// in order to catch Tab key press.
|
|
|
|
|
bool event(QEvent * e);
|
2006-12-22 16:13:19 +00:00
|
|
|
|
bool focusNextPrevChild(bool);
|
2007-11-12 22:15:51 +00:00
|
|
|
|
///
|
|
|
|
|
QRect updateFloatingGeometry();
|
2007-11-13 09:52:28 +00:00
|
|
|
|
///
|
2007-11-13 14:04:32 +00:00
|
|
|
|
void setIconSize(unsigned int size);
|
2007-11-12 22:15:51 +00:00
|
|
|
|
|
2007-11-13 14:49:50 +00:00
|
|
|
|
/// toggle toolbar state
|
|
|
|
|
void toggleToolbarState(std::string const & name, bool allowauto);
|
|
|
|
|
|
2007-11-12 22:15:51 +00:00
|
|
|
|
///
|
|
|
|
|
struct GuiViewPrivate;
|
|
|
|
|
GuiViewPrivate & d;
|
2006-12-20 21:28:05 +00:00
|
|
|
|
|
2007-11-12 22:15:51 +00:00
|
|
|
|
///
|
2006-03-05 17:24:44 +00:00
|
|
|
|
QTimer statusbar_timer_;
|
|
|
|
|
|
2006-12-12 01:39:50 +00:00
|
|
|
|
/// are we quitting by the menu?
|
|
|
|
|
bool quitting_by_menu_;
|
|
|
|
|
|
2006-06-21 10:30:32 +00:00
|
|
|
|
///
|
|
|
|
|
QRect floatingGeometry_;
|
2006-10-31 14:12:46 +00:00
|
|
|
|
|
2007-01-29 14:23:05 +00:00
|
|
|
|
struct ToolbarSize {
|
|
|
|
|
int top_width;
|
|
|
|
|
int bottom_width;
|
|
|
|
|
int left_height;
|
|
|
|
|
int right_height;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ToolbarSize toolbarSize_;
|
2007-11-12 23:23:19 +00:00
|
|
|
|
|
|
|
|
|
/// auto-saving of buffers
|
|
|
|
|
Timeout * const autosave_timeout_;
|
|
|
|
|
/// dialogs for this view
|
|
|
|
|
Dialogs * dialogs_;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
};
|
|
|
|
|
|
2007-10-06 15:48:58 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2006-06-20 09:33:01 +00:00
|
|
|
|
#endif // GUIVIEW_H
|