mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
support for rightarrowfill, leftarrowfill, upbracefill, downbracefill, by Helge Hafting.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24567 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1fa1e7c66b
commit
95767b840b
@ -1,6 +1,11 @@
|
||||
LyX file-format changes
|
||||
-----------------------
|
||||
|
||||
2008-25-04 Helge Hafting <helge.hafting@aitel.hist.no>
|
||||
* Format incremented to 330: More horizontal fills
|
||||
- \leftarrowfill, \rightarrowfill
|
||||
- \upbracefill, \downbracefill
|
||||
|
||||
2008-04-28 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
* Format incremented to 329: new param \master.
|
||||
|
||||
|
@ -80,7 +80,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)),
|
||||
("1_3", [221], minor_versions("1.3" , 7)),
|
||||
("1_4", range(222,246), minor_versions("1.4" , 5)),
|
||||
("1_5", range(246,277), minor_versions("1.5" , 2)),
|
||||
("1_6", range(277,330), minor_versions("1.6" , 0))]
|
||||
("1_6", range(277,331), minor_versions("1.6" , 0))]
|
||||
|
||||
|
||||
def formats_list():
|
||||
|
@ -1791,6 +1791,78 @@ def revert_protected_hfill(document):
|
||||
'hspace*{\n\\backslash\nfill}\n\\end_layout\n\n\\end_inset\n\n')
|
||||
|
||||
|
||||
def revert_leftarrowfill(document):
|
||||
' Revert \\begin_inset Space \\leftarrowfill{} to ERT '
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Space \\leftarrowfill{}', i)
|
||||
if i == -1:
|
||||
return
|
||||
j = find_end_of_inset(document.body, i)
|
||||
if j == -1:
|
||||
document.warning("Malformed LyX document: Could not find end of space inset.")
|
||||
continue
|
||||
del document.body[j]
|
||||
document.body[i] = document.body[i].replace('\\begin_inset Space \\leftarrowfill{}', \
|
||||
'\\begin_inset ERT\nstatus collapsed\n\n' \
|
||||
'\\begin_layout Standard\n\n\n\\backslash\n' \
|
||||
'leftarrowfill{}\n\\end_layout\n\n\\end_inset\n\n')
|
||||
|
||||
|
||||
def revert_rightarrowfill(document):
|
||||
' Revert \\begin_inset Space \\rightarrowfill{} to ERT '
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Space \\rightarrowfill{}', i)
|
||||
if i == -1:
|
||||
return
|
||||
j = find_end_of_inset(document.body, i)
|
||||
if j == -1:
|
||||
document.warning("Malformed LyX document: Could not find end of space inset.")
|
||||
continue
|
||||
del document.body[j]
|
||||
document.body[i] = document.body[i].replace('\\begin_inset Space \\rightarrowfill{}', \
|
||||
'\\begin_inset ERT\nstatus collapsed\n\n' \
|
||||
'\\begin_layout Standard\n\n\n\\backslash\n' \
|
||||
'rightarrowfill{}\n\\end_layout\n\n\\end_inset\n\n')
|
||||
|
||||
|
||||
def revert_upbracefill(document):
|
||||
' Revert \\begin_inset Space \\upbracefill{} to ERT '
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Space \\upbracefill{}', i)
|
||||
if i == -1:
|
||||
return
|
||||
j = find_end_of_inset(document.body, i)
|
||||
if j == -1:
|
||||
document.warning("Malformed LyX document: Could not find end of space inset.")
|
||||
continue
|
||||
del document.body[j]
|
||||
document.body[i] = document.body[i].replace('\\begin_inset Space \\upbracefill{}', \
|
||||
'\\begin_inset ERT\nstatus collapsed\n\n' \
|
||||
'\\begin_layout Standard\n\n\n\\backslash\n' \
|
||||
'upbracefill{}\n\\end_layout\n\n\\end_inset\n\n')
|
||||
|
||||
|
||||
def revert_downbracefill(document):
|
||||
' Revert \\begin_inset Space \\downbracefill{} to ERT '
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Space \\downbracefill{}', i)
|
||||
if i == -1:
|
||||
return
|
||||
j = find_end_of_inset(document.body, i)
|
||||
if j == -1:
|
||||
document.warning("Malformed LyX document: Could not find end of space inset.")
|
||||
continue
|
||||
del document.body[j]
|
||||
document.body[i] = document.body[i].replace('\\begin_inset Space \\downbracefill{}', \
|
||||
'\\begin_inset ERT\nstatus collapsed\n\n' \
|
||||
'\\begin_layout Standard\n\n\n\\backslash\n' \
|
||||
'downbracefill{}\n\\end_layout\n\n\\end_inset\n\n')
|
||||
|
||||
|
||||
def revert_local_layout(document):
|
||||
' Revert local layout headers.'
|
||||
i = 0
|
||||
@ -2066,9 +2138,11 @@ convert = [[277, [fix_wrong_tables]],
|
||||
[327, []],
|
||||
[328, [remove_embedding, remove_extra_embedded_files, remove_inzip_options]],
|
||||
[329, []],
|
||||
[330, []],
|
||||
]
|
||||
|
||||
revert = [[328, [revert_master]],
|
||||
revert = [[329, [revert_leftarrowfill, revert_rightarrowfill, revert_upbracefill, revert_downbracefill]],
|
||||
[328, [revert_master]],
|
||||
[327, []],
|
||||
[326, [revert_mexican]],
|
||||
[325, [revert_pdfpages]],
|
||||
|
@ -179,6 +179,10 @@ Menuset
|
||||
Item "Protected Horizontal Fill|i" "next-inset-modify space \hspace*{\fill}"
|
||||
Item "Horizontal Fill (Dots)|D" "next-inset-modify space \dotfill{}"
|
||||
Item "Horizontal Fill (Rule)|R" "next-inset-modify space \hrulefill{}"
|
||||
Item "Horizontal Fill (Left Arrow)|L" "next-inset-modify space \leftarrowfill{}"
|
||||
Item "Horizontal Fill (Right Arrow)|g" "next-inset-modify space \rightarrowfill{}"
|
||||
Item "Horizontal Fill (Up Brace)|p" "next-inset-modify space \upbracefill{}"
|
||||
Item "Horizontal Fill (Down Brace)|B" "next-inset-modify space \downbracefill{}"
|
||||
Item "Custom Length|C" "command-sequence next-inset-modify space \hspace{} \length 1in; next-inset-toggle"
|
||||
Separator
|
||||
Item "Settings...|S" "next-inset-toggle"
|
||||
|
@ -115,7 +115,7 @@ namespace os = support::os;
|
||||
|
||||
namespace {
|
||||
|
||||
int const LYX_FORMAT = 329;
|
||||
int const LYX_FORMAT = 330;
|
||||
|
||||
typedef map<string, bool> DepClean;
|
||||
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
|
||||
|
@ -165,6 +165,22 @@ static void setWidgetsFromHSpace(InsetSpaceParams const & params,
|
||||
item = 6;
|
||||
pattern = 2;
|
||||
break;
|
||||
case InsetSpaceParams::LEFTARROWFILL:
|
||||
item = 6;
|
||||
pattern = 3;
|
||||
break;
|
||||
case InsetSpaceParams::RIGHTARROWFILL:
|
||||
item = 6;
|
||||
pattern = 4;
|
||||
break;
|
||||
case InsetSpaceParams::UPBRACEFILL:
|
||||
item = 6;
|
||||
pattern = 5;
|
||||
break;
|
||||
case InsetSpaceParams::DOWNBRACEFILL:
|
||||
item = 6;
|
||||
pattern = 6;
|
||||
break;
|
||||
case InsetSpaceParams::CUSTOM:
|
||||
item = 7;
|
||||
break;
|
||||
@ -220,6 +236,14 @@ static InsetSpaceParams setHSpaceFromWidgets(int spacing,
|
||||
params.kind = InsetSpaceParams::DOTFILL;
|
||||
else if (fill == 2)
|
||||
params.kind = InsetSpaceParams::HRULEFILL;
|
||||
else if (fill == 3)
|
||||
params.kind = InsetSpaceParams::LEFTARROWFILL;
|
||||
else if (fill == 4)
|
||||
params.kind = InsetSpaceParams::RIGHTARROWFILL;
|
||||
else if (fill == 5)
|
||||
params.kind = InsetSpaceParams::UPBRACEFILL;
|
||||
else if (fill == 6)
|
||||
params.kind = InsetSpaceParams::DOWNBRACEFILL;
|
||||
else if (keep)
|
||||
params.kind = InsetSpaceParams::HFILL_PROTECTED;
|
||||
else
|
||||
|
@ -6,7 +6,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>259</width>
|
||||
<height>146</height>
|
||||
<height>160</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
@ -42,6 +42,26 @@
|
||||
<string>________</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string><-----------</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>-----------></string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>\-----v-----/</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>/-----^-----\</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
|
@ -102,6 +102,18 @@ docstring InsetSpace::toolTip(BufferView const &, int, int) const
|
||||
case InsetSpaceParams::HRULEFILL:
|
||||
message = _("Horizontal Fill (Rule)");
|
||||
break;
|
||||
case InsetSpaceParams::LEFTARROWFILL:
|
||||
message = _("Horizontal Fill (Left Arrow)");
|
||||
break;
|
||||
case InsetSpaceParams::RIGHTARROWFILL:
|
||||
message = _("Horizontal Fill (Right Arrow)");
|
||||
break;
|
||||
case InsetSpaceParams::UPBRACEFILL:
|
||||
message = _("Horizontal Fill (Up Brace)");
|
||||
break;
|
||||
case InsetSpaceParams::DOWNBRACEFILL:
|
||||
message = _("Horizontal Fill (Down Brace)");
|
||||
break;
|
||||
case InsetSpaceParams::CUSTOM:
|
||||
message = support::bformat(_("Horizontal Space (%1$s)"),
|
||||
params_.length.asDocstring());
|
||||
@ -202,6 +214,10 @@ void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
case InsetSpaceParams::HFILL_PROTECTED:
|
||||
case InsetSpaceParams::DOTFILL:
|
||||
case InsetSpaceParams::HRULEFILL:
|
||||
case InsetSpaceParams::LEFTARROWFILL:
|
||||
case InsetSpaceParams::RIGHTARROWFILL:
|
||||
case InsetSpaceParams::UPBRACEFILL:
|
||||
case InsetSpaceParams::DOWNBRACEFILL:
|
||||
// shut up compiler
|
||||
break;
|
||||
}
|
||||
@ -222,6 +238,9 @@ void InsetSpace::draw(PainterInfo & pi, int x, int y) const
|
||||
int const y0 = y + desc;
|
||||
int const y1 = y - asc;
|
||||
int const y2 = y - asc / 2;
|
||||
int const xoffset = (y0 - y1) / 2;
|
||||
int const x2 = x0 + xoffset;
|
||||
int const x3 = x1 - xoffset;
|
||||
|
||||
if (params_.kind == InsetSpaceParams::HFILL) {
|
||||
pi.pain.line(x0, y1, x0, y0, Color_added_space);
|
||||
@ -238,10 +257,26 @@ void InsetSpace::draw(PainterInfo & pi, int x, int y) const
|
||||
pi.pain.line(x0, y, x1, y, Color_special,
|
||||
frontend::Painter::line_onoffdash);
|
||||
pi.pain.line(x1, y1, x1, y0, Color_special);
|
||||
} if (params_.kind == InsetSpaceParams::HRULEFILL) {
|
||||
} else if (params_.kind == InsetSpaceParams::HRULEFILL) {
|
||||
pi.pain.line(x0, y1, x0, y0, Color_special);
|
||||
pi.pain.line(x0, y, x1, y, Color_special);
|
||||
pi.pain.line(x1, y1, x1, y0, Color_special);
|
||||
} else if (params_.kind == InsetSpaceParams::LEFTARROWFILL) {
|
||||
pi.pain.line(x2, y1 , x0, y2, Color_special);
|
||||
pi.pain.line(x0, y2 , x2, y0, Color_special);
|
||||
pi.pain.line(x0, y2 , x1, y2, Color_special);
|
||||
} else if (params_.kind == InsetSpaceParams::RIGHTARROWFILL) {
|
||||
pi.pain.line(x3, y1 , x1, y2, Color_special);
|
||||
pi.pain.line(x1, y2 , x3, y0, Color_special);
|
||||
pi.pain.line(x0, y2 , x1, y2, Color_special);
|
||||
} else if (params_.kind == InsetSpaceParams::UPBRACEFILL) {
|
||||
pi.pain.line(x0, y1 , x2, y2, Color_special);
|
||||
pi.pain.line(x3, y2 , x1, y1, Color_special);
|
||||
pi.pain.line(x2, y2 , x3, y2, Color_special);
|
||||
} else if (params_.kind == InsetSpaceParams::DOWNBRACEFILL) {
|
||||
pi.pain.line(x0, y0 , x2, y2, Color_special);
|
||||
pi.pain.line(x3, y2 , x1, y0, Color_special);
|
||||
pi.pain.line(x2, y2 , x3, y2, Color_special);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -313,6 +348,18 @@ void InsetSpaceParams::write(ostream & os) const
|
||||
case InsetSpaceParams::HRULEFILL:
|
||||
os << "\\hrulefill{}";
|
||||
break;
|
||||
case InsetSpaceParams::LEFTARROWFILL:
|
||||
os << "\\leftarrowfill{}";
|
||||
break;
|
||||
case InsetSpaceParams::RIGHTARROWFILL:
|
||||
os << "\\rightarrowfill{}";
|
||||
break;
|
||||
case InsetSpaceParams::UPBRACEFILL:
|
||||
os << "\\upbracefill{}";
|
||||
break;
|
||||
case InsetSpaceParams::DOWNBRACEFILL:
|
||||
os << "\\downbracefill{}";
|
||||
break;
|
||||
case InsetSpaceParams::CUSTOM:
|
||||
os << "\\hspace{}";
|
||||
break;
|
||||
@ -358,6 +405,14 @@ void InsetSpaceParams::read(Lexer & lex)
|
||||
kind = InsetSpaceParams::HRULEFILL;
|
||||
else if (command == "\\hspace{}")
|
||||
kind = InsetSpaceParams::CUSTOM;
|
||||
else if (command == "\\leftarrowfill{}")
|
||||
kind = InsetSpaceParams::LEFTARROWFILL;
|
||||
else if (command == "\\rightarrowfill{}")
|
||||
kind = InsetSpaceParams::RIGHTARROWFILL;
|
||||
else if (command == "\\upbracefill{}")
|
||||
kind = InsetSpaceParams::UPBRACEFILL;
|
||||
else if (command == "\\downbracefill{}")
|
||||
kind = InsetSpaceParams::DOWNBRACEFILL;
|
||||
else if (command == "\\hspace*{}")
|
||||
kind = InsetSpaceParams::CUSTOM_PROTECTED;
|
||||
else
|
||||
@ -421,6 +476,18 @@ int InsetSpace::latex(odocstream & os, OutputParams const & runparams) const
|
||||
case InsetSpaceParams::HRULEFILL:
|
||||
os << (runparams.free_spacing ? " " : "\\hrulefill{}");
|
||||
break;
|
||||
case InsetSpaceParams::LEFTARROWFILL:
|
||||
os << (runparams.free_spacing ? " " : "\\leftarrowfill{}");
|
||||
break;
|
||||
case InsetSpaceParams::RIGHTARROWFILL:
|
||||
os << (runparams.free_spacing ? " " : "\\rightarrowfill{}");
|
||||
break;
|
||||
case InsetSpaceParams::UPBRACEFILL:
|
||||
os << (runparams.free_spacing ? " " : "\\upbracefill{}");
|
||||
break;
|
||||
case InsetSpaceParams::DOWNBRACEFILL:
|
||||
os << (runparams.free_spacing ? " " : "\\downbracefill{}");
|
||||
break;
|
||||
case InsetSpaceParams::CUSTOM:
|
||||
if (runparams.free_spacing)
|
||||
os << " ";
|
||||
@ -451,6 +518,18 @@ int InsetSpace::plaintext(odocstream & os, OutputParams const &) const
|
||||
case InsetSpaceParams::HRULEFILL:
|
||||
os << "_____";
|
||||
return 5;
|
||||
case InsetSpaceParams::LEFTARROWFILL:
|
||||
os << "<----";
|
||||
return 5;
|
||||
case InsetSpaceParams::RIGHTARROWFILL:
|
||||
os << "---->";
|
||||
return 5;
|
||||
case InsetSpaceParams::UPBRACEFILL:
|
||||
os << "\\-v-/";
|
||||
return 5;
|
||||
case InsetSpaceParams::DOWNBRACEFILL:
|
||||
os << "/-^-\\";
|
||||
return 5;
|
||||
default:
|
||||
os << ' ';
|
||||
return 1;
|
||||
@ -482,6 +561,10 @@ int InsetSpace::docbook(odocstream & os, OutputParams const &) const
|
||||
case InsetSpaceParams::HRULEFILL:
|
||||
// FIXME
|
||||
os << '\n';
|
||||
case InsetSpaceParams::LEFTARROWFILL:
|
||||
case InsetSpaceParams::RIGHTARROWFILL:
|
||||
case InsetSpaceParams::UPBRACEFILL:
|
||||
case InsetSpaceParams::DOWNBRACEFILL:
|
||||
case InsetSpaceParams::CUSTOM:
|
||||
case InsetSpaceParams::CUSTOM_PROTECTED:
|
||||
// FIXME
|
||||
@ -502,7 +585,11 @@ bool InsetSpace::isStretchableSpace() const
|
||||
return params_.kind == InsetSpaceParams::HFILL
|
||||
|| params_.kind == InsetSpaceParams::HFILL_PROTECTED
|
||||
|| params_.kind == InsetSpaceParams::DOTFILL
|
||||
|| params_.kind == InsetSpaceParams::HRULEFILL;
|
||||
|| params_.kind == InsetSpaceParams::HRULEFILL
|
||||
|| params_.kind == InsetSpaceParams::LEFTARROWFILL
|
||||
|| params_.kind == InsetSpaceParams::RIGHTARROWFILL
|
||||
|| params_.kind == InsetSpaceParams::UPBRACEFILL
|
||||
|| params_.kind == InsetSpaceParams::DOWNBRACEFILL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,6 +51,14 @@ public:
|
||||
DOTFILL,
|
||||
/// rubber length, filled with a rule
|
||||
HRULEFILL,
|
||||
/// rubber length, filled with a left arrow
|
||||
LEFTARROWFILL,
|
||||
/// rubber length, filled with a right arrow
|
||||
RIGHTARROWFILL,
|
||||
// rubber length, filled with an up brace
|
||||
UPBRACEFILL,
|
||||
// rubber length, filled with a down brace
|
||||
DOWNBRACEFILL,
|
||||
/// \hspace{length}
|
||||
CUSTOM,
|
||||
/// \hspace*{length}
|
||||
|
Loading…
Reference in New Issue
Block a user