diff --git a/development/ChangeLog b/development/ChangeLog index d4f7cff291..dc34269068 100644 --- a/development/ChangeLog +++ b/development/ChangeLog @@ -1,3 +1,7 @@ +2003-12-29 Jürgen Spitzmüller + + * FORMAT: document change to format 229. + 2003-12-15 Angus Leeming * FORMAT: document change to format 228. diff --git a/development/FORMAT b/development/FORMAT index b4764b86f5..aaf9e3e036 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,12 @@ LyX file-format changes ----------------------- +2003-12-29 Jürgen Spitzmüller + + * format incremented to 229. + * Minipages cannot be read anymore. All minipage insets will + be converted to frameless box insets between 228->229. + 2003-12-15 Angus Leeming * format incremented to 228. diff --git a/lib/lyx2lyx/ChangeLog b/lib/lyx2lyx/ChangeLog index 6a5b8091ed..c609e0b3d8 100644 --- a/lib/lyx2lyx/ChangeLog +++ b/lib/lyx2lyx/ChangeLog @@ -1,7 +1,9 @@ 2003-12-29 Jürgen Spitzmüller + * lyx2lyx: up the format to 229. * lyxconvert_224.py (convert_minipage): remove function... - * lyxconvert_227.py: ...and place it here. + * lyxconvert_228.py: ...and place it here. + * lyxrevert_229.py: new file (bare bones). 2003-12-19 Angus Leeming diff --git a/lib/lyx2lyx/lyx2lyx b/lib/lyx2lyx/lyx2lyx index 1a45dbe0db..d4333283bc 100755 --- a/lib/lyx2lyx/lyx2lyx +++ b/lib/lyx2lyx/lyx2lyx @@ -40,7 +40,7 @@ opt.quiet = 0 format = re.compile(r"(\d)[\.,]?(\d\d)") fileformat = re.compile(r"\\lyxformat\s*(\S*)") -lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226, 227, 228] +lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226, 227, 228, 229] def usage(): print """Usage: lyx2lyx [options] [file] diff --git a/lib/lyx2lyx/lyxconvert_227.py b/lib/lyx2lyx/lyxconvert_227.py index e103323556..5ea38b2225 100644 --- a/lib/lyx2lyx/lyxconvert_227.py +++ b/lib/lyx2lyx/lyxconvert_227.py @@ -16,7 +16,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import sys -from parser_tools import find_token, find_tokens +from parser_tools import find_tokens def convert_collapsable(lines): i = 0 @@ -52,72 +52,8 @@ def convert_collapsable(lines): i = i + 1 -def convert_minipage(lines): - """ Convert minipages to the box inset. - We try to use the same order of arguments as lyx does. - """ - pos = ["t","c","b"] - inner_pos = ["c","t","b","s"] - - i = 0 - while 1: - i = find_token(lines, "\\begin_inset Minipage", i) - if i == -1: - return - - lines[i] = "\\begin_inset Box Frameless" - i = i + 1 - - # convert old to new position using the pos list - if lines[i][:8] == "position": - lines[i] = 'position "%s"' % pos[int(lines[i][9])] - else: - lines.insert(i, 'position "%s"' % pos[0]) - i = i + 1 - - lines.insert(i, 'hor_pos "c"') - i = i + 1 - lines.insert(i, 'has_inner_box 1') - i = i + 1 - - # convert the inner_position - if lines[i][:14] == "inner_position": - lines[i] = 'inner_pos "%s"' % inner_pos[int(lines[i][15])] - else: - lines.insert('inner_pos "%s"' % inner_pos[0]) - i = i + 1 - - # We need this since the new file format has a height and width - # in a different order. - if lines[i][:6] == "height": - height = lines[i][6:] - # test for default value of 221 and convert it accordingly - if height == ' "0pt"': - height = ' "1pt"' - del lines[i] - else: - height = ' "1pt"' - - if lines[i][:5] == "width": - width = lines[i][5:] - del lines[i] - else: - width = ' "0"' - - lines.insert(i, 'use_parbox 0') - i = i + 1 - lines.insert(i, 'width' + width) - i = i + 1 - lines.insert(i, 'special "none"') - i = i + 1 - lines.insert(i, 'height' + height) - i = i + 1 - lines.insert(i, 'height_special "totalheight"') - i = i + 1 - def convert(header, body): convert_collapsable(body) - convert_minipage(body) if __name__ == "__main__": pass diff --git a/lib/lyx2lyx/lyxconvert_228.py b/lib/lyx2lyx/lyxconvert_228.py new file mode 100644 index 0000000000..33e5af6585 --- /dev/null +++ b/lib/lyx2lyx/lyxconvert_228.py @@ -0,0 +1,91 @@ +# This file is part of lyx2lyx +# Copyright (C) 2003 José Matos +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + + +import sys +from parser_tools import find_token + + +def convert_minipage(lines): + """ Convert minipages to the box inset. + We try to use the same order of arguments as lyx does. + """ + pos = ["t","c","b"] + inner_pos = ["c","t","b","s"] + + i = 0 + while 1: + i = find_token(lines, "\\begin_inset Minipage", i) + if i == -1: + return + + lines[i] = "\\begin_inset Box Frameless" + i = i + 1 + + # convert old to new position using the pos list + if lines[i][:8] == "position": + lines[i] = 'position "%s"' % pos[int(lines[i][9])] + else: + lines.insert(i, 'position "%s"' % pos[0]) + i = i + 1 + + lines.insert(i, 'hor_pos "c"') + i = i + 1 + lines.insert(i, 'has_inner_box 1') + i = i + 1 + + # convert the inner_position + if lines[i][:14] == "inner_position": + lines[i] = 'inner_pos "%s"' % inner_pos[int(lines[i][15])] + else: + lines.insert('inner_pos "%s"' % inner_pos[0]) + i = i + 1 + + # We need this since the new file format has a height and width + # in a different order. + if lines[i][:6] == "height": + height = lines[i][6:] + # test for default value of 221 and convert it accordingly + if height == ' "0pt"': + height = ' "1pt"' + del lines[i] + else: + height = ' "1pt"' + + if lines[i][:5] == "width": + width = lines[i][5:] + del lines[i] + else: + width = ' "0"' + + lines.insert(i, 'use_parbox 0') + i = i + 1 + lines.insert(i, 'width' + width) + i = i + 1 + lines.insert(i, 'special "none"') + i = i + 1 + lines.insert(i, 'height' + height) + i = i + 1 + lines.insert(i, 'height_special "totalheight"') + i = i + 1 + +def convert(header, body): + convert_minipage(body) + +if __name__ == "__main__": + pass diff --git a/lib/lyx2lyx/lyxrevert_229.py b/lib/lyx2lyx/lyxrevert_229.py new file mode 100644 index 0000000000..5a1a16d256 --- /dev/null +++ b/lib/lyx2lyx/lyxrevert_229.py @@ -0,0 +1,24 @@ +# This file is part of lyx2lyx +# Copyright (C) 2003 José Matos +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + + +def convert(header, body): + pass + +if __name__ == "__main__": + pass diff --git a/src/ChangeLog b/src/ChangeLog index 941f8fcaa9..304c8b37fa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-12-29 Jürgen Spitzmüller + + * buffer.C: increment format to 229. + 2003-12-28 Michael Schmitt * LaTeXFeatures.C: diff --git a/src/buffer.C b/src/buffer.C index 30a42b39da..ac553cbcd3 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -132,7 +132,7 @@ extern BufferList bufferlist; namespace { -const int LYX_FORMAT = 228; +const int LYX_FORMAT = 229; } // namespace anon