r20004 by craig - Some clean up for scribusdoc. Move guide lock undo/redo to its own function to start fix for #13017
scribus-commit
scribus-commit at lists.scribus.net
Wed Apr 15 16:35:48 UTC 2015
Author: craig
Date: Wed Apr 15 16:35:48 2015
New Revision: 20004
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20004
Log:
Some clean up for scribusdoc. Move guide lock undo/redo to its own function to start fix for #13017
Modified:
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/ui/guidemanager.cpp
trunk/Scribus/scribus/ui/guidemanager.h
trunk/Scribus/scribus/ui/pageselector.h
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20004&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Apr 15 16:35:48 2015
@@ -4265,7 +4265,7 @@
else
QDir::setCurrent( QDir::homePath() );
}
- disconnect(pageSelector, 0 ,0 ,0);
+ pageSelector->disconnect();
pageSelector->setMaximum(1);
pageSelector->setEnabled(false);
updateLayerMenu();
@@ -6070,8 +6070,7 @@
}
if (tmpSelection.count() != 0)
doc->itemSelection_DeleteItem(&tmpSelection);
- //disconnect(view->pageSelector, SIGNAL(GotoPage(int)), view, SLOT(GotoPa(int)));
- pageSelector->blockSignals(true);
+ bool b = pageSelector->blockSignals(true);
view->updatesOn(false);
for (int a = to - 1; a >= from - 1; a--)
{
@@ -6100,8 +6099,7 @@
doc->removePageFromSection(a);
}
pageSelector->setMaximum(doc->Pages->count());
- //connect(view->pageSelector, SIGNAL(GotoPage(int)), view, SLOT(GotoPa(int)));
- pageSelector->blockSignals(false);
+ pageSelector->blockSignals(b);
undoManager->setUndoEnabled(false); // ugly hack to disable object moving when undoing page deletion
view->reformPagesView();
undoManager->setUndoEnabled(true); // ugly hack continues
@@ -6112,9 +6110,7 @@
doc->rebuildMasterNames();
pagePalette->rebuildMasters();
if (activeTransaction)
- {
activeTransaction.commit();
- }
}
void ScribusMainWindow::movePage()
@@ -8306,8 +8302,7 @@
connect(dia, SIGNAL(NewFont(const QString&)), this, SLOT(SetNewFont(const QString&)));
connect(dia, SIGNAL(NewAbs(int)), this, SLOT(setAlignmentValue(int)));
dia->exec();
- disconnect(dia, SIGNAL(NewFont(const QString&)), this, SLOT(SetNewFont(const QString&)));
- disconnect(dia, SIGNAL(NewAbs(int)), this, SLOT(setAlignmentValue(int)));
+ dia->disconnect();
delete dia;
slotSelect();
}
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20004&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed Apr 15 16:35:48 2015
@@ -1766,12 +1766,7 @@
else if (ss->contains("UNGROUP"))
restoreGrouping(ss, !isUndo);
else if (ss->contains("GUIDE_LOCK"))
- {
- if (isUndo)
- GuideLock = !ss->getBool("GUIDE_LOCK");
- else
- GuideLock = ss->getBool("GUIDE_LOCK");
- }
+ restoreGuideLock(ss, isUndo);
else if (ss->contains("UP_LAYER"))
{
if (isUndo)
@@ -2302,7 +2297,7 @@
}
}
-void ScribusDoc::restoreLevelDown(SimpleState *ss, bool isUndo)
+void ScribusDoc::restoreLevelDown(SimpleState* ss, bool isUndo)
{
ScItemState<QList<QPointer<PageItem> > > *is = dynamic_cast<ScItemState<QList<QPointer<PageItem> > > *>(ss);
QList<QPointer<PageItem> > listItem = is->getItem();
@@ -2315,7 +2310,7 @@
itemSelection_LowerItem();
}
-void ScribusDoc::restoreLevelBottom(SimpleState *ss, bool isUndo)
+void ScribusDoc::restoreLevelBottom(SimpleState* ss, bool isUndo)
{
ScItemState<QList<QPointer<PageItem> > > *is = dynamic_cast<ScItemState<QList<QPointer<PageItem> > > *>(ss);
QList<QPointer<PageItem> > listItem = is->getItem();
@@ -2328,7 +2323,15 @@
sendItemSelectionToBack();
}
-void ScribusDoc::restoreAddMasterPage(SimpleState *ss, bool isUndo)
+void ScribusDoc::restoreGuideLock(SimpleState* ss, bool isUndo)
+{
+ if (isUndo)
+ GuideLock = !ss->getBool("GUIDE_LOCK");
+ else
+ GuideLock = ss->getBool("GUIDE_LOCK");
+}
+
+void ScribusDoc::restoreAddMasterPage(SimpleState* ss, bool isUndo)
{
QString pageName = ss->get("MASTERPAGE_NAME");
int pageNr = ss->getInt("MASTERPAGE_NBR");
@@ -2395,10 +2398,10 @@
// scMW()->guidePalette->setupPage(false);
}
-void ScribusDoc::restoreGrouping(SimpleState *state, bool isUndo)
+void ScribusDoc::restoreGrouping(SimpleState* ss, bool isUndo)
{
double x, y, w, h;
- ScItemState<QList<QPointer<PageItem> > > *is = dynamic_cast<ScItemState<QList<QPointer<PageItem> > >*>(state);
+ ScItemState<QList<QPointer<PageItem> > > *is = dynamic_cast<ScItemState<QList<QPointer<PageItem> > >*>(ss);
QList<QPointer<PageItem> > select = is->getItem();
m_Selection->delaySignalsOn();
for (int i = 0; i < select.count(); ++i)
@@ -2859,10 +2862,10 @@
changed();
}
-void ScribusDoc::restoreSwapPage(SimpleState *state, bool isUndo)
-{
- int a = state->getInt("PAGE_SWAP_FROM");
- int b = state->getInt("PAGE_SWAP_TO");
+void ScribusDoc::restoreSwapPage(SimpleState* ss, bool isUndo)
+{
+ int a = ss->getInt("PAGE_SWAP_FROM");
+ int b = ss->getInt("PAGE_SWAP_TO");
if (isUndo)
swapPage(b,a);
@@ -2918,12 +2921,12 @@
changed();
}
-void ScribusDoc::restoreMovePage(SimpleState *state, bool isUndo)
-{
- int fromPage = state->getInt("PAGE_MOVE_FROM");
- int toPage = state->getInt("PAGE_MOVE_TO");
- int position = state->getInt("PAGE_MOVE_NEWPOS");
- int dest = state->getInt("PAGE_MOVE_DEST");
+void ScribusDoc::restoreMovePage(SimpleState* ss, bool isUndo)
+{
+ int fromPage = ss->getInt("PAGE_MOVE_FROM");
+ int toPage = ss->getInt("PAGE_MOVE_TO");
+ int position = ss->getInt("PAGE_MOVE_NEWPOS");
+ int dest = ss->getInt("PAGE_MOVE_DEST");
if (isUndo)
{
@@ -4904,11 +4907,11 @@
}
-void ScribusDoc::restoreMasterPageApplying(SimpleState *state, bool isUndo)
-{
- int pageNumber = state->getInt("PAGE_NUMBER");
- QString oldName = state->get("OLD_MASTERPAGE");
- QString newName = state->get("NEW_MASTERPAGE");
+void ScribusDoc::restoreMasterPageApplying(SimpleState* ss, bool isUndo)
+{
+ int pageNumber = ss->getInt("PAGE_NUMBER");
+ QString oldName = ss->get("OLD_MASTERPAGE");
+ QString newName = ss->get("NEW_MASTERPAGE");
if (isUndo)
applyMasterPage(oldName, pageNumber);
else
@@ -4916,10 +4919,10 @@
scMW()->pagePalette->rebuildPages();
}
-void ScribusDoc::restoreMasterPageRenaming(SimpleState *state, bool isUndo)
-{
- QString oldName = state->get("OLD_MASTERPAGE");
- QString newName = state->get("NEW_MASTERPAGE");
+void ScribusDoc::restoreMasterPageRenaming(SimpleState* ss, bool isUndo)
+{
+ QString oldName = ss->get("OLD_MASTERPAGE");
+ QString newName = ss->get("NEW_MASTERPAGE");
if (isUndo)
renameMasterPage(newName, oldName);
else
@@ -4927,12 +4930,12 @@
scMW()->pagePalette->updateMasterPageList();
}
-void ScribusDoc::restoreCopyPage(SimpleState *state, bool isUndo)
-{
- int pnum = state->getInt("PAGE_NUM");
- int extPage = state->getInt("EXISTING_PAGE");
- int whereTo = state->getInt("WHERE_TO");
- int copyCount = state->getInt("COPY_COUNT");
+void ScribusDoc::restoreCopyPage(SimpleState* ss, bool isUndo)
+{
+ int pnum = ss->getInt("PAGE_NUM");
+ int extPage = ss->getInt("EXISTING_PAGE");
+ int whereTo = ss->getInt("WHERE_TO");
+ int copyCount = ss->getInt("COPY_COUNT");
if (isUndo)
{
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20004&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Wed Apr 15 16:35:48 2015
@@ -718,22 +718,23 @@
/**
* @brief Undo function for applying a master page
*/
- void restoreMasterPageApplying(SimpleState *state, bool isUndo);
- void restoreMasterPageRenaming(SimpleState *state, bool isUndo);
- void restoreCopyPage(SimpleState *state, bool isUndo);
- void restoreMovePage(SimpleState *state, bool isUndo);
- void restoreSwapPage(SimpleState *state, bool isUndo);
- void restoreAddMasterPage(SimpleState *state, bool isUndo);
- void restoreChangePageProperties(SimpleState *state, bool isUndo);
+ void restoreMasterPageApplying(SimpleState* ss, bool isUndo);
+ void restoreMasterPageRenaming(SimpleState* ss, bool isUndo);
+ void restoreCopyPage(SimpleState* ss, bool isUndo);
+ void restoreMovePage(SimpleState* ss, bool isUndo);
+ void restoreSwapPage(SimpleState* ss, bool isUndo);
+ void restoreAddMasterPage(SimpleState* ss, bool isUndo);
+ void restoreChangePageProperties(SimpleState* ss, bool isUndo);
/**
* @brief Undo function for grouping/ungrouping
*/
- void restoreGrouping(SimpleState *state, bool isUndo);
+ void restoreGrouping(SimpleState* ss, bool isUndo);
/**
* @brief Undo function for level
*/
- void restoreLevelDown(SimpleState *state, bool isUndo);
- void restoreLevelBottom(SimpleState *state, bool isUndo);
+ void restoreLevelDown(SimpleState* ss, bool isUndo);
+ void restoreLevelBottom(SimpleState* ss, bool isUndo);
+ void restoreGuideLock(SimpleState* ss, bool isUndo);
/**
* @brief Save function
*/
Modified: trunk/Scribus/scribus/ui/guidemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20004&path=/trunk/Scribus/scribus/ui/guidemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/guidemanager.cpp (original)
+++ trunk/Scribus/scribus/ui/guidemanager.cpp Wed Apr 15 16:35:48 2015
@@ -76,43 +76,26 @@
SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(forceDrawGuides(const QItemSelection &, const QItemSelection &)));
- connect(applyToAllStdButton, SIGNAL(clicked()),
- this, SLOT(applyToAllStdButton_clicked()));
- connect(horizontalAutoCountSpin, SIGNAL(valueChanged(double)),
- this, SLOT(horizontalAutoCountSpin_valueChanged(double)));
- connect(verticalAutoCountSpin, SIGNAL(valueChanged(double)),
- this, SLOT(verticalAutoCountSpin_valueChanged(double)));
- connect(horizontalAutoGapCheck, SIGNAL(stateChanged(int)),
- this, SLOT(horizontalAutoGapCheck_stateChanged(int)));
- connect(verticalAutoGapCheck, SIGNAL(stateChanged(int)),
- this, SLOT(verticalAutoGapCheck_stateChanged(int)));
- connect(horizontalAutoGapSpin, SIGNAL(valueChanged(double)),
- this, SLOT(horizontalAutoGapSpin_valueChanged(double)));
- connect(verticalAutoGapSpin, SIGNAL(valueChanged(double)),
- this, SLOT(verticalAutoGapSpin_valueChanged(double)));
-
- connect(horizontalPageAutoButton, SIGNAL(toggled(bool)),
- this, SLOT(horizontalPageAutoButton_toggled(bool)));
- connect(horizontalMarginsAutoButton, SIGNAL(toggled(bool)),
- this, SLOT(horizontalMarginsAutoButton_toggled(bool)));
- connect(horizontalSelectionAutoButton, SIGNAL(toggled(bool)),
- this, SLOT(horizontalSelectionAutoButton_toggled(bool)));
- connect(verticalPageAutoButton, SIGNAL(toggled(bool)),
- this, SLOT(verticalPageAutoButton_toggled(bool)));
- connect(verticalMarginsAutoButton, SIGNAL(toggled(bool)),
- this, SLOT(verticalMarginsAutoButton_toggled(bool)));
- connect(verticalSelectionAutoButton, SIGNAL(toggled(bool)),
- this, SLOT(verticalSelectionAutoButton_toggled(bool)));
-
- connect(applyToAllAutoButton, SIGNAL(clicked()),
- this, SLOT(applyToAllAutoButton_clicked()));
- connect(deletePageButton, SIGNAL(clicked()),
- this, SLOT(deletePageButton_clicked()));
- connect(deleteAllGuides, SIGNAL(clicked()),
- this, SLOT(deleteAllGuides_clicked()));
-
- connect(lockCheck, SIGNAL(stateChanged(int)),
- this, SLOT(lockCheck_stateChanged(int)));
+ connect(applyToAllStdButton, SIGNAL(clicked()), this, SLOT(applyToAllStdButton_clicked()));
+ connect(horizontalAutoCountSpin, SIGNAL(valueChanged(double)), this, SLOT(horizontalAutoCountSpin_valueChanged(double)));
+ connect(verticalAutoCountSpin, SIGNAL(valueChanged(double)), this, SLOT(verticalAutoCountSpin_valueChanged(double)));
+ connect(horizontalAutoGapCheck, SIGNAL(stateChanged(int)), this, SLOT(horizontalAutoGapCheck_stateChanged(int)));
+ connect(verticalAutoGapCheck, SIGNAL(stateChanged(int)), this, SLOT(verticalAutoGapCheck_stateChanged(int)));
+ connect(horizontalAutoGapSpin, SIGNAL(valueChanged(double)), this, SLOT(horizontalAutoGapSpin_valueChanged(double)));
+ connect(verticalAutoGapSpin, SIGNAL(valueChanged(double)), this, SLOT(verticalAutoGapSpin_valueChanged(double)));
+
+ connect(horizontalPageAutoButton, SIGNAL(toggled(bool)), this, SLOT(horizontalPageAutoButton_toggled(bool)));
+ connect(horizontalMarginsAutoButton, SIGNAL(toggled(bool)), this, SLOT(horizontalMarginsAutoButton_toggled(bool)));
+ connect(horizontalSelectionAutoButton, SIGNAL(toggled(bool)), this, SLOT(horizontalSelectionAutoButton_toggled(bool)));
+ connect(verticalPageAutoButton, SIGNAL(toggled(bool)), this, SLOT(verticalPageAutoButton_toggled(bool)));
+ connect(verticalMarginsAutoButton, SIGNAL(toggled(bool)), this, SLOT(verticalMarginsAutoButton_toggled(bool)));
+ connect(verticalSelectionAutoButton, SIGNAL(toggled(bool)), this, SLOT(verticalSelectionAutoButton_toggled(bool)));
+
+ connect(applyToAllAutoButton, SIGNAL(clicked()), this, SLOT(applyToAllAutoButton_clicked()));
+ connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePageButton_clicked()));
+ connect(deleteAllGuides, SIGNAL(clicked()), this, SLOT(deleteAllGuides_clicked()));
+
+ connect(lockCheck, SIGNAL(stateChanged(int)), this, SLOT(lockCheck_stateChanged(int)));
connect(horizontalModel, SIGNAL(valueChanged()), this, SLOT(horizontalModel_valueChanged()));
connect(verticalModel, SIGNAL(valueChanged()), this, SLOT(verticalModel_valueChanged()));
@@ -490,6 +473,13 @@
return ret;
}
+void GuideManager::setGuideLock(bool guidesLocked)
+{
+ bool b=lockCheck->blockSignals(true);
+ lockCheck->setChecked(guidesLocked);
+ lockCheck->blockSignals(b);
+}
+
void GuideManager::forceDrawGuides(const QItemSelection &, const QItemSelection &)
{
drawGuides();
Modified: trunk/Scribus/scribus/ui/guidemanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20004&path=/trunk/Scribus/scribus/ui/guidemanager.h
==============================================================================
--- trunk/Scribus/scribus/ui/guidemanager.h (original)
+++ trunk/Scribus/scribus/ui/guidemanager.h Wed Apr 15 16:35:48 2015
@@ -64,7 +64,9 @@
\retval int page no */
int pageNr() const { return ((currentPage) ? currentPage->pageNr() : -1); }
- int currentIndex() { return tabWidget->currentIndex(); };
+ int currentIndex() { return tabWidget->currentIndex(); }
+
+ void setGuideLock(bool guidesLocked);
virtual void changeEvent(QEvent *e);
Modified: trunk/Scribus/scribus/ui/pageselector.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20004&path=/trunk/Scribus/scribus/ui/pageselector.h
==============================================================================
--- trunk/Scribus/scribus/ui/pageselector.h (original)
+++ trunk/Scribus/scribus/ui/pageselector.h Wed Apr 15 16:35:48 2015
@@ -36,11 +36,6 @@
void setFont ( const QFont & );
int getCurrentPage();
- QPushButton* startButton;
- QPushButton* backButton;
- QPushButton* forwardButton;
- QPushButton* lastButton;
-
public slots:
virtual void setGUIForPage(int i);
virtual void setMaximum(int i);
@@ -56,14 +51,17 @@
virtual void goForward();
protected:
+ QPushButton* startButton;
+ QPushButton* backButton;
+ QPushButton* forwardButton;
+ QPushButton* lastButton;
QHBoxLayout *PageSelectorLayout;
QLabel *pageCountLabel;
QString PageCountString;
+ QComboBox *m_pageCombo;
+ QIntValidator *m_validator;
int m_lastPage;
int m_currentPage;
-
- QComboBox *m_pageCombo;
- QIntValidator *m_validator;
signals:
void GotoPage(int);
More information about the scribus-commit
mailing list