Index: scribus/scribus.h =================================================================== --- scribus/scribus.h (révision 17743) +++ scribus/scribus.h (copie de travail) @@ -478,6 +478,7 @@ void ToggleGuides(); void ToggleBase(); void ToggleUGuides(); + void ToggleUElements(); void EditTabs(); void SearchText(); void imageEditorExited(int, QProcess::ExitStatus); Index: scribus/canvasmode.h =================================================================== --- scribus/canvasmode.h (révision 17743) +++ scribus/canvasmode.h (copie de travail) @@ -123,6 +123,8 @@ /** Draws the regular selection marker */ void drawSelection(QPainter* psx, bool drawHandles); /** Draws an outline of selected items */ + void drawSnapLine(QPainter* psx); + /** Draws an outline of selected items */ void drawOutline(QPainter* p, double scalex=1.0, double scaley=1.0, double deltax=0.0, double deltay=0.0); #ifdef GESTURE_FRAME_PREVIEW // I don’t know why the methods above have been implemented here and left non-virtual. @@ -146,6 +148,7 @@ Canvas * const m_canvas; ScribusDoc * const m_doc; PanGesture * m_panGesture; + double xSnap,ySnap; void setResizeCursor(int how, double rot = 0.0); bool commonMouseMove(QMouseEvent *m); Index: scribus/canvasmode_editweldpoint.cpp =================================================================== --- scribus/canvasmode_editweldpoint.cpp (révision 17743) +++ scribus/canvasmode_editweldpoint.cpp (copie de travail) @@ -349,7 +349,7 @@ FPoint npfN; double nx = mousePointDoc.x(); double ny = mousePointDoc.y(); - if (!m_doc->ApplyGuides(&nx, &ny)) + if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) npfN = m_doc->ApplyGridF(FPoint(nx, ny)); else npfN = FPoint(nx, ny); Index: scribus/canvasmode_imageimport.cpp =================================================================== --- scribus/canvasmode_imageimport.cpp (révision 17743) +++ scribus/canvasmode_imageimport.cpp (copie de travail) @@ -52,8 +52,12 @@ while(!(m_doc->m_Selection->itemAt(0)->isImageFrame())) m_doc->m_Selection->removeFirst(); if(!m_doc->m_Selection->isEmpty()) + { setImage(m_doc->m_Selection->itemAt(0)); - m_view->requestMode(submodePaintingDone); + m_view->requestMode(submodePaintingDone); + } + else + newToolTip(l.first()); } else newToolTip(l.first()); @@ -71,7 +75,6 @@ { thumb = thumb.scaled(80,80,Qt::KeepAspectRatio); p.drawImage((80 - thumb.width()) / 2, (80 - thumb.height()) / 2, thumb); - p.end(); QBuffer buffer; buffer.open(QIODevice::WriteOnly); pm.save(&buffer, "PNG"); @@ -113,6 +116,9 @@ case Qt::Key_Backtab: imageList.append(imageList.takeFirst()); break; + case Qt::Key_Backspace: + imageList.removeFirst(); + break; case Qt::Key_Escape: imageList.clear(); break; @@ -162,6 +168,17 @@ QToolTip::showText(m->globalPos(), tipText, qApp->activeWindow()); QToolTip::showText(m->globalPos(), tipText + "", qApp->activeWindow()); m->accept(); + PageItem *item; + if((item = m_canvas->itemUnderCursor(m->globalPos())) != NULL) + { + PageItem_ImageFrame *currItem; + if((currItem = item->asImageFrame()) != NULL) + qApp->changeOverrideCursor(QCursor(loadIcon("DrawImageFrame.xpm"))); + else + qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); + } + else + qApp->changeOverrideCursor(QCursor(loadIcon("DrawImageFrame.xpm"))); if (commonMouseMove(m)) return; } Index: scribus/canvasmode_edit.cpp =================================================================== --- scribus/canvasmode_edit.cpp (révision 17743) +++ scribus/canvasmode_edit.cpp (copie de travail) @@ -728,7 +728,7 @@ m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh); double nx = gx; double ny = gy; - if (!m_doc->ApplyGuides(&nx, &ny)) + if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) { FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy)); FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh)); @@ -746,7 +746,7 @@ m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh); nx = gx+gw; ny = gy+gh; - if (m_doc->ApplyGuides(&nx, &ny)) + if (m_doc->ApplyGuides(&nx, &ny) || m_doc->ApplyGuides(&nx,&ny,true)) m_doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false); m_doc->m_Selection->setGroupRect(); } @@ -757,7 +757,7 @@ { double nx = currItem->xPos(); double ny = currItem->yPos(); - if (!m_doc->ApplyGuides(&nx, &ny)) + if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) { m_doc->m_Selection->setGroupRect(); double gx, gy, gh, gw; Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp =================================================================== --- scribus/plugins/fileloader/scribus13format/scribus13format.cpp (révision 17743) +++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp (copie de travail) @@ -402,10 +402,10 @@ m_Doc->itemToolPrefs().shapeFillColorShade = dc.attribute("BRUSHSHADE", "100").toInt(); m_Doc->opToolPrefs().magMin = dc.attribute("MAGMIN", "1").toInt(); m_Doc->opToolPrefs().magMax = dc.attribute("MAGMAX", "3200").toInt(); - m_Doc->opToolPrefs().magStep = dc.attribute("MAGSTEP", "200").toInt(); + m_Doc->opToolPrefs().magStep = dc.attribute("MAGSTEP", "125").toInt(); //CB Reset doc zoom step value to 200% instead of old values. if (m_Doc->opToolPrefs().magStep <= 100) - m_Doc->opToolPrefs().magStep = 200; + m_Doc->opToolPrefs().magStep = 125; m_Doc->itemToolPrefs().textTabFillChar = dc.attribute("TabFill",""); m_Doc->itemToolPrefs().textTabWidth = ScCLocale::toDoubleC(dc.attribute("TabWidth"), 36.0); if (dc.hasAttribute("CPICT")) Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp =================================================================== --- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (révision 17743) +++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (copie de travail) @@ -1938,6 +1938,7 @@ m_Doc->rulerXoffset = attrs.valueAsDouble("rulerXoffset", 0.0); m_Doc->rulerYoffset = attrs.valueAsDouble("rulerYoffset", 0.0); m_Doc->SnapGuides = attrs.valueAsBool("SnapToGuides", false); + m_Doc->SnapElement = attrs.valueAsBool("SnapToElement", false); m_Doc->useRaster = attrs.valueAsBool("SnapToGrid", false); m_Doc->setAutoSave(attrs.valueAsBool("AutoSave", false)); @@ -2127,13 +2128,13 @@ doc->itemToolPrefs().calligrapicPenStyle = static_cast(attrs.valueAsInt("calligrapicPenStyle")); doc->opToolPrefs().magMin = attrs.valueAsInt("MAGMIN", 1); doc->opToolPrefs().magMax = attrs.valueAsInt("MAGMAX", 3200); - doc->opToolPrefs().magStep = attrs.valueAsInt("MAGSTEP", 200); + doc->opToolPrefs().magStep = attrs.valueAsInt("MAGSTEP", 125); doc->opToolPrefs().dispX = attrs.valueAsDouble("dispX", 10.0); doc->opToolPrefs().dispY = attrs.valueAsDouble("dispY", 10.0); doc->opToolPrefs().constrain = attrs.valueAsDouble("constrain", 15.0); //CB Reset doc zoom step value to 200% instead of old values. if (doc->opToolPrefs().magStep <= 100) - doc->opToolPrefs().magStep = 200; + doc->opToolPrefs().magStep = 125; doc->itemToolPrefs().textTabFillChar = attrs.valueAsString("TabFill",""); doc->itemToolPrefs().textTabWidth = attrs.valueAsDouble("TabWidth", 36.0); if (attrs.hasAttribute("CPICT")) @@ -3643,8 +3644,10 @@ uint itemCount1 = m_Doc->Items->count(); bool savedAlignGrid = m_Doc->useRaster; bool savedAlignGuides = m_Doc->SnapGuides; + bool savedAlignElement = m_Doc->SnapElement; m_Doc->useRaster = false; m_Doc->SnapGuides = false; + m_Doc->SnapElement = false; QStringRef tagName = reader.name(); while(!reader.atEnd() && !reader.hasError()) @@ -3709,6 +3712,7 @@ doc->useRaster = savedAlignGrid; doc->SnapGuides = savedAlignGuides; + doc->SnapElement = savedAlignElement; if (!success) { return false; Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp =================================================================== --- scribus/plugins/fileloader/scribus134format/scribus134format.cpp (révision 17743) +++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp (copie de travail) @@ -1018,13 +1018,13 @@ doc->itemToolPrefs().shapeFillColorShade = attrs.valueAsInt("BRUSHSHADE", 100); doc->opToolPrefs().magMin = attrs.valueAsInt("MAGMIN", 1); doc->opToolPrefs().magMax = attrs.valueAsInt("MAGMAX", 3200); - doc->opToolPrefs().magStep = attrs.valueAsInt("MAGSTEP", 200); + doc->opToolPrefs().magStep = attrs.valueAsInt("MAGSTEP", 125); doc->opToolPrefs().dispX = attrs.valueAsDouble("dispX", 10.0); doc->opToolPrefs().dispY = attrs.valueAsDouble("dispY", 10.0); doc->opToolPrefs().constrain = attrs.valueAsDouble("constrain", 15.0); //CB Reset doc zoom step value to 200% instead of old values. if (doc->opToolPrefs().magStep <= 100) - doc->opToolPrefs().magStep = 200; + doc->opToolPrefs().magStep = 125; doc->itemToolPrefs().textTabFillChar = attrs.valueAsString("TabFill",""); doc->itemToolPrefs().textTabWidth = attrs.valueAsDouble("TabWidth", 36.0); if (attrs.hasAttribute("CPICT")) Index: scribus/undomanager.h =================================================================== --- scribus/undomanager.h (révision 17743) +++ scribus/undomanager.h (copie de travail) @@ -536,6 +536,7 @@ static QString SetFontEffect; static QString ImageFrame; static QString TextFrame; + static QString Layer; static QString LatexFrame; static QString ResTyp; static QString Polygon; Index: scribus/canvasgesture_linemove.cpp =================================================================== --- scribus/canvasgesture_linemove.cpp (révision 17743) +++ scribus/canvasgesture_linemove.cpp (copie de travail) @@ -218,6 +218,7 @@ double nx = np2.x(); double ny = np2.y(); m_doc->ApplyGuides(&nx, &ny); + m_doc->ApplyGuides(&nx, &ny,true); newX = nx; newY = ny; //>>#8099 Index: scribus/canvasmode_editmeshgradient.cpp =================================================================== --- scribus/canvasmode_editmeshgradient.cpp (révision 17743) +++ scribus/canvasmode_editmeshgradient.cpp (copie de travail) @@ -576,7 +576,7 @@ FPoint npfN; double nx = mousePointDoc.x(); double ny = mousePointDoc.y(); - if (!m_doc->ApplyGuides(&nx, &ny)) + if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) npfN = m_doc->ApplyGridF(FPoint(nx, ny)); else npfN = FPoint(nx, ny); Index: scribus/pageitem.cpp =================================================================== --- scribus/pageitem.cpp (révision 17743) +++ scribus/pageitem.cpp (copie de travail) @@ -1033,11 +1033,14 @@ { if(LocalRot == newRotation) return; - SimpleState *ss = new SimpleState(Um::Rotate,"",Um::IRotate); - ss->set("IMAGE_ROTATION","image_rotation"); - ss->set("OLD_ROT",LocalRot); - ss->set("NEW_ROT",newRotation); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::Rotate,"",Um::IRotate); + ss->set("IMAGE_ROTATION","image_rotation"); + ss->set("OLD_ROT",LocalRot); + ss->set("NEW_ROT",newRotation); + undoManager->action(this,ss); + } LocalRot = newRotation; if (m_Doc->isLoading()) return; @@ -1233,12 +1236,12 @@ } if (UndoManager::undoEnabled() && createUndo) //addPARESEP is false only if linking is invoked from undo action for unlinkWithText { - ScItemState > *is = new ScItemState >(UndoManager::LinkTextFrame); + ScItemState > *is = new ScItemState >(Um::LinkTextFrame); is->set("LINK_TEXT_FRAME", "linkTextFrame"); is->set("FIRST", first); is->set("JOIN_POS", textLen); is->set("ADDPARSEP", addPARSEP); - is->setItem(std::pair(this, NextBox)); + is->setItem(qMakePair(this, NextBox)); undoManager->action(this, is); } } @@ -1287,9 +1290,9 @@ NextBox = NULL; if (UndoManager::undoEnabled() && createUndo) { - ScItemState > *is = new ScItemState >(UndoManager::UnlinkTextFrame); + ScItemState > *is = new ScItemState >(Um::UnlinkTextFrame); is->set("UNLINK_TEXT_FRAME", "unlinkTextFrame"); - is->setItem(std::pair(this, undoNextBox)); + is->setItem(qMakePair(this, undoNextBox)); undoManager->action(this, is); } } @@ -1376,10 +1379,10 @@ } if (UndoManager::undoEnabled()) { - ScItemState > *is = new ScItemState >(UndoManager::UnlinkTextFrame); + ScItemState > *is = new ScItemState >(Um::UnlinkTextFrame); is->set("UNLINK_TEXT_FRAME", "unlinkTextFrame"); is->set("CUT_TEXT", cutText); - is->setItem(std::pair(Prev, Next)); + is->setItem(qMakePair(Prev, Next)); undoManager->action(this, is); } } @@ -1526,7 +1529,8 @@ { if(Cols==n) return; - if(UndoManager::undoEnabled()){ + if(UndoManager::undoEnabled()) + { SimpleState *ss = new SimpleState(Um::Columns, "", Um::IBorder); ss->set("COLUMNS", "columns"); ss->set("OLD_COLUMNS", Cols); @@ -1553,23 +1557,20 @@ { 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); + if(UndoManager::undoEnabled()) + { + 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); } - - - - - - /** Paints the item. CHANGE: cullingArea is in doc coordinates! */ @@ -2718,30 +2719,39 @@ void PageItem::setMaskGradient(VGradient grad){ if(mask_gradient==grad) return; - ScItemState > *is = new ScItemState >(Um::GradVal); - is->set("MASK_GRAD","mask_grad"); - is->setItem(qMakePair(mask_gradient,grad)); - undoManager->action(this,is); + if(UndoManager::undoEnabled()) + { + ScItemState > *is = new ScItemState >(Um::GradVal); + is->set("MASK_GRAD","mask_grad"); + is->setItem(qMakePair(mask_gradient,grad)); + undoManager->action(this,is); + } mask_gradient=grad; } void PageItem::setFillGradient(VGradient grad){ if(fill_gradient==grad) return; - ScItemState > *is = new ScItemState >(Um::GradVal); - is->set("FILL_GRAD","fill_grad"); - is->setItem(qMakePair(fill_gradient,grad)); - undoManager->action(this,is); + if(UndoManager::undoEnabled()) + { + ScItemState > *is = new ScItemState >(Um::GradVal); + is->set("FILL_GRAD","fill_grad"); + is->setItem(qMakePair(fill_gradient,grad)); + undoManager->action(this,is); + } fill_gradient=grad; } void PageItem::setStrokeGradient(VGradient grad){ if(stroke_gradient==grad) return; - ScItemState > *is = new ScItemState >(Um::GradVal); - is->set("STROKE_GRAD","STROKE_grad"); - is->setItem(qMakePair(stroke_gradient,grad)); - undoManager->action(this,is); + if(UndoManager::undoEnabled()) + { + ScItemState > *is = new ScItemState >(Um::GradVal); + is->set("STROKE_GRAD","STROKE_grad"); + is->setItem(qMakePair(stroke_gradient,grad)); + undoManager->action(this,is); + } stroke_gradient=grad; } @@ -2770,28 +2780,44 @@ void PageItem::set4ColorTransparency(double t1, double t2, double t3, double t4) { - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill)); + UndoTransaction *trans = NULL; + if(UndoManager::undoEnabled()) + trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill)); setGradientTransp1(t1); setGradientTransp2(t2); setGradientTransp3(t3); setGradientTransp4(t4); - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } } void PageItem::set4ColorShade(int t1, int t2, int t3, int t4) { - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill)); + UndoTransaction *trans = NULL; + if(UndoManager::undoEnabled()) + trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill)); setGradientShade1(t1); setGradientShade2(t2); setGradientShade3(t3); setGradientShade4(t4); - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } } void PageItem::set4ColorColors(QString col1, QString col2, QString col3, QString col4) { QColor tmp; - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill)); + UndoTransaction *trans = NULL; + if(UndoManager::undoEnabled()) + trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill)); setGradientCol1(col1); if (GrColorP1 != CommonStrings::None) { @@ -2948,7 +2974,12 @@ VisionDefectColor defect; setGradientColor4(defect.convertDefect(GrColorP4QColor, m_Doc->previewVisual)); } - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } } void PageItem::get4ColorGeometry(FPoint &c1, FPoint &c2, FPoint &c3, FPoint &c4) @@ -3019,12 +3050,6 @@ meshPoint *mp; if (forPatch) { - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill)); - ScItemState > *ss = new ScItemState >(Um::GradVal); - ss->set("GRAD_MESH_COLOR","grad_mesh_color"); - ss->set("X",x); - ss->set("Y",y); - ss->set("PATCH",true); meshGradientPatch *patch = &meshGradientPatches[x]; switch (y) { @@ -3041,18 +3066,29 @@ mp = &(patch->BL); break; } - ss->set("OLD_COLOR_NAME",mp->colorName); - ss->set("NEW_COLOR_NAME",MColor); - ss->setItem(qMakePair(mp->color,MQColor)); - ss->set("OLD_SHADE",mp->shade); - ss->set("NEW_SHADE",shade); - ss->set("OLD_TRANSP",mp->transparency); - ss->set("NEW_TRANSP",transparency); + + UndoTransaction *trans = NULL; + if(UndoManager::undoEnabled()) + { + trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill)); + ScItemState > *ss = new ScItemState >(Um::GradVal); + ss->set("GRAD_MESH_COLOR","grad_mesh_color"); + ss->set("X",x); + ss->set("Y",y); + ss->set("PATCH",true); + ss->set("OLD_COLOR_NAME",mp->colorName); + ss->set("NEW_COLOR_NAME",MColor); + ss->setItem(qMakePair(mp->color,MQColor)); + ss->set("OLD_SHADE",mp->shade); + ss->set("NEW_SHADE",shade); + ss->set("OLD_TRANSP",mp->transparency); + ss->set("NEW_TRANSP",transparency); + undoManager->action(this,ss); + } mp->colorName = MColor; mp->color = MQColor; mp->shade = shade; mp->transparency = transparency; - undoManager->action(this,ss); FPoint xx = mp->gridPoint; for (int col = 0; col < meshGradientPatches.count(); col++) { @@ -3060,114 +3096,134 @@ { if (meshGradientPatches[col].TL.gridPoint == xx) { - ScItemState > *ss = new ScItemState >(Um::GradVal); - ss->set("GRAD_MESH_COLOR","grad_mesh_color"); - ss->set("X",col); - ss->set("Y",1); - ss->set("PATCH",true); mp = &(meshGradientPatches[col].TL); - ss->set("OLD_COLOR_NAME",mp->colorName); - ss->set("NEW_COLOR_NAME",MColor); - ss->setItem(qMakePair(mp->color,MQColor)); - ss->set("OLD_SHADE",mp->shade); - ss->set("NEW_SHADE",shade); - ss->set("OLD_TRANSP",mp->transparency); - ss->set("NEW_TRANSP",transparency); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradVal); + ss->set("GRAD_MESH_COLOR","grad_mesh_color"); + ss->set("X",col); + ss->set("Y",1); + ss->set("PATCH",true); + ss->set("OLD_COLOR_NAME",mp->colorName); + ss->set("NEW_COLOR_NAME",MColor); + ss->setItem(qMakePair(mp->color,MQColor)); + ss->set("OLD_SHADE",mp->shade); + ss->set("NEW_SHADE",shade); + ss->set("OLD_TRANSP",mp->transparency); + ss->set("NEW_TRANSP",transparency); + undoManager->action(this,ss); + } mp->colorName = MColor; mp->color = MQColor; mp->shade = shade; mp->transparency = transparency; - undoManager->action(this,ss); } if (meshGradientPatches[col].TR.gridPoint == xx) { - ScItemState > *ss = new ScItemState >(Um::GradVal); - ss->set("GRAD_MESH_COLOR","grad_mesh_color"); - ss->set("X",col); - ss->set("Y",2); - ss->set("PATCH",true); mp = &(meshGradientPatches[col].TR); - ss->set("OLD_COLOR_NAME",mp->colorName); - ss->set("NEW_COLOR_NAME",MColor); - ss->setItem(qMakePair(mp->color,MQColor)); - ss->set("OLD_SHADE",mp->shade); - ss->set("NEW_SHADE",shade); - ss->set("OLD_TRANSP",mp->transparency); - ss->set("NEW_TRANSP",transparency); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradVal); + ss->set("GRAD_MESH_COLOR","grad_mesh_color"); + ss->set("X",col); + ss->set("Y",2); + ss->set("PATCH",true); + ss->set("OLD_COLOR_NAME",mp->colorName); + ss->set("NEW_COLOR_NAME",MColor); + ss->setItem(qMakePair(mp->color,MQColor)); + ss->set("OLD_SHADE",mp->shade); + ss->set("NEW_SHADE",shade); + ss->set("OLD_TRANSP",mp->transparency); + ss->set("NEW_TRANSP",transparency); + undoManager->action(this,ss); + } mp->colorName = MColor; mp->color = MQColor; mp->shade = shade; mp->transparency = transparency; - undoManager->action(this,ss); } if (meshGradientPatches[col].BR.gridPoint == xx) { - ScItemState > *ss = new ScItemState >(Um::GradVal); - ss->set("GRAD_MESH_COLOR","grad_mesh_color"); - ss->set("X",col); - ss->set("Y",3); - ss->set("PATCH",true); mp = &(meshGradientPatches[col].BR); - ss->set("OLD_COLOR_NAME",mp->colorName); - ss->set("NEW_COLOR_NAME",MColor); - ss->setItem(qMakePair(mp->color,MQColor)); - ss->set("OLD_SHADE",mp->shade); - ss->set("NEW_SHADE",shade); - ss->set("OLD_TRANSP",mp->transparency); - ss->set("NEW_TRANSP",transparency); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradVal); + ss->set("GRAD_MESH_COLOR","grad_mesh_color"); + ss->set("X",col); + ss->set("Y",3); + ss->set("PATCH",true); + ss->set("OLD_COLOR_NAME",mp->colorName); + ss->set("NEW_COLOR_NAME",MColor); + ss->setItem(qMakePair(mp->color,MQColor)); + ss->set("OLD_SHADE",mp->shade); + ss->set("NEW_SHADE",shade); + ss->set("OLD_TRANSP",mp->transparency); + ss->set("NEW_TRANSP",transparency); + undoManager->action(this,ss); + } mp->colorName = MColor; mp->color = MQColor; mp->shade = shade; mp->transparency = transparency; - undoManager->action(this,ss); } if (meshGradientPatches[col].BL.gridPoint == xx) { - ScItemState > *ss = new ScItemState >(Um::GradVal); - ss->set("GRAD_MESH_COLOR","grad_mesh_color"); - ss->set("X",col); - ss->set("Y",4); - ss->set("PATCH",true); mp = &(meshGradientPatches[col].BL); - ss->set("OLD_COLOR_NAME",mp->colorName); - ss->set("NEW_COLOR_NAME",MColor); - ss->setItem(qMakePair(mp->color,MQColor)); - ss->set("OLD_SHADE",mp->shade); - ss->set("NEW_SHADE",shade); - ss->set("OLD_TRANSP",mp->transparency); - ss->set("NEW_TRANSP",transparency); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradVal); + ss->set("GRAD_MESH_COLOR","grad_mesh_color"); + ss->set("X",col); + ss->set("Y",4); + ss->set("PATCH",true); + ss->set("OLD_COLOR_NAME",mp->colorName); + ss->set("NEW_COLOR_NAME",MColor); + ss->setItem(qMakePair(mp->color,MQColor)); + ss->set("OLD_SHADE",mp->shade); + ss->set("NEW_SHADE",shade); + ss->set("OLD_TRANSP",mp->transparency); + ss->set("NEW_TRANSP",transparency); + undoManager->action(this,ss); + } mp->colorName = MColor; mp->color = MQColor; mp->shade = shade; mp->transparency = transparency; - undoManager->action(this,ss); } } } - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } } else { if ((x > -1) && (y > -1)) { - ScItemState > *ss = new ScItemState >(Um::GradVal); - ss->set("GRAD_MESH_COLOR","grad_mesh_color"); - ss->set("X",x); - ss->set("Y",y); - ss->set("PATCH",false); mp = &(meshGradientArray[x][y]); - ss->set("OLD_COLOR_NAME",mp->colorName); - ss->set("NEW_COLOR_NAME",MColor); - ss->setItem(qMakePair(mp->color,MQColor)); - ss->set("OLD_SHADE",mp->shade); - ss->set("NEW_SHADE",shade); - ss->set("OLD_TRANSP",mp->transparency); - ss->set("NEW_TRANSP",transparency); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradVal); + ss->set("GRAD_MESH_COLOR","grad_mesh_color"); + ss->set("X",x); + ss->set("Y",y); + ss->set("PATCH",false); + ss->set("OLD_COLOR_NAME",mp->colorName); + ss->set("NEW_COLOR_NAME",MColor); + ss->setItem(qMakePair(mp->color,MQColor)); + ss->set("OLD_SHADE",mp->shade); + ss->set("NEW_SHADE",shade); + ss->set("OLD_TRANSP",mp->transparency); + ss->set("NEW_TRANSP",transparency); + undoManager->action(this,ss); + } mp->colorName = MColor; mp->color = MQColor; mp->shade = shade; mp->transparency = transparency; - undoManager->action(this,ss); } } } @@ -3213,12 +3269,15 @@ VisionDefectColor defect; MQColor = defect.convertDefect(MQColor, m_Doc->previewVisual); } - ScItemState > > *is = new ScItemState > >(Um::MeshGradient); - is->set("CREATE_MESH_GRAD","create_mesh_grad"); - is->set("ROW",rows); - is->set("COL",cols); - is->setItem(meshGradientArray); - undoManager->action(this,is); + if(UndoManager::undoEnabled()) + { + ScItemState > > *is = new ScItemState > >(Um::MeshGradient); + is->set("CREATE_MESH_GRAD","create_mesh_grad"); + is->set("ROW",rows); + is->set("COL",cols); + is->setItem(meshGradientArray); + undoManager->action(this,is); + } meshGradientArray.clear(); double xoffs = Width / static_cast(cols); double yoffs = Height / static_cast(rows); @@ -3243,10 +3302,13 @@ { int rows = meshGradientArray.count(); int cols = meshGradientArray[0].count(); - ScItemState > > *is = new ScItemState > >(Um::ResetControlPoints); - is->set("RESET_MESH_GRAD","reset_mesh_grad"); - is->setItem(meshGradientArray); - undoManager->action(this,is); + if(UndoManager::undoEnabled()) + { + ScItemState > > *is = new ScItemState > >(Um::ResetControlPoints); + is->set("RESET_MESH_GRAD","reset_mesh_grad"); + is->setItem(meshGradientArray); + undoManager->action(this,is); + } double xoffs = Width / static_cast(cols-1); double yoffs = Height / static_cast(rows-1); for (int x = 0; x < rows; x++) @@ -3290,15 +3352,18 @@ meshGradientArray[m-1][0].gridPoint.x(), meshGradientArray[m-1][0].gridPoint.y()); } - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::ChangeMeshGradient,"",Um::IFill)); - ScItemState >,FPointArray> > *ism = new ScItemState >,FPointArray> >(Um::ChangeMeshGradient, "",Um::IFill); - ism->set("MOVE_MESH_GRAD", "move_mesh_grad"); - ism->setItem(qMakePair(meshGradientArray,PoLine)); - ism->set("OLDB",OldB2); - ism->set("OLDH",OldH2); - ism->set("FRAME_TYPE",FrameType); - undoManager->action(this, ism); - + UndoTransaction *trans = NULL; + if(UndoManager::undoEnabled()) + { + trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::ChangeMeshGradient,"",Um::IFill)); + ScItemState >,FPointArray> > *ism = new ScItemState >,FPointArray> >(Um::ChangeMeshGradient, "",Um::IFill); + ism->set("MOVE_MESH_GRAD", "move_mesh_grad"); + ism->setItem(qMakePair(meshGradientArray,PoLine)); + ism->set("OLDB",OldB2); + ism->set("OLDH",OldH2); + ism->set("FRAME_TYPE",FrameType); + undoManager->action(this, ism); + } QList > meshGradientArrayOld = meshGradientArray; PoLine = Coords.copy(); double oldX = Xpos; @@ -3317,12 +3382,20 @@ for (int x = 0; x < rows+1; x++) for (int y = 0; y < cols+1; y++) meshGradientArray[x][y].moveRel(dx, dy); - ScItemState *is = new ScItemState(Um::ResetContourLine, "",Um::IBorder); - is->set("RESET_CONTOUR", "reset_contour"); - is->setItem(ContourLine); - undoManager->action(this, is); + if(UndoManager::undoEnabled()) + { + ScItemState *is = new ScItemState(Um::ResetContourLine, "",Um::IBorder); + is->set("RESET_CONTOUR", "reset_contour"); + is->setItem(ContourLine); + undoManager->action(this, is); + } ContourLine = PoLine.copy(); - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } } void PageItem::createConicalMesh() @@ -3606,11 +3679,14 @@ { if(GrMask==val) return; - SimpleState *ss = new SimpleState(Um::GradTypeMask,"",Um::IFill); - ss->set("MASKTYPE","masktype"); - ss->set("NEW",val); - ss->set("OLD",GrMask); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradTypeMask,"",Um::IFill); + ss->set("MASKTYPE","masktype"); + ss->set("NEW",val); + ss->set("OLD",GrMask); + undoManager->action(this,ss); + } GrMask = val; } @@ -4133,11 +4209,14 @@ { if (m_startArrowScale == newScale) return; // nothing to do -> return - SimpleState *ss = new SimpleState(Um::StartArrowScale,"",Um::IArrow); - ss->set("START_ARROWSCALE","start_arrowscale"); - ss->set("OLD_SCALE",m_startArrowScale); - ss->set("NEW_SCALE",newScale); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::StartArrowScale,"",Um::IArrow); + ss->set("START_ARROWSCALE","start_arrowscale"); + ss->set("OLD_SCALE",m_startArrowScale); + ss->set("NEW_SCALE",newScale); + undoManager->action(this,ss); + } m_startArrowScale = newScale; } @@ -4145,11 +4224,14 @@ { if (m_endArrowScale == newScale) return; // nothing to do -> return - SimpleState *ss = new SimpleState(Um::EndArrowScale,"",Um::IArrow); - ss->set("END_ARROWSCALE","end_arrowscale"); - ss->set("OLD_SCALE",m_endArrowScale); - ss->set("NEW_SCALE",newScale); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::EndArrowScale,"",Um::IArrow); + ss->set("END_ARROWSCALE","end_arrowscale"); + ss->set("OLD_SCALE",m_endArrowScale); + ss->set("NEW_SCALE",newScale); + undoManager->action(this,ss); + } m_endArrowScale = newScale; } @@ -4639,6 +4721,8 @@ { bool useRasterBackup = m_Doc->useRaster; bool SnapGuidesBackup = m_Doc->SnapGuides; + bool SnapElementBackup = m_Doc->SnapElement; + m_Doc->SnapElement = false; m_Doc->useRaster = false; m_Doc->SnapGuides = false; SimpleState *ss = dynamic_cast(state); @@ -4797,8 +4881,6 @@ restoreArrow(ss, isUndo, true); else if (ss->contains("END_ARROW")) restoreArrow(ss, isUndo, false); - else if (ss->contains("PSTYLE")) - restorePStyle(ss, isUndo); else if (ss->contains("CONVERT")) restoreType(ss, isUndo); else if (ss->contains("TEXTFLOW_OLDMODE")) @@ -4871,6 +4953,7 @@ if (!OnMasterPage.isEmpty()) m_Doc->setCurrentPage(oldCurrentPage); m_Doc->setMasterPageMode(oldMPMode); + m_Doc->SnapElement = SnapElementBackup; m_Doc->useRaster = useRasterBackup; m_Doc->SnapGuides = SnapGuidesBackup; } @@ -6452,17 +6535,6 @@ setEndArrowIndex(i); } - -void PageItem::restorePStyle(SimpleState *state, bool isUndo) -{ - int styleid = state->getInt("OLD_STYLE"); - if (!isUndo) - styleid = state->getInt("NEW_STYLE"); - //will be done later with other text-undo: - // m_Doc->chAbStyle(this, styleid); -} - - // FIXME: This must go into class ScribusDoc! // For now we'll just make it independent of 'this' -- AV void PageItem::restoreType(SimpleState *state, bool isUndo) @@ -6615,7 +6687,7 @@ { unlink(false); //restore properly text if frame was linked at beginning of chain - ScItemState > *is = dynamic_cast >*>(state); + ScItemState > *is = dynamic_cast >*>(state); int joinPos = is->getInt("JOIN_POS"); int ParSep = is->getBool("ADDPARSEP")?1:0; if (is->getBool("FIRST")) @@ -6650,7 +6722,7 @@ } else { - ScItemState > *is = dynamic_cast >*>(state); + ScItemState > *is = dynamic_cast >*>(state); asTextFrame()->link(is->getItem().second->asTextFrame()); } } @@ -6659,7 +6731,7 @@ { if (!isTextFrame()) return; - ScItemState > *is = dynamic_cast >*>(state); + ScItemState > *is = dynamic_cast >*>(state); if (is->contains("CUT_TEXT")) { bool cutText = is->getBool("CUT_TEXT"); @@ -7289,11 +7361,14 @@ { if(GrType==val) return; - SimpleState *ss = new SimpleState(Um::GradType,"",Um::IFill); - ss->set("GRAD_TYPE","grad_type"); - ss->set("OLD",GrType); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradType,"",Um::IFill); + ss->set("GRAD_TYPE","grad_type"); + ss->set("OLD",GrType); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrType = val; } @@ -7301,11 +7376,14 @@ { if(GrTypeStroke==val) return; - SimpleState *ss = new SimpleState(Um::GradTypeStroke,"",Um::ILineStyle); - ss->set("GRAD_TYPESTROKE","grad_typestroke"); - ss->set("OLD",GrTypeStroke); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradTypeStroke,"",Um::ILineStyle); + ss->set("GRAD_TYPESTROKE","grad_typestroke"); + ss->set("OLD",GrTypeStroke); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrTypeStroke = val; } @@ -7313,11 +7391,14 @@ { if(GrColorP1==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_COL1","grad_col1"); - ss->set("OLD",GrColorP1); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_COL1","grad_col1"); + ss->set("OLD",GrColorP1); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrColorP1 = val; } @@ -7325,11 +7406,14 @@ { if(GrColorP2==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_COL2","grad_col2"); - ss->set("OLD",GrColorP2); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_COL2","grad_col2"); + ss->set("OLD",GrColorP2); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrColorP2 = val; } @@ -7337,11 +7421,14 @@ { if(GrColorP3==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_COL3","grad_col3"); - ss->set("OLD",GrColorP3); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_COL3","grad_col3"); + ss->set("OLD",GrColorP3); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrColorP3 = val; } @@ -7349,11 +7436,14 @@ { if(GrColorP4==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_COL4","grad_col4"); - ss->set("OLD",GrColorP4); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_COL4","grad_col4"); + ss->set("OLD",GrColorP4); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrColorP4 = val; } @@ -7361,11 +7451,14 @@ { if(GrCol1Shade==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_SHADE1","grad_shade1"); - ss->set("OLD",GrCol1Shade); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_SHADE1","grad_shade1"); + ss->set("OLD",GrCol1Shade); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrCol1Shade = val; } @@ -7373,11 +7466,14 @@ { if(GrCol1Shade==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_SHADE2","grad_shade2"); - ss->set("OLD",GrCol2Shade); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_SHADE2","grad_shade2"); + ss->set("OLD",GrCol2Shade); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrCol2Shade = val; } @@ -7385,11 +7481,14 @@ { if(GrCol1Shade==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_SHADE3","grad_shade3"); - ss->set("OLD",GrCol3Shade); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_SHADE3","grad_shade3"); + ss->set("OLD",GrCol3Shade); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrCol3Shade = val; } @@ -7397,11 +7496,14 @@ { if(GrCol1Shade==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_SHADE4","grad_shade4"); - ss->set("OLD",GrCol4Shade); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_SHADE4","grad_shade4"); + ss->set("OLD",GrCol4Shade); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrCol4Shade = val; } @@ -7409,11 +7511,14 @@ { if(GrCol1transp==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_TRANSP1","grad_transp1"); - ss->set("OLD",GrCol1transp); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_TRANSP1","grad_transp1"); + ss->set("OLD",GrCol1transp); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrCol1transp = val; } @@ -7421,11 +7526,14 @@ { if(GrCol2transp==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_TRANSP2","grad_transp2"); - ss->set("OLD",GrCol2transp); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_TRANSP2","grad_transp2"); + ss->set("OLD",GrCol2transp); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrCol2transp = val; } @@ -7433,11 +7541,14 @@ { if(GrCol3transp==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_TRANSP3","grad_transp3"); - ss->set("OLD",GrCol3transp); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_TRANSP3","grad_transp3"); + ss->set("OLD",GrCol3transp); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrCol3transp = val; } @@ -7445,11 +7556,14 @@ { if(GrCol4transp==val) return; - SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); - ss->set("GRAD_TRANSP4","grad_transp4"); - ss->set("OLD",GrCol4transp); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradCol,"",Um::IFill); + ss->set("GRAD_TRANSP4","grad_transp4"); + ss->set("OLD",GrCol4transp); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrCol4transp = val; } @@ -7457,10 +7571,13 @@ { if(GrColorP1QColor ==val) return; - ScItemState > *ss = new ScItemState >(Um::GradCol,"",Um::IFill); - ss->set("GRAD_QCOLOR1","grad_qcolor1"); - ss->setItem(qMakePair(GrColorP1QColor,val)); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradCol,"",Um::IFill); + ss->set("GRAD_QCOLOR1","grad_qcolor1"); + ss->setItem(qMakePair(GrColorP1QColor,val)); + undoManager->action(this,ss); + } GrColorP1QColor = val; } @@ -7468,10 +7585,13 @@ { if(GrColorP2QColor ==val) return; - ScItemState > *ss = new ScItemState >(Um::GradCol,"",Um::IFill); - ss->set("GRAD_QCOLOR2","grad_qcolor2"); - ss->setItem(qMakePair(GrColorP2QColor,val)); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradCol,"",Um::IFill); + ss->set("GRAD_QCOLOR2","grad_qcolor2"); + ss->setItem(qMakePair(GrColorP2QColor,val)); + undoManager->action(this,ss); + } GrColorP2QColor = val; } @@ -7479,10 +7599,13 @@ { if(GrColorP3QColor ==val) return; - ScItemState > *ss = new ScItemState >(Um::GradCol,"",Um::IFill); - ss->set("GRAD_QCOLOR3","grad_qcolor3"); - ss->setItem(qMakePair(GrColorP3QColor,val)); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradCol,"",Um::IFill); + ss->set("GRAD_QCOLOR3","grad_qcolor3"); + ss->setItem(qMakePair(GrColorP3QColor,val)); + undoManager->action(this,ss); + } GrColorP3QColor = val; } @@ -7490,10 +7613,13 @@ { if(GrColorP4QColor ==val) return; - ScItemState > *ss = new ScItemState >(Um::GradCol,"",Um::IFill); - ss->set("GRAD_QCOLOR4","grad_qcolor4"); - ss->setItem(qMakePair(GrColorP4QColor,val)); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradCol,"",Um::IFill); + ss->set("GRAD_QCOLOR4","grad_qcolor4"); + ss->setItem(qMakePair(GrColorP4QColor,val)); + undoManager->action(this,ss); + } GrColorP4QColor = val; } @@ -7501,324 +7627,414 @@ { if(snapToPatchGrid ==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("SNAP_TO_PATCH","snap_to_patch"); - ss->set("OLD",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("SNAP_TO_PATCH","snap_to_patch"); + ss->set("OLD",val); + undoManager->action(this,ss); + } snapToPatchGrid = val; } void PageItem::setGradientStartX(double val){ if(GrStartX==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_STARTX","grad_startx"); - ss->set("OLD",GrStartX); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_STARTX","grad_startx"); + ss->set("OLD",GrStartX); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrStartX = val; } void PageItem::setGradientStartY(double val){ if(GrStartY==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_STARTY","grad_starty"); - ss->set("OLD",GrStartY); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_STARTY","grad_starty"); + ss->set("OLD",GrStartY); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrStartY = val; } void PageItem::setGradientEndX(double val){ if(GrEndX==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_ENDX","grad_endx"); - ss->set("OLD",GrEndX); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_ENDX","grad_endx"); + ss->set("OLD",GrEndX); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrEndX = val; } void PageItem::setGradientEndY(double val){ if(GrEndY==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_ENDY","grad_endy"); - ss->set("OLD",GrEndY); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_ENDY","grad_endy"); + ss->set("OLD",GrEndY); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrEndY = val; } void PageItem::setGradientFocalX(double val){ if(GrFocalX==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_FOCALX","grad_focalx"); - ss->set("OLD",GrFocalX); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_FOCALX","grad_focalx"); + ss->set("OLD",GrFocalX); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrFocalX = val; } void PageItem::setGradientFocalY(double val){ if(GrFocalY==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_FOCALY","grad_focaly"); - ss->set("OLD",GrFocalY); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_FOCALY","grad_focaly"); + ss->set("OLD",GrFocalY); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrFocalY = val; } void PageItem::setGradientScale(double val){ if(GrScale==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_SCALE","grad_scale"); - ss->set("OLD",GrScale); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_SCALE","grad_scale"); + ss->set("OLD",GrScale); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrScale = val; } void PageItem::setGradientSkew(double val){ if(GrSkew==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_SKEW","grad_skew"); - ss->set("OLD",GrSkew); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_SKEW","grad_skew"); + ss->set("OLD",GrSkew); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrSkew = val; } void PageItem::setGradientMaskStartX(double val){ if(GrMaskStartX==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_MASKSTARTX","grad_maskstartx"); - ss->set("OLD",GrMaskStartX); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_MASKSTARTX","grad_maskstartx"); + ss->set("OLD",GrMaskStartX); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrMaskStartX = val; } void PageItem::setGradientMaskStartY(double val){ if(GrMaskStartY==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_MASKSTARTY","grad_maskstarty"); - ss->set("OLD",GrMaskStartY); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_MASKSTARTY","grad_maskstarty"); + ss->set("OLD",GrMaskStartY); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrMaskStartY = val; } void PageItem::setGradientMaskEndX(double val){ if(GrMaskEndX==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_MASKENDX","grad_maskendx"); - ss->set("OLD",GrMaskEndX); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_MASKENDX","grad_maskendx"); + ss->set("OLD",GrMaskEndX); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrMaskEndX = val; } void PageItem::setGradientMaskEndY(double val){ if(GrMaskEndY==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_MASKENDY","grad_maskendy"); - ss->set("OLD",GrMaskEndY); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_MASKENDY","grad_maskendy"); + ss->set("OLD",GrMaskEndY); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrMaskEndY = val; } void PageItem::setGradientMaskFocalX(double val){ if(GrMaskFocalX==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_MASKFOCALX","grad_maskfocalx"); - ss->set("OLD",GrMaskFocalX); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_MASKFOCALX","grad_maskfocalx"); + ss->set("OLD",GrMaskFocalX); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrMaskFocalX = val; } void PageItem::setGradientMaskFocalY(double val){ if(GrMaskFocalY==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_MASKFOCALY","grad_maskfocaly"); - ss->set("OLD",GrMaskFocalY); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_MASKFOCALY","grad_maskfocaly"); + ss->set("OLD",GrMaskFocalY); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrMaskFocalY = val; } void PageItem::setGradientMaskScale(double val){ if(GrMaskScale==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_MASKSCALE","grad_maskscale"); - ss->set("OLD",GrMaskScale); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_MASKSCALE","grad_maskscale"); + ss->set("OLD",GrMaskScale); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrMaskScale = val; } void PageItem::setGradientMaskSkew(double val){ if(GrMaskSkew==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); - ss->set("GRAD_MASKSKEW","grad_maskskew"); - ss->set("OLD",GrMaskSkew); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::IFill); + ss->set("GRAD_MASKSKEW","grad_maskskew"); + ss->set("OLD",GrMaskSkew); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrMaskSkew = val; } void PageItem::setGradientControl1(FPoint val){ if(GrControl1==val) return; - ScItemState > *ss = new ScItemState >(Um::GradPos,"",Um::IFill); - ss->set("GRAD_CONTROL1","grad_control1"); - ss->setItem(qMakePair(GrControl1,val)); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradPos,"",Um::IFill); + ss->set("GRAD_CONTROL1","grad_control1"); + ss->setItem(qMakePair(GrControl1,val)); + undoManager->action(this,ss); + } GrControl1 = val; } void PageItem::setGradientControl2(FPoint val){ if(GrControl2==val) return; - ScItemState > *ss = new ScItemState >(Um::GradPos,"",Um::IFill); - ss->set("GRAD_CONTROL2","grad_control2"); - ss->setItem(qMakePair(GrControl2,val)); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradPos,"",Um::IFill); + ss->set("GRAD_CONTROL2","grad_control2"); + ss->setItem(qMakePair(GrControl2,val)); + undoManager->action(this,ss); + } GrControl2 = val; } void PageItem::setGradientControl3(FPoint val){ if(GrControl3==val) return; - ScItemState > *ss = new ScItemState >(Um::GradPos,"",Um::IFill); - ss->set("GRAD_CONTROL3","grad_control3"); - ss->setItem(qMakePair(GrControl3,val)); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradPos,"",Um::IFill); + ss->set("GRAD_CONTROL3","grad_control3"); + ss->setItem(qMakePair(GrControl3,val)); + undoManager->action(this,ss); + } GrControl3 = val; } void PageItem::setGradientControl4(FPoint val){ if(GrControl4==val) return; - ScItemState > *ss = new ScItemState >(Um::GradPos,"",Um::IFill); - ss->set("GRAD_CONTROL4","grad_control4"); - ss->setItem(qMakePair(GrControl4,val)); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradPos,"",Um::IFill); + ss->set("GRAD_CONTROL4","grad_control4"); + ss->setItem(qMakePair(GrControl4,val)); + undoManager->action(this,ss); + } GrControl4 = val; } void PageItem::setGradientControl5(FPoint val){ if(GrControl5==val) return; - ScItemState > *ss = new ScItemState >(Um::GradPos,"",Um::IFill); - ss->set("GRAD_CONTROL5","grad_control5"); - ss->setItem(qMakePair(GrControl5,val)); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradPos,"",Um::IFill); + ss->set("GRAD_CONTROL5","grad_control5"); + ss->setItem(qMakePair(GrControl5,val)); + undoManager->action(this,ss); + } GrControl5 = val; } void PageItem::setGradientStrokeScale(double val){ if(GrStrokeScale==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); - ss->set("GRADSTROKE_SCALE","gradstroke_scale"); - ss->set("OLD",GrStrokeScale); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); + ss->set("GRADSTROKE_SCALE","gradstroke_scale"); + ss->set("OLD",GrStrokeScale); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrStrokeScale = val; } void PageItem::setGradientStrokeSkew(double val){ if(GrStrokeSkew==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); - ss->set("GRADSTROKE_SKEW","gradstroke_skew"); - ss->set("OLD",GrStrokeSkew); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); + ss->set("GRADSTROKE_SKEW","gradstroke_skew"); + ss->set("OLD",GrStrokeSkew); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrStrokeSkew = val; } void PageItem::setGradientStrokeFocalX(double val){ if(GrStrokeFocalX==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); - ss->set("GRADSTROKE_FOCALX","gradstroke_focalx"); - ss->set("OLD",GrStrokeFocalX); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); + ss->set("GRADSTROKE_FOCALX","gradstroke_focalx"); + ss->set("OLD",GrStrokeFocalX); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrStrokeFocalX = val; } void PageItem::setGradientStrokeFocalY(double val){ if(GrStrokeFocalY==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); - ss->set("GRADSTROKE_FOCALY","gradstroke_focaly"); - ss->set("OLD",GrStrokeFocalY); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); + ss->set("GRADSTROKE_FOCALY","gradstroke_focaly"); + ss->set("OLD",GrStrokeFocalY); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrStrokeFocalY = val; } void PageItem::setGradientStrokeStartX(double val){ if(GrStrokeStartX==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); - ss->set("GRADSTROKE_STARTX","gradstroke_startx"); - ss->set("OLD",GrStrokeStartX); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); + ss->set("GRADSTROKE_STARTX","gradstroke_startx"); + ss->set("OLD",GrStrokeStartX); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrStrokeStartX = val; } void PageItem::setGradientStrokeStartY(double val){ if(GrStrokeStartY==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); - ss->set("GRADSTROKE_STARTY","gradstroke_starty"); - ss->set("OLD",GrStrokeStartY); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); + ss->set("GRADSTROKE_STARTY","gradstroke_starty"); + ss->set("OLD",GrStrokeStartY); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrStrokeStartY = val; } void PageItem::setGradientStrokeEndX(double val){ if(GrStrokeEndX==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); - ss->set("GRADSTROKE_ENDX","gradstroke_endx"); - ss->set("OLD",GrStrokeEndX); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); + ss->set("GRADSTROKE_ENDX","gradstroke_endx"); + ss->set("OLD",GrStrokeEndX); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrStrokeEndX = val; } void PageItem::setGradientStrokeEndY(double val){ if(GrStrokeEndY==val) return; - SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); - ss->set("GRADSTROKE_ENDY","gradstroke_endy"); - ss->set("OLD",GrStrokeEndY); - ss->set("NEW",val); - undoManager->action(this,ss); + if(UndoManager::undoEnabled()) + { + SimpleState *ss = new SimpleState(Um::GradPos,"",Um::ILine); + ss->set("GRADSTROKE_ENDY","gradstroke_endy"); + ss->set("OLD",GrStrokeEndY); + ss->set("NEW",val); + undoManager->action(this,ss); + } GrStrokeEndY = val; } @@ -9768,7 +9984,7 @@ { ScItemState > *is = new ScItemState >(Um::FirstLineOffset); is->set("FIRSTLINEOFFSET", "fisrtlineoffset"); - is->setItem(QPair(firstLineOffsetP, flop)); + is->setItem(qMakePair(firstLineOffsetP, flop)); undoManager->action(this, is); } firstLineOffsetP = flop; Index: scribus/scribusdoc.h =================================================================== --- scribus/scribusdoc.h (révision 17743) +++ scribus/scribusdoc.h (copie de travail) @@ -1130,10 +1130,12 @@ bool hasTOCSetup() { return !docPrefsData.tocPrefs.defaultToCSetups.empty(); } //! \brief Get the closest guide to the given point void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL); + //! \brief Get the closest border of another element to the given point + void getClosestElementBorder(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL); //! \brief Snap an item to the guides void SnapToGuides(PageItem *currItem); - bool ApplyGuides(double *x, double *y); - bool ApplyGuides(FPoint* point); + bool ApplyGuides(double *x, double *y, bool elementSnap = false); + bool ApplyGuides(FPoint* point, bool elementSnap = false); bool MoveItem(double newX, double newY, PageItem* ite, bool fromMP = false); void RotateItem(double win, PageItem *currItem); void MoveRotated(PageItem *currItem, FPoint npv, bool fromMP = false); @@ -1198,6 +1200,7 @@ int viewCount; int viewID; bool SnapGuides; + bool SnapElement; bool GuideLock; bool dontResize; /** \brief Minimum and Maximum Points of Document */ Index: scribus/canvas.cpp =================================================================== --- scribus/canvas.cpp (révision 17743) +++ scribus/canvas.cpp (copie de travail) @@ -943,6 +943,7 @@ #endif // does mode specific rendering, currently selection in legacymode and nodes in nodeedit m_view->m_canvasMode->drawControls(&qp); + m_view->m_canvasMode->drawSnapLine(&qp); QPainter tp(this); tp.drawPixmap(p->rect(), tmpImg, tmpImg.rect()); #ifdef SHOW_ME_WHAT_YOU_GET_IN_D_CANVA Index: scribus/pageitem.h =================================================================== --- scribus/pageitem.h (révision 17743) +++ scribus/pageitem.h (copie de travail) @@ -1416,8 +1416,6 @@ void restoreCustomLineStyle(SimpleState *state, bool isUndo); void restoreArrow(SimpleState *state, bool isUndo, bool isStart); - void restorePStyle(SimpleState *state, bool isUndo); - void restoreType(SimpleState *state, bool isUndo); void restoreTextFlowing(SimpleState *state, bool isUndo); void restoreImageScaleMode(SimpleState *state, bool isUndo); Index: scribus/canvasmode_normal.cpp =================================================================== --- scribus/canvasmode_normal.cpp (révision 17743) +++ scribus/canvasmode_normal.cpp (copie de travail) @@ -83,6 +83,8 @@ m_mouseCurrentPoint.setXY(0, 0); m_mouseSavedPoint.setXY(0, 0); m_objectDeltaPos.setXY(0,0 ); + ySnap = 0; + xSnap = 0; } inline bool CanvasMode_Normal::GetItem(PageItem** pi) @@ -95,13 +97,9 @@ { // qDebug() << "CanvasMode_Normal::drawControls"; if (m_canvas->m_viewMode.operItemMoving) - { drawOutline(p, 1.0, 1.0, m_objectDeltaPos.x(), m_objectDeltaPos.y()); - } else - { drawSelection(p, true); - } } void CanvasMode_Normal::enterEvent(QEvent *) @@ -433,7 +431,6 @@ if (!m_canvas->m_viewMode.operItemResizing) { //Dragging an item (plus more?) - QRectF newPlace; newX = mousePointDoc.x(); //static_cast(m->x()/sc); newY = mousePointDoc.y(); //static_cast(m->y()/sc); m_canvas->m_viewMode.operItemMoving = true; @@ -466,7 +463,6 @@ } double gx, gy, gh, gw; m_objectDeltaPos.setXY(dX, dY); - m_doc->m_Selection->setGroupRect(); m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh); // #10677 : temporary hack : we need to introduce the // concept of item snapping points to handle better @@ -491,7 +487,38 @@ ny = nyo = gy + gh + m_objectDeltaPos.y(); m_doc->ApplyGuides(&nx, &ny); m_objectDeltaPos += FPoint(nx-nxo, ny-nyo); + if(false) + { + nx = nxo = gx + gw/2 + m_objectDeltaPos.x(); + ny = nyo = gy + gh/2 + m_objectDeltaPos.y(); + m_doc->ApplyGuides(&nx, &ny); + m_objectDeltaPos += FPoint(nx-nxo, ny-nyo); + } } + if (m_doc->SnapElement) + { + xSnap = 0; + ySnap = 0; + double snapWidth[] = {0,gw,gw/2}; + double snapHeight[] = {0,gh,gh/2}; + if(m_objectDeltaPos.x()<0) + std::swap(snapWidth[0],snapWidth[2]); + if(m_objectDeltaPos.y()<0) + std::swap(snapHeight[0],snapHeight[2]); + double nx,ny,nyo,nxo; + for(int i = 0;i<3;i++) + { + nx = gx + snapWidth[i] + m_objectDeltaPos.x(); + ny = gy + snapHeight[i] + m_objectDeltaPos.y(); + nxo = nx, nyo = ny; + m_doc->ApplyGuides(&nx, &ny,true); + m_objectDeltaPos += FPoint(nx - nxo, ny - nyo); + if(ny != nyo) + ySnap = ny * m_canvas->scale(); + if(nx != nxo) + xSnap = nx * m_canvas->scale(); + } + } if (m_doc->useRaster) { m_doc->m_Selection->setGroupRect(); @@ -537,17 +564,47 @@ m_objectDeltaPos.setXY(dX, dY); if (m_doc->SnapGuides) { - m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh); double nx = gx + m_objectDeltaPos.x(); double ny = gy + m_objectDeltaPos.y(); double nxo = nx, nyo = ny; m_doc->ApplyGuides(&nx, &ny); - m_objectDeltaPos += FPoint(nx-nxo, ny-nyo); + m_objectDeltaPos += FPoint(nx - nxo, ny - nyo); nx = nxo = gx + gw + m_objectDeltaPos.x(); ny = nyo = gy + gh + m_objectDeltaPos.y(); m_doc->ApplyGuides(&nx, &ny); m_objectDeltaPos += FPoint(nx-nxo, ny-nyo); + if(false) + { + nx = nxo = gx + gw/2 + m_objectDeltaPos.x(); + ny = nyo = gy + gh/2 + m_objectDeltaPos.y(); + m_doc->ApplyGuides(&nx, &ny); + m_objectDeltaPos += FPoint(nx-nxo, ny-nyo); + } } + if (m_doc->SnapElement) + { + xSnap = 0; + ySnap = 0; + double snapWidth[] = {0,gw,gw/2}; + double snapHeight[] = {0,gh,gh/2}; + if(m_objectDeltaPos.x()<0) + std::swap(snapWidth[0],snapWidth[2]); + if(m_objectDeltaPos.y()<0) + std::swap(snapHeight[0],snapHeight[2]); + double nx,ny,nyo,nxo; + for(int i = 0;i<3;i++) + { + nx = gx + snapWidth[i] + m_objectDeltaPos.x(); + ny = gy + snapHeight[i] + m_objectDeltaPos.y(); + nxo = nx, nyo = ny; + m_doc->ApplyGuides(&nx, &ny,true); + m_objectDeltaPos += FPoint(nx - nxo, ny - nyo); + if(ny != nyo) + ySnap = ny * m_canvas->scale(); + if(nx != nxo) + xSnap = nx * m_canvas->scale(); + } + } if (m_doc->useRaster) { double gx, gy, gh, gw, gxo, gyo; @@ -920,7 +977,7 @@ m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh); double nx = gx; double ny = gy; - if (!m_doc->ApplyGuides(&nx, &ny)) + if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) { FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy)); FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh)); @@ -938,7 +995,7 @@ m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh); nx = gx+gw; ny = gy+gh; - if (m_doc->ApplyGuides(&nx, &ny)) + if (m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) m_doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false); m_doc->m_Selection->setGroupRect(); } @@ -950,7 +1007,7 @@ { double nx = currItem->xPos(); double ny = currItem->yPos(); - if (!m_doc->ApplyGuides(&nx, &ny)) + if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) { m_doc->m_Selection->setGroupRect(); double gx, gy, gh, gw, gxo, gyo; @@ -1090,6 +1147,7 @@ } else m_view->Deselect(true); + xSnap = ySnap = 0; m_canvas->setRenderModeUseBuffer(false); m_doc->DragP = false; m_doc->leaveDrag = false; @@ -1381,6 +1439,8 @@ QFileInfo fi(fileName); bool savedAlignGrid = m_doc->useRaster; bool savedAlignGuides = m_doc->SnapGuides; + bool savedAlignElement = m_doc->SnapElement; + m_doc->SnapElement = false; m_doc->useRaster = false; m_doc->SnapGuides = false; if (fi.suffix().toLower() == "sce") @@ -1415,6 +1475,7 @@ } m_doc->useRaster = savedAlignGrid; m_doc->SnapGuides = savedAlignGuides; + m_doc->SnapElement = savedAlignElement; m_doc->setLoading(false); m_doc->view()->DrawNew(); if (m_doc->m_Selection->count() > 0) Index: scribus/actionmanager.cpp =================================================================== --- scribus/actionmanager.cpp (révision 17743) +++ scribus/actionmanager.cpp (copie de travail) @@ -631,6 +631,8 @@ scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); name="viewSnapToGuides"; scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); + name="viewSnapToElements"; + scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); name="viewShowContextMenu"; scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); name="showMouseCoordinates"; @@ -653,6 +655,7 @@ (*scrActions)["viewRulerMode"]->setToggleAction(true); (*scrActions)["viewSnapToGrid"]->setToggleAction(true); (*scrActions)["viewSnapToGuides"]->setToggleAction(true); + (*scrActions)["viewSnapToElements"]->setToggleAction(true); (*scrActions)["showMouseCoordinates"]->setToggleAction(true); (*scrActions)["viewPreviewMode"]->setChecked(false); @@ -689,6 +692,7 @@ connect( (*scrActions)["viewRulerMode"], SIGNAL(triggered()), mainWindow, SLOT(ToggleRulerMode()) ); connect( (*scrActions)["viewSnapToGrid"], SIGNAL(triggered()), mainWindow, SLOT(ToggleURaster()) ); connect( (*scrActions)["viewSnapToGuides"], SIGNAL(triggered()), mainWindow, SLOT(ToggleUGuides()) ); + connect( (*scrActions)["viewSnapToElements"], SIGNAL(triggered()), mainWindow, SLOT(ToggleUElements()) ); connect( (*scrActions)["showMouseCoordinates"], SIGNAL(triggered()), mainWindow, SLOT(ToggleMouseTips()) ); // connect( (*scrActions)["viewNewView"], SIGNAL(triggered()), mainWindow, SLOT(newView()) ); @@ -1540,6 +1544,7 @@ (*scrActions)["viewRulerMode"]->setTexts( tr("Rulers Relative to Page")); (*scrActions)["viewSnapToGrid"]->setTexts( tr("Sn&ap to Grid")); (*scrActions)["viewSnapToGuides"]->setTexts( tr("Sna&p to Guides")); + (*scrActions)["viewSnapToElements"]->setTexts( tr("Snap to Items")); (*scrActions)["viewShowContextMenu"]->setTexts( tr("Show Context Menu")); // (*scrActions)["viewNewView"]->setTexts( tr("New View")); @@ -2087,7 +2092,8 @@ << "pageManageGuides" << "pageManageMargins" << "viewSnapToGrid" - << "viewSnapToGuides"; + << "viewSnapToGuides" + << "viewSnapToElements"; //View ++itmenu; itmenu->second Index: scribus/canvasmode_nodeedit.cpp =================================================================== --- scribus/canvasmode_nodeedit.cpp (révision 17743) +++ scribus/canvasmode_nodeedit.cpp (copie de travail) @@ -428,7 +428,7 @@ FPoint npf; double nx = newP.x(); double ny = newP.y(); - if (!m_doc->ApplyGuides(&nx, &ny)) + if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) npf = m_doc->ApplyGridF(FPoint(nx, ny)); else npf = FPoint(nx, ny); @@ -1118,7 +1118,7 @@ npf = m_canvas->globalToCanvas(m->globalPos()); double nx = npf.x(); double ny = npf.y(); - if (!m_doc->ApplyGuides(&nx, &ny)) + if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) npf = m_doc->ApplyGridF(FPoint(nx, ny)); else npf = FPoint(nx, ny); @@ -1219,7 +1219,7 @@ npf = m_canvas->globalToCanvas(m->globalPos()); double nx = npf.x(); double ny = npf.y(); - if (!m_doc->ApplyGuides(&nx, &ny)) + if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) npf = m_doc->ApplyGridF(FPoint(nx, ny)); else npf = FPoint(nx, ny); Index: scribus/guidesmodel.cpp =================================================================== --- scribus/guidesmodel.cpp (révision 17743) +++ scribus/guidesmodel.cpp (copie de travail) @@ -49,7 +49,7 @@ { QLocale l; return QVariant(l.toString(pts2value(m_values.at(index.row()), - m_docUnitIndex), 'f', + m_docUnitIndex) - rule, 'f', m_docUnitDecimals) ); } @@ -69,7 +69,7 @@ double newVal = value.toDouble(&ok); if (!ok) return false; - m_values[index.row()] = value2pts(newVal, m_docUnitIndex); + m_values[index.row()] = value2pts(newVal, m_docUnitIndex) + rule; qSort(m_values); emit dataChanged(index, index); emit valueChanged(); @@ -138,8 +138,9 @@ return m_values; } -void GuidesModel::unitChange(int docUnitIndex, int docUnitDecimals) +void GuidesModel::unitChange(int docUnitIndex, int docUnitDecimals,double offset) { + rule = offset; m_docUnitIndex = docUnitIndex; m_docUnitDecimals = docUnitDecimals; reset(); Index: scribus/scribusview.cpp =================================================================== --- scribus/scribusview.cpp (révision 17743) +++ scribus/scribusview.cpp (copie de travail) @@ -423,6 +423,7 @@ void ScribusView::togglePreview() { + undoManager->setUndoEnabled(false); m_canvas->m_viewMode.viewAsPreview = !m_canvas->m_viewMode.viewAsPreview; Doc->drawAsPreview = m_canvas->m_viewMode.viewAsPreview; if (m_canvas->m_viewMode.viewAsPreview) @@ -470,6 +471,7 @@ { DrawNew(); } + undoManager->setUndoEnabled(true); } void ScribusView::changed(QRectF re, bool) @@ -1181,7 +1183,7 @@ Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh); double nx = gx; double ny = gy; - if (!Doc->ApplyGuides(&nx, &ny)) + if (!Doc->ApplyGuides(&nx, &ny) && !Doc->ApplyGuides(&nx, &ny,true)) { FPoint npx; npx = Doc->ApplyGridF(FPoint(nx, ny)); @@ -1195,6 +1197,7 @@ nx = gx+gw; ny = gy+gh; Doc->ApplyGuides(&nx, &ny); + Doc->ApplyGuides(&nx, &ny,true); Doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false); Doc->m_Selection->setGroupRect(); Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh); @@ -1221,7 +1224,7 @@ { double nx = currItem->xPos(); double ny = currItem->yPos(); - if (!Doc->ApplyGuides(&nx, &ny)) + if (!Doc->ApplyGuides(&nx, &ny) && !Doc->ApplyGuides(&nx, &ny,true)) { FPoint npx; npx = Doc->ApplyGridF(FPoint(nx, ny)); @@ -1962,7 +1965,7 @@ newObjects.getGroupRect(&gx, &gy, &gw, &gh); double nx = gx; double ny = gy; - if (!Doc->ApplyGuides(&nx, &ny)) + if (!Doc->ApplyGuides(&nx, &ny) && !Doc->ApplyGuides(&nx, &ny,true)) { FPoint npx; npx = Doc->ApplyGridF(FPoint(nx, ny)); @@ -1975,6 +1978,7 @@ nx = gx+gw; ny = gy+gh; Doc->ApplyGuides(&nx, &ny); + Doc->ApplyGuides(&nx, &ny,true); Doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false, &newObjects); newObjects.setGroupRect(); newObjects.getGroupRect(&gx, &gy, &gw, &gh); @@ -1988,7 +1992,7 @@ { double nx = currItem->xPos(); double ny = currItem->yPos(); - if (!Doc->ApplyGuides(&nx, &ny)) + if (!Doc->ApplyGuides(&nx, &ny) && !Doc->ApplyGuides(&nx, &ny,true)) { FPoint npx; npx = Doc->ApplyGridF(FPoint(nx, ny)); @@ -4255,9 +4259,9 @@ { //user creates new frame using linking tool PageItem * frame = Doc->m_Selection->itemAt(0); + requestMode(modeImportImage); if (frame) { - requestMode(modeImportImage); dynamic_cast(canvasMode())->setImage(frame); dynamic_cast(canvasMode())->updateList(); } Index: scribus/pageitem_textframe.cpp =================================================================== --- scribus/pageitem_textframe.cpp (révision 17743) +++ scribus/pageitem_textframe.cpp (copie de travail) @@ -3409,7 +3409,7 @@ return; } //>> - + ScribusView* view = m_Doc->view(); switch (kk) { @@ -3461,14 +3461,31 @@ unicodeInputString = ""; if (ok) { + UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::ITextFrame,Um::InsertText,"",Um::IDelete)); if (itemText.lengthOfSelection() > 0) deleteSelectedTextFromFrame(); if (conv < 31) conv = 32; + if (UndoManager::undoEnabled()) + { + SimpleState *ss = dynamic_cast(undoManager->getLastUndo()); + if(ss && ss->get("ETEA") == "insert_frametext") + ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(QChar(conv))); + else { + ss = new SimpleState(Um::InsertText,"",Um::ICreate); + ss->set("INSERT_FRAMETEXT", "insert_frametext"); + ss->set("ETEA", QString("insert_frametext")); + ss->set("TEXT_STR", QString(QChar(conv))); + ss->set("START", itemText.cursorPosition()); + undoManager->action(this, ss); + } + } itemText.insertChars(QString(QChar(conv)), true); + trans.commit(); // Tinput = true; m_Doc->scMW()->setTBvals(this); update(); + doc()->changed(); keyRepeat = false; return; } @@ -3772,14 +3789,18 @@ if (itemText.lengthOfSelection() == 0) itemText.select(itemText.cursorPosition(), 1, true); deleteSelectedTextFromFrame(); + updateLayout(); + if (oldLast != lastInFrame() && NextBox != 0 && NextBox->invalid) + NextBox->updateLayout(); update(); // Tinput = false; - if ((cr == QChar(13)) && (itemText.length() != 0)) - { +// if ((cr == QChar(13)) && (itemText.length() != 0)) +// { // m_Doc->chAbStyle(this, findParagraphStyle(m_Doc, itemText.paragraphStyle(qMax(itemText.cursorPosition()-1,0)))); // Tinput = false; - } +// } m_Doc->scMW()->setTBvals(this); + doc()->changed(); // view->RefreshItem(this); break; case Qt::Key_Backspace: @@ -3826,6 +3847,7 @@ } m_Doc->scMW()->setTBvals(this); update(); + doc()->changed(); // view->RefreshItem(this); break; default: @@ -3938,12 +3960,12 @@ updateLayout(); if (oldLast != lastInFrame() && NextBox != 0 && NextBox->invalid) NextBox->updateLayout(); + doc()->changed(); } //check if cursor need to jump to next linked frame if ((itemText.cursorPosition() > lastInFrame() + 1) && (lastInFrame() < (itemText.length() - 2)) && NextBox != 0) { view->Deselect(true); - view->Deselect(true); NextBox->update(); m_Doc->scMW()->selectItemsFromOutlines(NextBox); } @@ -3952,10 +3974,7 @@ // update(); // view->slotDoCurs(true); if ((kk == Qt::Key_Left) || (kk == Qt::Key_Right) || (kk == Qt::Key_Up) || (kk == Qt::Key_Down)) - { keyRepeat = false; - return; - } } void PageItem_TextFrame::deleteSelectedTextFromFrame() Index: scribus/canvasmode.cpp =================================================================== --- scribus/canvasmode.cpp (révision 17743) +++ scribus/canvasmode.cpp (copie de travail) @@ -766,8 +766,29 @@ } #endif // GESTURE_FRAME_PREVIEW +void CanvasMode::drawSnapLine(QPainter* p) +{ + if(m_doc->SnapElement) + { + if(ySnap) + { + p->setPen(Qt::green); + double x = (m_doc->currentPage()->xOffset() - m_doc->bleedsVal().Left)* m_canvas->scale(); + double w = (m_doc->currentPage()->width() + m_doc->bleedsVal().Left + m_doc->bleedsVal().Right) * m_canvas->scale(); + p->drawLine(x, ySnap, x+w,ySnap); + ySnap = 0; + } + if(xSnap) + { + p->setPen(Qt::green); + double y = (m_doc->currentPage()->yOffset() - m_doc->bleedsVal().Top) * m_canvas->scale(); + double h = (m_doc->currentPage()->height() + m_doc->bleedsVal().Bottom + m_doc->bleedsVal().Top) * m_canvas->scale(); + p->drawLine(xSnap, y, xSnap,y+h); + xSnap = 0; + } + } +} - void CanvasMode::setResizeCursor(int how, double rot) { switch (how) @@ -1265,14 +1286,17 @@ /* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */ /* as the user might be trying to fine tune a position */ bool sav1 = m_doc->SnapGuides; + bool sav3 = m_doc->SnapElement; bool sav2 = m_doc->useRaster; m_doc->SnapGuides = false; m_doc->useRaster = false; + m_doc->SnapElement = false; if (m_doc->m_Selection->count() > 1) m_view->startGroupTransaction(Um::Move, "", Um::IMove); m_doc->moveGroup(-moveBy, 0); if (m_doc->m_Selection->count() > 1) m_view->endGroupTransaction(); + m_doc->SnapElement = sav3; m_doc->SnapGuides = sav1; m_doc->useRaster = sav2; } @@ -1337,8 +1361,10 @@ /* as the user might be trying to fine tune a position */ bool sav1 = m_doc->SnapGuides; bool sav2 = m_doc->useRaster; + bool sav3 = m_doc->SnapElement; m_doc->SnapGuides = false; m_doc->useRaster = false; + m_doc->SnapElement = false; if (m_doc->m_Selection->count() > 1) m_view->startGroupTransaction(Um::Move, "", Um::IMove); m_doc->moveGroup(moveBy, 0); @@ -1346,6 +1372,7 @@ m_view->endGroupTransaction(); m_doc->SnapGuides = sav1; m_doc->useRaster = sav2; + m_doc->SnapElement = sav3; } } else @@ -1408,8 +1435,10 @@ /* as the user might be trying to fine tune a position */ bool sav1 = m_doc->SnapGuides; bool sav2 = m_doc->useRaster; + bool sav3 = m_doc->SnapElement; m_doc->SnapGuides = false; m_doc->useRaster = false; + m_doc->SnapElement = false; if (m_doc->m_Selection->count() > 1) m_view->startGroupTransaction(Um::Move, "", Um::IMove); m_doc->moveGroup(0, -moveBy); @@ -1417,6 +1446,7 @@ m_view->endGroupTransaction(); m_doc->SnapGuides = sav1; m_doc->useRaster = sav2; + m_doc->SnapElement = sav3; } } else @@ -1479,8 +1509,10 @@ /* as the user might be trying to fine tune a position */ bool sav1 = m_doc->SnapGuides; bool sav2 = m_doc->useRaster; + bool sav3 = m_doc->SnapElement; m_doc->SnapGuides = false; m_doc->useRaster = false; + m_doc->SnapElement = false; if (m_doc->m_Selection->count() > 1) m_view->startGroupTransaction(Um::Move, "", Um::IMove); m_doc->moveGroup(0, moveBy); @@ -1488,6 +1520,7 @@ m_view->endGroupTransaction(); m_doc->SnapGuides = sav1; m_doc->useRaster = sav2; + m_doc->SnapElement = sav3; } } else Index: scribus/canvasgesture_resize.cpp =================================================================== --- scribus/canvasgesture_resize.cpp (révision 17743) +++ scribus/canvasgesture_resize.cpp (copie de travail) @@ -420,13 +420,21 @@ } // snap to grid + snap to guides + xSnap = 0; + ySnap = 0; bool isCorner = m_handle == Canvas::NORTHWEST || m_handle == Canvas::NORTHEAST || m_handle == Canvas::SOUTHWEST || m_handle == Canvas::SOUTHEAST; if (m_rotation == 0 || isCorner) { FPoint snappedPoint = m_doc->ApplyGridF(docPoint); double x = snappedPoint.x(), y = snappedPoint.y(); + m_doc->ApplyGuides(&x, &y); + m_doc->ApplyGuides(&x, &y,true); + if(x != snappedPoint.x() && m_handle != Canvas::NORTH && m_handle != Canvas::SOUTH) + xSnap = x * m_canvas->scale(); + if(y != snappedPoint.y() && m_handle != Canvas::EAST && m_handle != Canvas::WEST) + ySnap = y * m_canvas->scale(); // if (m_doc->ApplyGuides(&x, &y)) // qDebug() << "guides applied:" << snappedPoint.x() << snappedPoint.y() << "to" << x << y; if (m_handle == Canvas::NORTH || m_handle == Canvas::SOUTH) Index: scribus/canvasmode_create.cpp =================================================================== --- scribus/canvasmode_create.cpp (révision 17743) +++ scribus/canvasmode_create.cpp (copie de travail) @@ -299,6 +299,7 @@ double nx = np2.x(); double ny = np2.y(); m_doc->ApplyGuides(&nx, &ny); + m_doc->ApplyGuides(&nx, &ny,true); // #8959 : suppress qRound here as this prevent drawing line with angle constrain // precisely and does not allow to stick precisely to grid or guides newX = /*qRound(*/nx/*)*/; @@ -359,6 +360,7 @@ canvasCurrCoord = canvasPressCoord; m_doc->ApplyGuides(&Rxp, &Ryp); + m_doc->ApplyGuides(&Rxp, &Ryp,true); createObjectPos.setXY(Rxp, Ryp); if (m->button() == Qt::MidButton) @@ -667,6 +669,7 @@ Rxp = createObjectPos.x(); Ryp = createObjectPos.y(); m_doc->ApplyGuides(&Rxp, &Ryp); + m_doc->ApplyGuides(&Rxp, &Ryp,true); rot = xy2Deg(Rxpd, Rypd); if (rot < 0.0) rot += 360; @@ -934,14 +937,16 @@ FPoint first = m_doc->ApplyGridF(firstPoint); FPoint second = m_doc->ApplyGridF(secondPoint); - // Lock to guides. + // Lock to guides and items. double firstX = first.x(); double firstY = first.y(); m_doc->ApplyGuides(&firstX, &firstY); + m_doc->ApplyGuides(&firstX, &firstY,true); double secondX = second.x(); double secondY = second.y(); m_doc->ApplyGuides(&secondX, &secondY); + m_doc->ApplyGuides(&secondX, &secondY,true); // Return normalized rectangle. FRect rect(firstX, firstY, secondX - firstX, secondY - firstY); Index: scribus/prefsmanager.cpp =================================================================== --- scribus/prefsmanager.cpp (révision 17743) +++ scribus/prefsmanager.cpp (copie de travail) @@ -258,7 +258,7 @@ appPrefs.itemToolPrefs.lineEndArrow = 0; appPrefs.opToolPrefs.magMin = 1; appPrefs.opToolPrefs.magMax = 3200; - appPrefs.opToolPrefs.magStep = 200; + appPrefs.opToolPrefs.magStep = 125; appPrefs.docSetupPrefs.docUnitIndex = 0; appPrefs.itemToolPrefs.polyCorners = 4; appPrefs.itemToolPrefs.polyFactor = 0.5; @@ -2104,8 +2104,8 @@ appPrefs.itemToolPrefs.imageStrokeColorShade = dc.attribute("ImageStrokeColorShade", "100").toInt(); appPrefs.itemToolPrefs.imageScaleX = ScCLocale::toDoubleC(dc.attribute("ImageScaleX"), 1.0); appPrefs.itemToolPrefs.imageScaleY = ScCLocale::toDoubleC(dc.attribute("ImageScaleY"), 1.0); - appPrefs.itemToolPrefs.imageScaleType = static_cast(dc.attribute("PSCALE", "1").toInt()); - appPrefs.itemToolPrefs.imageAspectRatio = static_cast(dc.attribute("PASPECT", "0").toInt()); + appPrefs.itemToolPrefs.imageScaleType = static_cast(dc.attribute("PSCALE", "0").toInt()); + appPrefs.itemToolPrefs.imageAspectRatio = static_cast(dc.attribute("PASPECT", "1").toInt()); appPrefs.itemToolPrefs.imageUseEmbeddedPath = static_cast(dc.attribute("EmbeddedPath", "0").toInt()); appPrefs.itemToolPrefs.imageLowResType = dc.attribute("ImageLowResType", "1").toInt(); appPrefs.itemToolPrefs.polyCorners = dc.attribute("PolygonCorners", "4").toInt(); @@ -2146,10 +2146,10 @@ { appPrefs.opToolPrefs.magMin = dc.attribute("MinimumMagnification", "1").toInt(); appPrefs.opToolPrefs.magMax = dc.attribute("MaximumMagnification", "3200").toInt(); - appPrefs.opToolPrefs.magStep = dc.attribute("MagnificationStep", "200").toInt(); + appPrefs.opToolPrefs.magStep = dc.attribute("MagnificationStep", "125").toInt(); //CB Reset prefs zoom step value to 200% instead of old values. if (appPrefs.opToolPrefs.magStep <= 100) - appPrefs.opToolPrefs.magStep = 200; + appPrefs.opToolPrefs.magStep = 125; appPrefs.opToolPrefs.dispX = ScCLocale::toDoubleC(dc.attribute("DisplayOffsetX"), 10.0); appPrefs.opToolPrefs.dispY = ScCLocale::toDoubleC(dc.attribute("DisplayOffsetY"), 10.0); appPrefs.opToolPrefs.constrain = ScCLocale::toDoubleC(dc.attribute("RotationConstrainAngle"), 15.0); Index: scribus/undomanager.cpp =================================================================== --- scribus/undomanager.cpp (révision 17743) +++ scribus/undomanager.cpp (copie de travail) @@ -422,7 +422,7 @@ if (!stacks_.contains(currentDoc_)) stacks_[currentDoc_] = UndoStack(); - stacks_[currentDoc_].setMaxSize(prefs_->getInt("historylength", 20)); + stacks_[currentDoc_].setMaxSize(prefs_->getInt("historylength", 100)); for (uint i = 0; i < undoGuis_.size(); ++i) setState(undoGuis_[i]); @@ -937,6 +937,7 @@ UndoManager::SetFontEffect = tr("Set font effect"); UndoManager::ImageFrame = tr("Image frame"); UndoManager::TextFrame = tr("Text frame"); + UndoManager::Layer = tr("Layer"); UndoManager::LatexFrame = tr("Render frame"); UndoManager::Polygon = tr("Polygon"); UndoManager::EditPolygon = tr("Edit polygon"); @@ -1205,6 +1206,7 @@ QString UndoManager::SetFontEffect = ""; QString UndoManager::ImageFrame = ""; QString UndoManager::TextFrame = ""; +QString UndoManager::Layer = ""; QString UndoManager::LatexFrame = ""; QString UndoManager::Polygon = ""; QString UndoManager::EditPolygon = ""; Index: scribus/canvasmode_editmeshpatch.cpp =================================================================== --- scribus/canvasmode_editmeshpatch.cpp (révision 17743) +++ scribus/canvasmode_editmeshpatch.cpp (copie de travail) @@ -570,7 +570,7 @@ FPoint npfN; double nx = mousePointDoc.x(); double ny = mousePointDoc.y(); - if (!m_doc->ApplyGuides(&nx, &ny)) + if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true)) npfN = m_doc->ApplyGridF(FPoint(nx, ny)); else npfN = FPoint(nx, ny); Index: scribus/canvasmode_drawbezier.cpp =================================================================== --- scribus/canvasmode_drawbezier.cpp (révision 17743) +++ scribus/canvasmode_drawbezier.cpp (copie de travail) @@ -138,7 +138,7 @@ // m_view->stopDragTimer(); PageItem* currItem = m_doc->m_Selection->itemAt(0); undoManager->setUndoEnabled(true); - if (UndoManager::undoEnabled()) + if (currItem && UndoManager::undoEnabled()) { ScItemState *is = new ScItemState("Create PageItem"); is->set("CREATE_ITEM", "create_item"); Index: scribus/scribusdoc.cpp =================================================================== --- scribus/scribusdoc.cpp (révision 17743) +++ scribus/scribusdoc.cpp (copie de travail) @@ -207,7 +207,8 @@ NrItems(0), First(1), Last(0), viewCount(0), viewID(0), - SnapGuides(false), GuideLock(false), + SnapGuides(false), + SnapElement(false), GuideLock(false), minCanvasCoordinate(FPoint(0, 0)), rulerXoffset(0.0), rulerYoffset(0.0), Pages(0), MasterPages(), DocPages(), @@ -301,6 +302,7 @@ NrItems(0), First(1), Last(0), viewCount(0), viewID(0), + SnapElement(false), SnapGuides(false), GuideLock(false), minCanvasCoordinate(FPoint(0, 0)), rulerXoffset(0.0), rulerYoffset(0.0), @@ -2472,7 +2474,7 @@ QString name = lToRemove->Name; UndoTransaction* activeTransaction = NULL; if (UndoManager::undoEnabled()) - activeTransaction = new UndoTransaction(undoManager->beginTransaction("Layer", Um::IDocument, Um::DeleteLayer, "", Um::IDelete)); + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Layer, Um::IDocument, Um::DeleteLayer, "", Um::IDelete)); rebuildItemLists(); if (ScCore->usingGUI()) @@ -4965,7 +4967,9 @@ iafData.linkToExistingFramePtr->itemType()==PageItem::TextFrame && DocItems.contains(iafData.linkToExistingFramePtr)) prevItem=iafData.linkToExistingFramePtr; - UndoTransaction transaction(undoManager->beginTransaction(iafData.frameType==PageItem::TextFrame ? Um::TextFrame : Um::ImageFrame, + UndoTransaction *transaction = NULL; + if(UndoManager::undoEnabled()) + transaction = new UndoTransaction(undoManager->beginTransaction(iafData.frameType==PageItem::TextFrame ? Um::TextFrame : Um::ImageFrame, iafData.frameType==PageItem::TextFrame ? Um::ITextFrame : Um::IImageFrame, Um::InsertFrame, "", Um::ICreate)); for (uint i=0;icommit(); + delete transaction; + transaction = NULL; + } setCurrentPage(oldCurrentPage); changed(); regionsChanged()->update(QRectF()); @@ -5811,9 +5820,7 @@ case PageItem::TextFrame: newItem = new PageItem_TextFrame(*oldItem); if (UndoManager::undoEnabled() && oldItem->itemType()==PageItem::PathText) - { transactionConversion = new UndoTransaction(undoManager->beginTransaction(currentPage()->getUName(), 0, Um::TextFrame, "", Um::ITextFrame)); - } break; //We dont allow this /* case PageItem::Line: @@ -5829,9 +5836,7 @@ if (secondaryItem==NULL) return NULL; if (UndoManager::undoEnabled()) - { transactionConversion = new UndoTransaction(undoManager->beginTransaction(currentPage()->getUName(), 0, Um::PathText, "", Um::ITextFrame)); - } newItem = new PageItem_PathText(*oldItem); break; default: @@ -5847,6 +5852,7 @@ { transactionConversion->cancel(); delete transactionConversion; + transactionConversion = NULL; } return NULL; } @@ -5975,9 +5981,9 @@ //Create the undo action for the new item if (UndoManager::undoEnabled()) { - ScItemState > *is = new ScItemState >("Convert Item"); + ScItemState > *is = new ScItemState >("Convert Item"); is->set("CONVERT_ITEM", "convert_item"); - is->setItem(std::pair(oldItem, newItem)); + is->setItem(qMakePair(oldItem, newItem)); //Undo target rests with the Page for object specific undo UndoObject *target = Pages->at(0); if (newItem->OwnPage > -1) @@ -6374,11 +6380,9 @@ return false; QMap::Iterator itprev=docPrefsData.docSectionMap.begin(); QMap::Iterator it=itprev; - uint currMinIndex = itprev.value().fromindex; uint currMaxIndex = itprev.value().toindex; for ( ; it != docPrefsData.docSectionMap.end(); ++it ) { - currMinIndex=it.value().fromindex; currMaxIndex=it.value().toindex; if (it.key()!=number) @@ -6648,8 +6652,10 @@ int currActiveLayer = activeLayer(); bool savedAlignGrid = this->useRaster; bool savedAlignGuides = this->SnapGuides; + bool savedAlignElement = this->SnapElement; this->useRaster = false; this->SnapGuides = false; + this->SnapElement = false; for (it = Layers.begin(); it != Layers.end(); ++it) { if ((lcount < itemBuffer.count()) && !itemBuffer[lcount].isEmpty()) @@ -6663,6 +6669,7 @@ } this->useRaster = savedAlignGrid; this->SnapGuides = savedAlignGuides; + this->SnapElement = savedAlignElement; setActiveLayer(currActiveLayer); } } @@ -7186,7 +7193,7 @@ { UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (selectedItemCount > 1) + if (UndoManager::undoEnabled() && selectedItemCount > 1) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::LineWidth, "", Um::ILineStyle)); for (uint a = 0; a < selectedItemCount; ++a) @@ -7230,7 +7237,7 @@ { UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (selectedItemCount > 1) + if (UndoManager::undoEnabled() && selectedItemCount > 1) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::LineStyle, "", Um::ILineStyle)); for (uint a = 0; a < selectedItemCount; ++a) @@ -7258,7 +7265,7 @@ { UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (selectedItemCount > 1) + if (UndoManager::undoEnabled() && selectedItemCount > 1) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::LineJoin, "", Um::ILineStyle)); for (uint a = 0; a < selectedItemCount; ++a) @@ -7286,7 +7293,7 @@ { UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (selectedItemCount > 1) + if (UndoManager::undoEnabled() && selectedItemCount > 1) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::LineEnd, "", Um::ILineStyle)); for (uint a = 0; a < selectedItemCount; ++a) @@ -7348,7 +7355,7 @@ { UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (docSelectionCount > 1) + if (UndoManager::undoEnabled() && docSelectionCount > 1) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::LineStyle, name, Um::ILineStyle)); for (uint aa = 0; aa < docSelectionCount; ++aa) { @@ -7377,7 +7384,7 @@ m_updateManager.setUpdatesDisabled(); if (farbe == CommonStrings::tr_NoneColor) farbe = CommonStrings::None; - if (selectedItemCount > 1) + if (selectedItemCount > 1 && UndoManager::undoEnabled()) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SetLineColor, farbe, Um::IFill)); PageItem *i; @@ -7494,7 +7501,7 @@ { UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (selectedItemCount > 1) + if (selectedItemCount > 1 && UndoManager::undoEnabled()) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SetFill, farbe, Um::IFill)); PageItem *currItem; @@ -7522,7 +7529,7 @@ { UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (selectedItemCount > 1) + if (selectedItemCount > 1 && UndoManager::undoEnabled()) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SetShade, QString("%1").arg(sha), Um::IShade)); @@ -7551,7 +7558,7 @@ { UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (selectedItemCount > 1) + if (selectedItemCount > 1 && UndoManager::undoEnabled()) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SetLineShade, QString("%1").arg(sha), Um::IShade)); PageItem *currItem; @@ -7577,9 +7584,11 @@ uint selectedItemCount=m_Selection->count(); if (selectedItemCount != 0) { + UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); PageItem *currItem; - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradTypeMask,"",Um::IFill)); + if (selectedItemCount > 1 && UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradTypeMask,"",Um::IFill)); for (uint a = 0; a < selectedItemCount; ++a) { currItem = m_Selection->itemAt(a); @@ -7588,7 +7597,12 @@ currItem->updateGradientVectors(); currItem->update(); } - trans.commit(); + if (activeTransaction) + { + activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; + } m_updateManager.setUpdatesEnabled(); changed(); } @@ -7599,9 +7613,11 @@ uint selectedItemCount=m_Selection->count(); if (selectedItemCount != 0) { + UndoTransaction *activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); PageItem *currItem; - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradTypeMask,"",Um::IFill)); + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradTypeMask,"",Um::IFill)); for (uint a = 0; a < selectedItemCount; ++a) { currItem = m_Selection->itemAt(a); @@ -7636,7 +7652,12 @@ currItem->updateGradientVectors(); currItem->update(); } - trans.commit(); + if (activeTransaction) + { + activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; + } m_updateManager.setUpdatesEnabled(); changed(); } @@ -7647,9 +7668,11 @@ uint selectedItemCount=m_Selection->count(); if (selectedItemCount != 0) { + UndoTransaction* trans = NULL; m_updateManager.setUpdatesDisabled(); PageItem *currItem; - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::SetFill,"",Um::IFill)); + if(UndoManager::undoEnabled()) + trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::SetFill,"",Um::IFill)); for (uint a = 0; a < selectedItemCount; ++a) { currItem = m_Selection->itemAt(a); @@ -7729,7 +7752,12 @@ currItem->createConicalMesh(); currItem->update(); } - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } m_updateManager.setUpdatesEnabled(); changed(); } @@ -8481,7 +8509,7 @@ ScItemState > *is = new ScItemState >(Um::SetStyle); is->set("SET_PARASTYLE", "set_parastyle"); is->set("POS",pos); - is->setItem(QPair(newStyle, currItem->itemText.paragraphStyle(pos))); + is->setItem(qMakePair(newStyle, currItem->itemText.paragraphStyle(pos))); undoManager->action(currItem, is); } currItem->itemText.setStyle(pos, newStyle); @@ -8494,7 +8522,7 @@ ScItemState > *is = new ScItemState >(Um::SetStyle); is->set("SET_PARASTYLE", "set_parastyle"); is->set("POS",stop); - is->setItem(QPair(newStyle2, currItem->itemText.paragraphStyle(stop))); + is->setItem(qMakePair(newStyle2, currItem->itemText.paragraphStyle(stop))); undoManager->action(currItem, is); } currItem->itemText.setStyle(stop, newStyle2); @@ -8507,7 +8535,7 @@ { ScItemState > *is = new ScItemState >(Um::SetStyle); is->set("APPLY_DEFAULTPARASTYLE", "apply_defaultparastyle"); - is->setItem(QPair(newStyle, currItem->itemText.defaultStyle())); + is->setItem(qMakePair(newStyle, currItem->itemText.defaultStyle())); undoManager->action(currItem, is); } currItem->itemText.setDefaultStyle(newStyle); @@ -8534,7 +8562,7 @@ if (selectedItemCount == 0) return; UndoTransaction* activeTransaction = NULL; - if (selectedItemCount > 1) + if (UndoManager::undoEnabled() && selectedItemCount > 1) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ApplyTextStyle, newStyle.displayName(), Um::IFont)); for (uint aa = 0; aa < selectedItemCount; ++aa) { @@ -8548,7 +8576,7 @@ { ScItemState > *is = new ScItemState >(Um::SetStyle); is->set("APPLY_DEFAULTPARASTYLE", "apply_defaultparastyle"); - is->setItem(QPair(dstyle, currItem->itemText.defaultStyle())); + is->setItem(qMakePair(dstyle, currItem->itemText.defaultStyle())); undoManager->action(currItem, is); } currItem->itemText.setDefaultStyle(dstyle); @@ -8573,7 +8601,7 @@ ScItemState > *is = new ScItemState >(Um::SetStyle); is->set("APPLY_PARASTYLE", "apply_parastyle"); is->set("POS",pos); - is->setItem(QPair(newStyle, currItem->itemText.paragraphStyle(pos))); + is->setItem(qMakePair(newStyle, currItem->itemText.paragraphStyle(pos))); undoManager->action(currItem, is); } currItem->itemText.applyStyle(pos, newStyle, rmDirectFormatting); @@ -8584,7 +8612,7 @@ ScItemState > *is = new ScItemState >(Um::SetStyle); is->set("APPLY_PARASTYLE", "apply_parastyle"); is->set("POS",stop); - is->setItem(QPair(newStyle, currItem->itemText.paragraphStyle(stop))); + is->setItem(qMakePair(newStyle, currItem->itemText.paragraphStyle(stop))); undoManager->action(currItem, is); } currItem->itemText.applyStyle(stop, newStyle, rmDirectFormatting); @@ -8656,9 +8684,9 @@ ss = dynamic_cast(ts->at(0)); if(ss && ss->get("ETEA") == ETEA) { - for(int i=0;isizet();i++){ + for(uint i=0;isizet();i++){ is = dynamic_cast > *>(ts->at(i)); - is->setItem(QPair(newStyle, is->getItem().second)); + is->setItem(qMakePair(newStyle, is->getItem().second)); } } else @@ -8668,7 +8696,7 @@ is->set("START",lastPos); is->set("LENGTH",i-lastPos); is->set("ETEA", ETEA); - is->setItem(QPair(newStyle, currItem->itemText.charStyle(lastPos))); + is->setItem(qMakePair(newStyle, currItem->itemText.charStyle(lastPos))); undoManager->action(currItem, is); } } @@ -8687,7 +8715,7 @@ { ScItemState > *is = new ScItemState >(Um::SetStyle); is->set("APPLY_DEFAULTPARASTYLE", "apply_defaultparastyle"); - is->setItem(QPair(dstyle, currItem->itemText.defaultStyle())); + is->setItem(qMakePair(dstyle, currItem->itemText.defaultStyle())); undoManager->action(currItem, is); } CharStyle lastParent = currItem->itemText.charStyle(0); @@ -8704,7 +8732,7 @@ ist->set("APPLY_CHARSTYLE", "apply_charstyle"); ist->set("START",lastPos); ist->set("LENGTH",i-lastPos); - ist->setItem(QPair(newStyle, currItem->itemText.charStyle(lastPos))); + ist->setItem(qMakePair(newStyle, currItem->itemText.charStyle(lastPos))); undoManager->action(currItem, ist); } lastPos = i; @@ -8770,7 +8798,7 @@ is->set("SET_CHARSTYLE", "set_charstyle"); is->set("START",start); is->set("LENGTH",length); - is->setItem(QPair(newStyle, currItem->itemText.charStyle(start))); + is->setItem(qMakePair(newStyle, currItem->itemText.charStyle(start))); undoManager->action(currItem, is); } currItem->itemText.setCharStyle(start, length, newStyle); @@ -8784,14 +8812,14 @@ { ScItemState > *is = new ScItemState >(Um::SetStyle); is->set("APPLY_DEFAULTPARASTYLE", "apply_defaultparastyle"); - is->setItem(QPair(dstyle, currItem->itemText.defaultStyle())); + is->setItem(qMakePair(dstyle, currItem->itemText.defaultStyle())); undoManager->action(currItem, is); ScItemState > *ist = new ScItemState >(Um::ApplyTextStyle); ist->set("SET_CHARSTYLE", "set_charstyle"); ist->set("START",0); ist->set("LENGTH",currItem->itemText.length()); - ist->setItem(QPair(newStyle, currItem->itemText.charStyle(0))); + ist->setItem(qMakePair(newStyle, currItem->itemText.charStyle(0))); undoManager->action(currItem, ist); } currItem->itemText.setDefaultStyle(dstyle); @@ -8864,7 +8892,7 @@ is->set("SET_CHARSTYLE", "set_charstyle"); is->set("START",lastPos); is->set("LENGTH",i-lastPos); - is->setItem(QPair(newStyle, currItem->itemText.charStyle(lastPos))); + is->setItem(qMakePair(newStyle, currItem->itemText.charStyle(lastPos))); undoManager->action(currItem, is); } currItem->itemText.setCharStyle(lastPos, i-lastPos, newStyle); @@ -8883,7 +8911,7 @@ is->set("SET_CHARSTYLE", "set_charstyle"); is->set("START",lastPos); is->set("LENGTH",stop-lastPos); - is->setItem(QPair(newStyle2, currItem->itemText.charStyle(lastPos))); + is->setItem(qMakePair(newStyle2, currItem->itemText.charStyle(lastPos))); undoManager->action(currItem, is); } currItem->itemText.setCharStyle(lastPos, stop-lastPos, newStyle2); @@ -8899,7 +8927,7 @@ { ScItemState > *is = new ScItemState >(Um::SetStyle); is->set("APPLY_DEFAULTPARASTYLE", "apply_defaultparastyle"); - is->setItem(QPair(defStyle, currItem->itemText.defaultStyle())); + is->setItem(qMakePair(defStyle, currItem->itemText.defaultStyle())); undoManager->action(currItem, is); } currItem->itemText.setDefaultStyle(defStyle); @@ -9889,7 +9917,7 @@ { UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (docSelectionCount > 1) + if (UndoManager::undoEnabled() && docSelectionCount > 1) { if (m_Selection->itemAt(0)->locked()) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::UnLock, 0, Um::IUnLock)); @@ -9921,7 +9949,7 @@ { UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (selectedItemCount > 1) + if (UndoManager::undoEnabled() && selectedItemCount > 1) { if (m_Selection->itemAt(0)->sizeLocked()) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SizeUnLock, 0, Um::IUnLock)); @@ -9976,7 +10004,7 @@ return; UndoTransaction* activeTransaction = NULL; m_updateManager.setUpdatesDisabled(); - if (docSelectionCount > 1) + if (docSelectionCount > 1 && UndoManager::undoEnabled()) { if (m_Selection->itemAt(0)->printEnabled()) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::DisablePrint, 0, Um::IDisablePrint)); @@ -10044,18 +10072,21 @@ matrixAft.translate(gw, 0); break; } - ScItemState > *state = new ScItemState >(Um::Transform); - state->set("TRANSFORM", "TRANSFORM"); - state->set("DX",deltaX); - state->set("DY",deltaY); - state->set("POSX",currItem->xPos()); - state->set("POSY",currItem->yPos()); - QList l; - l.append(matrixPre); - l.append(matrix); - l.append(matrixAft); - state->setItem(l); - undoManager->action(currItem, state); + if(UndoManager::undoEnabled()) + { + ScItemState > *state = new ScItemState >(Um::Transform); + state->set("TRANSFORM", "TRANSFORM"); + state->set("DX",deltaX); + state->set("DY",deltaY); + state->set("POSX",currItem->xPos()); + state->set("POSY",currItem->yPos()); + QList l; + l.append(matrixPre); + l.append(matrix); + l.append(matrixAft); + state->setItem(l); + undoManager->action(currItem, state); + } currItem->PoLine.translate(deltaX, deltaY); currItem->PoLine.map(matrixPre); @@ -10070,9 +10101,7 @@ // currItem->Frame = false; currItem->ClipEdited = true; // currItem->FrameType = 3; - undoManager->setUndoEnabled(false); AdjustItemSize(currItem); - undoManager->setUndoEnabled(true); } } else @@ -10080,8 +10109,10 @@ QList Elements; bool savedAlignGrid = useRaster; bool savedAlignGuides = SnapGuides; + bool savedAlignElement = SnapElement; useRaster = false; SnapGuides = false; + SnapElement = false; DoDrawing = false; view()->updatesOn(false); m_Selection->delaySignalsOn(); @@ -10134,18 +10165,21 @@ break; } - ScItemState > *state = new ScItemState >(Um::Transform); - state->set("TRANSFORM", "TRANSFORM"); - state->set("DX",deltaX); - state->set("DY",deltaY); - state->set("POSX",currItem->xPos()); - state->set("POSY",currItem->yPos()); - QList l; - l.append(matrixPre); - l.append(matrix); - l.append(matrixAft); - state->setItem(l); - undoManager->action(currItem, state); + if(UndoManager::undoEnabled()) + { + ScItemState > *state = new ScItemState >(Um::Transform); + state->set("TRANSFORM", "TRANSFORM"); + state->set("DX",deltaX); + state->set("DY",deltaY); + state->set("POSX",currItem->xPos()); + state->set("POSY",currItem->yPos()); + QList l; + l.append(matrixPre); + l.append(matrix); + l.append(matrixAft); + state->setItem(l); + undoManager->action(currItem, state); + } currItem->PoLine.translate(deltaX, deltaY); currItem->PoLine.map(matrixPre); @@ -10160,9 +10194,7 @@ // currItem->Frame = false; currItem->ClipEdited = true; // currItem->FrameType = 3; - undoManager->setUndoEnabled(false); AdjustItemSize(currItem); - undoManager->setUndoEnabled(true); Elements.append(currItem); } comulatedMatrix *= matrix; @@ -10175,6 +10207,7 @@ RotMode (rotBack); useRaster = savedAlignGrid; SnapGuides = savedAlignGuides; + SnapGuides = savedAlignElement; DoDrawing = true; m_Selection->delaySignalsOff(); view()->updatesOn(true); @@ -10193,7 +10226,9 @@ uint docSelectionCount=m_Selection->count(); if (docSelectionCount == 0) return; - UndoTransaction trans(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipH, 0, Um::IFlipH)); + UndoTransaction* trans = NULL; + if(UndoManager::undoEnabled()) + trans = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipH, 0, Um::IFlipH)); if (docSelectionCount > 1) { double gx, gy, gh, gw, ix, iy, iw, ih; @@ -10290,7 +10325,12 @@ else if (currItem->isSpiral()) emit updateEditItem(); } - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } regionsChanged()->update(QRectF()); changed(); emit firstSelectedItemType(m_Selection->itemAt(0)->itemType()); @@ -10302,7 +10342,9 @@ uint docSelectionCount=m_Selection->count(); if (docSelectionCount == 0) return; - UndoTransaction trans(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipV, 0, Um::IFlipV)); + UndoTransaction *trans = NULL; + if(UndoManager::undoEnabled()) + trans = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::FlipV, 0, Um::IFlipV)); if (docSelectionCount > 1) { double gx, gy, gh, gw, ix, iy, iw, ih; @@ -10405,7 +10447,12 @@ emit updateEditItem(); regionsChanged()->update(QRectF()); } - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } changed(); emit firstSelectedItemType(m_Selection->itemAt(0)->itemType()); } @@ -11217,17 +11264,14 @@ return; m_updateManager.setUpdatesDisabled(); UndoTransaction* outerTransaction = NULL; - if (UndoManager::undoEnabled() && selectedItemCount > 1) + if (UndoManager::undoEnabled()) outerTransaction = new UndoTransaction(undoManager->beginTransaction()); QString tooltip = Um::ItemsInvolved + "\n"; if (selectedItemCount > Um::ItemsInvolvedLimit) tooltip = Um::ItemsInvolved2 + "\n"; for (uint a = 0; a < selectedItemCount; ++a) { - UndoTransaction* activeTransaction = NULL; PageItem *currItem = itemSelection->itemAt(a); - if (UndoManager::undoEnabled()) - activeTransaction = new UndoTransaction(undoManager->beginTransaction()); currItem->setImageXYScale(sx, sy); currItem->setImageXYOffset(ox/sx, oy/sy); if (currItem->imageClip.size() != 0) @@ -11241,16 +11285,6 @@ } if (selectedItemCount <= Um::ItemsInvolvedLimit) tooltip += "\t" + currItem->getUName() + "\n"; - if (activeTransaction) - { - activeTransaction->commit(Um::Selection, - Um::IImageFrame, - Um::ImageScale, - tooltip, - Um::IImageScaling); - delete activeTransaction; - activeTransaction = NULL; - } currItem->update(); } if (outerTransaction) @@ -11274,7 +11308,8 @@ uint selectedItemCount=itemSelection->count(); if (selectedItemCount != 0) { - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IImageFrame,Um::Rotate,"",Um::IRotate)); + UndoTransaction * trans = NULL; + trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IImageFrame,Um::Rotate,"",Um::IRotate)); for (uint a = 0; a < selectedItemCount; ++a) { PageItem *currItem = itemSelection->itemAt(a); @@ -11290,7 +11325,12 @@ } currItem->update(); } - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } changed(); } } @@ -12944,13 +12984,15 @@ currItem->effectsInUse = newEffectList; updatePic(); - // this messy part is for the undo action - ScItemState > *state = - new ScItemState >( - Um::ImageEffects, "", currItem->getUPixmap()); - state->set("APPLY_IMAGE_EFFECTS", "apply_image_effects"); - state->setItem(QPair(oldEffects, currItem->effectsInUse)); - undoManager->action(currItem, state); + if(UndoManager::undoEnabled()) + { + ScItemState > *state = + new ScItemState >( + Um::ImageEffects, "", currItem->getUPixmap()); + state->set("APPLY_IMAGE_EFFECTS", "apply_image_effects"); + state->setItem(qMakePair(oldEffects, currItem->effectsInUse)); + undoManager->action(currItem, state); + } changed(); } } @@ -13113,12 +13155,12 @@ QMap tmpGuidesSel; Guides tmpGuides = page->guides.horizontals(GuideManagerCore::Standard); Guides::iterator it; + double viewScale=m_View->scale(); uint yg = 0; uint xg = 0; - double viewScale=m_View->scale(); for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg) { - if (fabs((*it) + page->yOffset() - yin) < (docPrefsData.guidesPrefs.guideRad / viewScale)) + if (fabs((*it) + page->yOffset() - yin) < (prefsData().guidesPrefs.guideRad / viewScale)) tmpGuidesSel.insert(fabs((*it) + page->yOffset() - yin), yg); } if (tmpGuidesSel.count() != 0) @@ -13130,7 +13172,7 @@ tmpGuides = page->guides.verticals(GuideManagerCore::Standard); for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg) { - if (fabs((*it) + page->xOffset() - xin) < (docPrefsData.guidesPrefs.guideRad / viewScale)) + if (fabs((*it) + page->xOffset() - xin) < (prefsData().guidesPrefs.guideRad / viewScale)) tmpGuidesSel.insert(fabs((*it) + page->xOffset() - xin), xg); } if (tmpGuidesSel.count() != 0) @@ -13144,7 +13186,7 @@ tmpGuides = page->guides.horizontals(GuideManagerCore::Auto); for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg) { - if (fabs((*it) + page->yOffset() - yin) < (docPrefsData.guidesPrefs.guideRad / viewScale)) + if (fabs((*it) + page->yOffset() - yin) < (prefsData().guidesPrefs.guideRad / viewScale)) tmpGuidesSel.insert(fabs((*it) + page->yOffset() - yin), yg); } if (tmpGuidesSel.count() != 0) @@ -13156,7 +13198,7 @@ tmpGuides = page->guides.verticals(GuideManagerCore::Auto); for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg) { - if (fabs((*it) + page->xOffset() - xin) < (docPrefsData.guidesPrefs.guideRad / viewScale)) + if (fabs((*it) + page->xOffset() - xin) < (prefsData().guidesPrefs.guideRad / viewScale)) tmpGuidesSel.insert(fabs((*it) + page->xOffset() - xin), xg); } if (tmpGuidesSel.count() != 0) @@ -13166,7 +13208,60 @@ } } +void ScribusDoc::getClosestElementBorder(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage) +{ + *GxM = -1; + *GyM = -1; + ScPage* page = (refPage == NULL) ? currentPage() : refPage; + QMap tmpGuidesSel; + double viewScale=m_View->scale(); + QList item = getAllItems(*Items); + for(int i=0;icontainsItem(item.at(i)) || item.at(i)->OwnPage != OnPage(xin,yin)) + continue; + else if (fabs(item.at(i)->yPos() - yin) < (prefsData().guidesPrefs.guideRad / viewScale)) + tmpGuidesSel.insert(fabs(item.at(i)->yPos() - yin), i*3); + else if (fabs(item.at(i)->yPos() + item.at(i)->height() - yin) < (prefsData().guidesPrefs.guideRad / viewScale)) + tmpGuidesSel.insert(fabs(item.at(i)->yPos() + item.at(i)->height() - yin), i*3+1); + else if (fabs(item.at(i)->yPos() + item.at(i)->height()/2 - yin) < (prefsData().guidesPrefs.guideRad / viewScale)) + tmpGuidesSel.insert(fabs(item.at(i)->yPos() + item.at(i)->height()/2 - yin), i*3+2); + } + if (tmpGuidesSel.count() != 0) + { + *GyM = tmpGuidesSel.begin().value(); + if(*GyM%3==0) + *yout = item.at(*GyM/3)->yPos() - page->yOffset(); + else if(*GyM%3==1) + *yout = item.at(*GyM/3)->yPos() + item.at(*GyM/3)->height() -page->yOffset(); + else if(*GyM%3==2) + *yout = item.at(*GyM/3)->yPos() + item.at(*GyM/3)->height()/2 -page->yOffset(); + } + tmpGuidesSel.clear(); + for(int i=0;icontainsItem(item.at(i)) || item.at(i)->OwnPage != OnPage(xin,yin)) + continue; + else if (fabs(item.at(i)->xPos() - xin) < (prefsData().guidesPrefs.guideRad / viewScale)) + tmpGuidesSel.insert(fabs(item.at(i)->xPos() - xin), i*3); + else if (fabs(item.at(i)->xPos() + item.at(i)->width() - xin) < (prefsData().guidesPrefs.guideRad / viewScale)) + tmpGuidesSel.insert(fabs(item.at(i)->xPos() + item.at(i)->width() - xin), i*3+1); + else if (fabs(item.at(i)->xPos() + item.at(i)->width()/2 - xin) < (prefsData().guidesPrefs.guideRad / viewScale)) + tmpGuidesSel.insert(fabs(item.at(i)->xPos() + item.at(i)->width()/2 - xin), i*3+2); + } + if (tmpGuidesSel.count() != 0) + { + *GxM = tmpGuidesSel.begin().value(); + if(*GxM%3==0) + *xout = item.at(*GxM/3)->xPos() -page->xOffset(); + else if(*GxM%3==1) + *xout = item.at(*GxM/3)->xPos() + item.at(*GxM/3)->width() -page->xOffset(); + else if(*GxM%3==2) + *xout = item.at(*GxM/3)->xPos() + item.at(*GxM/3)->width()/2 -page->xOffset(); + } +} + void ScribusDoc::SnapToGuides(PageItem *currItem) { int pg = OnPage(currItem); @@ -13175,8 +13270,7 @@ return; ScPage* page = Pages->at(pg); int GxM, GyM; - - //FIXME: stop using m_View + getClosestGuides(0, currItem->yPos(), &xout, &yout, &GxM, &GyM); if (GyM != -1) currItem->setYPos(yout+page->yOffset()); @@ -13220,7 +13314,7 @@ } -bool ScribusDoc::ApplyGuides(double *x, double *y) +bool ScribusDoc::ApplyGuides(double *x, double *y, bool elementSnap) { // m_SnapCounter++; bool ret = false; @@ -13232,10 +13326,13 @@ int GxM, GyM; // if ((SnapGuides) && (m_SnapCounter > 1)) - if (SnapGuides) + if ((SnapGuides && !elementSnap) || (SnapElement && elementSnap)) { // m_SnapCounter = 0; - getClosestGuides(*x, *y, &xout, &yout, &GxM, &GyM, page); + if(!elementSnap) + getClosestGuides(*x, *y, &xout, &yout, &GxM, &GyM, page); + else + getClosestElementBorder(*x, *y, &xout, &yout, &GxM, &GyM, page); if (GxM != -1) { *x = xout+page->xOffset(); @@ -13273,11 +13370,11 @@ return ret; } -bool ScribusDoc::ApplyGuides(FPoint* point) +bool ScribusDoc::ApplyGuides(FPoint* point,bool elementSnap) { double newX = point->x(); double newY = point->y(); - bool ret = ApplyGuides(&newX, &newY); + bool ret = ApplyGuides(&newX, &newY, elementSnap); point->setX(newX); point->setY(newY); @@ -13401,7 +13498,6 @@ PageItem *currItem = pi; if (currItem->locked()) return false; - QPainter p; QRectF oldR(currItem->getBoundingRect()); //Uncomment for stopping resize in any direction //and remove the height/width <0 tests in item sizing switch @@ -13412,11 +13508,11 @@ newY = qMax(newY, 1); } */ - std::auto_ptr activeTransaction; + UndoTransaction *activeTransaction = NULL; if (UndoManager::undoEnabled()) { QString transacDesc = QString(Um::ResizeFromTo).arg(currItem->oldWidth).arg(currItem->oldHeight).arg(newX).arg(newY); - activeTransaction.reset( new UndoTransaction(undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), Um::Resize, transacDesc, Um::IResize)) ); + activeTransaction = new UndoTransaction(undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), Um::Resize, transacDesc, Um::IResize)); } int ph = static_cast(qMax(1.0, currItem->lineWidth() / 2.0)); QTransform ma; @@ -13465,23 +13561,17 @@ { currItem->FrameOnly = true; - if (currItem->FrameType == 0 || currItem->asLine()) + if (currItem->FrameType != 0 && !currItem->asLine()) { - if (activeTransaction.get()) - { - currItem->checkChanges(); - activeTransaction->commit(); - } - return true; + currItem->updateClip(); +// currItem->updateGradientVectors(); } - - currItem->updateClip(); -// currItem->updateGradientVectors(); - - if (activeTransaction.get()) + if (activeTransaction) { currItem->checkChanges(); activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; } return true; } @@ -13530,10 +13620,12 @@ } } currItem->setCornerRadius(qMin(currItem->cornerRadius(), qMin(currItem->width(),currItem->height())/2)); - if (activeTransaction.get()) + if (activeTransaction) { currItem->checkChanges(); activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; } return true; } @@ -14146,7 +14238,9 @@ return NULL; PageItem *currItem; double x, y, w, h; - UndoTransaction activeTransaction(undoManager->beginTransaction(Um::Selection,Um::IGroup,Um::Group,"",Um::IGroup)); + UndoTransaction *activeTransaction = NULL; + if(UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IGroup,Um::Group,"",Um::IGroup)); uint selectedItemCount = itemSelection->count(); QString tooltip = Um::ItemsInvolved + "\n"; if (selectedItemCount > Um::ItemsInvolvedLimit) @@ -14211,13 +14305,20 @@ } groupItem->asGroupFrame()->adjustXYPosition(); - ScItemState > > *is = new ScItemState > >(UndoManager::Group); - is->set("GROUP", "group"); - itemSelection->addItem(groupItem,true); - is->setItem(itemSelection->selectionList()); - undoManager->action(this, is); - activeTransaction.commit(); - + if(UndoManager::undoEnabled()) + { + ScItemState > > *is = new ScItemState > >(UndoManager::Group); + is->set("GROUP", "group"); + itemSelection->addItem(groupItem,true); + is->setItem(itemSelection->selectionList()); + undoManager->action(this, is); + } + if(activeTransaction) + { + activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; + } itemSelection->clear(); itemSelection->addItem(groupItem); @@ -14240,7 +14341,9 @@ { uint docSelectionCount = itemSelection->count(); PageItem *currItem; - UndoTransaction activeTransaction(undoManager->beginTransaction(Um::Selection,Um::IGroup,Um::Ungroup,"",Um::IGroup)); + UndoTransaction *activeTransaction= NULL; + if(UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IGroup,Um::Ungroup,"",Um::IGroup)); QList toDelete; for (uint a=0; a < docSelectionCount; ++a) { @@ -14313,11 +14416,14 @@ rItem->OwnPage = OnPage(rItem); } - ScItemState > > *is = new ScItemState > >(UndoManager::Ungroup); - is->set("UNGROUP", "ungroup"); - tempSelection.addItem(currItem,true); - is->setItem(tempSelection.selectionList()); - undoManager->action(this, is); + if(UndoManager::undoEnabled()) + { + ScItemState > > *is = new ScItemState > >(UndoManager::Ungroup); + is->set("UNGROUP", "ungroup"); + tempSelection.addItem(currItem,true); + is->setItem(tempSelection.selectionList()); + undoManager->action(this, is); + } tempSelection.clear(); tempSelection.delaySignalsOff(); @@ -14351,7 +14457,12 @@ currItem = toDelete.at(0); delete currItem; } - activeTransaction.commit(); + if(activeTransaction) + { + activeTransaction->commit(); + delete activeTransaction; + activeTransaction = NULL; + } /* QMap >::iterator groupIt; for (it = toDelete.begin(); it != toDelete.end(); ++it) @@ -14540,7 +14651,7 @@ if (UndoManager::undoEnabled()) { ScItemState< QPair , QList > > *is = new ScItemState< QPair , QList > >(Um::UniteItem, "", Um::IGroup); - is->setItem(QPair,QList >(toDel,transform)); + is->setItem(qMakePair(toDel,transform)); is->set("UNITEITEM", "uniteitem"); is->set("FRAME",currFrame); is->set("FRAMETYPE",currFrameType); @@ -14622,8 +14733,7 @@ } undoManager->setUndoEnabled(true); m_Selection->delaySignalsOff(); - //FIXME: stop using m_View - m_View->Deselect(true); + view()->Deselect(true); regionsChanged()->update(QRectF()); if(transaction) { @@ -14670,7 +14780,11 @@ } } if (convertTransaction) + { convertTransaction->commit(); + delete convertTransaction; + convertTransaction = NULL; + } tmpSel.delaySignalsOff(); m_updateManager.setUpdatesEnabled(); changed(); @@ -14690,6 +14804,10 @@ if (selectedItemCount > 0) { UndoTransaction* activeTransaction = NULL; + if (UndoManager::undoEnabled()) + activeTransaction = new UndoTransaction(undoManager->beginTransaction( Um::SelectionGroup, + Um::IGroup, + Um::AdjustFrameToImage,"",Um::IResize)); for (uint i = 0; i < selectedItemCount; ++i) { PageItem *currItem = itemSelection->itemAt(i); @@ -14697,12 +14815,6 @@ { if (currItem->asImageFrame() && currItem->PictureIsAvailable) { - if (!activeTransaction) - activeTransaction = new UndoTransaction(undoManager->beginTransaction(selectedItemCount == 1 ? - currItem->getUName() : Um::SelectionGroup, - selectedItemCount == 1 ? - currItem->getUPixmap() : Um::IGroup, - Um::AdjustFrameToImage,"",Um::IResize)); double w, h, x, y; w = currItem->OrigW * currItem->imageXScale(); h = currItem->OrigH * currItem->imageYScale(); @@ -14724,10 +14836,10 @@ activeTransaction->commit(); delete activeTransaction; activeTransaction = NULL; - regionsChanged()->update(QRectF()); - changed(); - itemSelection->itemAt(0)->emitAllToGUI(); } + regionsChanged()->update(QRectF()); + changed(); + itemSelection->itemAt(0)->emitAllToGUI(); } } void ScribusDoc::itemSelection_AdjustImagetoFrameSize( Selection *customSelection) @@ -14765,7 +14877,9 @@ if (selectedItemCount > 0) { - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::ITextFrame,Um::Resize,"",Um::IResize)); + UndoTransaction *trans = NULL; + if(UndoManager::undoEnabled()) + trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::ITextFrame,Um::Resize,"",Um::IResize)); for (uint i = 0; i < selectedItemCount; ++i) { PageItem *currItem = itemSelection->itemAt(i); @@ -14775,7 +14889,12 @@ currItem ->asTextFrame()->setTextFrameHeight(); } } - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } regionsChanged()->update(QRectF()); changed(); itemSelection->itemAt(0)->emitAllToGUI(); @@ -14886,7 +15005,8 @@ oldClip = new FPointArray(Clip); oldItemX = currItem->xPos(); oldItemY = currItem->yPos(); - nodeTransaction = new UndoTransaction(undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), uAction)); + if(UndoManager::undoEnabled()) + nodeTransaction = new UndoTransaction(undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), uAction)); Doc->nodeEdit.deselect(); return Clip; } @@ -14908,7 +15028,7 @@ new ScItemState >(name); state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour"); state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine); - state->setItem(QPair(*oldClip, newClip)); + state->setItem(qMakePair(*oldClip, newClip)); state->set("OLD_X", oldItemX); state->set("OLD_Y", oldItemY); state->set("NEW_X", currItem->xPos()); @@ -14945,7 +15065,7 @@ state = new ScItemState >(name); state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour"); state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine); - state->setItem(QPair(*oldClip, newClip)); + state->setItem(qMakePair(*oldClip, newClip)); undoManager->setUndoEnabled(false); } else @@ -15190,14 +15310,14 @@ } undoManager->setUndoEnabled(true); FPointArray newClip(Doc->nodeEdit.isContourLine ? currItem->ContourLine : currItem->PoLine); - if (*oldClip != newClip) + if (*oldClip != newClip && UndoManager::undoEnabled()) { ScItemState > *state = new ScItemState >(Um::ResetControlPoint, "", currItem->getUPixmap()); state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour"); state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine); - state->setItem(QPair(*oldClip, newClip)); + state->setItem(qMakePair(*oldClip, newClip)); state->set("OLD_X", oldItemX); state->set("OLD_Y", oldItemY); state->set("NEW_X", currItem->xPos()); @@ -15288,14 +15408,14 @@ undoManager->setUndoEnabled(true); FPointArray newClip(Doc->nodeEdit.isContourLine ? currItem->ContourLine : currItem->PoLine); - if (*oldClip != newClip) + if (*oldClip != newClip && UndoManager::undoEnabled()) { ScItemState > *state = new ScItemState >(Um::ResetControlPoints, "", currItem->getUPixmap()); state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour"); state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine); - state->setItem(QPair(*oldClip, newClip)); + state->setItem(qMakePair(*oldClip, newClip)); state->set("OLD_X", oldItemX); state->set("OLD_Y", oldItemY); state->set("NEW_X", currItem->xPos()); Index: scribus/guidesmodel.h =================================================================== --- scribus/guidesmodel.h (révision 17743) +++ scribus/guidesmodel.h (copie de travail) @@ -49,7 +49,7 @@ //! \brief Get values back to the app. Guides values(); - void unitChange(int docUnitIndex, int docUnitDecimals); + void unitChange(int docUnitIndex, int docUnitDecimals, double offset); #if 0 //! debug only void printValues(); @@ -64,6 +64,7 @@ Guides m_values; int m_docUnitIndex; int m_docUnitDecimals; + double rule; }; #endif Index: scribus/canvasgesture_table.cpp =================================================================== --- scribus/canvasgesture_table.cpp (révision 17743) +++ scribus/canvasgesture_table.cpp (copie de travail) @@ -32,6 +32,7 @@ // Snap to grid and guides. canvasPoint = m_doc->ApplyGridF(canvasPoint); m_doc->ApplyGuides(&canvasPoint); + m_doc->ApplyGuides(&canvasPoint,true); } // Return point mapped to table grid. Index: scribus/scribus.cpp =================================================================== --- scribus/scribus.cpp (révision 17743) +++ scribus/scribus.cpp (copie de travail) @@ -952,6 +952,7 @@ scrMenuMgr->addMenuSeparator("Page"); scrMenuMgr->addMenuItem(scrActions["viewSnapToGrid"], "Page", true); scrMenuMgr->addMenuItem(scrActions["viewSnapToGuides"], "Page", true); + scrMenuMgr->addMenuItem(scrActions["viewSnapToElements"], "Page", true); //View menu scrMenuMgr->createMenu("View", ActionManager::defaultMenuNameEntryTranslated("View")); @@ -1346,8 +1347,6 @@ QList windows; QMdiSubWindow* w = NULL; int kk = k->key(); - QString uc = k->text(); -// QString cr, Tcha, Twort; if (HaveDoc) { if ((doc->appMode == modeMagnifier) && (kk == Qt::Key_Shift)) @@ -1598,16 +1597,16 @@ if (currItem->asImageFrame() && !currItem->locked()) { currItem->handleModeEditKey(k, keyrep); + slotDocCh(false); } //FIXME:av view->oldCp = currItem->CPos; - if (currItem->itemType() == PageItem::TextFrame) + else if (currItem->itemType() == PageItem::TextFrame) { bool kr=keyrep; view->canvasMode()->keyPressEvent(k); //Hack for 1.4.x for stopping the cursor blinking while moving about currItem->handleModeEditKey(k, keyrep); keyrep=kr; } - slotDocCh(false); } } } @@ -2451,6 +2450,7 @@ scrActions["viewSnapToGrid"]->setChecked(doc->useRaster); scrActions["viewSnapToGuides"]->setChecked(doc->SnapGuides); + scrActions["viewSnapToElements"]->setChecked(doc->SnapElement); scrActions["viewShowRulers"]->setEnabled(true); scrMenuMgr->setMenuEnabled("Insert", true); @@ -3449,14 +3449,17 @@ uint ac = doc->Items->count(); bool savedAlignGrid = doc->useRaster; bool savedAlignGuides = doc->SnapGuides; + bool savedAlignElement = doc->SnapElement; doc->useRaster = false; doc->SnapGuides = false; + doc->SnapElement = false; if ((view->dragX == 0) && (view->dragY == 0)) slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), true, false, doc, view); else slotElemRead(data, view->dragX, view->dragY, true, false, doc, view); doc->useRaster = savedAlignGrid; doc->SnapGuides = savedAlignGuides; + doc->SnapElement = savedAlignElement; Selection tmpSelection(this, false); tmpSelection.copy(*doc->m_Selection, true); for (int as = ac; as < doc->Items->count(); ++as) @@ -4417,6 +4420,7 @@ slotFileClose(); qApp->processEvents(); loadDoc(fn); + undoManager->clearStack(); } } @@ -4678,6 +4682,7 @@ scrActions["viewFit400"]->setEnabled(false); //scrMenuMgr->setMenuEnabled("Windows", false); scrActions["viewSnapToGuides"]->setChecked(false); + scrActions["viewSnapToElements"]->setChecked(false); scrActions["viewSnapToGrid"]->setChecked(false); scrActions["viewShowRulers"]->setEnabled(false); @@ -5161,6 +5166,7 @@ { bool savedAlignGrid = doc->useRaster; bool savedAlignGuides = doc->SnapGuides; + bool savedAlignElement = doc->SnapElement; int ac = doc->Items->count(); bool isGroup = false; double gx, gy, gh, gw; @@ -5168,6 +5174,7 @@ FPoint maxSize = doc->maxCanvasCoordinate; doc->useRaster = false; doc->SnapGuides = false; + doc->SnapElement = false; // HACK #6541 : undo does not handle text modification => do not record embedded item creation // if embedded item is deleted, undo system will not be aware of its deletion => crash - JG undoManager->setUndoEnabled(false); @@ -5182,6 +5189,7 @@ doc->useRaster = savedAlignGrid; doc->SnapGuides = savedAlignGuides; + doc->SnapElement = savedAlignElement; //int tempList=doc->m_Selection->backupToTempList(0); Selection tempSelection(*doc->m_Selection); doc->m_Selection->clear(); @@ -5255,8 +5263,10 @@ uint ac = doc->Items->count(); bool savedAlignGrid = doc->useRaster; bool savedAlignGuides = doc->SnapGuides; + bool savedAlignElement = doc->SnapElement; doc->useRaster = false; doc->SnapGuides = false; + doc->SnapElement = false; if (internalCopy) slotElemRead(internalCopyBuffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view); else @@ -5275,6 +5285,7 @@ doc->useRaster = savedAlignGrid; doc->SnapGuides = savedAlignGuides; + doc->SnapElement = savedAlignElement; doc->m_Selection->delaySignalsOn(); for (int as = ac; as < doc->Items->count(); ++as) { @@ -6191,7 +6202,16 @@ } } +void ScribusMainWindow::ToggleUElements() +{ + if (doc) + { + doc->SnapElement = !doc->SnapElement; + slotDocCh(); + } +} + void ScribusMainWindow::toggleNodeEdit() { if (!doc) @@ -7480,9 +7500,11 @@ slotSelect(); bool savedAlignGrid = doc->useRaster; bool savedAlignGuides = doc->SnapGuides; + bool savedAlignElement = doc->SnapElement; internalCopy = true; doc->useRaster = false; doc->SnapGuides = false; + doc->SnapElement = false; slotEditCopy(); view->Deselect(true); UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IPolygon,Um::Duplicate,"",Um::IMultipleDuplicate)); @@ -7495,6 +7517,7 @@ trans.commit(); doc->useRaster = savedAlignGrid; doc->SnapGuides = savedAlignGuides; + doc->SnapElement = savedAlignElement; internalCopy = false; internalCopyBuffer = ""; view->DrawNew(); @@ -8851,7 +8874,7 @@ QMessageBox msgBox; QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); QPushButton *lockButton = msgBox.addButton(tr("&Lock All"), QMessageBox::AcceptRole); - QPushButton *unlockButton = msgBox.addButton(tr("&Unlock All"), QMessageBox::AcceptRole); + msgBox.addButton(tr("&Unlock All"), QMessageBox::AcceptRole); msgBox.setIcon(QMessageBox::Warning); msgBox.setWindowTitle(CommonStrings::trWarning); msgBox.setText( tr("Some objects are locked.")); @@ -8861,7 +8884,6 @@ else if (msgBox.clickedButton() == lockButton) lockObject = true; modifyLock = true; - unlockButton = NULL; // just to silence the compiler } } doc->itemSelection_GroupObjects(modifyLock, lockObject); Index: scribus/ui/rulermover.cpp =================================================================== --- scribus/ui/rulermover.cpp (révision 17743) +++ scribus/ui/rulermover.cpp (copie de travail) @@ -31,6 +31,7 @@ #include "canvas.h" #include "canvasgesture_rulermove.h" +#include "ui/guidemanager.h" #include "scribusview.h" #include "scribusdoc.h" #include "scraction.h" @@ -104,6 +105,8 @@ if (pmen2) delete pmen2; } + if (currView->Doc->guidesPrefs().guidesShown) + currView->Doc->scMW()->guidePalette->setupPage(); QWidget::mouseReleaseEvent(m); } Index: scribus/ui/guidemanager.cpp =================================================================== --- scribus/ui/guidemanager.cpp (révision 17743) +++ scribus/ui/guidemanager.cpp (copie de travail) @@ -293,8 +293,8 @@ horizontalGroupBox->setTitle(horizontalGroupBox->title() + " ("+suffix.trimmed()+")"); verticalGroupBox->setTitle(verticalGroupBox->title() + " ("+suffix.trimmed()+")"); // models display - horizontalModel->unitChange(docUnitIndex, docUnitDecimals); - verticalModel->unitChange(docUnitIndex, docUnitDecimals); + horizontalModel->unitChange(docUnitIndex, docUnitDecimals, m_Doc->rulerYoffset); + verticalModel->unitChange(docUnitIndex, docUnitDecimals, m_Doc->rulerXoffset); qobject_cast(horizontalView->itemDelegateForColumn(0))->setDoc(m_Doc); qobject_cast(verticalView->itemDelegateForColumn(0))->setDoc(m_Doc); } Index: scribus/ui/cpalette.cpp =================================================================== --- scribus/ui/cpalette.cpp (révision 17743) +++ scribus/ui/cpalette.cpp (copie de travail) @@ -320,11 +320,12 @@ else setMeshPoint(); if(CGradDia && gradEditButton->isChecked()) + { if(tabFillStroke->currentIndex() == 0) CGradDia->setValues(currentItem->gradientStartX(), currentItem->gradientStartY(), currentItem->gradientEndX(), currentItem->gradientEndY(), currentItem->GrFocalX, currentItem->GrFocalY, currentItem->GrScale, currentItem->GrSkew, 0, 0); else CGradDia->setValues(currentItem->GrStrokeStartX, currentItem->GrStrokeStartY, currentItem->GrStrokeEndX, currentItem->GrStrokeEndY, currentItem->GrStrokeFocalX, currentItem->GrStrokeFocalY, currentItem->GrStrokeScale, currentItem->GrStrokeSkew, 0, 0); - + } editMeshColors->setEnabled(!CGradDia->isVisible()); gradEditButton->setEnabled(true); @@ -667,11 +668,18 @@ double t2 = color2Alpha->value() / 100.0; double t3 = color3Alpha->value() / 100.0; double t4 = color4Alpha->value() / 100.0; - UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill)); + UndoTransaction *trans = NULL; + if(UndoManager::undoEnabled()) + trans = new UndoTransaction(undoManager->beginTransaction(Um::Selection,Um::IFill,Um::GradVal,"",Um::IFill)); currentItem->set4ColorShade(static_cast(color1Shade->value()), static_cast(color2Shade->value()), static_cast(color3Shade->value()), static_cast(color4Shade->value())); currentItem->set4ColorTransparency(t1, t2, t3, t4); currentItem->set4ColorColors(color1, color2, color3, color4); - trans.commit(); + if(trans) + { + trans->commit(); + delete trans; + trans = NULL; + } currentItem->update(); } @@ -1227,11 +1235,15 @@ { if ((grow == -1) || (gcol == 0)) return; - ScItemState > *ss = new ScItemState >(Um::GradPos); - ss->set("MOVE_MESH_PATCH","move_mesh_patch"); - ss->set("ARRAY",false); - ss->set("X",grow); - ss->set("Y",gcol); + ScItemState > *ss = NULL; + if(UndoManager::undoEnabled()) + { + ss = new ScItemState >(Um::GradPos); + ss->set("MOVE_MESH_PATCH","move_mesh_patch"); + ss->set("ARRAY",false); + ss->set("X",grow); + ss->set("Y",gcol); + } switch (gcol) { case 1: @@ -1240,7 +1252,8 @@ tmp.controlBottom = tmp.gridPoint; if (cont == 4) tmp.controlRight = tmp.gridPoint; - ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TL,tmp)); + if(UndoManager::undoEnabled()) + ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TL,tmp)); currentItem->meshGradientPatches[grow].TL = tmp; break; case 2: @@ -1249,7 +1262,8 @@ tmp.controlBottom = tmp.gridPoint; if (cont == 3) tmp.controlLeft = tmp.gridPoint; - ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TR,tmp)); + if(UndoManager::undoEnabled()) + ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TR,tmp)); currentItem->meshGradientPatches[grow].TR = tmp; break; case 3: @@ -1258,7 +1272,8 @@ tmp.controlTop = tmp.gridPoint; if (cont == 3) tmp.controlLeft = tmp.gridPoint; - ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BR,tmp)); + if(UndoManager::undoEnabled()) + ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BR,tmp)); currentItem->meshGradientPatches[grow].BR = tmp; break; case 4: @@ -1267,21 +1282,19 @@ tmp.controlTop = tmp.gridPoint; if (cont == 4) tmp.controlRight = tmp.gridPoint; - ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BL,tmp)); + if(UndoManager::undoEnabled()) + ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BL,tmp)); currentItem->meshGradientPatches[grow].BL = tmp; break; } - undoManager->action(currentItem,ss); + if(UndoManager::undoEnabled()) + undoManager->action(currentItem,ss); } else { if ((grow == -1) || (gcol == -1)) return; - ScItemState > *ss = new ScItemState >(Um::GradPos); - ss->set("MOVE_MESH_PATCH","move_mesh_patch"); - ss->set("ARRAY",true); - ss->set("X",grow); - ss->set("Y",gcol); + tmp = currentItem->meshGradientArray[grow][gcol]; if (cont == 1) tmp.controlTop = tmp.gridPoint; @@ -1291,9 +1304,18 @@ tmp.controlLeft = tmp.gridPoint; else if (cont == 4) tmp.controlRight = tmp.gridPoint; - ss->setItem(qMakePair(currentItem->meshGradientArray[grow][gcol],tmp)); + + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradPos); + ss->set("MOVE_MESH_PATCH","move_mesh_patch"); + ss->set("ARRAY",true); + ss->set("X",grow); + ss->set("Y",gcol); + ss->setItem(qMakePair(currentItem->meshGradientArray[grow][gcol],tmp)); + undoManager->action(currentItem,ss); + } currentItem->meshGradientArray[grow][gcol] = tmp; - undoManager->action(currentItem,ss); } currentItem->update(); currentDoc->regionsChanged()->update(QRect()); @@ -1308,11 +1330,15 @@ { if ((grow == -1) || (gcol == 0)) return; - ScItemState > *ss = new ScItemState >(Um::GradPos); - ss->set("MOVE_MESH_PATCH","move_mesh_patch"); - ss->set("ARRAY",false); - ss->set("X",grow); - ss->set("Y",gcol); + ScItemState > *ss = NULL; + if(UndoManager::undoEnabled()) + { + ss = new ScItemState >(Um::GradPos); + ss->set("MOVE_MESH_PATCH","move_mesh_patch"); + ss->set("ARRAY",false); + ss->set("X",grow); + ss->set("Y",gcol); + } switch (gcol) { case 1: @@ -1321,7 +1347,8 @@ tmp.controlLeft = tmp.gridPoint; tmp.controlRight = tmp.gridPoint; tmp.controlBottom = tmp.gridPoint; - ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TL,tmp)); + if(UndoManager::undoEnabled()) + ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TL,tmp)); currentItem->meshGradientPatches[grow].TL = tmp; break; case 2: @@ -1330,7 +1357,8 @@ tmp.controlLeft = tmp.gridPoint; tmp.controlRight = tmp.gridPoint; tmp.controlBottom = tmp.gridPoint; - ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TR,tmp)); + if(UndoManager::undoEnabled()) + ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].TR,tmp)); currentItem->meshGradientPatches[grow].TR = tmp; break; case 3: @@ -1339,7 +1367,8 @@ tmp.controlLeft = tmp.gridPoint; tmp.controlRight = tmp.gridPoint; tmp.controlBottom = tmp.gridPoint; - ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BR,tmp)); + if(UndoManager::undoEnabled()) + ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BR,tmp)); currentItem->meshGradientPatches[grow].BR = tmp; break; case 4: @@ -1348,29 +1377,34 @@ tmp.controlLeft = tmp.gridPoint; tmp.controlRight = tmp.gridPoint; tmp.controlBottom = tmp.gridPoint; - ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BL,tmp)); + if(UndoManager::undoEnabled()) + ss->setItem(qMakePair(currentItem->meshGradientPatches[grow].BL,tmp)); currentItem->meshGradientPatches[grow].BL = tmp; break; } - undoManager->action(currentItem,ss); + if(UndoManager::undoEnabled()) + undoManager->action(currentItem,ss); } else { if ((grow == -1) || (gcol == -1)) return; - ScItemState > *ss = new ScItemState >(Um::GradPos); - ss->set("MOVE_MESH_PATCH","move_mesh_patch"); - ss->set("ARRAY",true); - ss->set("X",grow); - ss->set("Y",gcol); tmp = currentItem->meshGradientArray[grow][gcol]; tmp.controlTop = tmp.gridPoint; tmp.controlLeft = tmp.gridPoint; tmp.controlRight = tmp.gridPoint; tmp.controlBottom = tmp.gridPoint; - ss->setItem(qMakePair(currentItem->meshGradientArray[grow][gcol],tmp)); + if(UndoManager::undoEnabled()) + { + ScItemState > *ss = new ScItemState >(Um::GradPos); + ss->set("MOVE_MESH_PATCH","move_mesh_patch"); + ss->set("ARRAY",true); + ss->set("X",grow); + ss->set("Y",gcol); + ss->setItem(qMakePair(currentItem->meshGradientArray[grow][gcol],tmp)); + undoManager->action(currentItem,ss); + } currentItem->meshGradientArray[grow][gcol] = tmp; - undoManager->action(currentItem,ss); } currentItem->update(); currentDoc->regionsChanged()->update(QRect()); @@ -1501,11 +1535,14 @@ { if ((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1)) { - ScItemState *ss = new ScItemState(Um::RemoveMeshPatch,"",Um::ILine); - ss->set("REMOVE_MESH_PATCH","remove_mesh_patch"); - ss->setItem(currentItem->meshGradientPatches.takeAt(currentItem->selectedMeshPointX)); - ss->set("POS",currentItem->selectedMeshPointX); - undoManager->action(currentItem,ss); + if(UndoManager::undoEnabled()) + { + ScItemState *ss = new ScItemState(Um::RemoveMeshPatch,"",Um::ILine); + ss->set("REMOVE_MESH_PATCH","remove_mesh_patch"); + ss->setItem(currentItem->meshGradientPatches.takeAt(currentItem->selectedMeshPointX)); + ss->set("POS",currentItem->selectedMeshPointX); + undoManager->action(currentItem,ss); + } currentItem->selectedMeshPointX = -1; CGradDia->changebuttonRemovePatch((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1)); currentItem->update(); Index: scribus/ui/contextmenu.cpp =================================================================== --- scribus/ui/contextmenu.cpp (révision 17743) +++ scribus/ui/contextmenu.cpp (copie de travail) @@ -507,6 +507,7 @@ addSeparator(); addAction(m_AP->scrActions["viewSnapToGrid"]); addAction(m_AP->scrActions["viewSnapToGuides"]); + addAction(m_AP->scrActions["viewSnapToElements"]); onAPage = (m_doc->OnPage(mx, my) != -1); if (onAPage) Index: scribus/ui/propertiespalette_imagebase.ui =================================================================== --- scribus/ui/propertiespalette_imagebase.ui (révision 17743) +++ scribus/ui/propertiespalette_imagebase.ui (copie de travail) @@ -6,8 +6,8 @@ 0 0 - 280 - 502 + 286 + 617 @@ -143,6 +143,9 @@ true + + true + true @@ -182,6 +185,9 @@ true + + true + true @@ -338,8 +344,8 @@ ScrSpinBox - QDoubleSpinBox -
ui/scrspinbox.h
+ QSpinBox +
ui/scrspinbox.h
LinkButton Index: scribus/ui/paintmanager.cpp =================================================================== --- scribus/ui/paintmanager.cpp (révision 17743) +++ scribus/ui/paintmanager.cpp (copie de travail) @@ -1292,8 +1292,10 @@ uint ap = m_doc->docPatterns.count(); bool savedAlignGrid = m_doc->useRaster; bool savedAlignGuides = m_doc->SnapGuides; + bool savedAlignElement = m_doc->SnapElement; m_doc->useRaster = false; m_doc->SnapGuides = false; + m_doc->SnapElement = false; if (fi.suffix().toLower() == "sce") { ScriXmlDoc ss; @@ -1316,6 +1318,7 @@ } m_doc->useRaster = savedAlignGrid; m_doc->SnapGuides = savedAlignGuides; + m_doc->SnapElement = savedAlignElement; uint ae = m_doc->Items->count(); if (ac != ae) { Index: scribus/ui/prefs_guidesbase.ui =================================================================== --- scribus/ui/prefs_guidesbase.ui (révision 17743) +++ scribus/ui/prefs_guidesbase.ui (copie de travail) @@ -79,13 +79,6 @@ - - - Foreground - - - - Qt::Vertical @@ -150,13 +143,6 @@ - - - - Background - - -