View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0010800 | Scribus | Undo/Redo | public | 2012-06-25 10:04 | 2012-07-01 20:34 |
Reporter | Chelen | Assigned To | Chelen | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
OS | Ubuntu | ||||
Product Version | 1.5.0svn | ||||
Fixed in Version | 1.5.0svn | ||||
Summary | 0010800: GSoC : Git branch about Layout undo/redo functionnality | ||||
Description | There is a patch about Layout undo/redo functionnalities and other miscellaneous functionnality (before I understand how to use git) -align points with neighbour in node edit mode -correct two field size -shape rotation and resize undo/redo -undo/redo for combine/slip polygon action -correction of delete undo/redo -shape resize with null size bug -on delete undo, the polygone recreate is selected -import/copy/creation/deletion page undo/redo -import/copy/creation/deletion masterpage undo/redo -undo/redo for set level action | ||||
Tags | gsoc2012ux | ||||
Patch | |||||
related to | 0005210 | closed | Chelen | Undoing EPS graphic scaling does not undo all of scaling |
related to | 0004718 | closed | Chelen | Undo "Combine Polygons" doesn't work and should be deactivated until the issue is fixed |
related to | 0006220 | closed | Chelen | Undoing split polygon doesn't work |
related to | 0009893 | closed | Chelen | erorr when undoing polygon combining |
related to | 0004820 | closed | Chelen | deletion/creation of masterpage is not being recorded by undo system |
related to | 0005173 | closed | Chelen | Page import can't be undone |
related to | 0005075 | closed | cbradney | undo object deletion should make the object active |
related to | 0010269 | closed | Chelen | CTRL shape-tool modifier |
related to | 0010685 | closed | Chelen | Can't undo or CRTL+Z send to Level |
related to | 0008970 | closed | Chelen | Doing "Redo" on "Copy Page" Adds Extra Pages/Objects |
related to | 0004821 | closed | Chelen | page palette: deletion of masterpages and pages should only be possible after confirmation |
|
Patch.diff (48,320 bytes)
diff --git a/Scribus/scribus/canvasmode_nodeedit.cpp b/Scribus/scribus/canvasmode_nodeedit.cpp index 13baf3f..5029ed6 100644 --- a/Scribus/scribus/canvasmode_nodeedit.cpp +++ b/Scribus/scribus/canvasmode_nodeedit.cpp @@ -1127,7 +1127,56 @@ void CanvasMode_NodeEdit::handleNodeEditDrag(QMouseEvent* m, PageItem* currItem) npf = npf.transformPoint(p, false); } } + + //Control Modifier to have parallele shape + if (m->modifiers() == Qt::ControlModifier){ + FPointArray cli; + if (m_doc->nodeEdit.isContourLine) + cli = currItem->ContourLine; + else + cli = currItem->PoLine; + FPoint npf1(npf); + int tmpNode; + int curr = (m_doc->nodeEdit.ClRe==0)?cli.size()-2:m_doc->nodeEdit.ClRe; + int prev = (curr+cli.size()-4)%cli.size(); + int next = (curr+4)%cli.size(); + + if(abs(cli.point(prev).x()-cli.point(curr).x())<abs(cli.point(next).x()-cli.point(curr).x())) + tmpNode=next; + else if(abs(cli.point(prev).x()-cli.point(curr).x())==abs(cli.point(next).x()-cli.point(curr).x())){ + if(cli.point(prev).y()!=cli.point(curr).y()) + tmpNode=next; + else + tmpNode=prev; + } + else + tmpNode=prev; + + m_doc->nodeEdit.moveClipPoint(currItem, npf); + + m_doc->nodeEdit.ClRe=tmpNode; + + if (m_doc->nodeEdit.isContourLine) + npf1.setX(currItem->ContourLine.point(m_doc->nodeEdit.ClRe).x()); + else + npf1.setX(currItem->PoLine.point(m_doc->nodeEdit.ClRe).x()); + + m_doc->nodeEdit.moveClipPoint(currItem, npf1); + + if(m_doc->nodeEdit.ClRe==prev) + m_doc->nodeEdit.ClRe=next; + else + m_doc->nodeEdit.ClRe=prev; + + if (m_doc->nodeEdit.isContourLine) + npf.setY(currItem->ContourLine.point(m_doc->nodeEdit.ClRe).y()); + else + npf.setY(currItem->PoLine.point(m_doc->nodeEdit.ClRe).y()); + + + } m_doc->nodeEdit.moveClipPoint(currItem, npf); + m_canvas->displayXYHUD(m->globalPos(), npf.x(), npf.y()); } else diff --git a/Scribus/scribus/loadsaveplugin.cpp b/Scribus/scribus/loadsaveplugin.cpp index 36e3d09..fc69b11 100644 --- a/Scribus/scribus/loadsaveplugin.cpp +++ b/Scribus/scribus/loadsaveplugin.cpp @@ -21,7 +21,8 @@ LoadSavePlugin::LoadSavePlugin() m_View(0), m_ScMW(0), m_mwProgressBar(0), - m_AvailableFonts(0) + m_AvailableFonts(0), + undoManager(UndoManager::instance()) { } diff --git a/Scribus/scribus/loadsaveplugin.h b/Scribus/scribus/loadsaveplugin.h index 5a2352f..8d0bbee 100644 --- a/Scribus/scribus/loadsaveplugin.h +++ b/Scribus/scribus/loadsaveplugin.h @@ -22,6 +22,7 @@ class FileFormat; class ScribusView; #include "scfonts.h" #include "scribusdoc.h" +#include "undomanager.h" /*! * @brief Superclass for all file import/export/load/save plugins @@ -141,6 +142,7 @@ class SCRIBUS_API LoadSavePlugin : public ScPlugin QProgressBar* m_mwProgressBar; SCFonts* m_AvailableFonts; QString m_lastSavedFile; + UndoManager * const undoManager; private: // A list of all supported formats. This is maintained by plugins diff --git a/Scribus/scribus/pageitem.cpp b/Scribus/scribus/pageitem.cpp index 19c0c2c..a8acc92 100644 --- a/Scribus/scribus/pageitem.cpp +++ b/Scribus/scribus/pageitem.cpp @@ -4428,6 +4428,10 @@ void PageItem::restore(UndoState *state, bool isUndo) restoreContourLine(ss, isUndo); else if (ss->contains("CHANGE_SHAPE_TYPE")) restoreShapeType(ss, isUndo); + else if (ss->contains("UNITEITEM")) + restoreUniteItem(ss, isUndo); + else if (ss->contains("SPLITITEM")) + restoreSplitItem(ss, isUndo); else if (ss->contains("MIRROR_PATH_H")) { bool editContour = m_Doc->nodeEdit.isContourLine; @@ -4919,6 +4923,55 @@ void PageItem::restorePoly(SimpleState *state, bool isUndo, bool isContour) m_Doc->nodeEdit.isContourLine = editContour; } +void PageItem::restoreUniteItem(SimpleState *state, bool isUndo) +{ + ScItemState< QPair<QList<PageItem*>,QList<QTransform> > > *is = dynamic_cast<ScItemState< QPair<QList<PageItem*>,QList<QTransform> > >*>(state); + if (is) + { + if (isUndo){ + int pts = 0; + for (int i = 0; i < is->getItem().first.size(); ++i) { + PageItem* myItem = is->getItem().first.at(i); + myItem->PoLine.map(is->getItem().second.at(i).inverted()); + pts += myItem->PoLine.size(); + pts+=4; + } + PoLine.resize(PoLine.size()-pts); + Segments.clear(); + Frame = is->getBool("FRAME"); + FrameType = is->getInt("FRAMETYPE"); + ClipEdited = is->getBool("CLIPEDITED"); + m_Doc->AdjustItemSize(this); + } else { + m_Doc->view()->Deselect(true); + m_Doc->view()->SelectItem(this); + for (int i = 0; i < is->getItem().first.size(); ++i) { + m_Doc->view()->SelectItem(is->getItem().first.at(i)); + } + m_Doc->itemSelection_UniteItems(); + } + } +} + +void PageItem::restoreSplitItem(SimpleState *state, bool isUndo) +{ + ScItemState< QList<int> > *is = dynamic_cast<ScItemState< QList<int> >*>(state); + if (is) + { + + QList<int> itemsList = is->getItem(); + select(); + for (int i = 0; i < itemsList.size(); ++i) { + m_Doc->view()->SelectItem(m_Doc->Items->at(itemsList.at(i))); + } + if (isUndo){ + m_Doc->itemSelection_UniteItems(); + } else { + m_Doc->itemSelection_SplitItems(); + } + } +} + void PageItem::restoreContourLine(SimpleState *state, bool isUndo) { ScItemState<FPointArray> *is = dynamic_cast<ScItemState<FPointArray>*>(state); @@ -7184,8 +7237,8 @@ void PageItem::updateClip() OldH2 = height(); ContourLine = PoLine.copy(); } - if ((OldB2 == 0) || (OldH2 == 0) || (width() == 0) || (height() == 0)) - return; + OldB2 = (OldB2==0)?1:OldB2; + OldH2 = (OldH2==0)?1:OldH2; double scx = width() / OldB2; double scy = height() / OldH2; QTransform ma; diff --git a/Scribus/scribus/pageitem.h b/Scribus/scribus/pageitem.h index c5a5861..ea07fe7 100644 --- a/Scribus/scribus/pageitem.h +++ b/Scribus/scribus/pageitem.h @@ -1236,6 +1236,8 @@ protected: void restoreClearImage(UndoState *state, bool isUndo); void restoreGetImage(UndoState *state, bool isUndo); void restorePoly(SimpleState *state, bool isUndo, bool isContour); + void restoreUniteItem(SimpleState *state, bool isUndo); + void restoreSplitItem(SimpleState *state, bool isUndo); void restoreContourLine(SimpleState *state, bool isUndo); void restoreShapeType(SimpleState *state, bool isUndo); void restoreLayer(SimpleState *state, bool isUndo); diff --git a/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp b/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp index e290c96..14e91c2 100644 --- a/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp +++ b/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp @@ -4190,7 +4190,6 @@ PageItem* Scribus150Format::pasteItem(ScribusDoc *doc, ScXmlStreamAttributes& at break; } - UndoManager::instance()->setUndoEnabled(false); currItem->FrameType = attrs.valueAsInt("FRTYPE", 0); int startArrowIndex = attrs.valueAsInt("startArrowIndex", 0); if ((startArrowIndex < 0) || (startArrowIndex > static_cast<int>(doc->arrowStyles().size()))) @@ -4783,7 +4782,6 @@ PageItem* Scribus150Format::pasteItem(ScribusDoc *doc, ScXmlStreamAttributes& at //currItem->setRedrawBounding(); //currItem->OwnPage = view->OnPage(currItem); - UndoManager::instance()->setUndoEnabled(true); return currItem; } @@ -5136,7 +5134,6 @@ bool Scribus150Format::loadPage(const QString & fileName, int pageNumber, bool M ScPage* newPage = NULL; - QString tmp; QMap<int,PageItem*> TableID; QList<PageItem*> TableItems; QMap<int,PageItem*> WeldID; @@ -5280,10 +5277,37 @@ bool Scribus150Format::loadPage(const QString & fileName, int pageNumber, bool M continue; a = m_Doc->currentPage()->pageNr(); newPage = m_Doc->Pages->at(a); + SimpleState *ss = NULL; + if (UndoManager::undoEnabled()) + { + ss = new SimpleState(Um::ChangePageAttrs, "", Um::ICreate); + ss->set("PAGE_ATTRS", "page_attrs"); + ss->set("LEFT_OLD", newPage->LeftPg); + ss->set("NAME_OLD", newPage->pageName()); + ss->set("ORIENTATION_OLD", newPage->orientation()); + ss->set("SIZE_OLD", newPage->m_pageSize); + ss->set("WIDTH_OLD", newPage->width()); + ss->set("HEIGHT_OLD", newPage->height()); + ss->set("INIT_HEIGHT_OLD", newPage->initialHeight()); + ss->set("INIT_WIDTH_OLD", newPage->initialWidth()); + ss->set("INIT_MARGINTOP_OLD", newPage->initialMargins.Top); + ss->set("INIT_MARGINBOTTOM_OLD", newPage->initialMargins.Bottom); + ss->set("INIT_MARGINRIGHT_OLD", newPage->initialMargins.Right); + ss->set("INIT_MARGINLEFT_OLD", newPage->initialMargins.Left); + ss->set("MARGINTOP_OLD", newPage->Margins.Top); + ss->set("MARGINBOTTOM_OLD", newPage->Margins.Bottom); + ss->set("MARGINPRESET_OLD", newPage->marginPreset); + ss->set("HORIZONTAL_AUTOGAP_OLD", newPage->guides.horizontalAutoGap()); + ss->set("VERTICAL_AUTOGAP_OLD", newPage->guides.verticalAutoGap()); + ss->set("HORIZONTAL_AUTOCOUNT_OLD", newPage->guides.horizontalAutoCount()); + ss->set("VERTICAL_AUTOCOUNT_OLD", newPage->guides.verticalAutoCount()); + ss->set("HORIZONTAL_AUTOREFER_OLD", newPage->guides.horizontalAutoRefer()); + ss->set("VERTICAL_AUTOREFER_OLD", newPage->guides.verticalAutoRefer()); + } if (Mpage) { newPage->LeftPg = attrs.valueAsInt("LEFT", 0); - + if (!renamedPageName.isEmpty()) newPage->setPageName(renamedPageName); else @@ -5309,8 +5333,8 @@ bool Scribus150Format::loadPage(const QString & fileName, int pageNumber, bool M newPage->Margins.Bottom = newPage->initialMargins.Bottom; pageX = attrs.valueAsDouble( attrs.valueAsString("PAGEXPOS")); pageY = attrs.valueAsDouble( attrs.valueAsString("PAGEYPOS")); + // guides reading - tmp = ""; newPage->guides.setHorizontalAutoGap(attrs.valueAsDouble("AGhorizontalAutoGap", 0.0)); newPage->guides.setVerticalAutoGap(attrs.valueAsDouble("AGverticalAutoGap", 0.0)); newPage->guides.setHorizontalAutoCount(attrs.valueAsInt("AGhorizontalAutoCount", 0)); @@ -5329,6 +5353,31 @@ bool Scribus150Format::loadPage(const QString & fileName, int pageNumber, bool M newPage->guides.addHorizontals(newPage->guides.getAutoHorizontals(newPage), GuideManagerCore::Auto); newPage->guides.addVerticals(newPage->guides.getAutoVerticals(newPage), GuideManagerCore::Auto); + if (UndoManager::undoEnabled()) + { + ss->set("LEFT", newPage->LeftPg); + ss->set("NAME", newPage->pageName()); + ss->set("ORIENTATION", newPage->orientation()); + ss->set("SIZE", newPage->m_pageSize); + ss->set("WIDTH", newPage->width()); + ss->set("HEIGHT", newPage->height()); + ss->set("INIT_HEIGHT", newPage->initialHeight()); + ss->set("INIT_WIDTH", newPage->initialWidth()); + ss->set("INIT_MARGINTOP", newPage->initialMargins.Top); + ss->set("INIT_MARGINBOTTOM", newPage->initialMargins.Bottom); + ss->set("INIT_MARGINRIGHT", newPage->initialMargins.Right); + ss->set("INIT_MARGINLEFT", newPage->initialMargins.Left); + ss->set("MARGINTOP", newPage->Margins.Top); + ss->set("MARGINBOTTOM", newPage->Margins.Bottom); + ss->set("MARGINPRESET", newPage->marginPreset); + ss->set("HORIZONTAL_AUTOGAP", newPage->guides.horizontalAutoGap()); + ss->set("VERTICAL_AUTOGAP", newPage->guides.verticalAutoGap()); + ss->set("HORIZONTAL_AUTOCOUNT", newPage->guides.horizontalAutoCount()); + ss->set("VERTICAL_AUTOCOUNT", newPage->guides.verticalAutoCount()); + ss->set("HORIZONTAL_AUTOREFER", newPage->guides.horizontalAutoRefer()); + ss->set("VERTICAL_AUTOREFER", newPage->guides.verticalAutoRefer()); + undoManager->action(newPage, ss); + } } if ((tagName == "PAGEOBJECT") || (tagName == "MASTEROBJECT") || (tagName == "FRAMEOBJECT")) { diff --git a/Scribus/scribus/scpage.cpp b/Scribus/scribus/scpage.cpp index 814e490..5254420 100644 --- a/Scribus/scribus/scpage.cpp +++ b/Scribus/scribus/scpage.cpp @@ -205,6 +205,103 @@ void ScPage::restore(UndoState* state, bool isUndo) restorePageItemDeletion(dynamic_cast<ScItemState< QList<PageItem*> >*>(ss), isUndo); else if (ss->contains("CONVERT_ITEM")) restorePageItemConversion(dynamic_cast<ScItemState<std::pair<PageItem*, PageItem*> >*>(ss), isUndo); + else if (ss->contains("PAGE_ATTRS")) + restorePageAttributes(ss, isUndo); + } +} + +void ScPage::restorePageAttributes(SimpleState *state, bool isUndo) +{ + int left_old = state->getInt("LEFT_OLD"); + QString name_old = state->get("NAME_OLD"); + int orientation_old = state->getInt("ORIENTATION_OLD"); + QString size_old =state->get("SIZE_OLD"); + double width_old = state->getDouble("WIDTH_OLD"); + double height_old = state->getDouble("HEIGHT_OLD"); + double init_height_old = state->getDouble("INIT_HEIGHT_OLD"); + double init_width_old = state->getDouble("INIT_WIDTH_OLD"); + double init_margin_top_old = state->getDouble("INIT_MARGINTOP_OLD"); + double init_margin_bottom_old = state->getDouble("INIT_MARGINBOTTOM_OLD"); + double init_margin_right_old = state->getDouble("INIT_MARGINRIGHT_OLD"); + double init_margin_left_old = state->getDouble("INIT_MARGINLEFT_OLD"); + double margin_top_old = state->getDouble("MARGINTOP_OLD"); + double margin_bottom_old = state->getDouble("MARGINBOTTOM_OLD"); + int margin_preset_old = state->getInt("MARGINPRESET_OLD"); + int left = state->getInt("LEFT"); + QString name = state->get("NAME"); + int orientation = state->getInt("ORIENTATION"); + QString size =state->get("SIZE"); + double width = state->getDouble("WIDTH"); + double height = state->getDouble("HEIGHT"); + double init_height = state->getDouble("INIT_HEIGHT"); + double init_width = state->getDouble("INIT_WIDTH"); + double init_margin_top = state->getDouble("INIT_MARGINTOP"); + double init_margin_bottom = state->getDouble("INIT_MARGINBOTTOM"); + double init_margin_right = state->getDouble("INIT_MARGINRIGHT"); + double init_margin_left = state->getDouble("INIT_MARGINLEFT"); + double margin_top = state->getDouble("MARGINTOP"); + double margin_bottom = state->getDouble("MARGINBOTTOM"); + int margin_preset = state->getInt("MARGINPRESET"); + double horizontal_autogap_old = state->getDouble("HORIZONTAL_AUTOGAP"); + double vertical_autogap_old = state->getDouble("VERTICAL_AUTOGAP"); + double horizontal_autocount_old = state->getDouble("HORIZONTAL_AUTOCOUNT"); + double vertical_autocount_old = state->getDouble("VERTICAL_AUTOCOUNT"); + double horizontal_autorefer_old = state->getDouble("HORIZONTAL_AUTOREFER"); + double vertical_autorefer_old = state->getDouble("VERTICAL_AUTOREFER"); + double horizontal_autogap = state->getDouble("HORIZONTAL_AUTOGAP"); + double vertical_autogap = state->getDouble("VERTICAL_AUTOGAP"); + double horizontal_autocount = state->getDouble("HORIZONTAL_AUTOCOUNT"); + double vertical_autocount = state->getDouble("VERTICAL_AUTOCOUNT"); + double horizontal_autorefer = state->getDouble("HORIZONTAL_AUTOREFER"); + double vertical_autorefer = state->getDouble("VERTICAL_AUTOREFER"); + + if (isUndo) + { + this->LeftPg = left_old; + this->setPageName(name_old); + this->m_pageSize = size_old; + this->setOrientation(orientation_old); + this->setWidth(width_old); + this->setHeight(height_old); + this->setInitialHeight(init_height_old); + this->setInitialWidth(init_width_old); + this->initialMargins.Top = init_margin_top_old; + this->initialMargins.Bottom = init_margin_bottom_old; + this->initialMargins.Left = init_margin_left_old; + this->initialMargins.Right = init_margin_right_old; + this->marginPreset = margin_preset_old; + this->Margins.Top = margin_top_old; + this->Margins.Bottom = margin_bottom_old; + this->guides.setHorizontalAutoGap(horizontal_autogap_old); + this->guides.setVerticalAutoGap(vertical_autogap_old); + this->guides.setHorizontalAutoCount(horizontal_autocount_old); + this->guides.setVerticalAutoCount(vertical_autocount_old); + this->guides.setHorizontalAutoRefer(horizontal_autorefer_old); + this->guides.setVerticalAutoRefer(vertical_autorefer_old); + } + else + { + this->LeftPg = left; + this->setPageName(name); + this->m_pageSize = size; + this->setOrientation(orientation); + this->setWidth(width); + this->setHeight(height); + this->setInitialHeight(init_height); + this->setInitialWidth(init_width); + this->initialMargins.Top = init_margin_top; + this->initialMargins.Bottom = init_margin_bottom; + this->initialMargins.Left = init_margin_left; + this->initialMargins.Right = init_margin_right; + this->marginPreset = margin_preset; + this->Margins.Top = margin_top; + this->Margins.Bottom = margin_bottom; + this->guides.setHorizontalAutoGap(horizontal_autogap); + this->guides.setVerticalAutoGap(vertical_autogap); + this->guides.setHorizontalAutoCount(horizontal_autocount); + this->guides.setVerticalAutoCount(vertical_autocount); + this->guides.setHorizontalAutoRefer(horizontal_autorefer); + this->guides.setVerticalAutoRefer(vertical_autorefer); } } @@ -241,6 +338,7 @@ void ScPage::restorePageItemCreation(ScItemState<PageItem*> *state, bool isUndo) if ((stateCode == 0) || (stateCode == 1)) m_Doc->view()->Deselect(true); m_Doc->Items->append(ite); + ite->OwnPage = m_Doc->OnPage(ite); if ((stateCode == 0) || (stateCode == 2)) update(); } @@ -254,6 +352,7 @@ void ScPage::restorePageItemDeletion(ScItemState< QList<PageItem*> > *state, boo return; QList<PageItem*> itemList = state->getItem(); int id = state->getInt("ITEMID"); + int id2 = state->getInt("ID"); if (itemList.count() <= 0) return; m_Doc->view()->Deselect(true); @@ -265,27 +364,26 @@ void ScPage::restorePageItemDeletion(ScItemState< QList<PageItem*> > *state, boo if (isUndo) { //CB #3373 reinsert at old position and renumber items + PageItem* ite = itemList.at(id2); + m_Doc->Items->insert(id, ite); for (int i = 0; i < itemList.count(); ++i) { PageItem* ite = itemList.at(i); - m_Doc->Items->insert(id, ite); + m_Doc->view()->SelectItem(ite); } update(); } else { Selection tmpSelection(m_Doc, false); - for (int i = 0; i < itemList.count(); ++i) + PageItem* ite = itemList.at(id2); + if (m_Doc->m_Selection->findItem(ite)!=-1) { - PageItem* ite = itemList.at(i); - if (m_Doc->m_Selection->findItem(ite)!=-1) - { - if (m_Doc->appMode == modeEdit) - m_Doc->view()->requestMode(modeNormal); - m_Doc->m_Selection->removeItem(ite); - } - tmpSelection.addItem(ite); + if (m_Doc->appMode == modeEdit) + m_Doc->view()->requestMode(modeNormal); + m_Doc->m_Selection->removeItem(ite); } + tmpSelection.addItem(ite); m_Doc->itemSelection_DeleteItem(&tmpSelection); } m_Doc->m_Selection->delaySignalsOff(); diff --git a/Scribus/scribus/scpage.h b/Scribus/scribus/scpage.h index fafbbf3..d90f1c3 100644 --- a/Scribus/scribus/scpage.h +++ b/Scribus/scribus/scpage.h @@ -102,6 +102,7 @@ protected: UndoManager * const undoManager; void restorePageItemCreation(ScItemState<PageItem*> *state, bool isUndo); void restorePageItemDeletion(ScItemState< QList<PageItem*> > *state, bool isUndo); + void restorePageAttributes(SimpleState *state, bool isUndo); void restorePageItemConversion(ScItemState<std::pair<PageItem*, PageItem*> >*state, bool isUndo); double m_xOffset; diff --git a/Scribus/scribus/scribus.cpp b/Scribus/scribus/scribus.cpp index ea95ef9..7274e67 100644 --- a/Scribus/scribus/scribus.cpp +++ b/Scribus/scribus/scribus.cpp @@ -3597,6 +3597,10 @@ bool ScribusMainWindow::slotPageImport() Q_ASSERT(!doc->masterPageMode()); bool ret = false; MergeDoc *dia = new MergeDoc(this, false, doc->DocPages.count(), doc->currentPage()->pageNr() + 1); + UndoTransaction* activeTransaction = NULL; + if(UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::ImportPage, Um::IGroup, Um::ImportPage, 0, Um::ILock)); + if (dia->exec()) { mainWindowStatusLabel->setText( tr("Importing Pages...")); @@ -3681,6 +3685,12 @@ bool ScribusMainWindow::slotPageImport() qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); ret = doIt; } + if (activeTransaction) + { + activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; + } delete dia; return ret; } diff --git a/Scribus/scribus/scribusdoc.cpp b/Scribus/scribus/scribusdoc.cpp index c9b6e54..21feb61 100644 --- a/Scribus/scribus/scribusdoc.cpp +++ b/Scribus/scribus/scribusdoc.cpp @@ -40,6 +40,7 @@ for which a new license (GPL+exception) is in place. #include <qtconcurrentmap.h> #include "canvas.h" +#include "ui/masterpagepalette.h" #include "colorblind.h" #include "commonstrings.h" #include "desaxe/digester.h" @@ -48,6 +49,7 @@ for which a new license (GPL+exception) is in place. #include "filewatcher.h" #include "fpoint.h" #include "ui/guidemanager.h" +#include "ui/outlinepalette.h" #include "hyphenator.h" #include "ui/inserttablecolumnsdialog.h" #include "ui/inserttablerowsdialog.h" @@ -1758,10 +1760,20 @@ void ScribusDoc::restore(UndoState* state, bool isUndo) } else if (ss->contains("OLD_MASTERPAGE")) restoreMasterPageApplying(ss, isUndo); + else if (ss->contains("MASTERPAGE_ADD")) + restoreAddMasterPage(ss, isUndo); else if (ss->contains("PAGE_COPY")) restoreCopyPage(ss, isUndo); else if (ss->contains("PAGE_MOVE")) restoreMovePage(ss, isUndo); + else if (ss->contains("LEVEL_DOWN")) + restoreLevelDown(ss,isUndo); + else if (ss->contains("LEVEL_UP")) + restoreLevelDown(ss,!isUndo); + else if (ss->contains("LEVEL_BOTTOM")) + restoreLevelBottom(ss,isUndo); + else if (ss->contains("LEVEL_TOP")) + restoreLevelBottom(ss,!isUndo); else if (ss->contains("PAGE_CHANGEPROPS")) { if (isUndo) @@ -1792,6 +1804,53 @@ void ScribusDoc::restore(UndoState* state, bool isUndo) } } +void ScribusDoc::restoreLevelDown(SimpleState *ss, bool isUndo){ + ScItemState<QList<QPointer<PageItem> > > *is = dynamic_cast<ScItemState<QList<QPointer<PageItem> > > *>(ss); + QList<QPointer<PageItem> > listItem = is->getItem(); + m_Selection->clear(); + for(int i = 0; i<listItem.size();i++) + m_Selection->addItem(listItem.at(i)); + if(isUndo) + itemSelection_RaiseItem(); + else + itemSelection_LowerItem(); +} + +void ScribusDoc::restoreLevelBottom(SimpleState *ss, bool isUndo){ + ScItemState<QList<QPointer<PageItem> > > *is = dynamic_cast<ScItemState<QList<QPointer<PageItem> > > *>(ss); + QList<QPointer<PageItem> > listItem = is->getItem(); + m_Selection->clear(); + for(int i = 0; i<listItem.size();i++) + m_Selection->addItem(listItem.at(i)); + if(isUndo) + bringItemSelectionToFront(); + else + sendItemSelectionToBack(); +} + +void ScribusDoc::restoreAddMasterPage(SimpleState *ss, bool isUndo){ + QString pageName = ss->get("MASTERPAGE_NAME"); + int pageNr = ss->getInt("MASTERPAGE_NR"); + if(isUndo){ + DummyUndoObject *duo = new DummyUndoObject(); + uint did = static_cast<uint>(duo->getUId()); + undoManager->replaceObject(Pages->at(MasterNames[pageName])->getUId(), duo); + ss->set("DUMMY_ID", did); + + scMW()->deletePage2(MasterNames[pageName]); + rebuildMasterNames(); + scMW()->pagePalette->updateMasterPageList(); + } else { + ScPage* Mpage = addMasterPage(pageNr, pageName); + setCurrentPage(Mpage); + UndoObject *tmp = undoManager->replaceObject( + ss->getUInt("DUMMY_ID"), Pages->at(MasterNames[pageName])); + delete tmp; + scMW()->pagePalette->updateMasterPageList(); + m_View->reformPages(); + } +} + void ScribusDoc::restoreGrouping(SimpleState *state, bool isUndo) { double x, y, w, h; @@ -2108,6 +2167,13 @@ ScPage* ScribusDoc::addMasterPage(const int pageNumber, const QString& pageName) assert(MasterPages.at(pageNumber)!=NULL); if (!isLoading()) changed(); + if(UndoManager::undoEnabled()){ + SimpleState *ss = new SimpleState(Um::MovePage, "", Um::IDocument); + ss->set("MASTERPAGE_ADD", "masterpage_add"); + ss->set("MASTERPAGE_NAME", pageName); + ss->set("MASTERPAGE_NBR", pageNumber); + undoManager->action(this, ss); + } return addedPage; } @@ -4308,8 +4374,11 @@ void ScribusDoc::restoreCopyPage(SimpleState *state, bool isUndo) --destLocation; } } - else + else{ copyPage(pnum, extPage, whereTo, copyCount); + if(m_ScMW->outlinePalette->isVisible()) + m_ScMW->outlinePalette->BuildTree(); + } } @@ -6467,15 +6536,19 @@ void ScribusDoc::setFirstSectionFromFirstPageNumber() void ScribusDoc::copyPage(int pageNumberToCopy, int existingPage, int whereToInsert, int copyCount) { - UndoTransaction copyTransaction(undoManager->beginTransaction(getUName(), Um::IDocument, Um::CopyPage, "", Um::ICreate)); - SimpleState *ss = new SimpleState(Um::Copy, "", Um::ICreate); - ss->set("PAGE_COPY", "copy_page"); - ss->set("PAGE_NUM", pageNumberToCopy); - ss->set("EXISTING_PAGE", existingPage); - ss->set("WHERE_TO", whereToInsert); - ss->set("COPY_COUNT", copyCount); - undoManager->action(this, ss); + UndoTransaction *copyTransaction = NULL; + if(UndoManager::undoEnabled()){ + copyTransaction = new UndoTransaction(undoManager->beginTransaction(getUName(), Um::IDocument, Um::CopyPage, "", Um::ICreate)); + SimpleState *ss = new SimpleState(Um::Copy, "", Um::ICreate); + ss->set("PAGE_COPY", "copy_page"); + ss->set("PAGE_NUM", pageNumberToCopy); + ss->set("EXISTING_PAGE", existingPage); + ss->set("WHERE_TO", whereToInsert); + ss->set("COPY_COUNT", copyCount); + undoManager->action(this, ss); + } + undoManager->setUndoEnabled(false); //CB Should we really be disabling auto text frames here? bool autoText = usesAutomaticTextFrames(); setUsesAutomaticTextFrames(false); @@ -6608,7 +6681,12 @@ void ScribusDoc::copyPage(int pageNumberToCopy, int existingPage, int whereToIns else setCurrentPage(from); changed(); - copyTransaction.commit(); + undoManager->setUndoEnabled(true); + if(copyTransaction){ + copyTransaction->commit(); + delete copyTransaction; + copyTransaction = NULL; + } } @@ -6837,6 +6915,13 @@ void ScribusDoc::sendItemSelectionToBack() int docSelectionCount = m_Selection->count(); if (docSelectionCount == 0) return; + if (UndoManager::undoEnabled()) + { + ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(Um::LevelBottom); + is->set("LEVEL_BOTTOM","level_bottom"); + is->setItem(m_Selection->selectionList()); + undoManager->action(this, is); + } if (docSelectionCount > 1) { PageItem *firstItem = m_Selection->itemAt(0); @@ -6894,6 +6979,13 @@ void ScribusDoc::bringItemSelectionToFront() int docSelectionCount = m_Selection->count(); if (docSelectionCount == 0) return; + if (UndoManager::undoEnabled()) + { + ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(Um::LevelTop); + is->set("LEVEL_TOP","level_top"); + is->setItem(m_Selection->selectionList()); + undoManager->action(this, is); + } if (docSelectionCount > 1) { PageItem *firstItem = m_Selection->itemAt(0); @@ -6951,6 +7043,13 @@ void ScribusDoc::itemSelection_LowerItem() int docSelectionCount = m_Selection->count(); if (docSelectionCount == 0) return; + if (UndoManager::undoEnabled()) + { + ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(Um::LevelDown); + is->set("LEVEL_DOWN","level_down"); + is->setItem(m_Selection->selectionList()); + undoManager->action(this, is); + } if (docSelectionCount > 1) { PageItem *firstItem = m_Selection->itemAt(0); @@ -7016,6 +7115,13 @@ void ScribusDoc::itemSelection_RaiseItem() int docSelectionCount = m_Selection->count(); if (docSelectionCount == 0) return; + if (UndoManager::undoEnabled()) + { + ScItemState<QList<QPointer<PageItem> > > *is = new ScItemState<QList<QPointer<PageItem> > >(Um::LevelUp); + is->set("LEVEL_UP","level_up"); + is->setItem(m_Selection->selectionList()); + undoManager->action(this, is); + } if (docSelectionCount > 1) { PageItem *firstItem = m_Selection->itemAt(0); @@ -10483,6 +10589,7 @@ void ScribusDoc::itemSelection_DeleteItem(Selection* customSelection, bool force ScItemState< QList<PageItem*> > *is = new ScItemState< QList<PageItem*> >(Um::Delete + " " + currItem->getUName(), "", Um::IDelete); is->setItem(delItems); is->set("ITEMID", itemList->indexOf(currItem)); + is->set("ID", selectedItemCount - (de + 1)); is->set("DELETE_ITEM", "delete_item"); undoManager->action(Pages->at(0), is, currItem->getUPixmap()); } @@ -14181,15 +14288,25 @@ void ScribusDoc::itemSelection_UniteItems(Selection* /*customSelection*/) { PageItem *currItem; PageItem *bb; + QList<QTransform> transform; QList<PageItem *> toDel; toDel.clear(); uint docSelectionCount = m_Selection->count(); if (docSelectionCount > 1) { + UndoTransaction* transaction = NULL; + if (UndoManager::undoEnabled()){ + transaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::UniteItem, "", Um::IGroup)); + transform.clear(); + } + undoManager->setUndoEnabled(false); currItem = m_Selection->itemAt(0); if (currItem->isGroup()) return; m_Selection->delaySignalsOn(); + bool currFrame = currItem->Frame; + bool currClipEdited = currItem->ClipEdited; + int currFrameType = currItem->FrameType; currItem->Frame = false; currItem->ClipEdited = true; currItem->FrameType = 3; @@ -14200,25 +14317,45 @@ void ScribusDoc::itemSelection_UniteItems(Selection* /*customSelection*/) QTransform ma; ma.translate(bb->xPos(), bb->yPos()); ma.rotate(bb->rotation()); - bb->PoLine.map(ma); QTransform ma2; ma2.translate(currItem->xPos(), currItem->yPos()); ma2.rotate(currItem->rotation()); ma2 = ma2.inverted(); - bb->PoLine.map(ma2); + ma=ma*ma2; + bb->PoLine.map(ma); + undoManager->setUndoEnabled(true); + if (UndoManager::undoEnabled()) + transform.append(ma); + undoManager->setUndoEnabled(false); currItem->PoLine.setMarker(); currItem->PoLine.putPoints(currItem->PoLine.size(), bb->PoLine.size(), bb->PoLine); } // currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments); AdjustItemSize(currItem); currItem->ContourLine = currItem->PoLine.copy(); + undoManager->setUndoEnabled(true); //FIXME: stop using m_View + if (UndoManager::undoEnabled()) + { + ScItemState< QPair<QList<PageItem*> , QList<QTransform> > > *is = new ScItemState< QPair<QList<PageItem*> , QList<QTransform> > >(Um::UniteItem, "", Um::IGroup); + is->setItem(QPair<QList<PageItem*>,QList<QTransform> >(toDel,transform)); + is->set("UNITEITEM", "uniteitem"); + is->set("FRAME",currFrame); + is->set("FRAMETYPE",currFrameType); + is->set("CLIPEDITED",currClipEdited); + undoManager->action(currItem, is); + } m_View->Deselect(true); for (int c = 0; c < toDel.count(); ++c) m_View->SelectItem(toDel.at(c)); m_Selection->delaySignalsOff(); itemSelection_DeleteItem(); regionsChanged()->update(QRectF()); + if(transaction){ + transaction->commit(); + delete transaction; + transaction = NULL; + } } } @@ -14226,8 +14363,14 @@ void ScribusDoc::itemSelection_SplitItems(Selection* /*customSelection*/) { PageItem *bb; m_Selection->delaySignalsOn(); + UndoTransaction* transaction = NULL; + if (UndoManager::undoEnabled()) + transaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SplitItem, "", Um::IGroup)); + undoManager->setUndoEnabled(false); for (int i = 0; i < m_Selection->count(); ++i) { + QList< int> itemsList; + itemsList.clear(); PageItem *currItem = m_Selection->itemAt(i); if (!currItem->isPolygon() || currItem->Segments.count() <= 0) continue; @@ -14241,6 +14384,7 @@ void ScribusDoc::itemSelection_SplitItems(Selection* /*customSelection*/) StartInd = a + 1; bb = new PageItem_Polygon(*currItem); currItemNr++; + itemsList.append(currItemNr); Items->insert(currItemNr, bb); bb->convertTo(PageItem::Polygon); bb->Frame = false; @@ -14260,11 +14404,26 @@ void ScribusDoc::itemSelection_SplitItems(Selection* /*customSelection*/) AdjustItemSize(currItem); currItem->ContourLine = currItem->PoLine.copy(); currItem->ClipEdited = true; + undoManager->setUndoEnabled(true); + if (UndoManager::undoEnabled()) + { + ScItemState< QList<int> > *is = new ScItemState< QList<int> >(Um::SplitItem, "", Um::IGroup); + is->setItem(QList<int>(itemsList)); + is->set("SPLITITEM", "split_item"); + undoManager->action(currItem, is); + } + undoManager->setUndoEnabled(false); } + undoManager->setUndoEnabled(true); m_Selection->delaySignalsOff(); //FIXME: stop using m_View m_View->Deselect(true); regionsChanged()->update(QRectF()); + if(transaction){ + transaction->commit(); + delete transaction; + transaction = NULL; + } } void ScribusDoc::itemSelection_convertItemsTo(const PageItem::ItemType newType, Selection* restoredSelection, Selection* customSelection) diff --git a/Scribus/scribus/scribusdoc.h b/Scribus/scribus/scribusdoc.h index 4a7934c..d51441c 100644 --- a/Scribus/scribus/scribusdoc.h +++ b/Scribus/scribus/scribusdoc.h @@ -734,12 +734,18 @@ public: void restoreMasterPageApplying(SimpleState *state, bool isUndo); void restoreCopyPage(SimpleState *state, bool isUndo); void restoreMovePage(SimpleState *state, bool isUndo); + void restoreAddMasterPage(SimpleState *state, bool isUndo); /** * @brief Undo function for grouping/ungrouping */ void restoreGrouping(SimpleState *state, bool isUndo); void restoreUngrouping(SimpleState *state, bool isUndo); /** + * @brief Undo function for level + */ + void restoreLevelDown(SimpleState *state, bool isUndo); + void restoreLevelBottom(SimpleState *state, bool isUndo); + /** * @brief Save function */ bool save(const QString& fileName, QString* savedFile = NULL); diff --git a/Scribus/scribus/scribusview.cpp b/Scribus/scribus/scribusview.cpp index fa328ae..f13d616 100644 --- a/Scribus/scribus/scribusview.cpp +++ b/Scribus/scribus/scribusview.cpp @@ -1382,6 +1382,7 @@ void ScribusView::TransformPoly(int mode, int rot, double scaling) PageItem *currItem = Doc->m_Selection->itemAt(0); currItem->ClipEdited = true; QTransform ma; + undoManager->setUndoEnabled(false); if (Doc->nodeEdit.isContourLine) { FPoint tp2(getMinClipF(&currItem->ContourLine)); @@ -1462,6 +1463,7 @@ void ScribusView::TransformPoly(int mode, int rot, double scaling) updateContents(); currItem->FrameOnly = true; updateContents(currItem->getRedrawBounding(m_canvas->scale())); + undoManager->setUndoEnabled(true); if (UndoManager::undoEnabled()) { undoManager->setUndoEnabled(false); @@ -1566,6 +1568,7 @@ void ScribusView::TransformPoly(int mode, int rot, double scaling) currItem->update(); // MarkClip(currItem, currItem->PoLine, true); currItem->FrameType = 3; + undoManager->setUndoEnabled(true); if (UndoManager::undoEnabled()) { undoManager->setUndoEnabled(false); diff --git a/Scribus/scribus/ui/delpages.cpp b/Scribus/scribus/ui/delpages.cpp index 904e41d..83dc4ae 100644 --- a/Scribus/scribus/ui/delpages.cpp +++ b/Scribus/scribus/ui/delpages.cpp @@ -27,6 +27,7 @@ DelPages::DelPages( QWidget* parent, int currentPage, int maxPage ) : QDialog( p fromToLayout->addWidget( fromLabel ); fromPageData = new ScrSpinBox(this); fromPageData->setDecimals(0); + fromPageData->setSuffix(""); fromPageData->setMinimum(1); fromPageData->setMaximum(maxPage); fromPageData->setSuffix(""); @@ -41,6 +42,7 @@ DelPages::DelPages( QWidget* parent, int currentPage, int maxPage ) : QDialog( p toPageData->setMaximum(maxPage); toPageData->setSuffix(""); toPageData->setValue( currentPage ); + toPageData->setSuffix(""); fromToLayout->addWidget( toPageData ); dialogLayout->addLayout( fromToLayout ); diff --git a/Scribus/scribus/ui/masterpagepalette.cpp b/Scribus/scribus/ui/masterpagepalette.cpp index 9c73da0..50c1dfa 100644 --- a/Scribus/scribus/ui/masterpagepalette.cpp +++ b/Scribus/scribus/ui/masterpagepalette.cpp @@ -31,12 +31,14 @@ for which a new license (GPL+exception) is in place. #include "scribusview.h" #include "scribusXml.h" #include "selection.h" +#include "undomanager.h" #include "util_icon.h" MasterPagesPalette::MasterPagesPalette( QWidget* parent, ScribusDoc *pCurrentDoc, ScribusView *pCurrentView, QString masterPageName) : ScrPaletteBase( parent, "MasterPages", false, 0 ) { setAttribute(Qt::WA_DeleteOnClose); setModal(false); + undoManager = UndoManager::instance(); setWindowIcon(QIcon(loadIcon ( "AppIcon.png" ))); currentDoc = pCurrentDoc; currentView = pCurrentView; @@ -114,7 +116,9 @@ void MasterPagesPalette::closeEvent(QCloseEvent *closeEvent) void MasterPagesPalette::deleteMasterPage() { bool forceDelete = false; - + UndoTransaction* activeTransaction = NULL; + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Group, Um::IGroup, Um::DelMasterPage, "", Um::IDelete)); // allow to delete multiple pages in one step foreach (QListWidgetItem * delItem, masterPageListBox->selectedItems()) { @@ -163,11 +167,20 @@ void MasterPagesPalette::deleteMasterPage() QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); sMuster = it.key(); updateMasterPageList(sMuster); + if (activeTransaction) + { + activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; + } } void MasterPagesPalette::duplicateMasterPage() { int copyC = 1; + UndoTransaction* activeTransaction = NULL; + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Group, Um::IGroup, Um::DuplicateMasterPage, "", Um::IGroup)); QString potentialMasterPageName(sMuster); while (currentDoc->MasterNames.contains(potentialMasterPageName)) potentialMasterPageName = tr("Copy #%1 of %2").arg(copyC++).arg(sMuster); @@ -291,12 +304,21 @@ void MasterPagesPalette::duplicateMasterPage() currentView->reformPages(); currentView->DrawNew(); } + if (activeTransaction) + { + activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; + } delete dia; } void MasterPagesPalette::newMasterPage() { QString MasterPageName; + UndoTransaction* activeTransaction = NULL; + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Group, Um::IGroup, Um::NewMasterPage, "", Um::IGroup)); int nr = currentDoc->Pages->count(); NewTm *dia = new NewTm(this, tr("Name:"), tr("New MasterPage"), currentDoc, tr("New Master Page %1").arg(nr)); if (dia->exec()) @@ -345,11 +367,20 @@ void MasterPagesPalette::newMasterPage() selectMasterPage(MasterPageName); currentView->reformPages(); } + if (activeTransaction) + { + activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; + } delete dia; } void MasterPagesPalette::importPage() { + UndoTransaction* activeTransaction = NULL; + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Group, Um::IGroup, Um::ImportMasterPage, "", Um::IGroup)); //bool atf; MergeDoc *dia = new MergeDoc(this, true); if (dia->exec()) @@ -395,6 +426,12 @@ void MasterPagesPalette::importPage() qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); //currentDoc->MasterPages = currentDoc->Pages; } + if (activeTransaction) + { + activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; + } delete dia; } diff --git a/Scribus/scribus/ui/masterpagepalette.h b/Scribus/scribus/ui/masterpagepalette.h index bd4331e..db5192e 100644 --- a/Scribus/scribus/ui/masterpagepalette.h +++ b/Scribus/scribus/ui/masterpagepalette.h @@ -8,6 +8,7 @@ for which a new license (GPL+exception) is in place. #define MUSTERPAGES_H class QCloseEvent; +class UndoManager; class QHBoxLayout; class QListWidget; class QListWidgetItem; @@ -52,6 +53,7 @@ private: QToolButton* importButton; QToolButton* newButton; ScribusDoc *currentDoc; + UndoManager *undoManager; ScribusView *currentView; protected: diff --git a/Scribus/scribus/ui/mergedoc.cpp b/Scribus/scribus/ui/mergedoc.cpp index 197750e..f566b32 100644 --- a/Scribus/scribus/ui/mergedoc.cpp +++ b/Scribus/scribus/ui/mergedoc.cpp @@ -47,6 +47,7 @@ MergeDoc::MergeDoc(QWidget* parent, bool importMasterPages, int targetDocPageCou fromInfoLayout->setMargin(0); fromInfoLayout->setSpacing(5); fromDocData = new QLineEdit( this ); + fromDocData->setMinimumWidth(QWidget::fontMetrics().width('a')*50); fromDocLabel = new QLabel( tr( "&From Document:"), this ); fromDocLabel->setBuddy( fromDocData ); fromInfoLayout->addWidget( fromDocLabel, 0, 0 ); diff --git a/Scribus/scribus/ui/prefs_documentsetupbase.ui b/Scribus/scribus/ui/prefs_documentsetupbase.ui index d9f090c..b2580c4 100644 --- a/Scribus/scribus/ui/prefs_documentsetupbase.ui +++ b/Scribus/scribus/ui/prefs_documentsetupbase.ui @@ -217,7 +217,11 @@ </widget> </item> <item row="4" column="1"> - <widget class="QComboBox" name="layoutFirstPageIsComboBox"/> + <widget class="QComboBox" name="layoutFirstPageIsComboBox"> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> + </property> + </widget> </item> <item row="3" column="1"> <widget class="QRadioButton" name="fourFoldRadioButton"> @@ -303,8 +307,8 @@ <rect> <x>0</x> <y>0</y> - <width>428</width> - <height>525</height> + <width>252</width> + <height>206</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_5"> diff --git a/Scribus/scribus/undomanager.cpp b/Scribus/scribus/undomanager.cpp index 500b22b..6358cd4 100644 --- a/Scribus/scribus/undomanager.cpp +++ b/Scribus/scribus/undomanager.cpp @@ -601,6 +601,18 @@ UndoObject* UndoManager::replaceObject(ulong uid, UndoObject *newUndoObject) tmpState->setUndoObject(newUndoObject); } } + for (uint i = 0; i < stacks_[currentDoc_].redoActions_.size(); ++i) + { + UndoState *tmpState = stacks_[currentDoc_].redoActions_[i]; + TransactionState *ts = dynamic_cast<TransactionState*>(tmpState); + if (ts) + tmp = ts->replace(uid, newUndoObject); + else if (tmpState->undoObject() && tmpState->undoObject()->getUId() == uid) + { + tmp = tmpState->undoObject(); + tmpState->setUndoObject(newUndoObject); + } + } if (transaction_) // replace also in the currently open transaction tmp = transaction_->replace(uid, newUndoObject); return tmp; @@ -826,6 +838,12 @@ void UndoManager::languageChange() UndoManager::LockGuides = tr("Lock guides"); UndoManager::UnlockGuides = tr("Unlock guides"); UndoManager::Move = tr("Move"); + UndoManager::NewMasterPage = tr("Add master page"); + UndoManager::DelMasterPage = tr("Del master page"); + UndoManager::ImportMasterPage = tr("Import master page"); + UndoManager::DuplicateMasterPage= tr("Duplicate master page"); + UndoManager::UniteItem = tr("Combine Polygons"); + UndoManager::SplitItem = tr("Split Polygons"); UndoManager::Resize = tr("Resize"); UndoManager::Rotate = tr("Rotate"); UndoManager::MoveFromTo = tr("X1: %1, Y1: %2, %3\nX2: %4, Y2: %5, %6"); @@ -838,6 +856,10 @@ void UndoManager::languageChange() UndoManager::Group = tr("Group"); UndoManager::SelectionGroup = tr("Selection/Group"); UndoManager::Create = tr("Create"); + UndoManager::LevelUp = tr("Level up"); + UndoManager::LevelDown = tr("Level up"); + UndoManager::LevelTop = tr("Send to bottom"); + UndoManager::LevelBottom = tr("Send to front"); UndoManager::CreateTo = tr("X: %1, Y: %2\nW: %3, H: %4"); UndoManager::AlignDistribute = tr("Align/Distribute"); UndoManager::ItemsInvolved = tr("Items involved"); @@ -967,11 +989,13 @@ void UndoManager::languageChange() UndoManager::Copy = tr("Copy"); UndoManager::CopyPage = tr("Copy page"); UndoManager::MovePage = tr("Move page"); + UndoManager::ImportPage = tr("Import page"); UndoManager::ToOutlines = tr("Convert to outlines"); UndoManager::LinkTextFrame = tr("Link text frame"); UndoManager::UnlinkTextFrame = tr("Unlink text frame"); UndoManager::ClearImage = tr("Clear image frame content"); UndoManager::PathOperation = tr("Path Operation"); + UndoManager::ChangePageAttrs = tr("Change Page Attributes"); } void UndoManager::initIcons() @@ -1036,9 +1060,15 @@ QString UndoManager::DelVAGuide = ""; QString UndoManager::DelHAGuide = ""; QString UndoManager::MoveVGuide = ""; QString UndoManager::MoveHGuide = ""; +QString UndoManager::UniteItem = ""; +QString UndoManager::SplitItem = ""; QString UndoManager::LockGuides = ""; QString UndoManager::UnlockGuides = ""; QString UndoManager::Move = ""; +QString UndoManager::NewMasterPage = ""; +QString UndoManager::ImportMasterPage = ""; +QString UndoManager::DuplicateMasterPage= ""; +QString UndoManager::DelMasterPage = ""; QString UndoManager::Resize = ""; QString UndoManager::Rotate = ""; QString UndoManager::MoveFromTo = ""; @@ -1065,6 +1095,10 @@ QString UndoManager::SetLineShade = ""; QString UndoManager::FlipH = ""; QString UndoManager::FlipV = ""; QString UndoManager::Lock = ""; +QString UndoManager::LevelUp = ""; +QString UndoManager::LevelTop = ""; +QString UndoManager::LevelBottom = ""; +QString UndoManager::LevelDown = ""; QString UndoManager::UnLock = ""; QString UndoManager::SizeLock = ""; QString UndoManager::SizeUnLock = ""; @@ -1179,12 +1213,14 @@ QString UndoManager::RemoveAllGuides = ""; QString UndoManager::RemoveAllPageGuides = ""; QString UndoManager::Copy = ""; QString UndoManager::CopyPage = ""; +QString UndoManager::ImportPage = ""; QString UndoManager::MovePage = ""; QString UndoManager::ToOutlines = ""; QString UndoManager::LinkTextFrame = ""; QString UndoManager::UnlinkTextFrame = ""; QString UndoManager::ClearImage = ""; QString UndoManager::PathOperation = ""; +QString UndoManager::ChangePageAttrs = ""; /*** Icons for UndoObjects *******************************************/ QPixmap *UndoManager::IImageFrame = 0; diff --git a/Scribus/scribus/undomanager.h b/Scribus/scribus/undomanager.h index 2bf44dd..fd4fe2e 100644 --- a/Scribus/scribus/undomanager.h +++ b/Scribus/scribus/undomanager.h @@ -448,11 +448,17 @@ public: static QString DelHAGuide; static QString MoveVGuide; static QString MoveHGuide; + static QString UniteItem; + static QString SplitItem; static QString RemoveAllGuides; static QString RemoveAllPageGuides; static QString LockGuides; static QString UnlockGuides; static QString Move; + static QString NewMasterPage; + static QString DelMasterPage; + static QString ImportMasterPage; + static QString DuplicateMasterPage; static QString Resize; static QString Rotate; static QString MoveFromTo; @@ -588,10 +594,16 @@ public: static QString ResetControlPoint; static QString ResetControlPoints; static QString ImageEffects; + static QString LevelUp; + static QString LevelDown; + static QString LevelBottom; + static QString LevelTop; static QString InsertFrame; static QString AdjustFrameToImage; static QString Copy; static QString CopyPage; + static QString ChangePageAttrs; + static QString ImportPage; static QString MovePage; static QString ToOutlines; static QString LinkTextFrame; |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-06-25 10:04 | Chelen | New Issue | |
2012-06-25 10:04 | Chelen | File Added: LayoutPatch.diff | |
2012-06-25 10:07 | Chelen | Relationship added | related to 0005210 |
2012-06-25 10:07 | Chelen | Relationship added | related to 0004718 |
2012-06-25 10:07 | Chelen | Relationship added | related to 0006220 |
2012-06-25 10:09 | Chelen | Relationship added | related to 0009893 |
2012-06-25 10:09 | Chelen | Relationship added | related to 0004820 |
2012-06-25 10:09 | Chelen | Relationship added | related to 0005173 |
2012-06-25 10:09 | Chelen | Relationship added | related to 0005075 |
2012-06-25 10:10 | Chelen | Relationship added | related to 0010269 |
2012-06-25 10:11 | Chelen | Relationship added | related to 0010685 |
2012-06-25 19:39 | cbradney | Tag Attached: gsoc2012ux | |
2012-06-26 19:08 | Chelen | File Added: Patch.diff | |
2012-06-26 20:02 | cbradney | File Deleted: LayoutPatch.diff | |
2012-06-26 20:03 | cbradney | Status | new => resolved |
2012-06-26 20:03 | cbradney | Fixed in Version | => 1.5.0svn |
2012-06-26 20:03 | cbradney | Resolution | open => fixed |
2012-06-26 20:03 | cbradney | Assigned To | => cbradney |
2012-06-26 20:04 | cbradney | Assigned To | cbradney => Chelen |
2012-06-26 22:32 | Chelen | Relationship added | related to 0008970 |
2012-06-26 22:35 | Chelen | Relationship added | related to 0004821 |
2012-07-01 20:34 | cbradney | Status | resolved => closed |