Here's the patch. An entry to FORMAT is still coming.
The new format will be 283.

Can I go ahead with this? The actual work has been in,
this just seals it.

Hmmm, should look at the documentation.

- Martin

Index: src/Buffer.cpp
===================================================================
--- src/Buffer.cpp      (revision 20094)
+++ src/Buffer.cpp      (working copy)
@@ -142,7 +142,7 @@
 
 namespace {
 
-int const LYX_FORMAT = 282;
+int const LYX_FORMAT = 283;
 
 } // namespace anon
 
Index: src/insets/InsetFlex.cpp
===================================================================
--- src/insets/InsetFlex.cpp    (revision 20094)
+++ src/insets/InsetFlex.cpp    (working copy)
@@ -78,7 +78,7 @@
 
 docstring const InsetFlex::editMessage() const
 {
-       return _("Opened CharStyle Inset");
+       return _("Opened Flex Inset");
 }
 
 
@@ -137,7 +137,7 @@
        FuncStatus & status) const
 {
        switch (cmd.action) {
-               // paragraph breaks not allowed in charstyle insets
+               // paragraph breaks not allowed in flex insets
                case LFUN_BREAK_PARAGRAPH:
                case LFUN_BREAK_PARAGRAPH_KEEP_LAYOUT:
                case LFUN_BREAK_PARAGRAPH_SKIP:
@@ -190,7 +190,7 @@
 
 void InsetFlexParams::write(ostream & os) const
 {
-       os << "CharStyle " << name << "\n";
+       os << "Flex " << name << "\n";
 }
 
 
@@ -200,7 +200,7 @@
                lex.next();
                string token = lex.getString();
 
-               if (token == "CharStyle") {
+               if (token == "Flex") {
                        lex.next();
                        name = lex.getString();
                }
Index: lib/lyx2lyx/LyX.py
===================================================================
--- lib/lyx2lyx/LyX.py  (revision 20094)
+++ lib/lyx2lyx/LyX.py  (working copy)
@@ -78,7 +78,7 @@
                    ("1_3",     [221], generate_minor_versions("1.3" , 7)),
                    ("1_4", range(222,246), generate_minor_versions("1.4" , 5)),
                    ("1_5", range(246,277), generate_minor_versions("1.5" , 1)),
-                   ("1_6", range(277,283), generate_minor_versions("1.6" , 0))]
+                   ("1_6", range(277,284), generate_minor_versions("1.6" , 0))]
 
 
 def formats_list():
Index: lib/lyx2lyx/lyx_1_6.py
===================================================================
--- lib/lyx2lyx/lyx_1_6.py      (revision 20094)
+++ lib/lyx2lyx/lyx_1_6.py      (working copy)
@@ -155,7 +155,26 @@
             break
         document.header[i : j + 1] = []
 
+def convert_flex(document):
+    "Convert CharStyle to Flex"
+    i = 0
+    while True:
+        i = find_token(document.body, "\\begin_inset CharStyle", i)
+        if i == -1:
+            return
+        document.body[i] = document.body[i].replace('\\begin_inset CharStyle', 
'\\begin_inset Flex')
 
+def revert_flex(document):
+    "Convert Flex to CharStyle"
+    i = 0
+    while True:
+        i = find_token(document.body, "\\begin_inset Flex", i)
+        if i == -1:
+            return
+        document.body[i] = document.body[i].replace('\\begin_inset Flex', 
'\\begin_inset CharStyle')
+
+
+
 ##
 # Conversion hub
 #
@@ -167,10 +186,12 @@
            [279, [long_charstyle_names]],
            [280, [axe_show_label]],
            [281, []],
-           [282, []]
+           [282, []],
+           [283, [convert_flex]]
           ]
 
 revert =  [
+           [282, [revert_flex]],
            [281, []],
            [280, [revert_begin_modules]],
            [279, [revert_show_label]],

Reply via email to