else if (status_ == Open && !hitButton(cmd))
InsetText::priv_dispatch(cur, cmd);
else
- cur.noUpdate();
+ cur.noUpdate();
break;
case LFUN_MOUSE_MOTION:
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:
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;
math_numberinset.h \
math_oversetinset.C \
math_oversetinset.h \
- math_parboxinset.C \
- math_parboxinset.h \
math_parinset.C \
math_parinset.h \
math_parser.C \
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)
{}
void MathArray::touch() const
{
- clean_ = false;
- drawn_ = false;
}
void MathArray::metrics(MetricsInfo & mi) const
{
- //if (clean_)
- // return;
- clean_ = true;
- drawn_ = false;
-
mathed_char_dim(mi.base.font, 'I', dim_);
if (empty())
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);
void MathArray::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
{
- //if (clean_)
- // return;
dim.clear();
Dimension d;
for (const_iterator it = begin(); it != end(); ++it) {
}
-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;
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
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?
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_;
};
///
#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"
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")
+++ /dev/null
-/**
- * \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 <config.h>
-
-#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<InsetBase> MathParboxInset::clone() const
-{
- return auto_ptr<InsetBase>(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_;
-}
+++ /dev/null
-// -*- 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<InsetBase> 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
#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"
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)
return y;
}
-
} // namespace anon
// 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;
}
-//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;
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() << "..."
}
}
}
- //lyxerr << "No inset hit. " << endl;
+ lyxerr << "No inset hit. " << endl;
return 0;
}