Index: scribus/guidesmodel.cpp =================================================================== --- scribus/guidesmodel.cpp (revision 20488) +++ scribus/guidesmodel.cpp (working copy) @@ -121,8 +121,8 @@ { // insertRows(rowCount(), 1); beginResetModel(); - if (m_values.contains(0.0)) - return; +// if (m_values.contains(0.0)) +// return; m_values.append(0.0); qSort(m_values); endResetModel(); Index: scribus/ui/guidemanager.cpp =================================================================== --- scribus/ui/guidemanager.cpp (revision 20488) +++ scribus/ui/guidemanager.cpp (working copy) @@ -294,10 +294,18 @@ // see GuidesModel::data() v.append(horizontalModel->data(ix, Qt::EditRole).toDouble()); + UndoTransaction trans; + if(UndoManager::undoEnabled()) + trans = UndoManager::instance()->beginTransaction(currentPage->getUName(), + currentPage->getUPixmap(), + Um::DelHGuide, "", + Um::IGuides); horizontalModel->removeValues(v); currentPage->guides.clearHorizontals(GuideManagerCore::Standard); currentPage->guides.addHorizontals(horizontalModel->values(), GuideManagerCore::Standard); + if (trans) + trans.commit(); drawGuides(); m_Doc->changed(); } @@ -313,10 +321,18 @@ // see GuidesModel::data() v.append(verticalModel->data(ix, Qt::EditRole).toDouble()); + UndoTransaction trans; + if(UndoManager::undoEnabled()) + trans = UndoManager::instance()->beginTransaction(currentPage->getUName(), + currentPage->getUPixmap(), + Um::DelVGuide, "", + Um::IGuides); + verticalModel->removeValues(v); - currentPage->guides.clearVerticals(GuideManagerCore::Standard); currentPage->guides.addVerticals(verticalModel->values(), GuideManagerCore::Standard); + if (trans) + trans.commit(); drawGuides(); m_Doc->changed(); } @@ -323,16 +339,41 @@ void GuideManager::addHorButton_clicked() { + UndoTransaction trans; + if(UndoManager::undoEnabled()) + trans = UndoManager::instance()->beginTransaction(currentPage->getUName(), + currentPage->getUPixmap(), + Um::AddHGuide, "", + Um::IGuides); horizontalModel->insertRow(); - horizontalView->setCurrentIndex(horizontalModel->index(0, 0, QModelIndex())); - horizontalView->edit(horizontalView->currentIndex()); + currentPage->guides.clearHorizontals(GuideManagerCore::Standard); + currentPage->guides.addHorizontal(0.0, GuideManagerCore::Standard); + + if (trans) + trans.commit(); + + drawGuides(); + m_Doc->changed(); +// horizontalView->setCurrentIndex(horizontalModel->index(0, 0, QModelIndex())); +// horizontalView->edit(horizontalView->currentIndex()); } void GuideManager::addVerButton_clicked() { + UndoTransaction trans; + if(UndoManager::undoEnabled()) + trans = UndoManager::instance()->beginTransaction(currentPage->getUName(), + currentPage->getUPixmap(), + Um::AddVGuide, "", + Um::IGuides); + verticalModel->insertRow(); - verticalView->setCurrentIndex(verticalModel->index(0, 0, QModelIndex())); - verticalView->edit(verticalView->currentIndex()); + currentPage->guides.clearVerticals(GuideManagerCore::Standard); + currentPage->guides.addVertical(0.0, GuideManagerCore::Standard); + if(trans) + trans.commit(); +// verticalView->setCurrentIndex(verticalModel->index(0, 0, QModelIndex())); +// verticalView->edit(verticalView->currentIndex()); } void GuideManager::lockCheck_stateChanged( int ) @@ -626,8 +667,17 @@ void GuideManager::verticalModel_valueChanged() { + UndoTransaction trans; + if (UndoManager::undoEnabled()) + trans = UndoManager::instance()->beginTransaction(currentPage->getUName(), + currentPage->getUPixmap(), + Um::MoveVGuide, "", + Um::IGuides); currentPage->guides.clearVerticals(GuideManagerCore::Standard); currentPage->guides.addVerticals(verticalModel->values(), GuideManagerCore::Standard); + + if (trans) + trans.commit(); drawGuides(); m_Doc->changed(); } @@ -634,8 +684,17 @@ void GuideManager::horizontalModel_valueChanged() { + UndoTransaction trans; + if (UndoManager::undoEnabled()) + trans = UndoManager::instance()->beginTransaction(currentPage->getUName(), + currentPage->getUPixmap(), + Um::MoveHGuide, "", + Um::IGuides); currentPage->guides.clearHorizontals(GuideManagerCore::Standard); currentPage->guides.addHorizontals(horizontalModel->values(), GuideManagerCore::Standard); + if (trans) + trans.commit(); + drawGuides(); m_Doc->changed(); }