Fix compilation warnings on windows.

This commit is contained in:
Jean-Marc Lasgouttes 2014-07-28 09:46:13 +02:00
parent cc56c64ede
commit f9caebd29f
3 changed files with 12 additions and 63 deletions

View File

@ -45,7 +45,7 @@ double Row::Element::pos2x(pos_type const i) const
bool const rtl = font.isVisibleRightToLeft();
int w = 0;
double w = 0;
//handle first the two bounds of the element
if (i == pos || type != STRING)
w = rtl ? width() : 0;
@ -70,7 +70,7 @@ pos_type Row::Element::x2pos(double &x) const
case STRING: {
FontMetrics const & fm = theFontMetrics(font);
// FIXME: is it really necessary for x to be a double?
int xx = x;
int xx = int(x);
i = fm.x2pos(str, xx, rtl);
x = xx;
break;
@ -113,9 +113,9 @@ bool Row::Element::breakAt(double w)
return false;
str = str.substr(0, new_pos - pos);
if (rtl)
dim.wid -= w;
dim.wid -= int(w);
else
dim.wid = w;
dim.wid = int(w);
endpos = new_pos;
return true;
}
@ -404,7 +404,7 @@ void Row::shortenIfNeeded(pos_type const keep, int const w)
double max_w = w - x;
if (first_below->breakAt(max_w)) {
end_ = first_below->endpos;
dim_.wid = x + first_below->width();
dim_.wid = int(x + first_below->width());
// If there are other elements, they should be removed.
elements_.erase(boost::next(first_below), end);
} else if (first_below->pos > pos_) {

View File

@ -627,7 +627,7 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
row.x += w;
break;
case LYX_ALIGN_CENTER:
row.dimension().wid = width - w / 2;
row.dimension().wid = width - int(w / 2);
row.x += w / 2;
break;
}
@ -660,7 +660,7 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
for ( ; cit != cend; ++cit) {
if (row.label_hfill && cit->endpos == body_pos
&& cit->type == Row::SPACE)
cit->dim.wid -= row.label_hfill * (nlh - 1);
cit->dim.wid -= int(row.label_hfill * (nlh - 1));
if (!cit->inset || !cit->inset->isHfill())
continue;
if (pm.hfillExpansion(row, cit->pos))
@ -680,7 +680,7 @@ int TextMetrics::labelFill(pit_type const pit, Row const & row) const
Paragraph const & par = text_->getPar(pit);
LBUFERR(par.beginOfBody() > 0 || par.isEnvSeparator(0));
int w = 0;
double w = 0;
Row::const_iterator cit = row.begin();
Row::const_iterator const end = row.end();
// iterate over elements before main body (except the last one,
@ -697,7 +697,7 @@ int TextMetrics::labelFill(pit_type const pit, Row const & row) const
FontMetrics const & fm
= theFontMetrics(text_->labelFont(par));
return max(0, fm.width(label) - w);
return max(0, fm.width(label) - int(w));
}
@ -1108,10 +1108,10 @@ pos_type TextMetrics::getPosNearX(Row const & row, int & x,
pos_type pos = row.pos();
boundary = false;
if (row.empty())
x = row.x;
x = int(row.x);
else if (x <= row.x) {
pos = row.front().left_pos();
x = row.x;
x = int(row.x);
} else if (x >= row.width() - row.right_margin) {
pos = row.back().right_pos();
x = row.width() - row.right_margin;
@ -1123,7 +1123,7 @@ pos_type TextMetrics::getPosNearX(Row const & row, int & x,
if (w <= x && w + cit->width() > x) {
double x_offset = x - w;
pos = cit->x2pos(x_offset);
x = x_offset + w;
x = int(x_offset + w);
break;
}
w += cit->width();

View File

@ -305,7 +305,6 @@
<tabstop>autoBeginCB</tabstop>
<tabstop>autoEndCB</tabstop>
<tabstop>markForeignCB</tabstop>
<tabstop>rtlGB</tabstop>
<tabstop>logicalCursorRB</tabstop>
<tabstop>visualCursorRB</tabstop>
</tabstops>
@ -313,54 +312,4 @@
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
<connections>
<connection>
<sender>rtlGB</sender>
<signal>toggled(bool)</signal>
<receiver>logicalCursorRB</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>139</x>
<y>317</y>
</hint>
<hint type="destinationlabel">
<x>162</x>
<y>348</y>
</hint>
</hints>
</connection>
<connection>
<sender>rtlGB</sender>
<signal>toggled(bool)</signal>
<receiver>visualCursorRB</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>139</x>
<y>317</y>
</hint>
<hint type="destinationlabel">
<x>228</x>
<y>348</y>
</hint>
</hints>
</connection>
<connection>
<sender>rtlGB</sender>
<signal>toggled(bool)</signal>
<receiver>cursorMovementLA</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>139</x>
<y>317</y>
</hint>
<hint type="destinationlabel">
<x>72</x>
<y>348</y>
</hint>
</hints>
</connection>
</connections>
</ui>