mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Added %x support in vspace.C (LyXLenght) and use it for the minipages.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1853 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a266390f64
commit
f284f1c8bc
@ -10,9 +10,11 @@ src/CutAndPaste.C
|
|||||||
src/debug.C
|
src/debug.C
|
||||||
src/exporter.C
|
src/exporter.C
|
||||||
src/ext_l10n.h
|
src/ext_l10n.h
|
||||||
|
src/figure_form.C
|
||||||
|
src/figureForm.C
|
||||||
src/FontLoader.C
|
src/FontLoader.C
|
||||||
src/form1.C
|
|
||||||
src/frontends/controllers/ButtonController.h
|
src/frontends/controllers/ButtonController.h
|
||||||
|
src/frontends/controllers/character.C
|
||||||
src/frontends/controllers/ControlCharacter.C
|
src/frontends/controllers/ControlCharacter.C
|
||||||
src/frontends/controllers/ControlCopyright.C
|
src/frontends/controllers/ControlCopyright.C
|
||||||
src/frontends/controllers/ControlCredits.C
|
src/frontends/controllers/ControlCredits.C
|
||||||
@ -26,7 +28,6 @@ src/frontends/gnome/FormIndex.C
|
|||||||
src/frontends/gnome/FormPrint.C
|
src/frontends/gnome/FormPrint.C
|
||||||
src/frontends/gnome/FormRef.C
|
src/frontends/gnome/FormRef.C
|
||||||
src/frontends/gnome/FormToc.C
|
src/frontends/gnome/FormToc.C
|
||||||
src/frontends/gnome/FormUrl.C
|
|
||||||
src/frontends/gnome/Menubar_pimpl.C
|
src/frontends/gnome/Menubar_pimpl.C
|
||||||
src/frontends/kde/citationdlg.C
|
src/frontends/kde/citationdlg.C
|
||||||
src/frontends/kde/dlg/copyrightdlgdata.C
|
src/frontends/kde/dlg/copyrightdlgdata.C
|
||||||
@ -181,7 +182,6 @@ src/LaTeX.C
|
|||||||
src/layout.C
|
src/layout.C
|
||||||
src/LColor.C
|
src/LColor.C
|
||||||
src/LyXAction.C
|
src/LyXAction.C
|
||||||
src/lyx.C
|
|
||||||
src/lyx_cb.C
|
src/lyx_cb.C
|
||||||
src/lyxfind.C
|
src/lyxfind.C
|
||||||
src/lyxfont.C
|
src/lyxfont.C
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
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>
|
2001-03-28 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* Makefile.am: removed form1.[Ch], lyx.[Ch] and added figure_form.[Ch],
|
* Makefile.am: removed form1.[Ch], lyx.[Ch] and added figure_form.[Ch],
|
||||||
|
10
src/buffer.C
10
src/buffer.C
@ -1153,7 +1153,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
|||||||
InsetMinipage * mini = new InsetMinipage;
|
InsetMinipage * mini = new InsetMinipage;
|
||||||
mini->pos(static_cast<InsetMinipage::Position>(par->params.pextraAlignment()));
|
mini->pos(static_cast<InsetMinipage::Position>(par->params.pextraAlignment()));
|
||||||
mini->width(par->params.pextraWidth());
|
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;
|
mini->inset->par = par;
|
||||||
// Insert the minipage last in the
|
// Insert the minipage last in the
|
||||||
// previous paragraph.
|
// previous paragraph.
|
||||||
@ -1220,7 +1223,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
|||||||
InsetMinipage * mini = new InsetMinipage;
|
InsetMinipage * mini = new InsetMinipage;
|
||||||
mini->pos(static_cast<InsetMinipage::Position>(minipar->params.pextraAlignment()));
|
mini->pos(static_cast<InsetMinipage::Position>(minipar->params.pextraAlignment()));
|
||||||
mini->width(minipar->params.pextraWidth());
|
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;
|
mini->inset->par = minipar;
|
||||||
|
|
||||||
// Insert the minipage last in the
|
// Insert the minipage last in the
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2001-03-29 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* ControlCitation.C (bibkeysInfo): removed Assert.
|
* ControlCitation.C (bibkeysInfo): removed Assert.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* \author Juergen Vigna, jug@sad.it
|
* \author Jürgen Vigna, jug@sad.it
|
||||||
* \author Angus Leeming, a.leeming@ic.ac.uk
|
* \author Angus Leeming, a.leeming@ic.ac.uk
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -25,6 +25,9 @@
|
|||||||
using std::vector;
|
using std::vector;
|
||||||
using SigC::slot;
|
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)
|
ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
|
||||||
: ControlInset<InsetMinipage, MinipageParams>(lv, d)
|
: ControlInset<InsetMinipage, MinipageParams>(lv, d)
|
||||||
{
|
{
|
||||||
@ -40,7 +43,6 @@ ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
|
|||||||
void ControlMinipage::applyParamsToInset()
|
void ControlMinipage::applyParamsToInset()
|
||||||
{
|
{
|
||||||
inset()->width(params().width);
|
inset()->width(params().width);
|
||||||
inset()->widthp(params().widthp);
|
|
||||||
inset()->pos(params().pos);
|
inset()->pos(params().pos);
|
||||||
|
|
||||||
lv_.view()->updateInset(inset(), true);
|
lv_.view()->updateInset(inset(), true);
|
||||||
@ -59,16 +61,16 @@ MinipageParams const ControlMinipage::getParams(InsetMinipage const & inset)
|
|||||||
|
|
||||||
|
|
||||||
MinipageParams::MinipageParams()
|
MinipageParams::MinipageParams()
|
||||||
: widthp(0), pos(InsetMinipage::top)
|
: pos(InsetMinipage::top)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
MinipageParams::MinipageParams(InsetMinipage const & inset)
|
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
|
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
|
bool MinipageParams::operator!=(MinipageParams const & o) const
|
||||||
@ -81,16 +83,11 @@ namespace minipage {
|
|||||||
vector<string> const getUnits()
|
vector<string> const getUnits()
|
||||||
{
|
{
|
||||||
vector<string> units;
|
vector<string> units;
|
||||||
units.push_back("mm");
|
const char * str;
|
||||||
units.push_back("in");
|
for(int i=0;(str=stringFromUnit(i));++i)
|
||||||
units.push_back("em");
|
units.push_back(str);
|
||||||
units.push_back("%%");
|
|
||||||
units.push_back("%%c");
|
|
||||||
units.push_back("%%l");
|
|
||||||
units.push_back("%%p");
|
|
||||||
|
|
||||||
return units;
|
return units;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace minipage
|
} // namespace minipage
|
||||||
|
|
||||||
|
@ -40,8 +40,6 @@ struct MinipageParams {
|
|||||||
///
|
///
|
||||||
string width;
|
string width;
|
||||||
///
|
///
|
||||||
int widthp;
|
|
||||||
///
|
|
||||||
InsetMinipage::Position pos;
|
InsetMinipage::Position pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2001-03-28 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* FormGraphics.C:
|
* FormGraphics.C:
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include "FormMinipage.h"
|
#include "FormMinipage.h"
|
||||||
#include "form_minipage.h"
|
#include "form_minipage.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
#include "helper_funcs.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
typedef FormCB<ControlMinipage, FormDB<FD_form_minipage> > base_class;
|
typedef FormCB<ControlMinipage, FormDB<FD_form_minipage> > base_class;
|
||||||
|
|
||||||
@ -35,7 +37,9 @@ void FormMinipage::build()
|
|||||||
dialog_.reset(build_minipage());
|
dialog_.reset(build_minipage());
|
||||||
|
|
||||||
fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED);
|
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
|
// Manage the ok, apply and cancel/close buttons
|
||||||
bc().setOK(dialog_->button_ok);
|
bc().setOK(dialog_->button_ok);
|
||||||
@ -44,7 +48,7 @@ void FormMinipage::build()
|
|||||||
bc().setUndoAll(dialog_->button_restore);
|
bc().setUndoAll(dialog_->button_restore);
|
||||||
|
|
||||||
bc().addReadOnly(dialog_->input_width);
|
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_top);
|
||||||
bc().addReadOnly(dialog_->radio_middle);
|
bc().addReadOnly(dialog_->radio_middle);
|
||||||
bc().addReadOnly(dialog_->radio_bottom);
|
bc().addReadOnly(dialog_->radio_bottom);
|
||||||
@ -55,9 +59,11 @@ void FormMinipage::build()
|
|||||||
|
|
||||||
void FormMinipage::apply()
|
void FormMinipage::apply()
|
||||||
{
|
{
|
||||||
controller().params().width = fl_get_input(dialog_->input_width);
|
string const units = fl_get_choice_text(dialog_->choice_width_units);
|
||||||
controller().params().widthp =
|
double const val = strToDbl(fl_get_input(dialog_->input_width));
|
||||||
strToInt(fl_get_input(dialog_->input_widthp));
|
|
||||||
|
controller().params().width =
|
||||||
|
tostr(val) + frontStrip(strip(subst(units,"%%","%")));
|
||||||
|
|
||||||
if (fl_get_button(dialog_->radio_top))
|
if (fl_get_button(dialog_->radio_top))
|
||||||
controller().params().pos = InsetMinipage::top;
|
controller().params().pos = InsetMinipage::top;
|
||||||
@ -70,11 +76,10 @@ void FormMinipage::apply()
|
|||||||
|
|
||||||
void FormMinipage::update()
|
void FormMinipage::update()
|
||||||
{
|
{
|
||||||
fl_set_input(dialog_->input_width,
|
LyXLength len(controller().params().width.c_str());
|
||||||
controller().params().width.c_str());
|
fl_set_input(dialog_->input_width,tostr(len.value()).c_str());
|
||||||
fl_set_input(dialog_->input_widthp,
|
fl_set_choice(dialog_->choice_width_units, len.unit()+1);
|
||||||
tostr(controller().params().widthp).c_str());
|
|
||||||
|
|
||||||
switch (controller().params().pos) {
|
switch (controller().params().pos) {
|
||||||
case InsetMinipage::top:
|
case InsetMinipage::top:
|
||||||
fl_set_button(dialog_->radio_top, 1);
|
fl_set_button(dialog_->radio_top, 1);
|
||||||
|
@ -25,33 +25,17 @@ FD_form_minipage * FormMinipage::build_minipage()
|
|||||||
fdui->form = fl_bgn_form(FL_NO_BOX, 430, 170);
|
fdui->form = fl_bgn_form(FL_NO_BOX, 430, 170);
|
||||||
fdui->form->u_vdata = this;
|
fdui->form->u_vdata = this;
|
||||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 430, 170, "");
|
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 430, 170, "");
|
||||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 20, 190, 100, "");
|
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 20, 20, 200, 60, _("Width"));
|
||||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 20, 20, 200, 100, "");
|
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 240, 20, 180, 100, _("Alignment"));
|
||||||
{
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
char const * const dummy = N_("Length|#L");
|
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||||
fdui->input_width = obj = fl_add_input(FL_NORMAL_INPUT, 100, 30, 110, 30, idex(_(dummy)));
|
fdui->input_width = obj = fl_add_input(FL_NORMAL_INPUT, 30, 30, 110, 30, "");
|
||||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
|
||||||
}
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||||
{
|
fdui->choice_width_units = obj = fl_add_choice(FL_NORMAL_CHOICE2, 150, 30, 60, 30, "");
|
||||||
// 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);
|
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"));
|
|
||||||
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->group_alignment = fl_bgn_group();
|
fdui->group_alignment = fl_bgn_group();
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ struct FD_form_minipage {
|
|||||||
|
|
||||||
FL_FORM *form;
|
FL_FORM *form;
|
||||||
FL_OBJECT *input_width;
|
FL_OBJECT *input_width;
|
||||||
FL_OBJECT *input_widthp;
|
FL_OBJECT *choice_width_units;
|
||||||
FL_OBJECT *group_alignment;
|
FL_OBJECT *group_alignment;
|
||||||
FL_OBJECT *radio_top;
|
FL_OBJECT *radio_top;
|
||||||
FL_OBJECT *radio_middle;
|
FL_OBJECT *radio_middle;
|
||||||
|
@ -10,7 +10,7 @@ Unit of measure: FL_COORD_PIXEL
|
|||||||
Name: form_minipage
|
Name: form_minipage
|
||||||
Width: 430
|
Width: 430
|
||||||
Height: 170
|
Height: 170
|
||||||
Number of Objects: 16
|
Number of Objects: 14
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BOX
|
class: FL_BOX
|
||||||
@ -31,84 +31,12 @@ callback:
|
|||||||
argument:
|
argument:
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_FRAME
|
class: FL_LABELFRAME
|
||||||
type: ENGRAVED_FRAME
|
type: ENGRAVED_FRAME
|
||||||
box: 230 20 190 100
|
box: 20 20 200 60
|
||||||
boxtype: FL_NO_BOX
|
boxtype: FL_NO_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_BLACK FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_TOP_LEFT
|
||||||
style: FL_NORMAL_STYLE
|
|
||||||
size: FL_DEFAULT_SIZE
|
|
||||||
lcol: FL_BLACK
|
|
||||||
label:
|
|
||||||
shortcut:
|
|
||||||
resize: FL_RESIZE_ALL
|
|
||||||
gravity: FL_NoGravity FL_NoGravity
|
|
||||||
name:
|
|
||||||
callback:
|
|
||||||
argument:
|
|
||||||
|
|
||||||
--------------------
|
|
||||||
class: FL_FRAME
|
|
||||||
type: ENGRAVED_FRAME
|
|
||||||
box: 20 20 200 100
|
|
||||||
boxtype: FL_NO_BOX
|
|
||||||
colors: FL_COL1 FL_COL1
|
|
||||||
alignment: FL_ALIGN_CENTER
|
|
||||||
style: FL_NORMAL_STYLE
|
|
||||||
size: FL_DEFAULT_SIZE
|
|
||||||
lcol: FL_BLACK
|
|
||||||
label:
|
|
||||||
shortcut:
|
|
||||||
resize: FL_RESIZE_ALL
|
|
||||||
gravity: FL_NoGravity FL_NoGravity
|
|
||||||
name:
|
|
||||||
callback:
|
|
||||||
argument:
|
|
||||||
|
|
||||||
--------------------
|
|
||||||
class: FL_INPUT
|
|
||||||
type: NORMAL_INPUT
|
|
||||||
box: 100 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
|
|
||||||
shortcut:
|
|
||||||
resize: FL_RESIZE_ALL
|
|
||||||
gravity: FL_NoGravity FL_NoGravity
|
|
||||||
name: input_width
|
|
||||||
callback: C_FormBaseInputCB
|
|
||||||
argument: 0
|
|
||||||
|
|
||||||
--------------------
|
|
||||||
class: FL_INPUT
|
|
||||||
type: INT_INPUT
|
|
||||||
box: 100 70 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: or %|#o
|
|
||||||
shortcut:
|
|
||||||
resize: FL_RESIZE_ALL
|
|
||||||
gravity: FL_NoGravity FL_NoGravity
|
|
||||||
name: input_widthp
|
|
||||||
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
|
style: FL_BOLD_STYLE
|
||||||
size: FL_NORMAL_SIZE
|
size: FL_NORMAL_SIZE
|
||||||
lcol: FL_BLACK
|
lcol: FL_BLACK
|
||||||
@ -121,12 +49,12 @@ callback:
|
|||||||
argument:
|
argument:
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_TEXT
|
class: FL_LABELFRAME
|
||||||
type: NORMAL_TEXT
|
type: ENGRAVED_FRAME
|
||||||
box: 240 10 140 20
|
box: 240 20 180 100
|
||||||
boxtype: FL_FLAT_BOX
|
boxtype: FL_NO_BOX
|
||||||
colors: FL_COL1 FL_MCOL
|
colors: FL_BLACK FL_COL1
|
||||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
alignment: FL_ALIGN_TOP_LEFT
|
||||||
style: FL_BOLD_STYLE
|
style: FL_BOLD_STYLE
|
||||||
size: FL_NORMAL_SIZE
|
size: FL_NORMAL_SIZE
|
||||||
lcol: FL_BLACK
|
lcol: FL_BLACK
|
||||||
@ -138,10 +66,46 @@ name:
|
|||||||
callback:
|
callback:
|
||||||
argument:
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_INPUT
|
||||||
|
type: NORMAL_INPUT
|
||||||
|
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:
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_ALL
|
||||||
|
gravity: FL_NoGravity FL_NoGravity
|
||||||
|
name: input_width
|
||||||
|
callback: C_FormBaseInputCB
|
||||||
|
argument: 0
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
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_DEFAULT_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label:
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_ALL
|
||||||
|
gravity: FL_NoGravity FL_NoGravity
|
||||||
|
name: choice_width_units
|
||||||
|
callback: C_FormBaseInputCB
|
||||||
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BEGIN_GROUP
|
class: FL_BEGIN_GROUP
|
||||||
type: 0
|
type: 0
|
||||||
box: 0 0 0 0
|
box: 0 10 10 0
|
||||||
boxtype: FL_NO_BOX
|
boxtype: FL_NO_BOX
|
||||||
colors: FL_COL1 FL_MCOL
|
colors: FL_COL1 FL_MCOL
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2001-03-28 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* insets/figinset.[Ch]: changed headers lyx.h, form1.h -> figure_form.h.
|
* insets/figinset.[Ch]: changed headers lyx.h, form1.h -> figure_form.h.
|
||||||
|
@ -229,9 +229,9 @@ UpdatableInset::LocalDispatch(BufferView * bv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UpdatableInset::getMaxWidth(Painter & pain, UpdatableInset const *) const
|
int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
|
||||||
{
|
{
|
||||||
if (owner())
|
if (owner())
|
||||||
return static_cast<UpdatableInset*>(owner())->getMaxWidth(pain, this);
|
return static_cast<UpdatableInset*>(owner())->getMaxWidth(bv, this);
|
||||||
return pain.paperWidth();
|
return bv->workWidth();
|
||||||
}
|
}
|
||||||
|
@ -299,10 +299,10 @@ int InsetCollapsable::Latex(Buffer const * buf, ostream & os,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetCollapsable::getMaxWidth(Painter & pain,
|
int InsetCollapsable::getMaxWidth(BufferView * bv,
|
||||||
UpdatableInset const * inset) const
|
UpdatableInset const * inset) const
|
||||||
{
|
{
|
||||||
int const w = UpdatableInset::getMaxWidth(pain, inset);
|
int const w = UpdatableInset::getMaxWidth(bv, inset);
|
||||||
|
|
||||||
if (w < 0) {
|
if (w < 0) {
|
||||||
// What does a negative max width signify? (Lgb)
|
// What does a negative max width signify? (Lgb)
|
||||||
|
@ -121,7 +121,7 @@ public:
|
|||||||
///
|
///
|
||||||
void setAutoCollapse(bool f) { autocollapse = f; }
|
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;
|
LyXText * getLyXText(BufferView const *, bool const recursive) const;
|
||||||
///
|
///
|
||||||
|
@ -69,7 +69,7 @@ InsetMinipage::InsetMinipage()
|
|||||||
setLabelFont(font);
|
setLabelFont(font);
|
||||||
setAutoCollapse(false);
|
setAutoCollapse(false);
|
||||||
setInsetName("Minipage");
|
setInsetName("Minipage");
|
||||||
widthp_ = 100; // set default to 100% of column_width
|
width_ = "100%"; // set default to 100% of column_width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -85,8 +85,7 @@ void InsetMinipage::Write(Buffer const * buf, ostream & os) const
|
|||||||
<< "position " << pos_ << "\n"
|
<< "position " << pos_ << "\n"
|
||||||
<< "inner_position " << inner_pos_ << "\n"
|
<< "inner_position " << inner_pos_ << "\n"
|
||||||
<< "height \"" << height_ << "\"\n"
|
<< "height \"" << height_ << "\"\n"
|
||||||
<< "width \"" << width_ << "\"\n"
|
<< "width \"" << width_ << "\"\n";
|
||||||
<< "widthp " << widthp_ << "\n";
|
|
||||||
InsetCollapsable::Write(buf, os);
|
InsetCollapsable::Write(buf, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,6 +148,9 @@ void InsetMinipage::Read(Buffer const * buf, LyXLex & lex)
|
|||||||
<< endl;
|
<< 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 (lex.IsOK()) {
|
||||||
if (token.empty()) {
|
if (token.empty()) {
|
||||||
lex.next();
|
lex.next();
|
||||||
@ -156,13 +158,17 @@ void InsetMinipage::Read(Buffer const * buf, LyXLex & lex)
|
|||||||
}
|
}
|
||||||
if (token == "widthp") {
|
if (token == "widthp") {
|
||||||
lex.next();
|
lex.next();
|
||||||
widthp_ = lex.GetInteger();
|
// only do this if the width_-string was not already set!
|
||||||
|
if (width_.empty())
|
||||||
|
width_ = lex.GetString() + "%";
|
||||||
token = string();
|
token = string();
|
||||||
} else {
|
} else {
|
||||||
lyxerr << "InsetMinipage::Read: Missing 'widthp_'-tag!"
|
lyxerr << "InsetMinipage::Read: Missing 'widthp_'-tag!"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!token.empty())
|
||||||
|
lex.pushToken(token);
|
||||||
InsetCollapsable::Read(buf, lex);
|
InsetCollapsable::Read(buf, lex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +183,6 @@ Inset * InsetMinipage::Clone(Buffer const &) const
|
|||||||
result->inner_pos_ = inner_pos_;
|
result->inner_pos_ = inner_pos_;
|
||||||
result->height_ = height_;
|
result->height_ = height_;
|
||||||
result->width_ = width_;
|
result->width_ = width_;
|
||||||
result->widthp_ = widthp_;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,18 +256,12 @@ int InsetMinipage::Latex(Buffer const * buf,
|
|||||||
s_pos += "b";
|
s_pos += "b";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
os << "\\begin{minipage}[" << s_pos << "]{"
|
||||||
if (width_.empty()) {
|
<< LyXLength(width_).asLatexString() << "}%\n";
|
||||||
os << "\\begin{minipage}[" << s_pos << "]{."
|
|
||||||
<< widthp_ << "\\columnwidth}%\n";
|
|
||||||
} else {
|
|
||||||
os << "\\begin{minipage}[" << s_pos << "]{"
|
|
||||||
<< width_ << "}%\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
int i = inset->Latex(buf, os, fragile, fp);
|
int i = inset->Latex(buf, os, fragile, fp);
|
||||||
|
|
||||||
os << "\\end{minipage}%\n";
|
os << "\\end{minipage}%\n";
|
||||||
|
|
||||||
return i + 2;
|
return i + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,23 +323,6 @@ void InsetMinipage::width(string const & ll)
|
|||||||
width_ = ll;
|
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
|
bool InsetMinipage::ShowInsetDialog(BufferView * bv) const
|
||||||
{
|
{
|
||||||
@ -361,10 +343,11 @@ void InsetMinipage::InsetButtonRelease(BufferView * bv, int x, int y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetMinipage::getMaxWidth(Painter & pain, UpdatableInset const * inset)
|
int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
if (!width_.empty())
|
if (!width_.empty())
|
||||||
return VSpace(width_).inPixels(0, 0);
|
return VSpace(width_).inPixels(bv);
|
||||||
return InsetCollapsable::getMaxWidth(pain, inset) / 100 * widthp_;
|
// this should not happen!
|
||||||
|
return InsetCollapsable::getMaxWidth(bv, inset);
|
||||||
}
|
}
|
||||||
|
@ -77,17 +77,11 @@ public:
|
|||||||
///
|
///
|
||||||
void width(string const &);
|
void width(string const &);
|
||||||
///
|
///
|
||||||
int widthp() const;
|
|
||||||
///
|
|
||||||
void widthp(int);
|
|
||||||
///
|
|
||||||
void widthp(string const &);
|
|
||||||
///
|
|
||||||
SigC::Signal0<void> hideDialog;
|
SigC::Signal0<void> hideDialog;
|
||||||
///
|
///
|
||||||
void InsetButtonRelease(BufferView * bv, int x, int y, int button);
|
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; }
|
bool needFullRow() const { return false; }
|
||||||
///
|
///
|
||||||
@ -101,8 +95,6 @@ private:
|
|||||||
string height_;
|
string height_;
|
||||||
///
|
///
|
||||||
string width_;
|
string width_;
|
||||||
///
|
|
||||||
int widthp_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1812,17 +1812,17 @@ bool InsetTabular::InsetHit(BufferView *, int x, int) const
|
|||||||
|
|
||||||
// This returns paperWidth() if the cell-width is unlimited or the width
|
// This returns paperWidth() if the cell-width is unlimited or the width
|
||||||
// in pixels if we have a pwidth for this cell.
|
// 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);
|
string const s = tabular->GetPWidth(cell);
|
||||||
|
|
||||||
if (s.empty())
|
if (s.empty())
|
||||||
return -1;
|
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
|
UpdatableInset const * inset) const
|
||||||
{
|
{
|
||||||
int const n = tabular->GetNumberOfCells();
|
int const n = tabular->GetNumberOfCells();
|
||||||
@ -1833,7 +1833,7 @@ int InsetTabular::getMaxWidth(Painter & pain,
|
|||||||
}
|
}
|
||||||
if (cell >= n)
|
if (cell >= n)
|
||||||
return -1;
|
return -1;
|
||||||
int w = GetMaxWidthOfCell(pain, cell);
|
int w = GetMaxWidthOfCell(bv, cell);
|
||||||
if (w > 0)
|
if (w > 0)
|
||||||
// because the inset then subtracts it's top_x and owner->x()
|
// because the inset then subtracts it's top_x and owner->x()
|
||||||
w += (inset->x() - top_x);
|
w += (inset->x() - top_x);
|
||||||
|
@ -159,7 +159,7 @@ public:
|
|||||||
///
|
///
|
||||||
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
|
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); }
|
Buffer * BufferOwner() const { return const_cast<Buffer *>(buffer); }
|
||||||
///
|
///
|
||||||
@ -232,7 +232,7 @@ private:
|
|||||||
///
|
///
|
||||||
bool InsetHit(BufferView * bv, int x, int y) const;
|
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;
|
bool hasPasteBuffer() const;
|
||||||
///
|
///
|
||||||
|
@ -288,15 +288,15 @@ int InsetText::descent(BufferView * bv, LyXFont const &) const
|
|||||||
|
|
||||||
int InsetText::width(BufferView * bv, LyXFont const &) 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));
|
(int)TEXT(bv)->width + (2 * TEXT_TO_INSET_OFFSET));
|
||||||
return insetWidth;
|
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;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
|
|||||||
// static_cast<int>(TEXT(bv)->width) + drawTextXOffset) +
|
// static_cast<int>(TEXT(bv)->width) + drawTextXOffset) +
|
||||||
// (2 * TEXT_TO_INSET_OFFSET);
|
// (2 * TEXT_TO_INSET_OFFSET);
|
||||||
#else
|
#else
|
||||||
insetWidth = textWidth(bv->painter());
|
insetWidth = textWidth(bv);
|
||||||
if (insetWidth < 0)
|
if (insetWidth < 0)
|
||||||
insetWidth = static_cast<int>(TEXT(bv)->width);
|
insetWidth = static_cast<int>(TEXT(bv)->width);
|
||||||
#endif
|
#endif
|
||||||
@ -1517,9 +1517,9 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
if (w < 0) {
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(BufferView *, LyXFont const & f) const;
|
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 draw(BufferView *, LyXFont const &, int , float &, bool) const;
|
||||||
///
|
///
|
||||||
@ -154,7 +154,7 @@ public:
|
|||||||
///
|
///
|
||||||
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
|
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);
|
void init(InsetText const * ins = 0);
|
||||||
///
|
///
|
||||||
|
@ -361,7 +361,7 @@ public:
|
|||||||
///
|
///
|
||||||
virtual bool isCursorVisible() const { return cursor_visible; }
|
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; }
|
int scroll() const { return scx; }
|
||||||
///
|
///
|
||||||
|
@ -1993,7 +1993,6 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
|
|||||||
if (LeftLine(cell))
|
if (LeftLine(cell))
|
||||||
os << '|';
|
os << '|';
|
||||||
if (!GetPWidth(cell).empty()) {
|
if (!GetPWidth(cell).empty()) {
|
||||||
#warning Jürgen, are these alignments correct? (Lgb)
|
|
||||||
switch (GetVAlignment(cell)) {
|
switch (GetVAlignment(cell)) {
|
||||||
case LYX_VALIGN_TOP:
|
case LYX_VALIGN_TOP:
|
||||||
os << "p";
|
os << "p";
|
||||||
@ -2044,7 +2043,6 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
|
|||||||
} else if (GetUsebox(cell) == BOX_MINIPAGE) {
|
} else if (GetUsebox(cell) == BOX_MINIPAGE) {
|
||||||
os << "\\begin{minipage}[";
|
os << "\\begin{minipage}[";
|
||||||
switch (GetVAlignment(cell)) {
|
switch (GetVAlignment(cell)) {
|
||||||
#warning Jürgen, are these alignments correct? (Lgb)
|
|
||||||
case LYX_VALIGN_TOP:
|
case LYX_VALIGN_TOP:
|
||||||
os << "t";
|
os << "t";
|
||||||
break;
|
break;
|
||||||
@ -2109,7 +2107,6 @@ int LyXTabular::Latex(Buffer const * buf,
|
|||||||
os << column_info[i].align_special;
|
os << column_info[i].align_special;
|
||||||
} else if (!column_info[i].p_width.empty()) {
|
} else if (!column_info[i].p_width.empty()) {
|
||||||
switch (column_info[i].valignment) {
|
switch (column_info[i].valignment) {
|
||||||
#warning Jürgen, are these alignments correct? (Lgb)
|
|
||||||
case LYX_VALIGN_TOP:
|
case LYX_VALIGN_TOP:
|
||||||
os << "p";
|
os << "p";
|
||||||
break;
|
break;
|
||||||
|
@ -52,7 +52,7 @@ extern int bibitemMaxWidth(BufferView *, LyXFont const &);
|
|||||||
int LyXText::workWidth(BufferView * bview) const
|
int LyXText::workWidth(BufferView * bview) const
|
||||||
{
|
{
|
||||||
if (inset_owner) {
|
if (inset_owner) {
|
||||||
return inset_owner->textWidth(bview->painter());
|
return inset_owner->textWidth(bview);
|
||||||
}
|
}
|
||||||
return bview->workWidth();
|
return bview->workWidth();
|
||||||
}
|
}
|
||||||
|
46
src/vspace.C
46
src/vspace.C
@ -34,7 +34,8 @@ int const num_units = LyXLength::UNIT_NONE;
|
|||||||
// I am not sure if "mu" should be possible to select (Lgb)
|
// I am not sure if "mu" should be possible to select (Lgb)
|
||||||
char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
|
char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
|
||||||
"mm", "pc", "cc", "cm",
|
"mm", "pc", "cc", "cm",
|
||||||
"in", "ex", "em", "mu" };
|
"in", "ex", "em", "mu",
|
||||||
|
"%", "c%", "p%", "l%" };
|
||||||
|
|
||||||
|
|
||||||
/* The following static items form a simple scanner for
|
/* The following static items form a simple scanner for
|
||||||
@ -104,7 +105,7 @@ char nextToken(string & data)
|
|||||||
} else return 'E';
|
} else return 'E';
|
||||||
}
|
}
|
||||||
|
|
||||||
i = data.find_first_not_of("abcdefghijklmnopqrstuvwxyz");
|
i = data.find_first_not_of("abcdefghijklmnopqrstuvwxyz%");
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
if (unit_index > 3) return 'E';
|
if (unit_index > 3) return 'E';
|
||||||
|
|
||||||
@ -162,6 +163,13 @@ LaTeXLength table[] = {
|
|||||||
|
|
||||||
} // namespace anon
|
} // 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)
|
LyXLength::UNIT unitFromString (string const & data)
|
||||||
{
|
{
|
||||||
@ -323,6 +331,28 @@ string const LyXLength::asString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
/* LyXGlueLength class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -521,13 +551,15 @@ int VSpace::inPixels(BufferView * bv) const
|
|||||||
// Height of a normal line in pixels (zoom factor considered)
|
// Height of a normal line in pixels (zoom factor considered)
|
||||||
int height = bv->text->DefaultHeight(); // [pixels]
|
int height = bv->text->DefaultHeight(); // [pixels]
|
||||||
int skip = 0;
|
int skip = 0;
|
||||||
|
int width = bv->workWidth();
|
||||||
|
|
||||||
if (kin == DEFSKIP)
|
if (kin == DEFSKIP)
|
||||||
skip = bv->buffer()->params.getDefSkip().inPixels(bv);
|
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)
|
// Height of a normal line in pixels (zoom factor considered)
|
||||||
int height = default_height; // [pixels]
|
int height = default_height; // [pixels]
|
||||||
@ -623,6 +655,12 @@ int VSpace::inPixels(int default_height, int default_skip) const
|
|||||||
// math mode
|
// math mode
|
||||||
result = zoom * value * height;
|
result = zoom * value * height;
|
||||||
break;
|
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:
|
case LyXLength::UNIT_NONE:
|
||||||
result = 0; // this cannot happen
|
result = 0; // this cannot happen
|
||||||
break;
|
break;
|
||||||
|
15
src/vspace.h
15
src/vspace.h
@ -50,6 +50,13 @@ public:
|
|||||||
EM,
|
EM,
|
||||||
/// Math unit (18mu = 1em) for positioning in math mode
|
/// Math unit (18mu = 1em) for positioning in math mode
|
||||||
MU,
|
MU,
|
||||||
|
/// Percent of columnwidth both "%" or "%c"
|
||||||
|
PW,
|
||||||
|
PE,
|
||||||
|
/// Percent of pagewidth
|
||||||
|
PP,
|
||||||
|
/// Percent of linewidth
|
||||||
|
PL,
|
||||||
/// no unit
|
/// no unit
|
||||||
UNIT_NONE
|
UNIT_NONE
|
||||||
};
|
};
|
||||||
@ -71,9 +78,7 @@ public:
|
|||||||
/// conversion
|
/// conversion
|
||||||
virtual string const asString() const;
|
virtual string const asString() const;
|
||||||
///
|
///
|
||||||
virtual string const asLatexString() const {
|
virtual string const asLatexString() const;
|
||||||
return this->asString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** If "data" is valid, the length represented by it is
|
/** If "data" is valid, the length represented by it is
|
||||||
stored into "result", if that is not 0. */
|
stored into "result", if that is not 0. */
|
||||||
@ -99,6 +104,8 @@ bool operator==(LyXLength const & l1, LyXLength const & l2)
|
|||||||
extern LyXLength::UNIT unitFromString (string const & data);
|
extern LyXLength::UNIT unitFromString (string const & data);
|
||||||
///
|
///
|
||||||
extern bool isValidLength(string const & data, LyXLength * result);
|
extern bool isValidLength(string const & data, LyXLength * result);
|
||||||
|
///
|
||||||
|
extern const char * stringFromUnit(int unit);
|
||||||
|
|
||||||
/// LyXGlueLength class
|
/// LyXGlueLength class
|
||||||
class LyXGlueLength : public LyXLength {
|
class LyXGlueLength : public LyXLength {
|
||||||
@ -239,7 +246,7 @@ public:
|
|||||||
///
|
///
|
||||||
int inPixels(BufferView * bv) const;
|
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:
|
private:
|
||||||
/// This VSpace kind
|
/// This VSpace kind
|
||||||
vspace_kind kin;
|
vspace_kind kin;
|
||||||
|
Loading…
Reference in New Issue
Block a user