View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0010808 | Scribus | Undo/Redo | public | 2012-06-27 13:49 | 2012-07-01 20:31 |
Reporter | Chelen | Assigned To | Chelen | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | 1.5.0svn | ||||
Target Version | 1.5.0svn | Fixed in Version | 1.5.0svn | ||
Summary | 0010808: GSoC : git branch about option undo/redo functionnality | ||||
Description | Undo/redo for rounded corner fix for change shape Improve of grouping/ungrouping undo/redo (for a better one, I will need to work on "how undo/redo work") fix of flip item undo/redo undo/redo for show image option undo/redo for image resolution option undo/redo for pdf action option undo/redo for blend mode option undo/redo for overprint option ping me on IRC when you want the diff file :-) | ||||
Tags | No tags attached. | ||||
Patch | |||||
related to | 0004832 | closed | Chelen | Undo: setting transpareny mode is not recorded by undo system |
related to | 0004833 | closed | Chelen | Undo: overprint setting change is not recorded in undo system |
related to | 0003414 | closed | Chelen | PDF-Options for textframes do not create undo actions |
related to | 0010452 | closed | Chelen | Grouped objects should keep moving 1 by 1 cm through PP |
parent of | 0010809 | closed | Chelen | Undo/redo for rounded corner |
parent of | 0010810 | closed | Chelen | flip item undo/redo |
parent of | 0010811 | closed | Chelen | undo/redo for show image option |
parent of | 0010812 | closed | Chelen | undo/redo for image resolution option |
|
Patch.diff (39,803 bytes)
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc91882 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +sys$command diff --git a/Scribus/scribus/pageitem.cpp b/Scribus/scribus/pageitem.cpp index fb7e695..7c84596 100644 --- a/Scribus/scribus/pageitem.cpp +++ b/Scribus/scribus/pageitem.cpp @@ -1490,6 +1490,13 @@ void PageItem::setColumnGap(double gap) void PageItem::setCornerRadius(double newRadius) { + if(RadRect==newRadius) + return; + SimpleState *state = new SimpleState(Um::RoundCorner,"",Um::IBorder); + state->set("CORNER_RADIUS","corner_radius"); + state->set("OLD_RADIUS",RadRect); + state->set("NEW_RADIUS",newRadius); + undoManager->action(this,state); RadRect=newRadius; //emit cornerRadius(RadRect); } @@ -3576,6 +3583,13 @@ void PageItem::setFillBlendmode(int newBlendmode) { if (fillBlendmodeVal == newBlendmode) return; // nothing to do -> return + if (UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::BlendMode, 0, Um::IGroup); + ss->set("FILLBLENDMODE", newBlendmode); + ss->set("FILLBLENDMODE_OLD", fillBlendmodeVal); + undoManager->action(this, ss); + } fillBlendmodeVal = newBlendmode; } @@ -3802,6 +3816,13 @@ void PageItem::setLineBlendmode(int newBlendmode) { if (lineBlendmodeVal == newBlendmode) return; // nothing to do -> return + if (UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::BlendMode, 0, Um::IGroup); + ss->set("LINEBLENDMODE", newBlendmode); + ss->set("LINEBLENDMODE_OLD", lineBlendmodeVal); + undoManager->action(this, ss); + } lineBlendmodeVal = newBlendmode; } @@ -4001,6 +4022,19 @@ void PageItem::setImageScalingMode(bool freeScale, bool keepRatio) update(); } +void PageItem::setOverprint(bool val) { + if(doOverprint==val) + return; + + if (UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::Overprint, 0, Um::IGroup); + ss->set("OVERPRINT", val); + undoManager->action(this, ss); + } + doOverprint = val; +} + void PageItem::toggleLock() { if (UndoManager::undoEnabled()) @@ -4462,11 +4496,48 @@ void PageItem::restore(UndoState *state, bool isUndo) restoreFirstLineOffset(ss,isUndo); else if (ss->contains("PASTE_TEXT")) restorePasteText(ss,isUndo); + else if (ss->contains("CORNER_RADIUS")) + restoreCornerRadius(ss,isUndo); else if (ss->contains("IMAGEFLIPH")) { select(); m_Doc->itemSelection_FlipH(); } + else if (ss->contains("OVERPRINT")) + { + if(isUndo) + doOverprint=!ss->getBool("OVERPRINT"); + else + doOverprint=ss->getBool("OVERPRINT"); + } + else if (ss->contains("FILLBLENDMODE")) + { + if(isUndo) + fillBlendmodeVal=ss->getInt("FILLBLENDMODE_OLD"); + else + fillBlendmodeVal=ss->getInt("FILLBLENDMODE"); + } + else if (ss->contains("ACTIONPDFANNOTATION")) + { + if(isUndo) + m_isAnnotation=!ss->getBool("ACTIONPDFANNOTATION"); + else + m_isAnnotation=ss->getBool("ACTIONPDFANNOTATION"); + } + else if (ss->contains("ACTIONPDFBOOKMARK")) + { + if(isUndo) + isBookmark=!ss->getBool("ACTIONPDFBOOKMARK"); + else + isBookmark=ss->getBool("ACTIONPDFBOOKMARK"); + } + else if (ss->contains("LINEBLENDMODE")) + { + if(isUndo) + lineBlendmodeVal=ss->getInt("LINEBLENDMODE_OLD"); + else + lineBlendmodeVal=ss->getInt("LINEBLENDMODE"); + } else if (ss->contains("IMAGEFLIPV")) { select(); @@ -4489,6 +4560,8 @@ void PageItem::restore(UndoState *state, bool isUndo) } else if (ss->contains("NEW_NAME")) restoreName(ss, isUndo); + else if (ss->contains("SHOW_IMAGE")) + restoreShowImage(ss, isUndo); else if (ss->contains("TRANSPARENCY")) restoreFillTP(ss, isUndo); else if (ss->contains("LINE_TRANSPARENCY")) @@ -4523,6 +4596,8 @@ void PageItem::restore(UndoState *state, bool isUndo) restorePoly(ss, isUndo, true); else if (ss->contains("EDIT_SHAPE")) restorePoly(ss, isUndo, false); + else if (ss->contains("RES_TYP")) + restoreResTyp(ss, isUndo); else if (ss->contains("RESET_CONTOUR")) restoreContourLine(ss, isUndo); else if (ss->contains("CHANGE_SHAPE_TYPE")) @@ -4758,6 +4833,18 @@ void PageItem::restoreInsertFrameText(SimpleState *ss, bool isUndo){ } else { itemText.insertChars(start,text); } + +void PageItem::restoreCornerRadius(SimpleState *state, bool isUndo) +{ + if(isUndo) + RadRect=state->getDouble("OLD_RADIUS"); + else + RadRect=state->getDouble("NEW_RADIUS"); + Selection tmpSelection(doc()->m_Selection); + doc()->m_Selection->clear(); + doc()->m_Selection->addItem(this); + doc()->scMW()->view->SetFrameRounded(); + *(doc()->m_Selection) = tmpSelection; } void PageItem::restoreMove(SimpleState *state, bool isUndo) @@ -4851,6 +4938,16 @@ void PageItem::restoreRotate(SimpleState *state, bool isUndo) oldHeight = Height; } +void PageItem::restoreShowImage(SimpleState *state, bool isUndo) +{ + bool old = state->getBool("OLD"); + if (isUndo) + PicArt = old; + else + PicArt = !old; + update(); +} + void PageItem::restoreFill(SimpleState *state, bool isUndo) { QString fill = state->get("OLD_FILL"); @@ -4860,6 +4957,16 @@ void PageItem::restoreFill(SimpleState *state, bool isUndo) m_Doc->itemSelection_SetItemBrush(fill); } +void PageItem::restoreResTyp(SimpleState *state, bool isUndo) +{ + if (isUndo){ + setResolution(state->getInt("OLD_RES")); + } else { + setResolution(state->getInt("NEW_RES")); + } + doc()->updatePic(); +} + void PageItem::restoreShade(SimpleState *state, bool isUndo) { int shade = state->getInt("OLD_SHADE"); @@ -5285,13 +5392,15 @@ void PageItem::restoreShapeType(SimpleState *state, bool isUndo) { this->FrameType = is->getInt("OLD_FRAME_TYPE"); this->PoLine = is->getItem().first; + ClipEdited = !(FrameType == 0 || FrameType == 1); } else { this->FrameType = is->getInt("NEW_FRAME_TYPE"); this->PoLine = is->getItem().second; + ClipEdited = (FrameType == 0 || FrameType == 1); } - ClipEdited = true; + Clip = FlattenPath(PoLine,Segments); } } @@ -7291,9 +7400,43 @@ void PageItem::emitAllToGUI() void PageItem::setIsAnnotation(bool isAnnot) { + if (m_isAnnotation==isAnnot) + return; // nothing to do -> return + if (UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::ActionPDF, 0, Um::IGroup); + ss->set("ACTIONPDFANNOTATION", isAnnot); + undoManager->action(this, ss); + } m_isAnnotation=isAnnot; } +void PageItem::setIsBookMark(bool isBM) +{ + if (isBookmark==isBM) + return; // nothing to do -> return + if (UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::ActionPDF, 0, Um::IGroup); + ss->set("ACTIONPDFBOOKMARK", isBM); + undoManager->action(this, ss); + } + isBookmark=isBM; +} + +void PageItem::setResolution(int id){ + if(pixm.imgInfo.lowResType==id) + return; + if(UndoManager::undoEnabled()){ + SimpleState *ss = new SimpleState(Um::ResTyp,"",Um::IImageFrame); + ss->set("RES_TYP","res_typ"); + ss->set("OLD_RES",pixm.imgInfo.lowResType); + ss->set("NEW_RES",id); + undoManager->action(this,ss); + } + pixm.imgInfo.lowResType = id; +} + void PageItem::setAnnotation(const Annotation& ad) { m_annotation=ad; @@ -7301,6 +7444,14 @@ void PageItem::setAnnotation(const Annotation& ad) void PageItem::setImageShown(bool isShown) { + if(PicArt==isShown) + return; + if(UndoManager::undoEnabled()){ + SimpleState *ss = new SimpleState(Um::ResTyp,"",Um::IImageFrame); + ss->set("SHOW_IMAGE","show_image"); + ss->set("OLD",PicArt); + undoManager->action(this,ss); + } PicArt=isShown; } diff --git a/Scribus/scribus/pageitem.h b/Scribus/scribus/pageitem.h index d0fba00..387d3d8 100644 --- a/Scribus/scribus/pageitem.h +++ b/Scribus/scribus/pageitem.h @@ -488,6 +488,7 @@ public: QString externalFile() const { return Pfile; } void setExternalFile(QString val); void setImagePagenumber(int num) { pixm.imgInfo.actualPageNumber = num; } + void setResolution(int); //FIXME: maybe these should go into annotation? QString fileIconPressed() const { return Pfile2; } @@ -703,7 +704,7 @@ public: void setFillEvenOdd(bool val) { fillRule = val; } // bool overprint() const { return doOverprint; } - void setOverprint(bool val) { doOverprint = val; } + void setOverprint(bool val); // rect / oval / round / other int frameType() const { return FrameType; } void setFrameType(int val) { FrameType = val; } @@ -1180,6 +1181,7 @@ public: bool isAnnotation() const { return m_isAnnotation; } void setIsAnnotation(bool); + void setIsBookMark(bool); void setAnnotation(const Annotation& ad); Annotation& annotation() { return m_annotation; } const Annotation& annotation() const { return m_annotation; } @@ -1226,6 +1228,9 @@ protected: void restoreLoremIpsum(SimpleState *state, bool isUndo); void restoreDeleteFrameText(SimpleState *state, bool isUndo); void restoreInsertFrameText(SimpleState *state, bool isUndo); + void restoreCornerRadius(SimpleState *state, bool isUndo); + void restoreShowImage(SimpleState *state, bool isUndo); + void restoreResTyp(SimpleState *state, bool isUndo); void restoreMove(SimpleState *state, bool isUndo); void restoreResize(SimpleState *state, bool isUndo); void restoreRotate(SimpleState *state, bool isUndo); diff --git a/Scribus/scribus/scribus.cpp b/Scribus/scribus/scribus.cpp index 47011bd..ecf6a82 100644 --- a/Scribus/scribus/scribus.cpp +++ b/Scribus/scribus/scribus.cpp @@ -9959,7 +9959,6 @@ void ScribusMainWindow::PutToPatterns() uint docSelectionCount = doc->m_Selection->count(); QString patternName = "Pattern_"+doc->m_Selection->itemAt(0)->itemName(); patternName = patternName.trimmed().simplified().replace(" ", "_"); - bool wasUndo = undoManager->undoEnabled(); undoManager->setUndoEnabled(false); PageItem* currItem; Selection itemSelection(this, false); @@ -10066,7 +10065,7 @@ void ScribusMainWindow::PutToPatterns() if (outlinePalette->isVisible()) outlinePalette->BuildTree(); view->DrawNew(); - undoManager->setUndoEnabled(wasUndo); + undoManager->setUndoEnabled(true); } void ScribusMainWindow::managePaints() diff --git a/Scribus/scribus/scribusdoc.cpp b/Scribus/scribus/scribusdoc.cpp index 99f5c32..4543754 100644 --- a/Scribus/scribus/scribusdoc.cpp +++ b/Scribus/scribus/scribusdoc.cpp @@ -1663,7 +1663,7 @@ void ScribusDoc::restore(UndoState* state, bool isUndo) if (ss->contains("GROUP")) restoreGrouping(ss, isUndo); else if (ss->contains("UNGROUP")) - restoreUngrouping(ss, isUndo); + restoreGrouping(ss, !isUndo); else if (ss->contains("GUIDE_LOCK")) { if (isUndo) @@ -1864,48 +1864,25 @@ void ScribusDoc::restoreAddMasterPage(SimpleState *ss, bool isUndo) void ScribusDoc::restoreGrouping(SimpleState *state, bool isUndo) { double x, y, w, h; - Selection tmpSelection(this, false); - int itemCount = state->getInt("itemcount"); + ScItemState<QList<QPointer<PageItem> > > *is = dynamic_cast<ScItemState<QList<QPointer<PageItem> > >*>(state); + QList<QPointer<PageItem> > select = is->getItem(); m_Selection->setGroupRect(); m_Selection->getGroupRect(&x, &y, &w, &h); m_Selection->delaySignalsOn(); - m_Selection->clear(); - for (int i = 0; i < itemCount; ++i) - { - int itemNr = getItemNrfromUniqueID(state->getUInt(QString("item%1").arg(i))); - if (Items->at(itemNr)->uniqueNr == state->getUInt(QString("item%1").arg(i))) - tmpSelection.addItem(Items->at(itemNr)); + Selection tempSelect(this,false); + if(isUndo){ + tempSelect.addItem(select.last()); + itemSelection_UnGroupObjects(&tempSelect); } - if (isUndo) - itemSelection_UnGroupObjects(&tmpSelection); - else - itemSelection_GroupObjects(false, false, &tmpSelection); - QRectF rect(x, y , w, h); - regionsChanged()->update(rect.adjusted(-10, -10, 20, 20)); - m_Selection->delaySignalsOff(); -} - -void ScribusDoc::restoreUngrouping(SimpleState *state, bool isUndo) -{ - double x, y, w, h; - Selection tmpSelection(this, false); - int itemCount = state->getInt("itemcount"); - m_Selection->setGroupRect(); - m_Selection->getGroupRect(&x, &y, &w, &h); - m_Selection->delaySignalsOn(); - m_Selection->clear(); - for (int i = 0; i < itemCount; ++i) - { - int itemNr = getItemNrfromUniqueID(state->getUInt(QString("item%1").arg(i))); - if (Items->at(itemNr)->uniqueNr == state->getUInt(QString("item%1").arg(i))) + else { + for (int i = 0; i < select.size()-1; ++i) { - tmpSelection.addItem(Items->at(itemNr)); + tempSelect.addItem(select.at(i)); } + select.removeLast(); + select.append(itemSelection_GroupObjects(false, false,&tempSelect)); + is->setItem(select); } - if (isUndo) - itemSelection_GroupObjects(false, false, &tmpSelection); - else - itemSelection_UnGroupObjects(&tmpSelection); QRectF rect(x, y , w, h); regionsChanged()->update(rect.adjusted(-10, -10, 20, 20)); m_Selection->delaySignalsOff(); @@ -10130,9 +10107,9 @@ void ScribusDoc::itemSelection_FlipH() uint docSelectionCount=m_Selection->count(); if (docSelectionCount == 0) return; + UndoTransaction trans(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipH, 0, Um::IFlipH)); if (docSelectionCount > 1) { - UndoTransaction trans(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipH, 0, Um::IFlipH)); double gx, gy, gh, gw, ix, iy, iw, ih; m_Selection->getGroupRect(&gx, &gy, &gw, &gh); for (uint a = 0; a < docSelectionCount; ++a) @@ -10182,55 +10159,52 @@ void ScribusDoc::itemSelection_FlipH() emit updateEditItem(); currItem->setRedrawBounding(); } - trans.commit(); } else { - for (uint a = 0; a < docSelectionCount; ++a) + PageItem* currItem=m_Selection->itemAt(0); + if (currItem->isImageFrame() || currItem->isTextFrame() || currItem->isLatexFrame() || currItem->isOSGFrame() || currItem->isSymbol() || currItem->isGroup() || currItem->isSpiral()) + currItem->flipImageH(); + if (currItem->itemType() != PageItem::Line) + MirrorPolyH(currItem); + else { - PageItem* currItem=m_Selection->itemAt(a); - if (currItem->isImageFrame() || currItem->isTextFrame() || currItem->isLatexFrame() || currItem->isOSGFrame() || currItem->isSymbol() || currItem->isGroup() || currItem->isSpiral()) - currItem->flipImageH(); - if (currItem->itemType() != PageItem::Line) - MirrorPolyH(currItem); - else - { - double ix2, iy2, iw2, ih2, ix, iy, iw, ih; - currItem->getBoundingRect(&ix, &iy, &iw, &ih); - currItem->rotateBy(currItem->rotation() * -2.0); - currItem->setRedrawBounding(); - currItem->getBoundingRect(&ix2, &iy2, &iw2, &ih2); - currItem->moveBy(ix-ix2, iy-iy2, true); - currItem->setRedrawBounding(); - } - currItem->GrStartX = currItem->width() - currItem->GrStartX; - currItem->GrEndX = currItem->width() - currItem->GrEndX; - if (currItem->isArc()) - { - PageItem_Arc *ar = currItem->asArc(); - ar->arcStartAngle = (180 - ar->arcStartAngle) - ar->arcSweepAngle; - if (ar->arcStartAngle < 0) - ar->arcStartAngle += 360; - else if (ar->arcStartAngle > 360) - ar->arcStartAngle -= 360; - ar->recalcPath(); - FPoint tp2(getMinClipF(&currItem->PoLine)); - currItem->PoLine.translate(-tp2.x(), -tp2.y()); - AdjustItemSize(currItem); - emit updateEditItem(); - } - else if (currItem->isRegularPolygon()) - { - PageItem_RegularPolygon *ar = currItem->asRegularPolygon(); - ar->polyRotation *= -1; - ar->polyInnerRot *= -1; - ar->recalcPath(); - emit updateEditItem(); - } - else if (currItem->isSpiral()) - emit updateEditItem(); + double ix2, iy2, iw2, ih2, ix, iy, iw, ih; + currItem->getBoundingRect(&ix, &iy, &iw, &ih); + currItem->rotateBy(currItem->rotation() * -2.0); + currItem->setRedrawBounding(); + currItem->getBoundingRect(&ix2, &iy2, &iw2, &ih2); + currItem->moveBy(ix-ix2, iy-iy2, true); + currItem->setRedrawBounding(); + } + currItem->GrStartX = currItem->width() - currItem->GrStartX; + currItem->GrEndX = currItem->width() - currItem->GrEndX; + if (currItem->isArc()) + { + PageItem_Arc *ar = currItem->asArc(); + ar->arcStartAngle = (180 - ar->arcStartAngle) - ar->arcSweepAngle; + if (ar->arcStartAngle < 0) + ar->arcStartAngle += 360; + else if (ar->arcStartAngle > 360) + ar->arcStartAngle -= 360; + ar->recalcPath(); + FPoint tp2(getMinClipF(&currItem->PoLine)); + currItem->PoLine.translate(-tp2.x(), -tp2.y()); + AdjustItemSize(currItem); + emit updateEditItem(); } + else if (currItem->isRegularPolygon()) + { + PageItem_RegularPolygon *ar = currItem->asRegularPolygon(); + ar->polyRotation *= -1; + ar->polyInnerRot *= -1; + ar->recalcPath(); + emit updateEditItem(); + } + else if (currItem->isSpiral()) + emit updateEditItem(); } + trans.commit(); regionsChanged()->update(QRectF()); changed(); emit firstSelectedItemType(m_Selection->itemAt(0)->itemType()); @@ -10242,9 +10216,9 @@ void ScribusDoc::itemSelection_FlipV() uint docSelectionCount=m_Selection->count(); if (docSelectionCount == 0) return; + UndoTransaction trans(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipV, 0, Um::IFlipV)); if (docSelectionCount > 1) { - UndoTransaction trans(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipV, 0, Um::IFlipV)); double gx, gy, gh, gw, ix, iy, iw, ih; m_Selection->getGroupRect(&gx, &gy, &gw, &gh); for (uint a = 0; a < docSelectionCount; ++a) @@ -10297,58 +10271,55 @@ void ScribusDoc::itemSelection_FlipV() currItem->setRedrawBounding(); } regionsChanged()->update(QRectF()); - trans.commit(); } else { - for (uint a = 0; a < docSelectionCount; ++a) + PageItem* currItem=m_Selection->itemAt(0); + if (currItem->isImageFrame() || currItem->isTextFrame() || currItem->isLatexFrame() || currItem->isOSGFrame() || currItem->isSymbol() || currItem->isGroup() || currItem->isSpiral()) + currItem->flipImageV(); + if (currItem->itemType() != PageItem::Line) + MirrorPolyV(currItem); + else { - PageItem* currItem=m_Selection->itemAt(a); - if (currItem->isImageFrame() || currItem->isTextFrame() || currItem->isLatexFrame() || currItem->isOSGFrame() || currItem->isSymbol() || currItem->isGroup() || currItem->isSpiral()) - currItem->flipImageV(); - if (currItem->itemType() != PageItem::Line) - MirrorPolyV(currItem); - else - { - double ix2, iy2, iw2, ih2, ix, iy, iw, ih; - currItem->getBoundingRect(&ix, &iy, &iw, &ih); - currItem->rotateBy(currItem->rotation() * -2.0); - currItem->setRedrawBounding(); - currItem->getBoundingRect(&ix2, &iy2, &iw2, &ih2); - currItem->moveBy(ix-ix2, iy-iy2, true); - currItem->setRedrawBounding(); - } - currItem->GrStartY = currItem->height() - currItem->GrStartY; - currItem->GrEndY = currItem->height() - currItem->GrEndY; - if (currItem->isArc()) - { - PageItem_Arc *ar = currItem->asArc(); - ar->arcStartAngle *= -1; - ar->arcStartAngle -= ar->arcSweepAngle; - if (ar->arcStartAngle < 0) - ar->arcStartAngle += 360; - else if (ar->arcStartAngle > 360) - ar->arcStartAngle -= 360; - ar->recalcPath(); - FPoint tp2(getMinClipF(&currItem->PoLine)); - currItem->PoLine.translate(-tp2.x(), -tp2.y()); - AdjustItemSize(currItem); - emit updateEditItem(); - } - else if (currItem->isRegularPolygon()) - { - PageItem_RegularPolygon *ar = currItem->asRegularPolygon(); - ar->polyRotation = 180.0 - ar->polyRotation; - ar->polyRotation *= -1; - ar->polyInnerRot *= -1; - ar->recalcPath(); - emit updateEditItem(); - } - else if (currItem->isSpiral()) - emit updateEditItem(); + double ix2, iy2, iw2, ih2, ix, iy, iw, ih; + currItem->getBoundingRect(&ix, &iy, &iw, &ih); + currItem->rotateBy(currItem->rotation() * -2.0); + currItem->setRedrawBounding(); + currItem->getBoundingRect(&ix2, &iy2, &iw2, &ih2); + currItem->moveBy(ix-ix2, iy-iy2, true); + currItem->setRedrawBounding(); } + currItem->GrStartY = currItem->height() - currItem->GrStartY; + currItem->GrEndY = currItem->height() - currItem->GrEndY; + if (currItem->isArc()) + { + PageItem_Arc *ar = currItem->asArc(); + ar->arcStartAngle *= -1; + ar->arcStartAngle -= ar->arcSweepAngle; + if (ar->arcStartAngle < 0) + ar->arcStartAngle += 360; + else if (ar->arcStartAngle > 360) + ar->arcStartAngle -= 360; + ar->recalcPath(); + FPoint tp2(getMinClipF(&currItem->PoLine)); + currItem->PoLine.translate(-tp2.x(), -tp2.y()); + AdjustItemSize(currItem); + emit updateEditItem(); + } + else if (currItem->isRegularPolygon()) + { + PageItem_RegularPolygon *ar = currItem->asRegularPolygon(); + ar->polyRotation = 180.0 - ar->polyRotation; + ar->polyRotation *= -1; + ar->polyInnerRot *= -1; + ar->recalcPath(); + emit updateEditItem(); + } + else if (currItem->isSpiral()) + emit updateEditItem(); regionsChanged()->update(QRectF()); } + trans.commit(); changed(); emit firstSelectedItemType(m_Selection->itemAt(0)->itemType()); } @@ -10376,6 +10347,9 @@ void ScribusDoc::itemSelection_ChangePreviewResolution(int id) uint selectedItemCount=m_Selection->count(); if (selectedItemCount != 0) { + UndoTransaction* activeTransaction = NULL; + if(UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection, Um::IGroup,Um::ResTyp, "", Um::IImageFrame)); PageItem *currItem; bool found=false; for (uint i = 0; i < selectedItemCount; ++i) @@ -10384,23 +10358,19 @@ void ScribusDoc::itemSelection_ChangePreviewResolution(int id) if (currItem!=NULL) if (currItem->asImageFrame()) { - currItem->pixm.imgInfo.lowResType = id; + currItem->setResolution(id); if (!found) found=true; } } + if(activeTransaction){ + activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; + } if (!found) //No image frames in the current selection! return; updatePic(); - disconnect( m_ScMW->scrActions["itemPreviewLow"], SIGNAL(triggeredData(int)) , 0, 0 ); - disconnect( m_ScMW->scrActions["itemPreviewNormal"], SIGNAL(triggeredData(int)) , 0, 0 ); - disconnect( m_ScMW->scrActions["itemPreviewFull"], SIGNAL(triggeredData(int)) , 0, 0 ); - m_ScMW->scrActions["itemPreviewLow"]->setChecked(id==m_ScMW->scrActions["itemPreviewLow"]->actionInt()); - m_ScMW->scrActions["itemPreviewNormal"]->setChecked(id==m_ScMW->scrActions["itemPreviewNormal"]->actionInt()); - m_ScMW->scrActions["itemPreviewFull"]->setChecked(id==m_ScMW->scrActions["itemPreviewFull"]->actionInt()); - connect( m_ScMW->scrActions["itemPreviewLow"], SIGNAL(triggeredData(int)), this, SLOT(itemSelection_ChangePreviewResolution(int)) ); - connect( m_ScMW->scrActions["itemPreviewNormal"], SIGNAL(triggeredData(int)), this, SLOT(itemSelection_ChangePreviewResolution(int)) ); - connect( m_ScMW->scrActions["itemPreviewFull"], SIGNAL(triggeredData(int)), this, SLOT(itemSelection_ChangePreviewResolution(int)) ); } } @@ -10831,6 +10801,9 @@ void ScribusDoc::itemSelection_SetItemFillBlend(int t) uint selectedItemCount=m_Selection->count(); if (selectedItemCount != 0) { + UndoTransaction* activeTransaction = NULL; + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction()); for (uint i = 0; i < selectedItemCount; ++i) { PageItem *currItem = m_Selection->itemAt(i); @@ -10840,6 +10813,15 @@ void ScribusDoc::itemSelection_SetItemFillBlend(int t) } regionsChanged()->update(QRectF()); changed(); + if (activeTransaction){ + activeTransaction->commit(Um::Selection, + Um::IGroup, + Um::BlendMode, + "", + Um::IGroup); + delete activeTransaction; + activeTransaction = NULL; + } } } @@ -10849,6 +10831,9 @@ void ScribusDoc::itemSelection_SetItemLineBlend(int t) uint selectedItemCount=m_Selection->count(); if (selectedItemCount != 0) { + UndoTransaction* activeTransaction = NULL; + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction()); for (uint i = 0; i < selectedItemCount; ++i) { PageItem *currItem = m_Selection->itemAt(i); @@ -10856,6 +10841,15 @@ void ScribusDoc::itemSelection_SetItemLineBlend(int t) } regionsChanged()->update(QRectF()); changed(); + if (activeTransaction){ + activeTransaction->commit(Um::Selection, + Um::IGroup, + Um::BlendMode, + "", + Um::IGroup); + delete activeTransaction; + activeTransaction = NULL; + } } } @@ -10931,12 +10925,24 @@ void ScribusDoc::itemSelection_SetOverprint(bool overprint, Selection* customSel if (selectedItemCount == 0) return; m_updateManager.setUpdatesDisabled(); + UndoTransaction* activeTransaction = NULL; + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction()); for (uint i = 0; i < selectedItemCount; ++i) { PageItem* currItem = itemSelection->itemAt(i); currItem->setOverprint(overprint); currItem->update(); } + if (activeTransaction){ + activeTransaction->commit(Um::Selection, + Um::IGroup, + Um::Overprint, + "", + Um::IGroup); + delete activeTransaction; + activeTransaction = NULL; + } m_updateManager.setUpdatesEnabled(); changed(); } @@ -14025,7 +14031,7 @@ void ScribusDoc::groupObjectsToItem(PageItem* groupItem, QList<PageItem*> &itemL itemList.append(groupItem); } -const PageItem * ScribusDoc::itemSelection_GroupObjects(bool changeLock, bool lock, Selection* customSelection) +PageItem * ScribusDoc::itemSelection_GroupObjects(bool changeLock, bool lock, Selection* customSelection) { Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection; if (itemSelection->count() < 1) @@ -14036,36 +14042,21 @@ const PageItem * ScribusDoc::itemSelection_GroupObjects(bool changeLock, bool lo PageItem *currItem; PageItem* bb; double x, y, w, h; + UndoTransaction activeTransaction(undoManager->beginTransaction(Um::Selection,Um::IGroup,Um::Group,"",Um::IGroup)); uint selectedItemCount = itemSelection->count(); QString tooltip = Um::ItemsInvolved + "\n"; if (selectedItemCount > Um::ItemsInvolvedLimit) tooltip = Um::ItemsInvolved2 + "\n"; if (changeLock) { - uint lockedCount=0; - for (uint a=0; a<selectedItemCount; ++a) + for (uint c=0; c < selectedItemCount; ++c) { - if (itemSelection->itemAt(a)->locked()) - ++lockedCount; - } - if (lockedCount!=0 && lockedCount!=selectedItemCount) - { - for (uint a=0; a<selectedItemCount; ++a) - { - currItem = itemSelection->itemAt(a); - if (currItem->locked()) - { - for (uint c=0; c < selectedItemCount; ++c) - { - bb = itemSelection->itemAt(c); - bb->setLocked(lock); - if (m_ScMW && ScCore->usingGUI()) - m_ScMW->scrActions["itemLock"]->setChecked(lock); - if (selectedItemCount <= Um::ItemsInvolvedLimit) - tooltip += "\t" + currItem->getUName() + "\n"; - } - } - } + bb = itemSelection->itemAt(c); + bb->setLocked(lock); + //if (m_ScMW && ScCore->usingGUI()) + // m_ScMW->scrActions["itemLock"]->setChecked(lock); + if (selectedItemCount <= Um::ItemsInvolvedLimit) + tooltip += "\t" + currItem->getUName() + "\n"; } } itemSelection->getVisualGroupRect(&x, &y, &w, &h); @@ -14115,18 +14106,17 @@ const PageItem * ScribusDoc::itemSelection_GroupObjects(bool changeLock, bool lo currItem->Parent = groupItem; } groupItem->asGroupFrame()->adjustXYPosition(); + + ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(UndoManager::Group); + is->set("GROUP", "group"); + itemSelection->addItem(groupItem,true); + is->setItem(itemSelection->selectionList()); + undoManager->action(this, is); + activeTransaction.commit(); + itemSelection->clear(); itemSelection->addItem(groupItem); - selectedItemCount = groupItem->groupItemList.count(); - SimpleState *ss = new SimpleState(Um::Group, tooltip); - ss->set("GROUP", "group"); - ss->set("itemcount", selectedItemCount + 1); - ss->set(QString("item%1").arg(0), groupItem->uniqueNr); - for (int a = 0; a < groupItem->groupItemList.count(); ++a) - { - currItem = groupItem->groupItemList.at(a); - ss->set(QString("item%1").arg(a + 1), currItem->uniqueNr); - } + GroupCounter++; regionsChanged()->update(QRectF(gx-5, gy-5, gw+10, gh+10)); emit docChanged(); @@ -14136,7 +14126,6 @@ const PageItem * ScribusDoc::itemSelection_GroupObjects(bool changeLock, bool lo m_ScMW->scrActions["itemGroup"]->setEnabled(false); m_ScMW->scrActions["itemUngroup"]->setEnabled(true); } - undoManager->action(this, ss, Um::SelectionGroup, Um::IGroup); return groupItem; } @@ -14147,6 +14136,7 @@ void ScribusDoc::itemSelection_UnGroupObjects(Selection* customSelection) { uint docSelectionCount = itemSelection->count(); PageItem *currItem; + UndoTransaction activeTransaction(undoManager->beginTransaction(Um::Selection,Um::IGroup,Um::Ungroup,"",Um::IGroup)); QList<PageItem*> toDelete; for (uint a=0; a < docSelectionCount; ++a) { @@ -14218,6 +14208,13 @@ void ScribusDoc::itemSelection_UnGroupObjects(Selection* customSelection) setRedrawBounding(rItem); rItem->OwnPage = OnPage(rItem); } + + ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(UndoManager::Ungroup); + is->set("UNGROUP", "ungroup"); + tempSelection.addItem(currItem,true); + is->setItem(tempSelection.selectionList()); + undoManager->action(this, is); + tempSelection.clear(); tempSelection.delaySignalsOff(); /* currItem = toDelete.at(b); @@ -14250,14 +14247,9 @@ void ScribusDoc::itemSelection_UnGroupObjects(Selection* customSelection) currItem = toDelete.at(0); delete currItem; } + activeTransaction.commit(); - // Create undo actions -/* UndoTransaction* undoTransaction = NULL; - if (UndoManager::undoEnabled() && toDelete.count() > 1) - { - undoTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Ungroup, "", Um::IGroup)); - } - QMap<int, QList<PageItem*> >::iterator groupIt; +/* QMap<int, QList<PageItem*> >::iterator groupIt; for (it = toDelete.begin(); it != toDelete.end(); ++it) { // PageItem* groupItem = it.key(); @@ -14266,32 +14258,7 @@ void ScribusDoc::itemSelection_UnGroupObjects(Selection* customSelection) if (groupIt == groupObjects.end()) continue; QList<PageItem*> groupItems = groupIt.value(); - - docSelectionCount = groupItems.count(); - SimpleState *ss = new SimpleState(Um::Ungroup); - ss->set("UNGROUP", "ungroup"); - ss->set("itemcount", docSelectionCount); - QString tooltip = Um::ItemsInvolved + "\n"; - if (docSelectionCount > Um::ItemsInvolvedLimit) - tooltip = Um::ItemsInvolved2 + "\n"; - for (uint a=0; a < docSelectionCount; ++a) - { - currItem = groupItems.at(a); - ss->set(QString("item%1").arg(a), currItem->uniqueNr); - ss->set(QString("tableitem%1").arg(a), currItem->isTableItem); - if (docSelectionCount <= Um::ItemsInvolvedLimit) - tooltip += "\t" + currItem->getUName() + "\n"; - currItem->isTableItem = false; - currItem->setSelected(true); - } - undoManager->action(this, ss, Um::SelectionGroup, Um::IGroup); - } - if (undoTransaction) - { - undoTransaction->commit(); - delete undoTransaction; - undoTransaction = NULL; - } */ + }*/ double x, y, w, h; itemSelection->connectItemToGUI(); itemSelection->getGroupRect(&x, &y, &w, &h); diff --git a/Scribus/scribus/scribusdoc.h b/Scribus/scribus/scribusdoc.h index d51441c..363e9c9 100644 --- a/Scribus/scribus/scribusdoc.h +++ b/Scribus/scribus/scribusdoc.h @@ -739,7 +739,6 @@ public: * @brief Undo function for grouping/ungrouping */ void restoreGrouping(SimpleState *state, bool isUndo); - void restoreUngrouping(SimpleState *state, bool isUndo); /** * @brief Undo function for level */ @@ -1015,7 +1014,7 @@ public: PageItem* groupObjectsSelection(Selection* customSelection=0); PageItem* groupObjectsList(QList<PageItem*> &itemList); void groupObjectsToItem(PageItem* groupItem, QList<PageItem*> &itemList); - const PageItem * itemSelection_GroupObjects (bool changeLock, bool lock, Selection* customSelection=0); + PageItem * itemSelection_GroupObjects (bool changeLock, bool lock, Selection* customSelection=0); void itemSelection_UnGroupObjects(Selection* customSelection=0); void addToGroup(PageItem* group, PageItem* item); void removeFromGroup(PageItem* item); diff --git a/Scribus/scribus/scribusview.cpp b/Scribus/scribus/scribusview.cpp index f13d616..342e12a 100644 --- a/Scribus/scribus/scribusview.cpp +++ b/Scribus/scribus/scribusview.cpp @@ -1833,13 +1833,16 @@ void ScribusView::ToggleBookmark() { for (uint a = 0; a < docSelectionCount; ++a) { + UndoTransaction* activeTransaction = NULL; + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction()); PageItem* currItem = Doc->m_Selection->itemAt(a); if (currItem->asTextFrame()) { if (currItem->OwnPage != -1) { bool old = currItem->isBookmark; - currItem->isBookmark = !currItem->isBookmark; + currItem->setIsBookMark(!currItem->isBookmark); if (currItem->isBookmark) { currItem->setIsAnnotation(false); @@ -1852,6 +1855,15 @@ void ScribusView::ToggleBookmark() } } } + if (activeTransaction){ + activeTransaction->commit(Um::Selection, + Um::IGroup, + Um::ActionPDF, + "", + Um::IGroup); + delete activeTransaction; + activeTransaction = NULL; + } } m_ScMW->actionManager->setPDFActions(this); emit DocChanged(); @@ -1865,6 +1877,9 @@ void ScribusView::ToggleAnnotation() { for (int a = 0; a < Doc->m_Selection->count(); ++a) { + UndoTransaction* activeTransaction = NULL; + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction()); PageItem* currItem = Doc->m_Selection->itemAt(a); if (currItem->asTextFrame()) { @@ -1884,6 +1899,15 @@ void ScribusView::ToggleAnnotation() currItem->isBookmark = false; } } + if (activeTransaction){ + activeTransaction->commit(Um::Selection, + Um::IGroup, + Um::ActionPDF, + "", + Um::IGroup); + delete activeTransaction; + activeTransaction = NULL; + } } m_ScMW->actionManager->setPDFActions(this); emit DocChanged(); diff --git a/Scribus/scribus/ui/propertiespalette_shape.cpp b/Scribus/scribus/ui/propertiespalette_shape.cpp index 831fe88..691717c 100644 --- a/Scribus/scribus/ui/propertiespalette_shape.cpp +++ b/Scribus/scribus/ui/propertiespalette_shape.cpp @@ -143,17 +143,8 @@ PageItem* PropertiesPalette_Shape::currentItemFromSelection() { PageItem *currentItem = NULL; - if (m_doc) - { - if (m_doc->m_Selection->count() > 1) - { - currentItem = m_doc->m_Selection->itemAt(0); - } - else if (m_doc->m_Selection->count() == 1) - { - currentItem = m_doc->m_Selection->itemAt(0); - } - } + if (m_doc && m_doc->m_Selection->count()>0) + currentItem = m_doc->m_Selection->itemAt(0); return currentItem; } diff --git a/Scribus/scribus/undomanager.cpp b/Scribus/scribus/undomanager.cpp index 6d3282e..d8a8a24 100644 --- a/Scribus/scribus/undomanager.cpp +++ b/Scribus/scribus/undomanager.cpp @@ -844,6 +844,9 @@ void UndoManager::languageChange() UndoManager::MoveHGuide = tr("Move horizontal guide"); UndoManager::LockGuides = tr("Lock guides"); UndoManager::UnlockGuides = tr("Unlock guides"); + UndoManager::Overprint = tr("Change overprint"); + UndoManager::BlendMode = tr("Change blend mode"); + UndoManager::ActionPDF = tr("Change action PDF"); UndoManager::Move = tr("Move"); UndoManager::NewMasterPage = tr("Add master page"); UndoManager::DelMasterPage = tr("Del master page"); @@ -880,6 +883,7 @@ void UndoManager::languageChange() UndoManager::FlipH = tr("Flip horizontally"); UndoManager::FlipV = tr("Flip vertically"); UndoManager::Lock = tr("Lock"); + UndoManager::ResTyp = tr("Change image resolution"); UndoManager::UnLock = tr("Unlock"); UndoManager::SizeLock = tr("Lock size"); UndoManager::SizeUnLock = tr("Unlock size"); @@ -892,6 +896,7 @@ void UndoManager::languageChange() UndoManager::ApplyMasterPage = tr("Apply Master Page"); UndoManager::Paste = tr("Paste"); UndoManager::Cut = tr("Cut"); + UndoManager::RoundCorner = tr("Change round corner"); UndoManager::Transparency = tr("Set fill color transparency"); UndoManager::LineTransparency = tr("Set line color transparency"); UndoManager::LineStyle = tr("Set line style"); @@ -949,6 +954,7 @@ void UndoManager::languageChange() UndoManager::NoObjectFrame = tr("No object frame"); UndoManager::NoBoundingBox = tr("No bounding box"); UndoManager::NoContourLine = tr("No contour line"); + UndoManager::ShowImage = tr("Show image"); UndoManager::PageNmbr = tr("Page %1"); UndoManager::ImageScaling = tr("Set image scaling"); UndoManager::FrameSize = tr("Frame size"); @@ -1083,6 +1089,9 @@ QString UndoManager::UniteItem = ""; QString UndoManager::SplitItem = ""; QString UndoManager::LockGuides = ""; QString UndoManager::UnlockGuides = ""; +QString UndoManager::Overprint = ""; +QString UndoManager::BlendMode = ""; +QString UndoManager::ActionPDF = ""; QString UndoManager::Move = ""; QString UndoManager::NewMasterPage = ""; QString UndoManager::ImportMasterPage = ""; @@ -1093,6 +1102,8 @@ QString UndoManager::Rotate = ""; QString UndoManager::MoveFromTo = ""; QString UndoManager::ImageOffset = ""; QString UndoManager::ImageScale = ""; +QString UndoManager::ResTyp = ""; +QString UndoManager::ShowImage = ""; QString UndoManager::ImageOffsetFromTo = ""; QString UndoManager::ImageScaleFromTo = ""; QString UndoManager::ResizeFromTo = ""; @@ -1100,6 +1111,7 @@ QString UndoManager::Selection = ""; QString UndoManager::Group = ""; QString UndoManager::SelectionGroup = ""; QString UndoManager::Create = ""; +QString UndoManager::RoundCorner = ""; QString UndoManager::CreateTo = ""; QString UndoManager::AlignDistribute = ""; QString UndoManager::ItemsInvolved = ""; diff --git a/Scribus/scribus/undomanager.h b/Scribus/scribus/undomanager.h index 9d5a898..ec8f23d 100644 --- a/Scribus/scribus/undomanager.h +++ b/Scribus/scribus/undomanager.h @@ -451,6 +451,9 @@ public: static QString MoveVGuide; static QString MoveHGuide; static QString UniteItem; + static QString Overprint; + static QString BlendMode; + static QString ActionPDF; static QString SplitItem; static QString RemoveAllGuides; static QString RemoveAllPageGuides; @@ -530,12 +533,15 @@ public: static QString ImageFrame; static QString TextFrame; static QString LatexFrame; + static QString ResTyp; static QString Polygon; static QString BezierCurve; + static QString ShowImage; static QString Polyline; static QString PathText; static QString ConvertTo; static QString ImportSVG; + static QString RoundCorner; static QString ImportUniconv; static QString ImportEPS; static QString ImportBarcode; |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-06-27 13:49 | Chelen | New Issue | |
2012-06-27 13:49 | Chelen | Status | new => assigned |
2012-06-27 13:49 | Chelen | Assigned To | => Chelen |
2012-06-27 14:03 | Chelen | Relationship added | related to 0004832 |
2012-06-27 14:03 | Chelen | Relationship added | related to 0004833 |
2012-06-27 14:03 | Chelen | Relationship added | related to 0003414 |
2012-06-27 14:03 | Chelen | Relationship added | related to 0010452 |
2012-06-27 18:35 | Chelen | File Added: Patch.diff | |
2012-06-27 19:04 | cbradney | Relationship added | parent of 0010809 |
2012-06-27 19:04 | cbradney | Relationship added | parent of 0010810 |
2012-06-27 19:05 | cbradney | Relationship added | parent of 0010811 |
2012-06-27 19:06 | cbradney | Relationship added | parent of 0010812 |
2012-06-27 19:08 | cbradney | Status | assigned => resolved |
2012-06-27 19:08 | cbradney | Fixed in Version | => 1.5.0svn |
2012-06-27 19:08 | cbradney | Resolution | open => fixed |
2012-07-01 20:31 | cbradney | Status | resolved => closed |