|
|
@ -93,8 +93,10 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) |
|
|
|
, mCurrentStroke(0) |
|
|
|
, mCurrentStroke(0) |
|
|
|
, mShouldUseOMP(true) |
|
|
|
, mShouldUseOMP(true) |
|
|
|
, mItemCount(0) |
|
|
|
, mItemCount(0) |
|
|
|
|
|
|
|
, enableUndoRedoStack(true) |
|
|
|
, magniferControlViewWidget(0) |
|
|
|
, magniferControlViewWidget(0) |
|
|
|
, magniferDisplayViewWidget(0) |
|
|
|
, magniferDisplayViewWidget(0) |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
#ifdef __ppc__ |
|
|
|
#ifdef __ppc__ |
|
|
@ -139,6 +141,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); |
|
|
|
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsScene::~UBGraphicsScene() |
|
|
|
UBGraphicsScene::~UBGraphicsScene() |
|
|
@ -371,10 +375,13 @@ bool UBGraphicsScene::inputDeviceRelease() |
|
|
|
|
|
|
|
|
|
|
|
if (mRemovedItems.size() > 0 || mAddedItems.size() > 0) |
|
|
|
if (mRemovedItems.size() > 0 || mAddedItems.size() > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBGraphicsItemUndoCommand* udcmd = new UBGraphicsItemUndoCommand(this, mRemovedItems, mAddedItems); //deleted by the undoStack
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(UBApplication::undoStack) |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
UBApplication::undoStack->push(udcmd); |
|
|
|
UBGraphicsItemUndoCommand* udcmd = new UBGraphicsItemUndoCommand(this, mRemovedItems, mAddedItems); //deleted by the undoStack
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(UBApplication::undoStack) |
|
|
|
|
|
|
|
UBApplication::undoStack->push(udcmd); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mRemovedItems.clear(); |
|
|
|
mRemovedItems.clear(); |
|
|
|
mAddedItems.clear(); |
|
|
|
mAddedItems.clear(); |
|
|
@ -961,8 +968,11 @@ void UBGraphicsScene::clearItemsAndAnnotations() |
|
|
|
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
|
|
|
|
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
|
|
|
|
update(sceneRect()); |
|
|
|
update(sceneRect()); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setDocumentUpdated(); |
|
|
|
setDocumentUpdated(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -995,8 +1005,12 @@ void UBGraphicsScene::clearItems() |
|
|
|
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
|
|
|
|
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
|
|
|
|
update(sceneRect()); |
|
|
|
update(sceneRect()); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setDocumentUpdated(); |
|
|
|
setDocumentUpdated(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1022,8 +1036,12 @@ void UBGraphicsScene::clearAnnotations() |
|
|
|
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
|
|
|
|
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
|
|
|
|
update(sceneRect()); |
|
|
|
update(sceneRect()); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setDocumentUpdated(); |
|
|
|
setDocumentUpdated(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1044,8 +1062,10 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q |
|
|
|
|
|
|
|
|
|
|
|
addItem(pixmapItem); |
|
|
|
addItem(pixmapItem); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, pixmapItem); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, pixmapItem); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pixmapItem->scale(pScaleFactor, pScaleFactor); |
|
|
|
pixmapItem->scale(pScaleFactor, pScaleFactor); |
|
|
|
|
|
|
|
|
|
|
@ -1070,8 +1090,10 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem) |
|
|
|
void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBGraphicsTextItemUndoCommand* uc = new UBGraphicsTextItemUndoCommand(textItem); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
UBGraphicsTextItemUndoCommand* uc = new UBGraphicsTextItemUndoCommand(textItem); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1090,8 +1112,10 @@ UBGraphicsVideoItem* UBGraphicsScene::addVideo(const QUrl& pVideoFileUrl, bool s |
|
|
|
|
|
|
|
|
|
|
|
videoItem->show(); |
|
|
|
videoItem->show(); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, videoItem); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, videoItem); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
videoItem->mediaObject()->play(); |
|
|
|
videoItem->mediaObject()->play(); |
|
|
|
|
|
|
|
|
|
|
@ -1121,8 +1145,10 @@ UBGraphicsAudioItem* UBGraphicsScene::addAudio(const QUrl& pAudioFileUrl, bool s |
|
|
|
|
|
|
|
|
|
|
|
audioItem->show(); |
|
|
|
audioItem->show(); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, audioItem); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, audioItem); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
audioItem->mediaObject()->play(); |
|
|
|
audioItem->mediaObject()->play(); |
|
|
|
|
|
|
|
|
|
|
@ -1197,8 +1223,10 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co |
|
|
|
// graphicsWidget->widgetWebView()->loadMainHtml();
|
|
|
|
// graphicsWidget->widgetWebView()->loadMainHtml();
|
|
|
|
|
|
|
|
|
|
|
|
graphicsWidget->setSelected(true); |
|
|
|
graphicsWidget->setSelected(true); |
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, graphicsWidget); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, graphicsWidget); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setDocumentUpdated(); |
|
|
|
setDocumentUpdated(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1253,8 +1281,10 @@ UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPoint |
|
|
|
|
|
|
|
|
|
|
|
addItem(svgItem); |
|
|
|
addItem(svgItem); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, svgItem); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, svgItem); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setDocumentUpdated(); |
|
|
|
setDocumentUpdated(); |
|
|
|
|
|
|
|
|
|
|
@ -1314,8 +1344,10 @@ UBGraphicsTextItem* UBGraphicsScene::addTextWithFont(const QString& pString, con |
|
|
|
|
|
|
|
|
|
|
|
textItem->show(); |
|
|
|
textItem->show(); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); |
|
|
|
connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); |
|
|
|
|
|
|
|
|
|
|
@ -1337,8 +1369,10 @@ UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const Q |
|
|
|
addItem(textItem); |
|
|
|
addItem(textItem); |
|
|
|
textItem->show(); |
|
|
|
textItem->show(); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem); |
|
|
|
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem); |
|
|
|
|
|
|
|
UBApplication::undoStack->push(uc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), |
|
|
|
connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), |
|
|
|
this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); |
|
|
|
this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); |
|
|
|