Changeset View
Changeset View
Standalone View
Standalone View
views/kpView.cpp
Show First 20 Lines • Show All 420 Lines • ▼ Show 20 Line(s) | 420 | { | |||
---|---|---|---|---|---|
421 | return (viewY - origin ().y ()) * 100.0 / zoomLevelY (); | 421 | return (viewY - origin ().y ()) * 100.0 / zoomLevelY (); | ||
422 | } | 422 | } | ||
423 | 423 | | |||
424 | //--------------------------------------------------------------------- | 424 | //--------------------------------------------------------------------- | ||
425 | 425 | | |||
426 | // public | 426 | // public | ||
427 | QPoint kpView::transformViewToDoc (const QPoint &viewPoint) const | 427 | QPoint kpView::transformViewToDoc (const QPoint &viewPoint) const | ||
428 | { | 428 | { | ||
429 | return QPoint ((int) transformViewToDocX (viewPoint.x ()), | 429 | return QPoint (static_cast<int> (transformViewToDocX (viewPoint.x ())), | ||
430 | (int) transformViewToDocY (viewPoint.y ())); | 430 | static_cast<int> (transformViewToDocY (viewPoint.y ()))); | ||
431 | } | 431 | } | ||
432 | 432 | | |||
433 | //--------------------------------------------------------------------- | 433 | //--------------------------------------------------------------------- | ||
434 | 434 | | |||
435 | // public | 435 | // public | ||
436 | QRect kpView::transformViewToDoc (const QRect &viewRect) const | 436 | QRect kpView::transformViewToDoc (const QRect &viewRect) const | ||
437 | { | 437 | { | ||
438 | if (zoomLevelX () == 100 && zoomLevelY () == 100) | 438 | if (zoomLevelX () == 100 && zoomLevelY () == 100) | ||
Show All 28 Lines | |||||
467 | double kpView::transformDocToViewY (double docY) const | 467 | double kpView::transformDocToViewY (double docY) const | ||
468 | { | 468 | { | ||
469 | return (docY * zoomLevelY () / 100.0) + origin ().y (); | 469 | return (docY * zoomLevelY () / 100.0) + origin ().y (); | ||
470 | } | 470 | } | ||
471 | 471 | | |||
472 | // public | 472 | // public | ||
473 | QPoint kpView::transformDocToView (const QPoint &docPoint) const | 473 | QPoint kpView::transformDocToView (const QPoint &docPoint) const | ||
474 | { | 474 | { | ||
475 | return QPoint ((int) transformDocToViewX (docPoint.x ()), | 475 | return QPoint (static_cast<int> (transformDocToViewX (docPoint.x ())), | ||
476 | (int) transformDocToViewY (docPoint.y ())); | 476 | static_cast<int> (transformDocToViewY (docPoint.y ()))); | ||
477 | } | 477 | } | ||
478 | 478 | | |||
479 | // public | 479 | // public | ||
480 | QRect kpView::transformDocToView (const QRect &docRect) const | 480 | QRect kpView::transformDocToView (const QRect &docRect) const | ||
481 | { | 481 | { | ||
482 | if (zoomLevelX () == 100 && zoomLevelY () == 100) | 482 | if (zoomLevelX () == 100 && zoomLevelY () == 100) | ||
483 | { | 483 | { | ||
484 | return QRect (docRect.x () + origin ().x (), | 484 | return QRect (docRect.x () + origin ().x (), | ||
Show All 23 Lines | 507 | if (this == otherView) | |||
508 | return viewPoint; | 508 | return viewPoint; | ||
509 | 509 | | |||
510 | const double docX = transformViewToDocX (viewPoint.x ()); | 510 | const double docX = transformViewToDocX (viewPoint.x ()); | ||
511 | const double docY = transformViewToDocY (viewPoint.y ()); | 511 | const double docY = transformViewToDocY (viewPoint.y ()); | ||
512 | 512 | | |||
513 | const double otherViewX = otherView->transformDocToViewX (docX); | 513 | const double otherViewX = otherView->transformDocToViewX (docX); | ||
514 | const double otherViewY = otherView->transformDocToViewY (docY); | 514 | const double otherViewY = otherView->transformDocToViewY (docY); | ||
515 | 515 | | |||
516 | return QPoint ((int) otherViewX, (int) otherViewY); | 516 | return QPoint (static_cast<int> (otherViewX), static_cast<int> (otherViewY)); | ||
517 | } | 517 | } | ||
518 | 518 | | |||
519 | 519 | | |||
520 | // public | 520 | // public | ||
521 | int kpView::zoomedDocWidth () const | 521 | int kpView::zoomedDocWidth () const | ||
522 | { | 522 | { | ||
523 | return document () ? document ()->width () * zoomLevelX () / 100 : 0; | 523 | return document () ? document ()->width () * zoomLevelX () / 100 : 0; | ||
524 | } | 524 | } | ||
▲ Show 20 Lines • Show All 147 Lines • Show Last 20 Lines |