rename/merge LyXLength related stuff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18067 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-04-28 12:58:49 +00:00
parent 59d0d3cedc
commit 8c622e4ff0
53 changed files with 495 additions and 527 deletions

View File

@ -961,19 +961,19 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
}
}
if (!topmargin.empty())
os << ",tmargin=" << from_ascii(LyXLength(topmargin).asLatexString());
os << ",tmargin=" << from_ascii(Length(topmargin).asLatexString());
if (!bottommargin.empty())
os << ",bmargin=" << from_ascii(LyXLength(bottommargin).asLatexString());
os << ",bmargin=" << from_ascii(Length(bottommargin).asLatexString());
if (!leftmargin.empty())
os << ",lmargin=" << from_ascii(LyXLength(leftmargin).asLatexString());
os << ",lmargin=" << from_ascii(Length(leftmargin).asLatexString());
if (!rightmargin.empty())
os << ",rmargin=" << from_ascii(LyXLength(rightmargin).asLatexString());
os << ",rmargin=" << from_ascii(Length(rightmargin).asLatexString());
if (!headheight.empty())
os << ",headheight=" << from_ascii(LyXLength(headheight).asLatexString());
os << ",headheight=" << from_ascii(Length(headheight).asLatexString());
if (!headsep.empty())
os << ",headsep=" << from_ascii(LyXLength(headsep).asLatexString());
os << ",headsep=" << from_ascii(Length(headsep).asLatexString());
if (!footskip.empty())
os << ",footskip=" << from_ascii(LyXLength(footskip).asLatexString());
os << ",footskip=" << from_ascii(Length(footskip).asLatexString());
os << "}\n";
texrow.newline();
}

View File

@ -1,5 +1,5 @@
/**
* \file LyXLength.cpp
* \file Length.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -15,7 +15,7 @@
#include <config.h>
#include "LyXLength.h"
#include "Length.h"
#include "lengthcommon.h"
#include "LyXRC.h"
@ -26,25 +26,30 @@
namespace lyx {
using std::ostringstream;
using std::string;
LyXLength::LyXLength()
: val_(0), unit_(LyXLength::UNIT_NONE)
/////////////////////////////////////////////////////////////////////
//
// Length
//
/////////////////////////////////////////////////////////////////////
Length::Length()
: val_(0), unit_(Length::UNIT_NONE)
{}
LyXLength::LyXLength(double v, LyXLength::UNIT u)
Length::Length(double v, Length::UNIT u)
: val_(v), unit_(u)
{}
LyXLength::LyXLength(string const & data)
: val_(0), unit_(LyXLength::PT)
Length::Length(string const & data)
: val_(0), unit_(Length::PT)
{
LyXLength tmp;
Length tmp;
if (!isValidLength(data, &tmp))
return; // should raise an exception
@ -54,7 +59,7 @@ LyXLength::LyXLength(string const & data)
}
string const LyXLength::asString() const
string const Length::asString() const
{
ostringstream os;
os << val_ << unit_name[unit_]; // setw?
@ -62,7 +67,7 @@ string const LyXLength::asString() const
}
docstring const LyXLength::asDocstring() const
docstring const Length::asDocstring() const
{
odocstringstream os;
os << val_ << unit_name[unit_]; // setw?
@ -70,7 +75,7 @@ docstring const LyXLength::asDocstring() const
}
string const LyXLength::asLatexString() const
string const Length::asLatexString() const
{
ostringstream os;
switch (unit_) {
@ -100,43 +105,43 @@ string const LyXLength::asLatexString() const
}
double LyXLength::value() const
double Length::value() const
{
return val_;
}
LyXLength::UNIT LyXLength::unit() const
Length::UNIT Length::unit() const
{
return unit_;
}
void LyXLength::value(double v)
void Length::value(double v)
{
val_ = v;
}
void LyXLength::unit(LyXLength::UNIT u)
void Length::unit(Length::UNIT u)
{
unit_ = u;
}
bool LyXLength::zero() const
bool Length::zero() const
{
return val_ == 0.0;
}
bool LyXLength::empty() const
bool Length::empty() const
{
return unit_ == LyXLength::UNIT_NONE;
return unit_ == Length::UNIT_NONE;
}
int LyXLength::inPixels(int text_width, int em_width_base) const
int Length::inPixels(int text_width, int em_width_base) const
{
// Zoom factor specified by user in percent
double const zoom = lyxrc.zoom / 100.0; // [percent]
@ -159,79 +164,79 @@ int LyXLength::inPixels(int text_width, int em_width_base) const
double result = 0.0;
switch (unit_) {
case LyXLength::SP:
case Length::SP:
// Scaled point: sp = 1/65536 pt
result = zoom * dpi * val_
/ (72.27 * 65536); // 4736286.7
break;
case LyXLength::PT:
case Length::PT:
// Point: 1 pt = 1/72.27 inch
result = zoom * dpi * val_
/ 72.27; // 72.27
break;
case LyXLength::BP:
case Length::BP:
// Big point: 1 bp = 1/72 inch
result = zoom * dpi * val_
/ 72; // 72
break;
case LyXLength::DD:
case Length::DD:
// Didot: 1157dd = 1238 pt?
result = zoom * dpi * val_
/ (72.27 / (0.376 * 2.845)); // 67.559735
break;
case LyXLength::MM:
case Length::MM:
// Millimeter: 1 mm = 1/25.4 inch
result = zoom * dpi * val_
/ 25.4; // 25.4
break;
case LyXLength::PC:
case Length::PC:
// Pica: 1 pc = 12 pt
result = zoom * dpi * val_
/ (72.27 / 12); // 6.0225
break;
case LyXLength::CC:
case Length::CC:
// Cicero: 1 cc = 12 dd
result = zoom * dpi * val_
/ (72.27 / (12 * 0.376 * 2.845)); // 5.6299779
break;
case LyXLength::CM:
case Length::CM:
// Centimeter: 1 cm = 1/2.54 inch
result = zoom * dpi * val_
/ 2.54; // 2.54
break;
case LyXLength::IN:
case Length::IN:
// Inch
result = zoom * dpi * val_;
break;
case LyXLength::EX:
case Length::EX:
// Ex: The height of an "x"
// 0.4305 is the ration between 1ex and 1em in cmr10
result = val_ * em_width * 0.4305;
break;
case LyXLength::EM:
case Length::EM:
// Em: The width of an "m"
result = val_ * em_width;
break;
case LyXLength::MU:
case Length::MU:
// math unit = 1/18em
result = val_ * em_width / 18;
break;
case LyXLength::PCW: // Always % of workarea
case LyXLength::PTW:
case LyXLength::PLW:
case Length::PCW: // Always % of workarea
case Length::PTW:
case Length::PLW:
result = val_ * text_width / 100;
break;
case LyXLength::PPW:
case Length::PPW:
// paperwidth/textwidth is 1.7 for A4 paper with default margins
result = val_ * text_width * 1.7 / 100;
break;
case LyXLength::PTH:
case Length::PTH:
result = val_ * text_width * 1.787 / 100;
break;
case LyXLength::PPH:
case Length::PPH:
result = val_ * text_width * 2.2 / 100;
break;
case LyXLength::UNIT_NONE:
case Length::UNIT_NONE:
result = 0; // this cannot happen
break;
}
@ -239,21 +244,21 @@ int LyXLength::inPixels(int text_width, int em_width_base) const
}
int LyXLength::inBP() const
int Length::inBP() const
{
// return any LyXLength value as a one with
// return any Length value as a one with
// the PostScript point, called bp (big points)
double result = 0.0;
switch (unit_) {
case LyXLength::CM:
case Length::CM:
// 1bp = 0.2835cm
result = val_ * 28.346;
break;
case LyXLength::MM:
case Length::MM:
// 1bp = 0.02835mm
result = val_ * 2.8346;
break;
case LyXLength::IN:
case Length::IN:
// 1pt = 1/72in
result = val_ * 72.0;
break;
@ -266,13 +271,133 @@ int LyXLength::inBP() const
}
bool operator==(LyXLength const & l1, LyXLength const & l2)
bool operator==(Length const & l1, Length const & l2)
{
return l1.value() == l2.value() && l1.unit() == l2.unit();
}
bool operator!=(LyXLength const & l1, LyXLength const & l2)
bool operator!=(Length const & l1, Length const & l2)
{
return !(l1 == l2);
}
/////////////////////////////////////////////////////////////////////
//
// GlueLength
//
/////////////////////////////////////////////////////////////////////
GlueLength::GlueLength(Length const & len)
: len_(len)
{}
GlueLength::GlueLength(Length const & len, Length const & plus,
Length const & minus)
: len_(len), plus_(plus), minus_(minus)
{}
GlueLength::GlueLength(string const & data)
{
isValidGlueLength(data, this);
}
string const GlueLength::asString() const
{
ostringstream buffer;
buffer << len_.value();
if (plus_.zero() && minus_.zero()) {
buffer << unit_name[len_.unit()];
return buffer.str();
}
// just len and plus
if (minus_.zero()) {
if (len_.unit() != plus_.unit())
buffer << unit_name[len_.unit()];
buffer << '+' << plus_.value();
buffer << unit_name[plus_.unit()];
return buffer.str();
}
// just len and minus
if (plus_.zero()) {
if (len_.unit() != minus_.unit())
buffer << unit_name[len_.unit()];
buffer << '-' << minus_.value();
buffer << unit_name[minus_.unit()];
return buffer.str();
}
// ok, len, plus AND minus
// len+-
if (minus_ == plus_) {
if (len_.unit() != minus_.unit())
buffer << unit_name[len_.unit()];
buffer << "+-" << minus_.value();
buffer << unit_name[minus_.unit()];
return buffer.str();
}
// this is so rare a case, why bother minimising units ?
buffer << unit_name[len_.unit()];
buffer << '+' << plus_.value() << unit_name[plus_.unit()];
buffer << '-' << minus_.value() << unit_name[minus_.unit()];
return buffer.str();
}
string const GlueLength::asLatexString() const
{
ostringstream buffer;
buffer << len_.value() << unit_name[len_.unit()];
if (!plus_.zero())
buffer << " plus " << plus_.value() << unit_name[plus_.unit()];
if (!minus_.zero())
buffer << " minus " << minus_.value() << unit_name[minus_.unit()];
return buffer.str();
}
Length const & GlueLength::len() const
{
return len_;
}
Length const & GlueLength::plus() const
{
return plus_;
}
Length const & GlueLength::minus() const
{
return minus_;
}
bool operator==(GlueLength const & l1, GlueLength const & l2)
{
return l1.len() == l2.len()
&& l1.plus() == l2.plus()
&& l1.minus() == l2.minus();
}
bool operator!=(GlueLength const & l1, GlueLength const & l2)
{
return !(l1 == l2);
}

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
/**
* \file LyXLength.h
* \file Length.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -24,11 +24,17 @@ namespace lyx {
#undef PC
#undef SP
/////////////////////////////////////////////////////////////////////
//
// Length
//
/////////////////////////////////////////////////////////////////////
/**
* LyXLength - Represents latex length measurement
* Length - Represents latex length measurement
*/
class LyXLength {
class Length {
public:
/// length units
enum UNIT {
@ -54,14 +60,14 @@ public:
};
///
LyXLength();
Length();
///
LyXLength(double v, LyXLength::UNIT u);
Length(double v, Length::UNIT u);
/// "data" must be a decimal number, followed by a unit
explicit LyXLength(std::string const & data);
explicit Length(std::string const & data);
void swap(LyXLength & rhs)
void swap(Length & rhs)
{
std::swap(val_, rhs.val_);
std::swap(unit_, rhs.unit_);
@ -70,11 +76,11 @@ public:
///
double value() const;
///
LyXLength::UNIT unit() const;
Length::UNIT unit() const;
///
void value(double);
///
void unit(LyXLength::UNIT unit);
void unit(Length::UNIT unit);
///
bool zero() const;
///
@ -90,19 +96,19 @@ public:
/// return the on-screen size of this length of an image
int inBP() const;
friend bool isValidLength(std::string const & data, LyXLength * result);
friend bool isValidLength(std::string const & data, Length * result);
private:
///
double val_;
///
LyXLength::UNIT unit_;
Length::UNIT unit_;
};
///
bool operator==(LyXLength const & l1, LyXLength const & l2);
bool operator==(Length const & l1, Length const & l2);
///
bool operator!=(LyXLength const & l1, LyXLength const & l2);
bool operator!=(Length const & l1, Length const & l2);
/** Test whether \p data represents a valid length.
*
* \returns whether \p data is a valid length
@ -110,14 +116,72 @@ bool operator!=(LyXLength const & l1, LyXLength const & l2);
* and LaTeX format is the representation of length variables as units (e.g.
* \c text% vs. \c \\textwidth) you can actually use this function as well
* for testing LaTeX lengths as long as they only contain real units like pt.
* \param result Pointer to a LyXLength variable. If \p result is not 0 and
* \param result Pointer to a Length variable. If \p result is not 0 and
* \p data is valid, the length represented by it is stored into \p result.
*/
bool isValidLength(std::string const & data, LyXLength * result = 0);
bool isValidLength(std::string const & data, Length * result = 0);
/// return the LyX name of the given unit number
char const * stringFromUnit(int unit);
/////////////////////////////////////////////////////////////////////
//
// GlueLength
//
/////////////////////////////////////////////////////////////////////
class GlueLength {
public:
///
GlueLength() {}
///
explicit GlueLength(Length const & len);
///
GlueLength(Length const & len,
Length const & plus,
Length const & minus);
/** "data" must be a decimal number, followed by a unit, and
optional "glue" indicated by "+" and "-". You may abbreviate
reasonably. Examples:
1.2 cm // 4mm +2pt // 2cm -4mm +2mm // 4+0.1-0.2cm
The traditional Latex format is also accepted, like
4cm plus 10pt minus 10pt */
explicit GlueLength(std::string const & data);
///
Length const & len() const;
///
Length const & plus() const;
///
Length const & minus() const;
/// conversion
std::string const asString() const;
///
std::string const asLatexString() const;
friend bool isValidGlueLength(std::string const & data,
GlueLength* result);
private:
/// the normal vlaue
Length len_;
/// extra stretch
Length plus_;
/// extra shrink
Length minus_;
};
///
bool operator==(GlueLength const & l1, GlueLength const & l2);
///
bool operator!=(GlueLength const & l1, GlueLength const & l2);
/** If "data" is valid, the length represented by it is
stored into "result", if that is not 0. */
bool isValidGlueLength(std::string const & data, GlueLength * result = 0);
} // namespace lyx
#endif // LYXLENGTH_H

View File

@ -1,140 +0,0 @@
/**
* \file LyXGlueLength.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author Matthias Ettrich
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "LyXGlueLength.h"
#include "lengthcommon.h"
#include <sstream>
namespace lyx {
using std::ostringstream;
using std::string;
LyXGlueLength::LyXGlueLength(LyXLength const & len)
: len_(len)
{}
LyXGlueLength::LyXGlueLength(LyXLength const & len, LyXLength const & plus,
LyXLength const & minus)
: len_(len), plus_(plus), minus_(minus)
{}
LyXGlueLength::LyXGlueLength(string const & data)
{
isValidGlueLength(data, this);
}
string const LyXGlueLength::asString() const
{
ostringstream buffer;
buffer << len_.value();
if (plus_.zero() && minus_.zero()) {
buffer << unit_name[len_.unit()];
return buffer.str();
}
// just len and plus
if (minus_.zero()) {
if (len_.unit() != plus_.unit())
buffer << unit_name[len_.unit()];
buffer << '+' << plus_.value();
buffer << unit_name[plus_.unit()];
return buffer.str();
}
// just len and minus
if (plus_.zero()) {
if (len_.unit() != minus_.unit())
buffer << unit_name[len_.unit()];
buffer << '-' << minus_.value();
buffer << unit_name[minus_.unit()];
return buffer.str();
}
// ok, len, plus AND minus
// len+-
if (minus_ == plus_) {
if (len_.unit() != minus_.unit())
buffer << unit_name[len_.unit()];
buffer << "+-" << minus_.value();
buffer << unit_name[minus_.unit()];
return buffer.str();
}
// this is so rare a case, why bother minimising units ?
buffer << unit_name[len_.unit()];
buffer << '+' << plus_.value() << unit_name[plus_.unit()];
buffer << '-' << minus_.value() << unit_name[minus_.unit()];
return buffer.str();
}
string const LyXGlueLength::asLatexString() const
{
ostringstream buffer;
buffer << len_.value() << unit_name[len_.unit()];
if (!plus_.zero())
buffer << " plus " << plus_.value() << unit_name[plus_.unit()];
if (!minus_.zero())
buffer << " minus " << minus_.value() << unit_name[minus_.unit()];
return buffer.str();
}
LyXLength const & LyXGlueLength::len() const
{
return len_;
}
LyXLength const & LyXGlueLength::plus() const
{
return plus_;
}
LyXLength const & LyXGlueLength::minus() const
{
return minus_;
}
bool operator==(LyXGlueLength const & l1, LyXGlueLength const & l2)
{
return l1.len() == l2.len()
&& l1.plus() == l2.plus()
&& l1.minus() == l2.minus();
}
bool operator!=(LyXGlueLength const & l1, LyXGlueLength const & l2)
{
return !(l1 == l2);
}
} // namespace lyx

View File

@ -1,78 +0,0 @@
// -*- C++ -*-
/**
* \file LyXGlueLength.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author Matthias Ettrich
* \author Jean-Marc Lasgouttes
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYX_GLUE_LENGTH_H
#define LYX_GLUE_LENGTH_H
#include "LyXLength.h"
namespace lyx {
class LyXGlueLength {
public:
///
LyXGlueLength() {}
///
explicit LyXGlueLength(LyXLength const & len);
///
LyXGlueLength(LyXLength const & len,
LyXLength const & plus,
LyXLength const & minus);
/** "data" must be a decimal number, followed by a unit, and
optional "glue" indicated by "+" and "-". You may abbreviate
reasonably. Examples:
1.2 cm // 4mm +2pt // 2cm -4mm +2mm // 4+0.1-0.2cm
The traditional Latex format is also accepted, like
4cm plus 10pt minus 10pt */
explicit LyXGlueLength(std::string const & data);
///
LyXLength const & len() const;
///
LyXLength const & plus() const;
///
LyXLength const & minus() const;
/// conversion
std::string const asString() const;
///
std::string const asLatexString() const;
friend bool isValidGlueLength(std::string const & data,
LyXGlueLength* result);
private:
/// the normal vlaue
LyXLength len_;
/// extra stretch
LyXLength plus_;
/// extra shrink
LyXLength minus_;
};
///
bool operator==(LyXGlueLength const & l1, LyXGlueLength const & l2);
///
bool operator!=(LyXGlueLength const & l1, LyXGlueLength const & l2);
/** If "data" is valid, the length represented by it is
stored into "result", if that is not 0. */
bool isValidGlueLength(std::string const & data, LyXGlueLength * result = 0);
} // namespace lyx
#endif // LYXGLUELENGTH_H

View File

@ -158,6 +158,8 @@ lyx_SOURCES = \
LaTeXFeatures.h \
LaTeX.h \
layout.h \
Length.cpp \
Length.h \
lengthcommon.cpp \
lengthcommon.h \
Lexer.cpp \
@ -174,14 +176,10 @@ lyx_SOURCES = \
LyXFont.h \
LyXFunc.cpp \
LyXFunc.h \
LyXGlueLength.cpp \
LyXGlueLength.h \
LyX.h \
LyXLayout.cpp \
LyXLayout.h \
lyxlayout_ptr_fwd.h \
LyXLength.cpp \
LyXLength.h \
LyXRC.cpp \
LyXRC.h \
LyXServer.cpp \

View File

@ -28,7 +28,7 @@
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Color.h"
#include "LyXLength.h"
#include "Length.h"
#include "LyXFont.h"
#include "LyXRC.h"
#include "Row.h"

View File

@ -164,13 +164,13 @@ void ParagraphParameters::labelWidthString(docstring const & lws)
}
LyXLength const & ParagraphParameters::leftIndent() const
Length const & ParagraphParameters::leftIndent() const
{
return leftindent_;
}
void ParagraphParameters::leftIndent(LyXLength const & li)
void ParagraphParameters::leftIndent(Length const & li)
{
leftindent_ = li;
}
@ -194,7 +194,7 @@ void ParagraphParameters::read(Lexer & lex)
noindent(true);
} else if (token == "\\leftindent") {
lex.next();
LyXLength value(lex.getString());
Length value(lex.getString());
leftIndent(value);
} else if (token == "\\start_of_appendix") {
startOfAppendix(true);

View File

@ -15,7 +15,7 @@
#define PARAGRAPHPARAMETERS_H
#include "layout.h"
#include "LyXLength.h"
#include "Length.h"
#include "Spacing.h"
#include "support/types.h"
@ -28,7 +28,7 @@
namespace lyx {
class BufferView;
class LyXLength;
class Length;
class Lexer;
class Paragraph;
class Spacing;
@ -76,9 +76,9 @@ public:
///
void labelWidthString(docstring const &);
///
LyXLength const & leftIndent() const;
Length const & leftIndent() const;
///
void leftIndent(LyXLength const &);
void leftIndent(Length const &);
/// read the parameters from a lex
void read(Lexer & lex);
@ -107,7 +107,7 @@ private:
///
docstring labelwidthstring_;
///
LyXLength leftindent_;
Length leftindent_;
};

View File

@ -29,7 +29,7 @@
#include "FuncRequest.h"
#include "FontIterator.h"
#include "Color.h"
#include "LyXLength.h"
#include "Length.h"
#include "LyXRC.h"
#include "LyXText.h"
#include "MetricsInfo.h"

View File

@ -38,10 +38,10 @@ namespace {
/// used to return numeric values in parsing vspace
double number[4] = { 0, 0, 0, 0 };
/// used to return unit types in parsing vspace
LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE };
Length::UNIT unit[4] = { Length::UNIT_NONE,
Length::UNIT_NONE,
Length::UNIT_NONE,
Length::UNIT_NONE };
/// the current position in the number array
int number_index;
@ -154,7 +154,7 @@ char nextToken(string & data)
unit[unit_index] = unitFromString(buffer);
}
if (unit[unit_index] != LyXLength::UNIT_NONE) {
if (unit[unit_index] != Length::UNIT_NONE) {
++unit_index;
return 'u';
}
@ -203,7 +203,7 @@ const char * stringFromUnit(int unit)
}
bool isValidGlueLength(string const & data, LyXGlueLength * result)
bool isValidGlueLength(string const & data, GlueLength * result)
{
// This parser is table-driven. First, it constructs a "pattern"
// that describes the sequence of tokens in "data". For example,
@ -211,7 +211,7 @@ bool isValidGlueLength(string const & data, LyXGlueLength * result)
// numbers and units are stored into static arrays. Then, "pattern"
// is searched in the "table". If it is found, the associated
// table entries tell us which number and unit should go where
// in the LyXLength structure. Example: if "data" has the "pattern"
// in the Length structure. Example: if "data" has the "pattern"
// "nu+nu-nu", the associated table entries are "2, 3, 2, 3".
// That means, "plus_val" is the second number that was seen
// in the input, "minus_val" is the third number, and "plus_uni"
@ -280,7 +280,7 @@ bool isValidGlueLength(string const & data, LyXGlueLength * result)
}
bool isValidLength(string const & data, LyXLength * result)
bool isValidLength(string const & data, Length * result)
{
// This is a trimmed down version of isValidGlueLength.
// The parser may seem overkill for lengths without
@ -350,12 +350,12 @@ VSpace::VSpace(vspace_kind k)
{}
VSpace::VSpace(LyXLength const & l)
VSpace::VSpace(Length const & l)
: kind_(LENGTH), len_(l), keep_(false)
{}
VSpace::VSpace(LyXGlueLength const & l)
VSpace::VSpace(GlueLength const & l)
: kind_(LENGTH), len_(l), keep_(false)
{}
@ -392,7 +392,7 @@ VSpace::VSpace(string const & data)
// without units in added_space_top/bottom.
// Let unit default to centimeters here.
kind_ = LENGTH;
len_ = LyXGlueLength(LyXLength(convert<double>(input), LyXLength::CM));
len_ = GlueLength(Length(convert<double>(input), Length::CM));
}
}
@ -403,7 +403,7 @@ VSpace::vspace_kind VSpace::kind() const
}
LyXGlueLength const & VSpace::length() const
GlueLength const & VSpace::length() const
{
return len_;
}

View File

@ -12,7 +12,7 @@
#ifndef VSPACE_H
#define VSPACE_H
#include "LyXGlueLength.h"
#include "Length.h"
namespace lyx {
@ -39,9 +39,9 @@ public:
explicit VSpace(vspace_kind k);
explicit VSpace(LyXLength const & l);
explicit VSpace(Length const & l);
explicit VSpace(LyXGlueLength const & l);
explicit VSpace(GlueLength const & l);
/// Constructor for reading from a .lyx file
explicit VSpace(std::string const & data);
@ -49,7 +49,7 @@ public:
/// return the type of vertical space
vspace_kind kind() const;
/// return the length of this space
LyXGlueLength const & length() const;
GlueLength const & length() const;
// a flag that switches between \vspace and \vspace*
bool keep() const;
@ -73,7 +73,7 @@ private:
/// This VSpace kind
vspace_kind kind_;
/// the specified length
LyXGlueLength len_;
GlueLength len_;
/// if true, use \vspace* type
bool keep_;
};

View File

@ -34,7 +34,7 @@ class ButtonPolicy;
*
* Many widgets can be grouped together in the derived class if they
* make a logical whole. E.g., an input and a choice widget that together
* are used to set a LyXLength can be interrogated together.
* are used to set a Length can be interrogated together.
*/
class CheckedWidget {
public:

View File

@ -18,7 +18,7 @@
#include "debug.h"
#include "gettext.h"
#include "Language.h"
#include "LyXLength.h"
#include "Length.h"
#include <boost/regex.hpp>

View File

@ -27,9 +27,9 @@ LengthCombo::LengthCombo(QWidget * parent)
}
lyx::LyXLength::UNIT LengthCombo::currentLengthItem() const
lyx::Length::UNIT LengthCombo::currentLengthItem() const
{
return static_cast<lyx::LyXLength::UNIT>(currentIndex());
return static_cast<lyx::Length::UNIT>(currentIndex());
}
@ -40,7 +40,7 @@ void LengthCombo::has_activated(int)
}
void LengthCombo::setCurrentItem(lyx::LyXLength::UNIT unit)
void LengthCombo::setCurrentItem(lyx::Length::UNIT unit)
{
QComboBox::setCurrentIndex(int(unit));
}

View File

@ -20,7 +20,7 @@
//namespace lyx {
/**
* A combo box for selecting LyXLength::UNIT types.
* A combo box for selecting Length::UNIT types.
*/
class LengthCombo : public QComboBox {
Q_OBJECT
@ -29,11 +29,11 @@ public:
LengthCombo(QWidget * parent);
/// set the current item from unit
virtual void setCurrentItem(lyx::LyXLength::UNIT unit);
virtual void setCurrentItem(lyx::Length::UNIT unit);
/// set the current item from int
virtual void setCurrentItem(int item);
/// get the current item
lyx::LyXLength::UNIT currentLengthItem() const;
lyx::Length::UNIT currentLengthItem() const;
/// enable the widget
virtual void setEnabled(bool b);
/// use the %-items?
@ -43,7 +43,7 @@ protected Q_SLOTS:
virtual void has_activated(int index);
Q_SIGNALS:
/// the current selection has changed
void selectionChanged(lyx::LyXLength::UNIT unit);
void selectionChanged(lyx::Length::UNIT unit);
};

View File

@ -60,13 +60,13 @@ QBoxDialog::QBoxDialog(QBox * form)
connect(widthED, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(widthUnitsLC, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
connect(widthUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(change_adaptor()));
connect(valignCO, SIGNAL(highlighted(const QString &)),
this, SLOT(change_adaptor()));
connect(heightED, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(heightUnitsLC, SIGNAL(selectionChanged(lyx::LyXLength::UNIT) ),
connect(heightUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT) ),
this, SLOT(change_adaptor()));
connect(restorePB, SIGNAL(clicked()), this, SLOT(restoreClicked()));
connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
@ -127,7 +127,7 @@ void QBoxDialog::restoreClicked()
{
form_->setInnerType(true, 2);
widthED->setText("100");
widthUnitsLC->setCurrentItem(LyXLength::PCW);
widthUnitsLC->setCurrentItem(Length::PCW);
heightED->setText("1");
for (int j = 0; j < heightUnitsLC->count(); j++) {
if (heightUnitsLC->itemText(j) == qt_("Total Height"))
@ -217,8 +217,8 @@ void QBox::update_contents()
dialog_->halignCO->setEnabled(!ibox);
setSpecial(ibox);
LyXLength::UNIT default_unit =
(lyxrc.default_papersize > 3) ? LyXLength::CM : LyXLength::IN;
Length::UNIT default_unit =
(lyxrc.default_papersize > 3) ? Length::CM : Length::IN;
lengthToWidgets(dialog_->widthED, dialog_->widthUnitsLC,
(controller().params().width).asString(), default_unit);
@ -308,7 +308,7 @@ void QBox::apply()
} else
width = widgetsToLength(dialog_->widthED, dialog_->widthUnitsLC);
controller().params().width = LyXLength(width);
controller().params().width = Length(width);
i = 0;
spec = false;
@ -342,7 +342,7 @@ void QBox::apply()
} else
height = widgetsToLength(dialog_->heightED, dialog_->heightUnitsLC);
controller().params().height = LyXLength(height);
controller().params().height = Length(height);
}

View File

@ -963,14 +963,14 @@ void QDocumentDialog::updateParams(BufferParams const & params)
{
// set the default unit
// FIXME: move to controller
LyXLength::UNIT defaultUnit = LyXLength::CM;
Length::UNIT defaultUnit = Length::CM;
switch (lyxrc.default_papersize) {
case PAPER_DEFAULT: break;
case PAPER_USLETTER:
case PAPER_USLEGAL:
case PAPER_USEXECUTIVE:
defaultUnit = LyXLength::IN;
defaultUnit = Length::IN;
break;
case PAPER_A3:
@ -979,7 +979,7 @@ void QDocumentDialog::updateParams(BufferParams const & params)
case PAPER_B3:
case PAPER_B4:
case PAPER_B5:
defaultUnit = LyXLength::CM;
defaultUnit = Length::CM;
break;
case PAPER_CUSTOM:
break;

View File

@ -95,7 +95,7 @@ QExternalDialog::QExternalDialog(QExternal * form)
this, SLOT(formatChanged(const QString&)));
connect(widthUnitCO, SIGNAL(activated(int)),
this, SLOT(widthUnitChanged()));
connect(heightUnitCO, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
connect(heightUnitCO, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(change_adaptor()));
connect(displayCB, SIGNAL(stateChanged(int)),
this, SLOT(change_adaptor()));
@ -155,7 +155,7 @@ bool QExternalDialog::activateAspectratio() const
bool const wIsDbl = isStrDbl(wstr);
if (wIsDbl && float_equal(convert<double>(wstr), 0.0, 0.05))
return false;
LyXLength l;
Length l;
if (!wIsDbl && (!isValidLength(wstr, &l) || l.zero()))
return false;
@ -269,14 +269,14 @@ void QExternalDialog::widthUnitChanged()
namespace {
LyXLength::UNIT defaultUnit()
Length::UNIT defaultUnit()
{
LyXLength::UNIT default_unit = LyXLength::CM;
Length::UNIT default_unit = Length::CM;
switch (lyxrc.default_papersize) {
case PAPER_USLETTER:
case PAPER_USLEGAL:
case PAPER_USEXECUTIVE:
default_unit = LyXLength::IN;
default_unit = Length::IN;
break;
default:
break;
@ -394,7 +394,7 @@ void setSize(QLineEdit & widthED, QComboBox & widthUnitCO,
}
string const h = data.height.zero() ? string() : data.height.asString();
LyXLength::UNIT default_unit = data.width.zero() ?
Length::UNIT default_unit = data.width.zero() ?
defaultUnit() : data.width.unit();
lengthToWidgets(&heightED, &heightUnitCO, h, default_unit);
@ -420,24 +420,24 @@ void getSize(external::ResizeData & data,
// Subtract one, because scale is 0.
int const unit = widthUnitCO.currentIndex() - 1;
LyXLength w;
Length w;
if (isValidLength(width, &w))
data.width = w;
else if (isStrDbl(width))
data.width = LyXLength(convert<double>(width),
static_cast<LyXLength::UNIT>(unit));
data.width = Length(convert<double>(width),
static_cast<Length::UNIT>(unit));
else
data.width = LyXLength();
data.width = Length();
data.scale = string();
} else {
// scaling instead of a width
data.scale = width;
data.width = LyXLength();
data.width = Length();
}
data.height = LyXLength(widgetsToLength(&heightED, &heightUnitCO));
data.height = Length(widgetsToLength(&heightED, &heightUnitCO));
data.keepAspectRatio = aspectratioCB.isChecked();
}

View File

@ -139,12 +139,12 @@ void QGraphics::update_contents()
InsetGraphicsParams & igp = controller().params();
// set the right default unit
LyXLength::UNIT unitDefault = LyXLength::CM;
Length::UNIT unitDefault = Length::CM;
switch (lyxrc.default_papersize) {
case PAPER_USLETTER:
case PAPER_USLEGAL:
case PAPER_USEXECUTIVE:
unitDefault = LyXLength::IN;
unitDefault = Length::IN;
break;
default:
break;
@ -169,7 +169,7 @@ void QGraphics::update_contents()
controller().bbChanged = false;
} else {
// get the values from the inset
LyXLength anyLength;
Length anyLength;
string const xl(token(igp.bb, ' ', 0));
string const yl(token(igp.bb, ' ', 1));
string const xr(token(igp.bb, ' ', 2));
@ -347,19 +347,19 @@ void QGraphics::apply()
//the graphics section
if (dialog_->scaleCB->isChecked() && !dialog_->Scale->text().isEmpty()) {
igp.scale = fromqstr(dialog_->Scale->text());
igp.width = LyXLength("0pt");
igp.height = LyXLength("0pt");
igp.width = Length("0pt");
igp.height = Length("0pt");
igp.keepAspectRatio = false;
} else {
igp.scale = string();
igp.width = dialog_->WidthCB->isChecked() ?
//Note that this works even if dialog_->Width is "auto", since in
//that case we get "0pt".
LyXLength(widgetsToLength(dialog_->Width, dialog_->widthUnit)):
LyXLength("0pt");
Length(widgetsToLength(dialog_->Width, dialog_->widthUnit)):
Length("0pt");
igp.height = dialog_->HeightCB->isChecked() ?
LyXLength(widgetsToLength(dialog_->Height, dialog_->heightUnit)) :
LyXLength("0pt");
Length(widgetsToLength(dialog_->Height, dialog_->heightUnit)) :
Length("0pt");
igp.keepAspectRatio = dialog_->aspectratio->isEnabled() &&
dialog_->aspectratio->isChecked() &&
igp.width.value() > 0 && igp.height.value() > 0;

View File

@ -63,9 +63,9 @@ QGraphicsDialog::QGraphicsDialog(QGraphics * form)
this, SLOT(change_adaptor()));
connect(Height, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(heightUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
connect(heightUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(change_adaptor()));
connect(widthUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
connect(widthUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(change_adaptor()));
connect(aspectratio, SIGNAL(stateChanged(int)),
this, SLOT(change_adaptor()));

View File

@ -56,17 +56,17 @@ QTabularDialog::QTabularDialog(QTabular * form)
connect(topspaceED, SIGNAL(returnPressed()),
this, SLOT(topspace_changed()));
connect(topspaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
connect(topspaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(topspace_changed()));
connect(topspaceCO, SIGNAL(activated(int)), this, SLOT(topspace_changed()));
connect(bottomspaceED, SIGNAL(returnPressed()),
this, SLOT(bottomspace_changed()));
connect(bottomspaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
connect(bottomspaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(bottomspace_changed()));
connect(bottomspaceCO, SIGNAL(activated(int)), this, SLOT(bottomspace_changed()));
connect(interlinespaceED, SIGNAL(returnPressed()),
this, SLOT(interlinespace_changed()));
connect(interlinespaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
connect(interlinespaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(interlinespace_changed()));
connect(interlinespaceCO, SIGNAL(activated(int)), this, SLOT(interlinespace_changed()));
connect(booktabsRB, SIGNAL(clicked(bool)), this, SLOT(booktabsChanged(bool)));
@ -95,7 +95,7 @@ QTabularDialog::QTabularDialog(QTabular * form)
connect(lastfooterNoContentsCB, SIGNAL(clicked()), this, SLOT(ltLastFooterEmpty_clicked()));
connect(specialAlignmentED, SIGNAL(returnPressed()), this, SLOT(specialAlignment_changed()));
connect(widthED, SIGNAL(returnPressed()), this, SLOT(width_changed()));
connect(widthUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), this, SLOT(width_changed()));
connect(widthUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)), this, SLOT(width_changed()));
connect(closePB, SIGNAL(clicked()), this, SLOT(close_clicked()));
connect(borders, SIGNAL(topSet(bool)), this, SLOT(topBorder_changed()));
connect(borders, SIGNAL(bottomSet(bool)), this, SLOT(bottomBorder_changed()));
@ -653,7 +653,7 @@ void QTabular::update_contents()
update_borders();
LyXLength pwidth;
Length pwidth;
docstring special;
if (multicol) {
@ -669,7 +669,7 @@ void QTabular::update_contents()
bool const isReadonly = bc().bp().isReadOnly();
dialog_->specialAlignmentED->setEnabled(!isReadonly);
LyXLength::UNIT default_unit = controller().useMetricUnits() ? LyXLength::CM : LyXLength::IN;
Length::UNIT default_unit = controller().useMetricUnits() ? Length::CM : Length::IN;
dialog_->borderDefaultRB->setChecked(!tabular.useBookTabs());
dialog_->booktabsRB->setChecked(tabular.useBookTabs());
@ -896,8 +896,8 @@ void QTabular::closeGUI()
string width = widgetsToLength(dialog_->widthED, dialog_->widthUnit);
string width2;
LyXLength llen = tabular.getColumnPWidth(cell);
LyXLength llenMulti = tabular.getMColumnPWidth(cell);
Length llen = tabular.getColumnPWidth(cell);
Length llenMulti = tabular.getMColumnPWidth(cell);
if (multicol && !llenMulti.zero())
width2 = llenMulti.asString();

View File

@ -69,7 +69,7 @@ QVSpaceDialog::QVSpaceDialog(QVSpace * form)
this, SLOT(enableCustom(int)));
connect(keepCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
connect(unitCO, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
connect(unitCO, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(change_adaptor()));
valueLE->setValidator(unsignedLengthValidator(valueLE));
@ -133,8 +133,8 @@ static void setWidgetsFromVSpace(VSpace const & space,
spacing->setCurrentIndex(item);
keep->setChecked(space.keep());
LyXLength::UNIT default_unit =
(lyxrc.default_papersize > 3) ? LyXLength::CM : LyXLength::IN;
Length::UNIT default_unit =
(lyxrc.default_papersize > 3) ? Length::CM : Length::IN;
bool const custom_vspace = space.kind() == VSpace::LENGTH;
if (custom_vspace) {
value->setEnabled(true);
@ -173,7 +173,7 @@ static VSpace setVSpaceFromWidgets(int spacing,
space = VSpace(VSpace::VFILL);
break;
case 5:
space = VSpace(LyXGlueLength(widgetsToLength(value, unit)));
space = VSpace(GlueLength(widgetsToLength(value, unit)));
break;
}

View File

@ -52,7 +52,7 @@ QWrapDialog::QWrapDialog(QWrap * form)
connect(widthED, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(unitsLC, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
connect(unitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(change_adaptor()));
connect(valignCO, SIGNAL(highlighted(const QString &)),
this, SLOT(change_adaptor()));
@ -103,13 +103,13 @@ void QWrap::build_dialog()
void QWrap::apply()
{
double const value = convert<double>(fromqstr(dialog_->widthED->text()));
LyXLength::UNIT unit = dialog_->unitsLC->currentLengthItem();
Length::UNIT unit = dialog_->unitsLC->currentLengthItem();
if (dialog_->widthED->text().isEmpty())
unit = LyXLength::UNIT_NONE;
unit = Length::UNIT_NONE;
InsetWrapParams & params = controller().params();
params.width = LyXLength(value, unit);
params.width = Length(value, unit);
switch (dialog_->valignCO->currentIndex()) {
case 0:
@ -144,7 +144,7 @@ void QWrap::update_contents()
{
InsetWrapParams & params = controller().params();
LyXLength len(params.width);
Length len(params.width);
dialog_->widthED->setText(toqstr(numtostr(len.value())));
dialog_->unitsLC->setCurrentItem(len.unit());

View File

@ -50,12 +50,12 @@ QValidator::State LengthValidator::validate(QString & qtext, int &) const
return QValidator::Acceptable;
if (glue_length_) {
LyXGlueLength gl;
GlueLength gl;
return (isValidGlueLength(text, &gl)) ?
QValidator::Acceptable : QValidator::Intermediate;
}
LyXLength l;
Length l;
bool const valid_length = isValidLength(text, &l);
if (!valid_length)
return QValidator::Intermediate;
@ -68,14 +68,14 @@ QValidator::State LengthValidator::validate(QString & qtext, int &) const
}
void LengthValidator::setBottom(LyXLength const & b)
void LengthValidator::setBottom(Length const & b)
{
b_ = b;
no_bottom_ = false;
}
void LengthValidator::setBottom(LyXGlueLength const & g)
void LengthValidator::setBottom(GlueLength const & g)
{
g_ = g;
no_bottom_ = false;
@ -86,7 +86,7 @@ void LengthValidator::setBottom(LyXGlueLength const & g)
LengthValidator * unsignedLengthValidator(QLineEdit * ed)
{
LengthValidator * v = new LengthValidator(ed);
v->setBottom(LyXLength());
v->setBottom(Length());
return v;
}
@ -108,7 +108,7 @@ QValidator::State LengthAutoValidator::validate(QString & qtext, int & dummy) co
LengthAutoValidator * unsignedLengthAutoValidator(QLineEdit * ed)
{
LengthAutoValidator * v = new LengthAutoValidator(ed);
v->setBottom(LyXLength());
v->setBottom(Length());
return v;
}

View File

@ -25,8 +25,7 @@
#ifndef VALIDATOR_H
#define VALIDATOR_H
#include "LyXLength.h"
#include "LyXGlueLength.h"
#include "Length.h"
#include <QValidator>
@ -37,7 +36,7 @@ class QLineEdit;
namespace lyx {
/** A class to ascertain whether the data passed to the @c validate()
* member function can be interpretted as a LyXGlueLength.
* member function can be interpretted as a GlueLength.
*/
class LengthValidator : public QValidator
{
@ -46,18 +45,18 @@ public:
/// Define a validator for widget @c parent.
LengthValidator(QWidget * parent);
/** @returns QValidator::Acceptable if @c data is a LyXGlueLength.
/** @returns QValidator::Acceptable if @c data is a GlueLength.
* If not, returns QValidator::Intermediate.
*/
QValidator::State validate(QString & data, int &) const;
/** @name Bottom
* Set and retrieve the minimum allowed LyXLength value.
* Set and retrieve the minimum allowed Length value.
*/
//@{
void setBottom(LyXLength const &);
void setBottom(LyXGlueLength const &);
LyXLength bottom() const { return b_; }
void setBottom(Length const &);
void setBottom(GlueLength const &);
Length bottom() const { return b_; }
//@}
private:
@ -66,8 +65,8 @@ private:
LengthValidator& operator=( const LengthValidator & );
#endif
LyXLength b_;
LyXGlueLength g_;
Length b_;
GlueLength g_;
bool no_bottom_;
bool glue_length_;
};
@ -81,7 +80,7 @@ LengthValidator * unsignedLengthValidator(QLineEdit *);
//hard-coding it as "auto". But see qt_helpers.h for reasons this
//is not so trivial and an idea about how to do it. (RGH)
/** A class to ascertain whether the data passed to the @c validate()
* member function can be interpretted as a LyXGlueLength or is "auto".
* member function can be interpretted as a GlueLength or is "auto".
*/
class LengthAutoValidator : public LengthValidator
{
@ -90,7 +89,7 @@ class LengthAutoValidator : public LengthValidator
/// Define a validator for widget @c parent.
LengthAutoValidator(QWidget * parent);
/** @returns QValidator::Acceptable if @c data is a LyXGlueLength
/** @returns QValidator::Acceptable if @c data is a GlueLength
* or is "auto". If not, returns QValidator::Intermediate.
*/
QValidator::State validate(QString & data, int &) const;

View File

@ -71,38 +71,38 @@ string widgetsToLength(QLineEdit const * input, LengthCombo const * combo)
if (isValidGlueLength(fromqstr(length)))
return fromqstr(length);
LyXLength::UNIT const unit = combo->currentLengthItem();
Length::UNIT const unit = combo->currentLengthItem();
return LyXLength(length.toDouble(), unit).asString();
return Length(length.toDouble(), unit).asString();
}
LyXLength widgetsToLength(QLineEdit const * input, QComboBox const * combo)
Length widgetsToLength(QLineEdit const * input, QComboBox const * combo)
{
QString const length = input->text();
if (length.isEmpty())
return LyXLength();
return Length();
// don't return unit-from-choice if the input(field) contains a unit
if (isValidGlueLength(fromqstr(length)))
return LyXLength(fromqstr(length));
return Length(fromqstr(length));
LyXLength::UNIT const unit = unitFromString(fromqstr(combo->currentText()));
Length::UNIT const unit = unitFromString(fromqstr(combo->currentText()));
return LyXLength(length.toDouble(), unit);
return Length(length.toDouble(), unit);
}
void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
LyXLength const & len, LyXLength::UNIT defaultUnit)
Length const & len, Length::UNIT defaultUnit)
{
combo->setCurrentItem(LyXLength(len).unit());
input->setText(toqstr(convert<string>(LyXLength(len).value())));
combo->setCurrentItem(Length(len).unit());
input->setText(toqstr(convert<string>(Length(len).value())));
}
void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
string const & len, LyXLength::UNIT defaultUnit)
string const & len, Length::UNIT defaultUnit)
{
if (len.empty()) {
// no length (UNIT_NONE)
@ -113,13 +113,13 @@ void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
combo->setCurrentItem(defaultUnit);
input->setText(toqstr(len));
} else {
lengthToWidgets(input, combo, LyXLength(len), defaultUnit);
lengthToWidgets(input, combo, Length(len), defaultUnit);
}
}
void lengthAutoToWidgets(QLineEdit * input, LengthCombo * combo,
LyXLength const & len, LyXLength::UNIT defaultUnit)
Length const & len, Length::UNIT defaultUnit)
{
if (len.value() == 0)
lengthToWidgets(input, combo, "auto", defaultUnit);

View File

@ -13,7 +13,7 @@
#ifndef QTHELPERS_H
#define QTHELPERS_H
#include "LyXLength.h"
#include "Length.h"
#include "support/docstring.h"
#include "support/qstring_helpers.h"
@ -32,21 +32,21 @@ std::string makeFontName(std::string const & family, std::string const & foundry
std::pair<std::string,std::string> parseFontName(std::string const & name);
/// method to get a LyXLength from widgets (LengthCombo)
/// method to get a Length from widgets (LengthCombo)
std::string widgetsToLength(QLineEdit const * input, LengthCombo const * combo);
/// method to get a LyXLength from widgets (QComboBox)
LyXLength widgetsToLength(QLineEdit const * input, QComboBox const * combo);
/// method to get a Length from widgets (QComboBox)
Length widgetsToLength(QLineEdit const * input, QComboBox const * combo);
//FIXME It would be nice if defaultUnit were a default argument
/// method to set widgets from a LyXLength
/// method to set widgets from a Length
void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
LyXLength const & len, LyXLength::UNIT default_unit);
Length const & len, Length::UNIT default_unit);
/// method to set widgets from a string
void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
std::string const & len, LyXLength::UNIT default_unit);
/// method to set widgets from a LyXLength with optional "auto" if zero
std::string const & len, Length::UNIT default_unit);
/// method to set widgets from a Length with optional "auto" if zero
void lengthAutoToWidgets(QLineEdit * input, LengthCombo * combo,
LyXLength const & len, LyXLength::UNIT defaultUnit);
Length const & len, Length::UNIT defaultUnit);
//FIXME setAutoTextCB should really take an argument, as indicated, that
//determines what text is to be written for "auto". But making

View File

@ -12,7 +12,7 @@
#include "GraphicsParams.h"
#include "LyXLength.h"
#include "Length.h"
#include <sstream>
@ -71,10 +71,10 @@ BoundingBox::BoundingBox(string const & bb)
// inBP returns the length in Postscript points.
// Note further that there are 72 Postscript pixels per inch.
unsigned int const xl_tmp = abs(LyXLength(a).inBP());
unsigned int const yb_tmp = abs(LyXLength(b).inBP());
unsigned int const xr_tmp = abs(LyXLength(c).inBP());
unsigned int const yt_tmp = abs(LyXLength(d).inBP());
unsigned int const xl_tmp = abs(Length(a).inBP());
unsigned int const yb_tmp = abs(Length(b).inBP());
unsigned int const xr_tmp = abs(Length(c).inBP());
unsigned int const yt_tmp = abs(Length(d).inBP());
if (xr_tmp <= xl_tmp || yt_tmp <= yb_tmp)
return;

View File

@ -12,7 +12,7 @@
#ifndef EXTERNALTRANSFORMS_H
#define EXTERNALTRANSFORMS_H
#include "LyXLength.h"
#include "Length.h"
#include "graphics/GraphicsParams.h"
@ -63,8 +63,8 @@ public:
bool usingScale() const;
std::string scale;
LyXLength width;
LyXLength height;
Length width;
Length height;
bool keepAspectRatio;
};

View File

@ -508,12 +508,12 @@ InsetBoxParams::InsetBoxParams(string const & label)
: type(label),
use_parbox(false),
inner_box(true),
width(LyXLength("100col%")),
width(Length("100col%")),
special("none"),
pos('t'),
hor_pos('c'),
inner_pos('t'),
height(LyXLength("1in")),
height(Length("1in")),
height_special("totalheight") // default is 1\\totalheight
{}
@ -614,7 +614,7 @@ void InsetBoxParams::read(Lexer & lex)
return;
if (token == "width") {
lex.next();
width = LyXLength(lex.getString());
width = Length(lex.getString());
} else {
lyxerr << "InsetBox::Read: Missing 'width'-tag!" << endl;
lex.pushToken(token);
@ -638,7 +638,7 @@ void InsetBoxParams::read(Lexer & lex)
return;
if (token == "height") {
lex.next();
height = LyXLength(lex.getString());
height = Length(lex.getString());
} else {
lyxerr << "InsetBox::Read: Missing 'height'-tag!" << endl;
lex.pushToken(token);

View File

@ -14,7 +14,7 @@
#define INSETBOX_H
#include "InsetCollapsable.h"
#include "LyXLength.h"
#include "Length.h"
#include "MailInset.h"
@ -36,7 +36,7 @@ public:
/// columnwidth?
bool inner_box;
///
LyXLength width;
Length width;
/// "special" widths, see usrguide.dvi §3.5
std::string special;
///
@ -46,7 +46,7 @@ public:
///
char inner_pos;
///
LyXLength height;
Length height;
///
std::string height_special;
};

View File

@ -337,7 +337,7 @@ bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex)
case EX_HEIGHT:
lex.next();
resizedata.height = LyXLength(lex.getString());
resizedata.height = Length(lex.getString());
break;
case EX_KEEPASPECTRATIO:
@ -361,7 +361,7 @@ bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex)
case EX_WIDTH:
lex.next();
resizedata.width = LyXLength(lex.getString());
resizedata.width = Length(lex.getString());
break;
case EX_END:

View File

@ -64,7 +64,7 @@ TODO
#include "FuncStatus.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
#include "LyXLength.h"
#include "Length.h"
#include "Lexer.h"
#include "MetricsInfo.h"
#include "Mover.h"
@ -350,53 +350,53 @@ string const InsetGraphics::createLatexOptions() const
}
docstring const InsetGraphics::toDocbookLength(LyXLength const & len) const
docstring const InsetGraphics::toDocbookLength(Length const & len) const
{
odocstringstream result;
switch (len.unit()) {
case LyXLength::SP: // Scaled point (65536sp = 1pt) TeX's smallest unit.
case Length::SP: // Scaled point (65536sp = 1pt) TeX's smallest unit.
result << len.value() * 65536.0 * 72 / 72.27 << "pt";
break;
case LyXLength::PT: // Point = 1/72.27in = 0.351mm
case Length::PT: // Point = 1/72.27in = 0.351mm
result << len.value() * 72 / 72.27 << "pt";
break;
case LyXLength::BP: // Big point (72bp = 1in), also PostScript point
case Length::BP: // Big point (72bp = 1in), also PostScript point
result << len.value() << "pt";
break;
case LyXLength::DD: // Didot point = 1/72 of a French inch, = 0.376mm
case Length::DD: // Didot point = 1/72 of a French inch, = 0.376mm
result << len.value() * 0.376 << "mm";
break;
case LyXLength::MM: // Millimeter = 2.845pt
case Length::MM: // Millimeter = 2.845pt
result << len.value() << "mm";
break;
case LyXLength::PC: // Pica = 12pt = 4.218mm
case Length::PC: // Pica = 12pt = 4.218mm
result << len.value() << "pc";
break;
case LyXLength::CC: // Cicero = 12dd = 4.531mm
case Length::CC: // Cicero = 12dd = 4.531mm
result << len.value() * 4.531 << "mm";
break;
case LyXLength::CM: // Centimeter = 10mm = 2.371pc
case Length::CM: // Centimeter = 10mm = 2.371pc
result << len.value() << "cm";
break;
case LyXLength::IN: // Inch = 25.4mm = 72.27pt = 6.022pc
case Length::IN: // Inch = 25.4mm = 72.27pt = 6.022pc
result << len.value() << "in";
break;
case LyXLength::EX: // Height of a small "x" for the current font.
case Length::EX: // Height of a small "x" for the current font.
// Obviously we have to compromise here. Any better ratio than 1.5 ?
result << len.value() / 1.5 << "em";
break;
case LyXLength::EM: // Width of capital "M" in current font.
case Length::EM: // Width of capital "M" in current font.
result << len.value() << "em";
break;
case LyXLength::MU: // Math unit (18mu = 1em) for positioning in math mode
case Length::MU: // Math unit (18mu = 1em) for positioning in math mode
result << len.value() * 18 << "em";
break;
case LyXLength::PTW: // Percent of TextWidth
case LyXLength::PCW: // Percent of ColumnWidth
case LyXLength::PPW: // Percent of PageWidth
case LyXLength::PLW: // Percent of LineWidth
case LyXLength::PTH: // Percent of TextHeight
case LyXLength::PPH: // Percent of Paper
case Length::PTW: // Percent of TextWidth
case Length::PCW: // Percent of ColumnWidth
case Length::PPW: // Percent of PageWidth
case Length::PLW: // Percent of LineWidth
case Length::PTH: // Percent of TextHeight
case Length::PPH: // Percent of Paper
// Sigh, this will go wrong.
result << len.value() << "%";
break;

View File

@ -96,7 +96,7 @@ private:
/// Create the options for the latex command.
std::string const createLatexOptions() const;
/// Create length values for docbook export.
docstring const toDocbookLength(LyXLength const & len) const;
docstring const toDocbookLength(Length const & len) const;
/// Create the atributes for docbook export.
docstring const createDocBookAttributes() const;
/// Convert the file if needed, and return the location of the file.

View File

@ -69,8 +69,8 @@ void InsetGraphicsParams::init()
lyxscale = 100; // lyx scaling in percentage
display = graphics::DefaultDisplay; // display mode; see preferences
scale = string("100"); // output scaling in percentage
width = LyXLength();
height = LyXLength();
width = Length();
height = Length();
keepAspectRatio = false; // for LaTeX output
draft = false; // draft mode
noUnzip = false; // unzip files
@ -209,11 +209,11 @@ bool InsetGraphicsParams::Read(Lexer & lex, string const & token, string const &
scale = lex.getString();
} else if (token == "width") {
lex.next();
width = LyXLength(lex.getString());
width = Length(lex.getString());
scale = string();
} else if (token == "height") {
lex.next();
height = LyXLength(lex.getString());
height = Length(lex.getString());
scale = string();
} else if (token == "keepAspectRatio") {
keepAspectRatio = true;

View File

@ -15,7 +15,7 @@
#include "graphics/GraphicsTypes.h"
#include "LyXLength.h"
#include "Length.h"
#include "support/FileName.h"
namespace lyx {
@ -38,9 +38,9 @@ public:
/// Scaling for output (LaTeX)
std::string scale;
/// sizes for output (LaTeX)
LyXLength width;
Length width;
///
LyXLength height;
Length height;
/// Keep the ratio between height and width when resizing.
bool keepAspectRatio;
/// draft mode

View File

@ -235,7 +235,7 @@ string const write_attribute(string const & name, Tabular::idx_type const & i)
template <>
string const write_attribute(string const & name, LyXLength const & value)
string const write_attribute(string const & name, Length const & value)
{
// we write only the value if we really have one same reson as above.
return value.zero() ? string() : write_attribute(name, value.asString());
@ -426,19 +426,19 @@ bool getTokenValue(string const & str, char const * token, bool & flag)
}
bool getTokenValue(string const & str, char const * token, LyXLength & len)
bool getTokenValue(string const & str, char const * token, Length & len)
{
// set the lenght to be zero() as default as this it should be if not
// in the file format.
len = LyXLength();
len = Length();
string tmp;
return getTokenValue(str, token, tmp) && isValidLength(tmp, &len);
}
bool getTokenValue(string const & str, char const * token, LyXLength & len, bool & flag)
bool getTokenValue(string const & str, char const * token, Length & len, bool & flag)
{
len = LyXLength();
len = Length();
flag = false;
string tmp;
if (!getTokenValue(str, token, tmp))
@ -1105,7 +1105,7 @@ void toggleFixedWidth(Cursor & cur, InsetText * inset, bool fixedWidth)
void Tabular::setColumnPWidth(Cursor & cur, idx_type cell,
LyXLength const & width)
Length const & width)
{
col_type const j = column_of_cell(cell);
@ -1126,7 +1126,7 @@ void Tabular::setColumnPWidth(Cursor & cur, idx_type cell,
bool Tabular::setMColumnPWidth(Cursor & cur, idx_type cell,
LyXLength const & width)
Length const & width)
{
if (!isMultiColumn(cell))
return false;
@ -1216,7 +1216,7 @@ Tabular::getVAlignment(idx_type cell, bool onlycolumn) const
}
LyXLength const Tabular::getPWidth(idx_type cell) const
Length const Tabular::getPWidth(idx_type cell) const
{
if (isMultiColumn(cell))
return cellinfo_of_cell(cell).p_width;
@ -1224,17 +1224,17 @@ LyXLength const Tabular::getPWidth(idx_type cell) const
}
LyXLength const Tabular::getColumnPWidth(idx_type cell) const
Length const Tabular::getColumnPWidth(idx_type cell) const
{
return column_info[column_of_cell(cell)].p_width;
}
LyXLength const Tabular::getMColumnPWidth(idx_type cell) const
Length const Tabular::getMColumnPWidth(idx_type cell) const
{
if (isMultiColumn(cell))
return cellinfo_of_cell(cell).p_width;
return LyXLength();
return Length();
}
@ -2952,7 +2952,7 @@ bool InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
continue;
Dimension dim;
MetricsInfo m = mi;
LyXLength p_width;
Length p_width;
if (tabular.cell_info[i][j].multicolumn ==
Tabular::CELL_BEGIN_OF_MULTICOLUMN)
p_width = tabular.cellinfo_of_cell(cell).p_width;
@ -4143,7 +4143,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
switch (feature) {
case Tabular::SET_PWIDTH: {
LyXLength const len(value);
Length const len(value);
tabular.setColumnPWidth(cur, cur.idx(), len);
if (len.zero()
&& tabular.getAlignment(cur.idx(), true) == LYX_ALIGN_BLOCK)
@ -4152,7 +4152,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
}
case Tabular::SET_MPWIDTH:
tabular.setMColumnPWidth(cur, cur.idx(), LyXLength(value));
tabular.setMColumnPWidth(cur, cur.idx(), Length(value));
break;
case Tabular::SET_SPECIAL_COLUMN:
@ -4408,7 +4408,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
break;
case Tabular::SET_TOP_SPACE: {
LyXLength len;
Length len;
if (value == "default")
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
tabular.row_info[i].top_space_default = true;
@ -4426,7 +4426,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
}
case Tabular::SET_BOTTOM_SPACE: {
LyXLength len;
Length len;
if (value == "default")
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
tabular.row_info[i].bottom_space_default = true;
@ -4444,7 +4444,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
}
case Tabular::SET_INTERLINE_SPACE: {
LyXLength len;
Length len;
if (value == "default")
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
tabular.row_info[i].interline_space_default = true;

View File

@ -38,7 +38,7 @@
#include "Inset.h"
#include "MailInset.h"
#include "LyXLength.h"
#include "Length.h"
#include "InsetText.h"
@ -294,9 +294,9 @@ public:
void setVAlignment(idx_type cell, VAlignment align,
bool onlycolumn = false);
///
void setColumnPWidth(Cursor &, idx_type, LyXLength const &);
void setColumnPWidth(Cursor &, idx_type, Length const &);
///
bool setMColumnPWidth(Cursor &, idx_type, LyXLength const &);
bool setMColumnPWidth(Cursor &, idx_type, Length const &);
///
void setAlignSpecial(idx_type cell, docstring const & special,
Feature what);
@ -307,11 +307,11 @@ public:
VAlignment getVAlignment(idx_type cell,
bool onlycolumn = false) const;
///
LyXLength const getPWidth(idx_type cell) const;
Length const getPWidth(idx_type cell) const;
///
LyXLength const getColumnPWidth(idx_type cell) const;
Length const getColumnPWidth(idx_type cell) const;
///
LyXLength const getMColumnPWidth(idx_type cell) const;
Length const getMColumnPWidth(idx_type cell) const;
///
docstring const getAlignSpecial(idx_type cell, int what) const;
///
@ -489,7 +489,7 @@ public:
///
docstring align_special;
///
LyXLength p_width; // this is only set for multicolumn!!!
Length p_width; // this is only set for multicolumn!!!
///
boost::shared_ptr<InsetText> inset;
};
@ -513,15 +513,15 @@ public:
///
bool bottom_line;
/// Extra space between the top line and this row
LyXLength top_space;
Length top_space;
/// Ignore top_space if true and use the default top space
bool top_space_default;
/// Extra space between this row and the bottom line
LyXLength bottom_space;
Length bottom_space;
/// Ignore bottom_space if true and use the default bottom space
bool bottom_space_default;
/// Extra space between the bottom line and the next top line
LyXLength interline_space;
Length interline_space;
/// Ignore interline_space if true and use the default interline space
bool interline_space_default;
/// This are for longtabulars only
@ -555,7 +555,7 @@ public:
///
int width_of_column;
///
LyXLength p_width;
Length p_width;
///
docstring align_special;
};

View File

@ -53,7 +53,7 @@ InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
font.setColor(Color::collapsable);
setLabelFont(font);
params_.type = type;
params_.width = LyXLength(50, LyXLength::PCW);
params_.width = Length(50, Length::PCW);
setInsetName(from_utf8(type));
}
@ -136,7 +136,7 @@ void InsetWrapParams::read(Lexer & lex)
lex >> token;
if (token == "width") {
lex.next();
width = LyXLength(lex.getString());
width = Length(lex.getString());
} else {
lyxerr << "InsetWrap::Read:: Missing 'width'-tag!"
<< endl;

View File

@ -13,7 +13,7 @@
#define INSETWRAP_H
#include "InsetCollapsable.h"
#include "LyXLength.h"
#include "Length.h"
#include "MailInset.h"
@ -32,7 +32,7 @@ public:
///
std::string placement;
///
LyXLength width;
Length width;
};

View File

@ -39,12 +39,12 @@ char const * const unit_name_gui[] = {
N_("Text Width %"), N_("Column Width %"), N_("Page Width %"), N_("Line Width %"),
N_("Text Height %"), N_("Page Height %"), "" };
LyXLength::UNIT unitFromString(string const & data)
Length::UNIT unitFromString(string const & data)
{
int i = 0;
while (i < num_units && data != unit_name[i])
++i;
return static_cast<LyXLength::UNIT>(i);
return static_cast<Length::UNIT>(i);
}

View File

@ -15,7 +15,7 @@
#ifndef LENGTH_COMMON_H
#define LENGTH_COMMON_H
#include "LyXLength.h"
#include "Length.h"
namespace lyx {
@ -33,7 +33,7 @@ extern char const * const unit_name[];
extern char const * const unit_name_gui[];
/// return the unit given a string representation such as "cm"
LyXLength::UNIT unitFromString(std::string const & data);
Length::UNIT unitFromString(std::string const & data);

View File

@ -311,13 +311,13 @@ InsetMathGrid::row_type InsetMathGrid::row(idx_type idx) const
}
void InsetMathGrid::vcrskip(LyXLength const & crskip, row_type row)
void InsetMathGrid::vcrskip(Length const & crskip, row_type row)
{
rowinfo_[row].crskip_ = crskip;
}
LyXLength InsetMathGrid::vcrskip(row_type row) const
Length InsetMathGrid::vcrskip(row_type row) const
{
return rowinfo_[row].crskip_;
}

View File

@ -13,7 +13,7 @@
#define MATH_GRID_H
#include "InsetMathNest.h"
#include "LyXLength.h"
#include "Length.h"
namespace lyx {
@ -59,7 +59,7 @@ public:
/// how many hlines above this row?
unsigned int lines_;
/// parameter to the line break
LyXLength crskip_;
Length crskip_;
/// extra distance between lines
int skip_;
/// Is a page break allowed after this row?
@ -123,9 +123,9 @@ public:
///
char valign() const;
///
void vcrskip(LyXLength const &, row_type row);
void vcrskip(Length const &, row_type row);
///
LyXLength vcrskip(row_type row) const;
Length vcrskip(row_type row) const;
///
void resize(short int type, col_type cols);
///

View File

@ -30,7 +30,7 @@ InsetMathKern::InsetMathKern()
}
InsetMathKern::InsetMathKern(LyXLength const & w)
InsetMathKern::InsetMathKern(Length const & w)
: wid_(w)
{
dim_.asc = 0;

View File

@ -13,7 +13,7 @@
#define MATH_CHEATINSET_H
#include "InsetMath.h"
#include "LyXLength.h"
#include "Length.h"
namespace lyx {
@ -27,7 +27,7 @@ public:
///
InsetMathKern();
///
explicit InsetMathKern(LyXLength const & wid);
explicit InsetMathKern(Length const & wid);
///
explicit InsetMathKern(docstring const & wid);
///
@ -41,7 +41,7 @@ public:
private:
virtual std::auto_ptr<InsetBase> doClone() const;
/// width in em
LyXLength wid_;
Length wid_;
};

View File

@ -20,7 +20,7 @@
namespace lyx {
InsetMathXYMatrix::InsetMathXYMatrix(LyXLength const & s, char c)
InsetMathXYMatrix::InsetMathXYMatrix(Length const & s, char c)
: InsetMathGrid(1, 1), spacing_(s), spacing_code_(c)
{}

View File

@ -12,7 +12,7 @@
#ifndef MATH_XYMATRIX_H
#define MATH_XYMATRIX_H
#include "LyXLength.h"
#include "Length.h"
#include "InsetMathGrid.h"
@ -22,7 +22,7 @@ namespace lyx {
class InsetMathXYMatrix : public InsetMathGrid {
public:
///
InsetMathXYMatrix(LyXLength const & = LyXLength(), char c = '\0');
InsetMathXYMatrix(Length const & = Length(), char c = '\0');
///
bool metrics(MetricsInfo &, Dimension &) const;
///
@ -48,7 +48,7 @@ private:
///
virtual std::auto_ptr<InsetBase> doClone() const;
/// extra spacing, may be empty
LyXLength spacing_;
Length spacing_;
///
char spacing_code_;
};

View File

@ -318,7 +318,7 @@ MathAtom createInsetMath(docstring const & s)
return MathAtom(new InsetMathKern);
if (s.substr(0, 8) == "xymatrix") {
char spacing_code = '\0';
LyXLength spacing;
Length spacing;
size_t const len = s.length();
size_t i = 8;
if (i < len && s[i] == '@') {
@ -338,7 +338,7 @@ MathAtom createInsetMath(docstring const & s)
}
if (i < len && s[i] == '=') {
++i;
spacing = LyXLength(to_ascii(s.substr(i)));
spacing = Length(to_ascii(s.substr(i)));
}
}
return MathAtom(new InsetMathXYMatrix(spacing, spacing_code));

View File

@ -134,7 +134,7 @@ bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow,
return false;
}
}
grid.vcrskip(LyXLength(to_utf8(vskip)), cellrow - 1);
grid.vcrskip(Length(to_utf8(vskip)), cellrow - 1);
grid.rowinfo(cellrow - 1).allow_pagebreak_ = allow_pagebreak;
return true;
}

View File

@ -2305,18 +2305,18 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
}
if (!known_vspace) {
switch (unitFromString(unit)) {
case LyXLength::SP:
case LyXLength::PT:
case LyXLength::BP:
case LyXLength::DD:
case LyXLength::MM:
case LyXLength::PC:
case LyXLength::CC:
case LyXLength::CM:
case LyXLength::IN:
case LyXLength::EX:
case LyXLength::EM:
case LyXLength::MU:
case Length::SP:
case Length::PT:
case Length::BP:
case Length::DD:
case Length::MM:
case Length::PC:
case Length::CC:
case Length::CM:
case Length::IN:
case Length::EX:
case Length::EM:
case Length::MU:
known_unit = true;
break;
default:

View File

@ -38,7 +38,7 @@
#include "gettext.h"
#include "Language.h"
#include "Color.h"
#include "LyXLength.h"
#include "Length.h"
#include "Lexer.h"
#include "LyXRC.h"
#include "Row.h"