mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Revert the box alignment part of 8010b90c
The horizontal alignment changes caused a regression for documents in older formats. This could have been fixed by adding the following lines to the format entry for 489 in development/FORMAT: Previously, the horizontal position was ignored except for the following parameter combinations: - fixed width and type Boxed and without inner box - fixed width and any type and with inner box and with makebox Now, it is also used for the parameter combination below: - makebox is not used and not (type Boxed and without inner box) and a corresponding conversion to convert_BoxFeatures() in lib/lyx2lyx/lyx_2_2.py. However, it was decided to revert the box alignment changes instead: The box alignment can contradict the paragraph alignment. A better way to avoid the additional space that can be created by paragraph alignment (which was the motivation for implementing box alignment) is the same as for table cells (see noTrivlistCentering() in src/Paragraph.cpp). This would be a file format change and it is too late now for 2.2.0. See http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg188147.html for the complete discussion (subject "Regression in lyx2lyx box alignment").
This commit is contained in:
parent
ec6f51b373
commit
d5ed835225
@ -344,8 +344,10 @@ void GuiBox::paramsToDialog(Inset const * inset)
|
|||||||
ialignCO->setEnabled(ibox);
|
ialignCO->setEnabled(ibox);
|
||||||
setSpecial(ibox);
|
setSpecial(ibox);
|
||||||
|
|
||||||
// halign is only allowed if a width is used
|
// halign is only allowed without inner box and if a width is used and if
|
||||||
halignCO->setEnabled(widthCB->isChecked());
|
// pagebreak is not used
|
||||||
|
halignCO->setEnabled(!pagebreakCB->isChecked() && widthCB->isChecked()
|
||||||
|
&& ((!ibox && type == "Boxed") || inner_type == "makebox"));
|
||||||
// add the entry "Stretch" if the box is \makebox or \framebox and if not already there
|
// add the entry "Stretch" if the box is \makebox or \framebox and if not already there
|
||||||
if ((inner_type == "makebox" || (type == "Boxed" && inner_type == "none"))
|
if ((inner_type == "makebox" || (type == "Boxed" && inner_type == "none"))
|
||||||
&& halignCO->count() < 4)
|
&& halignCO->count() < 4)
|
||||||
@ -557,8 +559,10 @@ bool GuiBox::checkWidgets(bool readonly) const
|
|||||||
widthED->setEnabled(false);
|
widthED->setEnabled(false);
|
||||||
widthUnitsLC->setEnabled(false);
|
widthUnitsLC->setEnabled(false);
|
||||||
}
|
}
|
||||||
// halign is only allowed if a width is used
|
// halign is only allowed without inner box and if a width is used and if
|
||||||
halignCO->setEnabled(widthCB->isChecked());
|
// pagebreak is not used
|
||||||
|
halignCO->setEnabled(!pagebreakCB->isChecked() && widthCB->isChecked()
|
||||||
|
&& ((!ibox && outer == "Boxed") || itype == "makebox"));
|
||||||
// add the entry "Stretch" if the box is \makebox or \framebox and if not already there
|
// add the entry "Stretch" if the box is \makebox or \framebox and if not already there
|
||||||
if ((itype == "makebox" || (outer == "Boxed" && itype == "none"))
|
if ((itype == "makebox" || (outer == "Boxed" && itype == "none"))
|
||||||
&& halignCO->count() < 4)
|
&& halignCO->count() < 4)
|
||||||
|
@ -508,23 +508,6 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
os << "\\begin{shaded}%\n";
|
os << "\\begin{shaded}%\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// \framebox and \makebox handle hor_pos their own way
|
|
||||||
// hor_pos is senseless for \mbox and \fbox
|
|
||||||
if (!params_.use_makebox
|
|
||||||
&& !(btype == Boxed && !params_.inner_box)) {
|
|
||||||
switch (params_.hor_pos) {
|
|
||||||
case 'l':
|
|
||||||
// do nothing because this is LaTeX's default
|
|
||||||
break;
|
|
||||||
case 'c':
|
|
||||||
os << "\\centering ";
|
|
||||||
break;
|
|
||||||
case 'r':
|
|
||||||
os << "\\raggedleft ";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
InsetText::latex(os, runparams);
|
InsetText::latex(os, runparams);
|
||||||
|
|
||||||
if (btype == Shaded)
|
if (btype == Shaded)
|
||||||
|
@ -1266,7 +1266,7 @@ status collapsed
|
|||||||
|
|
||||||
\begin_inset Box Shadowbox
|
\begin_inset Box Shadowbox
|
||||||
position "c"
|
position "c"
|
||||||
hor_pos "c"
|
hor_pos "l"
|
||||||
has_inner_box 0
|
has_inner_box 0
|
||||||
inner_pos "c"
|
inner_pos "c"
|
||||||
use_parbox 0
|
use_parbox 0
|
||||||
@ -1284,7 +1284,19 @@ status open
|
|||||||
|
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
www
|
|
||||||
|
\begin_inset ERT
|
||||||
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
|
\backslash
|
||||||
|
centering
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
www
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
@ -1306,7 +1318,7 @@ status collapsed
|
|||||||
|
|
||||||
\begin_inset Box Frameless
|
\begin_inset Box Frameless
|
||||||
position "t"
|
position "t"
|
||||||
hor_pos "c"
|
hor_pos "l"
|
||||||
has_inner_box 1
|
has_inner_box 1
|
||||||
inner_pos "t"
|
inner_pos "t"
|
||||||
use_parbox 1
|
use_parbox 1
|
||||||
@ -1324,7 +1336,19 @@ status open
|
|||||||
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
www
|
|
||||||
|
\begin_inset ERT
|
||||||
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
|
\backslash
|
||||||
|
centering
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
www
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
@ -1358,7 +1382,7 @@ raggedleft
|
|||||||
|
|
||||||
\begin_inset Box Frameless
|
\begin_inset Box Frameless
|
||||||
position "t"
|
position "t"
|
||||||
hor_pos "c"
|
hor_pos "l"
|
||||||
has_inner_box 1
|
has_inner_box 1
|
||||||
inner_pos "t"
|
inner_pos "t"
|
||||||
use_parbox 1
|
use_parbox 1
|
||||||
@ -1376,6 +1400,18 @@ status open
|
|||||||
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
|
\begin_inset ERT
|
||||||
|
status collapsed
|
||||||
|
|
||||||
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
|
\backslash
|
||||||
|
centering
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
|
||||||
www
|
www
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
|
@ -127,7 +127,6 @@ string parse_text_snippet(Parser & p, unsigned flags, const bool outer,
|
|||||||
string fboxrule = "";
|
string fboxrule = "";
|
||||||
string fboxsep = "";
|
string fboxsep = "";
|
||||||
string shadow_size = "";
|
string shadow_size = "";
|
||||||
bool wasBoxAlign = false;
|
|
||||||
|
|
||||||
char const * const known_ref_commands[] = { "ref", "pageref", "vref",
|
char const * const known_ref_commands[] = { "ref", "pageref", "vref",
|
||||||
"vpageref", "prettyref", "nameref", "eqref", 0 };
|
"vpageref", "prettyref", "nameref", "eqref", 0 };
|
||||||
@ -1023,37 +1022,6 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags,
|
|||||||
p.popPosition();
|
p.popPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to determine the box content alignment
|
|
||||||
// first handle the simple case of "{\centering..."
|
|
||||||
if (p.next_token().asInput() == "\\raggedright") {
|
|
||||||
wasBoxAlign = true;
|
|
||||||
hor_pos = "l";
|
|
||||||
} else if (p.next_token().asInput() == "\\centering") {
|
|
||||||
wasBoxAlign = true;
|
|
||||||
hor_pos = "c";
|
|
||||||
} else if (p.next_token().asInput() == "\\raggedleft") {
|
|
||||||
wasBoxAlign = true;
|
|
||||||
hor_pos = "r";
|
|
||||||
} else {
|
|
||||||
// now handle the cases "{%catNewline\centering..."
|
|
||||||
// and "{catNewline\centering..."
|
|
||||||
p.pushPosition();
|
|
||||||
p.get_token().asInput();
|
|
||||||
if (p.next_token().cat() == catComment || p.next_token().cat() == catNewline)
|
|
||||||
p.get_token().asInput();
|
|
||||||
if (p.next_token().asInput() == "\\raggedright") {
|
|
||||||
wasBoxAlign = true;
|
|
||||||
hor_pos = "l";
|
|
||||||
} else if (p.next_token().asInput() == "\\centering") {
|
|
||||||
wasBoxAlign = true;
|
|
||||||
hor_pos = "c";
|
|
||||||
} else if (p.next_token().asInput() == "\\raggedleft") {
|
|
||||||
wasBoxAlign = true;
|
|
||||||
hor_pos = "r";
|
|
||||||
}
|
|
||||||
p.popPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (use_ert) {
|
if (use_ert) {
|
||||||
ostringstream ss;
|
ostringstream ss;
|
||||||
if (!outer_type.empty()) {
|
if (!outer_type.empty()) {
|
||||||
@ -4308,17 +4276,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
shadow_size = shadow_size + p.get_token().asInput();
|
shadow_size = shadow_size + p.get_token().asInput();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// we only handle them if they are in a box
|
output_ert_inset(os, t.asInput(), context);
|
||||||
if (wasBoxAlign) {
|
|
||||||
// LyX will add a space after outputting the
|
|
||||||
// alignment command, so eat any space which
|
|
||||||
// might follow. Otherwise the paragraph
|
|
||||||
// might start with an unneeded space.
|
|
||||||
p.skip_spaces(true);
|
|
||||||
} else
|
|
||||||
output_ert_inset(os, t.asInput(), context);
|
|
||||||
}
|
}
|
||||||
wasBoxAlign = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//\framebox() is part of the picture environment and different from \framebox{}
|
//\framebox() is part of the picture environment and different from \framebox{}
|
||||||
|
Loading…
Reference in New Issue
Block a user