Richard Heck wrote:

> On 10/16/2015 05:15 PM, Scott Kostyshak wrote:
>> On Fri, Oct 16, 2015 at 11:04:32PM +0200, Georg Baum wrote:
>>
>>>> In my opinion this is a serious regression. Many users have boxes.
>>> We should not release the alpha version with this regression IMHO.
>> OK. This issue is now considered a blocker of alpha.
> 
> Agreed. Georg, do you have an opinion what should be done here? I
> remember the discussion back in the day, but don't remember what options
> there were then.

I am not sure what to do. Since this regression is in for such a long time 
(about 5 months), it is not possible anymore to fix this for all cases. 
Whatever we do, we will silently change the output of some documents. This 
is what I found out (depending whether the new alignment handling is kept or 
not, see below for possible reasons not to keep it):

1) New alignment handling is kept: In this case the attached patch would fix 
lyx2lyx. All old documents which are converted with the patched lyx2lyx will 
be fine, all 2.2 documents that are created in format 489 or nwer will be 
fine as well. All old documents that have been converted with the unpatched 
lyx2lyx will produce wrong output for boxes with these parameters: makebox 
is not used and not (type Boxed and without inner box).

2) New alignment handling is not kept, first option: Do nothing in lyx2lyx, 
declare the new alignment handling a bug, remove the new alignment code from 
InsetBox.cpp and no additional format change. All 2.2 documents that were 
produced in format 489 or later until the alignment code revert will then 
produce wrong output for boxes with the parameters mentioned above.

3) New alignment handling is not kept, second option: Apply the attached 
patch, remove the new alignment code from InsetBox.cpp and do a new format 
change with lyx2lyx code to adjust the alignment settings. The documents 
that produce wrong output are the same ones as in 1).

What is wrong with the new alignment handling? It is IMHO confusing and not 
needed, we have paragraph alignment. Look at the attached example: I set the 
box alignment to centered, and the paragraph alignment to right. This will 
produce \centered \begin{flushright} which does not really make sense. I 
think we should try to be consistent and not offer different ways to do the 
same thing unless there is a very clear advantage (which I do not see in 
this case). Has this change been discussed on the list? If yes, then I 
missed it.

I do therefore vote for removing the new aligment handling again. I have no 
strong optinion whether we should prefer option 2) or 3). Basically we need 
to decide which is more important: Old documents imported into 2.2 during 
the last 5 months, or new documents created during the last 5 months? I 
slightly tend towards 2), also because it is less work.


Georg
diff --git a/development/FORMAT b/development/FORMAT
index 7861f62..e1c0cd1 100644
--- a/development/FORMAT
+++ b/development/FORMAT
@@ -59,6 +59,13 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
  	  - thickness
  	  - separation
  	  - shadowsize
+	  Previously, the horizontal position was ignored except for the
+	  following parameter combinations:
+	  - fixed width and type Boxed and without inner box
+	  - fixed width and any type   and with    inner box and with makebox
+	  Now, it is also used for the parameter combination below:
+	  - makebox is not used and not (type Boxed and without inner box)
+
 
 2015-04-21 Jürgen Spitzmüller <sp...@lyx.org>
  	* Format incremented to 488: Rewrite the Glosse insets (Glosse and Tri-Glosse).
diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py
index a09ad22..3c0672e 100644
--- a/lib/lyx2lyx/lyx_2_2.py
+++ b/lib/lyx2lyx/lyx_2_2.py
@@ -968,11 +968,23 @@ def convert_BoxFeatures(document):
 
     i = 0
     while True:
-        i = find_token(document.body, "height_special", i)
+        i = find_token(document.body, "\\begin_inset Box", i)
         if i == -1:
             return
-        document.body[i+1:i+1] = ['thickness "0.4pt"', 'separation "3pt"', 'shadowsize "4pt"']
-        i = i + 4
+        j = find_token(document.body, "height_special", i)
+        if j == -1:
+            document.warning("Malformed LyX document: Can't find height_special parameter of Box inset")
+            i += 1
+            continue
+        boxtype = get_value(document.body, "\\begin_inset Box", i, i+1, "Frameless")
+        use_makebox = get_value(document.body, "use_makebox", i, j, "0")
+        has_inner_box = get_value(document.body, "has_inner_box", i, j, "0")
+        if use_makebox == "0" and not (boxtype == "Boxed" and has_inner_box == 0):
+            k = find_token(document.body, "hor_pos", i, j)
+            if k != -1:
+                document.body[k:k+1] = ["hor_pos \"l\""]
+        document.body[j+1:j+1] = ['thickness "0.4pt"', 'separation "3pt"', 'shadowsize "4pt"']
+        i = j + 1
 
 
 def revert_BoxFeatures(document):

Attachment: boxtest.lyx
Description: application/lyx

Reply via email to