Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New undo/redo implementation #953

Closed
wants to merge 116 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
aee9c6a
Add new undo/redo implementation
MrStevns Apr 22, 2018
751143c
Merge branch 'master' into undo-redo-rewrite
candyface May 7, 2018
6c35536
Merge branch 'master' into undo-redo-rewrite
candyface Jun 11, 2018
7c3d540
Merge remote-tracking branch 'remotes/upstream/master' into undo-redo…
chchwy Jun 14, 2018
f2867d3
Fix compiler errors
chchwy Jun 14, 2018
1309f08
Merge pull request #6 from chchwy/undo-redo-rewrite
candyface Jun 14, 2018
b78c268
Remove commented code
MrStevns Aug 4, 2018
1b3e537
Merge branch 'master' into undo-redo-rewrite
MrStevns Sep 30, 2018
578f7a5
No isSequence anymore, use keyspacing
MrStevns Sep 30, 2018
f88d51a
Fix compiler errors and add history to ui
MrStevns Sep 30, 2018
4838911
Add Selection undo/redo WIP
MrStevns Oct 11, 2018
34d40b7
Rework bitmap and transform elements
MrStevns Oct 21, 2018
0c1b77e
Carefully merge master into undo-redo-rewrite
MrStevns Nov 3, 2018
57ef759
Merge branch 'master' into undo-redo-rewrite again...
MrStevns Nov 3, 2018
b6c6d82
Apply better naming for saving undo state
MrStevns Nov 3, 2018
3e86718
Refactor selectionElement
MrStevns Nov 3, 2018
2cec951
Add backup to keypress transformations
MrStevns Nov 3, 2018
6dff566
Fix clear selection not working
MrStevns Nov 4, 2018
88d23ba
Import bitmap should have its own QUndoCommand
MrStevns Nov 11, 2018
a8c2bc5
Refactor backupelements
MrStevns Nov 11, 2018
7798516
Fix compiler error
MrStevns Nov 11, 2018
01cb743
Fix compiler warnings
MrStevns Nov 24, 2018
7fd65e2
Refactor header and fix comment typo
MrStevns Nov 24, 2018
1a038ce
tr() takes string literal as parameters, not string variables
chchwy Nov 30, 2018
5b1358c
Merge pull request #7 from chchwy/undo-redo-rewrite
candyface Dec 1, 2018
4ebef23
Merge branch 'master' into undo-redo-rewrite
candyface Dec 9, 2018
ab978ba
Merge branch 'master' into undo-redo-rewrite
candyface Dec 14, 2018
2555a73
Begin unit testing
MrStevns Nov 24, 2018
cc92e35
Fix compiler error.
MrStevns Dec 20, 2018
d306ea7
Merge branch 'master' into undo-redo-rewrite
MrStevns Dec 20, 2018
2b86cfa
Fix bitmap bug when drawing on previous frame
MrStevns Jan 13, 2019
7c4e5fb
Remove redundant code...
MrStevns Jan 13, 2019
9d30e71
Fix various bugs related to previous drawing action
MrStevns Jan 18, 2019
d4ed5a7
Refactor BackupManager::restoreLayerKeys
MrStevns Jan 22, 2019
c4feb62
NewFoo are not needed for DeleteLayerElement, as we delete by id
MrStevns Jan 22, 2019
e856de1
RemoveKeyFrame should always undo/redo from oldFoo
MrStevns Jan 22, 2019
76cdc39
AddKeyFrameElement, Refactor and optimize
MrStevns Jan 22, 2019
be2272d
Fix bug where index is >= to lastLayerIndex..
MrStevns Jan 22, 2019
9fe396f
AddKeyFrameElement related, remove unnecessary emit.
MrStevns Jan 23, 2019
96f3241
Fix camera transformation being incorrect when reapplied.
MrStevns Jan 23, 2019
87c8f44
Merge branch 'master' into undo-redo-rewrite
MrStevns Feb 12, 2019
594baef
Merge branch 'master' into undo-redo-rewrite
MrStevns Apr 20, 2019
a52f8cf
Fix compiler errors that occured in merge conflict
MrStevns Apr 20, 2019
9f5379e
Merge branch 'master' into undo-redo-rewrite
MrStevns Jun 30, 2019
7a8c732
Refactor and make const if possible
MrStevns Jun 30, 2019
3a432aa
Refactor backupelement and make params const if possible
MrStevns Jul 2, 2019
8e6a30a
Reposition class methods to correspond to position in header
MrStevns Jul 2, 2019
59db340
Remove scribblearea from Backupmanager
MrStevns Jul 2, 2019
60ea27d
Refactor canvaspainter out of scribblearea
MrStevns Jul 2, 2019
5b2f945
Add deselect backup when outside selection area
MrStevns Jul 3, 2019
bb456fd
Simplify selectionElement
MrStevns Jul 3, 2019
8058d96
Simplify delete selection backup
MrStevns Jul 3, 2019
f8ef7f4
Remove scribblearea from TransformElement and SelectionElement
MrStevns Jul 3, 2019
eaf4846
Refactor addBitmapElement and addVectorElement
MrStevns Jul 3, 2019
169b026
Remove unused header
MrStevns Jul 3, 2019
6d0c8db
Merge branch 'master' into undo-redo-rewrite
candyface Jul 4, 2019
18f1638
Update frame after importing images
MrStevns Jul 4, 2019
6440350
Merge branch 'master' into undo-redo-rewrite
candyface Aug 5, 2019
a5b57cd
Fix bug: duplicate key undo removes wrong keyframe
MrStevns Aug 8, 2019
744bb5c
Improve undo/redo descriptions
MrStevns Aug 8, 2019
c10d24d
Fix restoring camera key would crash with malloc
MrStevns Aug 9, 2019
11af1c3
Apply motion backup on scrolling
MrStevns Aug 9, 2019
7592f32
Fix undo-redo sound keyframe replacing if overlapped
MrStevns Aug 9, 2019
10db303
Fix vector transformation when moving selection
MrStevns Aug 9, 2019
f313390
Fix MoveLayerBackup: Move essential layer swap code to editor
MrStevns Aug 15, 2019
17df292
MoveFrameBackup related: save state earlier..
MrStevns Aug 15, 2019
8e8d221
Fix drawing on empty frame would create a backup even if previous fra…
MrStevns Aug 15, 2019
04e7fb3
Fix vector selection going out of sync
MrStevns Aug 17, 2019
c4705ce
Fix deselection backup being made when there's no selection...
MrStevns Aug 17, 2019
cf7c1d3
MoveTool: fix backups being made unnecessarily
MrStevns Aug 18, 2019
11945ed
Fix transformed image not being applied correctly when selection is u…
MrStevns Aug 18, 2019
bdf5823
SelectTool: Fix potential selection pixel offset for bitmap
MrStevns Aug 18, 2019
7fabfc0
SelectTool: fix no deselect backup being made when creating a selecti…
MrStevns Aug 18, 2019
e8bc894
TransformElement: backup selection flip
MrStevns Aug 21, 2019
2ca81d4
Editor: Revert scrub to previous keyframe
MrStevns Aug 21, 2019
46fb960
Merge branch 'master' into undo-redo-rewrite
candyface Aug 25, 2019
4cc2bf5
Fix compiler error from bad merge
MrStevns Aug 25, 2019
9773d10
Fix camera motion not working properly unless you stood on the correc…
MrStevns Aug 26, 2019
ff6a9a8
Fix selection scaling not working after flip backup implementation
MrStevns Aug 26, 2019
c4c6555
Backup select all and deselect all actions
MrStevns Aug 26, 2019
28ea288
Avoid creating deselect backup unless something is selected.
MrStevns Aug 26, 2019
4247dc4
Fix camera motion zoom backup only working through scroll on mac
MrStevns Aug 26, 2019
de977df
Implement camera motion backup for view actions
MrStevns Aug 26, 2019
a3780c2
Fix camera motion undo action not moving to frame.
MrStevns Aug 26, 2019
c7af12c
Fix camera size not backed up properly
MrStevns Aug 27, 2019
4eea635
Fix selectionelement not backing up vector curves
MrStevns Aug 27, 2019
b827b0d
Rework: remove keyframe act as clear frame when there's only one frame
MrStevns Aug 27, 2019
6876eba
Fix wrong frame being deleted with duplicate previous key action
MrStevns Aug 27, 2019
89d2501
Fix bucket tool backup on vector layer if there's no change.
MrStevns Aug 27, 2019
7661103
Fix scale issue when performing multiple flip selections
MrStevns Aug 28, 2019
5c34c63
Fix problems related to having only one keyframe available on a layer
MrStevns Aug 28, 2019
223d72f
Vector and BitmapElement: make sure correct layer is selected.
MrStevns Aug 28, 2019
d40472d
Fix two cases that could crash program
MrStevns Aug 28, 2019
2d22ed1
Keyframe add/remove: scrub to correct layer
MrStevns Aug 28, 2019
2ee6307
Fix crash when attempting to backup keyframe that is null.
MrStevns Aug 28, 2019
33355ae
EraserTool: fix erased strokes not being backed up properly
MrStevns Aug 28, 2019
3f916d1
Fix bitmap and vector selection behaviours
MrStevns Aug 29, 2019
94bd80c
Fix selectAll not re-selecting all vector strokes
MrStevns Aug 29, 2019
2902a9a
Fix vector stroke selection would always select all strokes.
MrStevns Aug 29, 2019
cb6c220
Implement ability to undo/redo frame selections and non selected fram…
MrStevns Sep 7, 2019
a2dd983
Fix move frame in actioncommands undo/redo would scrub one behind frame
MrStevns Sep 7, 2019
e6d600d
Timelinecells: allow dragging selected frames when selecting on scrub…
MrStevns Sep 7, 2019
356479c
Fix selecting another layer would trigger deselect backup when empty
MrStevns Sep 7, 2019
9e6e5a2
Erasertool: only save on press otherwise might save wrong state
MrStevns Sep 7, 2019
df79035
EraserTool: don't backup vector unless a point is deleted
MrStevns Sep 7, 2019
6a4163b
Fix smudge making backup when not transformed
MrStevns Sep 9, 2019
adca2b2
Tweak duplicate key behavior backup description
MrStevns Sep 9, 2019
af00d79
Fix crash with transform element because pointer was presumably freed
MrStevns Sep 10, 2019
2dc3c4e
Cut backup: Fix another crash related to transformations
MrStevns Sep 10, 2019
0e6b76c
ImportImageElement: always merge
MrStevns Sep 11, 2019
0059bd9
ImportBitmapElement: optimize undo/redo actions
MrStevns Sep 11, 2019
11b656e
Fix vector transform acting up in certain cases:
MrStevns Sep 14, 2019
bfeed49
Fix frame deselecting when moved but mouse isn't on pos
MrStevns Sep 14, 2019
16b660a
Timelinecells: Fix backup not always triggered when selecting and mov…
MrStevns Sep 15, 2019
61ee83c
Simplify timeline move frame backup, revert back to no select frame e…
MrStevns Sep 29, 2019
9021a5c
Fix canvas not being updated after moving frame
MrStevns Sep 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 197 additions & 24 deletions app/src/actioncommands.cpp

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion app/src/actioncommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class ActionCommands : public QObject
// view
void ZoomIn();
void ZoomOut();
void zoomTo(const float value);
void resetView();
void rotateClockwise();
void rotateCounterClockwise();
void toggleMirror();
Expand All @@ -63,18 +65,20 @@ class ActionCommands : public QObject
void GotoPrevFrame();
void GotoNextKeyFrame();
void GotoPrevKeyFrame();
Status addNewKey();
void removeKey();
void duplicateKey();
void moveFrameForward();
void moveFrameBackward();

Status addNewKey();

// Layer
Status addNewBitmapLayer();
Status addNewVectorLayer();
Status addNewCameraLayer();
Status addNewSoundLayer();
Status deleteCurrentLayer();
void editCameraProperties();
QString nameSuggest(QString s);

// Help
Expand Down
26 changes: 26 additions & 0 deletions app/src/displayoptionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ GNU General Public License for more details.
#include <QGridLayout>

#include "preferencemanager.h"
#include "backupmanager.h"
#include "viewmanager.h"
#include "scribblearea.h"

#include "editor.h"
#include "util.h"
#include "direction.h"


DisplayOptionWidget::DisplayOptionWidget(QWidget *parent) :
Expand Down Expand Up @@ -108,34 +111,57 @@ void DisplayOptionWidget::updateUI()

void DisplayOptionWidget::onionPrevButtonClicked(bool isOn)
{
// BackupManager* backup = editor()->backups();

PreferenceManager* prefs = editor()->preference();
prefs->set(SETTING::PREV_ONION, isOn);

// backup->toggleSetting(isOn, SETTING::PREV_ONION);

}

void DisplayOptionWidget::onionNextButtonClicked(bool isOn)
{
// BackupManager* backup = editor()->backups();

PreferenceManager* prefs = editor()->preference();
prefs->set(SETTING::NEXT_ONION, isOn);

// backup->toggleSetting(isOn, SETTING::NEXT_ONION);
}

void DisplayOptionWidget::onionBlueButtonClicked(bool isOn)
{
// BackupManager* backup = editor()->backups();

PreferenceManager* prefs = editor()->preference();
prefs->set(SETTING::ONION_BLUE, isOn);

// backup->toggleSetting(isOn, SETTING::ONION_BLUE);
}

void DisplayOptionWidget::onionRedButtonClicked(bool isOn)
{
// BackupManager* backup = editor()->backups();

PreferenceManager* prefs = editor()->preference();
prefs->set(SETTING::ONION_RED, isOn);

// backup->toggleSetting(isOn, SETTING::ONION_RED);
}

void DisplayOptionWidget::toggleMirror(bool isOn)
{
// BackupManager* backup = editor()->backups();
editor()->view()->flipHorizontal(isOn);

// backup->flipView(isOn, DIRECTION::HORIZONTAL);
}

void DisplayOptionWidget::toggleMirrorV(bool isOn)
{
// BackupManager* backup = editor()->backups();
editor()->view()->flipVertical(isOn);

// backup->flipView(isOn, DIRECTION::VERTICAL);
}
115 changes: 63 additions & 52 deletions app/src/mainwindow2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ GNU General Public License for more details.
#include <QList>
#include <QMenu>
#include <QFile>
#include <QDir>
#include <QMessageBox>
#include <QProgressDialog>
#include <QTabletEvent>
#include <QStandardPaths>
#include <QDateTime>

// core_lib headers
#include "pencildef.h"
Expand All @@ -39,6 +42,11 @@ GNU General Public License for more details.
#include "filemanager.h"
#include "colormanager.h"
#include "layermanager.h"

#include "backupmanager.h"
#include "historyviewerwidget.h"
#include "layercamera.h"

#include "toolmanager.h"
#include "playbackmanager.h"
#include "soundmanager.h"
Expand Down Expand Up @@ -112,6 +120,23 @@ MainWindow2::MainWindow2(QWidget *parent) :
mCommands = new ActionCommands(this);
mCommands->setCore(mEditor);

ui->menuEdit->removeAction(ui->actionUndo);
ui->menuEdit->removeAction(ui->actionRedo);

QIcon undoIcon;
undoIcon.addFile(QStringLiteral(":/icons/undo.png"), QSize(), QIcon::Normal, QIcon::Off);
ui->actionUndo = mEditor->backups()->undoStack()->createUndoAction(this, tr("&Undo"));
ui->actionUndo->setIcon(undoIcon);

QIcon redoIcon;
redoIcon.addFile(QStringLiteral(":/icons/redo.png"), QSize(), QIcon::Normal, QIcon::Off);
ui->actionRedo = mEditor->backups()->undoStack()->createRedoAction(this, tr("&Redo"));
ui->actionRedo->setIcon(redoIcon);

ui->menuEdit->insertAction(ui->actionCut, ui->actionUndo);
ui->menuEdit->insertAction(ui->actionCut, ui->actionRedo);
ui->menuEdit->insertSeparator(ui->actionCut);

createDockWidgets();
createMenus();
setupKeyboardShortcuts();
Expand Down Expand Up @@ -159,6 +184,9 @@ void MainWindow2::createDockWidgets()
mToolBox = new ToolBoxWidget(this);
mToolBox->setObjectName("ToolBox");

mHistoryView = new HistoryViewerWidget(this);
mHistoryView->setObjectName("History");

/*
mTimeline2 = new Timeline2;
mTimeline2->setObjectName( "Timeline2" );
Expand All @@ -172,7 +200,8 @@ void MainWindow2::createDockWidgets()
<< mColorPalette
<< mDisplayOptionWidget
<< mToolOptions
<< mToolBox;
<< mToolBox
<< mHistoryView;

mStartIcon = QIcon(":icons/controls/play.png");
mStopIcon = QIcon(":icons/controls/stop.png");
Expand All @@ -196,6 +225,7 @@ void MainWindow2::createDockWidgets()
addDockWidget(Qt::LeftDockWidgetArea, mToolOptions);
addDockWidget(Qt::LeftDockWidgetArea, mDisplayOptionWidget);
addDockWidget(Qt::BottomDockWidgetArea, mTimeLine);
addDockWidget(Qt::RightDockWidgetArea, mHistoryView);
setDockNestingEnabled(true);

/*
Expand Down Expand Up @@ -249,9 +279,7 @@ void MainWindow2::createMenus()
connect(ui->actionImport_Sound, &QAction::triggered, mCommands, &ActionCommands::importSound);
connect(ui->actionImport_Palette, &QAction::triggered, this, &MainWindow2::importPalette);

//--- Edit Menu ---
connect(ui->actionUndo, &QAction::triggered, mEditor, &Editor::undo);
connect(ui->actionRedo, &QAction::triggered, mEditor, &Editor::redo);
/// --- Edit Menu ---
connect(ui->actionCut, &QAction::triggered, mEditor, &Editor::cut);
connect(ui->actionCopy, &QAction::triggered, mEditor, &Editor::copy);
connect(ui->actionPaste, &QAction::triggered, mEditor, &Editor::paste);
Expand All @@ -275,14 +303,14 @@ void MainWindow2::createMenus()
connect(ui->actionZoom_Out, &QAction::triggered, mCommands, &ActionCommands::ZoomOut);
connect(ui->actionRotate_Clockwise, &QAction::triggered, mCommands, &ActionCommands::rotateClockwise);
connect(ui->actionRotate_Anticlockwise, &QAction::triggered, mCommands, &ActionCommands::rotateCounterClockwise);
connect(ui->actionReset_View, &QAction::triggered, mEditor->view(), &ViewManager::resetView);
connect(ui->actionZoom400, &QAction::triggered, mEditor->view(), &ViewManager::scale400);
connect(ui->actionZoom300, &QAction::triggered, mEditor->view(), &ViewManager::scale300);
connect(ui->actionZoom200, &QAction::triggered, mEditor->view(), &ViewManager::scale200);
connect(ui->actionZoom100, &QAction::triggered, mEditor->view(), &ViewManager::scale100);
connect(ui->actionZoom50, &QAction::triggered, mEditor->view(), &ViewManager::scale50);
connect(ui->actionZoom33, &QAction::triggered, mEditor->view(), &ViewManager::scale33);
connect(ui->actionZoom25, &QAction::triggered, mEditor->view(), &ViewManager::scale25);
connect(ui->actionReset_View, &QAction::triggered, mCommands, &ActionCommands::resetView);
connect(ui->actionZoom400, &QAction::triggered, this, [this]{ mCommands->zoomTo(4); });
connect(ui->actionZoom300, &QAction::triggered, this, [this]{ mCommands->zoomTo(3); });
connect(ui->actionZoom200, &QAction::triggered, this, [this]{ mCommands->zoomTo(2); });
connect(ui->actionZoom100, &QAction::triggered, this, [this]{ mCommands->zoomTo(1); });
connect(ui->actionZoom50, &QAction::triggered, this, [this]{ mCommands->zoomTo(0.5f); });
connect(ui->actionZoom33, &QAction::triggered, this, [this]{ mCommands->zoomTo(0.33f); });
connect(ui->actionZoom25, &QAction::triggered, this, [this]{ mCommands->zoomTo(0.25f); });
connect(ui->actionHorizontal_Flip, &QAction::triggered, mCommands, &ActionCommands::toggleMirror);
connect(ui->actionVertical_Flip, &QAction::triggered, mCommands, &ActionCommands::toggleMirrorV);

Expand Down Expand Up @@ -346,7 +374,8 @@ void MainWindow2::createMenus()
mColorPalette->toggleViewAction(),
mTimeLine->toggleViewAction(),
mDisplayOptionWidget->toggleViewAction(),
mColorInspector->toggleViewAction()
mColorInspector->toggleViewAction(),
mHistoryView->toggleViewAction()
};

for (QAction* action : actions)
Expand Down Expand Up @@ -382,7 +411,6 @@ void MainWindow2::createMenus()

connect(mRecentFileMenu, &RecentFileMenu::loadRecentFile, this, &MainWindow2::openFile);

connect(ui->menuEdit, &QMenu::aboutToShow, this, &MainWindow2::undoActSetText);
connect(ui->menuEdit, &QMenu::aboutToHide, this, &MainWindow2::undoActSetEnabled);
}

Expand All @@ -400,7 +428,9 @@ void MainWindow2::setOpacity(int opacity)

void MainWindow2::updateSaveState()
{
setWindowModified(mEditor->currentBackup() != mBackupAtSave);
bool hasBeenModified = mEditor->backups()->currentBackup() != mBackupAtSave;

setWindowModified(hasBeenModified);
}

void MainWindow2::clearRecentFilesList()
Expand Down Expand Up @@ -483,6 +513,9 @@ void MainWindow2::newDocument(bool force)
mColorPalette->refreshColorList();
mEditor->color()->setColorNumber(0);

// clear backup stack
mEditor->backups()->undoStack()->clear();

setWindowTitle(PENCIL_WINDOW_TITLE);
updateSaveState();
}
Expand Down Expand Up @@ -640,6 +673,9 @@ bool MainWindow2::openObject(QString strFilePath, bool checkForChanges)
mColorPalette->refreshColorList();
mEditor->layers()->notifyAnimationLengthChanged();

// clear backup stack
mEditor->backups()->undoStack()->clear();

progress.setValue(progress.maximum());

updateSaveState();
Expand Down Expand Up @@ -706,13 +742,11 @@ bool MainWindow2::saveObject(QString strSavedFileName)
mTimeLine->updateContent();

setWindowTitle(strSavedFileName.prepend("[*]"));
mBackupAtSave = mEditor->currentBackup();
mBackupAtSave = mEditor->backups()->currentBackup();
updateSaveState();

progress.setValue(progress.maximum());

mEditor->resetAutoSaveCounter();

return true;
}

Expand All @@ -726,7 +760,7 @@ bool MainWindow2::saveDocument()

bool MainWindow2::maybeSave()
{
if (mEditor->currentBackup() != mBackupAtSave)
if (mEditor->backups()->currentBackup() != mBackupAtSave)
{
int ret = QMessageBox::warning(this, tr("Warning"),
tr("This animation has been modified.\n Do you want to save your changes?"),
Expand Down Expand Up @@ -783,7 +817,8 @@ void MainWindow2::importImage()
if (strFilePath.isEmpty()) { return; }
if (!QFile::exists(strFilePath)) { return; }

bool ok = mEditor->importImage(strFilePath);
bool isSequence = false;
bool ok = mEditor->importImage(strFilePath, isSequence);
if (!ok)
{
QMessageBox::warning(this,
Expand Down Expand Up @@ -838,7 +873,7 @@ void MainWindow2::importImageSequence()
strImgFileLower.endsWith(".tif") ||
strImgFileLower.endsWith(".tiff"))
{
mEditor->importImage(strImgFile);
mEditor->importImage(strImgFile, mIsImportingImageSequence);

imagesImportedSoFar++;
progress.setValue(imagesImportedSoFar);
Expand Down Expand Up @@ -961,10 +996,11 @@ void MainWindow2::addLayerByFilename(QString strFilePath)
Q_ASSERT(layer != nullptr);
LayerManager* lMgr = mEditor->layers();
lMgr->setCurrentLayer(layer);
bool isSequence = true;
for (int i = 0; i < finalList.size(); i++)
{
mEditor->scrubTo(finalList[i].mid(dot - digits, digits).toInt());
bool ok = mEditor->importImage(path + finalList[i]);
bool ok = mEditor->importImage(path + finalList[i], isSequence);
if (!ok) { return;}
layer->addNewKeyFrameAt(finalList[i].mid(dot - digits, digits).toInt());
}
Expand Down Expand Up @@ -1238,35 +1274,6 @@ void MainWindow2::clearKeyboardShortcuts()
}
}

void MainWindow2::undoActSetText()
{
if (mEditor->mBackupIndex < 0)
{
ui->actionUndo->setText(tr("Undo", "Menu item text"));
ui->actionUndo->setEnabled(false);
}
else
{
ui->actionUndo->setText(QString("%1 %2 %3").arg(tr("Undo", "Menu item text"))
.arg(QString::number(mEditor->mBackupIndex + 1))
.arg(mEditor->mBackupList.at(mEditor->mBackupIndex)->undoText));
ui->actionUndo->setEnabled(true);
}

if (mEditor->mBackupIndex + 2 < mEditor->mBackupList.size())
{
ui->actionRedo->setText(QString("%1 %2 %3").arg(tr("Redo", "Menu item text"))
.arg(QString::number(mEditor->mBackupIndex + 2))
.arg(mEditor->mBackupList.at(mEditor->mBackupIndex + 1)->undoText));
ui->actionRedo->setEnabled(true);
}
else
{
ui->actionRedo->setText(tr("Redo", "Menu item text"));
ui->actionRedo->setEnabled(false);
}
}

void MainWindow2::undoActSetEnabled()
{
ui->actionUndo->setEnabled(true);
Expand Down Expand Up @@ -1297,7 +1304,7 @@ void MainWindow2::importPalette()

void MainWindow2::makeConnections(Editor* editor)
{
connect(editor, &Editor::updateBackup, this, &MainWindow2::updateSaveState);
connect(editor->backups(), &BackupManager::updateBackup, this, &MainWindow2::updateSaveState);
connect(editor, &Editor::needDisplayInfo, this, &MainWindow2::displayMessageBox);
connect(editor, &Editor::needDisplayInfoNoTitle, this, &MainWindow2::displayMessageBoxNoTitle);
}
Expand All @@ -1322,6 +1329,8 @@ void MainWindow2::makeConnections(Editor* editor, ScribbleArea* scribbleArea)
connect(editor->layers(), &LayerManager::layerDeleted, scribbleArea, &ScribbleArea::updateAllFrames);

connect(editor, &Editor::currentFrameChanged, scribbleArea, &ScribbleArea::updateFrame);
// connect(editor, &Editor::deselectAll, scribbleArea, &ScribbleArea::deselectAll);
// connect(editor, &Editor::selectAll, scribbleArea, &ScribbleArea::selectAll);

connect(editor->view(), &ViewManager::viewChanged, scribbleArea, &ScribbleArea::updateAllFrames);
//connect( editor->preference(), &PreferenceManager::preferenceChanged, scribbleArea, &ScribbleArea::onPreferencedChanged );
Expand All @@ -1342,6 +1351,8 @@ void MainWindow2::makeConnections(Editor* pEditor, TimeLine* pTimeline)
connect(pTimeline, &TimeLine::newVectorLayer, mCommands, &ActionCommands::addNewVectorLayer);
connect(pTimeline, &TimeLine::newSoundLayer, mCommands, &ActionCommands::addNewSoundLayer);
connect(pTimeline, &TimeLine::newCameraLayer, mCommands, &ActionCommands::addNewCameraLayer);
connect(pTimeline, &TimeLine::deleteCurrentLayer, mCommands, &ActionCommands::deleteCurrentLayer);
connect(pTimeline, &TimeLine::modifiedCamera, mCommands, &ActionCommands::editCameraProperties);

connect(mTimeLine, &TimeLine::playButtonTriggered, mCommands, &ActionCommands::PlayStop);

Expand Down
Loading