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"
|
2008-02-18 07:14:42 +00:00
|
|
|
|
|
2007-11-29 07:04:28 +00:00
|
|
|
|
#include "support/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-12-06 08:39:42 +00:00
|
|
|
|
: separator(0), label_hfill(0), x(0),
|
2007-09-16 10:36:57 +00:00
|
|
|
|
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-12-06 08:39:42 +00:00
|
|
|
|
: separator(0), label_hfill(0), x(0),
|
2007-09-16 10:36:57 +00:00
|
|
|
|
sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(pos), end_(0)
|
2003-03-29 23:11:20 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2007-11-17 11:27:03 +00:00
|
|
|
|
void Row::setCrc(size_type crc) const
|
2000-06-08 23:16:16 +00:00
|
|
|
|
{
|
2007-11-17 11:27:03 +00:00
|
|
|
|
changed_ = crc != crc_;
|
2007-08-29 21:03:41 +00:00
|
|
|
|
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
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-03-03 11:03:47 +00:00
|
|
|
|
void Row::setSelection(pos_type beg, pos_type end) const
|
2007-09-05 13:04:05 +00:00
|
|
|
|
{
|
|
|
|
|
if (pos_ >= beg && pos_ <= end)
|
|
|
|
|
sel_beg = pos_;
|
|
|
|
|
else if (beg > pos_ && beg <= end_)
|
|
|
|
|
sel_beg = beg;
|
|
|
|
|
else
|
|
|
|
|
sel_beg = -1;
|
|
|
|
|
|
|
|
|
|
if (end_ >= beg && end_ <= end)
|
|
|
|
|
sel_end = end_;
|
|
|
|
|
else if (end < end_ && end >= pos_)
|
|
|
|
|
sel_end = end;
|
|
|
|
|
else
|
|
|
|
|
sel_end = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-16 10:36:57 +00:00
|
|
|
|
void Row::dump(char const * s) const
|
2003-08-01 14:12:04 +00:00
|
|
|
|
{
|
2007-11-28 22:12:03 +00:00
|
|
|
|
LYXERR0(s << " pos: " << pos_ << " end: " << end_
|
2007-08-28 09:21:48 +00:00
|
|
|
|
<< " width: " << dim_.wid
|
|
|
|
|
<< " ascent: " << dim_.asc
|
2007-11-28 22:12:03 +00:00
|
|
|
|
<< " descent: " << dim_.des);
|
2003-08-01 14:12:04 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|