Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
fcbca144
Commit
fcbca144
authored
Sep 01, 2011
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SANKORE-92 Magnifier
parent
e59ac4ca
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
517 additions
and
441 deletions
+517
-441
close.svg
resources/images/close.svg
+1
-2
magnifier.png
resources/images/cursors/magnifier.png
+0
-0
decrease.svg
resources/images/decrease.svg
+9
-0
increase.svg
resources/images/increase.svg
+9
-0
magnifier.png
resources/images/stylusPalette/magnifier.png
+0
-0
magnifierOn.png
resources/images/stylusPalette/magnifierOn.png
+0
-0
magnifierTool.png
resources/images/toolPalette/magnifierTool.png
+0
-0
largeMagnifierSize.png
resources/images/toolbar/largeMagnifierSize.png
+0
-0
largeMagnifierZoom.png
resources/images/toolbar/largeMagnifierZoom.png
+0
-0
mediumMagnifierSize.png
resources/images/toolbar/mediumMagnifierSize.png
+0
-0
mediumMagnifierZoom.png
resources/images/toolbar/mediumMagnifierZoom.png
+0
-0
smallMagnifierSize.png
resources/images/toolbar/smallMagnifierSize.png
+0
-0
smallMagnifierZoom.png
resources/images/toolbar/smallMagnifierZoom.png
+0
-0
sankore.qrc
resources/sankore.qrc
+3
-9
UBBoardController.cpp
src/board/UBBoardController.cpp
+9
-39
UBBoardController.h
src/board/UBBoardController.h
+5
-0
UBBoardView.cpp
src/board/UBBoardView.cpp
+0
-3
UBDrawingController.cpp
src/board/UBDrawingController.cpp
+0
-24
UBDrawingController.h
src/board/UBDrawingController.h
+0
-3
UB.h
src/core/UB.h
+1
-2
UBSettings.cpp
src/core/UBSettings.cpp
+0
-164
UBSettings.h
src/core/UBSettings.h
+1
-25
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+115
-60
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+11
-10
UBMagnifer.cpp
src/gui/UBMagnifer.cpp
+293
-62
UBMagnifer.h
src/gui/UBMagnifer.h
+52
-30
UBStylusPalette.cpp
src/gui/UBStylusPalette.cpp
+0
-1
UBToolsManager.cpp
src/tools/UBToolsManager.cpp
+7
-6
UBToolsManager.h
src/tools/UBToolsManager.h
+1
-1
No files found.
resources/images/close.svg
View file @
fcbca144
...
@@ -5,6 +5,5 @@
...
@@ -5,6 +5,5 @@
width=
"26px"
height=
"26px"
viewBox=
"0 0 26 26"
style=
"enable-background:new 0 0 26 26;"
xml:space=
"preserve"
>
width=
"26px"
height=
"26px"
viewBox=
"0 0 26 26"
style=
"enable-background:new 0 0 26 26;"
xml:space=
"preserve"
>
<circle
style=
"fill:#CCCCCC;"
cx=
"13"
cy=
"13"
r=
"13"
/>
<circle
style=
"fill:#CCCCCC;"
cx=
"13"
cy=
"13"
r=
"13"
/>
<circle
style=
"fill:#999999;"
cx=
"13"
cy=
"13"
r=
"11"
/>
<circle
style=
"fill:#999999;"
cx=
"13"
cy=
"13"
r=
"11"
/>
<polygon
style=
"fill:#FFFFFF;"
points=
"20.071,17.242 15.828,13 20.071,8.757 17.242,5.929 13,10.171 8.757,5.929 5.929,8.757
<polygon
style=
"fill:#FFFFFF;"
points=
"20,17 16,13 20,9 17,6 13,10 9,6 6,9 10,13 6,17 9,20 13,16 17,20 "
/>
10.171,13 5.929,17.242 8.757,20.071 13,15.828 17.242,20.071 "
/>
</svg>
</svg>
resources/images/cursors/magnifier.png
deleted
100644 → 0
View file @
e59ac4ca
4.58 KB
resources/images/decrease.svg
0 → 100644
View file @
fcbca144
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
version=
"1.1"
id=
"Layer_1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
x=
"0px"
y=
"0px"
width=
"26px"
height=
"26px"
viewBox=
"0 0 26 26"
style=
"enable-background:new 0 0 26 26;"
xml:space=
"preserve"
>
<circle
style=
"fill:#CCCCCC;"
cx=
"13"
cy=
"13"
r=
"13"
/>
<circle
style=
"fill:#999999;"
cx=
"13"
cy=
"13"
r=
"11"
/>
<polygon
style=
"fill:#FFFFFF;"
points=
"20,15 20,11 6,11 6,15 20,15"
/>
</svg>
resources/images/increase.svg
0 → 100644
View file @
fcbca144
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
version=
"1.1"
id=
"Layer_1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
x=
"0px"
y=
"0px"
width=
"26px"
height=
"26px"
viewBox=
"0 0 26 26"
style=
"enable-background:new 0 0 26 26;"
xml:space=
"preserve"
>
<circle
style=
"fill:#CCCCCC;"
cx=
"13"
cy=
"13"
r=
"13"
/>
<circle
style=
"fill:#999999;"
cx=
"13"
cy=
"13"
r=
"11"
/>
<polygon
style=
"fill:#FFFFFF;"
points=
"20,15 20,11 15,11 15,6 11,6 11,11 6,11 6,15 11,15 11,20 15,20 15,15 20,15"
/>
</svg>
resources/images/stylusPalette/magnifier.png
deleted
100644 → 0
View file @
e59ac4ca
2.02 KB
resources/images/stylusPalette/magnifierOn.png
deleted
100644 → 0
View file @
e59ac4ca
2.74 KB
resources/images/toolPalette/magnifierTool.png
0 → 100644
View file @
fcbca144
8.06 KB
resources/images/toolbar/largeMagnifierSize.png
deleted
100644 → 0
View file @
e59ac4ca
476 Bytes
resources/images/toolbar/largeMagnifierZoom.png
deleted
100644 → 0
View file @
e59ac4ca
270 Bytes
resources/images/toolbar/mediumMagnifierSize.png
deleted
100644 → 0
View file @
e59ac4ca
396 Bytes
resources/images/toolbar/mediumMagnifierZoom.png
deleted
100644 → 0
View file @
e59ac4ca
300 Bytes
resources/images/toolbar/smallMagnifierSize.png
deleted
100644 → 0
View file @
e59ac4ca
272 Bytes
resources/images/toolbar/smallMagnifierZoom.png
deleted
100644 → 0
View file @
e59ac4ca
295 Bytes
resources/sankore.qrc
View file @
fcbca144
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
<file>images/uniboard.png</file>
<file>images/uniboard.png</file>
<file>images/bigUniboard.png</file>
<file>images/bigUniboard.png</file>
<file>images/close.svg</file>
<file>images/close.svg</file>
<file>images/increase.svg</file>
<file>images/decrease.svg</file>
<file>images/resize.svg</file>
<file>images/resize.svg</file>
<file>images/play.svg</file>
<file>images/play.svg</file>
<file>images/pause.svg</file>
<file>images/pause.svg</file>
...
@@ -121,12 +123,6 @@
...
@@ -121,12 +123,6 @@
<file>images/toolbar/eraserTool.png</file>
<file>images/toolbar/eraserTool.png</file>
<file>images/toolbar/lineTool.png</file>
<file>images/toolbar/lineTool.png</file>
<file>images/toolbar/tools.png</file>
<file>images/toolbar/tools.png</file>
<file>images/toolbar/largeMagnifierSize.png</file>
<file>images/toolbar/mediumMagnifierSize.png</file>
<file>images/toolbar/smallMagnifierSize.png</file>
<file>images/toolbar/largeMagnifierZoom.png</file>
<file>images/toolbar/mediumMagnifierZoom.png</file>
<file>images/toolbar/smallMagnifierZoom.png</file>
<file>images/stylusPalette/arrow.png</file>
<file>images/stylusPalette/arrow.png</file>
<file>images/stylusPalette/arrowOn.png</file>
<file>images/stylusPalette/arrowOn.png</file>
<file>images/stylusPalette/eraser.png</file>
<file>images/stylusPalette/eraser.png</file>
...
@@ -150,8 +146,6 @@
...
@@ -150,8 +146,6 @@
<file>images/stylusPalette/textOn.png</file>
<file>images/stylusPalette/textOn.png</file>
<file>images/stylusPalette/captureArea.png</file>
<file>images/stylusPalette/captureArea.png</file>
<file>images/stylusPalette/captureAreaOn.png</file>
<file>images/stylusPalette/captureAreaOn.png</file>
<file>images/stylusPalette/magnifier.png</file>
<file>images/stylusPalette/magnifierOn.png</file>
<file>images/backgroundPalette/background1.svg</file>
<file>images/backgroundPalette/background1.svg</file>
<file>images/backgroundPalette/background1On.svg</file>
<file>images/backgroundPalette/background1On.svg</file>
<file>images/backgroundPalette/background2.svg</file>
<file>images/backgroundPalette/background2.svg</file>
...
@@ -167,6 +161,7 @@
...
@@ -167,6 +161,7 @@
<file>images/toolPalette/protractorTool.png</file>
<file>images/toolPalette/protractorTool.png</file>
<file>images/toolPalette/compassTool.png</file>
<file>images/toolPalette/compassTool.png</file>
<file>images/toolPalette/maskTool.png</file>
<file>images/toolPalette/maskTool.png</file>
<file>images/toolPalette/magnifierTool.png</file>
<file>images/extraPalette/blackout.png</file>
<file>images/extraPalette/blackout.png</file>
<file>images/extraPalette/keyboard.png</file>
<file>images/extraPalette/keyboard.png</file>
<file>images/extraPalette/trapFlash.png</file>
<file>images/extraPalette/trapFlash.png</file>
...
@@ -185,7 +180,6 @@
...
@@ -185,7 +180,6 @@
<file>images/cursors/resize.png</file>
<file>images/cursors/resize.png</file>
<file>images/cursors/drawCompass.png</file>
<file>images/cursors/drawCompass.png</file>
<file>images/cursors/drawRulerLine.png</file>
<file>images/cursors/drawRulerLine.png</file>
<file>images/cursors/magnifier.png</file>
<file>images/print/onepage.png</file>
<file>images/print/onepage.png</file>
<file>images/print/thumbnails.png</file>
<file>images/print/thumbnails.png</file>
<file>images/print/twopages.png</file>
<file>images/print/twopages.png</file>
...
...
src/board/UBBoardController.cpp
View file @
fcbca144
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include "gui/UBMainWindow.h"
#include "gui/UBMainWindow.h"
#include "gui/UBToolWidget.h"
#include "gui/UBToolWidget.h"
#include "gui/UBKeyboardPalette.h"
#include "gui/UBKeyboardPalette.h"
#include "gui/UBMagnifer.h"
#include "domain/UBGraphicsPixmapItem.h"
#include "domain/UBGraphicsPixmapItem.h"
#include "domain/UBGraphicsItemUndoCommand.h"
#include "domain/UBGraphicsItemUndoCommand.h"
...
@@ -312,42 +313,6 @@ void UBBoardController::setupToolbar()
...
@@ -312,42 +313,6 @@ void UBBoardController::setupToolbar()
//-----------------------------------------------------------//
//-----------------------------------------------------------//
QList
<
QAction
*>
magnifierZoomActions
;
magnifierZoomActions
.
append
(
mMainWindow
->
actionMagnifierZoomSmall
);
magnifierZoomActions
.
append
(
mMainWindow
->
actionMagnifierZoomMedium
);
magnifierZoomActions
.
append
(
mMainWindow
->
actionMagnifierZoomLarge
);
UBToolbarButtonGroup
*
magnifierZoomChoice
=
new
UBToolbarButtonGroup
(
mMainWindow
->
boardToolBar
,
magnifierZoomActions
);
mMainWindow
->
boardToolBar
->
insertWidget
(
mMainWindow
->
actionBackgrounds
,
magnifierZoomChoice
);
connect
(
settings
->
appToolBarDisplayText
,
SIGNAL
(
changed
(
QVariant
)),
magnifierZoomChoice
,
SLOT
(
displayText
(
QVariant
)));
connect
(
magnifierZoomChoice
,
SIGNAL
(
activated
(
int
)),
UBDrawingController
::
drawingController
(),
SLOT
(
setMagnifierZoomIndex
(
int
)));
magnifierZoomChoice
->
displayText
(
QVariant
(
settings
->
appToolBarDisplayText
->
get
().
toBool
()));
magnifierZoomChoice
->
setCurrentIndex
(
settings
->
magnifierZoomIndex
());
QList
<
QAction
*>
magnifierSizeActions
;
magnifierSizeActions
.
append
(
mMainWindow
->
actionMagnifierSizeSmall
);
magnifierSizeActions
.
append
(
mMainWindow
->
actionMagnifierSizeMedium
);
magnifierSizeActions
.
append
(
mMainWindow
->
actionMagnifierSizeLarge
);
UBToolbarButtonGroup
*
magnifierSizeChoice
=
new
UBToolbarButtonGroup
(
mMainWindow
->
boardToolBar
,
magnifierSizeActions
);
mMainWindow
->
boardToolBar
->
insertWidget
(
mMainWindow
->
actionBackgrounds
,
magnifierSizeChoice
);
connect
(
settings
->
appToolBarDisplayText
,
SIGNAL
(
changed
(
QVariant
)),
magnifierSizeChoice
,
SLOT
(
displayText
(
QVariant
)));
connect
(
magnifierSizeChoice
,
SIGNAL
(
activated
(
int
)),
UBDrawingController
::
drawingController
(),
SLOT
(
setMagnifierSizeIndex
(
int
)));
magnifierSizeChoice
->
displayText
(
QVariant
(
settings
->
appToolBarDisplayText
->
get
().
toBool
()));
magnifierSizeChoice
->
setCurrentIndex
(
settings
->
magnifierSizeIndex
());
mMainWindow
->
boardToolBar
->
insertSeparator
(
mMainWindow
->
actionBackgrounds
);
//-----------------------------------------------------------//
UBApplication
::
app
()
->
insertSpaceToToolbarBeforeAction
(
mMainWindow
->
boardToolBar
,
mMainWindow
->
actionBoard
);
UBApplication
::
app
()
->
insertSpaceToToolbarBeforeAction
(
mMainWindow
->
boardToolBar
,
mMainWindow
->
actionBoard
);
UBApplication
::
app
()
->
insertSpaceToToolbarBeforeAction
(
mMainWindow
->
tutorialToolBar
,
mMainWindow
->
actionBoard
);
UBApplication
::
app
()
->
insertSpaceToToolbarBeforeAction
(
mMainWindow
->
tutorialToolBar
,
mMainWindow
->
actionBoard
);
...
@@ -1056,9 +1021,14 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
...
@@ -1056,9 +1021,14 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
mActiveScene
->
addTriangle
(
pPos
);
mActiveScene
->
addTriangle
(
pPos
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
else
if
(
sourceUrl
.
toString
()
==
UBToolsManager
::
manager
()
->
cache
.
id
)
else
if
(
sourceUrl
.
toString
()
==
UBToolsManager
::
manager
()
->
magnifier
.
id
)
{
{
mActiveScene
->
addCache
();
UBMagnifierParams
params
;
params
.
x
=
controlContainer
()
->
geometry
().
width
()
/
2
;
params
.
y
=
controlContainer
()
->
geometry
().
height
()
/
2
;
params
.
zoom
=
2
;
params
.
sizePercentFromScene
=
20
;
mActiveScene
->
addMagnifier
(
params
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
else
if
(
sourceUrl
.
toString
()
==
UBToolsManager
::
manager
()
->
mask
.
id
)
else
if
(
sourceUrl
.
toString
()
==
UBToolsManager
::
manager
()
->
mask
.
id
)
...
...
src/board/UBBoardController.h
View file @
fcbca144
...
@@ -81,6 +81,11 @@ class UBBoardController : public QObject
...
@@ -81,6 +81,11 @@ class UBBoardController : public QObject
return
mDisplayView
;
return
mDisplayView
;
}
}
UBGraphicsScene
*
activeScene
()
{
return
mActiveScene
;
}
void
setPenColorOnDarkBackground
(
const
QColor
&
pColor
)
void
setPenColorOnDarkBackground
(
const
QColor
&
pColor
)
{
{
if
(
mPenColorOnDarkBackground
==
pColor
)
if
(
mPenColorOnDarkBackground
==
pColor
)
...
...
src/board/UBBoardView.cpp
View file @
fcbca144
...
@@ -857,9 +857,6 @@ UBBoardView::setToolCursor (int tool)
...
@@ -857,9 +857,6 @@ UBBoardView::setToolCursor (int tool)
case
UBStylusTool
:
:
Eraser
:
case
UBStylusTool
:
:
Eraser
:
controlViewport
->
setCursor
(
UBResources
::
resources
()
->
eraserCursor
);
controlViewport
->
setCursor
(
UBResources
::
resources
()
->
eraserCursor
);
break
;
break
;
case
UBStylusTool
:
:
Magnifier
:
controlViewport
->
setCursor
(
UBResources
::
resources
()
->
magnifierCursor
);
break
;
case
UBStylusTool
:
:
Marker
:
case
UBStylusTool
:
:
Marker
:
controlViewport
->
setCursor
(
UBResources
::
resources
()
->
markerCursor
);
controlViewport
->
setCursor
(
UBResources
::
resources
()
->
markerCursor
);
break
;
break
;
...
...
src/board/UBDrawingController.cpp
View file @
fcbca144
...
@@ -44,7 +44,6 @@ UBDrawingController::UBDrawingController(QObject * parent)
...
@@ -44,7 +44,6 @@ UBDrawingController::UBDrawingController(QObject * parent)
connect
(
UBApplication
::
mainWindow
->
actionPen
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
penToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionPen
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
penToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionEraser
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
eraserToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionEraser
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
eraserToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionMagnifier
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
magnifierToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionMarker
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
markerToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionMarker
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
markerToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionSelector
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
selectorToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionSelector
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
selectorToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionHand
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
handToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionHand
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
handToolSelected
(
bool
)));
...
@@ -103,8 +102,6 @@ void UBDrawingController::setStylusTool(int tool)
...
@@ -103,8 +102,6 @@ void UBDrawingController::setStylusTool(int tool)
UBApplication
::
mainWindow
->
actionPen
->
setChecked
(
true
);
UBApplication
::
mainWindow
->
actionPen
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Eraser
)
else
if
(
mStylusTool
==
UBStylusTool
::
Eraser
)
UBApplication
::
mainWindow
->
actionEraser
->
setChecked
(
true
);
UBApplication
::
mainWindow
->
actionEraser
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Magnifier
)
UBApplication
::
mainWindow
->
actionMagnifier
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Marker
)
else
if
(
mStylusTool
==
UBStylusTool
::
Marker
)
UBApplication
::
mainWindow
->
actionMarker
->
setChecked
(
true
);
UBApplication
::
mainWindow
->
actionMarker
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Selector
)
else
if
(
mStylusTool
==
UBStylusTool
::
Selector
)
...
@@ -265,21 +262,6 @@ void UBDrawingController::setEraserWidthIndex(int index)
...
@@ -265,21 +262,6 @@ void UBDrawingController::setEraserWidthIndex(int index)
UBSettings
::
settings
()
->
setEraserWidthIndex
(
index
);
UBSettings
::
settings
()
->
setEraserWidthIndex
(
index
);
}
}
void
UBDrawingController
::
setMagnifierZoomIndex
(
int
index
)
{
setStylusTool
(
UBStylusTool
::
Magnifier
);
UBSettings
::
settings
()
->
setMagnifierZoomIndex
(
index
);
}
void
UBDrawingController
::
setMagnifierSizeIndex
(
int
index
)
{
setStylusTool
(
UBStylusTool
::
Magnifier
);
UBSettings
::
settings
()
->
setMagnifierSizeIndex
(
index
);
}
void
UBDrawingController
::
setPenColor
(
bool
onDarkBackground
,
const
QColor
&
color
,
int
pIndex
)
void
UBDrawingController
::
setPenColor
(
bool
onDarkBackground
,
const
QColor
&
color
,
int
pIndex
)
{
{
if
(
onDarkBackground
)
if
(
onDarkBackground
)
...
@@ -340,12 +322,6 @@ void UBDrawingController::eraserToolSelected(bool checked)
...
@@ -340,12 +322,6 @@ void UBDrawingController::eraserToolSelected(bool checked)
setStylusTool
(
UBStylusTool
::
Eraser
);
setStylusTool
(
UBStylusTool
::
Eraser
);
}
}
void
UBDrawingController
::
magnifierToolSelected
(
bool
checked
)
{
if
(
checked
)
setStylusTool
(
UBStylusTool
::
Magnifier
);
}
void
UBDrawingController
::
markerToolSelected
(
bool
checked
)
void
UBDrawingController
::
markerToolSelected
(
bool
checked
)
{
{
if
(
checked
)
if
(
checked
)
...
...
src/board/UBDrawingController.h
View file @
fcbca144
...
@@ -57,8 +57,6 @@ class UBDrawingController : public QObject
...
@@ -57,8 +57,6 @@ class UBDrawingController : public QObject
void
setLineWidthIndex
(
int
index
);
void
setLineWidthIndex
(
int
index
);
void
setColorIndex
(
int
index
);
void
setColorIndex
(
int
index
);
void
setEraserWidthIndex
(
int
index
);
void
setEraserWidthIndex
(
int
index
);
void
setMagnifierZoomIndex
(
int
index
);
void
setMagnifierSizeIndex
(
int
index
);
signals
:
signals
:
void
stylusToolChanged
(
int
tool
);
void
stylusToolChanged
(
int
tool
);
...
@@ -77,7 +75,6 @@ class UBDrawingController : public QObject
...
@@ -77,7 +75,6 @@ class UBDrawingController : public QObject
void
penToolSelected
(
bool
checked
);
void
penToolSelected
(
bool
checked
);
void
eraserToolSelected
(
bool
checked
);
void
eraserToolSelected
(
bool
checked
);
void
magnifierToolSelected
(
bool
checked
);
void
markerToolSelected
(
bool
checked
);
void
markerToolSelected
(
bool
checked
);
void
selectorToolSelected
(
bool
checked
);
void
selectorToolSelected
(
bool
checked
);
void
handToolSelected
(
bool
checked
);
void
handToolSelected
(
bool
checked
);
...
...
src/core/UB.h
View file @
fcbca144
...
@@ -26,7 +26,6 @@ struct UBStylusTool
...
@@ -26,7 +26,6 @@ struct UBStylusTool
{
{
Pen
=
0
,
Pen
=
0
,
Eraser
,
Eraser
,
Magnifier
,
Marker
,
Marker
,
Selector
,
Selector
,
Hand
,
Hand
,
...
...
src/core/UBSettings.cpp
View file @
fcbca144
...
@@ -624,170 +624,6 @@ qreal UBSettings::currentEraserWidth()
...
@@ -624,170 +624,6 @@ qreal UBSettings::currentEraserWidth()
return
width
;
return
width
;
}
}
//----------------------------------------//
// magnifier
//-------------//
// zoom index
int
UBSettings
::
magnifierZoomIndex
()
{
return
value
(
"Board/MagnifierZoomIndex"
,
1
).
toInt
();
}
void
UBSettings
::
setMagnifierZoomIndex
(
int
index
)
{
setValue
(
"Board/MagnifierZoomIndex"
,
index
);
}
//-------------//
// small zoom
qreal
UBSettings
::
magnifierSmallZoom
()
{
return
value
(
"Board/MagnifierSmallZoom"
,
2
).
toDouble
();
}
void
UBSettings
::
setMagnifierSmallZoom
(
qreal
xZoom
)
{
setValue
(
"Board/MagnifierSmallZoom"
,
xZoom
);
}
//-------------//
// medium zoom
qreal
UBSettings
::
magnifierMediumZoom
()
{
return
value
(
"Board/MagnifierMediumZoom"
,
3
).
toDouble
();
}
void
UBSettings
::
setMagnifierMediumZoom
(
qreal
xZoom
)
{
setValue
(
"Board/MagnifierMediumZoom"
,
xZoom
);
}
//-------------//
// large zoom
qreal
UBSettings
::
magnifierLargeZoom
()
{
return
value
(
"Board/MagnifierLargeZoom"
,
4
).
toDouble
();
}
void
UBSettings
::
setMagnifierLargeZoom
(
qreal
xZoom
)
{
setValue
(
"Board/MagnifierLargeZoom"
,
xZoom
);
}
//-------------//
qreal
UBSettings
::
currentMagnifierZoom
()
{
qreal
zoom
=
0
;
switch
(
magnifierZoomIndex
())
{
case
UBZoom
:
:
Small
:
zoom
=
magnifierSmallZoom
();
break
;
case
UBZoom
:
:
Medium
:
zoom
=
magnifierMediumZoom
();
break
;
case
UBZoom
:
:
Large
:
zoom
=
magnifierLargeZoom
();
break
;
default
:
Q_ASSERT
(
false
);
//failsafe
zoom
=
magnifierSmallZoom
();
break
;
}
return
zoom
;
}
//-------------//
// size index
int
UBSettings
::
magnifierSizeIndex
()
{
return
value
(
"Board/MagnifierSizeIndex"
,
1
).
toInt
();
}
void
UBSettings
::
setMagnifierSizeIndex
(
int
index
)
{
setValue
(
"Board/MagnifierSizeIndex"
,
index
);
}
//-------------//
// small zoom
qreal
UBSettings
::
magnifierSmallSize
()
{
return
value
(
"Board/MagnifierSmallSize"
,
10
).
toDouble
();
}
void
UBSettings
::
setMagnifierSmallSize
(
qreal
xSize
)
{
setValue
(
"Board/MagnifierSmallSize"
,
xSize
);
}
//-------------//
// medium zoom
qreal
UBSettings
::
magnifierMediumSize
()
{
return
value
(
"Board/MagnifierMediumSize"
,
20
).
toDouble
();
}
void
UBSettings
::
setMagnifierMediumSize
(
qreal
xSize
)
{
setValue
(
"Board/MagnifierMediumSize"
,
xSize
);
}
//-------------//
// large zoom
qreal
UBSettings
::
magnifierLargeSize
()
{
return
value
(
"Board/MagnifierLargeSize"
,
30
).
toDouble
();
}
void
UBSettings
::
setMagnifierLargeSize
(
qreal
xSize
)
{
setValue
(
"Board/MagnifierLargeSize"
,
xSize
);
}
//-------------//
qreal
UBSettings
::
currentMagnifierSize
()
{
qreal
size
=
0
;
switch
(
magnifierSizeIndex
())
{
case
UBSize
:
:
Small
:
size
=
magnifierSmallSize
();
break
;
case
UBSize
:
:
Medium
:
size
=
magnifierMediumSize
();
break
;
case
UBSize
:
:
Large
:
size
=
magnifierLargeSize
();
break
;
default
:
Q_ASSERT
(
false
);
//failsafe
size
=
magnifierSmallSize
();
break
;
}
return
size
;
}
//----------------------------------------//
bool
UBSettings
::
isDarkBackground
()
bool
UBSettings
::
isDarkBackground
()
{
{
return
value
(
"Board/DarkBackground"
,
0
).
toBool
();
return
value
(
"Board/DarkBackground"
,
0
).
toBool
();
...
...
src/core/UBSettings.h
View file @
fcbca144
...
@@ -66,19 +66,6 @@ class UBSettings : public QObject
...
@@ -66,19 +66,6 @@ class UBSettings : public QObject
qreal
eraserStrongWidth
();
qreal
eraserStrongWidth
();
qreal
currentEraserWidth
();
qreal
currentEraserWidth
();
// Magnifier related
int
magnifierZoomIndex
();
qreal
magnifierSmallZoom
();
qreal
magnifierMediumZoom
();
qreal
magnifierLargeZoom
();
qreal
currentMagnifierZoom
();
int
magnifierSizeIndex
();
qreal
magnifierSmallSize
();
qreal
magnifierMediumSize
();
qreal
magnifierLargeSize
();
qreal
currentMagnifierSize
();
// Background related
// Background related
bool
isDarkBackground
();
bool
isDarkBackground
();
bool
isCrossedBackground
();
bool
isCrossedBackground
();
...
@@ -360,17 +347,6 @@ class UBSettings : public QObject
...
@@ -360,17 +347,6 @@ class UBSettings : public QObject
void
setEraserMediumWidth
(
qreal
width
);
void
setEraserMediumWidth
(
qreal
width
);
void
setEraserStrongWidth
(
qreal
width
);
void
setEraserStrongWidth
(
qreal
width
);
void
setMagnifierZoomIndex
(
int
index
);
void
setMagnifierSmallZoom
(
qreal
xZoom
);
void
setMagnifierMediumZoom
(
qreal
xZoom
);
void
setMagnifierLargeZoom
(
qreal
xZoom
);
void
setMagnifierSizeIndex
(
int
index
);
void
setMagnifierSmallSize
(
qreal
xSize
);
void
setMagnifierMediumSize
(
qreal
xSize
);
void
setMagnifierLargeSize
(
qreal
xSize
);
void
setStylusPaletteVisible
(
bool
visible
);
void
setStylusPaletteVisible
(
bool
visible
);
void
setPenPressureSensitive
(
bool
sensitive
);
void
setPenPressureSensitive
(
bool
sensitive
);
...
...
src/domain/UBGraphicsScene.cpp
View file @
fcbca144
...
@@ -36,7 +36,6 @@
...
@@ -36,7 +36,6 @@
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsTriangle.h"
#include "tools/UBGraphicsTriangle.h"
#include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsCache.h"
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentProxy.h"
...
@@ -71,7 +70,6 @@ qreal UBGraphicsScene::toolOffsetProtractor = 100;
...
@@ -71,7 +70,6 @@ qreal UBGraphicsScene::toolOffsetProtractor = 100;
qreal
UBGraphicsScene
::
toolOffsetTriangle
=
100
;
qreal
UBGraphicsScene
::
toolOffsetTriangle
=
100
;
qreal
UBGraphicsScene
::
toolOffsetCompass
=
100
;
qreal
UBGraphicsScene
::
toolOffsetCompass
=
100
;
qreal
UBGraphicsScene
::
toolOffsetEraser
=
200
;
qreal
UBGraphicsScene
::
toolOffsetEraser
=
200
;
qreal
UBGraphicsScene
::
toolOffsetCache
=
1000
;
qreal
UBGraphicsScene
::
toolOffsetCurtain
=
1000
;
qreal
UBGraphicsScene
::
toolOffsetCurtain
=
1000
;
qreal
UBGraphicsScene
::
toolOffsetPointer
=
1100
;
qreal
UBGraphicsScene
::
toolOffsetPointer
=
1100
;
...
@@ -138,13 +136,13 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
...
@@ -138,13 +136,13 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
}
}
connect
(
this
,
SIGNAL
(
selectionChanged
()),
this
,
SLOT
(
selectionChangedProcessing
()));
connect
(
this
,
SIGNAL
(
selectionChanged
()),
this
,
SLOT
(
selectionChangedProcessing
()));
mHasCache
=
false
;
}
}
UBGraphicsScene
::~
UBGraphicsScene
()
UBGraphicsScene
::~
UBGraphicsScene
()
{
{
// NOOP
// NOOP
DisposeMagnifierQWidgets
();
}
}
void
UBGraphicsScene
::
selectionChangedProcessing
()
void
UBGraphicsScene
::
selectionChangedProcessing
()
...
@@ -238,15 +236,6 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
...
@@ -238,15 +236,6 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
drawPointer
(
scenePos
);
drawPointer
(
scenePos
);
accepted
=
true
;
accepted
=
true
;
}
}
else
if
(
currentTool
==
UBStylusTool
::
Magnifier
)
{
CreateMagnifierQWidgets
();
magniferControlViewWidget
->
grabNMove
(
QCursor
::
pos
(),
true
);
magniferDisplayViewWidget
->
grabNMove
(
scenePos
,
true
);
magniferControlViewWidget
->
show
();
magniferDisplayViewWidget
->
show
();
accepted
=
true
;
}
}
}
return
accepted
;
return
accepted
;
...
@@ -320,11 +309,6 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
...
@@ -320,11 +309,6 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
{
{
drawPointer
(
position
);
drawPointer
(
position
);
}
}
else
if
(
currentTool
==
UBStylusTool
::
Magnifier
)
{
magniferControlViewWidget
->
grabNMove
(
QCursor
::
pos
(),
false
);
magniferDisplayViewWidget
->
grabNMove
(
position
,
false
);
}
accepted
=
true
;
accepted
=
true
;
}
}
...
@@ -363,12 +347,6 @@ bool UBGraphicsScene::inputDeviceRelease()
...
@@ -363,12 +347,6 @@ bool UBGraphicsScene::inputDeviceRelease()
{
{
mCurrentStroke
=
0
;
mCurrentStroke
=
0
;
}
}
else
if
(
currentTool
==
UBStylusTool
::
Magnifier
)
{
DisposeMagnifierQWidgets
();
//qDebug() << "deleted";
}
if
(
mRemovedItems
.
size
()
>
0
||
mAddedItems
.
size
()
>
0
)
if
(
mRemovedItems
.
size
()
>
0
||
mAddedItems
.
size
()
>
0
)
{
{
...
@@ -425,24 +403,6 @@ void UBGraphicsScene::drawPointer(const QPointF &pPoint)
...
@@ -425,24 +403,6 @@ void UBGraphicsScene::drawPointer(const QPointF &pPoint)
}
}
}
}
// call this function when user press mouse button in Magnifier mode
void
UBGraphicsScene
::
CreateMagnifierQWidgets
()
{
UBApplication
::
app
()
->
setOverrideCursor
(
QCursor
(
Qt
::
BlankCursor
)
);
magniferControlViewWidget
=
new
UBMagnifer
((
QWidget
*
)(
UBApplication
::
boardController
->
controlContainer
()));
magniferControlViewWidget
->
setGrabView
((
QGraphicsView
*
)
UBApplication
::
boardController
->
controlView
());
magniferControlViewWidget
->
setMoveView
((
QGraphicsView
*
)
UBApplication
::
boardController
->
controlContainer
());
magniferControlViewWidget
->
setSize
(
UBSettings
::
settings
()
->
currentMagnifierSize
());
magniferControlViewWidget
->
setZoom
(
UBSettings
::
settings
()
->
currentMagnifierZoom
());
magniferDisplayViewWidget
=
new
UBMagnifer
((
QWidget
*
)(
UBApplication
::
boardController
->
displayView
()));
magniferDisplayViewWidget
->
setGrabView
((
QGraphicsView
*
)
UBApplication
::
boardController
->
controlView
());
magniferDisplayViewWidget
->
setMoveView
((
QGraphicsView
*
)
UBApplication
::
boardController
->
displayView
());
magniferDisplayViewWidget
->
setSize
(
UBSettings
::
settings
()
->
currentMagnifierSize
());
magniferDisplayViewWidget
->
setZoom
(
UBSettings
::
settings
()
->
currentMagnifierZoom
());
}
// call this function when user release mouse button in Magnifier mode
// call this function when user release mouse button in Magnifier mode
void
UBGraphicsScene
::
DisposeMagnifierQWidgets
()
void
UBGraphicsScene
::
DisposeMagnifierQWidgets
()
{
{
...
@@ -1536,6 +1496,119 @@ void UBGraphicsScene::addTriangle(QPointF center)
...
@@ -1536,6 +1496,119 @@ void UBGraphicsScene::addTriangle(QPointF center)
setModified
(
true
);
setModified
(
true
);
}
}
void
UBGraphicsScene
::
addMagnifier
(
UBMagnifierParams
params
)
{
// can have only one magnifier at one time
if
(
magniferControlViewWidget
)
return
;
QWidget
*
cContainer
=
(
QWidget
*
)(
UBApplication
::
boardController
->
controlContainer
());
QGraphicsView
*
cView
=
(
QGraphicsView
*
)
UBApplication
::
boardController
->
controlView
();
QGraphicsView
*
dView
=
(
QGraphicsView
*
)
UBApplication
::
boardController
->
displayView
();
QPoint
ccZeroPoint
=
cContainer
->
mapToGlobal
(
QPoint
(
0
,
0
));
QPoint
cvZeroPoint
=
cView
->
mapToGlobal
(
QPoint
(
0
,
0
));
QPoint
dvZeroPoint
=
dView
->
mapToGlobal
(
QPoint
(
0
,
0
));
int
cvW
=
cView
->
width
();
int
dvW
=
dView
->
width
();
qreal
wCoeff
=
(
qreal
)
dvW
/
(
qreal
)
cvW
;
int
cvH
=
cView
->
height
();
int
dvH
=
dView
->
height
();
qreal
hCoeff
=
(
qreal
)
dvH
/
(
qreal
)
cvH
;
QPoint
ccPoint
(
params
.
x
,
params
.
y
);
QPoint
globalPoint
=
cContainer
->
mapToGlobal
(
ccPoint
);
QPoint
cvPoint
=
cView
->
mapFromGlobal
(
globalPoint
);
QPoint
dvPoint
(
cvPoint
.
x
()
*
wCoeff
+
dvZeroPoint
.
x
(),
cvPoint
.
y
()
*
hCoeff
+
dvZeroPoint
.
y
());
magniferControlViewWidget
=
new
UBMagnifier
((
QWidget
*
)(
UBApplication
::
boardController
->
controlContainer
()),
true
);
magniferControlViewWidget
->
setGrabView
((
QGraphicsView
*
)
UBApplication
::
boardController
->
controlView
());
magniferControlViewWidget
->
setMoveView
((
QWidget
*
)(
UBApplication
::
boardController
->
controlContainer
()));
magniferControlViewWidget
->
setSize
(
params
.
sizePercentFromScene
);
magniferControlViewWidget
->
setZoom
(
params
.
zoom
);
magniferDisplayViewWidget
=
new
UBMagnifier
((
QWidget
*
)(
UBApplication
::
boardController
->
displayView
()),
false
);
magniferDisplayViewWidget
->
setGrabView
((
QGraphicsView
*
)
UBApplication
::
boardController
->
controlView
());
magniferDisplayViewWidget
->
setMoveView
((
QGraphicsView
*
)
UBApplication
::
boardController
->
displayView
());
magniferDisplayViewWidget
->
setSize
(
params
.
sizePercentFromScene
);
magniferDisplayViewWidget
->
setZoom
(
params
.
zoom
);
magniferControlViewWidget
->
grabNMove
(
globalPoint
,
globalPoint
,
true
);
magniferDisplayViewWidget
->
grabNMove
(
globalPoint
,
dvPoint
,
true
);
magniferControlViewWidget
->
show
();
magniferDisplayViewWidget
->
show
();
connect
(
magniferControlViewWidget
,
SIGNAL
(
magnifierMoved_Signal
(
QPoint
)),
this
,
SLOT
(
moveMagnifier
(
QPoint
)));
connect
(
magniferControlViewWidget
,
SIGNAL
(
magnifierClose_Signal
()),
this
,
SLOT
(
closeMagnifier
()));
connect
(
magniferControlViewWidget
,
SIGNAL
(
magnifierZoomIn_Signal
()),
this
,
SLOT
(
zoomInMagnifier
()));
connect
(
magniferControlViewWidget
,
SIGNAL
(
magnifierZoomOut_Signal
()),
this
,
SLOT
(
zoomOutMagnifier
()));
connect
(
magniferControlViewWidget
,
SIGNAL
(
magnifierResized_Signal
(
qreal
)),
this
,
SLOT
(
resizedMagnifier
(
qreal
)));
setModified
(
true
);
}
void
UBGraphicsScene
::
moveMagnifier
(
QPoint
newPos
)
{
QWidget
*
cContainer
=
(
QWidget
*
)(
UBApplication
::
boardController
->
controlContainer
());
QGraphicsView
*
cView
=
(
QGraphicsView
*
)
UBApplication
::
boardController
->
controlView
();
QGraphicsView
*
dView
=
(
QGraphicsView
*
)
UBApplication
::
boardController
->
displayView
();
QPoint
ccZeroPoint
=
cContainer
->
mapToGlobal
(
QPoint
(
0
,
0
));
QPoint
cvZeroPoint
=
cView
->
mapToGlobal
(
QPoint
(
0
,
0
));
QPoint
dvZeroPoint
=
dView
->
mapToGlobal
(
QPoint
(
0
,
0
));
int
cvW
=
cView
->
width
();
int
dvW
=
dView
->
width
();
qreal
wCoeff
=
(
qreal
)
dvW
/
(
qreal
)
cvW
;
int
cvH
=
cView
->
height
();
int
dvH
=
dView
->
height
();
qreal
hCoeff
=
(
qreal
)
dvH
/
(
qreal
)
cvH
;
QPoint
globalPoint
=
cContainer
->
mapToGlobal
(
newPos
);
QPoint
cvPoint
=
cView
->
mapFromGlobal
(
globalPoint
);
QPoint
dvPoint
(
cvPoint
.
x
()
*
wCoeff
+
dvZeroPoint
.
x
(),
cvPoint
.
y
()
*
hCoeff
+
dvZeroPoint
.
y
());
magniferControlViewWidget
->
grabNMove
(
globalPoint
,
globalPoint
,
false
,
false
);
magniferDisplayViewWidget
->
grabNMove
(
globalPoint
,
dvPoint
,
false
,
true
);
setModified
(
true
);
}
void
UBGraphicsScene
::
closeMagnifier
()
{
DisposeMagnifierQWidgets
();
}
void
UBGraphicsScene
::
zoomInMagnifier
()
{
if
(
magniferControlViewWidget
->
params
.
zoom
<
8
)
{
magniferControlViewWidget
->
setZoom
(
magniferControlViewWidget
->
params
.
zoom
+
0.5
);
magniferDisplayViewWidget
->
setZoom
(
magniferDisplayViewWidget
->
params
.
zoom
+
0.5
);
}
}
void
UBGraphicsScene
::
zoomOutMagnifier
()
{
if
(
magniferControlViewWidget
->
params
.
zoom
>
1
)
{
magniferControlViewWidget
->
setZoom
(
magniferControlViewWidget
->
params
.
zoom
-
0.5
);
magniferDisplayViewWidget
->
setZoom
(
magniferDisplayViewWidget
->
params
.
zoom
-
0.5
);
}
}
void
UBGraphicsScene
::
resizedMagnifier
(
qreal
newPercent
)
{
if
(
newPercent
>
18
&&
newPercent
<
50
)
{
magniferControlViewWidget
->
setSize
(
newPercent
);
magniferControlViewWidget
->
grabPoint
();
magniferDisplayViewWidget
->
setSize
(
newPercent
);
magniferDisplayViewWidget
->
grabPoint
();
}
}
void
UBGraphicsScene
::
addCompass
(
QPointF
center
)
void
UBGraphicsScene
::
addCompass
(
QPointF
center
)
{
{
...
@@ -1553,24 +1626,6 @@ void UBGraphicsScene::addCompass(QPointF center)
...
@@ -1553,24 +1626,6 @@ void UBGraphicsScene::addCompass(QPointF center)
setModified
(
true
);
setModified
(
true
);
}
}
void
UBGraphicsScene
::
addCache
()
{
UBGraphicsCache
*
cache
=
new
UBGraphicsCache
();
mTools
<<
cache
;
QGraphicsView
*
view
;
if
(
UBApplication
::
applicationController
->
displayManager
()
->
hasDisplay
())
{
view
=
(
QGraphicsView
*
)(
UBApplication
::
boardController
->
displayView
());
}
else
{
view
=
(
QGraphicsView
*
)(
UBApplication
::
boardController
->
controlView
());
}
addItem
(
cache
);
cache
->
setVisible
(
true
);
cache
->
setSelected
(
true
);
}
void
UBGraphicsScene
::
addMask
()
void
UBGraphicsScene
::
addMask
()
{
{
...
...
src/domain/UBGraphicsScene.h
View file @
fcbca144
...
@@ -44,8 +44,8 @@ class UBAbstractWidget;
...
@@ -44,8 +44,8 @@ class UBAbstractWidget;
class
UBDocumentProxy
;
class
UBDocumentProxy
;
class
UBGraphicsCurtainItem
;
class
UBGraphicsCurtainItem
;
class
UBGraphicsStroke
;
class
UBGraphicsStroke
;
class
UB
GraphicsCache
;
class
UB
MagnifierParams
;
class
UBMagnifer
;
class
UBMagnif
i
er
;
const
double
PI
=
4
.
0
*
atan
(
1
.
0
);
const
double
PI
=
4
.
0
*
atan
(
1
.
0
);
...
@@ -166,10 +166,10 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -166,10 +166,10 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
qreal
getNextObjectZIndex
();
qreal
getNextObjectZIndex
();
void
addRuler
(
QPointF
center
);
void
addRuler
(
QPointF
center
);
void
addTriangle
(
QPointF
center
);
void
addProtractor
(
QPointF
center
);
void
addProtractor
(
QPointF
center
);
void
addCompass
(
QPointF
center
);
void
addCompass
(
QPointF
center
);
void
addCache
();
void
addTriangle
(
QPointF
center
);
void
addMagnifier
(
UBMagnifierParams
params
);
void
addMask
();
void
addMask
();
...
@@ -247,7 +247,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -247,7 +247,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
static
qreal
toolOffsetCompass
;
static
qreal
toolOffsetCompass
;
static
qreal
toolOffsetCurtain
;
static
qreal
toolOffsetCurtain
;
static
qreal
toolOffsetTriangle
;
static
qreal
toolOffsetTriangle
;
static
qreal
toolOffsetCache
;
QSet
<
QGraphicsItem
*>
tools
(){
return
mTools
;}
QSet
<
QGraphicsItem
*>
tools
(){
return
mTools
;}
...
@@ -277,6 +276,11 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -277,6 +276,11 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void
selectionChangedProcessing
();
void
selectionChangedProcessing
();
void
moveMagnifier
(
QPoint
newPos
);
void
closeMagnifier
();
void
zoomInMagnifier
();
void
zoomOutMagnifier
();
void
resizedMagnifier
(
qreal
newPercent
);
signals
:
signals
:
...
@@ -292,7 +296,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -292,7 +296,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void
drawEraser
(
const
QPointF
&
pEndPoint
);
void
drawEraser
(
const
QPointF
&
pEndPoint
);
void
drawPointer
(
const
QPointF
&
pEndPoint
);
void
drawPointer
(
const
QPointF
&
pEndPoint
);
void
CreateMagnifierQWidgets
();
void
DisposeMagnifierQWidgets
();
void
DisposeMagnifierQWidgets
();
...
@@ -355,10 +358,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -355,10 +358,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
//int mMesure1Ms, mMesure2Ms;
//int mMesure1Ms, mMesure2Ms;
bool
mHasCache
;
UBMagnifier
*
magniferControlViewWidget
;
UBMagnifier
*
magniferDisplayViewWidget
;
UBMagnifer
*
magniferControlViewWidget
;
UBMagnifer
*
magniferDisplayViewWidget
;
};
};
#endif
/* UBGRAPHICSSCENE_H_ */
#endif
/* UBGRAPHICSSCENE_H_ */
src/gui/UBMagnifer.cpp
View file @
fcbca144
#include <QtGui>
#include "UBMagnifer.h"
#include "UBMagnifer.h"
#include <QPainter>
#include <QPixmap>
#include "core/UBApplication.h"
#include <QDebug>
#include "board/UBBoardController.h"
#include <QWidget>
#include "domain/UBGraphicsScene.h"
#include <QGraphicsView>
#include <QTimerEvent>
// #include <QPainter>
#include <QBitmap>
// #include <QPixmap>
#include <QPen>
// #include <QDebug>
// #include <QWidget>
UBMagnifer
::
UBMagnifer
(
QWidget
*
parent
)
// #include <QGraphicsView>
:
QWidget
(
parent
)
// #include <QTimerEvent>
// #include <QBitmap>
// #include <QPen>
UBMagnifier
::
UBMagnifier
(
QWidget
*
parent
,
bool
isInteractive
)
:
QWidget
(
parent
,
parent
?
Qt
::
Widget
:
Qt
::
Tool
|
(
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
X11BypassWindowManagerHint
))
,
gView
(
0
)
,
gView
(
0
)
,
mView
(
0
)
,
mView
(
0
)
,
sizePercentFromScene
(
20
)
,
inTimer
(
false
)
,
inTimer
(
false
)
,
borderPen
(
Qt
::
darkGray
)
,
borderPen
(
Qt
::
darkGray
)
,
mShouldMoveWidget
(
false
)
,
mShouldResizeWidget
(
false
)
{
{
borderPen
.
setWidth
(
2
);
isCusrsorAlreadyStored
=
false
;
setMouseTracking
(
true
);
//--------------------------------------------------//
QPixmap
pix
(
":/images/cursors/resize.png"
);
QTransform
tr
;
tr
.
rotate
(
45
);
mResizeCursor
=
QCursor
(
pix
.
transformed
(
tr
,
Qt
::
SmoothTransformation
),
pix
.
width
()
/
2
,
pix
.
height
()
/
2
);
//--------------------------------------------------//
params
.
sizePercentFromScene
=
20
;
m_isInteractive
=
isInteractive
;
sClosePixmap
=
new
QPixmap
(
":/images/close.svg"
);
sIncreasePixmap
=
new
QPixmap
(
":/images/increase.svg"
);
sDecreasePixmap
=
new
QPixmap
(
":/images/decrease.svg"
);
mResizeItem
=
new
QPixmap
(
":/images/resize.svg"
);
if
(
parent
)
{
setAttribute
(
Qt
::
WA_NoMousePropagation
);
}
else
{
// standalone window
// !!!! Should be included into Windows after QT recompilation
#ifndef Q_WS_WIN
setAttribute
(
Qt
::
WA_TranslucentBackground
);
setAttribute
(
Qt
::
WA_MacAlwaysShowToolWindow
);
#endif
#ifdef Q_WS_MAC
setAttribute
(
Qt
::
WA_MacAlwaysShowToolWindow
);
setAttribute
(
Qt
::
WA_MacNonActivatingToolWindow
);
setAttribute
(
Qt
::
WA_MacNoShadow
);
#endif
}
}
}
UBMagnif
er
::~
UBMagnif
er
()
UBMagnif
ier
::~
UBMagnifi
er
()
{
{
if
(
timerUpdate
!=
0
)
if
(
timerUpdate
!=
0
)
{
{
killTimer
(
timerUpdate
);
killTimer
(
timerUpdate
);
timerUpdate
=
0
;
timerUpdate
=
0
;
}
}
if
(
sClosePixmap
)
{
delete
sClosePixmap
;
sClosePixmap
=
NULL
;
}
if
(
sIncreasePixmap
)
{
delete
sIncreasePixmap
;
sIncreasePixmap
=
NULL
;
}
if
(
sDecreasePixmap
)
{
delete
sDecreasePixmap
;
sDecreasePixmap
=
NULL
;
}
}
}
void
UBMagnif
er
::
setSize
(
int
percentFromScene
)
void
UBMagnif
ier
::
setSize
(
qreal
percentFromScene
)
{
{
if
(
gView
==
NULL
)
return
;
if
(
gView
==
NULL
||
mView
==
NULL
)
return
;
// calculate object size
// calculate object size
sizePercentFromScene
=
percentFromScene
;
params
.
sizePercentFromScene
=
percentFromScene
;
QSize
sceneSize
=
g
View
->
size
();
QSize
sceneSize
=
m
View
->
size
();
int
size
=
sizePercentFromScene
*
sceneSize
.
width
()
/
100
;
qreal
size
=
params
.
sizePercentFromScene
*
sceneSize
.
width
()
/
100
;
QRect
currGeom
=
geometry
();
if
(
currGeom
.
width
()
==
currGeom
.
height
())
{
QPoint
newPos
=
mView
->
mapFromGlobal
(
updPointMove
);
setGeometry
(
newPos
.
x
()
-
size
/
2
,
newPos
.
y
()
-
size
/
2
,
size
,
size
);
}
else
setGeometry
(
0
,
0
,
size
,
size
);
setGeometry
(
0
,
0
,
size
,
size
);
// prepare transparent bit mask
// prepare transparent bit mask
...
@@ -45,7 +118,7 @@ void UBMagnifer::setSize(int percentFromScene)
...
@@ -45,7 +118,7 @@ void UBMagnifer::setSize(int percentFromScene)
mask_img
.
fill
(
0xff
);
mask_img
.
fill
(
0xff
);
QPainter
mask_ptr
(
&
mask_img
);
QPainter
mask_ptr
(
&
mask_img
);
mask_ptr
.
setBrush
(
QBrush
(
QColor
(
0
,
0
,
0
)
)
);
mask_ptr
.
setBrush
(
QBrush
(
QColor
(
0
,
0
,
0
)
)
);
mask_ptr
.
drawEllipse
(
QPoint
(
size
/
2
,
size
/
2
),
size
/
2
,
size
/
2
);
mask_ptr
.
drawEllipse
(
QPoint
F
(
size
/
2
,
size
/
2
),
size
/
2
-
sClosePixmap
->
width
(),
size
/
2
-
sClosePixmap
->
width
()
);
bmpMask
=
QBitmap
::
fromImage
(
mask_img
);
bmpMask
=
QBitmap
::
fromImage
(
mask_img
);
// prepare general image
// prepare general image
...
@@ -54,49 +127,207 @@ void UBMagnifer::setSize(int percentFromScene)
...
@@ -54,49 +127,207 @@ void UBMagnifer::setSize(int percentFromScene)
pMap
.
setMask
(
bmpMask
);
pMap
.
setMask
(
bmpMask
);
}
}
void
UBMagnifer
::
setZoom
(
int
z
)
void
UBMagnifier
::
setZoom
(
qreal
zoom
)
{
params
.
zoom
=
zoom
;
}
void
UBMagnifier
::
paintEvent
(
QPaintEvent
*
event
)
{
QPainter
painter
(
this
);
// painter.drawRect(0,0,size().width()-1, size().height()-1);
painter
.
setRenderHint
(
QPainter
::
Antialiasing
);
painter
.
setPen
(
Qt
::
NoPen
);
if
(
m_isInteractive
)
{
painter
.
setBrush
(
QColor
(
127
,
127
,
127
,
127
));
painter
.
drawRoundedRect
(
QRectF
(
size
().
width
()
/
2
,
size
().
height
()
/
2
,
(
size
().
width
()
-
sClosePixmap
->
width
()
)
/
2
,
(
size
().
height
()
-
sClosePixmap
->
width
()
)
/
2
),
15
,
15
);
painter
.
setBrush
(
QColor
(
190
,
190
,
190
,
255
));
painter
.
drawEllipse
(
QPoint
(
size
().
width
()
/
2
,
size
().
height
()
/
2
),
(
size
().
width
()
-
sClosePixmap
->
width
()
)
/
2
,
(
size
().
height
()
-
sClosePixmap
->
height
()
)
/
2
);
painter
.
drawPixmap
(
size
().
width
()
-
sClosePixmap
->
width
(),
size
().
height
()
/
2
+
sClosePixmap
->
height
()
*
1
,
*
sClosePixmap
);
painter
.
drawPixmap
(
size
().
width
()
-
sIncreasePixmap
->
width
(),
size
().
height
()
/
2
+
sIncreasePixmap
->
height
()
*
2.5
,
*
sIncreasePixmap
);
painter
.
drawPixmap
(
size
().
width
()
-
sDecreasePixmap
->
width
(),
size
().
height
()
/
2
+
sDecreasePixmap
->
height
()
*
3.6
,
*
sDecreasePixmap
);
painter
.
drawPixmap
(
size
().
width
()
-
mResizeItem
->
width
()
-
20
,
size
().
height
()
-
mResizeItem
->
height
()
-
20
,
*
mResizeItem
);
}
else
{
painter
.
setBrush
(
QColor
(
127
,
127
,
127
,
127
));
painter
.
drawEllipse
(
QPoint
(
size
().
width
()
/
2
,
size
().
height
()
/
2
),
(
size
().
width
()
-
sClosePixmap
->
width
()
)
/
2
,
(
size
().
height
()
-
sClosePixmap
->
height
()
)
/
2
);
}
painter
.
drawPixmap
(
0
,
0
,
pMap
);
}
void
UBMagnifier
::
mousePressEvent
(
QMouseEvent
*
event
)
{
if
(
m_isInteractive
)
{
QWidget
::
mousePressEvent
(
event
);
if
(
event
->
pos
().
x
()
>=
size
().
width
()
-
mResizeItem
->
width
()
-
20
&&
event
->
pos
().
x
()
<
size
().
width
()
-
20
&&
event
->
pos
().
y
()
>=
size
().
height
()
-
mResizeItem
->
height
()
-
20
&&
event
->
pos
().
y
()
<
size
().
height
()
-
-
20
)
{
mShouldResizeWidget
=
true
;
}
else
{
mShouldMoveWidget
=
!
event
->
isAccepted
()
&&
(
event
->
buttons
()
&
Qt
::
LeftButton
);
}
mMousePressPos
=
event
->
pos
();
mMousePressDelta
=
(
qreal
)
updPointGrab
.
x
()
+
(
qreal
)
size
().
width
()
/
2
-
(
qreal
)
event
->
globalPos
().
x
();
event
->
accept
();
update
();
}
else
event
->
ignore
();
}
void
UBMagnifier
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
{
zoom
=
z
;
if
(
m_isInteractive
)
{
if
(
mShouldMoveWidget
&&
(
event
->
buttons
()
&
Qt
::
LeftButton
))
{
QPoint
offset
=
event
->
pos
()
-
mMousePressPos
;
move
(
pos
()
-
mMousePressPos
+
event
->
pos
());
event
->
accept
();
QWidget
::
mouseMoveEvent
(
event
);
emit
magnifierMoved_Signal
(
QPoint
(
this
->
pos
().
x
()
+
size
().
width
()
/
2
,
this
->
pos
().
y
()
+
size
().
height
()
/
2
));
return
;
}
if
(
mShouldResizeWidget
&&
(
event
->
buttons
()
&
Qt
::
LeftButton
))
{
QPoint
currGlobalPos
=
event
->
globalPos
();
qreal
cvW
=
mView
->
width
();
qreal
newXSize
=
(
currGlobalPos
.
x
()
+
mMousePressDelta
-
updPointGrab
.
x
()
)
*
2
;
qreal
newPercentSize
=
newXSize
*
100
/
cvW
;
emit
magnifierResized_Signal
(
newPercentSize
);
zWidth
=
size
().
width
()
/
zoom
;
event
->
ignore
();
zWidthHalf
=
zWidth
/
2
;
return
;
zHeight
=
size
().
height
()
/
zoom
;
}
zHeightHalf
=
zHeight
/
2
;
if
(
event
->
pos
().
x
()
>=
size
().
width
()
-
mResizeItem
->
width
()
-
20
&&
event
->
pos
().
x
()
<
size
().
width
()
-
20
&&
event
->
pos
().
y
()
>=
size
().
height
()
-
mResizeItem
->
height
()
-
20
&&
event
->
pos
().
y
()
<
size
().
height
()
-
-
20
&&
isCusrsorAlreadyStored
==
false
)
{
mOldCursor
=
cursor
();
isCusrsorAlreadyStored
=
true
;
setCursor
(
mResizeCursor
);
}
}
else
event
->
ignore
();
}
}
void
UBMagnifer
::
paintEvent
(
QPaintEvent
*
)
void
UBMagnifier
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
{
QPainter
p
(
this
);
if
(
m_isInteractive
)
p
.
drawPixmap
(
0
,
0
,
pMap
);
{
mShouldMoveWidget
=
false
;
// in future replace to image border
mShouldResizeWidget
=
false
;
QPen
pen
(
Qt
::
darkGray
);
pen
.
setWidth
(
2
);
if
(
event
->
pos
().
x
()
>=
size
().
width
()
-
sClosePixmap
->
width
()
&&
p
.
setPen
(
borderPen
);
event
->
pos
().
x
()
<
size
().
width
()
&&
p
.
drawEllipse
(
QPoint
(
size
().
width
()
/
2
,
size
().
height
()
/
2
),
size
().
width
()
/
2
,
size
().
height
()
/
2
);
event
->
pos
().
y
()
>=
size
().
height
()
/
2
+
sClosePixmap
->
height
()
*
1
&&
event
->
pos
().
y
()
<
size
().
height
()
/
2
+
sClosePixmap
->
height
()
*
2
)
{
event
->
accept
();
emit
magnifierClose_Signal
();
}
else
if
(
event
->
pos
().
x
()
>=
size
().
width
()
-
sIncreasePixmap
->
width
()
&&
event
->
pos
().
x
()
<
size
().
width
()
&&
event
->
pos
().
y
()
>=
size
().
height
()
/
2
+
sIncreasePixmap
->
height
()
*
2.5
&&
event
->
pos
().
y
()
<
size
().
height
()
/
2
+
sIncreasePixmap
->
height
()
*
3.5
)
{
event
->
accept
();
emit
magnifierZoomIn_Signal
();
}
else
if
(
event
->
pos
().
x
()
>=
size
().
width
()
-
sDecreasePixmap
->
width
()
&&
event
->
pos
().
x
()
<
size
().
width
()
&&
event
->
pos
().
y
()
>=
size
().
height
()
/
2
+
sDecreasePixmap
->
height
()
*
3.6
&&
event
->
pos
().
y
()
<
size
().
height
()
/
2
+
sDecreasePixmap
->
height
()
*
4.6
)
{
event
->
accept
();
emit
magnifierZoomOut_Signal
();
}
else
QWidget
::
mouseReleaseEvent
(
event
);
// don't propgate to parent, the widget is deleted in UBApplication::boardController->removeTool
}
else
event
->
ignore
();
}
}
void
UBMagnifer
::
timerEvent
(
QTimerEvent
*
e
)
void
UBMagnif
i
er
::
timerEvent
(
QTimerEvent
*
e
)
{
{
if
(
inTimer
)
return
;
if
(
inTimer
)
return
;
if
(
e
->
timerId
()
==
timerUpdate
)
if
(
e
->
timerId
()
==
timerUpdate
)
{
{
inTimer
=
true
;
inTimer
=
true
;
if
(
!
(
updPoint
.
isNull
()))
grabPoint
(
updPoint
);
if
(
!
(
updPointGrab
.
isNull
()))
if
(
!
(
updPointF
.
isNull
()))
grabPoint
(
updPointF
);
grabPoint
(
updPointGrab
);
if
(
isCusrsorAlreadyStored
)
{
QPoint
globalCursorPos
=
QCursor
::
pos
();
QPoint
cursorPos
=
mapFromGlobal
(
globalCursorPos
);
if
(
cursorPos
.
x
()
<
size
().
width
()
-
mResizeItem
->
width
()
-
20
||
cursorPos
.
x
()
>
size
().
width
()
-
20
||
cursorPos
.
y
()
<
size
().
height
()
-
mResizeItem
->
height
()
-
20
||
cursorPos
.
y
()
>
size
().
height
()
-
-
20
)
{
isCusrsorAlreadyStored
=
false
;
setCursor
(
mOldCursor
);
}
}
inTimer
=
false
;
inTimer
=
false
;
}
}
}
}
void
UBMagnif
er
::
grabPoint
(
const
QPoint
&
point
)
void
UBMagnif
ier
::
grabPoint
(
)
{
{
QPointF
itemPos
=
gView
->
mapFromGlobal
(
point
);
QPointF
itemPos
=
gView
->
mapFromGlobal
(
updPointGrab
);
qreal
zWidth
=
size
().
width
()
/
params
.
zoom
;
qreal
zWidthHalf
=
zWidth
/
2
;
qreal
zHeight
=
size
().
height
()
/
params
.
zoom
;
qreal
zHeightHalf
=
zHeight
/
2
;
int
x
=
itemPos
.
x
()
-
zWidthHalf
;
int
x
=
itemPos
.
x
()
-
zWidthHalf
;
int
y
=
itemPos
.
y
()
-
zHeightHalf
;
int
y
=
itemPos
.
y
()
-
zHeightHalf
;
QPixmap
newPixMap
(
QSize
(
zWidth
,
zHeight
));
QPixmap
newPixMap
(
QSize
(
zWidth
,
zHeight
));
((
QWidget
*
)
gView
)
->
render
(
&
newPixMap
,
QPoint
(
0
,
0
),
QRegion
(
x
,
y
,
zWidth
,
zHeight
));
((
QWidget
*
)
gView
)
->
render
(
&
newPixMap
,
QPoint
(
0
,
0
),
QRegion
(
x
,
y
,
zWidth
,
zHeight
));
UBApplication
::
boardController
->
activeScene
()
->
update
();
pMap
.
fill
(
Qt
::
transparent
);
pMap
.
fill
(
Qt
::
transparent
);
pMap
=
newPixMap
.
scaled
(
QSize
(
width
(),
height
()));
pMap
=
newPixMap
.
scaled
(
QSize
(
width
(),
height
()));
pMap
.
setMask
(
bmpMask
);
pMap
.
setMask
(
bmpMask
);
...
@@ -104,15 +335,23 @@ void UBMagnifer::grabPoint(const QPoint &point)
...
@@ -104,15 +335,23 @@ void UBMagnifer::grabPoint(const QPoint &point)
update
();
update
();
}
}
void
UBMagnif
er
::
grabPoint
(
const
QPointF
&
point
)
void
UBMagnif
ier
::
grabPoint
(
const
QPoint
&
pGrab
)
{
{
QPoint
itemPos
=
gView
->
mapFromScene
(
point
);
updPointGrab
=
pGrab
;
QPointF
itemPos
=
gView
->
mapFromGlobal
(
pGrab
);
qreal
zWidth
=
size
().
width
()
/
params
.
zoom
;
qreal
zWidthHalf
=
zWidth
/
2
;
qreal
zHeight
=
size
().
height
()
/
params
.
zoom
;
qreal
zHeightHalf
=
zHeight
/
2
;
int
x
=
itemPos
.
x
()
-
zWidthHalf
;
int
x
=
itemPos
.
x
()
-
zWidthHalf
;
int
y
=
itemPos
.
y
()
-
zHeightHalf
;
int
y
=
itemPos
.
y
()
-
zHeightHalf
;
QPixmap
newPixMap
(
QSize
(
zWidth
,
zHeight
));
QPixmap
newPixMap
(
QSize
(
zWidth
,
zHeight
));
((
QWidget
*
)
gView
)
->
render
(
&
newPixMap
,
QPoint
(
0
,
0
),
QRegion
(
x
,
y
,
zWidth
,
zHeight
));
((
QWidget
*
)
gView
)
->
render
(
&
newPixMap
,
QPoint
(
0
,
0
),
QRegion
(
x
,
y
,
zWidth
,
zHeight
));
UBApplication
::
boardController
->
activeScene
()
->
update
();
pMap
.
fill
(
Qt
::
transparent
);
pMap
.
fill
(
Qt
::
transparent
);
pMap
=
newPixMap
.
scaled
(
QSize
(
width
(),
height
()));
pMap
=
newPixMap
.
scaled
(
QSize
(
width
(),
height
()));
pMap
.
setMask
(
bmpMask
);
pMap
.
setMask
(
bmpMask
);
...
@@ -120,32 +359,24 @@ void UBMagnifer::grabPoint(const QPointF &point)
...
@@ -120,32 +359,24 @@ void UBMagnifer::grabPoint(const QPointF &point)
update
();
update
();
}
}
// from global
// from global
void
UBMagnif
er
::
grabNMove
(
const
QPoint
&
point
,
bool
needGrab
=
tru
e
)
void
UBMagnif
ier
::
grabNMove
(
const
QPoint
&
pGrab
,
const
QPoint
&
pMove
,
bool
needGrab
,
bool
needMov
e
)
{
{
updPoint
=
point
;
updPointGrab
=
pGrab
;
updPointMove
=
pMove
;
if
(
needGrab
)
if
(
needGrab
)
grabPoint
(
point
);
grabPoint
(
pGrab
);
QPoint
itemPos
=
mView
->
mapFromGlobal
(
point
);
move
(
itemPos
.
x
()
-
width
()
/
2
,
itemPos
.
y
()
-
height
()
/
2
);
// move(itemPos.x(), itemPos.y());
}
// from scene
void
UBMagnifer
::
grabNMove
(
const
QPointF
&
point
,
bool
needGrab
=
true
)
{
updPointF
=
point
;
if
(
needGrab
)
if
(
needMove
)
grabPoint
(
point
);
{
QPoint
itemPos
=
mView
->
mapFromScene
(
point
);
QPoint
movePos
=
mView
->
mapFromGlobal
(
pMove
);
move
(
itemPos
.
x
()
-
width
()
/
2
,
itemPos
.
y
()
-
height
()
/
2
);
move
(
movePos
.
x
()
-
width
()
/
2
,
movePos
.
y
()
-
height
()
/
2
);
// move(itemPos.x(), itemPos.y());
// move(itemPos.x(), itemPos.y());
}
}
}
void
UBMagnif
er
::
setGrabView
(
QGraphicsView
*
view
)
void
UBMagnif
ier
::
setGrabView
(
QWidget
*
view
)
{
{
if
(
timerUpdate
!=
0
)
if
(
timerUpdate
!=
0
)
killTimer
(
timerUpdate
);
killTimer
(
timerUpdate
);
...
...
src/gui/UBMagnifer.h
View file @
fcbca144
#ifndef UBMAGNIFER_H
#ifndef UBMAGNIF
I
ER_H
#define UBMAGNIFER_H
#define UBMAGNIF
I
ER_H
#include <QWidget>
#include <QtGui>
#include <QBitmap>
#include <QPen>
class
QPixmap
;
class
UBMagnifierParams
class
QBitmap
;
{
class
QPen
;
public
:
class
QGraphicsView
;
int
x
;
int
y
;
qreal
zoom
;
qreal
sizePercentFromScene
;
};
class
UBMagnifer
:
public
QWidget
class
UBMagnif
i
er
:
public
QWidget
{
{
Q_OBJECT
Q_OBJECT
public
:
public
:
UBMagnif
er
(
QWidget
*
parent
=
0
);
UBMagnif
ier
(
QWidget
*
parent
=
0
,
bool
isInteractive
=
false
);
~
UBMagnifer
();
~
UBMagnif
i
er
();
void
setSize
(
int
percentFromScene
);
void
setSize
(
qreal
percentFromScene
);
void
setZoom
(
int
z
);
void
setZoom
(
qreal
zoom
);
void
setGrabView
(
Q
GraphicsView
*
view
);
void
setGrabView
(
Q
Widget
*
view
);
void
setMoveView
(
Q
GraphicsView
*
view
)
{
mView
=
view
;}
void
setMoveView
(
Q
Widget
*
view
)
{
mView
=
view
;}
void
grabPoint
();
void
grabPoint
(
const
QPoint
&
point
);
void
grabPoint
(
const
QPoint
&
point
);
void
grabPoint
(
const
QPointF
&
point
);
void
grabNMove
(
const
QPoint
&
pGrab
,
const
QPoint
&
pMove
,
bool
needGrab
=
true
,
bool
needMove
=
true
);
void
grabNMove
(
const
QPoint
&
point
,
bool
needGrab
);
void
grabNMove
(
const
QPointF
&
point
,
bool
needGrab
);
UBMagnifierParams
params
;
signals
:
void
magnifierMoved_Signal
(
QPoint
newPos
);
void
magnifierClose_Signal
();
void
magnifierZoomIn_Signal
();
void
magnifierZoomOut_Signal
();
void
magnifierResized_Signal
(
qreal
newPercentSize
);
protected
:
protected
:
void
paintEvent
(
QPaintEvent
*
);
void
paintEvent
(
QPaintEvent
*
);
void
timerEvent
(
QTimerEvent
*
);
void
timerEvent
(
QTimerEvent
*
);
int
sizePercentFromScene
;
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
event
);
QPoint
mMousePressPos
;
qreal
mMousePressDelta
;
bool
mShouldMoveWidget
;
bool
mShouldResizeWidget
;
QPixmap
*
sClosePixmap
;
QPixmap
*
sIncreasePixmap
;
QPixmap
*
sDecreasePixmap
;
QPixmap
*
mResizeItem
;
bool
isCusrsorAlreadyStored
;
QCursor
mOldCursor
;
QCursor
mResizeCursor
;
private
:
private
:
int
zoom
;
int
zWidth
;
int
zHeight
;
int
zWidthHalf
;
int
zHeightHalf
;
bool
inTimer
;
bool
inTimer
;
bool
m_isInteractive
;
int
timerUpdate
;
int
timerUpdate
;
QPoint
updPoint
;
QPoint
updPoint
Grab
;
QPoint
F
updPointF
;
QPoint
updPointMove
;
QPixmap
pMap
;
QPixmap
pMap
;
QBitmap
bmpMask
;
QBitmap
bmpMask
;
QPen
borderPen
;
QPen
borderPen
;
Q
GraphicsView
*
gView
;
Q
Widget
*
gView
;
Q
GraphicsView
*
mView
;
Q
Widget
*
mView
;
};
};
#endif // UBMAGNIFER_H
#endif // UBMAGNIF
I
ER_H
src/gui/UBStylusPalette.cpp
View file @
fcbca144
...
@@ -37,7 +37,6 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
...
@@ -37,7 +37,6 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
actions
<<
UBApplication
::
mainWindow
->
actionPen
;
actions
<<
UBApplication
::
mainWindow
->
actionPen
;
actions
<<
UBApplication
::
mainWindow
->
actionEraser
;
actions
<<
UBApplication
::
mainWindow
->
actionEraser
;
actions
<<
UBApplication
::
mainWindow
->
actionMagnifier
;
actions
<<
UBApplication
::
mainWindow
->
actionMarker
;
actions
<<
UBApplication
::
mainWindow
->
actionMarker
;
actions
<<
UBApplication
::
mainWindow
->
actionSelector
;
actions
<<
UBApplication
::
mainWindow
->
actionSelector
;
...
...
src/tools/UBToolsManager.cpp
View file @
fcbca144
...
@@ -58,12 +58,13 @@ UBToolsManager::UBToolsManager(QObject *parent)
...
@@ -58,12 +58,13 @@ UBToolsManager::UBToolsManager(QObject *parent)
mToolsIcon
.
insert
(
triangle
.
id
,
":/images/toolPalette/triangleTool.png"
);
mToolsIcon
.
insert
(
triangle
.
id
,
":/images/toolPalette/triangleTool.png"
);
mDescriptors
<<
triangle
;
mDescriptors
<<
triangle
;
// cache.id = "uniboardTool://uniboard.mnemis.com/cache";
magnifier
.
id
=
"uniboardTool://uniboard.mnemis.com/magnifier"
;
// cache.icon = QPixmap(":/images/toolPalette/cacheTool.png");
magnifier
.
icon
=
QPixmap
(
":/images/toolPalette/magnifierTool.png"
);
// cache.label = tr("Cache");
magnifier
.
label
=
tr
(
"Magnifier"
);
// cache.version = "1.0";
magnifier
.
version
=
"1.0"
;
// mToolsIcon.insert(cache.id, ":/images/toolPalette/cacheTool.png");
mToolsIcon
.
insert
(
magnifier
.
id
,
":/images/toolPalette/magnifierTool.png"
);
// mDescriptors << cache;
mDescriptors
<<
magnifier
;
}
}
UBToolsManager
::~
UBToolsManager
()
UBToolsManager
::~
UBToolsManager
()
...
...
src/tools/UBToolsManager.h
View file @
fcbca144
...
@@ -78,7 +78,7 @@ class UBToolsManager : public QObject
...
@@ -78,7 +78,7 @@ class UBToolsManager : public QObject
UBToolDescriptor
compass
;
UBToolDescriptor
compass
;
UBToolDescriptor
mask
;
UBToolDescriptor
mask
;
UBToolDescriptor
triangle
;
UBToolDescriptor
triangle
;
UBToolDescriptor
cache
;
UBToolDescriptor
magnifier
;
QString
iconFromToolId
(
QString
id
)
{
return
mToolsIcon
.
value
(
id
);}
QString
iconFromToolId
(
QString
id
)
{
return
mToolsIcon
.
value
(
id
);}
...
...
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