void KPrViewModeSlidesSorter::activate(KoPAViewMode *previousViewMode)
{
    Q_UNUSED(previousViewMode);
    KoPAView *view = dynamic_cast<KoPAView *>(m_view);
    if (view) {
        view->replaceCentralWidget(m_centralWidget);
    }
    m_slidesSorterView->setFocus(Qt::ActiveWindowFocusReason);
    updateToActivePageIndex();

    //setup signals
    connect(m_slidesSorterView,SIGNAL(indexChanged(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
    connect(m_slidesSorterView, SIGNAL(pressed(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
    connect(m_view->proxyObject, SIGNAL(activePageChanged()), this, SLOT(updateToActivePageIndex()));

    //change zoom saving slot
    connect(m_view->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), this, SLOT(updateZoom(KoZoomMode::Mode,qreal)));

    KPrView *kPrview = dynamic_cast<KPrView *>(m_view);
    if (kPrview) {
        disconnect(kPrview->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), kPrview, SLOT(zoomChanged(KoZoomMode::Mode,qreal)));
        m_view->zoomController()->zoomAction()->setZoomModes(KoZoomMode::ZOOM_CONSTANT);
        loadZoomConfig();
        disconnect(kPrview->deleteSelectionAction(), SIGNAL(triggered()), kPrview, SLOT(editDeleteSelection()));
        connect(kPrview->deleteSelectionAction(), SIGNAL(triggered()), this, SLOT(deleteSlide()));
    }
}
void KPrViewModeSlidesSorter::deactivate()
{
    // Give the resources back to the canvas
    m_canvas->resourceManager()->setResource(KoCanvasResourceManager::ShowTextShapeOutlines, QVariant(false));
    // Active the view as a basic but active one
    m_view->setActionEnabled(KoPAView::AllActions, true);
    m_view->doUpdateActivePage(m_view->activePage());
    KoPAView *view = dynamic_cast<KoPAView *>(m_view);
    if (view) {
        view->restoreCentralWidget();
    }

    //save zoom value
    saveZoomConfig(zoom());

    //change zoom saving slot and restore normal view zoom values
    disconnect(m_view->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), this, SLOT(updateZoom(KoZoomMode::Mode,qreal)));
    m_view->zoomController()->zoomAction()->setZoomModes(KoZoomMode::ZOOM_PAGE | KoZoomMode::ZOOM_WIDTH);
    m_view->setActivePage(m_view->kopaDocument()->pageByIndex(m_slidesSorterView->currentIndex().row(), false));

    KPrView *kPrview = dynamic_cast<KPrView *>(m_view);
    if (kPrview) {
        kPrview->restoreZoomConfig();
        connect(kPrview->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), kPrview, SLOT(zoomChanged(KoZoomMode::Mode,qreal)));
        connect(kPrview->deleteSelectionAction(), SIGNAL(triggered()), kPrview, SLOT(editDeleteSelection()));
        disconnect(kPrview->deleteSelectionAction(), SIGNAL(triggered()), this, SLOT(deleteSlide()));
    }
    disableEditActions();
}
Exemple #3
0
void SessionLapTimesChart::onZoomOut()
{
    ChartWidget::onZoomOut();
    if (scaleRectsStack.size() > 1)
        emit zoomChanged(first, last, tMin, tMax);
    else
        emit zoomChanged(first, last, -1, -1);
}
Exemple #4
0
void ZoomSlider::setZoom(double newZoom){
    if(this->zoomFactor != newZoom){
        this->zoomFactor = newZoom;
        adjustSlider();
        emit zoomChanged(zoomFactor);
    }
}
Exemple #5
0
void SessionLapTimesChart::calculateTransformFactors()
{    
    int firstLap, lastLap, size;
    findFirstAndLastLap(firstLap, lastLap, size);
    int sz = last-first+1;
    double xFactor = ((double)paintRect.width()) / ((double)sz);
    double yFactor = (((double)paintRect.height()) / (double)(tMax - tMin));

    first = firstLap + ceil((scaleRect.left() - paintRect.left()) / xFactor);
    if (first < 1)
        first = 1;

//	if (first >= driverData.lapData.size())
//		first = driverData.lapData.size() - 1;

    last = first + ceil((scaleRect.right() - scaleRect.left()) / xFactor);
    if (last > EventData::getInstance().getEventInfo().laps)
        last = EventData::getInstance().getEventInfo().laps;

    tMin = tMin + ceil((paintRect.bottom() - scaleRect.bottom()) / yFactor)-1;
    if (tMin < min)
        tMin = min;
    tMax = tMin + ceil((scaleRect.bottom() - scaleRect.top()) / yFactor);

    emit zoomChanged(first, last, tMin, tMax);
}
Exemple #6
0
void ViWaveWidgetGroup::updateBindings()
{
	ViWaveWidget *widget;
	ViWaveWidgetGroup::Action action;
	foreach(widget, mWidgets)
	{
		widget->disconnect(this);
		foreach(action, mActions)
		{
			if(action == ViWaveWidgetGroup::Zoom)
			{
				QObject::connect(widget, SIGNAL(zoomChanged(qint16)), this, SLOT(changeZoom(qint16)));
			}
			else if(action == ViWaveWidgetGroup::Pointer)
			{
				QObject::connect(widget, SIGNAL(pointerChanged(qint32)), this, SLOT(changePointer(qint32)));
			}
			else if(action == ViWaveWidgetGroup::Position)
			{
				QObject::connect(widget, SIGNAL(positionChanged(ViAudioPosition)), this, SLOT(changePosition(ViAudioPosition)));
			}
			else if(action == ViWaveWidgetGroup::Toolbars)
			{
				QObject::connect(widget, SIGNAL(toolbarsShown()), this, SLOT(showToolbars()));
				QObject::connect(widget, SIGNAL(toolbarsHidden()), this, SLOT(hideToolbars()));
			}
		}
	}
void PreviewWidget::zoomOut()
{
	m_currentZoom -= m_zoomStep;
	if (m_currentZoom < m_zoomMin)
		m_currentZoom = m_zoomMin;
	emit(zoomChanged((int)((m_currentZoom/((double)QDesktopWidget().screen()->width()/(screen_widthMM*10)))*100 + 0.5)));
}
void HistogramView::setAutoZoom()
{
    this->compute( true );

 // compute zoom

    unsigned long max_absolute_probability = 0;
    for( int min_huv = huv0; min_huv <= huv1 - signed( classSize ); min_huv += classSize )
    {
        unsigned long absolute_probability = 0;
        for( int huv = min_huv; huv < min_huv + signed( classSize ); ++huv )
        {
            absolute_probability += histogram[ huv + 1024 ];
        }
        max_absolute_probability = std::max( max_absolute_probability, absolute_probability );
    }

    const double max_relative_probability = ( scale( max_absolute_probability ) / scale( getSum() ) );
    const double max_class_density = max_relative_probability / classSize;
    zoom = std::max( 1., 1 / max_class_density );

 // emit notifier signals

    emit zoomChanged( zoom );

 // post repaint event

    this->update();
}
Exemple #9
0
void PaintWidget::wheelEvent( QWheelEvent * event )
{
	IRenderer* renderer = MapData::instance()->renderer();
	if ( renderer == NULL )
		return;

	// 15 degrees is a full mousewheel "click"
	int numDegrees = event->delta() / 8 + m_wheelDelta;
	int numSteps = numDegrees / 15;
	m_wheelDelta = numDegrees % 15;

	// limit zoom
	int newZoom = m_request.zoom + numSteps;
	if ( newZoom < 0 )
		newZoom = 0;
	if ( newZoom > m_maxZoom )
		newZoom = m_maxZoom;

	// avoid looping event calls
	if ( newZoom == m_request.zoom )
		return;

	// zoom in/out on current mouse position
	m_request.center = renderer->Move( width() / 2 - event->x(), height() / 2 - event->y(), m_request );
	m_request.zoom = newZoom;
	m_request.center = renderer->Move( event->x() - width() / 2, event->y() - height() / 2, m_request );

	emit zoomChanged( newZoom );
	update();
	event->accept();
}
Exemple #10
0
void
ViewCameraGL::initialize(const double& _radius,const Vector3& center)
{

  double _default_far_plane = 200;
  __view_angle = __default_view_angle;

  __radius = _radius;
  __center = center;

  double dist = (__radius)/tan((__default_view_angle/2)*GEOM_RAD);

  // distance of the eye to the center of the scene:
  __eye = Vector3(dist,__center.y(),__center.z());

  // we try to keep a ratio far plane / near plane less than 1000.
  // (cf FAQ MESA3D http/www.mesa3d.org)
  __far_plane = 12 * __radius;
  if (__far_plane < _default_far_plane)
      __far_plane = _default_far_plane;
  __near_plane = __far_plane / 800;

  updateActualViewAngle();

  int newstep = int(__radius/10);
  if(newstep < 1)newstep =1;
  if(newstep != __stepMove && newstep !=0){
    double r = (double)newstep / (double)__stepMove;
    __translation *= r;
    __stepMove=newstep;
    emit(stepMoveChanged(__stepMove));
    emit zoomChanged(__translation.x());
  }
}
Exemple #11
0
void ViewCameraGL::read(const QString& filename)
{
    QFile file(filename);
    if(file.exists() && file.open( QIODevice::ReadOnly )) {
    QTextStream stream ( &file );

        stream >> __azimuth >> __elevation;
        printf("%d\n",__azimuth);
        printf("%d\n",__elevation);
        stream >> __stepMove;
        printf("%i\n",__stepMove);

        IV(stream,__center);
        IV(stream,__eye);
        IV(stream,__translation);

        stream >> __radius >> __far_plane >> __near_plane;
    stream >> __default_view_angle >> __view_angle;
        int i = 0;
    stream >> i;
        __projectionmode = (i != 0);
    stream >> i;
        __geomsys = (i != 0);
//    emit azimuthChanged(QString::number(__azimuth));
//    emit elevationChanged(QString::number(__elevation));
//    emit zoomChanged(QString::number(__translation.x()));
    emit azimuthChanged(__azimuth);
    emit elevationChanged(__elevation);
    emit zoomChanged(__translation.x());
    emit farPlaneChanged(QString::number(__far_plane));
    emit nearPlaneChanged(QString::number(__near_plane));
    emit projectionChanged(__projectionmode);
    emit coordSysChanged(__geomsys);
    emit valueChanged();
        }
void ZoomableGraphicsView::relativeZoom(double step, bool centerOnCursor) {
	double tempSize = m_scaleValue + step;
	if (tempSize < m_minScaleValue) {
		m_scaleValue = m_minScaleValue;
		emit zoomOutOfRange(m_scaleValue);
		return;
	}
	if (tempSize > m_maxScaleValue) {
		m_scaleValue = m_maxScaleValue;
		emit zoomOutOfRange(m_scaleValue);
		return;
	}
	double tempScaleValue = tempSize/100;

	m_scaleValue = tempSize;

	//QPoint p = QCursor::pos();
	//QPoint q = this->mapFromGlobal(p);
	//QPointF r = this->mapToScene(q);

	QMatrix matrix;
	matrix.scale(tempScaleValue, tempScaleValue);
	if (centerOnCursor) {
		//this->setMatrix(QMatrix().translate(-r.x(), -r.y()) * matrix * QMatrix().translate(r.x(), r.y()));
        this->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
	}
	else {
		this->setTransformationAnchor(QGraphicsView::AnchorViewCenter);
	}
	this->setMatrix(matrix);

	emit zoomChanged(m_scaleValue);
}
Exemple #13
0
void MainWindow::previewChanged()
{
    disconnect(pageNumberComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentPageChanged(int)));
    disconnect(zoomComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(zoomChanged(QString)));

    QString str = QString::number(preview->currentPage());
    pageNumberComboBox->setCurrentIndex(pageNumberComboBox->findText(str));

    const int zoomFactor = qRound(preview->zoomFactor() * 100);
    zoomComboBox->setCurrentIndex(zoomComboBox->findText(QString("%1%").arg(zoomFactor)));

    connect(pageNumberComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentPageChanged(int)));
    connect(zoomComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(zoomChanged(QString)));

    pagesPane->setText(QString("%1/%2").arg(preview->currentPage()).arg(preview->pageCount()));
}
void CurvesView::wheelEvent(QGraphicsSceneWheelEvent * event){
    if(event->modifiers().testFlag(Qt::ShiftModifier)){ // zoom only when SHIFT key pressed
        if(!zoomStarted){
            zoomCenter = event->scenePos();
            qDebug() << "Zoom center" << zoomCenter;
            zoomStarted = true;
        }
        if (event->delta() == 0) {
            event->ignore();
            return;
        }
        zoomFactor += (event->delta()>0)?0.05:-0.05;
        zoomTo(zoomFactor);
        /*
        if(zoomFactor<0.1){
            zoomFactor = 0.1;
        }else if(zoomFactor > 20){
            zoomFactor = 20;
        }
        */
        // qDebug() << "Zoom factor: " << zoomFactor;
        //qreal sc = pow(1.25, numSteps); // I use scale factor 1.25
        emit zoomChanged(QPointF(zoomFactor,zoomFactor), zoomCenter);

        event->accept();

    }else{
        zoomStarted = false;
        event->ignore();
    }

}
Exemple #15
0
UBZoomPalette::UBZoomPalette(QWidget* parent)
    : UBFloatingPalette(Qt::BottomRightCorner, parent)
    , mIsExpanded(1)
{
    mBoardController = UBApplication::boardController;
    QLayout* layout = new QVBoxLayout(this);
    mCurrentZoomButton = new QPushButton(parent);
    mCurrentZoomButton->setStyleSheet(QString("QPushButton { color: white; background-color: transparent; border: none; font-family: Arial; font-weight: bold; font-size: 20px }"));
    mCurrentZoomButton->setFocusPolicy(Qt::NoFocus);
    connect(mCurrentZoomButton, SIGNAL(clicked(bool)), this, SLOT(showHideExtraButton()));
    connect(mBoardController, SIGNAL(zoomChanged(qreal)), this, SLOT(refreshPalette()));
    connect(mBoardController, SIGNAL(activeSceneChanged()), this, SLOT(refreshPalette()));

    mHundredButton = new QPushButton(parent);
    mHundredButton->setStyleSheet(QString("QPushButton { color: white; background-color: transparent; border: none; font-family: Arial; font-weight: bold; font-size: 20px }"));
    mHundredButton->setFocusPolicy(Qt::NoFocus);
    mHundredButton->setIcon(QIcon(":/images/stylusPalette/restoreZoom.png"));
    mHundredButton->setIconSize(QSize(42,42));
    connect(mHundredButton, SIGNAL(clicked(bool)), this, SLOT(goHundred()));

    layout->setContentsMargins(radius() + 15, 4, radius() + 15, 4);
    layout->addWidget(mHundredButton);
    layout->addWidget(mCurrentZoomButton);
    hide();
    refreshPalette();
}
Exemple #16
0
void Settings::setZoom(double zoom)
{
    if (zoom_ == zoom)
        return;
    zoom_ = zoom;
    emit zoomChanged(zoom);
}
Exemple #17
0
void ImageView::setZoom(double value) {
    if (value != m_zoom) {
        m_zoom = value;
        zoomChanged(m_zoom);
        update();
    }
}
Exemple #18
0
void MultiPageLayout::setZoom(double zoom)
{
    if(this->zoom != zoom )
    {
        this->zoom = zoom;
        emit zoomChanged(zoom);
    }
}
Exemple #19
0
void BrowserWidget::changeZoom(float zoomChangeFactor) {
    freezeTilesFor(1000 * 1000); // freeze forever ...
    webView->setScale(webView->scale() * zoomChangeFactor);
    horizontalScrollBar()->setValue(horizontalScrollBar()->value() * zoomChangeFactor);
    verticalScrollBar()->setValue(verticalScrollBar()->value() * zoomChangeFactor);
    freezeTilesFor(freezeForMsecsWhenZooming); // ... and unfreeze after that time
    emit zoomChanged(webView->scale());
}
void IPImageViewer::resizeEvent(QResizeEvent *)
{
    if(_zoomFitMode)
    {
        zoomFit();
        emit zoomChanged(zoomFactor());
    }
}
Exemple #21
0
void
ViewCameraGL::zooming(int dx, int dy)
{
  __translation.x() += dy*__stepMove;
  glInitProjectionMatrix();
  emit zoomChanged(__translation.x());
// emit zoomChanged(QString::number(__translation.x()));
}
void core::ZoomControl::setZoom(int percentaje)
{
	if(sbZoom->value() != percentaje){
		sbZoom->setValue(percentaje);

		emit zoomChanged(percentaje);
	}
}
void CurvesView::zoomTo(float z){
    zoomFactor = z;
    if(zoomFactor<0.1){
        zoomFactor = 0.1;
    }else if(zoomFactor > 20){
        zoomFactor = 20;
    }
    emit zoomChanged(QPointF(zoomFactor,zoomFactor), zoomCenter);
}
Exemple #24
0
void
ViewCameraGL::setZoom(int zoom)
{
  if(__translation.x() != zoom){
	__translation.x() = zoom;
	emit zoomChanged(__translation.x());
	emit valueChanged();
  }
}
Exemple #25
0
void ZoomSlider::setZoomValue(int zoomValue){
    double normalizedZoom = double(zoomValue)/double(zoomResolution);
    double newZoom = minZoom + (normalizedZoom*(maxZoom-minZoom));

    if(newZoom != zoomFactor){
        zoomFactor = newZoom;
        emit zoomChanged(newZoom);
    }
}
void DiagramToolBar::updateDiagramZoomLevel(const QString& level)
{
	QString zoomTextStr = level;
	QTextStream textStream(&zoomTextStr);
	qreal zoomLevel = 0;

	textStream >> zoomLevel;
	emit zoomChanged(zoomLevel / 100);
}
Exemple #27
0
void QtWebKitWebWidget::setZoom(int zoom)
{
	if (zoom != getZoom())
	{
		m_webView->setZoomFactor(qBound(0.1, ((qreal) zoom / 100), (qreal) 100));

		emit zoomChanged(zoom);
	}
}
Exemple #28
0
void BrowserWidget::resetZoom() {
    float scale = webView->scale();
    freezeTilesFor(1000 * 1000);
    webView->setScale(1);
    horizontalScrollBar()->setValue(horizontalScrollBar()->value() / scale);
    verticalScrollBar()->setValue(verticalScrollBar()->value() / scale);
    freezeTilesFor(freezeForMsecsWhenZooming); // ... and unfreeze after that time
    emit zoomChanged(1);
    newScene();
}
Exemple #29
0
void TreeView::wheelEvent(QWheelEvent *event) {
    if(event->modifiers() && Qt::ControlModifier) {
        qreal numDegrees = event->delta() / 8.0;
        qreal numSteps = numDegrees / 15.0;
        qreal factor = std::pow(1.125, numSteps);
        scale(factor, factor);  m_zoom *= factor;
        emit zoomChanged();
    } else
        QGraphicsView::wheelEvent(event);
}
Exemple #30
0
void ImageView::reset() {
    m_zoom = 1.0;
    m_resolution = 1.0;
    m_origin = QPoint(0, 0);
    zoomChanged(1);
    resolutionChanged(1);
    originXChanged(0);
    originYChanged(0);
    update();
}