2011-10-16 22:48:26 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file GuiWorkArea_Private.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WORKAREA_PRIVATE_H
|
|
|
|
#define WORKAREA_PRIVATE_H
|
|
|
|
|
|
|
|
#include "FuncRequest.h"
|
|
|
|
|
2016-10-19 09:55:08 +00:00
|
|
|
#include "support/FileName.h"
|
2011-10-16 22:48:26 +00:00
|
|
|
#include "support/Timeout.h"
|
|
|
|
|
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
class Buffer;
|
|
|
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
class GuiCompleter;
|
2017-07-22 22:56:27 +00:00
|
|
|
class GuiPainter;
|
2011-10-16 22:48:26 +00:00
|
|
|
class GuiView;
|
|
|
|
class GuiWorkArea;
|
|
|
|
|
|
|
|
/// for emulating triple click
|
|
|
|
class DoubleClick {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
DoubleClick() : state(Qt::NoButton), active(false) {}
|
|
|
|
///
|
|
|
|
DoubleClick(QMouseEvent * e) : state(e->button()), active(true) {}
|
|
|
|
///
|
|
|
|
bool operator==(QMouseEvent const & e) { return state == e.button(); }
|
|
|
|
///
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
Qt::MouseButton state;
|
|
|
|
///
|
|
|
|
bool active;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Qt only emits mouse events when the mouse is being moved, but
|
|
|
|
* we want to generate 'pseudo' mouse events when the mouse button is
|
|
|
|
* pressed and the mouse cursor is below the bottom, or above the top
|
|
|
|
* of the work area. In this way, we'll be able to continue scrolling
|
|
|
|
* (and selecting) the text.
|
|
|
|
*
|
|
|
|
* This class stores all the parameters needed to make this happen.
|
|
|
|
*/
|
|
|
|
class SyntheticMouseEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SyntheticMouseEvent();
|
|
|
|
|
|
|
|
FuncRequest cmd;
|
|
|
|
Timeout timeout;
|
|
|
|
bool restart_timeout;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of the work area (buffer view GUI)
|
|
|
|
*/
|
2017-07-21 23:19:45 +00:00
|
|
|
class CaretWidget;
|
2011-10-16 22:48:26 +00:00
|
|
|
|
|
|
|
struct GuiWorkArea::Private
|
|
|
|
{
|
2017-07-21 23:19:45 +00:00
|
|
|
///
|
2011-10-16 22:48:26 +00:00
|
|
|
Private(GuiWorkArea *);
|
|
|
|
|
|
|
|
///
|
2017-07-21 23:19:45 +00:00
|
|
|
~Private();
|
2011-10-16 22:48:26 +00:00
|
|
|
|
2017-07-21 23:19:45 +00:00
|
|
|
///
|
|
|
|
void resizeBufferView();
|
2011-10-16 22:48:26 +00:00
|
|
|
|
|
|
|
///
|
2016-06-20 19:10:14 +00:00
|
|
|
void dispatch(FuncRequest const & cmd0);
|
2017-10-02 15:07:31 +00:00
|
|
|
/// recompute the shape and position of the caret
|
|
|
|
void updateCaretGeometry();
|
2017-08-24 15:37:56 +00:00
|
|
|
/// show the caret if it is not visible
|
2017-07-21 23:19:45 +00:00
|
|
|
void showCaret();
|
2017-10-02 15:07:31 +00:00
|
|
|
/// hide the caret if it is visible
|
|
|
|
void hideCaret();
|
2017-07-24 22:15:20 +00:00
|
|
|
/// Set the range and value of the scrollbar and connect to its valueChanged
|
|
|
|
/// signal.
|
2011-10-16 22:48:26 +00:00
|
|
|
void updateScrollbar();
|
|
|
|
/// Change the cursor when the mouse hovers over a clickable inset
|
|
|
|
void updateCursorShape();
|
2011-10-23 06:52:03 +00:00
|
|
|
|
2017-07-22 22:56:27 +00:00
|
|
|
void paintPreeditText(GuiPainter & pain);
|
|
|
|
|
2011-10-16 22:48:26 +00:00
|
|
|
///
|
|
|
|
GuiWorkArea * p;
|
2011-12-17 21:53:46 +00:00
|
|
|
///
|
2011-10-16 22:48:26 +00:00
|
|
|
BufferView * buffer_view_;
|
|
|
|
///
|
|
|
|
GuiView * lyx_view_;
|
|
|
|
|
|
|
|
///
|
2017-07-21 23:19:45 +00:00
|
|
|
CaretWidget * caret_;
|
2017-08-24 15:37:56 +00:00
|
|
|
/// is the caret currently displayed
|
2017-07-21 23:19:45 +00:00
|
|
|
bool caret_visible_;
|
|
|
|
///
|
|
|
|
QTimer caret_timeout_;
|
|
|
|
|
2011-10-16 22:48:26 +00:00
|
|
|
///
|
|
|
|
SyntheticMouseEvent synthetic_mouse_event_;
|
|
|
|
///
|
|
|
|
DoubleClick dc_event_;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool need_resize_;
|
2017-07-22 22:56:27 +00:00
|
|
|
|
|
|
|
/// the current preedit text of the input method
|
|
|
|
docstring preedit_string_;
|
|
|
|
/// Number of lines used by preedit text
|
2011-10-16 22:48:26 +00:00
|
|
|
int preedit_lines_;
|
2017-07-22 22:56:27 +00:00
|
|
|
/// the attributes of the preedit text
|
|
|
|
QList<QInputMethodEvent::Attribute> preedit_attr_;
|
|
|
|
|
2014-10-12 17:23:13 +00:00
|
|
|
/// Ratio between physical pixels and device-independent pixels
|
|
|
|
/// We save the last used value to detect changes of the
|
|
|
|
/// current pixel_ratio of the viewport.
|
2017-09-18 08:58:07 +00:00
|
|
|
double last_pixel_ratio_;
|
2011-10-16 22:48:26 +00:00
|
|
|
///
|
|
|
|
GuiCompleter * completer_;
|
|
|
|
|
|
|
|
/// Special mode in which Esc and Enter (with or without Shift)
|
|
|
|
/// are ignored
|
|
|
|
bool dialog_mode_;
|
|
|
|
/// store the name of the context menu when the mouse is
|
2017-07-03 17:45:58 +00:00
|
|
|
/// pressed. This is used to get the correct context menu
|
2011-10-16 22:48:26 +00:00
|
|
|
/// when the menu is actually shown (after releasing on Windows)
|
|
|
|
/// and after the DEPM has done its job.
|
2011-10-29 14:48:55 +00:00
|
|
|
std::string context_menu_name_;
|
2016-10-19 09:55:08 +00:00
|
|
|
|
|
|
|
/// stuff related to window title
|
|
|
|
///
|
|
|
|
support::FileName file_name_;
|
|
|
|
///
|
2017-08-03 11:07:41 +00:00
|
|
|
bool shell_escape_;
|
|
|
|
///
|
2016-10-19 09:55:08 +00:00
|
|
|
bool read_only_;
|
|
|
|
///
|
|
|
|
docstring vc_status_;
|
|
|
|
///
|
|
|
|
bool clean_;
|
2017-02-28 21:58:44 +00:00
|
|
|
///
|
|
|
|
bool externally_modified_;
|
2016-10-19 09:55:08 +00:00
|
|
|
|
2011-10-16 22:48:26 +00:00
|
|
|
}; // GuiWorkArea
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
|
|
#endif // WORKAREA_H
|