Merge pull request #883 from manongjohn/autorenumber_column
Autorenumber column
This commit is contained in:
commit
f877ebbba2
5 changed files with 35 additions and 0 deletions
|
@ -433,6 +433,9 @@ class RenumberUndo::RedoNotifier final : public TUndo {
|
|||
}
|
||||
|
||||
int getSize() const override { return sizeof(*this); }
|
||||
|
||||
QString getHistoryString() override { return QObject::tr("Autorenumber"); }
|
||||
int getHistoryType() override { return HistoryType::Xsheet; }
|
||||
};
|
||||
|
||||
class RenumberUndo::UndoNotifier final : public TUndo {
|
||||
|
@ -443,6 +446,9 @@ class RenumberUndo::UndoNotifier final : public TUndo {
|
|||
}
|
||||
|
||||
int getSize() const override { return sizeof(*this); }
|
||||
|
||||
QString getHistoryString() override { return QObject::tr("Autorenumber"); }
|
||||
int getHistoryType() override { return HistoryType::Xsheet; }
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
@ -805,6 +805,31 @@ void TColumnSelection::reframeWithEmptyInbetweens() {
|
|||
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void TColumnSelection::renumberColumns() {
|
||||
if (isEmpty()) return;
|
||||
|
||||
int rowCount =
|
||||
TApp::instance()->getCurrentXsheet()->getXsheet()->getFrameCount();
|
||||
std::vector<int> colIndeces;
|
||||
std::set<int>::const_iterator it;
|
||||
|
||||
TUndoManager *undoManager = TUndoManager::manager();
|
||||
undoManager->beginBlock();
|
||||
|
||||
for (it = m_indices.begin(); it != m_indices.end(); it++) {
|
||||
TCellSelection selection;
|
||||
selection.selectCells(0, *it, rowCount, *it);
|
||||
selection.dRenumberCells();
|
||||
}
|
||||
|
||||
undoManager->endBlock();
|
||||
|
||||
TApp::instance()->getCurrentScene()->setDirtyFlag(true);
|
||||
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
|
||||
}
|
||||
|
||||
//*********************************************************************************
|
||||
// Reset Step Cells command
|
||||
//*********************************************************************************
|
||||
|
|
|
@ -94,6 +94,7 @@ void TColumnSelection::enableCommands() {
|
|||
enableCommand(this, MI_Reframe4, &TColumnSelection::reframe4Cells);
|
||||
enableCommand(this, MI_ReframeWithEmptyInbetweens,
|
||||
&TColumnSelection::reframeWithEmptyInbetweens);
|
||||
enableCommand(this, MI_Autorenumber, &TColumnSelection::renumberColumns);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
void reframe4Cells() { reframeCells(4); }
|
||||
|
||||
void reframeWithEmptyInbetweens();
|
||||
|
||||
void renumberColumns();
|
||||
};
|
||||
|
||||
#endif // TCELLSELECTION_H
|
||||
|
|
|
@ -2919,6 +2919,7 @@ void ColumnArea::contextMenuEvent(QContextMenuEvent *event) {
|
|||
}
|
||||
menu.addMenu(reframeSubMenu);
|
||||
menu.addAction(cmdManager->getAction(MI_AutoInputCellNumber));
|
||||
menu.addAction(cmdManager->getAction(MI_Autorenumber));
|
||||
}
|
||||
|
||||
if (containsRasterLevel(m_viewer->getColumnSelection())) {
|
||||
|
|
Loading…
Reference in a new issue