1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-08-04 23:11:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file BufferView.h
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
1999-11-04 01:40:20 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Alfredo Braustein
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
|
#ifndef BUFFER_VIEW_H
|
|
|
|
|
#define BUFFER_VIEW_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "CoordCache.h"
|
2007-04-26 14:56:30 +00:00
|
|
|
|
#include "Cursor.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "MetricsInfo.h"
|
2006-12-29 23:54:48 +00:00
|
|
|
|
#include "TextMetrics.h"
|
2007-04-28 20:44:46 +00:00
|
|
|
|
#include "update_flags.h"
|
2006-12-29 23:54:48 +00:00
|
|
|
|
|
2004-02-02 11:07:51 +00:00
|
|
|
|
#include "support/types.h"
|
|
|
|
|
|
2007-09-30 15:47:00 +00:00
|
|
|
|
#include <boost/noncopyable.hpp>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-11-17 17:42:52 +00:00
|
|
|
|
#include <utility>
|
2003-10-06 15:43:21 +00:00
|
|
|
|
#include <string>
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
|
namespace support { class FileName; }
|
|
|
|
|
|
2007-08-27 22:53:16 +00:00
|
|
|
|
namespace frontend { class Painter; }
|
2007-10-02 18:27:20 +00:00
|
|
|
|
namespace frontend { class GuiBufferViewDelegate; }
|
2007-08-27 22:53:16 +00:00
|
|
|
|
|
2003-09-06 19:16:30 +00:00
|
|
|
|
class Buffer;
|
2003-02-08 19:18:01 +00:00
|
|
|
|
class Change;
|
2004-03-31 19:11:56 +00:00
|
|
|
|
class DocIterator;
|
2003-09-06 19:16:30 +00:00
|
|
|
|
class FuncRequest;
|
2004-04-01 08:58:45 +00:00
|
|
|
|
class FuncStatus;
|
2006-09-17 10:03:00 +00:00
|
|
|
|
class Intl;
|
2007-04-26 14:56:30 +00:00
|
|
|
|
class Cursor;
|
2007-04-29 23:33:02 +00:00
|
|
|
|
class Text;
|
2004-02-02 11:07:51 +00:00
|
|
|
|
class ParIterator;
|
2006-12-29 23:54:48 +00:00
|
|
|
|
class ParagraphMetrics;
|
2006-07-04 00:04:46 +00:00
|
|
|
|
class ViewMetricsInfo;
|
2007-09-29 08:02:37 +00:00
|
|
|
|
|
|
|
|
|
enum CursorStatus {
|
|
|
|
|
CUR_INSIDE,
|
|
|
|
|
CUR_ABOVE,
|
|
|
|
|
CUR_BELOW
|
|
|
|
|
};
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// Scrollbar Parameters.
|
2006-06-26 16:55:35 +00:00
|
|
|
|
struct ScrollbarParameters
|
|
|
|
|
{
|
|
|
|
|
void reset(int h = 0, int p = 0, int l = 0)
|
|
|
|
|
{
|
|
|
|
|
height = h;
|
|
|
|
|
position = p;
|
|
|
|
|
lineScrollHeight = l;
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// Total document height in pixels.
|
2006-06-26 16:55:35 +00:00
|
|
|
|
int height;
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// Current position in the document in pixels.
|
2006-06-26 16:55:35 +00:00
|
|
|
|
int position;
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// Line-scroll amount in pixels.
|
2006-06-26 16:55:35 +00:00
|
|
|
|
int lineScrollHeight;
|
|
|
|
|
};
|
2005-05-31 14:40:30 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// Screen view of a Buffer.
|
2002-10-21 16:21:56 +00:00
|
|
|
|
/**
|
2006-11-09 10:10:06 +00:00
|
|
|
|
* A BufferView encapsulates a view onto a particular
|
2002-10-21 16:21:56 +00:00
|
|
|
|
* buffer, and allows access to operate upon it. A view
|
|
|
|
|
* is a sliding window of the entire document rendering.
|
2006-11-09 10:10:06 +00:00
|
|
|
|
* It is the official interface between the LyX core and
|
|
|
|
|
* the frontend WorkArea.
|
2007-05-28 22:27:45 +00:00
|
|
|
|
*
|
2006-11-09 10:10:06 +00:00
|
|
|
|
* \sa WorkArea
|
|
|
|
|
* \sa Buffer
|
|
|
|
|
* \sa CoordCache
|
2002-10-21 16:21:56 +00:00
|
|
|
|
*/
|
2001-04-17 13:43:57 +00:00
|
|
|
|
class BufferView : boost::noncopyable {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
2007-08-21 07:33:46 +00:00
|
|
|
|
///
|
|
|
|
|
BufferView(Buffer & buffer);
|
2007-10-02 18:27:20 +00:00
|
|
|
|
///
|
1999-12-10 00:07:59 +00:00
|
|
|
|
~BufferView();
|
2002-12-01 21:10:37 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// return the buffer being viewed.
|
2007-08-21 13:03:55 +00:00
|
|
|
|
Buffer & buffer();
|
|
|
|
|
Buffer const & buffer() const;
|
2002-12-01 21:10:37 +00:00
|
|
|
|
|
2006-12-07 11:46:27 +00:00
|
|
|
|
/// perform pending metrics updates.
|
|
|
|
|
/** \c Update::FitCursor means first to do a FitCursor, and to
|
|
|
|
|
* force an update if screen position changes.
|
|
|
|
|
* \c Update::Force means to force an update in any case.
|
|
|
|
|
* \retval true if a screen redraw is needed
|
2004-11-30 01:59:49 +00:00
|
|
|
|
*/
|
2006-12-07 11:46:27 +00:00
|
|
|
|
bool update(Update::flags flags = Update::FitCursor | Update::Force);
|
2005-05-31 14:40:30 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// move the screen to fit the cursor.
|
|
|
|
|
/// Only to be called with good y coordinates (after a bv::metrics)
|
2002-03-29 15:49:45 +00:00
|
|
|
|
bool fitCursor();
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// reset the scrollbar to reflect current view position.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
void updateScrollbar();
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// return the Scrollbar Parameters.
|
2006-06-26 16:55:35 +00:00
|
|
|
|
ScrollbarParameters const & scrollbarParameters() const;
|
2002-12-01 21:10:37 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// Save the current position as bookmark.
|
2007-03-29 03:41:55 +00:00
|
|
|
|
/// if idx == 0, save to temp_bookmark
|
|
|
|
|
void saveBookmark(unsigned int idx);
|
2007-08-22 14:25:51 +00:00
|
|
|
|
/// goto a specified position, try top_id first, and then bottom_pit.
|
|
|
|
|
/// \return true if success
|
|
|
|
|
bool moveToPosition(
|
2007-04-16 19:01:32 +00:00
|
|
|
|
pit_type bottom_pit, ///< Paragraph pit, used when par_id is zero or invalid.
|
|
|
|
|
pos_type bottom_pos, ///< Paragraph pit, used when par_id is zero or invalid.
|
|
|
|
|
int top_id, ///< Paragraph ID, \sa Paragraph
|
|
|
|
|
pos_type top_pos ///< Position in the \c Paragraph
|
2006-11-09 10:10:06 +00:00
|
|
|
|
);
|
|
|
|
|
/// return the current change at the cursor.
|
2006-10-11 20:01:32 +00:00
|
|
|
|
Change const getCurrentChange() const;
|
2002-12-01 21:10:37 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// move cursor to the named label.
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void gotoLabel(docstring const & label);
|
2002-12-01 21:10:37 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// set the cursor based on the given TeX source row.
|
2000-01-08 21:02:58 +00:00
|
|
|
|
void setCursorFromRow(int row);
|
2002-12-01 21:10:37 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// center the document view around the cursor.
|
2000-02-17 19:59:08 +00:00
|
|
|
|
void center();
|
2007-09-15 12:28:41 +00:00
|
|
|
|
/// scroll down document by the given number of pixels.
|
|
|
|
|
void scrollDown(int pixels);
|
|
|
|
|
/// scroll up document by the given number of pixels.
|
|
|
|
|
void scrollUp(int pixels);
|
|
|
|
|
/// scroll document by the given number of pixels.
|
|
|
|
|
void scroll(int pixels);
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// Scroll the view by a number of pixels.
|
2004-08-14 19:55:00 +00:00
|
|
|
|
void scrollDocView(int pixels);
|
2006-08-16 15:24:38 +00:00
|
|
|
|
/// Set the cursor position based on the scrollbar one.
|
|
|
|
|
void setCursorFromScrollbar();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// return the pixel width of the document view.
|
2002-10-21 16:21:56 +00:00
|
|
|
|
int workWidth() const;
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// return the pixel height of the document view.
|
2002-10-21 16:21:56 +00:00
|
|
|
|
int workHeight() const;
|
|
|
|
|
|
2007-06-11 22:05:44 +00:00
|
|
|
|
/// translate and insert a character, using the correct keymap.
|
|
|
|
|
void translateAndInsert(char_type c, Text * t, Cursor & cur);
|
2000-02-03 19:51:27 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// return true for events that will handle.
|
2004-04-01 08:58:45 +00:00
|
|
|
|
FuncStatus getStatus(FuncRequest const & cmd);
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// execute the given function.
|
2007-01-24 23:10:03 +00:00
|
|
|
|
/// \return the Update::flags for further metrics update.
|
|
|
|
|
Update::flags dispatch(FuncRequest const & argument);
|
2004-04-03 08:37:12 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// request an X11 selection.
|
|
|
|
|
/// \return the selected string.
|
2006-10-21 00:16:43 +00:00
|
|
|
|
docstring const requestSelection();
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// clear the X11 selection.
|
2006-09-17 08:35:12 +00:00
|
|
|
|
void clearSelection();
|
* frontends/WorkArea.h(workAreaResize, scrollDocView, workAreaKeyPress,
dispatch, selectionReuqested, selectionLost): remove signals
* BufferView.[Ch] (selectionRequested, selectionLost, workAreaResize,
workAreaKeyPress, workAreaDispatch): add forwarding functions to the pimpl
* BufferView_pimpl.C (Pimpl): Remove the setup of the now deleted signals,
also remove corresponding connection objects.
* frontends/xforms/XWorkArea.h:
* frontends/qt2/QWorkArea.h:
* frontends/qt4/QWorkArea.h:
* frontends/gtk/GWorkArea.h: add LyXView as class variable view_ (qt
classes also get view() medthod)
* frontends/qt2/QWorkArea.C:
* frontends/qt2/QContentPane.C:
* frontends/qt4/QWorkArea.C:
* frontends/xforms/XWorkArea.C:
* frontends/gtk/GWorkArea.C: Change from calling signals to call
the functions directly through view_.view()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13671 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-13 18:58:48 +00:00
|
|
|
|
|
2007-08-24 07:05:19 +00:00
|
|
|
|
/// resize the BufferView.
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// \sa WorkArea
|
2007-08-24 07:05:19 +00:00
|
|
|
|
void resize(int width, int height);
|
* frontends/WorkArea.h(workAreaResize, scrollDocView, workAreaKeyPress,
dispatch, selectionReuqested, selectionLost): remove signals
* BufferView.[Ch] (selectionRequested, selectionLost, workAreaResize,
workAreaKeyPress, workAreaDispatch): add forwarding functions to the pimpl
* BufferView_pimpl.C (Pimpl): Remove the setup of the now deleted signals,
also remove corresponding connection objects.
* frontends/xforms/XWorkArea.h:
* frontends/qt2/QWorkArea.h:
* frontends/qt4/QWorkArea.h:
* frontends/gtk/GWorkArea.h: add LyXView as class variable view_ (qt
classes also get view() medthod)
* frontends/qt2/QWorkArea.C:
* frontends/qt2/QContentPane.C:
* frontends/qt4/QWorkArea.C:
* frontends/xforms/XWorkArea.C:
* frontends/gtk/GWorkArea.C: Change from calling signals to call
the functions directly through view_.view()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13671 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-13 18:58:48 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// dispatch method helper for \c WorkArea
|
|
|
|
|
/// \sa WorkArea
|
2007-10-05 09:38:40 +00:00
|
|
|
|
void mouseEventDispatch(FuncRequest const & ev);
|
* frontends/WorkArea.h(workAreaResize, scrollDocView, workAreaKeyPress,
dispatch, selectionReuqested, selectionLost): remove signals
* BufferView.[Ch] (selectionRequested, selectionLost, workAreaResize,
workAreaKeyPress, workAreaDispatch): add forwarding functions to the pimpl
* BufferView_pimpl.C (Pimpl): Remove the setup of the now deleted signals,
also remove corresponding connection objects.
* frontends/xforms/XWorkArea.h:
* frontends/qt2/QWorkArea.h:
* frontends/qt4/QWorkArea.h:
* frontends/gtk/GWorkArea.h: add LyXView as class variable view_ (qt
classes also get view() medthod)
* frontends/qt2/QWorkArea.C:
* frontends/qt2/QContentPane.C:
* frontends/qt4/QWorkArea.C:
* frontends/xforms/XWorkArea.C:
* frontends/gtk/GWorkArea.C: Change from calling signals to call
the functions directly through view_.view()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13671 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-13 18:58:48 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// access to anchor.
|
2006-10-21 00:16:43 +00:00
|
|
|
|
pit_type anchor_ref() const;
|
2005-04-26 11:12:20 +00:00
|
|
|
|
|
2007-09-29 08:02:37 +00:00
|
|
|
|
///
|
|
|
|
|
CursorStatus cursorStatus(DocIterator const & dit) const;
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// access to full cursor.
|
2007-04-26 14:56:30 +00:00
|
|
|
|
Cursor & cursor();
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// access to full cursor.
|
2007-04-26 14:56:30 +00:00
|
|
|
|
Cursor const & cursor() const;
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// sets cursor.
|
|
|
|
|
/// This will also open all relevant collapsable insets.
|
2005-02-22 11:41:22 +00:00
|
|
|
|
void setCursor(DocIterator const &);
|
2006-12-30 15:05:15 +00:00
|
|
|
|
/// Check deleteEmptyParagraphMechanism and update metrics if needed.
|
|
|
|
|
/// \retval true if an update was needed.
|
2007-04-26 14:56:30 +00:00
|
|
|
|
bool checkDepm(Cursor & cur, Cursor & old);
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// sets cursor.
|
|
|
|
|
/// This is used when handling LFUN_MOUSE_PRESS.
|
2007-04-26 14:56:30 +00:00
|
|
|
|
bool mouseSetCursor(Cursor & cur);
|
2005-12-01 10:28:50 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// sets the selection.
|
|
|
|
|
/* When \c backwards == false, set anchor
|
2004-09-17 16:28:47 +00:00
|
|
|
|
* to \c cur and cursor to \c cur + \c length. When \c
|
|
|
|
|
* backwards == true, set anchor to \c cur and cursor to \c
|
|
|
|
|
* cur + \c length.
|
|
|
|
|
*/
|
2004-03-31 19:11:56 +00:00
|
|
|
|
void putSelectionAt(DocIterator const & cur,
|
2004-03-25 09:16:36 +00:00
|
|
|
|
int length, bool backwards);
|
2006-11-09 10:10:06 +00:00
|
|
|
|
|
|
|
|
|
/// return the internal \c ViewMetricsInfo.
|
|
|
|
|
/// This is used specifically by the \c Workrea.
|
|
|
|
|
/// \sa WorkArea
|
|
|
|
|
/// \sa ViewMetricsInfo
|
2006-07-04 00:04:46 +00:00
|
|
|
|
ViewMetricsInfo const & viewMetricsInfo();
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// update the internal \c ViewMetricsInfo.
|
|
|
|
|
/// \param singlepar indicates wether
|
2006-07-14 09:56:21 +00:00
|
|
|
|
void updateMetrics(bool singlepar = false);
|
|
|
|
|
|
2006-12-29 23:54:48 +00:00
|
|
|
|
///
|
2007-04-29 23:33:02 +00:00
|
|
|
|
TextMetrics const & textMetrics(Text const * t) const;
|
|
|
|
|
TextMetrics & textMetrics(Text const * t);
|
2006-12-29 23:54:48 +00:00
|
|
|
|
///
|
2007-04-29 23:33:02 +00:00
|
|
|
|
ParagraphMetrics const & parMetrics(Text const *, pit_type) const;
|
2006-12-29 23:54:48 +00:00
|
|
|
|
|
2006-10-13 16:44:44 +00:00
|
|
|
|
///
|
2007-09-29 08:02:37 +00:00
|
|
|
|
CoordCache & coordCache() { return coord_cache_; }
|
2006-10-13 16:44:44 +00:00
|
|
|
|
///
|
2007-09-29 08:02:37 +00:00
|
|
|
|
CoordCache const & coordCache() const { return coord_cache_; }
|
2007-08-27 22:53:16 +00:00
|
|
|
|
|
2007-09-29 09:22:17 +00:00
|
|
|
|
///
|
|
|
|
|
Point getPos(DocIterator const & dit, bool boundary) const;
|
|
|
|
|
|
|
|
|
|
|
2007-08-27 22:53:16 +00:00
|
|
|
|
///
|
|
|
|
|
void draw(frontend::Painter & pain);
|
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// get this view's keyboard map handler.
|
2006-09-17 10:03:00 +00:00
|
|
|
|
Intl & getIntl() { return *intl_.get(); }
|
|
|
|
|
///
|
|
|
|
|
Intl const & getIntl() const { return *intl_.get(); }
|
|
|
|
|
|
2007-10-02 18:27:20 +00:00
|
|
|
|
//
|
|
|
|
|
// Messages to the GUI
|
|
|
|
|
//
|
2006-08-24 14:10:22 +00:00
|
|
|
|
/// This signal is emitted when some message shows up.
|
2007-10-02 18:27:20 +00:00
|
|
|
|
void message(docstring const & msg);
|
2006-08-24 14:10:22 +00:00
|
|
|
|
|
2006-09-19 13:36:20 +00:00
|
|
|
|
/// This signal is emitted when some dialog needs to be shown.
|
2007-10-02 18:27:20 +00:00
|
|
|
|
void showDialog(std::string const & name);
|
2006-09-19 13:36:20 +00:00
|
|
|
|
|
|
|
|
|
/// This signal is emitted when some dialog needs to be shown with
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// some data.
|
2007-10-02 18:27:20 +00:00
|
|
|
|
void showDialogWithData(std::string const & name, std::string const & data);
|
2006-09-19 13:36:20 +00:00
|
|
|
|
|
|
|
|
|
/// This signal is emitted when some inset dialogs needs to be shown.
|
2007-10-02 18:27:20 +00:00
|
|
|
|
void showInsetDialog(std::string const & name, std::string const & data,
|
|
|
|
|
Inset * inset);
|
2006-09-19 13:36:20 +00:00
|
|
|
|
|
|
|
|
|
/// This signal is emitted when some dialogs needs to be updated.
|
2007-10-02 18:27:20 +00:00
|
|
|
|
void updateDialog(std::string const & name, std::string const & data);
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void setGuiDelegate(frontend::GuiBufferViewDelegate *);
|
2006-09-19 13:36:20 +00:00
|
|
|
|
|
2007-10-03 20:15:49 +00:00
|
|
|
|
///
|
|
|
|
|
docstring contentsOfPlaintextFile(std::string const & f, bool asParagraph);
|
2007-10-03 18:56:37 +00:00
|
|
|
|
// Insert plain text file (if filename is empty, prompt for one)
|
|
|
|
|
void insertPlaintextFile(std::string const & fileName, bool asParagraph);
|
2000-04-08 17:02:02 +00:00
|
|
|
|
private:
|
2007-09-29 09:22:17 +00:00
|
|
|
|
// the position relative to (0, baseline) of outermost paragraph
|
|
|
|
|
Point coordOffset(DocIterator const & dit, bool boundary) const;
|
2007-09-28 09:11:24 +00:00
|
|
|
|
/// Update current paragraph metrics.
|
|
|
|
|
/// \return true if no further update is needed.
|
|
|
|
|
bool singleParUpdate();
|
2003-11-28 08:55:12 +00:00
|
|
|
|
///
|
2006-09-16 10:08:51 +00:00
|
|
|
|
bool multiParSel();
|
2007-03-28 14:47:52 +00:00
|
|
|
|
|
|
|
|
|
/// Search recursively for the the innermost inset that covers (x, y) position.
|
|
|
|
|
/// \retval 0 if no inset is found.
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset const * getCoveringInset(
|
2007-04-29 23:33:02 +00:00
|
|
|
|
Text const & text, //< The Text where we start searching.
|
2007-03-28 14:47:52 +00:00
|
|
|
|
int x, //< x-coordinate on screen
|
|
|
|
|
int y //< y-coordinate on screen
|
|
|
|
|
);
|
|
|
|
|
|
2003-11-28 08:55:12 +00:00
|
|
|
|
///
|
2006-09-16 10:08:51 +00:00
|
|
|
|
int width_;
|
2003-11-28 08:55:12 +00:00
|
|
|
|
///
|
2006-09-16 10:08:51 +00:00
|
|
|
|
int height_;
|
|
|
|
|
///
|
|
|
|
|
ScrollbarParameters scrollbarParameters_;
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
ViewMetricsInfo metrics_info_;
|
2006-11-09 10:10:06 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
CoordCache coord_cache_;
|
2006-09-16 10:08:51 +00:00
|
|
|
|
///
|
2007-08-21 07:33:46 +00:00
|
|
|
|
Buffer & buffer_;
|
2006-09-16 10:08:51 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// Estimated average par height for scrollbar.
|
2006-09-16 10:08:51 +00:00
|
|
|
|
int wh_;
|
|
|
|
|
///
|
|
|
|
|
void menuInsertLyXFile(std::string const & filen);
|
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// this is used to handle XSelection events in the right manner.
|
2006-09-16 10:08:51 +00:00
|
|
|
|
struct {
|
|
|
|
|
CursorSlice cursor;
|
|
|
|
|
CursorSlice anchor;
|
|
|
|
|
bool set;
|
|
|
|
|
} xsel_cache_;
|
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
Cursor cursor_;
|
2006-09-16 10:08:51 +00:00
|
|
|
|
///
|
|
|
|
|
bool multiparsel_cache_;
|
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
pit_type anchor_ref_;
|
2006-09-16 10:08:51 +00:00
|
|
|
|
///
|
|
|
|
|
int offset_ref_;
|
2007-08-22 14:14:52 +00:00
|
|
|
|
///
|
|
|
|
|
void updateOffsetRef();
|
|
|
|
|
///
|
|
|
|
|
bool need_centering_;
|
2006-09-17 10:03:00 +00:00
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
|
/// keyboard mapping object.
|
2006-09-17 10:03:00 +00:00
|
|
|
|
boost::scoped_ptr<Intl> const intl_;
|
2006-12-15 16:48:09 +00:00
|
|
|
|
|
2006-12-15 16:53:02 +00:00
|
|
|
|
/// last visited inset (kept to send setMouseHover(false) )
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset * last_inset_;
|
2006-12-29 23:54:48 +00:00
|
|
|
|
|
2007-04-29 23:33:02 +00:00
|
|
|
|
/// A map from a Text to the associated text metrics
|
|
|
|
|
typedef std::map<Text const *, TextMetrics> TextMetricsCache;
|
2006-12-29 23:54:48 +00:00
|
|
|
|
mutable TextMetricsCache text_metrics_;
|
2007-10-02 18:27:20 +00:00
|
|
|
|
|
|
|
|
|
// Whom to notify. Not owned, so don't delete.
|
|
|
|
|
frontend::GuiBufferViewDelegate * gui_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2007-08-28 15:31:04 +00:00
|
|
|
|
/// some space for drawing the 'nested' markers (in pixel)
|
|
|
|
|
inline int nestMargin() { return 15; }
|
|
|
|
|
|
|
|
|
|
/// margin for changebar
|
|
|
|
|
inline int changebarMargin() { return 12; }
|
|
|
|
|
|
|
|
|
|
/// right margin
|
|
|
|
|
inline int rightMargin() { return 10; }
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2002-10-21 16:21:56 +00:00
|
|
|
|
#endif // BUFFERVIEW_H
|