mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
two-phase-drawing for InsetText & InsetTabular
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7312 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8d2394b02c
commit
99b64f351e
@ -1,3 +1,14 @@
|
||||
2003-07-18 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* lyxtext.h:
|
||||
* metricsinfo.C:
|
||||
* metricsinfo.h:
|
||||
* rowpainter.C:
|
||||
* text.C:
|
||||
* text2.C:
|
||||
* text3.C: two-phase drawing for InsetText and InsetTabular
|
||||
some float -> int changes.
|
||||
|
||||
2003-07-18 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* lyx_main.C: fix a crash in batch mode if no files specified
|
||||
|
@ -1,4 +1,23 @@
|
||||
|
||||
2003-07-18 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* inset.[Ch]:
|
||||
* insetbibitem.C:
|
||||
* insetcollapsable.C:
|
||||
* insetcommand.C:
|
||||
* insetert.C:
|
||||
* insetexternal.C:
|
||||
* insetgraphics.[Ch]:
|
||||
* insetlatexaccent.[Ch]:
|
||||
* insetminipage.C:
|
||||
* insetnewline.C:
|
||||
* insetquotes.C:
|
||||
* insetspace.C:
|
||||
* insetspecialchar.C:
|
||||
* insettabular.[Ch]:
|
||||
* insettext.[Ch]:
|
||||
* updatableinset.C: two-phase-drawing for InsetText & InsetTabular
|
||||
|
||||
2003-07-17 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insetcollapsable.C:
|
||||
|
@ -142,28 +142,19 @@ int Inset::latexTextWidth(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
int Inset::ascent(BufferView * bv, LyXFont const & font) const
|
||||
int Inset::ascent() const
|
||||
{
|
||||
Dimension dim;
|
||||
MetricsInfo mi(bv, font);
|
||||
metrics(mi, dim);
|
||||
return dim.ascent();
|
||||
return dim_.asc;
|
||||
}
|
||||
|
||||
|
||||
int Inset::descent(BufferView * bv, LyXFont const & font) const
|
||||
int Inset::descent() const
|
||||
{
|
||||
Dimension dim;
|
||||
MetricsInfo mi(bv, font);
|
||||
metrics(mi, dim);
|
||||
return dim.descent();
|
||||
return dim_.des;
|
||||
}
|
||||
|
||||
|
||||
int Inset::width(BufferView * bv, LyXFont const & font) const
|
||||
int Inset::width() const
|
||||
{
|
||||
Dimension dim;
|
||||
MetricsInfo mi(bv, font);
|
||||
metrics(mi, dim);
|
||||
return dim.width();
|
||||
return dim_.wid;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "LColor.h"
|
||||
#include "insetbase.h"
|
||||
#include "dimension.h"
|
||||
#include "support/types.h"
|
||||
|
||||
#include <vector>
|
||||
@ -157,11 +158,11 @@ public:
|
||||
///
|
||||
Inset(Inset const & in);
|
||||
///
|
||||
int ascent(BufferView *, LyXFont const &) const;
|
||||
int ascent() const;
|
||||
///
|
||||
int descent(BufferView *, LyXFont const &) const;
|
||||
int descent() const;
|
||||
///
|
||||
int width(BufferView *, LyXFont const &) const;
|
||||
int width() const;
|
||||
/// what appears in the minibuffer when opening
|
||||
virtual string const editMessage() const;
|
||||
///
|
||||
@ -331,6 +332,8 @@ protected:
|
||||
unsigned int id_;
|
||||
///
|
||||
static unsigned int inset_id;
|
||||
///
|
||||
mutable Dimension dim_;
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -141,7 +141,8 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
|
||||
ParagraphList::iterator end = bv->buffer()->paragraphs.end();
|
||||
for (; it != end; ++it) {
|
||||
if (it->bibitem()) {
|
||||
int const wx = it->bibitem()->width(bv, font);
|
||||
#warning metrics broken!
|
||||
int const wx = it->bibitem()->width();
|
||||
if (wx > w)
|
||||
w = wx;
|
||||
}
|
||||
|
@ -129,13 +129,15 @@ int InsetCollapsable::height_collapsed() const
|
||||
|
||||
void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
//lyxerr << "InsetCollapsable::metrics: width: " << mi.base.textwidth << "\n";
|
||||
dimension_collapsed(dim);
|
||||
if (collapsed_)
|
||||
return;
|
||||
if (!collapsed_) {
|
||||
Dimension insetdim;
|
||||
inset.metrics(mi, insetdim);
|
||||
dim.des += insetdim.height() + TEXT_TO_BOTTOM_OFFSET;
|
||||
dim.wid = max(dim.wid, insetdim.wid);
|
||||
}
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
@ -156,7 +158,7 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y, bool inlined) const
|
||||
Dimension dim_collapsed;
|
||||
dimension_collapsed(dim_collapsed);
|
||||
|
||||
int const aa = ascent(pi.base.bv, pi.base.font);
|
||||
int const aa = ascent();
|
||||
button_length = dim_collapsed.width();
|
||||
button_top_y = -aa;
|
||||
button_bottom_y = -aa + dim_collapsed.height();
|
||||
@ -180,8 +182,7 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y, bool inlined) const
|
||||
inset.draw(pi, x, y);
|
||||
} else {
|
||||
draw_collapsed(pi, old_x, bl);
|
||||
int const yy = bl + dim_collapsed.descent()
|
||||
+ inset.ascent(pi.base.bv, pi.base.font);
|
||||
int const yy = bl + dim_collapsed.descent() + inset.ascent();
|
||||
inset.draw(pi, x, yy);
|
||||
}
|
||||
}
|
||||
@ -221,10 +222,8 @@ void InsetCollapsable::insetUnlock(BufferView * bv)
|
||||
|
||||
FuncRequest InsetCollapsable::adjustCommand(FuncRequest const & cmd)
|
||||
{
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
FuncRequest cmd1 = cmd;
|
||||
cmd1.y = ascent(cmd.view(), font) + cmd.y -
|
||||
(height_collapsed() + inset.ascent(cmd.view(), font));
|
||||
cmd1.y = ascent() + cmd.y - (height_collapsed() + inset.ascent());
|
||||
return cmd1;
|
||||
}
|
||||
|
||||
@ -341,9 +340,7 @@ Inset::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
|
||||
if (cmd.y <= button_bottom_y) {
|
||||
cmd1.y = 0;
|
||||
} else {
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
cmd1.y = ascent(bv, font) + cmd.y -
|
||||
(height_collapsed() + inset.ascent(bv, font));
|
||||
cmd1.y = ascent() + cmd.y - (height_collapsed() + inset.ascent());
|
||||
}
|
||||
inset.localDispatch(cmd);
|
||||
}
|
||||
@ -465,8 +462,7 @@ void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const
|
||||
void InsetCollapsable::resizeLyXText(BufferView * bv, bool force) const
|
||||
{
|
||||
inset.resizeLyXText(bv, force);
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
oldWidth = width(bv, font);
|
||||
oldWidth = width();
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,6 +47,7 @@ void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
editable() != NOT_EDITABLE);
|
||||
}
|
||||
button_.metrics(mi, dim);
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
|
@ -297,9 +297,9 @@ bool InsetERT::lfunMouseRelease(FuncRequest const & cmd)
|
||||
(cmd.y >= button_top_y) && (cmd.y <= button_bottom_y)) {
|
||||
updateStatus(bv, true);
|
||||
} else {
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
FuncRequest cmd1 = cmd;
|
||||
cmd1.y = ascent(bv, font) + cmd.y - inset.ascent(bv, font);
|
||||
#warning metrics?
|
||||
cmd1.y = ascent() + cmd.y - inset.ascent();
|
||||
|
||||
// inlined is special - the text appears above
|
||||
// button_bottom_y
|
||||
@ -554,6 +554,7 @@ void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
inset.metrics(mi, dim);
|
||||
else
|
||||
InsetCollapsable::metrics(mi, dim);
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
|
@ -170,6 +170,7 @@ dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd)
|
||||
void InsetExternal::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
renderer_->metrics(mi, dim);
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,6 +204,7 @@ dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
|
||||
void InsetGraphics::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
graphic_->metrics(mi, dim);
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,7 +133,6 @@ private:
|
||||
boost::scoped_ptr<PreviewImpl> const preview_;
|
||||
|
||||
/// cache
|
||||
mutable Dimension dim_;
|
||||
mutable bool set_label_;
|
||||
mutable ButtonRenderer button_;
|
||||
};
|
||||
|
@ -404,7 +404,8 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
|
||||
// closer to the top of the dot-less 'i' or 'j'.
|
||||
char tmpic = ic; // store the ic when we
|
||||
ic = 'x'; // calculates the ascent of
|
||||
int asc = ascent(bv, font); // the dot-less version (here: 'x')
|
||||
#warning metrics?
|
||||
int asc = ascent(); // the dot-less version (here: 'x')
|
||||
ic = tmpic; // set the orig ic back
|
||||
y = baseline - asc; // update to new y coord.
|
||||
}
|
||||
@ -473,7 +474,7 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
|
||||
|
||||
case CIRCLE: // circle
|
||||
{
|
||||
LyXFont tmpf(font);
|
||||
LyXFont tmpf = font;
|
||||
tmpf.decSize().decSize();
|
||||
pi.pain.text(int(x2 - (font_metrics::rbearing(0xB0, tmpf) - font_metrics::lbearing(0xB0, tmpf)) / 2.0),
|
||||
int(baseline - font_metrics::ascent(ic, font) - font_metrics::descent(0xB0, tmpf) - (font_metrics::ascent(0xB0, tmpf) + font_metrics::descent(0xB0, tmpf)) / 3.0),
|
||||
|
@ -129,8 +129,6 @@ private:
|
||||
bool plusdesc;
|
||||
/// international char
|
||||
mutable char ic;
|
||||
///
|
||||
mutable Dimension dim_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "lyxlex.h"
|
||||
#include "lyxtext.h"
|
||||
#include "Lsstream.h"
|
||||
#include "metricsinfo.h"
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
@ -220,7 +221,9 @@ void InsetMinipage::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
dimension_collapsed(dim);
|
||||
else {
|
||||
Dimension d;
|
||||
InsetCollapsable::metrics(mi, d);
|
||||
MetricsInfo m = mi;
|
||||
m.base.textwidth = params_.width.inPixels(mi.base.textwidth);
|
||||
InsetCollapsable::metrics(m, d);
|
||||
switch (params_.pos) {
|
||||
case top:
|
||||
dim.asc = d.asc;
|
||||
@ -237,6 +240,7 @@ void InsetMinipage::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
}
|
||||
dim.wid = d.wid;
|
||||
}
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
@ -347,7 +351,7 @@ void InsetMinipageMailer::string2params(string const & in,
|
||||
return;
|
||||
|
||||
istringstream data(STRCONV(in));
|
||||
LyXLex lex(0,0);
|
||||
LyXLex lex(0, 0);
|
||||
lex.setStream(data);
|
||||
|
||||
if (lex.isOK()) {
|
||||
|
@ -44,6 +44,7 @@ void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
dim.asc = font_metrics::maxAscent(font);
|
||||
dim.des = font_metrics::maxDescent(font);
|
||||
dim.wid = font_metrics::width('n', font);
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
|
@ -189,6 +189,7 @@ void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
else
|
||||
dim.wid += font_metrics::width(',', font);
|
||||
}
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,12 +71,13 @@ void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
dim.wid = 10;
|
||||
break;
|
||||
}
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
void InsetSpace::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
int const w = width(pi.base.bv, pi.base.font);
|
||||
int const w = width();
|
||||
int const h = font_metrics::ascent('x', pi.base.font);
|
||||
int xp[4], yp[4];
|
||||
|
||||
|
@ -56,6 +56,7 @@ void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
dim.wid = font_metrics::width(s, font);
|
||||
if (kind_ == HYPHENATION && dim.wid > 5)
|
||||
dim.wid -= 2; // to make it look shorter
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
|
@ -263,33 +263,18 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
Assert(0);
|
||||
}
|
||||
|
||||
calculate_dimensions_of_cells(mi.base.bv);
|
||||
//lyxerr << "InsetTabular::metrics, bv: " << mi.base.bv << endl;
|
||||
for (int i = 0; i < tabular.getNumberOfCells(); ++i) {
|
||||
LyXTabular::cellstruct * ci = tabular.cellinfo_of_cell(i);
|
||||
int col = tabular.column_of_cell(i);
|
||||
InsetText & cell = ci->inset;
|
||||
cell.text_.bv_owner = mi.base.bv;
|
||||
int wid = tabular.column_info[col].p_width.inPixels(mi.base.textwidth);
|
||||
//lyxerr << " " << i << " - " << ci->width_of_cell << " - "
|
||||
// << tabular.column_info[col].width_of_column << " - "
|
||||
// << wid << " ";
|
||||
MetricsInfo m = mi;
|
||||
m.base.textwidth = wid;
|
||||
Dimension d;
|
||||
cell.metrics(m, d);
|
||||
}
|
||||
//lyxerr << endl;
|
||||
calculate_dimensions_of_cells(mi);
|
||||
|
||||
dim.asc = tabular.getAscentOfRow(0);
|
||||
dim.des = tabular.getHeightOfTabular() - tabular.getAscentOfRow(0) + 1;
|
||||
dim.wid = tabular.getWidthOfTabular() + 2 * ADD_TO_TABULAR_WIDTH;
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
lyxerr << "InsetTabular::draw: " << x << " " << y << "\n";
|
||||
//lyxerr << "InsetTabular::draw: " << x << " " << y << "\n";
|
||||
if (nodraw()) {
|
||||
need_update = FULL;
|
||||
return;
|
||||
@ -454,9 +439,6 @@ void InsetTabular::insetUnlock(BufferView * bv)
|
||||
void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what) const
|
||||
{
|
||||
lyxerr << "InsetTabular::updateLocal: " << what << "\n";
|
||||
if (what == INIT) {
|
||||
calculate_dimensions_of_cells(bv);
|
||||
}
|
||||
if (!locked && what == CELL)
|
||||
what = FULL;
|
||||
if (need_update < what) // only set this if it has greater update
|
||||
@ -1246,30 +1228,31 @@ void InsetTabular::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::calculate_dimensions_of_cells(BufferView * bv) const
|
||||
void InsetTabular::calculate_dimensions_of_cells(MetricsInfo & mi) const
|
||||
{
|
||||
// FIXME: since InsetText ignores this anyway, it doesn't
|
||||
// matter what we pass it. Ugly
|
||||
LyXFont font;
|
||||
|
||||
#if 1
|
||||
// if we have a locking_inset we should have to check only this cell for
|
||||
// change so I'll try this to have a boost, but who knows ;)
|
||||
// change so I'll try this to have a boost, but who knows ;) (Jug?)
|
||||
// This is _really_ important (André)
|
||||
if (need_update != INIT &&
|
||||
the_locking_inset == tabular.getCellInset(actcell)) {
|
||||
int maxAsc = 0;
|
||||
int maxDesc = 0;
|
||||
for(int i = 0; i < tabular.columns(); ++i) {
|
||||
for (int j = 0; j < tabular.columns(); ++j) {
|
||||
Dimension dim;
|
||||
MetricsInfo mi(bv, font);
|
||||
tabular.getCellInset(actrow, i)->metrics(mi, dim);
|
||||
MetricsInfo m = mi;
|
||||
m.base.textwidth =
|
||||
tabular.column_info[j].p_width.inPixels(mi.base.textwidth);
|
||||
tabular.getCellInset(actrow, j)->metrics(m, dim);
|
||||
maxAsc = max(dim.asc, maxAsc);
|
||||
maxDesc = max(dim.des, maxDesc);
|
||||
}
|
||||
tabular.setWidthOfCell(actcell, the_locking_inset->width(bv, font));
|
||||
tabular.setWidthOfCell(actcell, the_locking_inset->width());
|
||||
tabular.setAscentOfRow(actrow, maxAsc + ADD_TO_HEIGHT);
|
||||
tabular.setDescentOfRow(actrow, maxDesc + ADD_TO_HEIGHT);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
int cell = -1;
|
||||
bool changed = false;
|
||||
@ -1281,8 +1264,10 @@ void InsetTabular::calculate_dimensions_of_cells(BufferView * bv) const
|
||||
continue;
|
||||
++cell;
|
||||
Dimension dim;
|
||||
MetricsInfo mi(bv, font);
|
||||
tabular.getCellInset(cell)->metrics(mi, dim);
|
||||
MetricsInfo m = mi;
|
||||
m.base.textwidth =
|
||||
tabular.column_info[j].p_width.inPixels(mi.base.textwidth);
|
||||
tabular.getCellInset(cell)->metrics(m, dim);
|
||||
maxAsc = max(maxAsc, dim.asc);
|
||||
maxDesc = max(maxDesc, dim.des);
|
||||
changed = tabular.setWidthOfCell(cell, dim.wid) || changed;
|
||||
@ -1290,8 +1275,8 @@ void InsetTabular::calculate_dimensions_of_cells(BufferView * bv) const
|
||||
changed = tabular.setAscentOfRow(i, maxAsc + ADD_TO_HEIGHT) || changed;
|
||||
changed = tabular.setDescentOfRow(i, maxDesc + ADD_TO_HEIGHT) || changed;
|
||||
}
|
||||
if (changed)
|
||||
tabular.reinit();
|
||||
//if (changed)
|
||||
// tabular.reinit();
|
||||
}
|
||||
|
||||
|
||||
@ -2051,15 +2036,15 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
||||
}
|
||||
|
||||
|
||||
bool InsetTabular::activateCellInset(BufferView * bv, int x, int y, mouse_button::state button,
|
||||
bool behind)
|
||||
bool InsetTabular::activateCellInset(BufferView * bv, int x, int y,
|
||||
mouse_button::state button, bool behind)
|
||||
{
|
||||
UpdatableInset * inset =
|
||||
static_cast<UpdatableInset*>(tabular.getCellInset(actcell));
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
if (behind) {
|
||||
x = inset->x() + inset->width(bv, font);
|
||||
y = inset->descent(bv, font);
|
||||
#warning metrics?
|
||||
x = inset->x() + inset->width();
|
||||
y = inset->descent();
|
||||
}
|
||||
//inset_x = cursor.x() - top_x + tabular.getBeginningOfTextInCell(actcell);
|
||||
//inset_y = cursor.y();
|
||||
@ -2083,8 +2068,8 @@ bool InsetTabular::activateCellInsetAbs(BufferView * bv, int x, int y,
|
||||
|
||||
bool InsetTabular::insetHit(BufferView *, int x, int) const
|
||||
{
|
||||
return (x + top_x)
|
||||
> (cursor_.x() + tabular.getBeginningOfTextInCell(actcell));
|
||||
return x + top_x
|
||||
> cursor_.x() + tabular.getBeginningOfTextInCell(actcell);
|
||||
}
|
||||
|
||||
|
||||
|
@ -240,7 +240,7 @@ private:
|
||||
///
|
||||
void lfunMouseMotion(FuncRequest const &);
|
||||
///
|
||||
void calculate_dimensions_of_cells(BufferView *) const;
|
||||
void calculate_dimensions_of_cells(MetricsInfo & mi) const;
|
||||
///
|
||||
void drawCellLines(Painter &, int x, int baseline,
|
||||
int row, int cell) const;
|
||||
|
@ -152,12 +152,14 @@ InsetText & InsetText::operator=(InsetText const & it)
|
||||
void InsetText::init(InsetText const * ins)
|
||||
{
|
||||
if (ins) {
|
||||
textwidth_ = ins->textwidth_;
|
||||
text_.bv_owner = ins->text_.bv_owner;
|
||||
setParagraphData(ins->paragraphs);
|
||||
autoBreakRows = ins->autoBreakRows;
|
||||
drawFrame_ = ins->drawFrame_;
|
||||
frame_color = ins->frame_color;
|
||||
} else {
|
||||
textwidth_ = 0; // unbounded
|
||||
drawFrame_ = NEVER;
|
||||
frame_color = LColor::insetframe;
|
||||
autoBreakRows = false;
|
||||
@ -274,7 +276,10 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
|
||||
|
||||
void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
//lyxerr << "InsetText::metrics: width: " << mi.base.textwidth << "\n";
|
||||
//lyxerr << "InsetText::metrics: " << getInsetName()
|
||||
// << " width: " << mi.base.textwidth << "\n";
|
||||
if (mi.base.textwidth)
|
||||
textwidth_ = mi.base.textwidth;
|
||||
BufferView * bv = mi.base.bv;
|
||||
setViewCache(bv);
|
||||
text_.rebuild(mi.base.textwidth);
|
||||
@ -288,6 +293,7 @@ void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
|
||||
int InsetText::textWidth(BufferView * bv, bool fordraw) const
|
||||
{
|
||||
/*
|
||||
int w = autoBreakRows ? getMaxWidth(bv, this) : -1;
|
||||
|
||||
if (fordraw)
|
||||
@ -298,6 +304,10 @@ int InsetText::textWidth(BufferView * bv, bool fordraw) const
|
||||
return -1;
|
||||
|
||||
return w - 2 * TEXT_TO_INSET_OFFSET;
|
||||
lyxerr << "InsetText::textWidth: " << getInsetName()
|
||||
<< " " << textwidth_ << endl;
|
||||
*/
|
||||
return textwidth_;
|
||||
}
|
||||
|
||||
|
||||
@ -1866,7 +1876,7 @@ int InsetText::cx(BufferView * bv) const
|
||||
LyXFont font = text_.getFont(bv->buffer(), text_.cursor.par(),
|
||||
text_.cursor.pos());
|
||||
if (font.isVisibleRightToLeft())
|
||||
x -= the_locking_inset->width(bv, font);
|
||||
x -= the_locking_inset->width();
|
||||
}
|
||||
return x;
|
||||
}
|
||||
@ -1879,7 +1889,7 @@ int InsetText::cix(BufferView * bv) const
|
||||
LyXFont font = text_.getFont(bv->buffer(), text_.cursor.par(),
|
||||
text_.cursor.pos());
|
||||
if (font.isVisibleRightToLeft())
|
||||
x -= the_locking_inset->width(bv, font);
|
||||
x -= the_locking_inset->width();
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
@ -328,8 +328,6 @@ private:
|
||||
///
|
||||
mutable bool locked;
|
||||
///
|
||||
mutable Dimension dim_;
|
||||
///
|
||||
mutable int top_y;
|
||||
///
|
||||
ParagraphList::iterator inset_par;
|
||||
@ -371,5 +369,7 @@ public:
|
||||
void reinitLyXText() const;
|
||||
///
|
||||
mutable LyXText text_;
|
||||
///
|
||||
mutable int textwidth_;
|
||||
};
|
||||
#endif
|
||||
|
@ -73,21 +73,18 @@ void UpdatableInset::scroll(BufferView * bv, float s) const
|
||||
int const workW = bv->workWidth();
|
||||
int const tmp_top_x = top_x - scx;
|
||||
|
||||
if (tmp_top_x > 0 &&
|
||||
(tmp_top_x + width(bv, font)) < workW)
|
||||
if (tmp_top_x > 0 && tmp_top_x + width() < workW)
|
||||
return;
|
||||
if (s > 0 && top_x > 0)
|
||||
return;
|
||||
|
||||
// int mx_scx=abs((width(bv,font) - bv->workWidth())/2);
|
||||
//int const save_scx = scx;
|
||||
|
||||
scx = int(s * workW / 2);
|
||||
// if (!display())
|
||||
// scx += 20;
|
||||
|
||||
if ((tmp_top_x + scx + width(bv, font)) < (workW / 2)) {
|
||||
scx += (workW / 2) - (tmp_top_x + scx + width(bv, font));
|
||||
#warning metrics?
|
||||
if (tmp_top_x + scx + width() < workW / 2) {
|
||||
scx += workW / 2 - (tmp_top_x + scx + width());
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,11 +99,11 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
|
||||
else
|
||||
scx += offset;
|
||||
} else {
|
||||
LyXFont const font;
|
||||
if (!scx && (top_x + width(bv, font)) < (bv->workWidth() - 20))
|
||||
#warning metrics?
|
||||
if (!scx && top_x + width() < bv->workWidth() - 20)
|
||||
return;
|
||||
if ((top_x - scx + offset + width(bv, font)) < (bv->workWidth() - 20)) {
|
||||
scx = bv->workWidth() - width(bv, font) - top_x + scx - 20;
|
||||
if (top_x - scx + offset + width() < bv->workWidth() - 20) {
|
||||
scx += bv->workWidth() - width() - top_x - 20;
|
||||
} else {
|
||||
scx += offset;
|
||||
}
|
||||
@ -141,7 +138,7 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
|
||||
int w;
|
||||
|
||||
if (owner()) {
|
||||
w = static_cast<UpdatableInset *>(owner())->getMaxWidth(bv, this);
|
||||
w = owner()->getMaxWidth(bv, this);
|
||||
} else {
|
||||
w = bv->text->workWidth(this);
|
||||
}
|
||||
|
@ -495,10 +495,10 @@ public:
|
||||
|
||||
/** this calculates the specified parameters. needed when setting
|
||||
* the cursor and when creating a visible row */
|
||||
void prepareToPrint(RowList::iterator row, float & x,
|
||||
float & fill_separator,
|
||||
float & fill_hfill,
|
||||
float & fill_label_hfill,
|
||||
void prepareToPrint(RowList::iterator row, int & x,
|
||||
int & fill_separator,
|
||||
int & fill_hfill,
|
||||
int & fill_label_hfill,
|
||||
bool bidi = true) const;
|
||||
|
||||
private:
|
||||
|
@ -16,9 +16,9 @@ MetricsBase::MetricsBase()
|
||||
|
||||
|
||||
|
||||
MetricsBase::MetricsBase(BufferView * b, LyXFont const & f)
|
||||
MetricsBase::MetricsBase(BufferView * b, LyXFont const & f, int w)
|
||||
: bv(b), font(f), style(LM_ST_TEXT), fontname("mathnormal"),
|
||||
restrictwidth(false), textwidth(0)
|
||||
restrictwidth(false), textwidth(w)
|
||||
{}
|
||||
|
||||
|
||||
@ -27,8 +27,8 @@ MetricsInfo::MetricsInfo()
|
||||
{}
|
||||
|
||||
|
||||
MetricsInfo::MetricsInfo(BufferView * bv, LyXFont const & font)
|
||||
: base(bv, font)
|
||||
MetricsInfo::MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth)
|
||||
: base(bv, font, textwidth)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ struct MetricsBase {
|
||||
///
|
||||
MetricsBase();
|
||||
///
|
||||
MetricsBase(BufferView * bv, LyXFont const & font);
|
||||
MetricsBase(BufferView * bv, LyXFont const & font, int textwidth);
|
||||
|
||||
/// the current view
|
||||
BufferView * bv;
|
||||
@ -53,7 +53,7 @@ struct MetricsInfo {
|
||||
///
|
||||
MetricsInfo();
|
||||
///
|
||||
MetricsInfo(BufferView * bv, LyXFont const & font);
|
||||
MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth);
|
||||
|
||||
///
|
||||
MetricsBase base;
|
||||
|
@ -74,7 +74,7 @@ private:
|
||||
void paintChangeBar();
|
||||
void paintFirst();
|
||||
void paintLast();
|
||||
void paintForeignMark(float const orig_x, LyXFont const & orig_font);
|
||||
void paintForeignMark(int orig_x, LyXFont const & orig_font);
|
||||
void paintHebrewComposeChar(lyx::pos_type & vpos);
|
||||
void paintArabicComposeChar(lyx::pos_type & vpos);
|
||||
void paintChars(lyx::pos_type & vpos, bool hebrew, bool arabic);
|
||||
@ -118,12 +118,12 @@ private:
|
||||
// Looks ugly - is
|
||||
int xo_;
|
||||
int yo_;
|
||||
float x_;
|
||||
int x_;
|
||||
int y_;
|
||||
int width_;
|
||||
float separator_;
|
||||
float hfill_;
|
||||
float label_hfill_;
|
||||
int separator_;
|
||||
int hfill_;
|
||||
int label_hfill_;
|
||||
};
|
||||
|
||||
RowPainter::RowPainter(BufferView const & bv, LyXText const & text,
|
||||
@ -178,11 +178,15 @@ void RowPainter::paintInset(pos_type const pos)
|
||||
|
||||
Assert(inset);
|
||||
|
||||
MetricsInfo mi(perv(bv_), getFont(pos), text_.workWidth());
|
||||
Dimension dim;
|
||||
inset->metrics(mi, dim);
|
||||
|
||||
PainterInfo pi(perv(bv_));
|
||||
pi.base.font = getFont(pos);
|
||||
int const w = inset->width(perv(bv_), pi.base.font);
|
||||
#warning metrics?
|
||||
inset->draw(pi, int(x_), yo_ + row_->baseline());
|
||||
x_ += w;
|
||||
x_ += dim.wid;
|
||||
}
|
||||
|
||||
|
||||
@ -310,7 +314,7 @@ void RowPainter::paintChars(pos_type & vpos, bool hebrew, bool arabic)
|
||||
}
|
||||
|
||||
|
||||
void RowPainter::paintForeignMark(float const orig_x, LyXFont const & orig_font)
|
||||
void RowPainter::paintForeignMark(int orig_x, LyXFont const & orig_font)
|
||||
{
|
||||
if (!lyxrc.mark_foreign_language)
|
||||
return;
|
||||
@ -330,7 +334,7 @@ void RowPainter::paintFromPos(pos_type & vpos)
|
||||
|
||||
LyXFont const & orig_font = getFont(pos);
|
||||
|
||||
float const orig_x = x_;
|
||||
int const orig_x = x_;
|
||||
|
||||
char const c = pit_->getChar(pos);
|
||||
|
||||
@ -430,11 +434,11 @@ void RowPainter::paintSelection()
|
||||
|
||||
pos_type const body_pos = pit_->beginningOfBody();
|
||||
pos_type const last = lastPrintablePos(text_, row_);
|
||||
float tmpx = x_;
|
||||
int tmpx = x_;
|
||||
|
||||
for (pos_type vpos = row_->pos(); vpos <= last; ++vpos) {
|
||||
pos_type pos = text_.vis2log(vpos);
|
||||
float const old_tmpx = tmpx;
|
||||
int const old_tmpx = tmpx;
|
||||
if (body_pos > 0 && pos == body_pos - 1) {
|
||||
LyXLayout_ptr const & layout = pit_->layout();
|
||||
LyXFont const lfont = getLabelFont();
|
||||
@ -714,7 +718,7 @@ void RowPainter::paintFirst()
|
||||
|
||||
y_top += asc;
|
||||
|
||||
int const w = (text_.isInInset() ? text_.inset_owner->width(perv(bv_), font) : ww);
|
||||
int const w = (text_.isInInset() ? text_.inset_owner->width() : ww);
|
||||
int const xp = static_cast<int>(text_.isInInset() ? xo_ : 0);
|
||||
pain_.line(xp, yo_ + y_top, xp + w, yo_ + y_top,
|
||||
LColor::topline, Painter::line_solid,
|
||||
@ -733,7 +737,7 @@ void RowPainter::paintFirst()
|
||||
|
||||
LyXFont font = getLabelFont();
|
||||
if (!pit_->getLabelstring().empty()) {
|
||||
float x = x_;
|
||||
int x = x_;
|
||||
string const str = pit_->getLabelstring();
|
||||
|
||||
// this is special code for the chapter layout. This is
|
||||
@ -757,7 +761,7 @@ void RowPainter::paintFirst()
|
||||
font_metrics::width(str, font);
|
||||
}
|
||||
|
||||
pain_.text(int(x),
|
||||
pain_.text(x,
|
||||
yo_ + row_->baseline() -
|
||||
row_->ascent_of_text() - maxdesc,
|
||||
str, font);
|
||||
@ -771,7 +775,7 @@ void RowPainter::paintFirst()
|
||||
- font_metrics::width(str, font);
|
||||
}
|
||||
|
||||
pain_.text(int(x), yo_ + row_->baseline(), str, font);
|
||||
pain_.text(x, yo_ + row_->baseline(), str, font);
|
||||
}
|
||||
}
|
||||
|
||||
@ -795,7 +799,7 @@ void RowPainter::paintFirst()
|
||||
int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val
|
||||
+ (layout->labelbottomsep * defaultRowHeight()));
|
||||
|
||||
float x = x_;
|
||||
int x = x_;
|
||||
if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
|
||||
x = ((is_rtl ? leftMargin() : x_)
|
||||
+ ww - text_.rightMargin(*bv_.buffer(), *row_)) / 2;
|
||||
@ -804,7 +808,7 @@ void RowPainter::paintFirst()
|
||||
x = ww - leftMargin() -
|
||||
font_metrics::width(str, font);
|
||||
}
|
||||
pain_.text(int(x), yo_ + row_->baseline()
|
||||
pain_.text(x, yo_ + row_->baseline()
|
||||
- row_->ascent_of_text() - maxdesc,
|
||||
str, font);
|
||||
}
|
||||
@ -842,7 +846,7 @@ void RowPainter::paintLast()
|
||||
|
||||
y_bottom -= asc;
|
||||
|
||||
int const w = (text_.isInInset() ? text_.inset_owner->width(perv(bv_), font) : ww);
|
||||
int const w = text_.isInInset() ? text_.inset_owner->width() : ww;
|
||||
int const xp = static_cast<int>(text_.isInInset() ? xo_ : 0);
|
||||
int const y = yo_ + y_bottom;
|
||||
pain_.line(xp, y, xp + w, y, LColor::topline, Painter::line_solid,
|
||||
@ -879,7 +883,7 @@ void RowPainter::paintLast()
|
||||
LyXFont font = getLabelFont();
|
||||
string const & str = pit_->layout()->endlabelstring();
|
||||
int const x = is_rtl ?
|
||||
int(x_) - font_metrics::width(str, font)
|
||||
x_ - font_metrics::width(str, font)
|
||||
: ww - text_.rightMargin(*bv_.buffer(), *row_) - row_->fill();
|
||||
pain_.text(x, yo_ + row_->baseline(), str, font);
|
||||
break;
|
||||
@ -904,7 +908,7 @@ void RowPainter::paintText()
|
||||
|
||||
bool running_strikeout = false;
|
||||
bool is_struckout = false;
|
||||
float last_strikeout_x = 0.0;
|
||||
int last_strikeout_x = 0;
|
||||
|
||||
pos_type vpos = row_->pos();
|
||||
while (vpos <= last) {
|
||||
@ -938,7 +942,7 @@ void RowPainter::paintText()
|
||||
if (running_strikeout && (highly_editable_inset || !is_struckout)) {
|
||||
int const middle = yo_ + row_->top_of_text()
|
||||
+ ((row_->baseline() - row_->top_of_text()) / 2);
|
||||
pain_.line(int(last_strikeout_x), middle, int(x_), middle,
|
||||
pain_.line(last_strikeout_x, middle, x_, middle,
|
||||
LColor::strikeout, Painter::line_solid, Painter::line_thin);
|
||||
running_strikeout = false;
|
||||
}
|
||||
@ -957,28 +961,25 @@ void RowPainter::paintText()
|
||||
int const y0 = yo_ + row_->baseline();
|
||||
int const y1 = y0 - defaultRowHeight() / 2;
|
||||
|
||||
pain_.line(int(x_), y1, int(x_), y0,
|
||||
pain_.line(x_, y1, x_, y0,
|
||||
LColor::added_space);
|
||||
|
||||
if (hfillExpansion(text_, row_, pos)) {
|
||||
int const y2 = (y0 + y1) / 2;
|
||||
|
||||
if (pos >= body_pos) {
|
||||
pain_.line(int(x_), y2,
|
||||
int(x_ + hfill_), y2,
|
||||
pain_.line(x_, y2, x_ + hfill_, y2,
|
||||
LColor::added_space,
|
||||
Painter::line_onoffdash);
|
||||
x_ += hfill_;
|
||||
} else {
|
||||
pain_.line(int(x_), y2,
|
||||
int(x_ + label_hfill_), y2,
|
||||
pain_.line(x_, y2,
|
||||
x_ + label_hfill_, y2,
|
||||
LColor::added_space,
|
||||
Painter::line_onoffdash);
|
||||
x_ += label_hfill_;
|
||||
}
|
||||
pain_.line(int(x_), y1,
|
||||
int(x_), y0,
|
||||
LColor::added_space);
|
||||
pain_.line(x_, y1, x_, y0, LColor::added_space);
|
||||
}
|
||||
x_ += 2;
|
||||
++vpos;
|
||||
@ -996,7 +997,7 @@ void RowPainter::paintText()
|
||||
if (running_strikeout) {
|
||||
int const middle = yo_ + row_->top_of_text()
|
||||
+ ((row_->baseline() - row_->top_of_text()) / 2);
|
||||
pain_.line(int(last_strikeout_x), middle, int(x_), middle,
|
||||
pain_.line(last_strikeout_x, middle, x_, middle,
|
||||
LColor::strikeout, Painter::line_solid, Painter::line_thin);
|
||||
running_strikeout = false;
|
||||
}
|
||||
@ -1059,7 +1060,7 @@ int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp)
|
||||
return 0;
|
||||
|
||||
int const arrow_size = 4;
|
||||
int const space_size = int(vsp.inPixels(bv));
|
||||
int const space_size = vsp.inPixels(bv);
|
||||
|
||||
LyXFont font;
|
||||
font.decSize();
|
||||
|
57
src/text.C
57
src/text.C
@ -322,13 +322,12 @@ int LyXText::singleWidth(ParagraphList::iterator pit,
|
||||
// should be changed! (Jug 20011204)
|
||||
//tmpinset->update(bv());
|
||||
Dimension dim;
|
||||
MetricsInfo mi;
|
||||
mi.base.bv = bv();
|
||||
mi.base.font = font;
|
||||
MetricsInfo mi(bv(), font, workWidth());
|
||||
tmpinset->metrics(mi, dim);
|
||||
#endif
|
||||
//return tmpinset->width(bv(), font);
|
||||
return dim.wid;
|
||||
#else
|
||||
return tmpinset->width();
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1084,18 +1083,20 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
|
||||
tmpfont = getFont(bv()->buffer(), pit, pos);
|
||||
tmpinset = pit->getInset(pos);
|
||||
if (tmpinset) {
|
||||
#if 1 // this is needed for deep update on initialitation
|
||||
#if 0 // this is needed for deep update on initialitation
|
||||
#warning inset->update FIXME
|
||||
//tmpinset->update(bv());
|
||||
Dimension dim;
|
||||
MetricsInfo mi;
|
||||
mi.base.bv = bv();
|
||||
mi.base.font = tmpfont;
|
||||
MetricsInfo mi(bv(), tmpfont, workWidth());
|
||||
tmpinset->metrics(mi, dim);
|
||||
#endif
|
||||
maxwidth += dim.wid;
|
||||
maxasc = max(maxasc, dim.asc);
|
||||
maxdesc = max(maxdesc, dim.des);
|
||||
#else
|
||||
maxwidth += tmpinset->width();
|
||||
maxasc = max(maxasc, tmpinset->ascent());
|
||||
maxdesc = max(maxdesc, tmpinset->descent());
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
maxwidth += singleWidth(pit, pos);
|
||||
@ -1317,9 +1318,9 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
|
||||
|
||||
rit->top_of_text(rit->baseline() - font_metrics::maxAscent(font));
|
||||
|
||||
float x = 0;
|
||||
int x = 0;
|
||||
if (layout->margintype != MARGIN_RIGHT_ADDRESS_BOX) {
|
||||
float dummy;
|
||||
int dummy;
|
||||
// this IS needed
|
||||
rit->width(maxwidth);
|
||||
prepareToPrint(rit, x, dummy, dummy, dummy, false);
|
||||
@ -1826,13 +1827,13 @@ void LyXText::charInserted()
|
||||
}
|
||||
|
||||
|
||||
void LyXText::prepareToPrint(RowList::iterator rit, float & x,
|
||||
float & fill_separator,
|
||||
float & fill_hfill,
|
||||
float & fill_label_hfill,
|
||||
void LyXText::prepareToPrint(RowList::iterator rit, int & x,
|
||||
int & fill_separator,
|
||||
int & fill_hfill,
|
||||
int & fill_label_hfill,
|
||||
bool bidi) const
|
||||
{
|
||||
float w = rit->fill();
|
||||
int w = rit->fill();
|
||||
fill_hfill = 0;
|
||||
fill_label_hfill = 0;
|
||||
fill_separator = 0;
|
||||
@ -1842,12 +1843,10 @@ void LyXText::prepareToPrint(RowList::iterator rit, float & x,
|
||||
|
||||
bool const is_rtl =
|
||||
pit->isRightToLeftPar(bv()->buffer()->params);
|
||||
if (is_rtl) {
|
||||
x = (workWidth() > 0)
|
||||
? rightMargin(*bv()->buffer(), *rit) : 0;
|
||||
} else
|
||||
x = (workWidth() > 0)
|
||||
? leftMargin(*rit) : 0;
|
||||
if (is_rtl)
|
||||
x = workWidth() > 0 ? rightMargin(*bv()->buffer(), *rit) : 0;
|
||||
else
|
||||
x = workWidth() > 0 ? leftMargin(*rit) : 0;
|
||||
|
||||
// is there a manual margin with a manual label
|
||||
LyXLayout_ptr const & layout = pit->layout();
|
||||
@ -1855,7 +1854,7 @@ void LyXText::prepareToPrint(RowList::iterator rit, float & x,
|
||||
if (layout->margintype == MARGIN_MANUAL
|
||||
&& layout->labeltype == LABEL_MANUAL) {
|
||||
/// We might have real hfills in the label part
|
||||
float nlh = numberOfLabelHfills(*this, rit);
|
||||
int nlh = numberOfLabelHfills(*this, rit);
|
||||
|
||||
// A manual label par (e.g. List) has an auto-hfill
|
||||
// between the label text and the body of the
|
||||
@ -1866,12 +1865,12 @@ void LyXText::prepareToPrint(RowList::iterator rit, float & x,
|
||||
++nlh;
|
||||
|
||||
if (nlh && !pit->getLabelWidthString().empty()) {
|
||||
fill_label_hfill = labelFill(*rit) / nlh;
|
||||
fill_label_hfill = int(labelFill(*rit) / nlh);
|
||||
}
|
||||
}
|
||||
|
||||
// are there any hfills in the row?
|
||||
float const nh = numberOfHfills(*this, rit);
|
||||
int const nh = numberOfHfills(*this, rit);
|
||||
|
||||
if (nh) {
|
||||
if (w > 0)
|
||||
@ -1879,7 +1878,7 @@ void LyXText::prepareToPrint(RowList::iterator rit, float & x,
|
||||
// we don't have to look at the alignment if it is ALIGN_LEFT and
|
||||
// if the row is already larger then the permitted width as then
|
||||
// we force the LEFT_ALIGN'edness!
|
||||
} else if (static_cast<int>(rit->width()) < workWidth()) {
|
||||
} else if (int(rit->width()) < workWidth()) {
|
||||
// is it block, flushleft or flushright?
|
||||
// set x how you need it
|
||||
int align;
|
||||
@ -1908,7 +1907,7 @@ void LyXText::prepareToPrint(RowList::iterator rit, float & x,
|
||||
switch (align) {
|
||||
case LYX_ALIGN_BLOCK:
|
||||
{
|
||||
float const ns = numberOfSeparators(*this, rit);
|
||||
int const ns = numberOfSeparators(*this, rit);
|
||||
RowList::iterator next_row = boost::next(rit);
|
||||
ParagraphList::iterator next_pit = next_row->par();
|
||||
|
||||
@ -2661,6 +2660,7 @@ LyXText::getRow(ParagraphList::iterator pit, pos_type pos) const
|
||||
return rit;
|
||||
}
|
||||
|
||||
|
||||
// returns pointer to a specified row
|
||||
RowList::iterator
|
||||
LyXText::getRow(ParagraphList::iterator pit, pos_type pos, int & y) const
|
||||
@ -2690,6 +2690,7 @@ LyXText::getRow(ParagraphList::iterator pit, pos_type pos, int & y) const
|
||||
return rit;
|
||||
}
|
||||
|
||||
|
||||
// returns pointer to some fancy row 'below' specified row
|
||||
RowList::iterator LyXText::cursorIRow() const
|
||||
{
|
||||
|
22
src/text2.C
22
src/text2.C
@ -1615,10 +1615,10 @@ float LyXText::getCursorX(RowList::iterator rit,
|
||||
pos_type pos, pos_type last, bool boundary) const
|
||||
{
|
||||
pos_type cursor_vpos = 0;
|
||||
float x;
|
||||
float fill_separator;
|
||||
float fill_hfill;
|
||||
float fill_label_hfill;
|
||||
int x;
|
||||
int fill_separator;
|
||||
int fill_hfill;
|
||||
int fill_label_hfill;
|
||||
// This call HAS to be here because of the BidiTables!!!
|
||||
prepareToPrint(rit, x, fill_separator, fill_hfill,
|
||||
fill_label_hfill);
|
||||
@ -1752,13 +1752,12 @@ void LyXText::setCurrentFont()
|
||||
pos_type
|
||||
LyXText::getColumnNearX(RowList::iterator rit, int & x, bool & boundary) const
|
||||
{
|
||||
float tmpx = 0.0;
|
||||
float fill_separator;
|
||||
float fill_hfill;
|
||||
float fill_label_hfill;
|
||||
int tmpx = 0;
|
||||
int fill_separator;
|
||||
int fill_hfill;
|
||||
int fill_label_hfill;
|
||||
|
||||
prepareToPrint(rit, tmpx, fill_separator,
|
||||
fill_hfill, fill_label_hfill);
|
||||
prepareToPrint(rit, tmpx, fill_separator, fill_hfill, fill_label_hfill);
|
||||
|
||||
pos_type vc = rit->pos();
|
||||
pos_type last = lastPrintablePos(*this, rit);
|
||||
@ -1870,7 +1869,8 @@ void LyXText::setCursorFromCoordinates(int x, int y)
|
||||
|
||||
setCursorFromCoordinates(cursor, x, y);
|
||||
setCurrentFont();
|
||||
deleteEmptyParagraphMechanism(old_cursor);
|
||||
#warning DEPM disabled, otherwise crash when entering new table
|
||||
//deleteEmptyParagraphMechanism(old_cursor);
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,15 +115,15 @@ namespace {
|
||||
|
||||
LyXFont const & font = text.getFont(bv->buffer(), par, pos);
|
||||
|
||||
int const width = inset->width(bv, font);
|
||||
int const width = inset->width();
|
||||
int const inset_x = font.isVisibleRightToLeft()
|
||||
? (cur.ix() - width) : cur.ix();
|
||||
|
||||
Box b(
|
||||
inset_x + inset->scroll(),
|
||||
inset_x + width,
|
||||
cur.iy() - inset->ascent(bv, font),
|
||||
cur.iy() + inset->descent(bv, font)
|
||||
cur.iy() - inset->ascent(),
|
||||
cur.iy() + inset->descent()
|
||||
);
|
||||
|
||||
if (!b.contained(x, y)) {
|
||||
@ -1297,7 +1297,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
LyXCursor cursor = bv->text->cursor;
|
||||
LyXFont font = bv->text->getFont(bv->buffer(),
|
||||
cursor.par(), cursor.pos());
|
||||
int width = tli->width(bv, font);
|
||||
int width = tli->width();
|
||||
int inset_x = font.isVisibleRightToLeft()
|
||||
? cursor.ix() - width : cursor.ix();
|
||||
int start_x = inset_x + tli->scroll();
|
||||
|
Loading…
Reference in New Issue
Block a user