MCPcopy Create free account
hub / github.com/buggins/coolreader / invalidateCurrentSelection

Method invalidateCurrentSelection

cr3gui/src/linksdlg.cpp:328–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328void CRLinksDialog::invalidateCurrentSelection()
329{
330 if ( _currentButton != LINK ) {
331 _invalidateRect.left = _iconRects[0].left;
332 _invalidateRect.top = _iconRects[0].top;
333 _invalidateRect.right = _iconRects[1].right;
334 _invalidateRect.bottom = _iconRects[1].bottom;
335 CRLog::debug("invalidateCurrentSelection() : invalidating buttons rect");
336 return;
337 }
338 ldomXRange * link = _docview->getCurrentPageSelectedLink();
339 _invalidateRect.clear();
340 if ( !link ) {
341 CRLog::debug("invalidateCurrentSelection() : no current page selection found!");
342 return;
343 }
344 lvRect rc;
345 if ( link->getRect( rc ) ) {
346 CRLog::debug("link docRect { %d, %d, %d, %d }", rc.left, rc.top, rc.right, rc.bottom);
347#if 1
348 _invalidateRect.left = 0;
349 _invalidateRect.top = 0;
350 _invalidateRect.right = _wm->getScreen()->getWidth();
351 _invalidateRect.bottom = _wm->getScreen()->getHeight();
352#else
353 lvPoint topLeft = rc.topLeft();
354 lvPoint bottomRight = rc.bottomRight();
355 if ( _docview->docToWindowPoint(topLeft) && _docview->docToWindowPoint(bottomRight) ) {
356 rc.left = topLeft.x;
357 rc.top = topLeft.y;
358 rc.right = bottomRight.x;
359 rc.bottom = bottomRight.y;
360 CRLog::debug("invalidating link screenRect { %d, %d, %d, %d }", rc.left, rc.top, rc.right, rc.bottom);
361 _invalidateRect = rc;
362 } else {
363 CRLog::debug("link rect conversion error: invalidating full screen");
364 _invalidateRect.left = 0;
365 _invalidateRect.top = 0;
366 _invalidateRect.right = 600;
367 _invalidateRect.bottom = 800;
368 }
369#endif
370 } else {
371 CRLog::debug("invalidateCurrentSelection() : getRect failed for link!");
372 }
373}

Callers

nothing calls this directly

Calls 9

getScreenMethod · 0.80
topLeftMethod · 0.80
bottomRightMethod · 0.80
docToWindowPointMethod · 0.80
clearMethod · 0.45
getRectMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected