Krita Source Code Documentation
Loading...
Searching...
No Matches
KoRulerPrivate Class Reference

#include <KoRuler_p.h>

Classes

struct  HotSpotData
 

Public Types

enum  Selection {
  None , Tab , FirstLineIndent , ParagraphIndent ,
  EndIndent , HotSpot
}
 

Public Member Functions

qreal doSnapping (const qreal value) const
 
qreal effectiveActiveRangeEnd () const
 
qreal effectiveActiveRangeStart () const
 
void emitTabChanged ()
 
int hotSpotIndex (const QPoint &pos)
 
 KoRulerPrivate (KoRuler *parent, const KoViewConverter *vc, Qt::Orientation orientation)
 
qreal numberStepForUnit () const
 
Selection selectionAtPosition (const QPoint &pos, int *selectOffset=0)
 
 ~KoRulerPrivate ()
 

Public Attributes

qreal activeOverrideRangeEnd {0.0}
 
qreal activeOverrideRangeStart {0.0}
 
qreal activeRangeEnd {0.0}
 
qreal activeRangeStart {0.0}
 
int currentIndex {0}
 
KoRuler::Tab deletedTab
 
PaintingStrategydistancesPaintingStrategy {0}
 
qreal endIndent {0.0}
 
qreal firstLineIndent {0.0}
 
qreal firstSelectionBorder {0.0}
 
bool guideCreationStarted {false}
 
QList< HotSpotDatahotspots
 
int mouseCoordinate {0}
 
PaintingStrategynormalPaintingStrategy {0}
 
int offset { 0 }
 
const Qt::Orientation orientation
 
int originalIndex {0}
 
PaintingStrategypaintingStrategy {0}
 
qreal paragraphIndent {0.0}
 
qreal pixelStep {0.0}
 
QList< QAction * > popupActions
 
bool relativeTabs {false}
 
bool rightToLeft {false}
 
KoRulerruler {0}
 
qreal rulerLength {0.0}
 
qreal secondSelectionBorder {0.0}
 
Selection selected {None}
 
int selectOffset {0}
 
bool showIndents {false}
 
int showMousePosition {0}
 
bool showSelectionBorders {false}
 
bool showTabs {false}
 
RulerTabChoosertabChooser {0}
 
qreal tabDistance {0.0}
 
bool tabMoved {false}
 
QList< KoRuler::Tabtabs
 
KoUnit unit
 
const KoViewConverter *const viewConverter
 

Friends

class HorizontalPaintingStrategy
 
class VerticalPaintingStrategy
 

Detailed Description

Definition at line 112 of file KoRuler_p.h.

Member Enumeration Documentation

◆ Selection

Enumerator
None 
Tab 
FirstLineIndent 
ParagraphIndent 
EndIndent 
HotSpot 

Definition at line 159 of file KoRuler_p.h.

Constructor & Destructor Documentation

◆ KoRulerPrivate()

KoRulerPrivate::KoRulerPrivate ( KoRuler * parent,
const KoViewConverter * vc,
Qt::Orientation orientation )

Definition at line 666 of file KoRuler.cpp.

668 orientation(o),
669 viewConverter(vc),
670 offset(0),
671 rulerLength(0),
676 mouseCoordinate(-1),
681 showIndents(false),
684 endIndent(0),
685 showTabs(false),
686 relativeTabs(false),
687 tabMoved(false),
688 originalIndex(-1),
689 currentIndex(0),
690 rightToLeft(false),
691 selected(None),
692 selectOffset(0),
693 tabChooser(0),
694 normalPaintingStrategy(o == Qt::Horizontal ?
698 ruler(parent),
700 pixelStep(100.0)
701{
702}
qreal firstLineIndent
Definition KoRuler_p.h:139
bool guideCreationStarted
Definition KoRuler_p.h:183
friend class HorizontalPaintingStrategy
Definition KoRuler_p.h:196
RulerTabChooser * tabChooser
Definition KoRuler_p.h:172
KoRuler * ruler
Definition KoRuler_p.h:181
qreal paragraphIndent
Definition KoRuler_p.h:140
PaintingStrategy * paintingStrategy
Definition KoRuler_p.h:179
qreal activeRangeEnd
Definition KoRuler_p.h:127
int showMousePosition
Definition KoRuler_p.h:132
qreal firstSelectionBorder
Definition KoRuler_p.h:135
qreal secondSelectionBorder
Definition KoRuler_p.h:136
qreal activeOverrideRangeStart
Definition KoRuler_p.h:128
qreal activeOverrideRangeEnd
Definition KoRuler_p.h:129
const KoViewConverter *const viewConverter
Definition KoRuler_p.h:122
qreal activeRangeStart
Definition KoRuler_p.h:126
qreal rulerLength
Definition KoRuler_p.h:125
const Qt::Orientation orientation
Definition KoRuler_p.h:121
PaintingStrategy * distancesPaintingStrategy
Definition KoRuler_p.h:176
PaintingStrategy * normalPaintingStrategy
Definition KoRuler_p.h:175
Selection selected
Definition KoRuler_p.h:167
bool showSelectionBorders
Definition KoRuler_p.h:134
@ Point
Postscript point, 1/72th of an Inco.
Definition KoUnit.h:76
ChildIterator< value_type, is_const > parent(const ChildIterator< value_type, is_const > &it)
Definition KisForest.h:327

◆ ~KoRulerPrivate()

KoRulerPrivate::~KoRulerPrivate ( )

Definition at line 704 of file KoRuler.cpp.

705{
708}

References distancesPaintingStrategy, and normalPaintingStrategy.

Member Function Documentation

◆ doSnapping()

qreal KoRulerPrivate::doSnapping ( const qreal value) const
Returns
The rounding of value to the nearest multiple of stepValue

Definition at line 727 of file KoRuler.cpp.

728{
729 qreal numberStep = unit.fromUserValue(numberStepForUnit()/4.0);
730 return numberStep * qRound(value / numberStep);
731}
float value(const T *src, size_t ch)
qreal numberStepForUnit() const
Definition KoRuler.cpp:710
qreal fromUserValue(qreal value) const
Definition KoUnit.cpp:201

References KoUnit::fromUserValue(), numberStepForUnit(), unit, and value().

◆ effectiveActiveRangeEnd()

qreal KoRulerPrivate::effectiveActiveRangeEnd ( ) const

Definition at line 808 of file KoRuler.cpp.

809{
812 } else {
813 return activeRangeEnd;
814 }
815}

References activeOverrideRangeEnd, activeOverrideRangeStart, and activeRangeEnd.

◆ effectiveActiveRangeStart()

qreal KoRulerPrivate::effectiveActiveRangeStart ( ) const

Definition at line 799 of file KoRuler.cpp.

800{
803 } else {
804 return activeRangeStart;
805 }
806}

References activeOverrideRangeEnd, activeOverrideRangeStart, and activeRangeStart.

◆ emitTabChanged()

void KoRulerPrivate::emitTabChanged ( )

Definition at line 817 of file KoRuler.cpp.

818{
819 KoRuler::Tab tab;
820 if (currentIndex >= 0)
821 tab = tabs[currentIndex];
822 Q_EMIT ruler->tabChanged(originalIndex, currentIndex >= 0 ? &tab : 0);
823}
QList< KoRuler::Tab > tabs
Definition KoRuler_p.h:146
void tabChanged(int originalTabIndex, KoRuler::Tab *tab)
For paragraphs each tab definition is represented by this struct.
Definition KoRuler.h:43

References currentIndex, originalIndex, ruler, KoRuler::tabChanged(), and tabs.

◆ hotSpotIndex()

int KoRulerPrivate::hotSpotIndex ( const QPoint & pos)

Definition at line 784 of file KoRuler.cpp.

785{
786 for(int counter = 0; counter < hotspots.count(); counter++) {
787 bool hit;
788 if (orientation == Qt::Horizontal)
789 hit = qAbs(viewConverter->documentToViewX(hotspots[counter].position) - pos.x() + offset) < 3;
790 else
791 hit = qAbs(viewConverter->documentToViewY(hotspots[counter].position) - pos.y() + offset) < 3;
792
793 if (hit)
794 return counter;
795 }
796 return -1;
797}
QList< HotSpotData > hotspots
Definition KoRuler_p.h:156
virtual qreal documentToViewY(qreal documentY) const
virtual qreal documentToViewX(qreal documentX) const

References KoViewConverter::documentToViewX(), KoViewConverter::documentToViewY(), hotspots, offset, orientation, and viewConverter.

◆ numberStepForUnit()

qreal KoRulerPrivate::numberStepForUnit ( ) const

Definition at line 710 of file KoRuler.cpp.

711{
712 switch(unit.type()) {
713 case KoUnit::Inch:
717 return 1.0;
718 case KoUnit::Pica:
719 case KoUnit::Cicero:
720 return 10.0;
721 case KoUnit::Point:
722 default:
723 return pixelStep;
724 }
725}
KoUnit::Type type() const
Definition KoUnit.h:118
@ Centimeter
Definition KoUnit.h:78
@ Decimeter
Definition KoUnit.h:79
@ Pica
Definition KoUnit.h:80
@ Millimeter
Definition KoUnit.h:75
@ Inch
Definition KoUnit.h:77
@ Cicero
Definition KoUnit.h:81

References KoUnit::Centimeter, KoUnit::Cicero, KoUnit::Decimeter, KoUnit::Inch, KoUnit::Millimeter, KoUnit::Pica, pixelStep, KoUnit::Point, KoUnit::type(), and unit.

◆ selectionAtPosition()

KoRulerPrivate::Selection KoRulerPrivate::selectionAtPosition ( const QPoint & pos,
int * selectOffset = 0 )

Definition at line 733 of file KoRuler.cpp.

734{
735 const int height = ruler->height();
736 if (rightToLeft) {
738 if (pos.x() >= x - 8 && pos.x() <= x +8 && pos.y() < height / 2) {
739 if (selectOffset)
740 *selectOffset = x - pos.x();
742 }
743
745 if (pos.x() >= x - 8 && pos.x() <= x +8 && pos.y() > height / 2) {
746 if (selectOffset)
747 *selectOffset = x - pos.x();
749 }
750
752 if (pos.x() >= x - 8 && pos.x() <= x + 8) {
753 if (selectOffset)
754 *selectOffset = x - pos.x();
756 }
757 }
758 else {
760 if (pos.x() >= x -8 && pos.x() <= x + 8 && pos.y() < height / 2) {
761 if (selectOffset)
762 *selectOffset = x - pos.x();
764 }
765
767 if (pos.x() >= x - 8 && pos.x() <= x + 8 && pos.y() > height/2) {
768 if (selectOffset)
769 *selectOffset = x - pos.x();
771 }
772
774 if (pos.x() >= x - 8 && pos.x() <= x + 8) {
775 if (selectOffset)
776 *selectOffset = x - pos.x();
778 }
779 }
780
782}
qreal effectiveActiveRangeEnd() const
Definition KoRuler.cpp:808
qreal effectiveActiveRangeStart() const
Definition KoRuler.cpp:799

References KoViewConverter::documentToViewX(), effectiveActiveRangeEnd(), effectiveActiveRangeStart(), endIndent, EndIndent, firstLineIndent, FirstLineIndent, None, offset, paragraphIndent, ParagraphIndent, rightToLeft, ruler, selectOffset, and viewConverter.

Friends And Related Symbol Documentation

◆ HorizontalPaintingStrategy

friend class HorizontalPaintingStrategy
friend

Definition at line 196 of file KoRuler_p.h.

◆ VerticalPaintingStrategy

friend class VerticalPaintingStrategy
friend

Definition at line 195 of file KoRuler_p.h.

Member Data Documentation

◆ activeOverrideRangeEnd

qreal KoRulerPrivate::activeOverrideRangeEnd {0.0}

Definition at line 129 of file KoRuler_p.h.

129{0.0};

◆ activeOverrideRangeStart

qreal KoRulerPrivate::activeOverrideRangeStart {0.0}

Definition at line 128 of file KoRuler_p.h.

128{0.0};

◆ activeRangeEnd

qreal KoRulerPrivate::activeRangeEnd {0.0}

Definition at line 127 of file KoRuler_p.h.

127{0.0};

◆ activeRangeStart

qreal KoRulerPrivate::activeRangeStart {0.0}

Definition at line 126 of file KoRuler_p.h.

126{0.0};

◆ currentIndex

int KoRulerPrivate::currentIndex {0}

Definition at line 148 of file KoRuler_p.h.

148{0}; //index of selected tab or selected HotSpot - only valid when selected indicates tab or hotspot

◆ deletedTab

KoRuler::Tab KoRulerPrivate::deletedTab

Definition at line 149 of file KoRuler_p.h.

◆ distancesPaintingStrategy

PaintingStrategy* KoRulerPrivate::distancesPaintingStrategy {0}

Definition at line 176 of file KoRuler_p.h.

176{0};

◆ endIndent

qreal KoRulerPrivate::endIndent {0.0}

Definition at line 141 of file KoRuler_p.h.

141{0.0};

◆ firstLineIndent

qreal KoRulerPrivate::firstLineIndent {0.0}

Definition at line 139 of file KoRuler_p.h.

139{0.0};

◆ firstSelectionBorder

qreal KoRulerPrivate::firstSelectionBorder {0.0}

Definition at line 135 of file KoRuler_p.h.

135{0.0};

◆ guideCreationStarted

bool KoRulerPrivate::guideCreationStarted {false}

Definition at line 183 of file KoRuler_p.h.

183{false};

◆ hotspots

QList<HotSpotData> KoRulerPrivate::hotspots

Definition at line 156 of file KoRuler_p.h.

◆ mouseCoordinate

int KoRulerPrivate::mouseCoordinate {0}

Definition at line 131 of file KoRuler_p.h.

131{0};

◆ normalPaintingStrategy

PaintingStrategy* KoRulerPrivate::normalPaintingStrategy {0}

Definition at line 175 of file KoRuler_p.h.

175{0};

◆ offset

int KoRulerPrivate::offset { 0 }

Definition at line 124 of file KoRuler_p.h.

124{ 0 };

◆ orientation

const Qt::Orientation KoRulerPrivate::orientation

Definition at line 121 of file KoRuler_p.h.

◆ originalIndex

int KoRulerPrivate::originalIndex {0}

Definition at line 147 of file KoRuler_p.h.

147{0}; //index of selected tab before we started dragging it.

◆ paintingStrategy

PaintingStrategy* KoRulerPrivate::paintingStrategy {0}

Definition at line 179 of file KoRuler_p.h.

179{0};

◆ paragraphIndent

qreal KoRulerPrivate::paragraphIndent {0.0}

Definition at line 140 of file KoRuler_p.h.

140{0.0};

◆ pixelStep

qreal KoRulerPrivate::pixelStep {0.0}

Definition at line 185 of file KoRuler_p.h.

185{0.0};

◆ popupActions

QList<QAction*> KoRulerPrivate::popupActions

Definition at line 170 of file KoRuler_p.h.

◆ relativeTabs

bool KoRulerPrivate::relativeTabs {false}

Definition at line 144 of file KoRuler_p.h.

144{false};

◆ rightToLeft

bool KoRulerPrivate::rightToLeft {false}

Definition at line 158 of file KoRuler_p.h.

158{false};

◆ ruler

KoRuler* KoRulerPrivate::ruler {0}

Definition at line 181 of file KoRuler_p.h.

181{0};

◆ rulerLength

qreal KoRulerPrivate::rulerLength {0.0}

Definition at line 125 of file KoRuler_p.h.

125{0.0};

◆ secondSelectionBorder

qreal KoRulerPrivate::secondSelectionBorder {0.0}

Definition at line 136 of file KoRuler_p.h.

136{0.0};

◆ selected

Selection KoRulerPrivate::selected {None}

Definition at line 167 of file KoRuler_p.h.

167{None};

◆ selectOffset

int KoRulerPrivate::selectOffset {0}

Definition at line 168 of file KoRuler_p.h.

168{0};

◆ showIndents

bool KoRulerPrivate::showIndents {false}

Definition at line 138 of file KoRuler_p.h.

138{false};

◆ showMousePosition

int KoRulerPrivate::showMousePosition {0}

Definition at line 132 of file KoRuler_p.h.

132{0};

◆ showSelectionBorders

bool KoRulerPrivate::showSelectionBorders {false}

Definition at line 134 of file KoRuler_p.h.

134{false};

◆ showTabs

bool KoRulerPrivate::showTabs {false}

Definition at line 143 of file KoRuler_p.h.

143{false};

◆ tabChooser

RulerTabChooser* KoRulerPrivate::tabChooser {0}

Definition at line 172 of file KoRuler_p.h.

172{0};

◆ tabDistance

qreal KoRulerPrivate::tabDistance {0.0}

Definition at line 150 of file KoRuler_p.h.

150{0.0};

◆ tabMoved

bool KoRulerPrivate::tabMoved {false}

Definition at line 145 of file KoRuler_p.h.

145{false}; // set to true on first move of a selected tab

◆ tabs

QList<KoRuler::Tab> KoRulerPrivate::tabs

Definition at line 146 of file KoRuler_p.h.

◆ unit

KoUnit KoRulerPrivate::unit

Definition at line 120 of file KoRuler_p.h.

◆ viewConverter

const KoViewConverter* const KoRulerPrivate::viewConverter

Definition at line 122 of file KoRuler_p.h.


The documentation for this class was generated from the following files: