Changeset 77 for trunk


Ignore:
Timestamp:
Jul 16, 2006, 1:40:26 PM (15 years ago)
Author:
Eugene Romanenko
Message:

Fix highlighting after changeset [74]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/SOURCE/gui/docViewer.cpp

    r74 r77  
    13011301void DocumentViewer::winPosToDocPos( PPOINTL startpoint, PPOINTL endpoint, LuRectangle *r )
    13021302{
    1303     r->x1 = ( startpoint->x + sHscrollPos ) / realzoom;
    1304     r->y1 = ( ( cyClient - startpoint->y ) + sVscrollPos ) / realzoom;
    1305     r->x2 = ( endpoint->x + sHscrollPos ) / realzoom;
    1306     r->y2 = ( ( cyClient - endpoint->y ) + sVscrollPos ) / realzoom;
     1303    LONG sx = startpoint->x;
     1304    LONG sy = startpoint->y;
     1305    LONG ex = endpoint->x;
     1306    LONG ey = endpoint->y;
     1307    if ( width < cxClient ) {
     1308        LONG xPos = ( cxClient - width ) / 2;
     1309        sx -= xPos;
     1310        ex -= xPos;
     1311    }
     1312    if ( height < cyClient ) {
     1313        LONG yPos = ( cyClient - height ) / 2;
     1314        sy += yPos;
     1315        ey += yPos;
     1316    }
     1317
     1318    r->x1 = ( sx + sHscrollPos ) / realzoom;
     1319    r->y1 = ( ( cyClient - sy ) + sVscrollPos ) / realzoom;
     1320    r->x2 = ( ex + sHscrollPos ) / realzoom;
     1321    r->y2 = ( ( cyClient - ey ) + sVscrollPos ) / realzoom;
    13071322
    13081323    rotateRectangle( currentpage, r );
     
    13131328void DocumentViewer::winPosToDocPos( PageDrawArea *pda, LuRectangle *r )
    13141329{
    1315     r->x1 = ( sHscrollPos + pda->drawrect.xLeft ) / realzoom;;
     1330    LONG sx = pda->drawrect.xLeft;
     1331    LONG ex = pda->drawrect.xRight;
     1332    double w = pagesizes[ pda->pagenum ].x * realzoom;
     1333    if ( w < cxClient ) {
     1334        LONG xPos = ( cxClient - w ) / 2;
     1335        sx -= xPos;
     1336        ex -= xPos;
     1337    }
     1338
     1339    r->x1 = ( sHscrollPos + sx ) / realzoom;;
    13161340    r->y1 = pda->startpos.y / realzoom;
    1317     r->x2 = ( ( pda->drawrect.xRight - pda->drawrect.xLeft ) / realzoom ) + r->x1;
     1341    r->x2 = ( ( ex - sx ) / realzoom ) + r->x1;
    13181342    r->y2 = ( ( pda->drawrect.yTop - pda->drawrect.yBottom ) / realzoom ) + r->y1;
    13191343
     
    13591383    rcl->xRight  = ( tmp_x2 * realzoom ) - sHscrollPos;
    13601384    rcl->yTop    = cyClient - ( yplus + ( tmp_y1 * realzoom ) ) + ( sVscrollPos * VScrollStep );
     1385
     1386    LONG pw = w * realzoom;
     1387    if ( pw < cxClient ) {
     1388        LONG xPos = ( cxClient - pw ) / 2;
     1389        rcl->xLeft  += xPos;
     1390        rcl->xRight += xPos;
     1391    }
     1392    if ( !continuous )
     1393    {
     1394        LONG ph = h * realzoom;
     1395        if ( ph < cyClient ) {
     1396            LONG yPos = ( cyClient - ph ) / 2;
     1397            rcl->yBottom -= yPos;
     1398            rcl->yTop    -= yPos;
     1399        }
     1400    }
    13611401}
    13621402
Note: See TracChangeset for help on using the changeset viewer.