From 93adf5d595248347e02a009220d6ce7dbd38114a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 6 Feb 2004 11:12:49 +0000 Subject: [PATCH] re-enable bits of selection git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8407 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 2 +- src/insets/insetcollapsable.C | 6 ++++++ src/insets/insetcollapsable.h | 2 ++ src/insets/insettext.C | 6 ++++++ src/insets/insettext.h | 2 ++ src/lyxtext.h | 2 ++ src/rowpainter.C | 4 ++-- src/text.C | 7 +++++++ 8 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 4cc5294765..333c116fa1 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -975,7 +975,7 @@ bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0) bool BufferView::Pimpl::dispatch(FuncRequest const & cmd) { - lyxerr << "*** BufferView::Pimpl: request: " << cmd << std::endl; + //lyxerr << "*** BufferView::Pimpl: request: " << cmd << std::endl; // Make sure that the cached BufferView is correct. lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch:" << " action[" << cmd.action << ']' diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 8a285b8e8e..70c7b91b22 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -183,6 +183,12 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const } +void InsetCollapsable::drawSelection(PainterInfo & pi, int x, int y) const +{ + inset.drawSelection(pi, x, y); +} + + InsetOld::EDITABLE InsetCollapsable::editable() const { return status_ != Collapsed ? HIGHLY_EDITABLE : IS_EDITABLE; diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 0f4cd27e40..330b6e2718 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -53,6 +53,8 @@ public: /// void draw(PainterInfo & pi, int x, int y) const; /// + void drawSelection(PainterInfo & pi, int x, int y) const; + /// bool hitButton(FuncRequest const &) const; /// std::string const getNewLabel(std::string const & l) const; diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 195a2e31e0..0abf884686 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -213,6 +213,12 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const } +void InsetText::drawSelection(PainterInfo & pi, int x, int y) const +{ + text_.drawSelection(pi, x, y); +} + + void InsetText::drawFrame(Painter & pain, int x) const { int const ttoD2 = TEXT_TO_INSET_OFFSET / 2; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 09c9b3d0c0..cc847e593a 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -67,6 +67,8 @@ public: void metrics(MetricsInfo & mi, Dimension & dim) const; /// void draw(PainterInfo & pi, int x, int y) const; + /// draw inset selection + void drawSelection(PainterInfo & pi, int x, int y) const; /// std::string const editMessage() const; /// diff --git a/src/lyxtext.h b/src/lyxtext.h index 1555db6af0..42c6435974 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -121,6 +121,8 @@ public: void metrics(MetricsInfo & mi, Dimension & dim); /// draw text (only used for insets) void draw(PainterInfo & pi, int x, int y) const; + /// draw textselection + void drawSelection(PainterInfo & pi, int x, int y) const; /// try to handle that request DispatchResult dispatch(LCursor & cur, FuncRequest const & cmd); diff --git a/src/rowpainter.C b/src/rowpainter.C index cea4f0de89..fcdd02f95a 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -137,8 +137,8 @@ RowPainter::RowPainter(BufferView const & bv, LyXText const & text, // paint the selection background #warning look here for selection - //if (bv_.cursor().selection() && &text_ == bv_.cursor().innerText()) - // paintSelection(); + if (bv_.cursor().selection() && &text_ == bv_.cursor().innerText()) + paintSelection(); // vertical lines for appendix paintAppendix(); diff --git a/src/text.C b/src/text.C index 5f53767f14..2d2671dc33 100644 --- a/src/text.C +++ b/src/text.C @@ -1626,6 +1626,13 @@ void LyXText::draw(PainterInfo & pi, int x, int y) const } +// only used for inset right now. should also be used for main text +void LyXText::drawSelection(PainterInfo & pi, int x, int y) const +{ + lyxerr << "LyXText::drawSelection at " << x << " " << y << endl; +} + + bool LyXText::isLastRow(ParagraphList::iterator pit, Row const & row) const { return row.endpos() >= pit->size() -- 2.39.2