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
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author John Levon
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Jürgen Vigna
|
2003-08-23 00:17:00 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
2012-03-13 16:13:31 +00:00
|
|
|
#include "DocumentClassPtr.h"
|
2007-04-28 20:44:46 +00:00
|
|
|
#include "update_flags.h"
|
2006-12-29 23:54:48 +00:00
|
|
|
|
2007-10-31 22:40:34 +00:00
|
|
|
#include "support/strfwd.h"
|
2004-02-02 11:07:51 +00:00
|
|
|
#include "support/types.h"
|
|
|
|
|
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;
|
2007-10-11 09:59:01 +00:00
|
|
|
class CoordCache;
|
|
|
|
class Cursor;
|
2010-01-25 15:14:41 +00:00
|
|
|
class DispatchResult;
|
2004-03-31 19:11:56 +00:00
|
|
|
class DocIterator;
|
2009-09-19 20:56:12 +00:00
|
|
|
class DocumentClass;
|
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-10-11 09:59:01 +00:00
|
|
|
class Inset;
|
2004-02-02 11:07:51 +00:00
|
|
|
class ParIterator;
|
2006-12-29 23:54:48 +00:00
|
|
|
class ParagraphMetrics;
|
2007-11-03 18:50:54 +00:00
|
|
|
class Point;
|
2007-10-11 09:59:01 +00:00
|
|
|
class Text;
|
|
|
|
class TextMetrics;
|
|
|
|
|
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
|
|
|
|
{
|
2008-04-16 18:18:12 +00:00
|
|
|
ScrollbarParameters()
|
2008-06-20 12:52:38 +00:00
|
|
|
: min(0), max(0), position(0), single_step(1), page_step(1)
|
2008-04-16 18:18:12 +00:00
|
|
|
{}
|
2008-01-17 17:06:55 +00:00
|
|
|
/// Minimum scrollbar position in pixels.
|
|
|
|
int min;
|
|
|
|
/// Maximum scrollbar position in pixels.
|
|
|
|
int max;
|
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.
|
2008-01-17 17:06:55 +00:00
|
|
|
int single_step;
|
|
|
|
/// Page-scroll amount in pixels.
|
|
|
|
int page_step;
|
2006-06-26 16:55:35 +00:00
|
|
|
};
|
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
|
|
|
*/
|
2007-11-03 18:50:54 +00:00
|
|
|
class BufferView {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
2007-08-21 07:33:46 +00:00
|
|
|
///
|
2008-02-09 17:20:23 +00:00
|
|
|
explicit 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
|
|
|
|
2008-02-09 17:20:23 +00:00
|
|
|
///
|
|
|
|
void setFullScreen(bool full_screen) { full_screen_ = full_screen; }
|
|
|
|
|
|
|
|
/// right margin
|
|
|
|
int rightMargin() const;
|
|
|
|
|
|
|
|
/// left margin
|
|
|
|
int leftMargin() const;
|
|
|
|
|
2008-03-06 12:41:38 +00:00
|
|
|
/// \return true if the BufferView is at the top of the document.
|
|
|
|
bool isTopScreen() const;
|
|
|
|
|
|
|
|
/// \return true if the BufferView is at the bottom of the document.
|
|
|
|
bool isBottomScreen() const;
|
|
|
|
|
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
|
|
|
*/
|
2007-10-10 08:52:55 +00:00
|
|
|
void processUpdateFlags(Update::flags flags);
|
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;
|
2007-12-25 18:53:38 +00:00
|
|
|
/// \return Tool tip for the given position.
|
|
|
|
docstring toolTip(int x, int y) const;
|
2007-12-25 20:12:07 +00:00
|
|
|
/// \return the context menu for the given position.
|
2011-10-29 14:48:55 +00:00
|
|
|
std::string contextMenu(int x, int y) 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
|
|
|
|
2008-09-17 14:51:27 +00:00
|
|
|
/// set cursor to the given inset. Return true if found.
|
|
|
|
bool setCursorFromInset(Inset const *);
|
2009-03-26 00:09:16 +00:00
|
|
|
/// Recenters the BufferView such that the passed cursor
|
|
|
|
/// is in the center.
|
|
|
|
void recenter();
|
2008-01-29 09:51:12 +00:00
|
|
|
/// Ensure that the BufferView cursor is visible.
|
|
|
|
/// This method will automatically scroll and update the BufferView
|
2007-12-21 08:35:43 +00:00
|
|
|
/// if needed.
|
2009-03-26 00:09:16 +00:00
|
|
|
void showCursor();
|
2008-01-29 09:51:12 +00:00
|
|
|
/// Ensure the passed cursor \p dit is visible.
|
|
|
|
/// This method will automatically scroll and update the BufferView
|
|
|
|
/// if needed.
|
2009-03-26 00:09:16 +00:00
|
|
|
/// \param recenter Whether the cursor should be centered on screen
|
2010-06-14 21:48:23 +00:00
|
|
|
void showCursor(DocIterator const & dit, bool recenter,
|
|
|
|
bool update);
|
2009-03-27 17:27:38 +00:00
|
|
|
/// Scroll to the cursor.
|
|
|
|
void scrollToCursor();
|
|
|
|
/// Scroll to the cursor.
|
|
|
|
/// \param recenter Whether the cursor should be centered on screen
|
|
|
|
bool scrollToCursor(DocIterator const & dit, bool recenter);
|
2007-09-15 12:28:41 +00:00
|
|
|
/// scroll down document by the given number of pixels.
|
2008-07-04 11:33:28 +00:00
|
|
|
int scrollDown(int pixels);
|
2007-09-15 12:28:41 +00:00
|
|
|
/// scroll up document by the given number of pixels.
|
2008-07-04 11:33:28 +00:00
|
|
|
int scrollUp(int pixels);
|
2007-09-15 12:28:41 +00:00
|
|
|
/// scroll document by the given number of pixels.
|
2008-07-04 11:33:28 +00:00
|
|
|
int scroll(int pixels);
|
2006-11-09 10:10:06 +00:00
|
|
|
/// Scroll the view by a number of pixels.
|
2010-06-14 21:48:23 +00:00
|
|
|
void scrollDocView(int pixels, bool update);
|
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;
|
|
|
|
|
2008-02-21 19:42:34 +00:00
|
|
|
/// return the inline completion postfix.
|
|
|
|
docstring const & inlineCompletion() const;
|
|
|
|
/// return the number of unique characters in the inline completion.
|
|
|
|
size_t const & inlineCompletionUniqueChars() const;
|
|
|
|
/// return the position in the buffer of the inline completion postfix.
|
|
|
|
DocIterator const & inlineCompletionPos() const;
|
2010-11-30 03:54:29 +00:00
|
|
|
/// make sure inline completion position is OK
|
2011-02-21 15:26:28 +00:00
|
|
|
void resetInlineCompletionPos();
|
2008-02-21 19:42:34 +00:00
|
|
|
/// set the inline completion postfix and its position in the buffer.
|
2008-02-21 19:43:16 +00:00
|
|
|
/// Updates the updateFlags in \c cur.
|
2011-12-02 22:41:33 +00:00
|
|
|
void setInlineCompletion(Cursor const & cur, DocIterator const & pos,
|
2008-02-21 19:43:16 +00:00
|
|
|
docstring const & completion, size_t uniqueChars = 0);
|
2007-12-25 18:53:38 +00:00
|
|
|
|
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
|
|
|
|
2009-04-06 12:12:06 +00:00
|
|
|
/// \return true if we've made a decision
|
|
|
|
bool getStatus(FuncRequest const & cmd, FuncStatus & flag);
|
2006-11-09 10:10:06 +00:00
|
|
|
/// execute the given function.
|
2010-01-25 15:14:41 +00:00
|
|
|
void dispatch(FuncRequest const & cmd, DispatchResult & dr);
|
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-10-11 14:46:53 +00:00
|
|
|
bool mouseSetCursor(Cursor & cur, bool select = false);
|
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
|
|
|
|
2011-03-19 10:34:59 +00:00
|
|
|
/// selects the item at cursor if its paragraph is empty.
|
|
|
|
bool selectIfEmpty(DocIterator & cur);
|
|
|
|
|
2006-11-09 10:10:06 +00:00
|
|
|
/// update the internal \c ViewMetricsInfo.
|
2007-11-06 08:32:25 +00:00
|
|
|
void updateMetrics();
|
2006-07-14 09:56:21 +00:00
|
|
|
|
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-10-11 09:59:01 +00:00
|
|
|
CoordCache & coordCache();
|
2006-10-13 16:44:44 +00:00
|
|
|
///
|
2007-10-11 09:59:01 +00:00
|
|
|
CoordCache const & coordCache() const;
|
2007-08-27 22:53:16 +00:00
|
|
|
|
2007-09-29 09:22:17 +00:00
|
|
|
///
|
2010-04-21 13:03:04 +00:00
|
|
|
Point getPos(DocIterator const & dit) const;
|
2008-11-18 23:57:26 +00:00
|
|
|
/// is the paragraph of the cursor visible ?
|
|
|
|
bool paragraphVisible(DocIterator const & dit) const;
|
2009-04-03 21:39:06 +00:00
|
|
|
/// is the cursor currently visible in the view
|
|
|
|
bool cursorInView(Point const & p, int h) const;
|
|
|
|
/// get the position and height of the cursor
|
|
|
|
void cursorPosAndHeight(Point & p, int & h) const;
|
2007-09-29 09:22:17 +00:00
|
|
|
|
|
|
|
|
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.
|
2007-10-11 09:59:01 +00:00
|
|
|
Intl & getIntl();
|
2006-09-17 10:03:00 +00:00
|
|
|
///
|
2007-10-11 09:59:01 +00:00
|
|
|
Intl const & getIntl() const;
|
2006-09-17 10:03:00 +00:00
|
|
|
|
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-11-18 00:39:15 +00:00
|
|
|
void showDialog(std::string const & name, std::string const & data,
|
|
|
|
Inset * inset = 0);
|
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
|
|
|
///
|
2007-12-02 20:05:17 +00:00
|
|
|
docstring contentsOfPlaintextFile(support::FileName const & f);
|
2007-10-03 18:56:37 +00:00
|
|
|
// Insert plain text file (if filename is empty, prompt for one)
|
2007-12-02 11:55:25 +00:00
|
|
|
void insertPlaintextFile(support::FileName const & f, bool asParagraph);
|
2007-12-02 17:50:08 +00:00
|
|
|
///
|
|
|
|
void insertLyXFile(support::FileName const & f);
|
2009-02-13 13:46:08 +00:00
|
|
|
/// save temporary bookmark for jump back navigation
|
|
|
|
void bookmarkEditPosition();
|
2009-09-27 10:29:13 +00:00
|
|
|
/// Find and return the inset associated with given dialog name.
|
|
|
|
Inset * editedInset(std::string const & name) const;
|
|
|
|
/// Associate an inset associated with given dialog name.
|
|
|
|
void editInset(std::string const & name, Inset * inset);
|
2010-04-30 14:55:37 +00:00
|
|
|
///
|
|
|
|
void clearLastInset(Inset * inset) const;
|
2010-10-24 21:41:47 +00:00
|
|
|
/// Is the mouse hovering a clickable inset or element?
|
|
|
|
bool clickableInset() const;
|
2012-06-04 17:39:24 +00:00
|
|
|
///
|
|
|
|
void makeDocumentClass();
|
2007-10-11 09:59:01 +00:00
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
private:
|
2007-11-03 18:50:54 +00:00
|
|
|
/// noncopyable
|
|
|
|
BufferView(BufferView const &);
|
|
|
|
void operator=(BufferView const &);
|
|
|
|
|
2010-04-21 13:12:40 +00:00
|
|
|
/// the position relative to (0, baseline) of outermost paragraph
|
|
|
|
Point coordOffset(DocIterator const & dit) const;
|
2007-09-28 09:11:24 +00:00
|
|
|
/// Update current paragraph metrics.
|
|
|
|
/// \return true if no further update is needed.
|
|
|
|
bool singleParUpdate();
|
2007-03-28 14:47:52 +00:00
|
|
|
|
2009-03-27 17:41:58 +00:00
|
|
|
/// The minimal size of the document that is visible. Used
|
|
|
|
/// when it is allowed to scroll below the document.
|
|
|
|
int minVisiblePart();
|
|
|
|
|
2013-04-19 21:26:58 +00:00
|
|
|
/// Search recursively for the innermost inset that covers (x, y) position.
|
2007-03-28 14:47:52 +00:00
|
|
|
/// \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
|
2007-12-25 18:53:38 +00:00
|
|
|
) const;
|
2007-03-28 14:47:52 +00:00
|
|
|
|
2010-03-29 15:21:10 +00:00
|
|
|
/// Update the hovering status of the insets. This is called when
|
|
|
|
/// either the screen is updated or when the buffer has scolled.
|
2010-03-29 15:45:24 +00:00
|
|
|
void updateHoveredInset() const;
|
2010-03-29 15:21:10 +00:00
|
|
|
|
2009-09-19 20:56:12 +00:00
|
|
|
///
|
2012-03-13 16:13:31 +00:00
|
|
|
void updateDocumentClass(DocumentClassConstPtr olddc);
|
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_;
|
|
|
|
///
|
2008-02-09 17:20:23 +00:00
|
|
|
bool full_screen_;
|
|
|
|
///
|
2007-08-21 07:33:46 +00:00
|
|
|
Buffer & buffer_;
|
2006-09-16 10:08:51 +00:00
|
|
|
|
2007-10-13 07:33:07 +00:00
|
|
|
struct Private;
|
|
|
|
Private * const d;
|
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; }
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2002-10-21 16:21:56 +00:00
|
|
|
#endif // BUFFERVIEW_H
|