From b119fd180d08630b87530a744d6cde7b38bdbaca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 13 Aug 2004 22:24:42 +0000 Subject: [PATCH] remove unused mathed parts git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8915 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/insetcollapsable.C | 2 +- src/insets/insettabular.C | 24 ++++++---- src/mathed/Makefile.am | 2 - src/mathed/math_data.C | 44 +------------------ src/mathed/math_data.h | 12 ----- src/mathed/math_factory.C | 3 -- src/mathed/math_parboxinset.C | 82 ----------------------------------- src/mathed/math_parboxinset.h | 51 ---------------------- src/mathed/math_parser.C | 13 ------ src/rowpainter.C | 1 - src/text2.C | 2 +- src/text3.C | 8 ++-- 12 files changed, 23 insertions(+), 221 deletions(-) delete mode 100644 src/mathed/math_parboxinset.C delete mode 100644 src/mathed/math_parboxinset.h diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 7f7fb2b766..31c4350b53 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -263,7 +263,7 @@ void InsetCollapsable::priv_dispatch(LCursor & cur, FuncRequest & cmd) else if (status_ == Open && !hitButton(cmd)) InsetText::priv_dispatch(cur, cmd); else - cur.noUpdate(); + cur.noUpdate(); break; case LFUN_MOUSE_MOTION: diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index a0c75ba21b..f3e49bf25d 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -414,16 +414,22 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd) switch (cmd.action) { case LFUN_MOUSE_PRESS: - // we'll pop up the table dialog on release - if (cmd.button() == mouse_button::button3) + lyxerr << "# InsetTabular::MousePress\n" << cur.bv().cursor() << endl; + + if (cmd.button() == mouse_button::button1) { + cur.selection() = false; + setPos(cur, cmd.x, cmd.y); + cur.resetAnchor(); + bvcur = cur; break; - cur.selection() = false; - setPos(cur, cmd.x, cmd.y); - cur.resetAnchor(); - bvcur = cur; + } + //if (cmd.button() == mouse_button::button2) // dispatch(cur, FuncRequest(LFUN_PASTESELECTION, "paragraph")); - //lyxerr << "# InsetTabular::MousePress\n" << cur.bv().cursor() << endl; + + // we'll pop up the table dialog on release + if (cmd.button() == mouse_button::button3) + break; break; case LFUN_MOUSE_MOTION: @@ -434,11 +440,11 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd) break; setPos(cur, cmd.x, cmd.y); bvcur.setCursor(cur, true); - //lyxerr << "# InsetTabular::MouseMotion\n" << bvcur << endl; + lyxerr << "# InsetTabular::MouseMotion\n" << bvcur << endl; break; case LFUN_MOUSE_RELEASE: - //lyxerr << "# InsetTabular::MouseRelease\n" << bvcur << endl; + lyxerr << "# InsetTabular::MouseRelease\n" << bvcur << endl; if (cmd.button() == mouse_button::button3) InsetTabularMailer(*this).showDialog(&cur.bv()); break; diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index a89e9c12a6..524b91b37c 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -108,8 +108,6 @@ libmathed_la_SOURCES = \ math_numberinset.h \ math_oversetinset.C \ math_oversetinset.h \ - math_parboxinset.C \ - math_parboxinset.h \ math_parinset.C \ math_parinset.h \ math_parser.C \ diff --git a/src/mathed/math_data.C b/src/mathed/math_data.C index b6480ee7c0..e342291375 100644 --- a/src/mathed/math_data.C +++ b/src/mathed/math_data.C @@ -38,12 +38,12 @@ using std::vector; MathArray::MathArray() - : xo_(0), yo_(0), clean_(false), drawn_(false) + : xo_(0), yo_(0) {} MathArray::MathArray(const_iterator from, const_iterator to) - : base_type(from, to), xo_(0), yo_(0), clean_(false), drawn_(false) + : base_type(from, to), xo_(0), yo_(0) {} @@ -206,8 +206,6 @@ bool MathArray::contains(MathArray const & ar) const void MathArray::touch() const { - clean_ = false; - drawn_ = false; } @@ -237,11 +235,6 @@ bool isInside(DocIterator const & it, MathArray const & ar, void MathArray::metrics(MetricsInfo & mi) const { - //if (clean_) - // return; - clean_ = true; - drawn_ = false; - mathed_char_dim(mi.base.font, 'I', dim_); if (empty()) @@ -282,13 +275,10 @@ void MathArray::metrics(MetricsInfo & mi) const void MathArray::draw(PainterInfo & pi, int x, int y) const { - //if (drawn_ && x == xo_ && y == yo_) - // return; //lyxerr << "MathArray::draw: x: " << x << " y: " << y << endl; xo_ = x; yo_ = y; - drawn_ = true; if (empty()) { pi.pain.rectangle(x, y - ascent(), width(), height(), LColor::mathline); @@ -331,8 +321,6 @@ void MathArray::draw(PainterInfo & pi, int x, int y) const void MathArray::metricsT(TextMetricsInfo const & mi, Dimension & dim) const { - //if (clean_) - // return; dim.clear(); Dimension d; for (const_iterator it = begin(); it != end(); ++it) { @@ -423,34 +411,6 @@ int MathArray::dist(int x, int y) const } -bool MathArray::contains(int x, int y) const -{ - return xo_ <= x && x <= xo_ + width() - && yo_ - ascent() <= y && y <= yo_ + descent(); -} - - -void MathArray::center(int & x, int & y) const -{ - x = xo_ + width() / 2; - y = yo_ + (descent() - ascent()) / 2; -} - - -void MathArray::towards(int & x, int & y) const -{ - int cx = 0; - int cy = 0; - center(cx, cy); - - double r = 1.0; - //int dist = (x - cx) * (x - cx) + (y - cy) * (y - cy); - - x = cx + int(r * (x - cx)); - y = cy + int(r * (y - cy)); -} - - void MathArray::setXY(int x, int y) const { xo_ = x; diff --git a/src/mathed/math_data.h b/src/mathed/math_data.h index f9b58cc428..7e774d2850 100644 --- a/src/mathed/math_data.h +++ b/src/mathed/math_data.h @@ -119,8 +119,6 @@ public: int xm() const { return xo_ + dim_.wid / 2; } /// access to cached y coordinate of mid point of last drawing int ym() const { return yo_ + (dim_.des - dim_.asc) / 2; } - /// - bool contains(int x, int y) const; /// write access to coordinate; void setXY(int x, int y) const; /// returns x coordinate of given position in the array @@ -147,12 +145,6 @@ public: Dimension const & dim() const { return dim_; } /// dimensions of cell void setDim(Dimension const & d) const { dim_ = d; } - /// bounding box of this cell - void boundingBox(int & xlow, int & xhigh, int & ylow, int & yhigh); - /// gives center coordinates - void center(int & x, int & y) const; - /// adjust (x,y) to point on boundary on a straight line from the center - void towards(int & x, int & y) const; private: /// is this an exact match at this position? @@ -164,10 +156,6 @@ private: mutable int xo_; /// cached y coordinate of last drawing mutable int yo_; - /// cached cleaness of cell - mutable bool clean_; - /// cached draw status of cell - mutable bool drawn_; }; /// diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index 744f5aa34d..039a7947a2 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -36,7 +36,6 @@ #include "math_macrotemplate.h" #include "math_makeboxinset.h" #include "math_oversetinset.h" -#include "math_parboxinset.h" #include "math_parser.h" #include "math_rootinset.h" #include "math_sizeinset.h" @@ -255,8 +254,6 @@ MathAtom createMathInset(string const & s) return MathAtom(new MathDotsInset(l)); // if (inset == "mbox") // return MathAtom(new MathBoxInset(l->name)); - // if (inset == "parbox") - // return MathAtom(new MathParboxInset); // if (inset == "fbox") // return MathAtom(new MathFboxInset(l)); if (inset == "style") diff --git a/src/mathed/math_parboxinset.C b/src/mathed/math_parboxinset.C deleted file mode 100644 index 176d34988f..0000000000 --- a/src/mathed/math_parboxinset.C +++ /dev/null @@ -1,82 +0,0 @@ -/** - * \file math_parboxinset.C - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author André Pönitz - * - * Full author contact details are available in file CREDITS. - */ - -#include - -#include "math_parboxinset.h" -#include "math_data.h" -#include "math_mathmlstream.h" -#include "math_streamstr.h" -#include "debug.h" - - -using std::string; -using std::auto_ptr; -using std::endl; - - -MathParboxInset::MathParboxInset() - : lyx_width_(0), tex_width_("0mm"), position_('c') -{ - lyxerr << "constructing MathParboxInset" << endl; -} - - -auto_ptr MathParboxInset::clone() const -{ - return auto_ptr(new MathParboxInset(*this)); -} - - -void MathParboxInset::setPosition(string const & p) -{ - position_ = p.size() > 0 ? p[0] : 'c'; -} - - -void MathParboxInset::setWidth(string const & w) -{ - tex_width_ = w; - lyx_width_ = LyXLength(w).inBP(); - lyxerr << "setting " << w << " to " << lyx_width_ << " pixel" << endl; -} - - -void MathParboxInset::metrics(MetricsInfo & mi, Dimension & dim) const -{ - FontSetChanger dummy1(mi.base, "textnormal"); - WidthChanger dummy2(mi.base, lyx_width_); - MathTextInset::metrics(mi, dim); - metricsMarkers(dim); - dim_ = dim; -} - - -void MathParboxInset::draw(PainterInfo & pi, int x, int y) const -{ - FontSetChanger dummy(pi.base, "textnormal"); - MathTextInset::draw(pi, x + 1, y); - drawMarkers(pi, x, y); -} - - -void MathParboxInset::write(WriteStream & os) const -{ - os << "\\parbox"; - if (position_ != 'c') - os << '[' << position_ << ']'; - os << '{' << tex_width_ << "}{" << cell(0) << '}'; -} - - -void MathParboxInset::infoize(std::ostream & os) const -{ - os << "Box: Parbox " << tex_width_; -} diff --git a/src/mathed/math_parboxinset.h b/src/mathed/math_parboxinset.h deleted file mode 100644 index 01b0af9508..0000000000 --- a/src/mathed/math_parboxinset.h +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -/** - * \file math_parboxinset.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author André Pönitz - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef MATH_PARBOXINSET_H -#define MATH_PARBOXINSET_H - - -#include "math_textinset.h" - -// implements support for \parbox - -class MathParboxInset : public MathTextInset { -public: - /// - MathParboxInset(); - /// - MathParboxInset * asParboxInset() { return this; } - /// - virtual std::auto_ptr clone() const; - /// - mode_type currentMode() const { return TEXT_MODE; } - /// - void metrics(MetricsInfo & mi, Dimension & dim) const; - /// - void draw(PainterInfo &, int x, int y) const; - /// - void infoize(std::ostream & os) const; - /// - void write(WriteStream & os) const; - /// - void setWidth(std::string const & width); - /// - void setPosition(std::string const & pos); -private: - /// width on screen - int lyx_width_; - /// width for TeX - std::string tex_width_; - /// one of htb - char position_; -}; - -#endif diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 087cd2c117..cd2bf6ba90 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -50,7 +50,6 @@ following hack as starting point to write some macros: #include "math_macro.h" #include "math_macroarg.h" #include "math_macrotemplate.h" -#include "math_parboxinset.h" #include "math_parinset.h" #include "math_rootinset.h" #include "math_scriptinset.h" @@ -1169,18 +1168,6 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, return; } -#if 0 - else if (l->inset == "parbox") { - // read optional positioning and width - string pos = parse_verbatim_option(); - string width = parse_verbatim_item(); - cell->push_back(createMathInset(t.cs())); - parse(cell->back().nucleus()->cell(0), FLAG_ITEM, MathInset::TEXT_MODE); - cell->back().nucleus()->asParboxInset()->setPosition(pos); - cell->back().nucleus()->asParboxInset()->setWidth(width); - } -#endif - else { MathAtom at = createMathInset(t.cs()); for (MathInset::idx_type i = 0; i < at->nargs(); ++i) diff --git a/src/rowpainter.C b/src/rowpainter.C index 96c74c6f14..6bdae7a813 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -874,7 +874,6 @@ int paintPars(BufferView const & bv, Painter & pain, return y; } - } // namespace anon diff --git a/src/text2.C b/src/text2.C index d7a8733ba0..f87fbe2fb6 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1152,7 +1152,7 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const // try to descend into nested insets InsetBase * inset = checkInsetHit(x, y); - lyxerr[Debug::DEBUG] << "inset " << inset << " hit at x: " << x << " y: " << y << endl; + lyxerr << "inset " << inset << " hit at x: " << x << " y: " << y << endl; if (!inset) return 0; diff --git a/src/text3.C b/src/text3.C index fd6d9b298e..a185e9d0a6 100644 --- a/src/text3.C +++ b/src/text3.C @@ -184,8 +184,8 @@ string const freefont2string() } -//takes absolute x,y coordinates -InsetBase * LyXText::checkInsetHit(int x, int y) const +// takes absolute x,y coordinates +InsetBase * LyXText::checkInsetHit(int x, int y) const { par_type pit; par_type end; @@ -202,7 +202,7 @@ InsetBase * LyXText::checkInsetHit(int x, int y) const InsetList::const_iterator iend = pars_[pit].insetlist.end(); for (; iit != iend; ++iit) { InsetBase * inset = iit->inset; -#if 0 +#if 1 lyxerr << "examining inset " << inset << " xo: " << inset->xo() << "..." << inset->xo() + inset->width() << " yo: " << inset->yo() - inset->ascent() << "..." @@ -214,7 +214,7 @@ InsetBase * LyXText::checkInsetHit(int x, int y) const } } } - //lyxerr << "No inset hit. " << endl; + lyxerr << "No inset hit. " << endl; return 0; } -- 2.39.2