Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tusooa Zhu
Krita
Commits
348e440e
Commit
348e440e
authored
May 26, 2006
by
Thomas Zander
Browse files
replace KoShape::boundingBox with KoShape::boundingRect
svn path=/trunk/koffice/; revision=544820
parent
febb7675
Changes
12
Hide whitespace changes
Inline
Side-by-side
libs/flake/KoInteractionTool.cpp
View file @
348e440e
...
...
@@ -84,7 +84,7 @@ void KoInteractionTool::paint( QPainter &painter, KoViewConverter &converter) {
painter
.
setPen
(
pen
);
bool
editable
=
false
;
foreach
(
KoShape
*
shape
,
selection
()
->
selectedObjects
(
KoFlake
::
StrippedSelection
))
{
painter
.
drawRect
(
converter
.
normalToView
(
shape
->
bounding
Box
())
);
painter
.
drawRect
(
converter
.
normalToView
(
shape
->
bounding
Rect
())
);
if
(
!
shape
->
isLocked
())
editable
=
true
;
}
...
...
@@ -92,7 +92,7 @@ void KoInteractionTool::paint( QPainter &painter, KoViewConverter &converter) {
if
(
!
editable
)
return
;
SelectionDecorator
decorator
(
selection
()
->
bounding
Box
(),
m_lastHandle
,
true
,
true
);
SelectionDecorator
decorator
(
selection
()
->
bounding
Rect
(),
m_lastHandle
,
true
,
true
);
decorator
.
paint
(
painter
,
converter
);
}
}
...
...
@@ -125,7 +125,7 @@ void KoInteractionTool::mouseMoveEvent( KoGfxEvent *event ) {
}
QRectF
KoInteractionTool
::
handlesSize
()
{
QRectF
bound
=
selection
()
->
bounding
Box
();
QRectF
bound
=
selection
()
->
bounding
Rect
();
// expansion Border
QPointF
border
=
m_canvas
->
viewConverter
()
->
viewToNormal
(
QPointF
(
HANDLE_DISTANCE
,
HANDLE_DISTANCE
));
bound
.
adjust
(
-
border
.
x
(),
-
border
.
y
(),
border
.
x
(),
border
.
y
());
...
...
@@ -207,7 +207,7 @@ KoFlake::SelectionHandle KoInteractionTool::handleAt(const QPointF &point, bool
}
void
KoInteractionTool
::
recalcSelectionBox
()
{
QRectF
bb
(
selection
()
->
bounding
Box
()
);
QRectF
bb
(
selection
()
->
bounding
Rect
()
);
float
width
=
bb
.
width
();
float
height
=
bb
.
height
();
float
halfWidth
=
width
/
2.0
;
...
...
libs/flake/KoPathShape.cpp
View file @
348e440e
...
...
@@ -86,7 +86,7 @@ bool KoPathShape::hitTest( const QPointF &position ) const
return
m_path
.
contains
(
point
);
}
QRectF
KoPathShape
::
bounding
Box
()
const
QRectF
KoPathShape
::
bounding
Rect
()
const
{
QRectF
bb
(
m_path
.
boundingRect
()
);
bb
.
moveTopLeft
(
position
()
);
...
...
libs/flake/KoPathShape.h
View file @
348e440e
...
...
@@ -43,7 +43,7 @@ public:
void
close
();
bool
hitTest
(
const
QPointF
&
position
)
const
;
virtual
QRectF
bounding
Box
()
const
;
virtual
QRectF
bounding
Rect
()
const
;
virtual
const
QPainterPath
outline
()
const
;
private:
...
...
libs/flake/KoSelection.cpp
View file @
348e440e
...
...
@@ -42,7 +42,7 @@ void KoSelection::paint( QPainter &painter, KoViewConverter &converter)
if
(
count
()
==
0
)
return
;
painter
.
setRenderHint
(
QPainter
::
Antialiasing
,
false
);
QRectF
bb
=
converter
.
normalToView
(
bounding
Box
()
);
QRectF
bb
=
converter
.
normalToView
(
bounding
Rect
()
);
QPen
pen
(
Qt
::
blue
);
//TODO make it configurable
painter
.
setPen
(
pen
);
painter
.
drawRect
(
bb
);
...
...
@@ -97,7 +97,7 @@ void KoSelection::requestSelectionChangedEvent() {
void
KoSelection
::
selectionChangedEvent
()
{
m_eventTriggered
=
false
;
QRectF
bb
(
bounding
Box
()
);
QRectF
bb
(
bounding
Rect
()
);
resize
(
bb
.
size
()
);
setPosition
(
bb
.
topLeft
()
);
emit
selectionChanged
();
...
...
@@ -112,7 +112,7 @@ bool KoSelection::hitTest( const QPointF &position ) const
{
if
(
count
()
>
1
)
{
QRectF
bb
(
bounding
Box
()
);
QRectF
bb
(
bounding
Rect
()
);
return
bb
.
contains
(
position
);
}
else
if
(
count
()
==
1
)
...
...
@@ -121,7 +121,7 @@ bool KoSelection::hitTest( const QPointF &position ) const
return
false
;
}
QRectF
KoSelection
::
bounding
Box
()
const
QRectF
KoSelection
::
bounding
Rect
()
const
{
bool
first
=
true
;
QRectF
bb
;
...
...
@@ -132,11 +132,11 @@ QRectF KoSelection::boundingBox() const
if
(
dynamic_cast
<
KoShapeGroup
*>
(
*
it
))
continue
;
if
(
first
)
{
bb
=
(
*
it
)
->
bounding
Box
();
bb
=
(
*
it
)
->
bounding
Rect
();
first
=
false
;
}
else
bb
=
bb
.
unite
(
(
*
it
)
->
bounding
Box
()
);
bb
=
bb
.
unite
(
(
*
it
)
->
bounding
Rect
()
);
}
}
return
bb
;
...
...
libs/flake/KoSelection.h
View file @
348e440e
...
...
@@ -74,7 +74,7 @@ public:
virtual
bool
hitTest
(
const
QPointF
&
position
)
const
;
virtual
QRectF
bounding
Box
()
const
;
virtual
QRectF
bounding
Rect
()
const
;
signals:
/// emitted when the selection is changed
...
...
libs/flake/KoShape.cpp
View file @
348e440e
...
...
@@ -131,7 +131,7 @@ bool KoShape::hitTest( const QPointF &position ) const
return
hit
;
}
QRectF
KoShape
::
bounding
Box
()
const
QRectF
KoShape
::
bounding
Rect
()
const
{
QRectF
bb
(
QPointF
(
0
,
0
),
m_size
);
return
m_matrix
.
mapRect
(
bb
);
...
...
libs/flake/KoShape.h
View file @
348e440e
...
...
@@ -180,7 +180,7 @@ public:
*
* @return the bounding box of the shape
*/
virtual
QRectF
bounding
Box
()
const
;
virtual
QRectF
bounding
Rect
()
const
;
/**
* @brief Add a connector point to the shape
...
...
libs/flake/KoShapeManager.cpp
View file @
348e440e
...
...
@@ -85,7 +85,7 @@ void KoShapeManager::paint( QPainter &painter, KoViewConverter &converter, bool
if
(
shape
->
parent
()
!=
0
&&
shape
->
parent
()
->
childClipped
(
shape
))
continue
;
if
(
painter
.
hasClipping
())
{
QRectF
objectBox
=
shape
->
bounding
Box
();
QRectF
objectBox
=
shape
->
bounding
Rect
();
objectBox
=
converter
.
normalToView
(
objectBox
);
QRegion
objectRegion
=
QRegion
(
objectBox
.
toRect
());
...
...
libs/flake/KoShapeMoveStrategy.cpp
View file @
348e440e
...
...
@@ -38,16 +38,16 @@ KoShapeMoveStrategy::KoShapeMoveStrategy( KoTool *tool, KoCanvasBase *canvas, co
,
m_start
(
clicked
)
{
KoSelectionSet
selectedObjects
=
canvas
->
shapeManager
()
->
selection
()
->
selectedObjects
(
KoFlake
::
StrippedSelection
);
QRectF
bounding
Box
;
QRectF
bounding
Rect
;
foreach
(
KoShape
*
shape
,
selectedObjects
)
{
if
(
shape
->
isLocked
())
continue
;
m_selectedObjects
<<
shape
;
m_previousPositions
<<
shape
->
position
();
m_newPositions
<<
shape
->
position
();
bounding
Box
=
bounding
Box
.
unite
(
shape
->
bounding
Box
()
);
bounding
Rect
=
bounding
Rect
.
unite
(
shape
->
bounding
Rect
()
);
}
m_initialTopLeft
=
bounding
Box
.
topLeft
();
m_initialTopLeft
=
bounding
Rect
.
topLeft
();
}
void
KoShapeMoveStrategy
::
handleMouseMove
(
const
QPointF
&
point
,
Qt
::
KeyboardModifiers
modifiers
)
{
...
...
libs/flake/KoShapeResizeStrategy.cpp
View file @
348e440e
...
...
@@ -35,7 +35,7 @@ KoShapeResizeStrategy::KoShapeResizeStrategy( KoTool *tool, KoCanvasBase *canvas
m_selectedObjects
<<
shape
;
m_startPositions
<<
shape
->
absolutePosition
();
m_startSizes
<<
shape
->
size
();
m_initialBoundingRect
=
m_initialBoundingRect
.
unite
(
shape
->
bounding
Box
()
);
m_initialBoundingRect
=
m_initialBoundingRect
.
unite
(
shape
->
bounding
Rect
()
);
}
m_start
=
clicked
;
...
...
@@ -146,6 +146,6 @@ KCommand* KoShapeResizeStrategy::createCommand() {
}
void
KoShapeResizeStrategy
::
paint
(
QPainter
&
painter
,
KoViewConverter
&
converter
)
{
SelectionDecorator
decorator
(
m_canvas
->
shapeManager
()
->
selection
()
->
bounding
Box
(),
KoFlake
::
NoHandle
,
false
,
false
);
SelectionDecorator
decorator
(
m_canvas
->
shapeManager
()
->
selection
()
->
bounding
Rect
(),
KoFlake
::
NoHandle
,
false
,
false
);
decorator
.
paint
(
painter
,
converter
);
}
libs/flake/KoShapeRotateStrategy.cpp
View file @
348e440e
...
...
@@ -41,7 +41,7 @@ KoShapeRotateStrategy::KoShapeRotateStrategy( KoTool *tool, KoCanvasBase *canvas
m_selectedObjects
<<
shape
;
m_startPositions
<<
shape
->
absolutePosition
();
m_initialAngles
<<
shape
->
rotation
();
m_initialBoundingRect
=
m_initialBoundingRect
.
unite
(
shape
->
bounding
Box
()
);
m_initialBoundingRect
=
m_initialBoundingRect
.
unite
(
shape
->
bounding
Rect
()
);
}
}
...
...
@@ -76,7 +76,7 @@ void KoShapeRotateStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardMo
}
void
KoShapeRotateStrategy
::
paint
(
QPainter
&
painter
,
KoViewConverter
&
converter
)
{
SelectionDecorator
decorator
(
m_canvas
->
shapeManager
()
->
selection
()
->
bounding
Box
(),
KoFlake
::
NoHandle
,
true
,
false
);
SelectionDecorator
decorator
(
m_canvas
->
shapeManager
()
->
selection
()
->
bounding
Rect
(),
KoFlake
::
NoHandle
,
true
,
false
);
decorator
.
paint
(
painter
,
converter
);
}
...
...
libs/flake/KoShapeRubberSelectStrategy.cpp
View file @
348e440e
...
...
@@ -91,8 +91,8 @@ void KoShapeRubberSelectStrategy::finishInteraction()
const
QList
<
KoShape
*>
&
objects
=
m_canvas
->
shapeManager
()
->
objects
();
foreach
(
KoShape
*
object
,
objects
)
{
//qDebug() << "o bb:" << object->bounding
Box
() << ", m_selectRect:" << m_selectRect;
if
(
object
->
bounding
Box
().
intersects
(
m_selectRect
)
)
//qDebug() << "o bb:" << object->bounding
Rect
() << ", m_selectRect:" << m_selectRect;
if
(
object
->
bounding
Rect
().
intersects
(
m_selectRect
)
)
{
selection
->
select
(
object
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment