]> git.lyx.org Git - features.git/commitdiff
partial fix for bug 622, cosmetic rest remains open
authorAndré Pönitz <poenitz@gmx.net>
Fri, 15 Jul 2005 00:39:44 +0000 (00:39 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 15 Jul 2005 00:39:44 +0000 (00:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10195 a592a061-630c-0410-9148-cb99ea01b6c8

19 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/insets/insetbase.C
src/insets/insetbase.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/lyxtext.h
src/mathed/ChangeLog
src/mathed/math_hullinset.C
src/mathed/math_hullinset.h
src/mathed/math_nestinset.C
src/mathed/math_nestinset.h
src/text2.C
src/text3.C
src/undo.C

index 0d2d466a853235603a6543b2de55bbdadc2b4941..d497313e496e2cf09d8af7fee086a8667d75b88e 100644 (file)
@@ -875,8 +875,7 @@ void BufferView::Pimpl::trackChanges()
 
 bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0)
 {
-       lyxerr << BOOST_CURRENT_FUNCTION
-              << "[ cmd0 " << cmd0 << "]" << endl;
+       //lyxerr << BOOST_CURRENT_FUNCTION << "[ cmd0 " << cmd0 << "]" << endl;
 
        // This is only called for mouse related events including
        // LFUN_FILE_OPEN generated by drag-and-drop.
@@ -910,10 +909,10 @@ bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0)
        // Build temporary cursor.
        cmd.y = min(max(cmd.y,-1), workarea().workHeight());
        InsetBase * inset = bv_->text()->editXY(cur, cmd.x, cmd.y);
-       lyxerr << BOOST_CURRENT_FUNCTION
-              << " * hit inset at tip: " << inset << endl;
-       lyxerr << BOOST_CURRENT_FUNCTION
-              << " * created temp cursor:" << cur << endl;
+       //lyxerr << BOOST_CURRENT_FUNCTION
+       //       << " * hit inset at tip: " << inset << endl;
+       //lyxerr << BOOST_CURRENT_FUNCTION
+       //       << " * created temp cursor:" << cur << endl;
 
        // Put anchor at the same position.
        cur.resetAnchor();
index eee34cf82ebb343fa1fdf532eb98258d1fb295e3..0a105e02057329b993e8f7da944eac961d16031c 100644 (file)
@@ -1,15 +1,15 @@
 
-2005-05-07  André Pönitz  <poenitz@gmx.net>
+2005-07-14  André Pönitz  <poenitz@gmx.net>
 
        * undo.C (recordUndoFullBuffer): implement undo for
   textclass switches
 
-2005-05-07  André Pönitz  <poenitz@gmx.net>
+2005-07-14  André Pönitz  <poenitz@gmx.net>
 
        * cursor.C (setSelection): open insets when selection is set there
   to avoid crashs with cold coord cache
 
-2005-05-07  André Pönitz  <poenitz@gmx.net>
+2005-07-14  André Pönitz  <poenitz@gmx.net>
 
        * trans_mgr.C (insert): move cursor to the right after inserting
   a char.
index dcbc08fac9fcab7a4bce033a4295dbc0d64e22f0..c97ec15af5707409ca5f85bbf5e8d0a2baccae5c 100644 (file)
@@ -176,10 +176,10 @@ void InsetBase::edit(LCursor &, bool)
 }
 
 
-InsetBase * InsetBase::editXY(LCursor &, int x, int y) const
+InsetBase * InsetBase::editXY(LCursor &, int x, int y)
 {
        lyxerr << "InsetBase: editXY x:" << x << " y: " << y << std::endl;
-       return const_cast<InsetBase*>(this);
+       return this;
 }
 
 
index 52ead301278ad23a302967ee74a9e018d4be54ac..8ea769041005b7022961de3e8b92015e1d0043fa 100644 (file)
@@ -106,7 +106,7 @@ public:
        /// cursor enters
        virtual void edit(LCursor & cur, bool left);
        /// cursor enters
-       virtual InsetBase * editXY(LCursor & cur, int x, int y) const;
+       virtual InsetBase * editXY(LCursor & cur, int x, int y);
 
        /// compute the size of the object returned in dim
        virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
index 7e371e6235d063221b5c0edcfe0ba21d4ef7b96b..410cd90a589900a3e998fbf9f51b21d0b88f0034 100644 (file)
@@ -260,13 +260,12 @@ void InsetCollapsable::edit(LCursor & cur, bool left)
 }
 
 
-InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y) const
+InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y)
 {
        //lyxerr << "InsetCollapsable: edit xy" << endl;
-       if (status_ == Collapsed) {
-               return const_cast<InsetCollapsable*>(this);
-       }
-       cur.push(const_cast<InsetCollapsable&>(*this));
+       if (status_ == Collapsed)
+               return this;
+       cur.push(*this);
        return InsetText::editXY(cur, x, y);
 }
 
index a552119eb43ff7204763188f026a0c60d1a23381..264904902ee508181a81fbc1b318f59d365a44fb 100644 (file)
@@ -96,7 +96,7 @@ protected:
        ///
        void edit(LCursor & cur, bool left);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y) const;
+       InsetBase * editXY(LCursor & cur, int x, int y);
        ///
        void setInlined() { status_ = Inlined; }
 
index 4ccb70b76854dab25c1c55ecfc919b68e35daad9..3a9f61bed9fbde0938c37d965995f39291426a6e 100644 (file)
@@ -1158,11 +1158,11 @@ int InsetTabular::dist(idx_type const cell, int x, int y) const
 }
 
 
-InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y) const
+InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y)
 {
        //lyxerr << "InsetTabular::editXY: " << this << endl;
        cur.selection() = false;
-       cur.push(const_cast<InsetTabular&>(*this));
+       cur.push(*this);
        cur.idx() = getNearestCell(x, y);
        resetPos(cur);
        return cell(cur.idx())->text_.editXY(cur, x, y);
index 4d73b7859dc959666c28feb1611c0003d1deaaf0..206f573f5dbea6dee236695794d1c222fc9d149a 100644 (file)
@@ -130,7 +130,7 @@ public:
        /// lock cell with given index
        void edit(LCursor & cur, bool left);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y) const;
+       InsetBase * editXY(LCursor & cur, int x, int y);
        /// can we go further down on mouse click?
        bool descendable() const { return true; }
 
index 0b9f8cad59269163ca1c935af103df1c9a0c8743..0c17b80920b3bef387c6ef373835014fc1407390 100644 (file)
@@ -288,7 +288,7 @@ void InsetText::edit(LCursor & cur, bool left)
 }
 
 
-InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const
+InsetBase * InsetText::editXY(LCursor & cur, int x, int y)
 {
        old_pit = -1;
        return text_.editXY(cur, x, y);
index 4d82a7b2c5c746e78b4a8552b9addeb9aa707bdb..ed387ff0f25d4f5f81f85b38d154008a001bfee7 100644 (file)
@@ -124,7 +124,7 @@ public:
        ///
        void edit(LCursor & cur, bool left);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y) const;
+       InsetBase * editXY(LCursor & cur, int x, int y);
 
        /// number of cells in this inset
        size_t nargs() const { return 1; }
index a73826cb8a198732c9587ebbd55c111fbd9eeafc..882f340571c7cc1d2e08d6c76ccf265034c92ef7 100644 (file)
@@ -180,7 +180,7 @@ public:
        ///
        void setCursorFromCoordinates(LCursor & cur, int x, int y);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y) const;
+       InsetBase * editXY(LCursor & cur, int x, int y);
        /// Move cursor one line up.
        /**
         * Returns true if an update is needed after the move.
index d1763faa80f2d4183059ac441490b94e762a4c8a..e10d7fa3d6ebdf49fe069014742103cbbfb2cafc 100644 (file)
@@ -1,18 +1,22 @@
 
-2005-07-16  André Pönitz  <poenitz@lyx.org>
+2005-07-15  Andreas Vox  <vox@arcor.de>
+
+       * math_hullinset.C (editXY): partial fix for #622
+
+2005-07-14  André Pönitz  <poenitz@lyx.org>
 
        * math_hullinset.C (BREAKLINE): choose between eqnarray and
   align according to user preference
 
-2005-07-16  André Pönitz  <poenitz@lyx.org>
+2005-07-14  André Pönitz  <poenitz@lyx.org>
 
        * math_charinset.C (mathmlize): escape <, >, and & on export
 
-2005-07-16  André Pönitz  <poenitz@lyx.org>
+2005-07-14  André Pönitz  <poenitz@lyx.org>
 
        * math_gridinset.C (doDispatch): cur.undispatched on LFUN_ESCAPE
 
-2005-07-16  André Pönitz  <poenitz@lyx.org>
+2005-07-14  André Pönitz  <poenitz@lyx.org>
 
        * math_gridinset.C (doDispatch): cur.undispatched on LFUN_NEXT/PRIOR
 
index cacf5cdd525f2c9813459becd3d35db6a9e3f8fd..b9200844057c3e5e72dfb6977ffa96a08f359e61 100644 (file)
@@ -183,6 +183,16 @@ MathHullInset & MathHullInset::operator=(MathHullInset const & other)
 }
 
 
+InsetBase * MathHullInset::editXY(LCursor & cur, int x, int y)
+{
+       if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
+               edit(cur, true);
+               return this;
+       }
+       return MathNestInset::editXY(cur, x, y); 
+}
+
+
 MathInset::mode_type MathHullInset::currentMode() const
 {
        if (type_ == "none")
index d82b845c5b37a6cb450aff5990d38145742c029d..64bd708820babb8b370885938137ed4f37459686 100644 (file)
@@ -196,6 +196,8 @@ public:
        ///
        void edit(LCursor & cur, bool left);
        ///
+       InsetBase * editXY(LCursor & cur, int x, int y);
+       ///
        bool display() const;
        ///
        Code lyxCode() const;
index 2950fbb59f585756c1b740e91362ecf048bfe9a6..90addf0155d3df055e04bb7ae0f685744db124e2 100644 (file)
@@ -987,19 +987,19 @@ void MathNestInset::edit(LCursor & cur, bool left)
 }
 
 
-InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y) const
+InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y)
 {
        int idx_min = 0;
        int dist_min = 1000000;
-       for (idx_type i = 0; i < nargs(); ++i) {
-               int d = cell(i).dist(x, y);
+       for (idx_type i = 0, n = nargs(); i != n; ++i) {
+               int const d = cell(i).dist(x, y);
                if (d < dist_min) {
                        dist_min = d;
                        idx_min = i;
                }
        }
-       MathArray const & ar = cell(idx_min);
-       cur.push(const_cast<MathNestInset&>(*this));
+       MathArray & ar = cell(idx_min);
+       cur.push(*this);
        cur.idx() = idx_min;
        cur.pos() = ar.x2pos(x - ar.xo());
        lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl;
@@ -1009,7 +1009,7 @@ InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y) const
                        if (ar[i]->covers(x, y))
                                return ar[i].nucleus()->editXY(cur, x, y);
        }
-       return const_cast<MathNestInset*>(this);
+       return this;
 }
 
 
index 4e3af6185e8253cb737f723f6c1f7ce5e4e80f70..46b6abe332971ce5ea0c970c7790505a6d67c847 100644 (file)
@@ -41,7 +41,7 @@ public:
        ///
        void edit(LCursor & cur, bool left);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y) const;
+       InsetBase * editXY(LCursor & cur, int x, int y);
 
        /// order of movement through the cells when pressing the left key
        bool idxLeft(LCursor &) const;
index f7fbeeaace3d491feb64460824edf68dda045c2a..8b0460572dac25d3ec02d9c008da55f73b218e9b 100644 (file)
@@ -912,7 +912,7 @@ Row const & LyXText::getRowNearY(int y, pit_type pit) const
 
 // x,y are absolute screen coordinates
 // sets cursor recursively descending into nested editable insets
-InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
+InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
 {
        pit_type pit = getPitNearY(y);
        BOOST_ASSERT(pit != -1);
@@ -932,7 +932,7 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
        if (!inset) {
                // Either we deconst editXY or better we move current_font
                // and real_current_font to LCursor
-               const_cast<LyXText *>(this)->setCurrentFont(cur);
+               setCurrentFont(cur);
                return 0;
        }
 
@@ -946,7 +946,7 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
                --cur.pos();
        inset = inset->editXY(cur, x, y);
        if (cur.top().text() == this)
-               const_cast<LyXText *>(this)->setCurrentFont(cur);
+               setCurrentFont(cur);
        return inset;
 }
 
index b8dfda96754a62403fda7b749660f28370d1cad0..16a2fe645f193e7d2a0c96511345b5b32de7178a 100644 (file)
@@ -288,7 +288,6 @@ bool LyXText::isRTL(Paragraph const & par) const
 void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 {
        lyxerr[Debug::ACTION] << "LyXText::dispatch: cmd: " << cmd << endl;
-       lyxerr << "*** LyXText::dispatch: cmd: " << cmd << endl;
 
        BOOST_ASSERT(cur.text() == this);
        BufferView * bv = &cur.bv();
@@ -1062,7 +1061,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                                // don't set anchor_
                                bvcur.setCursor(cur);
                                bvcur.selection() = true;
-                               lyxerr << "MOTION: " << bv->cursor() << endl;
+                               //lyxerr << "MOTION: " << bv->cursor() << endl;
                        }
 
                } else
index 4afddcbaf41d235cbeba27eccf39c43a0873f98d..cecca1c39ec84526172f68de671477c022133889 100644 (file)
@@ -65,8 +65,8 @@ void doRecordUndo(Undo::undo_kind kind,
        undo.cursor = cur;
        undo.bparams = bparams ;
        undo.isFullBuffer = isFullBuffer;
-       lyxerr << "recordUndo: cur: " << cur << endl;
-       lyxerr << "recordUndo: pos: " << cur.pos() << endl;
+       //lyxerr << "recordUndo: cur: " << cur << endl;
+       //lyxerr << "recordUndo: pos: " << cur.pos() << endl;
        //lyxerr << "recordUndo: cell: " << cell << endl;
        undo.from = first_pit;
        undo.end = cell.lastpit() - last_pit;