Show
Ignore:
Timestamp:
06/26/07 07:07:49 (18 months ago)
Author:
jordi
Message:

Igor Vagulin sent a patch to change the Scroll and Text Selection ToggleAction? to RadioActions?.

Moved the implementation of PagePter?'s setMode() to its implementation file.

Fixed the selection of an empty rectangle.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/PDFDocument.cxx

    r277 r279  
    657657} 
    658658 
     659static void 
     660repairEmpty(PopplerRectangle& rect) 
     661{ 
     662    //rect must have be least 1x1 
     663    if(rect.y1 == rect.y2) 
     664        rect.y2++; 
     665    if(rect.x1 == rect.x2) 
     666        rect.x2++; 
     667} 
     668 
    659669void  
    660670PDFDocument::setTextSelection (DocumentRectangle *rect) 
     
    670680     
    671681    //for get text we must exchange y coordinate, don't ask me where logic here. 
    672     PopplerRectangle textRect = { rect->getX1(), 
    673                                   (pageHeight - rect->getY2()), 
    674                                   rect->getX2(), 
    675                                   (pageHeight - rect->getY1())}; 
     682    PopplerRectangle textRect = { rect->getX1() / getZoom(), 
     683                                  (pageHeight - rect->getY2() / getZoom()), 
     684                                  rect->getX2() * getZoom() / getZoom(), 
     685                                  (pageHeight - rect->getY1() / getZoom())}; 
     686    repairEmpty(textRect); 
     687 
    676688    gchar *text = poppler_page_get_text(page, &textRect); 
    677689    if(!text) 
     
    692704        g_free(text); 
    693705} 
     706 
    694707GdkRegion* 
    695708PDFDocument::getTextRegion (DocumentRectangle *r) 
     
    705718    rect.y1 = r->getY1() / getZoom(); 
    706719    rect.x2 = r->getX2() / getZoom(); 
    707     rect.y2 = r->getY2() / getZoom(); 
     720    rect.y2 = r->getY2() / getZoom();    
     721    repairEmpty(rect); 
    708722 
    709723    //calc selection size