src/debug.C
src/exporter.C
src/ext_l10n.h
+src/figure_form.C
+src/figureForm.C
src/FontLoader.C
-src/form1.C
src/frontends/controllers/ButtonController.h
+src/frontends/controllers/character.C
src/frontends/controllers/ControlCharacter.C
src/frontends/controllers/ControlCopyright.C
src/frontends/controllers/ControlCredits.C
src/frontends/gnome/FormPrint.C
src/frontends/gnome/FormRef.C
src/frontends/gnome/FormToc.C
-src/frontends/gnome/FormUrl.C
src/frontends/gnome/Menubar_pimpl.C
src/frontends/kde/citationdlg.C
src/frontends/kde/dlg/copyrightdlgdata.C
src/layout.C
src/LColor.C
src/LyXAction.C
-src/lyx.C
src/lyx_cb.C
src/lyxfind.C
src/lyxfont.C
+2001-03-29 Juergen Vigna <jug@sad.it>
+
+ * vspace.C: added support for %, c%, p%, l%.
+ (stringFromUnit): added helper function.
+ (asLatexString): changed to give right results for the %-values.
+
+ * buffer.C: convert the widthp in a width%.
+
2001-03-28 Angus Leeming <a.leeming@ic.ac.uk>
* Makefile.am: removed form1.[Ch], lyx.[Ch] and added figure_form.[Ch],
InsetMinipage * mini = new InsetMinipage;
mini->pos(static_cast<InsetMinipage::Position>(par->params.pextraAlignment()));
mini->width(par->params.pextraWidth());
- mini->widthp(par->params.pextraWidthp());
+ if (!par->params.pextraWidthp().empty()) {
+ lyxerr << "WP:" << mini->width() << endl;
+ mini->width(tostr(par->params.pextraWidthp())+"%");
+ }
mini->inset->par = par;
// Insert the minipage last in the
// previous paragraph.
InsetMinipage * mini = new InsetMinipage;
mini->pos(static_cast<InsetMinipage::Position>(minipar->params.pextraAlignment()));
mini->width(minipar->params.pextraWidth());
- mini->widthp(minipar->params.pextraWidthp());
+ if (!par->params.pextraWidthp().empty()) {
+ lyxerr << "WP:" << mini->width() << endl;
+ mini->width(tostr(par->params.pextraWidthp())+"%");
+ }
mini->inset->par = minipar;
// Insert the minipage last in the
+2001-03-29 Juergen Vigna <jug@sad.it>
+
+ * ControlMinipage.C: removed widthp_ and all it's functions and changed
+ to use new %-lengths of LyXLength.
+
2001-03-29 Angus Leeming <a.leeming@ic.ac.uk>
* ControlCitation.C (bibkeysInfo): removed Assert.
*
* ======================================================
*
- * \author Juergen Vigna, jug@sad.it
+ * \author Jürgen Vigna, jug@sad.it
* \author Angus Leeming, a.leeming@ic.ac.uk
*/
using std::vector;
using SigC::slot;
+// sorry this is just a temporary hack we should include vspace.h! (Jug)
+extern const char * stringFromUnit(int);
+
ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
: ControlInset<InsetMinipage, MinipageParams>(lv, d)
{
void ControlMinipage::applyParamsToInset()
{
inset()->width(params().width);
- inset()->widthp(params().widthp);
inset()->pos(params().pos);
lv_.view()->updateInset(inset(), true);
MinipageParams::MinipageParams()
- : widthp(0), pos(InsetMinipage::top)
+ : pos(InsetMinipage::top)
{}
MinipageParams::MinipageParams(InsetMinipage const & inset)
- : width(inset.width()), widthp(inset.widthp()), pos(inset.pos())
+ : width(inset.width()), pos(inset.pos())
{}
bool MinipageParams::operator==(MinipageParams const & o) const
{
- return (width == o.width && widthp == o.widthp && pos == o.pos);
+ return (width == o.width && pos == o.pos);
}
bool MinipageParams::operator!=(MinipageParams const & o) const
vector<string> const getUnits()
{
vector<string> units;
- units.push_back("mm");
- units.push_back("in");
- units.push_back("em");
- units.push_back("%%");
- units.push_back("%%c");
- units.push_back("%%l");
- units.push_back("%%p");
+ const char * str;
+ for(int i=0;(str=stringFromUnit(i));++i)
+ units.push_back(str);
return units;
}
} // namespace minipage
-
///
string width;
///
- int widthp;
- ///
InsetMinipage::Position pos;
};
+2001-03-29 Juergen Vigna <jug@sad.it>
+
+ * FormMinipage.C: removed widthp_ and all it's functions and changed
+ to use new %-lengths of LyXLength.
+
2001-03-28 Angus Leeming <a.leeming@ic.ac.uk>
* FormGraphics.C:
#include "FormMinipage.h"
#include "form_minipage.h"
#include "support/lstrings.h"
+#include "helper_funcs.h"
+#include "debug.h"
typedef FormCB<ControlMinipage, FormDB<FD_form_minipage> > base_class;
dialog_.reset(build_minipage());
fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED);
- fl_set_input_return(dialog_->input_widthp, FL_RETURN_CHANGED);
+
+ string const choice = getStringFromVector(minipage::getUnits(), "|");
+ fl_addto_choice(dialog_->choice_width_units, subst(choice, "%", "%%").c_str());
// Manage the ok, apply and cancel/close buttons
bc().setOK(dialog_->button_ok);
bc().setUndoAll(dialog_->button_restore);
bc().addReadOnly(dialog_->input_width);
- bc().addReadOnly(dialog_->input_widthp);
+ bc().addReadOnly(dialog_->choice_width_units);
bc().addReadOnly(dialog_->radio_top);
bc().addReadOnly(dialog_->radio_middle);
bc().addReadOnly(dialog_->radio_bottom);
void FormMinipage::apply()
{
- controller().params().width = fl_get_input(dialog_->input_width);
- controller().params().widthp =
- strToInt(fl_get_input(dialog_->input_widthp));
+ string const units = fl_get_choice_text(dialog_->choice_width_units);
+ double const val = strToDbl(fl_get_input(dialog_->input_width));
+
+ controller().params().width =
+ tostr(val) + frontStrip(strip(subst(units,"%%","%")));
if (fl_get_button(dialog_->radio_top))
controller().params().pos = InsetMinipage::top;
void FormMinipage::update()
{
- fl_set_input(dialog_->input_width,
- controller().params().width.c_str());
- fl_set_input(dialog_->input_widthp,
- tostr(controller().params().widthp).c_str());
-
+ LyXLength len(controller().params().width.c_str());
+ fl_set_input(dialog_->input_width,tostr(len.value()).c_str());
+ fl_set_choice(dialog_->choice_width_units, len.unit()+1);
+
switch (controller().params().pos) {
case InsetMinipage::top:
fl_set_button(dialog_->radio_top, 1);
fdui->form = fl_bgn_form(FL_NO_BOX, 430, 170);
fdui->form->u_vdata = this;
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 430, 170, "");
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 20, 190, 100, "");
- fl_set_object_color(obj, FL_COL1, FL_COL1);
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 20, 20, 200, 100, "");
- fl_set_object_color(obj, FL_COL1, FL_COL1);
- {
- char const * const dummy = N_("Length|#L");
- fdui->input_width = obj = fl_add_input(FL_NORMAL_INPUT, 100, 30, 110, 30, idex(_(dummy)));
- fl_set_button_shortcut(obj, scex(_(dummy)), 1);
- }
+ obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 20, 20, 200, 60, _("Width"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- {
- // xgettext:no-c-format
- char const * const dummy = N_("or %|#o");
- fdui->input_widthp = obj = fl_add_input(FL_INT_INPUT, 100, 70, 110, 30, idex(_(dummy)));
- fl_set_button_shortcut(obj, scex(_(dummy)), 1);
- }
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- obj = fl_add_text(FL_NORMAL_TEXT, 30, 10, 100, 20, _("Width"));
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
- obj = fl_add_text(FL_NORMAL_TEXT, 240, 10, 140, 20, _("Alignment"));
+ obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 240, 20, 180, 100, _("Alignment"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
+ fdui->input_width = obj = fl_add_input(FL_NORMAL_INPUT, 30, 30, 110, 30, "");
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->choice_width_units = obj = fl_add_choice(FL_NORMAL_CHOICE2, 150, 30, 60, 30, "");
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->group_alignment = fl_bgn_group();
{
FL_FORM *form;
FL_OBJECT *input_width;
- FL_OBJECT *input_widthp;
+ FL_OBJECT *choice_width_units;
FL_OBJECT *group_alignment;
FL_OBJECT *radio_top;
FL_OBJECT *radio_middle;
Name: form_minipage
Width: 430
Height: 170
-Number of Objects: 16
+Number of Objects: 14
--------------------
class: FL_BOX
argument:
--------------------
-class: FL_FRAME
+class: FL_LABELFRAME
type: ENGRAVED_FRAME
-box: 230 20 190 100
+box: 20 20 200 60
boxtype: FL_NO_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_BOLD_STYLE
+size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: Width
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
argument:
--------------------
-class: FL_FRAME
+class: FL_LABELFRAME
type: ENGRAVED_FRAME
-box: 20 20 200 100
+box: 240 20 180 100
boxtype: FL_NO_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_BOLD_STYLE
+size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: Alignment
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 100 30 110 30
+box: 30 30 110 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Length|#L
+label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
argument: 0
--------------------
-class: FL_INPUT
-type: INT_INPUT
-box: 100 70 110 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
+class: FL_CHOICE
+type: NORMAL_CHOICE2
+box: 150 30 60 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
lcol: FL_BLACK
-label: or %|#o
+label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: input_widthp
+name: choice_width_units
callback: C_FormBaseInputCB
argument: 0
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 30 10 100 20
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Width
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 240 10 140 20
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Alignment
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
--------------------
class: FL_BEGIN_GROUP
type: 0
-box: 0 0 0 0
+box: 0 10 10 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
+2001-03-29 Juergen Vigna <jug@sad.it>
+
+ * insetminipage.C: removed widthp_ and all it's functions and changed
+ to use new %-lengths of LyXLength.
+
2001-03-28 Angus Leeming <a.leeming@ic.ac.uk>
* insets/figinset.[Ch]: changed headers lyx.h, form1.h -> figure_form.h.
}
-int UpdatableInset::getMaxWidth(Painter & pain, UpdatableInset const *) const
+int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
{
if (owner())
- return static_cast<UpdatableInset*>(owner())->getMaxWidth(pain, this);
- return pain.paperWidth();
+ return static_cast<UpdatableInset*>(owner())->getMaxWidth(bv, this);
+ return bv->workWidth();
}
}
-int InsetCollapsable::getMaxWidth(Painter & pain,
+int InsetCollapsable::getMaxWidth(BufferView * bv,
UpdatableInset const * inset) const
{
- int const w = UpdatableInset::getMaxWidth(pain, inset);
+ int const w = UpdatableInset::getMaxWidth(bv, inset);
if (w < 0) {
// What does a negative max width signify? (Lgb)
///
void setAutoCollapse(bool f) { autocollapse = f; }
///
- int getMaxWidth(Painter & pain, UpdatableInset const *) const;
+ int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
LyXText * getLyXText(BufferView const *, bool const recursive) const;
///
setLabelFont(font);
setAutoCollapse(false);
setInsetName("Minipage");
- widthp_ = 100; // set default to 100% of column_width
+ width_ = "100%"; // set default to 100% of column_width
}
<< "position " << pos_ << "\n"
<< "inner_position " << inner_pos_ << "\n"
<< "height \"" << height_ << "\"\n"
- << "width \"" << width_ << "\"\n"
- << "widthp " << widthp_ << "\n";
+ << "width \"" << width_ << "\"\n";
InsetCollapsable::Write(buf, os);
}
<< endl;
}
}
+#warning Remove me before final 1.2.0 (Jug)
+ // this is only for compatibility to the intermediate format and should
+ // vanish till the final 1.2.0!
if (lex.IsOK()) {
if (token.empty()) {
lex.next();
}
if (token == "widthp") {
lex.next();
- widthp_ = lex.GetInteger();
+ // only do this if the width_-string was not already set!
+ if (width_.empty())
+ width_ = lex.GetString() + "%";
token = string();
} else {
lyxerr << "InsetMinipage::Read: Missing 'widthp_'-tag!"
<< endl;
}
}
+ if (!token.empty())
+ lex.pushToken(token);
InsetCollapsable::Read(buf, lex);
}
result->inner_pos_ = inner_pos_;
result->height_ = height_;
result->width_ = width_;
- result->widthp_ = widthp_;
return result;
}
s_pos += "b";
break;
}
-
- if (width_.empty()) {
- os << "\\begin{minipage}[" << s_pos << "]{."
- << widthp_ << "\\columnwidth}%\n";
- } else {
- os << "\\begin{minipage}[" << s_pos << "]{"
- << width_ << "}%\n";
- }
+ os << "\\begin{minipage}[" << s_pos << "]{"
+ << LyXLength(width_).asLatexString() << "}%\n";
int i = inset->Latex(buf, os, fragile, fp);
+
os << "\\end{minipage}%\n";
-
return i + 2;
}
width_ = ll;
}
-int InsetMinipage::widthp() const
-{
- return widthp_;
-}
-
-
-void InsetMinipage::widthp(int ll)
-{
- widthp_ = ll;
-}
-
-
-void InsetMinipage::widthp(string const & ll)
-{
- widthp_ = strToInt(ll);
-}
-
bool InsetMinipage::ShowInsetDialog(BufferView * bv) const
{
}
-int InsetMinipage::getMaxWidth(Painter & pain, UpdatableInset const * inset)
+int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
const
{
if (!width_.empty())
- return VSpace(width_).inPixels(0, 0);
- return InsetCollapsable::getMaxWidth(pain, inset) / 100 * widthp_;
+ return VSpace(width_).inPixels(bv);
+ // this should not happen!
+ return InsetCollapsable::getMaxWidth(bv, inset);
}
///
void width(string const &);
///
- int widthp() const;
- ///
- void widthp(int);
- ///
- void widthp(string const &);
- ///
SigC::Signal0<void> hideDialog;
///
void InsetButtonRelease(BufferView * bv, int x, int y, int button);
///
- int getMaxWidth(Painter &, UpdatableInset const *) const;
+ int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
bool needFullRow() const { return false; }
///
string height_;
///
string width_;
- ///
- int widthp_;
};
#endif
// This returns paperWidth() if the cell-width is unlimited or the width
// in pixels if we have a pwidth for this cell.
-int InsetTabular::GetMaxWidthOfCell(Painter &, int cell) const
+int InsetTabular::GetMaxWidthOfCell(BufferView * bv, int cell) const
{
string const s = tabular->GetPWidth(cell);
if (s.empty())
return -1;
- return VSpace(s).inPixels(0, 0);
+ return VSpace(s).inPixels(bv);
}
-int InsetTabular::getMaxWidth(Painter & pain,
+int InsetTabular::getMaxWidth(BufferView * bv,
UpdatableInset const * inset) const
{
int const n = tabular->GetNumberOfCells();
}
if (cell >= n)
return -1;
- int w = GetMaxWidthOfCell(pain, cell);
+ int w = GetMaxWidthOfCell(bv, cell);
if (w > 0)
// because the inset then subtracts it's top_x and owner->x()
w += (inset->x() - top_x);
///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
///
- int getMaxWidth(Painter & pain, UpdatableInset const *) const;
+ int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
Buffer * BufferOwner() const { return const_cast<Buffer *>(buffer); }
///
///
bool InsetHit(BufferView * bv, int x, int y) const;
///
- int GetMaxWidthOfCell(Painter &, int cell) const;
+ int GetMaxWidthOfCell(BufferView * bv, int cell) const;
///
bool hasPasteBuffer() const;
///
int InsetText::width(BufferView * bv, LyXFont const &) const
{
- insetWidth = max(textWidth(bv->painter()),
+ insetWidth = max(textWidth(bv),
(int)TEXT(bv)->width + (2 * TEXT_TO_INSET_OFFSET));
return insetWidth;
}
-int InsetText::textWidth(Painter & pain) const
+int InsetText::textWidth(BufferView * bv) const
{
- int const w = getMaxWidth(pain, this);
+ int const w = getMaxWidth(bv, this);
return w;
}
// static_cast<int>(TEXT(bv)->width) + drawTextXOffset) +
// (2 * TEXT_TO_INSET_OFFSET);
#else
- insetWidth = textWidth(bv->painter());
+ insetWidth = textWidth(bv);
if (insetWidth < 0)
insetWidth = static_cast<int>(TEXT(bv)->width);
#endif
}
-int InsetText::getMaxWidth(Painter & pain, UpdatableInset const * inset) const
+int InsetText::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const
{
- int w = UpdatableInset::getMaxWidth(pain, inset);
+ int w = UpdatableInset::getMaxWidth(bv, inset);
if (w < 0) {
return w;
}
///
int width(BufferView *, LyXFont const & f) const;
///
- int textWidth(Painter &) const;
+ int textWidth(BufferView *) const;
///
void draw(BufferView *, LyXFont const &, int , float &, bool) const;
///
///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
///
- int getMaxWidth(Painter &, UpdatableInset const *) const;
+ int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
void init(InsetText const * ins = 0);
///
///
virtual bool isCursorVisible() const { return cursor_visible; }
///
- virtual int getMaxWidth(Painter & pain, UpdatableInset const *) const;
+ virtual int getMaxWidth(BufferView * bv, UpdatableInset const *) const;
///
int scroll() const { return scx; }
///
if (LeftLine(cell))
os << '|';
if (!GetPWidth(cell).empty()) {
-#warning Jürgen, are these alignments correct? (Lgb)
switch (GetVAlignment(cell)) {
case LYX_VALIGN_TOP:
os << "p";
} else if (GetUsebox(cell) == BOX_MINIPAGE) {
os << "\\begin{minipage}[";
switch (GetVAlignment(cell)) {
-#warning Jürgen, are these alignments correct? (Lgb)
case LYX_VALIGN_TOP:
os << "t";
break;
os << column_info[i].align_special;
} else if (!column_info[i].p_width.empty()) {
switch (column_info[i].valignment) {
-#warning Jürgen, are these alignments correct? (Lgb)
case LYX_VALIGN_TOP:
os << "p";
break;
int LyXText::workWidth(BufferView * bview) const
{
if (inset_owner) {
- return inset_owner->textWidth(bview->painter());
+ return inset_owner->textWidth(bview);
}
return bview->workWidth();
}
// I am not sure if "mu" should be possible to select (Lgb)
char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
"mm", "pc", "cc", "cm",
- "in", "ex", "em", "mu" };
+ "in", "ex", "em", "mu",
+ "%", "c%", "p%", "l%" };
/* The following static items form a simple scanner for
} else return 'E';
}
- i = data.find_first_not_of("abcdefghijklmnopqrstuvwxyz");
+ i = data.find_first_not_of("abcdefghijklmnopqrstuvwxyz%");
if (i != 0) {
if (unit_index > 3) return 'E';
} // namespace anon
+const char * stringFromUnit(int unit)
+{
+ if (unit < 0 || unit >= num_units)
+ return 0;
+ return unit_name[unit];
+}
+
LyXLength::UNIT unitFromString (string const & data)
{
}
+string const LyXLength::asLatexString() const
+{
+ std::ostringstream buffer;
+ switch(uni) {
+ case PW:
+ case PE:
+ buffer << "." << abs(static_cast<int>(val)) << "\\columnwidth";
+ break;
+ case PP:
+ buffer << "." << abs(static_cast<int>(val)) << "\\pagewidth";
+ break;
+ case PL:
+ buffer << "." << abs(static_cast<int>(val)) << "\\linewidth";
+ break;
+ default:
+ buffer << val << unit_name[uni]; // setw?
+ break;
+ }
+ return buffer.str().c_str();
+}
+
+
/* LyXGlueLength class
*/
// Height of a normal line in pixels (zoom factor considered)
int height = bv->text->DefaultHeight(); // [pixels]
int skip = 0;
+ int width = bv->workWidth();
+
if (kin == DEFSKIP)
skip = bv->buffer()->params.getDefSkip().inPixels(bv);
- return inPixels(height, skip);
+ return inPixels(height, skip, width);
}
-int VSpace::inPixels(int default_height, int default_skip) const
+int VSpace::inPixels(int default_height, int default_skip, int default_width) const
{
// Height of a normal line in pixels (zoom factor considered)
int height = default_height; // [pixels]
// math mode
result = zoom * value * height;
break;
+ case LyXLength::PW: // Always % of workarea
+ case LyXLength::PE:
+ case LyXLength::PP:
+ case LyXLength::PL:
+ result = value * default_width / 100;
+ break;
case LyXLength::UNIT_NONE:
result = 0; // this cannot happen
break;
EM,
/// Math unit (18mu = 1em) for positioning in math mode
MU,
+ /// Percent of columnwidth both "%" or "%c"
+ PW,
+ PE,
+ /// Percent of pagewidth
+ PP,
+ /// Percent of linewidth
+ PL,
/// no unit
UNIT_NONE
};
/// conversion
virtual string const asString() const;
///
- virtual string const asLatexString() const {
- return this->asString();
- }
+ virtual string const asLatexString() const;
/** If "data" is valid, the length represented by it is
stored into "result", if that is not 0. */
extern LyXLength::UNIT unitFromString (string const & data);
///
extern bool isValidLength(string const & data, LyXLength * result);
+///
+extern const char * stringFromUnit(int unit);
/// LyXGlueLength class
class LyXGlueLength : public LyXLength {
///
int inPixels(BufferView * bv) const;
///
- int inPixels(int default_height, int default_skip) const;
+ int inPixels(int default_height, int default_skip, int default_width=0) const;
private:
/// This VSpace kind
vspace_kind kin;