Changeset View
Changeset View
Standalone View
Standalone View
src/wrtembed/KReportRuler_p.cpp
Show All 16 Lines | 1 | /* This file is part of the KDE project | |||
---|---|---|---|---|---|
17 | 17 | | |||
18 | You should have received a copy of the GNU Library General Public License | 18 | You should have received a copy of the GNU Library General Public License | ||
19 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to | ||
20 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
21 | Boston, MA 02110-1301, USA. | 21 | Boston, MA 02110-1301, USA. | ||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | #include "KReportRuler_p.h" | 24 | #include "KReportRuler_p.h" | ||
25 | #include "KReportDesign_p.h" | ||||
25 | #include "KReportZoomHandler_p.h" | 26 | #include "KReportZoomHandler_p.h" | ||
26 | 27 | | |||
27 | #include <QPainter> | 28 | #include <QPainter> | ||
28 | #include <QMenu> | 29 | #include <QMenu> | ||
29 | #include <QMouseEvent> | 30 | #include <QMouseEvent> | ||
30 | #include <QFontDatabase> | 31 | #include <QFontDatabase> | ||
31 | 32 | | |||
32 | // the distance in pixels of a mouse position considered outside the rule | 33 | // the distance in pixels of a mouse position considered outside the rule | ||
▲ Show 20 Lines • Show All 819 Lines • ▼ Show 20 Line(s) | 841 | { | |||
852 | while (i.hasNext() && i.hasPrevious()) { | 853 | while (i.hasNext() && i.hasPrevious()) { | ||
853 | drawDistanceLine(d, painter, i.peekPrevious(), i.peekNext()); | 854 | drawDistanceLine(d, painter, i.peekPrevious(), i.peekNext()); | ||
854 | i.next(); | 855 | i.next(); | ||
855 | } | 856 | } | ||
856 | } | 857 | } | ||
857 | 858 | | |||
858 | KReportRuler::Private::Private(KReportRuler *parent, | 859 | KReportRuler::Private::Private(KReportRuler *parent, | ||
859 | const KReportZoomHandler &zoomHandler, Qt::Orientation o) | 860 | const KReportZoomHandler &zoomHandler, Qt::Orientation o) | ||
860 | : unit(KReportUnit(KReportUnit::Point)), | 861 | : unit(DEFAULT_UNIT), | ||
861 | orientation(o), | 862 | orientation(o), | ||
862 | viewConverter(&zoomHandler), | 863 | viewConverter(&zoomHandler), | ||
863 | offset(0), | 864 | offset(0), | ||
864 | rulerLength(0), | 865 | rulerLength(0), | ||
865 | activeRangeStart(0), | 866 | activeRangeStart(0), | ||
866 | activeRangeEnd(0), | 867 | activeRangeEnd(0), | ||
867 | activeOverrideRangeStart(0), | 868 | activeOverrideRangeStart(0), | ||
868 | activeOverrideRangeEnd(0), | 869 | activeOverrideRangeEnd(0), | ||
Show All 28 Lines | |||||
897 | { | 898 | { | ||
898 | delete normalPaintingStrategy; | 899 | delete normalPaintingStrategy; | ||
899 | delete distancesPaintingStrategy; | 900 | delete distancesPaintingStrategy; | ||
900 | } | 901 | } | ||
901 | 902 | | |||
902 | qreal KReportRuler::Private::numberStepForUnit() const | 903 | qreal KReportRuler::Private::numberStepForUnit() const | ||
903 | { | 904 | { | ||
904 | switch(unit.type()) { | 905 | switch(unit.type()) { | ||
905 | case KReportUnit::Inch: | 906 | case KReportUnit::Type::Inch: | ||
906 | case KReportUnit::Centimeter: | 907 | case KReportUnit::Type::Centimeter: | ||
907 | case KReportUnit::Decimeter: | 908 | case KReportUnit::Type::Decimeter: | ||
908 | case KReportUnit::Millimeter: | 909 | case KReportUnit::Type::Millimeter: | ||
909 | return 1.0; | 910 | return 1.0; | ||
910 | case KReportUnit::Pica: | 911 | case KReportUnit::Type::Pica: | ||
911 | case KReportUnit::Cicero: | 912 | case KReportUnit::Type::Cicero: | ||
912 | return 10.0; | 913 | return 10.0; | ||
913 | case KReportUnit::Point: | 914 | case KReportUnit::Type::Point: | ||
914 | default: | 915 | default: | ||
915 | return 100.0; | 916 | return 100.0; | ||
916 | } | 917 | } | ||
917 | } | 918 | } | ||
918 | 919 | | |||
919 | qreal KReportRuler::Private::doSnapping(qreal value) const | 920 | qreal KReportRuler::Private::doSnapping(qreal value) const | ||
920 | { | 921 | { | ||
921 | qreal numberStep = unit.fromUserValue(numberStepForUnit()/4.0); | 922 | qreal numberStep = unit.fromUserValue(numberStepForUnit()/4.0); | ||
▲ Show 20 Lines • Show All 597 Lines • Show Last 20 Lines |