There are some white space errors in previous mail.
I am attaching text file with this mail that will give exact idea.
In this case now inset dimensions are dynamic as it will depend on position of 
inset.
Current implementation of dimensions has 3 members 
{wid - width,
 ascent - asc,
 des-descent}.
With three box implementation, I think we will need four members 

{ wid1-width of first row,
  wid2-width of last row,
  asc-ascent,
  des-descent}.

Now to compute dimensions, I have thought something like below:

max_width (Maximum width of current viewport)
(x,y) (current position)

There will be 2 cases:

1) text of inset has only one row:

    fig1:      
    
[[
    original inset text:
    This is inset text.

    with 3 box inset implementation:
    This is the normal text.[[This is inset text.]]This is the normal text 
again.
    
]]


    fig2:
    
[[
    original inset text:
    This is inset text.This is inset text.This is inset text.

    with 3 box inset implementation:
    This is the normal text.This is the normal text.[[This is inset text.This is
    inset text.]]This is the normal text again.
    
]]

           In this case, if (max_width - x) > width of row of original text
                                     then
                                     **fig1**
                                     w1=width of row of original text
                                          w2=0
                               else
                                     **fig2**
                                     w1= max_width - x
                                     w2= width of row of original text - w1
                                     
                                     
2) text of inset has more than one rows:

     fig3:

[[
    Original inset Text
    Foot This is the foonote which is pretty long, and what LyX would normally 
do is
    put this whole thing on a few lines by itself. What we want is for it 
toflow with
    the normal text.

    with 3 box inset implementation:
    This is the normal text. This is the normal text.[[Foot This is the foonote 
which 
    is pretty long, and what LyX would normally do is put this whole thing on a 
few 
    lines by itself. What we want is for it to flow with the normal text.]]This 
is the
    normal text again.
]]
    
    fig4:
    
[[
    Original inset text: 
    Foot This is the foonote which is pretty long, and what LyX would normally 
do is put this
    whole thing on a few lines by itself. What we want is for it to flow with 
the normal text.
    This is inset text. This is inset text. This is inset text.
 
    with 3 box inset implementation:
    This is the normal text. This is the normal text.[[Foot This is the foonote 
which is pretty 
    long, and what LyX would normally do is put this whole thing on a few lines 
by itself. What
    we want is for it to flow with the normal text.This is inset text. This is 
inset text. This
    is inset text.]] This is the normal text again.
]]
    
    
    In this case, 
                                w1= max_width - x
                                if (max_width - x) > width of last row of 
original text 
                                **fig3** 
                                then  
                                        w2= max_width + width of last row of 
original text - w1 
                                else
                                        **fig4** 
                                        w2= width of last row of original text 
- w1                                                  
                                        and there will be n+1 rows if original 
text of inset has n rows
                                        
Now with this implementation, I think I have to re-implement methods like 
TextMetrics:drawParagraph, TextMetrics:redoParagraph ,methods in rowPainter 
class and maybe some others because with current implementation, text is 
painted row by row and with new implementation of 3 box model of insets, I am 
breaking rows like in fig2,fig3 or fig4. With nested Insets complications may 
increase (I am not sure at this moment) .
                                

Reply via email to