]> git.lyx.org Git - features.git/commitdiff
some nicer margins and some small cleanup
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 14 Aug 2004 15:55:22 +0000 (15:55 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 14 Aug 2004 15:55:22 +0000 (15:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8925 a592a061-630c-0410-9148-cb99ea01b6c8

15 files changed:
po/POTFILES.in
src/ChangeLog
src/cursor.C
src/factory.C
src/insets/ChangeLog
src/insets/insetcaption.C
src/insets/insetcollapsable.C
src/insets/insetenv.C
src/insets/insettext.C
src/insets/insettext.h
src/rowpainter.C
src/rowpainter.h
src/tabular.C
src/text.C
src/text3.C

index cf76b832377c87b7ca1b17a4cd2f8bb19eeed54c..225ff4f4b48a0ab82a4aae812c04e7ba69514f01 100644 (file)
@@ -177,7 +177,6 @@ src/mathed/formulamacro.C
 src/mathed/math_hullinset.C
 src/mathed/math_macrotemplate.C
 src/mathed/math_nestinset.C
-src/mathed/math_parboxinset.C
 src/mathed/ref_inset.C
 src/output.C
 src/output_docbook.C
index 29a0121abf60c79f47fd5f3b2342bf3cb59e93e2..9449533a900845bbb2a07748c9d51f0ed1175678 100644 (file)
@@ -1,10 +1,30 @@
+2004-08-14  Lars Gullik Bjonnes  <larsbj@lyx.org>
+
+       * text3.C: use Debug::DEBUG a bit more
+
+       * text.C (leftMargin): try to simplify a tiny bit change var x to
+       l_margin. Dont output the wide margins always.
+       (rightMargin): no margin in inner texts
+
+       * rowpainter.h (nestMargin): new func
+       (changebarMargin): new func
+       (rightMargin): new func
+
+       * rowpainter.C (paintDepthBar): changebarMargin and nestMargin is
+       now functions.
+       (paintLast): ditto
+
+       * factory.C (createInset): modify setDrawFrame
+
+       * cursor.C: use Debug::DEBUG a bit more
+
 2004-08-14  André Pönitz  <poenitz@gmx.net>
 
        * coordcache.[Ch]:
        * Makefile.am: new files to accomodate an 'external' (x,y)-position
     cache for all insets in (at least partially) visible (top-level)
          paragraphs.
-       
+
   * BufferView_pimpl.C: reset external coord cache before every update.
          This means the coord cache only contains valid entries.
 
index 947d70b6103b66157232c970f1ee1b49c218e1c4..2a45dbd4da51961455d68779b057749f06998315 100644 (file)
@@ -44,6 +44,7 @@
 #include "frontends/LyXView.h"
 
 #include <boost/assert.hpp>
+#include <boost/current_function.hpp>
 
 #include <sstream>
 
@@ -96,7 +97,7 @@ namespace {
                        double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
                        // '<=' in order to take the last possible position
                        // this is important for clicking behind \sum in e.g. '\sum_i a'
-                       lyxerr << "i: " << i << " d: " << d << " best: " << best_dist << endl;
+                       lyxerr[Debug::DEBUG] << "i: " << i << " d: " << d << " best: " << best_dist << endl;
                        if (d <= best_dist) {
                                best_dist = d;
                                result = it;
@@ -197,8 +198,8 @@ void LCursor::dispatch(FuncRequest const & cmd0)
        FuncRequest cmd = cmd0;
        LCursor safe = *this;
 
-       for ( ; size(); pop()) {
-               lyxerr << "LCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
+       for (; size(); pop()) {
+               lyxerr[Debug::DEBUG] << "LCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
                BOOST_ASSERT(pos() <= lastpos());
                BOOST_ASSERT(idx() <= lastidx());
                BOOST_ASSERT(par() <= lastpar());
@@ -1001,7 +1002,7 @@ bool LCursor::goUpDown(bool up)
 
 void LCursor::handleFont(string const & font)
 {
-       lyxerr << "LCursor::handleFont: " << font << endl;
+       lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION << ": " << font << endl;
        string safe;
        if (selection()) {
                macroModeClose();
@@ -1150,5 +1151,3 @@ void LCursor::noUpdate()
 {
        disp_.update(false);
 }
-
-
index 66ae5f30e5ec01fd80ea48bef19ae614656a418e..03a285a3c3e0e007b6eea7644f1f28878602148c 100644 (file)
@@ -187,7 +187,7 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
                if (!up) {
                        auto_ptr<InsetCaption> inset(new InsetCaption(params));
                        inset->setAutoBreakRows(true);
-                       inset->setDrawFrame(InsetText::LOCKED);
+                       inset->setDrawFrame(true);
                        inset->setFrameColor(LColor::captionframe);
                        return inset.release();
                }
index 33d652f1b64a9405935ef7a8a08a1c417cf83b7f..853bd8e7a4fc3c10ddc2ba90df6e027b9f3ff3f7 100644 (file)
@@ -1,4 +1,12 @@
+2004-08-14  Lars Gullik Bjonnes  <larsbj@lyx.org>
 
+       * insettext.[Ch] (setDrawFrame): take a bool, get rid of the
+       DrawFrame enum.
+
+       * insetcaption.C (InsetCaption): modify call to setDrawFrame
+       * insetcollapsable.C (InsetCollapsable): ditto
+       * insetenv.C (InsetEnvironment): ditto
+       
 2004-08-14  André Pönitz  <poenitz@gmx.net>
 
        * inset.[Ch]:
        * insetoptarg.C (latexOptional): if the optional argument contains
        a ']' enclose it in {curly brackets}
 
-       * insettext.C (editXY): 
-       * insettabular.C (editXY): 
-       * insetcollapsable.C (editXY): 
+       * insettext.C (editXY):
+       * insettabular.C (editXY):
+       * insetcollapsable.C (editXY):
        * insetbase.C (editXY): constify
 
        * insetcollapsable.C (priv_dispatch): on a mouse press event, do
        not ask for an update if we did nothing; on a mouse release, make
        sure that the cursor is  moved to the right position; on a mouse
        release, exit from the inset instead of invoking a
-       LFUN_FINISHED_RIGHT. 
+       LFUN_FINISHED_RIGHT.
 
        * insetbase.C (dispatch): before invoking dispatch, set cursor
        result to dispatch=update=true.
index 37e9c4ef9ff5627ed5f7148ba02b010e6c43ae55..cf1d9965b0698419c9c14bb9e5bb695fb07d894e 100644 (file)
@@ -44,7 +44,7 @@ InsetCaption::InsetCaption(BufferParams const & bp)
        : InsetText(bp)
 {
        setAutoBreakRows(true);
-       setDrawFrame(InsetText::LOCKED);
+       setDrawFrame(true);
        setFrameColor(LColor::captionframe);
 }
 
index 31c4350b5334d64b742e18f423a74f80c61197e8..f8de8e7f6c5ac35791dceaa6c9f348f4c8176615 100644 (file)
@@ -55,7 +55,7 @@ InsetCollapsable::InsetCollapsable(BufferParams const & bp,
        : InsetText(bp), label("Label"), status_(status), openinlined_(false)
 {
        setAutoBreakRows(true);
-       setDrawFrame(InsetText::ALWAYS);
+       setDrawFrame(true);
        setFrameColor(LColor::collapsableframe);
        setInsetName("Collapsable");
        setButtonLabel();
@@ -253,16 +253,16 @@ InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y) const
 
 void InsetCollapsable::priv_dispatch(LCursor & cur, FuncRequest & cmd)
 {
-//     lyxerr << "InsetCollapsable::priv_dispatch (begin): cmd: " << cmd
-//            << "  button y: " << button_dim.y2 
-//            << "  coll/inline/open: " << status_ << endl;
+//     lyxerr << "InsetCollapsable::priv_dispatch (begin): cmd: " << cmd
+//            << "  button y: " << button_dim.y2
+//            << "  coll/inline/open: " << status_ << endl;
        switch (cmd.action) {
        case LFUN_MOUSE_PRESS:
                if (status_ == Inlined)
                        InsetText::priv_dispatch(cur, cmd);
                else if (status_ == Open && !hitButton(cmd))
                        InsetText::priv_dispatch(cur, cmd);
-               else 
+               else
                  cur.noUpdate();
                break;
 
index 6898757a0cea14740ac427ad5bdcac7370272c9c..5980ab9aedaa0d40540568eccbf90dcd14397a84 100644 (file)
@@ -32,7 +32,7 @@ InsetEnvironment::InsetEnvironment
 {
        setInsetName(name);
        setAutoBreakRows(true);
-       setDrawFrame(ALWAYS);
+       setDrawFrame(true);
 }
 
 
index cd751325f5d0ad8ae8530fa540c0028d9bbdd017..268d19a5991ccf0aed2d769f6cc5c38769c4b0e1 100644 (file)
@@ -69,7 +69,7 @@ using std::vector;
 
 
 InsetText::InsetText(BufferParams const & bp)
-       : autoBreakRows_(false), drawFrame_(NEVER),
+       : autoBreakRows_(false), drawFrame_(false),
          frame_color_(LColor::insetframe), text_(0)
 {
        paragraphs().push_back(Paragraph());
@@ -205,7 +205,7 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
 
        text_.draw(pi, x, y + bv->top_y());
 
-       if (drawFrame_ == ALWAYS || drawFrame_ == LOCKED)
+       if (drawFrame_)
                drawFrame(pi.pain, x, y);
 }
 
@@ -306,7 +306,7 @@ void InsetText::edit(LCursor & cur, bool left)
 
 InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const
 {
-       lyxerr << "InsetText::edit xy" << endl;
+       lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION << endl;
        old_par = -1;
        return text_.editXY(cur, x, y);
        //sanitizeEmptyText(cur.bv());
@@ -448,9 +448,9 @@ void InsetText::setAutoBreakRows(bool flag)
 }
 
 
-void InsetText::setDrawFrame(DrawFrame how)
+void InsetText::setDrawFrame(bool flag)
 {
-       drawFrame_ = how;
+       drawFrame_ = flag;
 }
 
 
index 09ba6880118e6f34b7b70e3f6efced886eb3caff..a44fadf1538646994d0ce8bdc66260ffe874b713 100644 (file)
@@ -38,15 +38,6 @@ class Row;
  */
 class InsetText : public UpdatableInset {
 public:
-       ///
-       enum DrawFrame {
-               ///
-               NEVER = 0,
-               ///
-               LOCKED,
-               ///
-               ALWAYS
-       };
        ///
        explicit InsetText(BufferParams const &);
        ///
@@ -102,7 +93,7 @@ public:
        ///
        bool getAutoBreakRows() const { return autoBreakRows_; }
        ///
-       void setDrawFrame(DrawFrame);
+       void setDrawFrame(bool);
        ///
        LColor_color frameColor() const;
        ///
@@ -174,7 +165,7 @@ private:
        ///
        bool autoBreakRows_;
        ///
-       DrawFrame drawFrame_;
+       bool drawFrame_;
        /** We store the LColor::color value as an int to get LColor.h out
         *  of the header file.
         */
index 56fd368fe45c0122c0de363ddcf3216abb436563..9f970230c3ffb6f0bce875cde810776043ece499 100644 (file)
@@ -47,9 +47,6 @@ using std::endl;
 using std::max;
 using std::string;
 
-extern int NEST_MARGIN;
-extern int CHANGEBAR_MARGIN;
-
 
 namespace {
 
@@ -129,8 +126,10 @@ RowPainter::RowPainter(BufferView const & bv, Painter & pain,
        //lyxerr << "RowPainter: x: " << x_ << " xo: " << xo << " yo: " << yo
        //      << " pit->y: " << pit_->y
        //      << " row: " << (pars_[pit_].size() ? pars_[pit_].getChar(row_.pos()) : 'X') << endl;
+
        RowMetrics m = text_.computeRowMetrics(pit, row_);
        x_ = m.x + xo_;
+
        separator_ = m.separator;
        hfill_ = m.hfill;
        label_hfill_ = m.label_hfill;
@@ -544,11 +543,12 @@ void RowPainter::paintDepthBar()
        }
 
        for (Paragraph::depth_type i = 1; i <= depth; ++i) {
-               int const w = NEST_MARGIN / 5;
-               int x = int(w * i + xo_);
+               int const w = nestMargin() / 5;
+               int x = xo_ + w * i;
                // only consider the changebar space if we're drawing outer left
                if (xo_ == 0)
-                       x += CHANGEBAR_MARGIN;
+                       x += changebarMargin();
+
                int const h = yo_ + row_.height() - 1 - (i - next_depth - 1) * 3;
 
                pain_.line(x, yo_, x, h, LColor::depthbar);
@@ -718,7 +718,7 @@ void RowPainter::paintLast()
                LyXFont const font = getLabelFont();
                int const size = int(0.75 * font_metrics::maxAscent(font));
                int const y = yo_ + row_.baseline() - size;
-               int x = is_rtl ? NEST_MARGIN + CHANGEBAR_MARGIN: width_ - size;
+               int x = is_rtl ? nestMargin() + changebarMargin() : width_ - size;
 
                if (width_ - int(row_.width()) <= size)
                        x += (size - width_ + row_.width() + 1) * (is_rtl ? -1 : 1);
index b3904b27f5d47f20738855846a054eb535c56706..05c5f538ec8f240be2dad81868541536f11bf9d8 100644 (file)
@@ -29,4 +29,25 @@ void refreshPar(BufferView const & bv, LyXText const & text,
 /// paint the rows of a text inset
 void paintTextInset(LyXText const & text, PainterInfo & pi);
 
+/// some space for drawing the 'nested' markers (in pixel)
+inline int nestMargin()
+{
+       return 15;
+}
+
+
+/// margin for changebar
+inline int changebarMargin()
+{
+       return 10;
+}
+
+
+/// right margin
+inline int rightMargin()
+{
+       return 30;
+}
+
+
 #endif // ROWPAINTER_H
index c3da317f2c5ef1e884d2dedea1389ae3479c14e6..0cb7adec7bb1b19be5bc611dfcbd1ddcba483538 100644 (file)
@@ -377,7 +377,9 @@ void LyXTabular::fixCellNums()
        int cellno = 0;
        for (int i = 0; i < rows_; ++i) {
                for (int j = 0; j < columns_; ++j) {
-                       cell_info[i][j].inset.setDrawFrame(InsetText::LOCKED);
+                       // When debugging it can be nice to set
+                       // this to true.
+                       cell_info[i][j].inset.setDrawFrame(false);
                        cell_info[i][j].cellno = cellno++;
                }
                cell_info[i].back().right_line = true;
index 6c6c06b303bb11b867cff6320839bfc546f274bd..7fe1ce68f54f3d40a052da5a759314bbb71ac63c 100644 (file)
@@ -90,14 +90,6 @@ using std::endl;
 using std::string;
 
 
-/// some space for drawing the 'nested' markers (in pixel)
-extern int const NEST_MARGIN = 20;
-/// margin for changebar
-extern int const CHANGEBAR_MARGIN = 10;
-/// right margin
-extern int const RIGHT_MARGIN = 10;
-
-
 namespace {
 
 int numberOfSeparators(Paragraph const & par, Row const & row)
@@ -506,82 +498,68 @@ int LyXText::leftMargin(par_type pit, pos_type pos) const
 
        string parindent = layout->parindent;
 
-       int x = NEST_MARGIN + CHANGEBAR_MARGIN;
+       int l_margin = 0;
 
-       x += font_metrics::signedWidth(tclass.leftmargin(), tclass.defaultfont());
+       if (xo_ == 0)
+               l_margin += changebarMargin();
 
-       // This is the way LyX handles LaTeX-Environments.
-       // I have had this idea very late, so it seems to be a
-       // later added hack and this is true
-       if (pars_[pit].getDepth() == 0) {
-               if (pars_[pit].layout() == tclass.defaultLayout()) {
-                       // find the previous same level paragraph
-                       if (pit != 0) {
-                               par_type newpit =
-                                       depthHook(pit, paragraphs(), pars_[pit].getDepth());
-                               if (newpit == pit && pars_[newpit].layout()->nextnoindent)
+       l_margin += font_metrics::signedWidth(tclass.leftmargin(), tclass.defaultfont());
+
+       if (pars_[pit].getDepth() != 0) {
+       // find the next level paragraph
+       par_type newpar = outerHook(pit, pars_);
+               if (newpar != par_type(pars_.size())) {
+                       if (pars_[newpar].layout()->isEnvironment()) {
+                               l_margin = leftMargin(newpar);
+                       }
+                       if (pars_[pit].layout() == tclass.defaultLayout()) {
+                               if (pars_[newpar].params().noindent())
                                        parindent.erase();
+                               else
+                                       parindent = pars_[newpar].layout()->parindent;
                        }
                }
-       } else {
-               // find the next level paragraph
-               par_type newpar = outerHook(pit, pars_);
-
-               // Make a corresponding row. Need to call leftMargin()
-               // to check whether it is a sufficent paragraph.
-               if (newpar != par_type(pars_.size())
-                   && pars_[newpar].layout()->isEnvironment()) {
-                       x = leftMargin(newpar);
-               }
-
-               if (newpar != par_type(paragraphs().size())
-                   && pars_[pit].layout() == tclass.defaultLayout()) {
-                       if (pars_[newpar].params().noindent())
-                               parindent.erase();
-                       else
-                               parindent = pars_[newpar].layout()->parindent;
-               }
        }
 
        LyXFont const labelfont = getLabelFont(pit);
        switch (layout->margintype) {
        case MARGIN_DYNAMIC:
                if (!layout->leftmargin.empty())
-                       x += font_metrics::signedWidth(layout->leftmargin,
+                       l_margin += font_metrics::signedWidth(layout->leftmargin,
                                                  tclass.defaultfont());
                if (!pars_[pit].getLabelstring().empty()) {
-                       x += font_metrics::signedWidth(layout->labelindent,
+                       l_margin += font_metrics::signedWidth(layout->labelindent,
                                                  labelfont);
-                       x += font_metrics::width(pars_[pit].getLabelstring(),
+                       l_margin += font_metrics::width(pars_[pit].getLabelstring(),
                                            labelfont);
-                       x += font_metrics::width(layout->labelsep, labelfont);
+                       l_margin += font_metrics::width(layout->labelsep, labelfont);
                }
                break;
 
        case MARGIN_MANUAL:
-               x += font_metrics::signedWidth(layout->labelindent, labelfont);
+               l_margin += font_metrics::signedWidth(layout->labelindent, labelfont);
                // The width of an empty par, even with manual label, should be 0
                if (!pars_[pit].empty() && pos >= pars_[pit].beginOfBody()) {
                        if (!pars_[pit].getLabelWidthString().empty()) {
-                               x += font_metrics::width(pars_[pit].getLabelWidthString(),
+                               l_margin += font_metrics::width(pars_[pit].getLabelWidthString(),
                                               labelfont);
-                               x += font_metrics::width(layout->labelsep, labelfont);
+                               l_margin += font_metrics::width(layout->labelsep, labelfont);
                        }
                }
                break;
 
        case MARGIN_STATIC:
-               x += font_metrics::signedWidth(layout->leftmargin, tclass.defaultfont()) * 4
+               l_margin += font_metrics::signedWidth(layout->leftmargin, tclass.defaultfont()) * 4
                        / (pars_[pit].getDepth() + 4);
                break;
 
        case MARGIN_FIRST_DYNAMIC:
                if (layout->labeltype == LABEL_MANUAL) {
                        if (pos >= pars_[pit].beginOfBody()) {
-                               x += font_metrics::signedWidth(layout->leftmargin,
+                               l_margin += font_metrics::signedWidth(layout->leftmargin,
                                                          labelfont);
                        } else {
-                               x += font_metrics::signedWidth(layout->labelindent,
+                               l_margin += font_metrics::signedWidth(layout->labelindent,
                                                          labelfont);
                        }
                } else if (pos != 0
@@ -589,17 +567,17 @@ int LyXText::leftMargin(par_type pit, pos_type pos) const
                           // theorems (JMarc)
                           || (layout->labeltype == LABEL_STATIC
                               && layout->latextype == LATEX_ENVIRONMENT
-                              && !isFirstInSequence(pit, paragraphs()))) {
-                       x += font_metrics::signedWidth(layout->leftmargin,
+                              && !isFirstInSequence(pit, pars_))) {
+                       l_margin += font_metrics::signedWidth(layout->leftmargin,
                                                  labelfont);
                } else if (layout->labeltype != LABEL_TOP_ENVIRONMENT
                           && layout->labeltype != LABEL_BIBLIO
                           && layout->labeltype !=
                           LABEL_CENTERED_TOP_ENVIRONMENT) {
-                       x += font_metrics::signedWidth(layout->labelindent,
+                       l_margin += font_metrics::signedWidth(layout->labelindent,
                                                  labelfont);
-                       x += font_metrics::width(layout->labelsep, labelfont);
-                       x += font_metrics::width(pars_[pit].getLabelstring(),
+                       l_margin += font_metrics::width(layout->labelsep, labelfont);
+                       l_margin += font_metrics::width(pars_[pit].getLabelstring(),
                                            labelfont);
                }
                break;
@@ -617,19 +595,18 @@ int LyXText::leftMargin(par_type pit, pos_type pos) const
                for ( ; rit != end; ++rit)
                        if (rit->fill() < minfill)
                                minfill = rit->fill();
-               x += font_metrics::signedWidth(layout->leftmargin,
+               l_margin += font_metrics::signedWidth(layout->leftmargin,
                        tclass.defaultfont());
-               x += minfill;
+               l_margin += minfill;
 #endif
                // also wrong, but much shorter.
-               x += maxwidth_ / 2;
+               l_margin += maxwidth_ / 2;
                break;
        }
        }
 
-
        if (!pars_[pit].params().leftIndent().zero())
-               x += pars_[pit].params().leftIndent().inPixels(maxwidth_);
+               l_margin += pars_[pit].params().leftIndent().inPixels(maxwidth_);
 
        LyXAlignment align;
 
@@ -645,20 +622,20 @@ int LyXText::leftMargin(par_type pit, pos_type pos) const
               || layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT
               || (layout->labeltype == LABEL_STATIC
                   && layout->latextype == LATEX_ENVIRONMENT
-                  && !isFirstInSequence(pit, paragraphs())))
+                  && !isFirstInSequence(pit, pars_)))
            && align == LYX_ALIGN_BLOCK
            && !pars_[pit].params().noindent()
            // in tabulars and ert paragraphs are never indented!
-           && (pars_[pit].ownerCode() != InsetOld::TABULAR_CODE
-                   && pars_[pit].ownerCode() != InsetOld::ERT_CODE)
+           && (pars_[pit].ownerCode() != InsetBase::TEXT_CODE
+                   && pars_[pit].ownerCode() != InsetBase::ERT_CODE)
            && (pars_[pit].layout() != tclass.defaultLayout()
                || bv()->buffer()->params().paragraph_separation ==
                   BufferParams::PARSEP_INDENT))
        {
-               x += font_metrics::signedWidth(parindent, tclass.defaultfont());
+               l_margin += font_metrics::signedWidth(parindent, tclass.defaultfont());
        }
 
-       return x;
+       return l_margin;
 }
 
 
@@ -666,13 +643,20 @@ int LyXText::rightMargin(Paragraph const & par) const
 {
        LyXTextClass const & tclass = bv()->buffer()->params().getLyXTextClass();
 
-       return
-               RIGHT_MARGIN
+       // We do not want rightmargins on inner texts.
+       if (bv()->text() != this)
+               return 0;
+
+       int const r_margin =
+               ::rightMargin()
                + font_metrics::signedWidth(tclass.rightmargin(),
-                                      tclass.defaultfont())
+                                           tclass.defaultfont())
                + font_metrics::signedWidth(par.layout()->rightmargin,
-                                      tclass.defaultfont())
+                                           tclass.defaultfont())
                * 4 / (par.getDepth() + 4);
+
+       return r_margin;
+
 }
 
 
index adf27cfc27cd8e6fceaf3b7754e705a726723901..d07a337b245e9a5e833e15a7a0d0d257fc91f2c7 100644 (file)
@@ -186,7 +186,7 @@ string const freefont2string()
 
 
 // takes absolute x,y coordinates
-InsetBase * LyXText::checkInsetHit(int x, int y) const 
+InsetBase * LyXText::checkInsetHit(int x, int y) const
 {
        par_type pit;
        par_type end;
@@ -196,15 +196,17 @@ InsetBase * LyXText::checkInsetHit(int x, int y) const
                       bv()->top_y() - yo_ + bv()->workHeight(),
                       pit, end);
 
-       lyxerr << "checkInsetHit: x: " << x << " y: " << y << endl;
-       lyxerr << "  pit: " << pit << " end: " << end << endl;
+       lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION
+                            << ": x: " << x << " y: " << y
+                            << "  pit: " << pit << " end: " << end << endl;
        for (; pit != end; ++pit) {
                InsetList::const_iterator iit = pars_[pit].insetlist.begin();
                InsetList::const_iterator iend = pars_[pit].insetlist.end();
                for (; iit != iend; ++iit) {
                        InsetBase * inset = iit->inset;
 #if 1
-                       lyxerr << "examining inset " << inset << endl;
+                       lyxerr[Debug::DEBUG]
+                               << "examining inset " << inset << endl;
                        if (theCoords.insets_.has(inset))
                                lyxerr
                                        << " xo: " << inset->xo() << "..." << inset->xo() + inset->width()
@@ -214,12 +216,13 @@ InsetBase * LyXText::checkInsetHit(int x, int y) const
                                lyxerr << " inset has no cached position";
 #endif
                        if (inset->covers(x, y)) {
-                               lyxerr << "Hit inset: " << inset << endl;
+                               lyxerr[Debug::DEBUG]
+                                       << "Hit inset: " << inset << endl;
                                return inset;
                        }
                }
        }
-       lyxerr << "No inset hit. " << endl;
+       lyxerr[Debug::DEBUG] << "No inset hit. " << endl;
        return 0;
 }
 
@@ -1448,21 +1451,21 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_FINISHED_LEFT:
-               lyxerr << "handle LFUN_FINISHED_LEFT:\n" << cur << endl;
+               lyxerr[Debug::DEBUG] << "handle LFUN_FINISHED_LEFT:\n" << cur << endl;
                break;
 
        case LFUN_FINISHED_RIGHT:
-               lyxerr << "handle LFUN_FINISHED_RIGHT:\n" << cur << endl;
+               lyxerr[Debug::DEBUG] << "handle LFUN_FINISHED_RIGHT:\n" << cur << endl;
                ++cur.pos();
                break;
 
        case LFUN_FINISHED_UP:
-               lyxerr << "handle LFUN_FINISHED_UP:\n" << cur << endl;
+               lyxerr[Debug::DEBUG] << "handle LFUN_FINISHED_UP:\n" << cur << endl;
                cursorUp(cur);
                break;
 
        case LFUN_FINISHED_DOWN:
-               lyxerr << "handle LFUN_FINISHED_DOWN:\n" << cur << endl;
+               lyxerr[Debug::DEBUG] << "handle LFUN_FINISHED_DOWN:\n" << cur << endl;
                cursorDown(cur);
                break;