X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetCollapsable.h;h=57a089858d1eda392d57ba68629c431ca7f940a0;hb=2c357c1d23b7b83839a9beb8225d4f1ae4f793b4;hp=999315a50657ef4f49deb60d051a1fc82b035f04;hpb=b7cc721833b9bce07aad2c622f24d7aa1b200ce4;p=lyx.git diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index 999315a506..57a089858d 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -15,10 +15,11 @@ #define INSETCOLLAPSABLE_H #include "Inset.h" -#include "InsetLayout.h" #include "InsetText.h" #include "Box.h" +#include "TextClass.h" +#include "TextClassPtr.h" #include @@ -41,20 +42,31 @@ public: InsetCollapsable( BufferParams const &, CollapseStatus status = Inset::Open, - InsetLayout const * il = 0 + TextClassPtr tc = TextClassPtr((TextClass *)0) ); /// InsetCollapsable(InsetCollapsable const & rhs); - + /// InsetCollapsable * asInsetCollapsable() { return this; } + /// InsetCollapsable const * asInsetCollapsable() const { return this; } + /// + docstring toolTip(BufferView const & bv, int x, int y) const; + /// docstring name() const { return from_ascii("Collapsable"); } + /// InsetLayout const & getLayout(BufferParams const &) const - { return *layout_; } + { return *layout_; } + /// + InsetLayout const & getLayout() const + { return *layout_; } /// void setLayout(BufferParams const &); - /// (Re-)set the character style parameters from \p il - void setLayout(InsetLayout const & il); + /// (Re-)set the character style parameters from \p tc according + /// to name() + void setLayout(TextClassPtr tc); + /// + virtual bool useEmptyLayout() { return true; } /// void read(Buffer const &, Lexer &); /// @@ -66,7 +78,8 @@ public: /// return x,y of given position relative to the inset's baseline void cursorPos(BufferView const & bv, CursorSlice const & sl, - bool boundary, int & x, int & y) const; + /// + bool boundary, int & x, int & y) const; /// bool hitButton(FuncRequest const &) const; /// @@ -76,6 +89,8 @@ public: /// can we go further down on mouse click? bool descendable() const; /// + bool isMacroScope(Buffer const & buf) const; + /// void setLabel(docstring const & l); /// virtual void setButtonLabel() {} @@ -95,21 +110,15 @@ public: * -------------+------------------------------- * Classic | *) TopButton, <--x) ButtonOnly * | LeftButton - * Minimalistic | ButtonOnly NoButton + * Minimalistic | NoButton ButtonOnly * Conglomerate | SubLabel Corners * --------------------------------------------- * *) toggled by openinlined_ * x) toggled by autoOpen_ */ - /// - enum Decoration { - Classic, - Minimalistic, - Conglomerate - }; /// Default looks - virtual Decoration decoration() const; + virtual InsetDecoration decoration() const; /// enum Geometry { TopButton, @@ -134,8 +143,8 @@ public: /// bool setMouseHover(bool mouse_hover); /// - virtual ColorCode backgroundColor() const {return layout_->bgcolor; } - + virtual ColorCode backgroundColor() const {return layout_->bgcolor(); } + /// int latex(Buffer const &, odocstream &, OutputParams const &) const; /// @@ -144,17 +153,22 @@ public: virtual InsetCode lyxCode() const { return COLLAPSABLE_CODE; } /// Allow multiple blanks - virtual bool isFreeSpacing() const { return layout_->freespacing; } + virtual bool isFreeSpacing() const { return layout_->isFreeSpacing(); } /// Don't eliminate empty paragraphs - virtual bool allowEmpty() const { return layout_->keepempty; } + virtual bool allowEmpty() const { return layout_->isKeepEmpty(); } /// Force inset into LTR environment if surroundings are RTL? - virtual bool forceLTR() const { return layout_->forceltr; } - + virtual bool forceLTR() const { return layout_->isForceLtr(); } + /// + virtual bool useEmptyLayout() const { return true; } + /// Is this inset's layout defined in the document's textclass? + /// May be wrong after textclass change or paste from another document + bool undefined() const; protected: /// virtual void doDispatch(Cursor & cur, FuncRequest & cmd); /// - void edit(Cursor & cur, bool left); + void edit(Cursor & cur, bool front, + EntryDirection entry_from = ENTRY_DIRECTION_IGNORE); /// Inset * editXY(Cursor & cur, int x, int y); /// @@ -162,10 +176,11 @@ protected: /// virtual void resetParagraphsFont(); -protected: - /// - InsetLayout const * layout_; private: + /// text class to keep the InsetLayout above in memory + TextClassPtr textClass_; + /// cache for the layout_. Make sure it is in sync with the text class! + InsetLayout const * layout_; /// Dimension dimensionCollapsed() const; ///