From 5246fc55833f02361ead8e9ffda215095f894382 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 20 Feb 2003 17:39:48 +0000 Subject: [PATCH] split inset -> inset + updatableinset git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6212 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 1 + src/InsetList.C | 5 +- src/bufferview_funcs.C | 8 +- src/insets/Makefile.am | 4 +- src/insets/inset.C | 215 ---------------------------------- src/insets/inset.h | 152 ------------------------ src/insets/insettext.h | 2 +- src/insets/updatableinset.C | 222 ++++++++++++++++++++++++++++++++++++ src/insets/updatableinset.h | 178 +++++++++++++++++++++++++++++ src/mathed/formulabase.h | 2 +- src/undo_funcs.C | 2 +- 11 files changed, 415 insertions(+), 376 deletions(-) create mode 100644 src/insets/updatableinset.C create mode 100644 src/insets/updatableinset.h diff --git a/src/BufferView.C b/src/BufferView.C index e654a63eac..8459e042f4 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -35,6 +35,7 @@ #include "insets/insetcommand.h" // ChangeRefs #include "insets/inseterror.h" +#include "insets/updatableinset.h" #include "support/FileInfo.h" #include "support/filetools.h" diff --git a/src/InsetList.C b/src/InsetList.C index a4f0352825..dab5287baf 100644 --- a/src/InsetList.C +++ b/src/InsetList.C @@ -3,7 +3,7 @@ #include "InsetList.h" #include "debug.h" -#include "insets/inset.h" +#include "insets/updatableinset.h" #include @@ -19,7 +19,8 @@ struct MatchIt { /// used by lower_bound and upper_bound inline int operator()(InsetList::InsetTable const & a, - InsetList::InsetTable const & b) const { + InsetList::InsetTable const & b) const + { return a.pos < b.pos; } }; diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 249acf9e49..58ed8fdaf1 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -11,7 +11,6 @@ #include #include "bufferview_funcs.h" -#include "frontends/LyXView.h" #include "BufferView.h" #include "paragraph.h" #include "lyxfont.h" @@ -24,10 +23,13 @@ #include "author.h" #include "changes.h" +#include "frontends/LyXView.h" #include "frontends/Alert.h" #include "support/lstrings.h" +#include "insets/updatableinset.h" + #include "BoostFormat.h" void emph(BufferView * bv) @@ -143,11 +145,11 @@ void fontSize(BufferView * bv, string const & size) // Returns the current font and depth as a message. string const currentState(BufferView * bv) { - ostringstream state; - if (!bv->available()) return string(); + ostringstream state; + LyXText * text = bv->getLyXText(); Buffer * buffer = bv->buffer(); LyXCursor const & c(text->cursor); diff --git a/src/insets/Makefile.am b/src/insets/Makefile.am index 562e147f99..071957cc60 100644 --- a/src/insets/Makefile.am +++ b/src/insets/Makefile.am @@ -84,7 +84,9 @@ libinsets_la_SOURCES = \ insettoc.C \ insettoc.h \ inseturl.C \ - inseturl.h + inseturl.h \ + updatableinset.C \ + updatableinset.h # insetlist.C \ # insetlist.h \ # insetsection.h \ diff --git a/src/insets/inset.C b/src/insets/inset.C index b62738a609..1025cc7bf1 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -17,18 +17,14 @@ #include "inset.h" #include "BufferView.h" -#include "debug.h" #include "funcrequest.h" #include "gettext.h" -#include "lyxcursor.h" #include "lyxfont.h" #include "lyxtext.h" -#include "WordLangTuple.h" #include "frontends/Painter.h" #include "frontends/mouse_state.h" -#include "support/lstrings.h" #include "support/lstrings.h" using std::endl; @@ -161,214 +157,3 @@ int Inset::latexTextWidth(BufferView * bv) const return bv->workWidth(); } -// some stuff for inset locking - -UpdatableInset::UpdatableInset() - : Inset(), cursor_visible_(false), block_drawing_(false) -{} - - -UpdatableInset::UpdatableInset(UpdatableInset const & in, bool same_id) - : Inset(in, same_id), cursor_visible_(false), block_drawing_(false) -{} - - -void UpdatableInset::insetUnlock(BufferView *) -{ - lyxerr[Debug::INFO] << "Inset Unlock" << endl; -} - - -// An updatable inset is highly editable by definition -Inset::EDITABLE UpdatableInset::editable() const -{ - return HIGHLY_EDITABLE; -} - - -void UpdatableInset::toggleInsetCursor(BufferView *) -{} - - -void UpdatableInset::showInsetCursor(BufferView *, bool) -{} - - -void UpdatableInset::hideInsetCursor(BufferView *) -{} - - -void UpdatableInset::fitInsetCursor(BufferView *) const -{} - - -void UpdatableInset::edit(BufferView *, int, int, mouse_button::state) -{} - - -void UpdatableInset::edit(BufferView *, bool) -{} - - -void UpdatableInset::draw(BufferView *, LyXFont const &, - int /* baseline */, float & x, - bool/*cleared*/) const -{ - x += float(scx); - // ATTENTION: don't do the following here!!! - // top_x = int(x); - // top_baseline = baseline; -} - - -void UpdatableInset::scroll(BufferView * bv, float s) const -{ - LyXFont font; - - if (!s) { - scx = 0; - return; - } - - int const workW = bv->workWidth(); - int const tmp_top_x = top_x - scx; - - if (tmp_top_x > 0 && - (tmp_top_x + width(bv, font)) < workW) - return; - if (s > 0 && top_x > 0) - return; - - // int mx_scx=abs((width(bv,font) - bv->workWidth())/2); - //int const save_scx = scx; - - scx = int(s * workW / 2); - // if (!display()) - // scx += 20; - - if ((tmp_top_x + scx + width(bv, font)) < (workW / 2)) { - scx += (workW / 2) - (tmp_top_x + scx + width(bv, font)); - } - - // bv->updateInset(const_cast(this), false); -} - -void UpdatableInset::scroll(BufferView * bv, int offset) const -{ - if (offset > 0) { - if (!scx && top_x >= 20) - return; - if ((top_x + offset) > 20) - scx = 0; - // scx += offset - (top_x - scx + offset - 20); - else - scx += offset; - } else { - LyXFont const font; - if (!scx && (top_x + width(bv, font)) < (bv->workWidth() - 20)) - return; - if ((top_x - scx + offset + width(bv, font)) < (bv->workWidth() - 20)) { - scx = bv->workWidth() - width(bv, font) - top_x + scx - 20; - } else { - scx += offset; - } - } -// bv->updateInset(const_cast(this), false); -} - - -/// An updatable inset could handle lyx editing commands -Inset::RESULT UpdatableInset::localDispatch(FuncRequest const & ev) -{ - if (ev.action == LFUN_MOUSE_RELEASE) - return (editable() == IS_EDITABLE) ? DISPATCHED : UNDISPATCHED; - - if (!ev.argument.empty() && ev.action == LFUN_SCROLL_INSET) { - if (ev.argument.find('.') != ev.argument.npos) { - float const xx = static_cast(strToDbl(ev.argument)); - scroll(ev.view(), xx); - } else { - int const xx = strToInt(ev.argument); - scroll(ev.view(), xx); - } - ev.view()->updateInset(this, false); - - return DISPATCHED; - } - return UNDISPATCHED; -} - - -int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const -{ - int w; - if (owner()) { - w = static_cast - (owner())->getMaxWidth(bv, this); - } else { - w = bv->text->workWidth(bv, const_cast(this)); - } - if (w < 0) { - return -1; - } - // check for margins left/right and extra right margin "const 5" - if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0) - w -= (2 * TEXT_TO_INSET_OFFSET) + 5; - if (topx_set && owner()) { - w -= top_x; - w += owner()->x(); - } else if (owner()) { - // this is needed as otherwise we might have a too large inset if - // its top_x afterwards changes to LeftMargin so we try to put at - // least the default margin as top_x - w -= 20; - } - if (w < 10) { - w = 10; - } - return w; -} - - -LyXCursor const & Inset::cursor(BufferView * bv) const -{ - if (owner()) - return owner()->getLyXText(bv, false)->cursor; - return bv->text->cursor; -} - - -WordLangTuple const -UpdatableInset::selectNextWordToSpellcheck(BufferView *bv, float & value) const -{ - // we have to unlock ourself in this function by default! - bv->unlockInset(const_cast(this)); - value = 0; - return WordLangTuple(); -} - - -bool UpdatableInset::nextChange(BufferView * bv, lyx::pos_type &) -{ - // we have to unlock ourself in this function by default! - bv->unlockInset(const_cast(this)); - return false; -} - - -bool UpdatableInset::searchForward(BufferView * bv, string const &, - bool, bool) -{ - // we have to unlock ourself in this function by default! - bv->unlockInset(const_cast(this)); - return false; -} - - -bool UpdatableInset::searchBackward(BufferView * bv, string const &, - bool, bool) -{ - // we have to unlock ourself in this function by default! - bv->unlockInset(const_cast(this)); - return false; -} diff --git a/src/insets/inset.h b/src/insets/inset.h index e2a01478d6..8cc9fa5df8 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -378,158 +378,6 @@ bool Inset::checkInsertChar(LyXFont &) return false; } -// Updatable Insets. These insets can be locked and receive -// directly user interaction. Currently used only for mathed. -// Note that all pure methods from Inset class are pure here too. -// [Alejandro 080596] - -/** Extracted from Matthias notes: - * - * An inset can simple call LockInset in it's edit call and *ONLY* - * in it's edit call. - * - * Unlocking is either done by LyX or the inset itself with a - * UnlockInset-call - * - * During the lock, all button and keyboard events will be modified - * and send to the inset through the following inset-features. Note that - * Inset::insetUnlock will be called from inside UnlockInset. It is meant - * to contain the code for restoring the menus and things like this. - * - * If a inset wishes any redraw and/or update it just has to call - * updateInset(this). - * - * It's is completly irrelevant, where the inset is. UpdateInset will - * find it in any paragraph in any buffer. - * Of course the_locking_inset and the insets in the current paragraph/buffer - * are checked first, so no performance problem should occur. - */ -class UpdatableInset : public Inset { -public: - /// - UpdatableInset(); - /// - UpdatableInset(UpdatableInset const & in, bool same_id = false); - - /// check if the font of the char we want inserting is correct - /// and modify it if it is not. - virtual bool checkInsertChar(LyXFont &); - /// - virtual EDITABLE editable() const; - - /// - virtual void toggleInsetCursor(BufferView *); - /// - virtual void showInsetCursor(BufferView *, bool show = true); - /// - virtual void hideInsetCursor(BufferView *); - /// - virtual void fitInsetCursor(BufferView *) const; - /// - virtual void getCursorPos(BufferView *, int &, int &) const {} - /// - virtual void insetUnlock(BufferView *); - /// - virtual void edit(BufferView *, int x, int y, mouse_button::state button); - /// - virtual void edit(BufferView *, bool front = true); - /// - virtual void draw(BufferView *, LyXFont const &, - int baseline, float & x, bool cleared) const; - /// - virtual bool insertInset(BufferView *, Inset *) { return false; } - /// - virtual UpdatableInset * getLockingInset() const { - return const_cast(this); - } - /// - virtual UpdatableInset * getFirstLockingInsetOfType(Inset::Code c) - { return (c == lyxCode()) ? this : 0; } - /// - virtual int insetInInsetY() const { return 0; } - /// - virtual bool updateInsetInInset(BufferView *, Inset *) - { return false; } - /// - virtual bool lockInsetInInset(BufferView *, UpdatableInset *) - { return false; } - /// - virtual bool unlockInsetInInset(BufferView *, UpdatableInset *, - bool /*lr*/ = false) - { return false; } - /// An updatable inset could handle lyx editing commands - virtual RESULT localDispatch(FuncRequest const & cmd); - /// - bool isCursorVisible() const { return cursor_visible_; } - /// - virtual int getMaxWidth(BufferView * bv, UpdatableInset const *) const; - /// - int scroll(bool recursive = true) const { - // We need this method to not clobber the real method in Inset - return Inset::scroll(recursive); - } - /// - virtual bool showInsetDialog(BufferView *) const { return false; } - /// - virtual void nodraw(bool b) const { - block_drawing_ = b; - } - /// - virtual bool nodraw() const { - return block_drawing_; - } - /// - // needed for spellchecking text - /// - virtual bool allowSpellcheck() const { return false; } - /// - virtual WordLangTuple const - selectNextWordToSpellcheck(BufferView *, float & value) const; - /// - virtual void selectSelectedWord(BufferView *) {} - /// - virtual void toggleSelection(BufferView *, bool /*kill_selection*/) {} - - /// find the next change in the inset - virtual bool nextChange(BufferView * bv, lyx::pos_type & length); - - /// - // needed for search/replace functionality - /// - virtual bool searchForward(BufferView *, string const &, - bool = true, bool = false); - /// - virtual bool searchBackward(BufferView *, string const &, - bool = true, bool = false); - - -protected: - /// - void toggleCursorVisible() const { - cursor_visible_ = !cursor_visible_; - } - /// - void setCursorVisible(bool b) const { - cursor_visible_ = b; - } - /// scrolls to absolute position in bufferview-workwidth * sx units - void scroll(BufferView *, float sx) const; - /// scrolls offset pixels - void scroll(BufferView *, int offset) const; - -private: - /// - mutable bool cursor_visible_; - /// - mutable bool block_drawing_; -}; - -inline -bool UpdatableInset::checkInsertChar(LyXFont &) -{ - return true; -} - /** * returns true if pointer argument is valid * and points to an editable inset diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 710711b2af..92e340dc73 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -13,7 +13,7 @@ #define INSETTEXT_H -#include "inset.h" +#include "updatableinset.h" #include "LString.h" #include "LColor.h" #include "ParagraphList.h" diff --git a/src/insets/updatableinset.C b/src/insets/updatableinset.C new file mode 100644 index 0000000000..7df76d7676 --- /dev/null +++ b/src/insets/updatableinset.C @@ -0,0 +1,222 @@ + +#include "updatableinset.h" +#include "BufferView.h" +#include "funcrequest.h" +#include "debug.h" +#include "lyxfont.h" +#include "WordLangTuple.h" +#include "lyxtext.h" +#include "support/lstrings.h" + + +// some stuff for inset locking + +UpdatableInset::UpdatableInset() + : Inset(), cursor_visible_(false), block_drawing_(false) +{} + + +UpdatableInset::UpdatableInset(UpdatableInset const & in, bool same_id) + : Inset(in, same_id), cursor_visible_(false), block_drawing_(false) +{} + + +void UpdatableInset::insetUnlock(BufferView *) +{ + lyxerr[Debug::INFO] << "Inset Unlock" << endl; +} + + +// An updatable inset is highly editable by definition +Inset::EDITABLE UpdatableInset::editable() const +{ + return HIGHLY_EDITABLE; +} + + +void UpdatableInset::toggleInsetCursor(BufferView *) +{} + + +void UpdatableInset::showInsetCursor(BufferView *, bool) +{} + + +void UpdatableInset::hideInsetCursor(BufferView *) +{} + + +void UpdatableInset::fitInsetCursor(BufferView *) const +{} + + +void UpdatableInset::edit(BufferView *, int, int, mouse_button::state) +{} + + +void UpdatableInset::edit(BufferView *, bool) +{} + + +void UpdatableInset::draw(BufferView *, LyXFont const &, + int /* baseline */, float & x, + bool/*cleared*/) const +{ + x += float(scx); + // ATTENTION: don't do the following here!!! + // top_x = int(x); + // top_baseline = baseline; +} + + +void UpdatableInset::scroll(BufferView * bv, float s) const +{ + LyXFont font; + + if (!s) { + scx = 0; + return; + } + + int const workW = bv->workWidth(); + int const tmp_top_x = top_x - scx; + + if (tmp_top_x > 0 && + (tmp_top_x + width(bv, font)) < workW) + return; + if (s > 0 && top_x > 0) + return; + + // int mx_scx=abs((width(bv,font) - bv->workWidth())/2); + //int const save_scx = scx; + + scx = int(s * workW / 2); + // if (!display()) + // scx += 20; + + if ((tmp_top_x + scx + width(bv, font)) < (workW / 2)) { + scx += (workW / 2) - (tmp_top_x + scx + width(bv, font)); + } + + // bv->updateInset(const_cast(this), false); +} + +void UpdatableInset::scroll(BufferView * bv, int offset) const +{ + if (offset > 0) { + if (!scx && top_x >= 20) + return; + if ((top_x + offset) > 20) + scx = 0; + // scx += offset - (top_x - scx + offset - 20); + else + scx += offset; + } else { + LyXFont const font; + if (!scx && (top_x + width(bv, font)) < (bv->workWidth() - 20)) + return; + if ((top_x - scx + offset + width(bv, font)) < (bv->workWidth() - 20)) { + scx = bv->workWidth() - width(bv, font) - top_x + scx - 20; + } else { + scx += offset; + } + } +// bv->updateInset(const_cast(this), false); +} + + +/// An updatable inset could handle lyx editing commands +Inset::RESULT UpdatableInset::localDispatch(FuncRequest const & ev) +{ + if (ev.action == LFUN_MOUSE_RELEASE) + return (editable() == IS_EDITABLE) ? DISPATCHED : UNDISPATCHED; + + if (!ev.argument.empty() && ev.action == LFUN_SCROLL_INSET) { + if (ev.argument.find('.') != ev.argument.npos) { + float const xx = static_cast(strToDbl(ev.argument)); + scroll(ev.view(), xx); + } else { + int const xx = strToInt(ev.argument); + scroll(ev.view(), xx); + } + ev.view()->updateInset(this, false); + + return DISPATCHED; + } + return UNDISPATCHED; +} + + +int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const +{ + int w; + if (owner()) { + w = static_cast + (owner())->getMaxWidth(bv, this); + } else { + w = bv->text->workWidth(bv, const_cast(this)); + } + if (w < 0) { + return -1; + } + // check for margins left/right and extra right margin "const 5" + if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0) + w -= (2 * TEXT_TO_INSET_OFFSET) + 5; + if (topx_set && owner()) { + w -= top_x; + w += owner()->x(); + } else if (owner()) { + // this is needed as otherwise we might have a too large inset if + // its top_x afterwards changes to LeftMargin so we try to put at + // least the default margin as top_x + w -= 20; + } + if (w < 10) { + w = 10; + } + return w; +} + + +LyXCursor const & Inset::cursor(BufferView * bv) const +{ + if (owner()) + return owner()->getLyXText(bv, false)->cursor; + return bv->text->cursor; +} + + +WordLangTuple const +UpdatableInset::selectNextWordToSpellcheck(BufferView *bv, float & value) const +{ + // we have to unlock ourself in this function by default! + bv->unlockInset(const_cast(this)); + value = 0; + return WordLangTuple(); +} + + +bool UpdatableInset::nextChange(BufferView * bv, lyx::pos_type &) +{ + // we have to unlock ourself in this function by default! + bv->unlockInset(const_cast(this)); + return false; +} + + +bool UpdatableInset::searchForward(BufferView * bv, string const &, + bool, bool) +{ + // we have to unlock ourself in this function by default! + bv->unlockInset(const_cast(this)); + return false; +} + + +bool UpdatableInset::searchBackward(BufferView * bv, string const &, + bool, bool) +{ + // we have to unlock ourself in this function by default! + bv->unlockInset(const_cast(this)); + return false; +} diff --git a/src/insets/updatableinset.h b/src/insets/updatableinset.h new file mode 100644 index 0000000000..75681ccaf9 --- /dev/null +++ b/src/insets/updatableinset.h @@ -0,0 +1,178 @@ +// -*- C++ -*- +/** + * \file insetupdatable.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Alejandro Aguilar Sierra + * \author Jürgen Vigna + * \author Lars Gullik Bjønnes + * \author Matthias Ettrich + * + * Full author contact details are available in file CREDITS + */ + +#ifndef UPDATABLEINSET_H +#define UPDATABLEINSET_H + +// Updatable Insets. These insets can be locked and receive +// directly user interaction. Currently used only for mathed. +// Note that all pure methods from Inset class are pure here too. +// [Alejandro 080596] + +#include "inset.h" + + +/** Extracted from Matthias notes: + * + * An inset can simple call LockInset in it's edit call and *ONLY* + * in it's edit call. + * + * Unlocking is either done by LyX or the inset itself with a + * UnlockInset-call + * + * During the lock, all button and keyboard events will be modified + * and send to the inset through the following inset-features. Note that + * Inset::insetUnlock will be called from inside UnlockInset. It is meant + * to contain the code for restoring the menus and things like this. + * + * If a inset wishes any redraw and/or update it just has to call + * updateInset(this). + * + * It's is completly irrelevant, where the inset is. UpdateInset will + * find it in any paragraph in any buffer. + * Of course the_locking_inset and the insets in the current paragraph/buffer + * are checked first, so no performance problem should occur. + */ +class UpdatableInset : public Inset { +public: + /// + UpdatableInset(); + /// + UpdatableInset(UpdatableInset const & in, bool same_id = false); + + /// check if the font of the char we want inserting is correct + /// and modify it if it is not. + virtual bool checkInsertChar(LyXFont &); + /// + virtual EDITABLE editable() const; + + /// + virtual void toggleInsetCursor(BufferView *); + /// + virtual void showInsetCursor(BufferView *, bool show = true); + /// + virtual void hideInsetCursor(BufferView *); + /// + virtual void fitInsetCursor(BufferView *) const; + /// + virtual void getCursorPos(BufferView *, int &, int &) const {} + /// + virtual void insetUnlock(BufferView *); + /// + virtual void edit(BufferView *, int x, int y, mouse_button::state button); + /// + virtual void edit(BufferView *, bool front = true); + /// + virtual void draw(BufferView *, LyXFont const &, + int baseline, float & x, bool cleared) const; + /// + virtual bool insertInset(BufferView *, Inset *) { return false; } + /// + virtual UpdatableInset * getLockingInset() const { + return const_cast(this); + } + /// + virtual UpdatableInset * getFirstLockingInsetOfType(Inset::Code c) + { return (c == lyxCode()) ? this : 0; } + /// + virtual int insetInInsetY() const { return 0; } + /// + virtual bool updateInsetInInset(BufferView *, Inset *) + { return false; } + /// + virtual bool lockInsetInInset(BufferView *, UpdatableInset *) + { return false; } + /// + virtual bool unlockInsetInInset(BufferView *, UpdatableInset *, + bool /*lr*/ = false) + { return false; } + /// An updatable inset could handle lyx editing commands + virtual RESULT localDispatch(FuncRequest const & cmd); + /// + bool isCursorVisible() const { return cursor_visible_; } + /// + virtual int getMaxWidth(BufferView * bv, UpdatableInset const *) const; + /// + int scroll(bool recursive = true) const { + // We need this method to not clobber the real method in Inset + return Inset::scroll(recursive); + } + /// + virtual bool showInsetDialog(BufferView *) const { return false; } + /// + virtual void nodraw(bool b) const { + block_drawing_ = b; + } + /// + virtual bool nodraw() const { + return block_drawing_; + } + /// + // needed for spellchecking text + /// + virtual bool allowSpellcheck() const { return false; } + /// + virtual WordLangTuple const + selectNextWordToSpellcheck(BufferView *, float & value) const; + /// + virtual void selectSelectedWord(BufferView *) {} + /// + virtual void toggleSelection(BufferView *, bool /*kill_selection*/) {} + + /// find the next change in the inset + virtual bool nextChange(BufferView * bv, lyx::pos_type & length); + + /// + // needed for search/replace functionality + /// + virtual bool searchForward(BufferView *, string const &, + bool = true, bool = false); + /// + virtual bool searchBackward(BufferView *, string const &, + bool = true, bool = false); + + + /// + BufferView * view() const; + /// + void setView(BufferView * bv) const; + +protected: + /// + void toggleCursorVisible() const { + cursor_visible_ = !cursor_visible_; + } + /// + void setCursorVisible(bool b) const { + cursor_visible_ = b; + } + /// scrolls to absolute position in bufferview-workwidth * sx units + void scroll(BufferView *, float sx) const; + /// scrolls offset pixels + void scroll(BufferView *, int offset) const; + +private: + /// + mutable bool cursor_visible_; + /// + mutable bool block_drawing_; +}; + +inline +bool UpdatableInset::checkInsertChar(LyXFont &) +{ + return true; +} + +#endif diff --git a/src/mathed/formulabase.h b/src/mathed/formulabase.h index 8dd68ec3ba..9c53c47c57 100644 --- a/src/mathed/formulabase.h +++ b/src/mathed/formulabase.h @@ -14,7 +14,7 @@ #define INSET_FORMULABASE_H -#include "insets/inset.h" +#include "insets/updatableinset.h" #include "frontends/mouse_state.h" #include "lyxfont.h" diff --git a/src/undo_funcs.C b/src/undo_funcs.C index 96d5497491..4501d53b11 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -13,7 +13,7 @@ #include "lyxtext.h" #include "BufferView.h" #include "buffer.h" -#include "insets/inset.h" +#include "insets/updatableinset.h" #include "debug.h" #include "support/LAssert.h" -- 2.39.2