]> git.lyx.org Git - features.git/commitdiff
Fix bug #6341: Can't set equal spacing in xymatrix.
authorVincent van Ravesteijn <vfr@lyx.org>
Sun, 28 Mar 2010 16:29:25 +0000 (16:29 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sun, 28 Mar 2010 16:29:25 +0000 (16:29 +0000)
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

development/FORMAT
lib/lyx2lyx/lyx_2_0.py
src/Buffer.cpp

index 10817f26e0ee43194dd9ab4926dc5cf5ceeebdcb..c20bd894f4571c6ffb47d01aa706a3a3381b802a 100644 (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.
        
index 37de77032d3d112bf590aa323a72e88e63e155e0..d3f310feface8112c15ccc013ae70a6b9918e37f 100644 (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]],
index 83f8cda7566e8ea22003d62ca6a33b255625817d..7317ac20714feed43ffb18c67819043eea438f78 100644 (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;