inline
-void lyx_advance(string & data, unsigned int n)
+void lyx_advance(string & data, string::size_type n)
{
data.erase(0, n);
}
// To make isValidGlueLength recognize negative values as
// the first number this little hack is needed:
- short val_sign = 1; // positive as default
+ int val_sign = 1; // positive as default
switch (buffer[0]) {
case '-':
lyx_advance(buffer, 1);
// To make isValidLength recognize negative values
// this little hack is needed:
- short val_sign = 1; // positive as default
+ int val_sign = 1; // positive as default
switch (buffer[0]) {
case '-':
lyx_advance(buffer, 1);
string const LyXLength::asString() const
{
- std::ostringstream buffer;
+ ostringstream buffer;
buffer << val << unit_name[uni]; // setw?
return buffer.str().c_str();
}
string const LyXLength::asLatexString() const
{
- std::ostringstream buffer;
+ ostringstream buffer;
switch(uni) {
case PW:
case PE:
buffer << abs(static_cast<int>(val/100)) << "." << abs(static_cast<int>(val)%100) << "\\columnwidth";
break;
case PP:
- buffer << "." << abs(static_cast<int>(val/100)) << "." << abs(static_cast<int>(val)%100) << "\\pagewidth";
+ buffer << abs(static_cast<int>(val/100)) << "." << abs(static_cast<int>(val)%100) << "\\pagewidth";
break;
case PL:
- buffer << "." << abs(static_cast<int>(val/100)) << "." << abs(static_cast<int>(val)%100) << "\\linewidth";
+ buffer << abs(static_cast<int>(val/100)) << "." << abs(static_cast<int>(val)%100) << "\\linewidth";
break;
default:
buffer << val << unit_name[uni]; // setw?
{
LyXGlueLength tmp(0.0, PT);
- if (!isValidGlueLength (data, &tmp))
- return; // should raise an exception
- else {
- val = tmp.val;
- uni = tmp.uni;
- plus_val = tmp.plus_val;
- plus_uni = tmp.plus_uni;
- minus_val = tmp.minus_val;
- minus_uni = tmp.minus_uni;
- }
+ // we should really raise exception here
+ if (!isValidGlueLength(data, &tmp))
+ ;
+
+ val = tmp.val;
+ uni = tmp.uni;
+ plus_val = tmp.plus_val;
+ plus_uni = tmp.plus_uni;
+ minus_val = tmp.minus_val;
+ minus_uni = tmp.minus_uni;
}
string const LyXGlueLength::asString() const
{
- std::ostringstream buffer;
+ ostringstream buffer;
if (plus_val != 0.0)
if (minus_val != 0.0)
string const LyXGlueLength::asLatexString() const
{
- std::ostringstream buffer;
+ ostringstream buffer;
if (plus_val != 0.0)
if (minus_val != 0.0)
float value;
string input = strip(data);
- int length = input.length();
+ string::size_type const length = input.length();
if (length > 1 && input[length-1] == '*') {
kp = true;
// is the same as on paper.
// we don't care about sign of value, we
- // can't display negative anyway
+ // display negative space with text too
result = 0.0;
value = len.value();
- short val_sign = value < 0.0 ? -1 : 1;
+ int val_sign = value < 0.0 ? -1 : 1;
switch (len.unit()) {
case LyXLength::SP: