# HG changeset patch # User Chris Cannam # Date 1374663721 -3600 # Node ID 110eecb5d9f6dfcb6dafb86c6e3162f5597f899d # Parent e37154e52d8946164c846e15e614d0141d67e40f Reset cyclical counters when document is replaced (#182) diff -r e37154e52d89 -r 110eecb5d9f6 .hgsubstate --- a/.hgsubstate Wed Jul 24 11:43:09 2013 +0100 +++ b/.hgsubstate Wed Jul 24 12:02:01 2013 +0100 @@ -1,4 +1,4 @@ 7096c7de2d4c327de5e028c33036f146a1884706 dataquay 2925a4bbca5e86036d564aaac1bcf7fd11226ca9 svapp -420ade1cb6da314a5717637d902238b713ebc4b0 svcore +2f85f0fbf7ab6d67b7c8f79456c76106a0db4785 svcore 0aea4b9e4c3dca9c42f9181748bdfde924a8574f svgui diff -r e37154e52d89 -r 110eecb5d9f6 main/MainWindow.cpp --- a/main/MainWindow.cpp Wed Jul 24 11:43:09 2013 +0100 +++ b/main/MainWindow.cpp Wed Jul 24 12:02:01 2013 +0100 @@ -775,9 +775,15 @@ } } + action = new QAction(tr("Reset Numbering Counters"), this); + action->setStatusTip(tr("Reset to 1 all the counters used for counter-based labelling")); + connect(action, SIGNAL(triggered()), this, SLOT(resetInstantsCounters())); + connect(this, SIGNAL(replacedDocument()), action, SLOT(trigger())); + menu->addAction(action); + action = new QAction(tr("Set Numbering Counters..."), this); action->setStatusTip(tr("Set the counters used for counter-based labelling")); - connect(action, SIGNAL(triggered()), this, SLOT(resetInstantsCounters())); + connect(action, SIGNAL(triggered()), this, SLOT(setInstantsCounters())); menu->addAction(action); action = new QAction(tr("Renumber Selected Instants"), this); @@ -4049,7 +4055,7 @@ } void -MainWindow::resetInstantsCounters() +MainWindow::setInstantsCounters() { LabelCounterInputDialog dialog(m_labeller, this); dialog.setWindowTitle(tr("Reset Counters")); @@ -4057,6 +4063,12 @@ } void +MainWindow::resetInstantsCounters() +{ + if (m_labeller) m_labeller->resetCounters(); +} + +void MainWindow::modelGenerationFailed(QString transformName, QString message) { emit hideSplash(); diff -r e37154e52d89 -r 110eecb5d9f6 main/MainWindow.h --- a/main/MainWindow.h Wed Jul 24 11:43:09 2013 +0100 +++ b/main/MainWindow.h Wed Jul 24 12:02:01 2013 +0100 @@ -121,6 +121,7 @@ virtual void setInstantsNumbering(); virtual void setInstantsCounterCycle(); + virtual void setInstantsCounters(); virtual void resetInstantsCounters(); virtual void modelGenerationFailed(QString, QString);