2003-02-14 00:41:44 +00:00
|
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
|
* \file Row.cpp
|
2003-02-14 00:41:44 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-02-14 00:41:44 +00:00
|
|
|
|
* \author unknown
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2000-06-08 23:16:16 +00:00
|
|
|
|
*
|
2003-02-14 00:41:44 +00:00
|
|
|
|
* Metrics for an on-screen text row.
|
|
|
|
|
*/
|
2000-06-08 23:16:16 +00:00
|
|
|
|
|
2000-06-15 15:54:05 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Row.h"
|
2003-08-01 14:12:04 +00:00
|
|
|
|
#include "debug.h"
|
2000-06-08 23:16:16 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
2003-02-14 00:41:44 +00:00
|
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
|
|
|
|
|
|
Row::Row()
|
2007-09-16 10:36:57 +00:00
|
|
|
|
: separator(0), hfill(0), label_hfill(0), x(0),
|
|
|
|
|
sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(0), end_(0)
|
2000-06-08 23:16:16 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2007-08-28 17:40:40 +00:00
|
|
|
|
Row::Row(pos_type pos)
|
2007-09-16 10:36:57 +00:00
|
|
|
|
: separator(0), hfill(0), label_hfill(0), x(0),
|
|
|
|
|
sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(pos), end_(0)
|
2003-03-29 23:11:20 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2007-08-29 21:03:41 +00:00
|
|
|
|
void Row::setCrc(size_type crc)
|
2000-06-08 23:16:16 +00:00
|
|
|
|
{
|
2007-08-29 21:03:41 +00:00
|
|
|
|
changed_ |= crc != crc_;
|
|
|
|
|
crc_ = crc;
|
2000-06-08 23:16:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-29 21:03:41 +00:00
|
|
|
|
void Row::setDimension(Dimension const & dim)
|
2000-06-08 23:16:16 +00:00
|
|
|
|
{
|
2007-08-29 21:03:41 +00:00
|
|
|
|
changed_ |= dim != dim_;
|
|
|
|
|
dim_ = dim;
|
2000-06-08 23:16:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-29 21:03:41 +00:00
|
|
|
|
void Row::pos(pos_type p)
|
2003-08-22 07:49:57 +00:00
|
|
|
|
{
|
2007-08-29 21:03:41 +00:00
|
|
|
|
pos_ = p;
|
2003-08-22 07:49:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-29 21:03:41 +00:00
|
|
|
|
void Row::endpos(pos_type p)
|
2003-08-22 07:49:57 +00:00
|
|
|
|
{
|
2007-08-29 21:03:41 +00:00
|
|
|
|
end_ = p;
|
2003-08-22 07:49:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-05 13:04:05 +00:00
|
|
|
|
void Row::setSelection(pos_type beg, pos_type end)
|
|
|
|
|
{
|
|
|
|
|
pos_type sel_beg_b = sel_beg;
|
|
|
|
|
if (pos_ >= beg && pos_ <= end)
|
|
|
|
|
sel_beg = pos_;
|
|
|
|
|
else if (beg > pos_ && beg <= end_)
|
|
|
|
|
sel_beg = beg;
|
|
|
|
|
else
|
|
|
|
|
sel_beg = -1;
|
|
|
|
|
|
|
|
|
|
pos_type sel_end_b = sel_end;
|
|
|
|
|
if (end_ >= beg && end_ <= end)
|
|
|
|
|
sel_end = end_;
|
|
|
|
|
else if (end < end_ && end >= pos_)
|
|
|
|
|
sel_end = end;
|
|
|
|
|
else
|
|
|
|
|
sel_end = -1;
|
|
|
|
|
/*
|
|
|
|
|
&& ((rit->pos() >= beg.pos() && rit->pos() <= end.pos())
|
|
|
|
|
|| (rit->endpos() >= beg.pos() && rit->endpos() <= end.pos())
|
|
|
|
|
|| (beg.pos() >= rit->pos() && beg.pos() <= rit->endpos())
|
|
|
|
|
|| (end.pos() >= rit->pos() && end.pos() <= rit->endpos()));
|
|
|
|
|
*/
|
|
|
|
|
changed_ |= sel_beg_b != sel_beg;
|
|
|
|
|
changed_ |= sel_end_b != sel_end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-16 10:36:57 +00:00
|
|
|
|
void Row::dump(char const * s) const
|
2003-08-01 14:12:04 +00:00
|
|
|
|
{
|
2004-11-30 01:59:49 +00:00
|
|
|
|
lyxerr << s << " pos: " << pos_ << " end: " << end_
|
2007-08-28 09:21:48 +00:00
|
|
|
|
<< " width: " << dim_.wid
|
|
|
|
|
<< " ascent: " << dim_.asc
|
|
|
|
|
<< " descent: " << dim_.des
|
2004-11-30 01:59:49 +00:00
|
|
|
|
<< std::endl;
|
2003-08-01 14:12:04 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|