ImageView::ImageView( QImage const& image, QImage const& downscaled_image, ImageTransformation const& xform) : ImageViewBase( image, downscaled_image, ImagePresentation(xform.transform(), xform.resultingPreCropArea()) ), m_handlePixmap(":/icons/aqua-sphere.png"), m_dragHandler(*this), m_zoomHandler(*this), m_xform(xform) { setMouseTracking(true); interactionState().setDefaultStatusTip( tr("Use Ctrl+Wheel to rotate or Ctrl+Shift+Wheel for finer rotation.") ); QString const tip(tr("Drag this handle to rotate the image.")); double const hit_radius = std::max<double>(0.5 * m_handlePixmap.width(), 15.0); for (int i = 0; i < 2; ++i) { m_handles[i].setHitRadius(hit_radius); m_handles[i].setPositionCallback( boost::bind(&ImageView::handlePosition, this, i) ); m_handles[i].setMoveRequestCallback( boost::bind(&ImageView::handleMoveRequest, this, i, _1) ); m_handles[i].setDragFinishedCallback( boost::bind(&ImageView::dragFinished, this) ); m_handleInteractors[i].setProximityStatusTip(tip); m_handleInteractors[i].setObject(&m_handles[i]); makeLastFollower(m_handleInteractors[i]); } m_zoomHandler.setFocus(ZoomHandler::CENTER); rootInteractionHandler().makeLastFollower(*this); rootInteractionHandler().makeLastFollower(m_dragHandler); rootInteractionHandler().makeLastFollower(m_zoomHandler); }
ImageView::ImageView( QImage const& image, QImage const& downscaled_image, ImageTransformation const& xform, PageLayout const& layout, IntrusivePtr<ProjectPages> const& pages, ImageId const& image_id, bool left_half_removed, bool right_half_removed) : ImageViewBase( image, downscaled_image, ImagePresentation(xform.transform(), xform.resultingPreCropArea()) ), m_ptrPages(pages), m_imageId(image_id), m_leftUnremoveButton(boost::bind(&ImageView::leftPageCenter, this)), m_rightUnremoveButton(boost::bind(&ImageView::rightPageCenter, this)), m_dragHandler(*this), m_zoomHandler(*this), m_handlePixmap(":/icons/aqua-sphere.png"), m_virtLayout(layout), m_leftPageRemoved(left_half_removed), m_rightPageRemoved(right_half_removed) { setMouseTracking(true); m_leftUnremoveButton.setClickCallback(boost::bind(&ImageView::unremoveLeftPage, this)); m_rightUnremoveButton.setClickCallback(boost::bind(&ImageView::unremoveRightPage, this)); if (m_leftPageRemoved) { makeLastFollower(m_leftUnremoveButton); } if (m_rightPageRemoved) { makeLastFollower(m_rightUnremoveButton); } setupCuttersInteraction(); rootInteractionHandler().makeLastFollower(*this); rootInteractionHandler().makeLastFollower(m_dragHandler); rootInteractionHandler().makeLastFollower(m_zoomHandler); }