Show
Ignore:
Timestamp:
10/20/07 15:17:40 (1 year ago)
Author:
daboo
Message:

Fix for drag and drop cell offset issues when lists are scrolled.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Mulberry/trunk/Linux/Sources/Support/Table/CTableDragAndDrop.cp

    r21 r108  
    268268{ 
    269269 
    270   // Clear existing cell hilight 
    271   ClearDropCell(mDropCell); 
     270        // Clear existing cell hilight 
     271        ClearDropCell(mDropCell); 
    272272 
    273273        // Cache the action for reference 
     
    292292                                { 
    293293                                        STableCell dropCell; 
    294                                         JPoint imagePt; 
    295                                         LocalToImagePoint(pt, imagePt); 
    296                                         if (GetCellHitBy(imagePt, dropCell) && IsDropCell(mCurrentDropFlavors, dropCell)) 
     294                                        if (GetCellHitBy(pt, dropCell) && IsDropCell(mCurrentDropFlavors, dropCell)) 
    297295                                        { 
    298296                                                if (mDropCursor) 
     
    300298                                                        // Check if close to edge of cell and drop cursor allowed 
    301299                                                        JRect rowRect; 
    302                                                         GetLocalCellRect(dropCell, rowRect); 
     300                                                        GetImageCellBounds(dropCell, rowRect); 
    303301                                                         
    304302                                                        if ((pt.y < rowRect.top + 2) || (pt.y > rowRect.bottom - 2)) 
     
    322320                                        // Get the hit cell 
    323321                                        STableCell      hitCell; 
    324                                         JPoint imagePt; 
    325                                         LocalToImagePoint(pt, imagePt); 
    326                                         GetCellHitBy(imagePt, hitCell); 
     322                                        GetCellHitBy(pt, hitCell); 
    327323 
    328324                                        JRect rowRect; 
    329                                         GetLocalCellRect(hitCell, rowRect); 
     325                                        GetImageCellBounds(hitCell, rowRect); 
    330326 
    331327                                        JPoint offset = pt; 
     
    333329 
    334330                                        // Get the hit cell 
    335                                         LocalToImagePoint(offset, imagePt); 
    336                                         GetCellHitBy(imagePt, hitCell); 
     331                                        GetCellHitBy(offset, hitCell); 
    337332                                         
    338333                                        if (mRows == 0) 
     
    377372void CTableDragAndDrop::HandleDNDHere(const JPoint& pt, const JXWidget* source) 
    378373{ 
    379         JPoint  imagePt; 
    380         LocalToImagePoint(pt, imagePt); 
    381  
    382374        bool hilite = false; 
    383375        STableCell lastDrop = mLastDropCell; 
     
    388380                // Get the hit cell 
    389381                STableCell      hitCell; 
    390                 GetCellHitBy(imagePt, hitCell); 
     382                GetCellHitBy(pt, hitCell); 
    391383                mLastHitCell = hitCell; 
    392384 
     
    398390                        // Check if close to edge of cell and drop cursor allowed 
    399391                        JRect rowRect; 
    400                         GetLocalCellRect(hitCell, rowRect); 
     392                        GetImageCellBounds(hitCell, rowRect); 
    401393                         
    402394                        if ((pt.y < rowRect.top + 2) || (pt.y > rowRect.bottom - 2)) 
     
    416408                // Get the hit cell 
    417409                STableCell      hitCell; 
    418                 GetCellHitBy(imagePt, hitCell); 
     410                GetCellHitBy(pt, hitCell); 
    419411 
    420412                JRect rowRect; 
    421                 GetLocalCellRect(hitCell, rowRect); 
    422  
    423                 JPoint offset = imagePt; 
     413                GetImageCellBounds(hitCell, rowRect); 
     414 
     415                JPoint offset = pt; 
    424416                offset += JPoint(0, rowRect.height()/2); 
    425417 
    426418                // Get the hit cell 
    427                 GetCellHitBy(imagePt, hitCell); 
     419                GetCellHitBy(offset, hitCell); 
    428420                 
    429421                if (!hilite) 
     
    548540                // Get row rect 
    549541                JRect rowRect; 
    550                 GetLocalCellRect(mLastDropCell, rowRect); 
    551  
     542                GetImageCellBounds(mLastDropCell, rowRect); 
    552543                p->RectInside(rowRect);  
    553544        } 
     
    558549                // Get row rect 
    559550                JRect rowRect; 
    560                 GetLocalCellRect(cell, rowRect); 
    561  
     551                GetImageCellBounds(cell, rowRect); 
    562552                p->RectInside(rowRect);  
    563553        } 
     
    594584                if (mLastDropCursor <= GetItemCount()) 
    595585                { 
    596                         GetLocalRowRect(mLastDropCursor.row, rowRect); 
     586                        GetImageCellBounds(mLastDropCursor.row, rowRect); 
    597587                        rowRect.bottom = rowRect.top + 2; 
    598588                } 
     
    601591                        STableCell temp = mLastDropCursor; 
    602592                        temp.row--; 
    603                         GetLocalRowRect(temp.row, rowRect); 
     593                        GetImageCellBounds(temp.row, rowRect); 
    604594                        rowRect.top = rowRect.bottom - 2; 
    605595                } 
     
    616606                if (cell.row <= GetItemCount()) 
    617607                { 
    618                         GetLocalRowRect(cell.row, rowRect); 
     608                        GetImageCellBounds(cell.row, rowRect); 
    619609                        rowRect.bottom = rowRect.top + 2; 
    620610                } 
     
    623613                        STableCell temp = cell; 
    624614                        temp.row--; 
    625                         GetLocalRowRect(temp.row, rowRect); 
     615                        GetImageCellBounds(temp.row, rowRect); 
    626616                        rowRect.top = rowRect.bottom - 2; 
    627617                }