void CardInfo::clearPixmapCacheMiss() { if (!pixmap) return; if (pixmap->isNull()) clearPixmapCache(); }
void CanvasMode_Magnifier::mouseReleaseEvent(QMouseEvent *m) { #ifdef GESTURE_FRAME_PREVIEW clearPixmapCache(); #endif // GESTURE_FRAME_PREVIEW const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); m_canvas->m_viewMode.m_MouseButtonPressed = false; m_canvas->resetRenderMode(); m->accept(); // m_view->stopDragTimer(); if (m_doc->appMode == modeMagnifier) { double sc = m_canvas->scale(); if (m_view->HaveSelRect) { QRect geom = m_view->redrawMarker->geometry().normalized(); geom = QRect(m_view->mapToGlobal(geom.topLeft()), m_view->mapToGlobal(geom.bottomRight())); FPoint nx = m_canvas->globalToCanvas(QPoint(geom.x() + geom.width() / 2, geom.y() + geom.height() / 2)); double scaleH = m_view->visibleWidth() / static_cast<double>(qMax(geom.width(), 1)); double scaleV = m_view->visibleHeight() / static_cast<double>(qMax(geom.height(), 1)); double scaleAdjust = qMax(0.5, qMin(scaleH, scaleV)); m_view->zoom(nx.x(), nx.y(), m_canvas->scale() * scaleAdjust, false); if (sc == m_canvas->scale()) { m_view->HaveSelRect = false; m_view->setRedrawMarkerShown(false); m_view->requestMode(submodePaintingDone); } m_view->setRedrawMarkerShown(false); } else { FPoint nx = mousePointDoc; int mx = qRound(nx.x()); int my = qRound(nx.y()); m_view->Magnify ? m_view->slotZoomIn(mx,my) : m_view->slotZoomOut(mx,my); if (sc == m_canvas->scale()) { m_view->HaveSelRect = false; m_view->requestMode(submodePaintingDone); } else { if (m->modifiers() & Qt::ShiftModifier) m_view->setCursor(IconManager::instance()->loadCursor("LupeZm.xpm")); else m_view->setCursor(IconManager::instance()->loadCursor("LupeZ.xpm")); } } } m_canvas->setRenderModeUseBuffer(false); m_doc->DragP = false; m_doc->leaveDrag = false; m_canvas->m_viewMode.operItemMoving = false; m_canvas->m_viewMode.operItemResizing = false; m_view->MidButt = false; //Make sure the Zoom spinbox and page selector dont have focus if we click on the canvas m_view->m_ScMW->zoomSpinBox->clearFocus(); m_view->m_ScMW->pageSelector->clearFocus(); }
void LvkInputImageWidget::clearPixmapCache() { for (int i = 0; i < PCACHE_ROW_SIZE; ++i) { clearPixmapCache(i); } _cacheId = NullId; }
void CardInfo::updatePixmapCache() { qDebug() << "Updating pixmap cache for" << name; clearPixmapCache(); loadPixmap(); emit pixmapUpdated(); }
void LvkInputImageWidget::clear() { _pixmap = QPixmap(); _zoom = 0; _c = pow(ZOOM_FACTOR, _zoom); _blendPixmap = QPixmap(); clearPixmapCache(); }
void CardInfo::clearPixmapCacheMiss() { QPixmap pixmap; if(!QPixmapCache::find(pixmapCacheKey, &pixmap)) return; if (pixmap.isNull()) clearPixmapCache(); }
void CanvasMode_CopyProperties::mouseReleaseEvent(QMouseEvent *m) { #ifdef GESTURE_FRAME_PREVIEW clearPixmapCache(); #endif // GESTURE_FRAME_PREVIEW const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); PageItem *currItem; m_canvas->m_viewMode.m_MouseButtonPressed = false; m_canvas->resetRenderMode(); m->accept(); // m_view->stopDragTimer(); if ((GetItem(&currItem)) && (m->button() == Qt::RightButton) && (!m_doc->DragP)) { createContextMenu(currItem, mousePointDoc.x(), mousePointDoc.y()); return; } }
void CanvasMode_FrameLinks::mouseReleaseEvent(QMouseEvent *m) { #ifdef GESTURE_FRAME_PREVIEW clearPixmapCache(); #endif // GESTURE_FRAME_PREVIEW const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); PageItem *currItem; m_canvas->m_viewMode.m_MouseButtonPressed = false; m_canvas->resetRenderMode(); m->accept(); // m_view->stopDragTimer(); //m_canvas->update(); //ugly in a mouseReleaseEvent!!!!!!! if ((GetItem(&currItem)) && (m->button() == Qt::RightButton) && (!m_doc->DragP)) { createContextMenu(currItem, mousePointDoc.x(), mousePointDoc.y()); return; } if ((m_doc->appMode == modeLinkFrames) || (m_doc->appMode == modeUnlinkFrames)) { m_view->updateContents(); if (m_doc->ElemToLink != 0) return; else { m_view->requestMode(submodePaintingDone); return; } } m_canvas->setRenderModeUseBuffer(false); m_doc->DragP = false; m_doc->leaveDrag = false; m_canvas->m_viewMode.operItemMoving = false; m_canvas->m_viewMode.operItemResizing = false; m_view->MidButt = false; for (int i = 0; i < m_doc->m_Selection->count(); ++i) m_doc->m_Selection->itemAt(i)->checkChanges(true); //Make sure the Zoom spinbox and page selector dont have focus if we click on the canvas m_view->zoomSpinBox->clearFocus(); m_view->pageSelector->clearFocus(); }
void CardDatabase::picsPathChanged() { pictureLoader->setPicsPath(settingsCache->getPicsPath()); clearPixmapCache(); }
CardInfo::~CardInfo() { clearPixmapCache(); }
void CanvasMode_Rotate::mouseReleaseEvent(QMouseEvent *m) { #ifdef GESTURE_FRAME_PREVIEW clearPixmapCache(); #endif // GESTURE_FRAME_PREVIEW const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); PageItem *currItem; m_canvas->m_viewMode.m_MouseButtonPressed = false; m_canvas->resetRenderMode(); m->accept(); // m_view->stopDragTimer(); if ((GetItem(&currItem)) && (m->button() == Qt::RightButton)) { createContextMenu(currItem, mousePointDoc.x(), mousePointDoc.y()); return; } m_inItemRotation = false; if (m_view->moveTimerElapsed() && (GetItem(&currItem))) { // m_view->stopDragTimer(); //Always start group transaction as a rotate action is generally a combination of //a change of rotation + a change of position if (!m_view->groupTransactionStarted() /*&& m_doc->m_Selection->isMultipleSelection()*/) { m_view->startGroupTransaction(Um::Rotate, "", Um::IRotate); } double newW = xy2Deg(mousePointDoc.x()-m_view->RCenter.x(), mousePointDoc.y()-m_view->RCenter.y()); //xy2Deg(m->x()/sc - m_view->RCenter.x(), m->y()/sc - m_view->RCenter.y()); if (m->modifiers() & Qt::ControlModifier) { newW=constrainAngle(newW, m_doc->toolSettings.constrain); m_view->oldW=constrainAngle(m_view->oldW, m_doc->toolSettings.constrain); //RotateGroup uses MoveBy so its pretty hard to constrain the result if (m_doc->m_Selection->isMultipleSelection()) m_doc->rotateGroup(newW-m_view->oldW, m_view->RCenter); else m_doc->RotateItem(newW, currItem->ItemNr); } else { if (m_doc->m_Selection->isMultipleSelection()) m_doc->rotateGroup(newW - m_view->oldW, m_view->RCenter); else m_doc->RotateItem(currItem->rotation() - (m_view->oldW - newW), currItem->ItemNr); } m_view->oldW = newW; m_canvas->setRenderModeUseBuffer(false); if (!m_doc->m_Selection->isMultipleSelection()) { m_doc->setRedrawBounding(currItem); currItem->OwnPage = m_doc->OnPage(currItem); if (currItem->asLine()) m_view->updateContents(); } } m_doc->RotMode = m_oldRotMode; m_view->RCenter = m_oldRotCenter; if (!PrefsManager::instance()->appPrefs.stickyTools) m_view->requestMode(modeNormal); else { int appMode = m_doc->appMode; m_view->requestMode(appMode); } if (GetItem(&currItem)) { if (m_doc->m_Selection->count() > 1) { m_doc->m_Selection->setGroupRect(); double x, y, w, h; m_doc->m_Selection->getGroupRect(&x, &y, &w, &h); m_view->updateContents(QRect(static_cast<int>(x-5), static_cast<int>(y-5), static_cast<int>(w+10), static_cast<int>(h+10))); } // Handled normally automatically by Selection in sendSignals() /*else currItem->emitAllToGUI();*/ } m_canvas->setRenderModeUseBuffer(false); m_doc->leaveDrag = false; m_view->MidButt = false; if (m_view->groupTransactionStarted()) { for (int i = 0; i < m_doc->m_Selection->count(); ++i) m_doc->m_Selection->itemAt(i)->checkChanges(true); m_view->endGroupTransaction(); } for (int i = 0; i < m_doc->m_Selection->count(); ++i) m_doc->m_Selection->itemAt(i)->checkChanges(true); //Make sure the Zoom spinbox and page selector dont have focus if we click on the canvas m_view->zoomSpinBox->clearFocus(); m_view->pageSelector->clearFocus(); }
LvkInputImageWidget::~LvkInputImageWidget() { clearPixmapCache(); }