Fix bug #6341: Can't set equal spacing in xymatrix.

Fix the file format change that was introduced in r32518.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33893 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-03-28 16:29:25 +00:00
parent f637c4748d
commit 81dc517306
3 changed files with 44 additions and 3 deletions

View File

@ -1,6 +1,10 @@
LyX file-format changes
-----------------------
2010-03-28: Vincent van Ravesteijn <vfr@lyx.org>
* Format incremented to 381: support for new parameters
for \xymatrix: \xymatrix@!0, \xymatrix!R and \xymatrix!C.
2010-03-28: Vincent van Ravesteijn <vfr@lyx.org>
* Format incremented to 380: introduction of InsetPreview.

View File

@ -1262,7 +1262,42 @@ def revert_inset_preview(document):
del document.body[i]
del document.body[j-1]
i -= 2
def revert_equalspacing_xymatrix(document):
" Revert a Formula with xymatrix@! to an ERT inset "
i = 0
j = 0
has_preamble = 0
while True:
found = -1
i = find_token(document.body, "\\begin_inset Formula", i)
if i == -1:
break
j = find_end_of_inset(document.body, i)
if j == -1:
document.warning("Malformed LyX document: Could not find end of Formula inset.")
break
for curline in range(len(document.body[i:j])):
found = document.body[i+curline].find("\\xymatrix@!")
if found != -1:
break
if found != -1:
content = document.body[i][21:]
for curline in range(len(document.body[i+1:j])):
content += document.body[i+1+curline]
subst = [put_cmd_in_ert(content)]
document.body[i:j+1] = subst
else:
for curline in range(len(document.body[i:j])):
l = document.body[i+curline].find("\\xymatrix")
if l != -1:
has_preamble = 1;
i += 1
if has_preamble == 0:
add_to_preamble(document, ['\\usepackage[all]{xy}'])
##
# Conversion hub
@ -1303,10 +1338,12 @@ convert = [[346, []],
[377, []],
[378, []],
[379, [convert_math_output]],
[380, []]
[380, []],
[381, []]
]
revert = [[379, [revert_inset_preview]],
revert = [[380, [revert_equalspacing_xymatrix]],
[379, [revert_inset_preview]],
[378, [revert_math_output]],
[377, []],
[376, [revert_multirow]],

View File

@ -126,7 +126,7 @@ namespace {
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
int const LYX_FORMAT = 380; // vfr: introduction of insetpreview
int const LYX_FORMAT = 381; // vfr: new parameters for xymatrix
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;