Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Okular
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Andi Sardina Ramos
Okular
Commits
383459da
Commit
383459da
authored
Jun 24, 2005
by
Enrico Ros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
applying patch_086,087 (tinyurl.com/8t5ec)
svn path=/branches/kpdf/annotations/kdegraphics/kpdf/; revision=428589
parent
a4b2be7c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
ui/pageview.cpp
ui/pageview.cpp
+16
-12
No files found.
ui/pageview.cpp
View file @
383459da
...
...
@@ -75,9 +75,10 @@ public:
QPoint
mousePressPos
;
bool
mouseMidZooming
;
int
mouseMidLastY
;
bool
mouse
OnRect
;
bool
mouse
Selecting
;
QRect
mouseSelectionRect
;
QColor
selectionRectColor
;
QColor
mouseSelectionColor
;
bool
mouseOnRect
;
// type ahead find
bool
typeAheadActive
;
...
...
@@ -135,6 +136,7 @@ PageView::PageView( QWidget *parent, KPDFDocument *document )
d
->
zoomFactor
=
1.0
;
d
->
mouseMode
=
MouseNormal
;
d
->
mouseMidZooming
=
false
;
d
->
mouseSelecting
=
false
;
d
->
mouseOnRect
=
false
;
d
->
typeAheadActive
=
false
;
d
->
findTimeoutTimer
=
0
;
...
...
@@ -471,7 +473,7 @@ void PageView::viewportPaintEvent( QPaintEvent * pe )
selectionRectInternal
.
addCoords
(
1
,
1
,
-
1
,
-
1
);
// color for blending
QColor
selBlendColor
=
(
selectionRect
.
width
()
>
8
||
selectionRect
.
height
()
>
8
)
?
d
->
selectionRect
Color
:
Qt
::
red
;
d
->
mouseSelection
Color
:
Qt
::
red
;
// subdivide region into rects
QMemArray
<
QRect
>
allRects
=
pe
->
region
().
rects
();
...
...
@@ -593,7 +595,7 @@ void PageView::keyPressEvent( QKeyEvent * e )
e
->
accept
();
// if performing a selection or dyn zooming, disable keys handling
if
(
!
d
->
mouseSelectionRect
.
isNull
()
||
d
->
mouseMidZooming
)
if
(
d
->
mouseSelecting
||
d
->
mouseMidZooming
)
return
;
// handle 'find as you type' (based on khtml/khtmlview.cpp)
...
...
@@ -871,7 +873,7 @@ void PageView::contentsMouseMoveEvent( QMouseEvent * e )
case
MouseZoom
:
case
MouseSelect
:
// set second corner of selection
if
(
(
leftButton
||
d
->
aPrevAction
)
&&
!
d
->
mouseSelectionRect
.
isNull
(
)
)
if
(
d
->
mouseSelecting
&&
(
leftButton
||
d
->
aPrevAction
)
)
selectionEndPoint
(
e
->
x
(),
e
->
y
()
);
break
;
}
...
...
@@ -884,8 +886,7 @@ void PageView::contentsMousePressEvent( QMouseEvent * e )
return
;
// if performing a selection or dyn zooming, disable mouse press
if
(
!
d
->
mouseSelectionRect
.
isNull
()
||
d
->
mouseMidZooming
||
d
->
viewportMoveActive
)
if
(
d
->
mouseSelecting
||
d
->
mouseMidZooming
||
d
->
viewportMoveActive
)
return
;
// if the page is scrolling, stop it
...
...
@@ -1026,7 +1027,7 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
case
MouseZoom
:
// if a selection rect has been defined, zoom into it
if
(
leftButton
&&
!
d
->
mouseSelectionRect
.
isNull
()
)
if
(
leftButton
&&
d
->
mouseSelecting
)
{
QRect
selRect
=
d
->
mouseSelectionRect
.
normalize
();
if
(
selRect
.
width
()
<=
8
&&
selRect
.
height
()
<=
8
)
...
...
@@ -1060,7 +1061,7 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
case
MouseSelect
:{
// if mouse is released and selection is null this is a rightClick
if
(
rightButton
&&
d
->
mouseSelectionRect
.
isNull
()
)
if
(
rightButton
&&
!
d
->
mouseSelecting
)
{
PageViewItem
*
pageItem
=
pickItemOnPoint
(
e
->
x
(),
e
->
y
()
);
emit
rightClick
(
pageItem
?
pageItem
->
page
()
:
0
,
e
->
globalPos
()
);
...
...
@@ -1069,7 +1070,7 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
// if a selection is defined, display a popup
if
(
(
!
leftButton
&&
!
d
->
aPrevAction
)
||
(
!
rightButton
&&
d
->
aPrevAction
)
||
d
->
mouseSelectionRect
.
isNull
()
)
!
d
->
mouseSelecting
)
break
;
QRect
selectionRect
=
d
->
mouseSelectionRect
.
normalize
();
...
...
@@ -1415,8 +1416,9 @@ PageViewItem * PageView::pickItemOnPoint( int x, int y )
void
PageView
::
selectionStart
(
int
x
,
int
y
,
const
QColor
&
color
,
bool
/*aboveAll*/
)
{
d
->
mouseSelecting
=
true
;
d
->
mouseSelectionRect
.
setRect
(
x
,
y
,
1
,
1
);
d
->
selectionRect
Color
=
color
;
d
->
mouseSelection
Color
=
color
;
// ensures page doesn't scroll
if
(
d
->
autoScrollTimer
)
{
...
...
@@ -1457,8 +1459,10 @@ void PageView::selectionEndPoint( int x, int y )
void
PageView
::
selectionClear
()
{
updateContents
(
d
->
mouseSelectionRect
.
normalize
()
);
QRect
updatedRect
=
d
->
mouseSelectionRect
.
normalize
();
d
->
mouseSelecting
=
false
;
d
->
mouseSelectionRect
.
setCoords
(
0
,
0
,
-
1
,
-
1
);
updateContents
(
updatedRect
);
}
void
PageView
::
updateZoom
(
ZoomMode
newZoomMode
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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