Re: imdonatello - r27301 - abiword/branches/gsoc2009tablelayout/src/text/fmt/xp

From: Martin Sevior <msevior_at_gmail.com>
Date: Sun Jul 19 2009 - 10:50:53 CEST

Nice little patch though :-)

Cheers

Nartin

On Sun, Jul 19, 2009 at 6:44 PM, Martin Edmund
Sevior<martines@unimelb.edu.au> wrote:
>
> HI Aditya,
>
> Please don't use "or" in boolean operations. Use the conventional C "||"
>
> ie,
>        if (row < 0 or row > getNumRows())
>
> should be:
>
>        if (row < 0 || row > getNumRows())
>
> etc.
>
> Cheers
>
> Martin
>
>
> -----Original Message-----
> From: owner-abisource-cvs-commit@abisource.com on behalf of cvs@abisource.com
> Sent: Sun 7/19/2009 2:09 PM
> To: abisource-cvs-commit@abisource.com
> Subject: imdonatello - r27301 - abiword/branches/gsoc2009tablelayout/src/text/fmt/xp
>
>
> Author: imdonatello
> Date: 2009-07-19 06:09:51 +0200 (Sun, 19 Jul 2009)
> New Revision: 27301
>
> Modified:
>   abiword/branches/gsoc2009tablelayout/src/text/fmt/xp/fp_TableContainer.cpp
> Log:
> Constant time implementation of fp_TableContainer::getYOfRow(...)
>
> Modified: abiword/branches/gsoc2009tablelayout/src/text/fmt/xp/fp_TableContainer.cpp
> ===================================================================
> --- abiword/branches/gsoc2009tablelayout/src/text/fmt/xp/fp_TableContainer.cpp  2009-07-19 04:05:22 UTC (rev 27300)
> +++ abiword/branches/gsoc2009tablelayout/src/text/fmt/xp/fp_TableContainer.cpp  2009-07-19 04:09:51 UTC (rev 27301)
> @@ -3071,56 +3071,17 @@
>  */
>  UT_sint32 fp_TableContainer::getYOfRow(UT_sint32 row)
>  {
> -       UT_sint32 i =0;
> -       UT_sint32 numCols = getNumCols();
> -       if(row > getNumRows())
> +       if (row < 0 or row > getNumRows())
>        {
>                return 0;
>        }
> -       fp_CellContainer * pCell = getCellAtRowColumn(0,0);
> -
> -       UT_sint32 iYRow = 0;
> -       if(pCell != NULL)
> +       else if (row == getNumRows())
>        {
> -               iYRow = pCell->getY();
> +               UT_sint32 lastRow = getNumRows() - 1;
> +               return getNthRow(lastRow)->y + getNthRow(lastRow)->spacing
> +                       + getNthRow(lastRow)->allocation;
>        }
> -       for(i=0; i< numCols; i++)
> -       {
> -               pCell = getCellAtRowColumn(0,i);
> -               if(pCell)
> -               {
> -                       UT_sint32 Y = pCell->getY();
> -                       if(Y < iYRow)
> -                       {
> -                               iYRow = Y;
> -                       }
> -               }
> -       }
> -       if(row == 0)
> -       {
> -               return iYRow;
> -       }
> -       xxx_UT_DEBUGMSG(("Looking for row %d numrows %d \n",row,getNumRows()));
> -       for(i=0; i < row; i++)
> -       {
> -               fp_TableRowColumn *pRow = getNthRow(i);
> -               if(pRow)
> -               {
> -                       iYRow += pRow->allocation;
> -                       iYRow += pRow->spacing;
> -               }
> -               xxx_UT_DEBUGMSG((" row %d Height here %d \n",i,iYRow));
> -       }
> -       if((row < getNumRows()) && (i > 0))
> -       {
> -               fp_TableRowColumn *pRow = getNthRow(i-1);
> -               if(pRow)
> -               {
> -                       iYRow -= pRow->spacing;
> -                       iYRow += pRow->spacing/2;
> -               }
> -       }
> -       return iYRow;
> +       return getNthRow(row)->y;
>  }
>
>  /*!
>
> -----------------------------------------------
> To unsubscribe from this list, send a message to
> abisource-cvs-commit-request@abisource.com with the word
> unsubscribe in the message body.
>
>
>
Received on Sun Jul 19 10:51:05 2009

This archive was generated by hypermail 2.1.8 : Sun Jul 19 2009 - 10:51:05 CEST