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
545e3160
Commit
545e3160
authored
Sep 25, 2012
by
Guillaume Burel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'guillaume-dev' into develop
parents
36119103
ed67f1ba
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
15 deletions
+35
-15
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+1
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+12
-9
UBGraphicsCache.cpp
src/tools/UBGraphicsCache.cpp
+13
-2
UBGraphicsCache.h
src/tools/UBGraphicsCache.h
+9
-3
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
545e3160
...
@@ -3090,7 +3090,7 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
...
@@ -3090,7 +3090,7 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
UBGraphicsCache
*
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
cacheFromSvg
()
UBGraphicsCache
*
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
cacheFromSvg
()
{
{
UBGraphicsCache
*
pCache
=
new
UBGraphicsCache
(
);
UBGraphicsCache
*
pCache
=
UBGraphicsCache
::
instance
(
mScene
);
pCache
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Tool
));
pCache
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Tool
));
graphicsItemFromSvg
(
pCache
);
graphicsItemFromSvg
(
pCache
);
...
...
src/domain/UBGraphicsScene.cpp
View file @
545e3160
...
@@ -1603,6 +1603,9 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
...
@@ -1603,6 +1603,9 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
--
mItemCount
;
--
mItemCount
;
mFastAccessItems
.
removeAll
(
item
);
mFastAccessItems
.
removeAll
(
item
);
/* delete the item if it is cache to allow its reinstanciation, because Cache implements design pattern Singleton. */
if
(
dynamic_cast
<
UBGraphicsCache
*>
(
item
))
UBCoreGraphicsScene
::
deleteItem
(
item
);
}
}
void
UBGraphicsScene
::
removeItems
(
const
QSet
<
QGraphicsItem
*>&
items
)
void
UBGraphicsScene
::
removeItems
(
const
QSet
<
QGraphicsItem
*>&
items
)
...
@@ -1956,17 +1959,17 @@ void UBGraphicsScene::addAristo(QPointF center)
...
@@ -1956,17 +1959,17 @@ void UBGraphicsScene::addAristo(QPointF center)
void
UBGraphicsScene
::
addCache
()
void
UBGraphicsScene
::
addCache
()
{
{
UBGraphicsCache
*
cache
=
new
UBGraphicsCache
();
UBGraphicsCache
*
cache
=
UBGraphicsCache
::
instance
(
this
);
mTools
<<
cache
;
if
(
!
items
().
contains
(
cache
))
{
addItem
(
cache
);
addItem
(
cache
);
cache
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Tool
)
);
cache
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Tool
));
cache
->
setVisible
(
true
);
cache
->
setSelected
(
true
);
cache
->
setVisible
(
true
);
UBApplication
::
boardController
->
notifyCache
(
true
);
cache
->
setSelected
(
true
);
UBApplication
::
boardController
->
notifyPageChanged
();
UBApplication
::
boardController
->
notifyCache
(
true
);
}
UBApplication
::
boardController
->
notifyPageChanged
();
}
}
void
UBGraphicsScene
::
addMask
(
const
QPointF
&
center
)
void
UBGraphicsScene
::
addMask
(
const
QPointF
&
center
)
...
...
src/tools/UBGraphicsCache.cpp
View file @
545e3160
...
@@ -24,11 +24,21 @@
...
@@ -24,11 +24,21 @@
#include "core/memcheck.h"
#include "core/memcheck.h"
UBGraphicsCache
::
UBGraphicsCache
()
:
QGraphicsRectItem
()
QMap
<
UBGraphicsScene
*
,
UBGraphicsCache
*>
UBGraphicsCache
::
sInstances
;
UBGraphicsCache
*
UBGraphicsCache
::
instance
(
UBGraphicsScene
*
scene
)
{
if
(
!
sInstances
.
contains
(
scene
))
sInstances
.
insert
(
scene
,
new
UBGraphicsCache
(
scene
));
return
sInstances
[
scene
];
}
UBGraphicsCache
::
UBGraphicsCache
(
UBGraphicsScene
*
scene
)
:
QGraphicsRectItem
()
,
mMaskColor
(
Qt
::
black
)
,
mMaskColor
(
Qt
::
black
)
,
mMaskShape
(
eMaskShape_Circle
)
,
mMaskShape
(
eMaskShape_Circle
)
,
mShapeWidth
(
100
)
,
mShapeWidth
(
100
)
,
mDrawMask
(
false
)
,
mDrawMask
(
false
)
,
mScene
(
scene
)
{
{
// Get the board size and pass it to the shape
// Get the board size and pass it to the shape
QRect
boardRect
=
UBApplication
::
boardController
->
displayView
()
->
rect
();
QRect
boardRect
=
UBApplication
::
boardController
->
displayView
()
->
rect
();
...
@@ -39,11 +49,12 @@ UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
...
@@ -39,11 +49,12 @@ UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
UBGraphicsCache
::~
UBGraphicsCache
()
UBGraphicsCache
::~
UBGraphicsCache
()
{
{
sInstances
.
remove
(
mScene
);
}
}
UBItem
*
UBGraphicsCache
::
deepCopy
()
const
UBItem
*
UBGraphicsCache
::
deepCopy
()
const
{
{
UBGraphicsCache
*
copy
=
new
UBGraphicsCache
();
UBGraphicsCache
*
copy
=
new
UBGraphicsCache
(
mScene
);
copyItemParameters
(
copy
);
copyItemParameters
(
copy
);
...
...
src/tools/UBGraphicsCache.h
View file @
545e3160
...
@@ -30,7 +30,7 @@ typedef enum
...
@@ -30,7 +30,7 @@ typedef enum
class
UBGraphicsCache
:
public
QGraphicsRectItem
,
public
UBItem
class
UBGraphicsCache
:
public
QGraphicsRectItem
,
public
UBItem
{
{
public
:
public
:
UBGraphicsCache
(
);
static
UBGraphicsCache
*
instance
(
UBGraphicsScene
*
scene
);
~
UBGraphicsCache
();
~
UBGraphicsCache
();
enum
{
Type
=
UBGraphicsItemType
::
cacheItemType
};
enum
{
Type
=
UBGraphicsItemType
::
cacheItemType
};
...
@@ -55,8 +55,7 @@ protected:
...
@@ -55,8 +55,7 @@ protected:
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
private
:
private
:
void
init
();
static
QMap
<
UBGraphicsScene
*
,
UBGraphicsCache
*>
sInstances
;
QRectF
updateRect
(
QPointF
currentPoint
);
QColor
mMaskColor
;
QColor
mMaskColor
;
eMaskShape
mMaskShape
;
eMaskShape
mMaskShape
;
...
@@ -65,6 +64,13 @@ private:
...
@@ -65,6 +64,13 @@ private:
QPointF
mShapePos
;
QPointF
mShapePos
;
int
mOldShapeWidth
;
int
mOldShapeWidth
;
QPointF
mOldShapePos
;
QPointF
mOldShapePos
;
UBGraphicsScene
*
mScene
;
UBGraphicsCache
(
UBGraphicsScene
*
scene
);
void
init
();
QRectF
updateRect
(
QPointF
currentPoint
);
};
};
#endif // UBGRAPHICSCACHE_H
#endif // UBGRAPHICSCACHE_H
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