Clarify some endblock undo info (#260)

This commit is contained in:
Jeremy Bullock 2020-09-30 22:51:23 -06:00 committed by GitHub
parent a3a2579f08
commit 6125029b08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 7 deletions

View file

@ -328,7 +328,7 @@ void SkeletonTool::leftButtonDown(const TPointD &ppos, const TMouseEvent &e) {
m_otherColumnBBoxAff = TAffine();
m_labelPos = TPointD(0, 0);
m_label = "";
// This undo block ends in leftButtonUp
TUndoManager::manager()->beginBlock();
if (!doesApply()) return;

View file

@ -3115,7 +3115,7 @@ static void createNewDrawing(TXsheet *xsh, int row, int col,
const Type *Var = dynamic_cast<const Type *>(Data)
void TCellSelection::dPasteCells() {
if (isEmpty()) // Se la selezione delle celle e' vuota ritorno.
if (isEmpty())
return;
int r0, c0, r1, c1;
getSelectedCells(r0, c0, r1, c1);
@ -3124,7 +3124,10 @@ void TCellSelection::dPasteCells() {
QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();
if (DYNAMIC_CAST(TCellData, cellData, mimeData)) {
if (!cellData->canChange(xsh, c0)) return;
if (!cellData->canChange(xsh, c0)) {
TUndoManager::manager()->endBlock();
return;
}
for (int c = 0; c < cellData->getColCount(); c++) {
for (int r = 0; r < cellData->getRowCount(); r++) {
TXshCell src = cellData->getCell(r, c);

View file

@ -106,6 +106,7 @@ MovePointDragTool::MovePointDragTool(FunctionPanel *panel, TDoubleParam *curve)
, m_speed1Index(-1)
, m_groupEnabled(false)
, m_selection(0) {
// This undo block is closed in the destructor
TUndoManager::manager()->beginBlock();
if (curve) {

View file

@ -258,8 +258,11 @@ bool FxSelection::insertPasteSelection() {
fxsData->getFxs(fxs, zeraryFxColumnSize, columns);
if (fxs.empty() && columns.empty()) return true;
if (!auto_.m_destruct)
auto_.m_destruct = true, TUndoManager::manager()->beginBlock();
// auto ends the undo block in the destructor.
if (!auto_.m_destruct) {
auto_.m_destruct = true;
TUndoManager::manager()->beginBlock();
}
TFxCommand::insertPasteFxs(selectedLinks[i], fxs.toStdList(),
zeraryFxColumnSize.toStdMap(),
@ -300,6 +303,7 @@ bool FxSelection::addPasteSelection() {
fxsData->getFxs(fxs, zeraryFxColumnSize, columns);
if (fxs.empty() && columns.empty()) return true;
// auto ends the undo block in its destructor
if (!auto_.m_destruct)
auto_.m_destruct = true, TUndoManager::manager()->beginBlock();
@ -343,6 +347,7 @@ bool FxSelection::replacePasteSelection() {
fxsData->getFxs(fxs, zeraryFxColumnSize, columns);
if (fxs.empty() && columns.empty()) return true;
// auto ends the undo block in its destructor
if (!auto_.m_destruct)
auto_.m_destruct = true, TUndoManager::manager()->beginBlock();
@ -377,8 +382,9 @@ void FxSelection::ungroupSelection() {
TUndoManager::manager()->beginBlock();
QSet<int>::iterator it;
for (it = idSet.begin(); it != idSet.end(); it++)
TFxCommand::ungroupFxs(*it, m_xshHandle);
for (it = idSet.begin(); it != idSet.end(); it++) {
TFxCommand::ungroupFxs(*it, m_xshHandle);
}
TUndoManager::manager()->endBlock();
selectNone();
m_xshHandle->notifyXsheetChanged();