21#include <QImageReader>
23#include <QTemporaryDir>
26#include "vectorimage.h"
27#include "bitmapimage.h"
30#include "layerbitmap.h"
31#include "layervector.h"
32#include "layercamera.h"
33#include "undoredocommand.h"
37#include "colormanager.h"
38#include "filemanager.h"
39#include "toolmanager.h"
40#include "layermanager.h"
41#include "playbackmanager.h"
42#include "viewmanager.h"
43#include "preferencemanager.h"
44#include "soundmanager.h"
45#include "selectionmanager.h"
46#include "overlaymanager.h"
47#include "clipboardmanager.h"
48#include "undoredomanager.h"
50#include "scribblearea.h"
99 mIsAutosave = mPreferenceManager->isOn(SETTING::AUTO_SAVE);
100 mAutosaveNumber = mPreferenceManager->getInt(SETTING::AUTO_SAVE_NUMBER);
105int Editor::currentFrame()
const
112 return mPlaybackManager->fps();
115void Editor::setFps(
int fps)
117 mPreferenceManager->set(SETTING::FPS, fps);
118 emit fpsChanged(fps);
121void Editor::makeConnections()
123 connect(mPreferenceManager, &PreferenceManager::optionChanged,
this, &Editor::settingUpdated);
124 connect(mUndoRedoManager, &UndoRedoManager::didUpdateUndoStack,
this, &Editor::updateAutoSaveCounter);
125 connect(mPreferenceManager, &PreferenceManager::optionChanged, mUndoRedoManager, &UndoRedoManager::onSettingChanged);
129 connect(mLayerManager, &LayerManager::currentLayerWillChange,
this, &Editor::onCurrentLayerWillChange);
132void Editor::settingUpdated(SETTING setting)
136 case SETTING::AUTO_SAVE:
137 mIsAutosave = mPreferenceManager->isOn(SETTING::AUTO_SAVE);
139 case SETTING::AUTO_SAVE_NUMBER:
140 mAutosaveNumber = mPreferenceManager->getInt(SETTING::AUTO_SAVE_NUMBER);
142 case SETTING::ONION_TYPE:
144 emit updateTimeLineCached();
146 case SETTING::FRAME_POOL_SIZE:
147 mObject->setActiveFramePoolSize(mPreferenceManager->getInt(SETTING::FRAME_POOL_SIZE));
149 case SETTING::LAYER_VISIBILITY:
150 mScribbleArea->setLayerVisibility(
static_cast<LayerVisibility
>(mPreferenceManager->getInt(SETTING::LAYER_VISIBILITY)));
151 emit updateTimeLine();
158void Editor::onCurrentLayerWillChange(
int index)
162 if (select() && select()->somethingSelected()) {
163 static_cast<MoveTool*
>(tools()->getTool(MOVE))->applyTransformationAndDeselect();
167void Editor::updateAutoSaveCounter()
169 if (mIsAutosave ==
false)
173 if (mAutosaveCounter >= mAutosaveNumber)
175 resetAutoSaveCounter();
180void Editor::resetAutoSaveCounter()
182 mAutosaveCounter = 0;
187 Layer* currentLayer = layers()->currentLayer();
189 Q_ASSERT(currentLayer !=
nullptr);
191 if (!canCopy()) {
return; }
195 if (currentLayer->hasAnySelectedFrames() && !select()->somethingSelected()) {
197 }
else if (currentLayer->type() == Layer::BITMAP) {
198 BitmapImage* bitmapImage =
static_cast<BitmapImage*
>(currentLayer->getLastKeyFrameAtPosition(currentFrame()));
199 clipboards()->
copyBitmapImage(bitmapImage, select()->mySelectionRect());
200 }
else if (currentLayer->type() == Layer::VECTOR) {
201 VectorImage* vectorImage =
static_cast<VectorImage*
>(currentLayer->getLastKeyFrameAtPosition(currentFrame()));
206void Editor::copyAndCut()
210 Layer* currentLayer = layers()->currentLayer();
212 if (currentLayer->hasAnySelectedFrames() && !select()->somethingSelected()) {
214 currentLayer->removeKeyFrame(pos);
216 emit layers()->currentLayerChanged(currentLayerIndex());
217 emit updateTimeLine();
221 if (currentLayer->type() == Layer::BITMAP || currentLayer->type() == Layer::VECTOR) {
222 mScribbleArea->deleteSelection();
227void Editor::pasteFromPreviousFrame()
229 Layer* currentLayer = layers()->currentLayer();
230 int prevFrame = currentLayer->getPreviousKeyFramePosition(mFrame);
231 if (!currentLayer->keyExists(mFrame) || prevFrame == mFrame)
236 if (currentLayer->type() == Layer::BITMAP)
238 backup(
tr(
"Paste from Previous Keyframe"));
240 if (select()->somethingSelected())
243 pasteToCanvas(©, mFrame);
247 pasteToCanvas(bitmapImage, mFrame);
250 else if (currentLayer->type() == Layer::VECTOR)
252 backup(
tr(
"Paste from Previous Keyframe"));
254 pasteToCanvas(vectorImage, mFrame);
258void Editor::pasteToCanvas(
BitmapImage* bitmapImage,
int frameNumber)
260 Layer* currentLayer = layers()->currentLayer();
262 Q_ASSERT(currentLayer->type() == Layer::BITMAP);
264 if (select()->somethingSelected())
266 QRectF selection = select()->mySelectionRect();
267 if (bitmapImage->width() <= selection.
width() && bitmapImage->height() <= selection.
height())
269 bitmapImage->moveTopLeft(selection.
topLeft());
273 bitmapImage->transform(selection,
true);
277 BitmapImage *canvasImage =
static_cast<BitmapImage*
>(currentLayer->getLastKeyFrameAtPosition(frameNumber));
280 canvasImage->paste(bitmapImage);
288void Editor::pasteToCanvas(
VectorImage* vectorImage,
int frameNumber)
290 Layer* currentLayer = layers()->currentLayer();
292 Q_ASSERT(currentLayer->type() == Layer::VECTOR);
296 VectorImage* canvasImage =
static_cast<VectorImage*
>(currentLayer->getLastKeyFrameAtPosition(frameNumber));
297 canvasImage->
paste(*vectorImage);
298 select()->
setSelection(vectorImage->getSelectionRect());
302void Editor::pasteToFrames()
305 Q_ASSERT(!clipboardFrames.empty());
306 Layer* currentLayer = layers()->currentLayer();
308 currentLayer->deselectAll();
310 int newPositionOffset = mFrame - clipboardFrames.cbegin()->first;
311 for (
auto it = clipboardFrames.cbegin(); it != clipboardFrames.cend(); ++it)
313 int newPosition = it->first + newPositionOffset;
315 KeyFrame* keyFrameNewPos = currentLayer->getKeyFrameWhichCovers(newPosition);
317 if (keyFrameNewPos !=
nullptr) {
321 currentLayer->moveSelectedFrames(1);
326 Q_ASSERT(key !=
nullptr);
330 if (currentLayer->type() == Layer::SOUND)
332 auto soundClip =
static_cast<SoundClip*
>(key);
333 sound()->loadSound(soundClip, soundClip->fileName());
336 currentLayer->setFrameSelected(key->pos(),
true);
344 Layer* currentLayer = layers()->currentLayer();
346 Q_ASSERT(currentLayer !=
nullptr);
348 if (!canPaste()) {
return; }
350 if (clipboards()->framesIsEmpty()) {
354 clipboards()->setFromSystemClipboard(mScribbleArea->getCentralPoint(), currentLayer);
356 BitmapImage clipboardImage = clipboards()->getBitmapClipboard();
357 VectorImage clipboardVectorImage = clipboards()->getVectorClipboard();
358 if (currentLayer->type() == Layer::BITMAP && clipboardImage.isLoaded()) {
359 pasteToCanvas(&clipboardImage, mFrame);
360 }
else if (currentLayer->type() == Layer::VECTOR && !clipboardVectorImage.isEmpty()) {
361 pasteToCanvas(&clipboardVectorImage, mFrame);
371void Editor::flipSelection(
bool flipVertical)
374 backup(
tr(
"Flip selection vertically"));
376 backup(
tr(
"Flip selection horizontally"));
378 mScribbleArea->flipSelection(flipVertical);
381void Editor::repositionImage(
QPoint transform,
int frame)
383 if (layers()->currentLayer()->type() == Layer::BITMAP)
387 QRect reposRect = layer->getFrameBounds(frame);
391 layer->repositionFrame(point, frame);
392 backup(layer->id(), frame,
tr(
"Reposition frame"));
396void Editor::setModified(
int layerNumber,
int frameNumber)
398 Layer* layer = object()->getLayer(layerNumber);
399 if (layer ==
nullptr) {
return; }
401 layer->setModified(frameNumber,
true);
402 undoRedo()->rememberLastModifiedFrame(layerNumber, frameNumber);
407void Editor::clipboardChanged()
409 Layer* layer = layers()->currentLayer();
411 clipboards()->setFromSystemClipboard(mScribbleArea->getCentralPoint(), layer);
413 bool canCopyState = canCopy();
414 bool canPasteState = canPaste();
416 emit canCopyChanged(canCopyState);
417 emit canPasteChanged(canPasteState);
421 mScribbleArea->setLayerVisibility(visibility);
422 emit updateTimeLine();
425LayerVisibility Editor::layerVisibility()
427 return mScribbleArea->getLayerVisibility();
430qreal Editor::viewScaleInversed()
435void Editor::increaseLayerVisibilityIndex()
437 mScribbleArea->increaseLayerVisibilityIndex();
438 emit updateTimeLine();
441void Editor::decreaseLayerVisibilityIndex()
443 mScribbleArea->decreaseLayerVisibilityIndex();
444 emit updateTimeLine();
449 mTemporaryDirs.
append(dir);
452void Editor::clearTemporary()
454 while(!mTemporaryDirs.
isEmpty())
462Status Editor::openObject(
const QString& strFilePath,
const std::function<
void(
int)>& progressChanged,
const std::function<
void(
int)>& progressRangeChanged)
465 Q_ASSERT(!strFilePath.
isEmpty());
468 dd <<
QString(
"Raw file path: %1").
arg(strFilePath);
469 dd <<
QString(
"Resolved file path: %1").
arg(fileInfo.absoluteFilePath());
470 if (fileInfo.isDir())
472 return Status(Status::ERROR_FILE_CANNOT_OPEN,
474 tr(
"Could not open file"),
475 tr(
"The file you have selected is a directory, so we are unable to open it. "
476 "If you are are trying to open a project that uses the old structure, "
477 "please open the file ending with .pcl, not the data folder."));
479 if (!fileInfo.exists())
481 return Status(Status::FILE_NOT_FOUND,
483 tr(
"Could not open file"),
484 tr(
"The file you have selected does not exist, so we are unable to open it. "
485 "Please make sure that you've entered the correct path and that the file is accessible and try again."));
487 if (!fileInfo.isReadable())
489 dd <<
QString(
"Permissions: 0x%1").
arg(
static_cast<uint
>(fileInfo.permissions()), 0, 16);
490 return Status(Status::ERROR_FILE_CANNOT_OPEN,
492 tr(
"Could not open file"),
493 tr(
"This program does not have permission to read the file you have selected. "
494 "Please check that you have read permissions for this file and try again."));
499 connect(&fm, &FileManager::progressChanged, [&progress, &progressChanged](
int p)
501 progressChanged(progress = p);
503 connect(&fm, &FileManager::progressRangeChanged, [&progressRangeChanged](
int max)
505 progressRangeChanged(max + 3);
508 QString fullPath = fileInfo.absoluteFilePath();
510 Object*
object = fm.load(fullPath);
512 Status fmStatus = fm.error();
515 dd.collect(fmStatus.details());
516 fmStatus.setDetails(dd);
520 if (
object ==
nullptr)
522 return Status(Status::ERROR_FILE_CANNOT_OPEN,
524 tr(
"Could not open file"),
525 tr(
"An unknown error occurred while trying to load the file and we are not able to load your file."));
530 progressChanged(progress + 1);
533 setFps(playback()->fps());
542 if (newObject == mObject.get())
547 mObject.reset(newObject);
554 m->load(mObject.get());
561void Editor::updateObject()
563 setCurrentLayerIndex(mObject->data()->getCurrentLayer());
564 scrubTo(mObject->data()->getCurrentFrame());
566 mAutosaveCounter = 0;
567 mAutosaveNeverAskAgain =
false;
569 if (mPreferenceManager)
571 mObject->setActiveFramePoolSize(mPreferenceManager->getInt(SETTING::FRAME_POOL_SIZE));
574 emit updateLayerCount();
581 Q_ASSERT(layers()->currentLayer()->type() == Layer::BITMAP);
582 const auto layer =
static_cast<LayerBitmap*
>(layers()->currentLayer());
584 if (!layer->visible())
586 mScribbleArea->showLayerNotVisibleWarning();
590 Status status = Status::OK;
592 dd <<
QString(
"Raw file path: %1").
arg(filePath);
595 if (!reader.read(&img)) {
596 QString format = reader.format();
599 dd <<
QString(
"QImageReader format: %1").
arg(format);
601 dd <<
QString(
"QImageReader ImageReaderError type: %1").
arg(reader.errorString());
604 switch(reader.error())
606 case QImageReader::ImageReaderError::FileNotFoundError:
607 errorDesc =
tr(
"File not found at path \"%1\". Please check the image is present at the specified location and try again.").
arg(filePath);
610 errorDesc =
tr(
"Image format is not supported. Please convert the image file to one of the following formats and try again:\n%1")
614 errorDesc =
tr(
"An error has occurred while reading the image. Please check that the file is a valid image and try again.");
617 status =
Status(Status::FAIL, dd,
tr(
"Import failed"), errorDesc);
623 if (!layer->keyExists(mFrame))
628 BitmapImage* bitmapImage = layer->getBitmapImageAtFrame(mFrame);
630 bitmapImage->paste(&importedBitmapImage);
635 backup(
tr(
"Import Image"));
642 Q_ASSERT(layers()->currentLayer()->type() == Layer::VECTOR);
644 auto layer =
static_cast<LayerVector*
>(layers()->currentLayer());
646 Status status = Status::OK;
648 dd <<
QString(
"Raw file path: %1").
arg(filePath);
650 VectorImage* vectorImage = layer->getVectorImageAtFrame(currentFrame());
651 if (vectorImage ==
nullptr)
654 vectorImage = layer->getVectorImageAtFrame(currentFrame());
658 bool ok = importedVectorImage.
read(filePath);
662 vectorImage->
paste(importedVectorImage);
665 backup(
tr(
"Import Image"));
668 status =
Status(Status::FAIL, dd,
tr(
"Import failed"),
tr(
"You cannot import images into a vector layer."));
676 Layer* layer = layers()->currentLayer();
679 dd <<
QString(
"Raw file path: %1").
arg(filePath);
682 switch (importConfig.positionType)
684 case ImportImageConfig::CenterOfCamera: {
687 transform = layerCam->getViewAtFrame(importConfig.importFrame).
inverted();
690 case ImportImageConfig::CenterOfCameraFollowed: {
693 transform = camera->getViewAtFrame(currentFrame()).
inverted();
696 case ImportImageConfig::CenterOfView: {
697 QPointF centralPoint = mScribbleArea->getCentralPoint();
701 case ImportImageConfig::CenterOfCanvas:
702 case ImportImageConfig::None: {
708 switch (layer->type())
711 return importBitmapImage(filePath, transform);
714 return importVectorImage(filePath);
717 dd <<
QString(
"Current layer: %1").
arg(layer->type());
718 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"You can only import images to a bitmap layer."));
722Status Editor::importAnimatedImage(
const QString& filePath,
int frameSpacing,
const std::function<
void(
int)>& progressChanged,
const std::function<
bool()>& wasCanceled)
724 frameSpacing = qMax(1, frameSpacing);
727 dd <<
QString(
"Raw file path: %1").
arg(filePath);
729 Layer* layer = layers()->currentLayer();
730 if (layer->type() != Layer::BITMAP)
732 dd <<
QString(
"Current layer: %1").
arg(layer->type());
733 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"You can only import images to a bitmap layer."));
739 if (!reader.supportsAnimation()) {
740 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"The selected image has a format that does not support animation."));
744 const QPoint pos(view()->getView().dx() - (img.width() / 2),
745 view()->getView().dy() - (img.height() / 2));
746 int totalFrames = reader.imageCount();
747 while (reader.read(&img))
751 dd <<
QString(
"QImageReader ImageReaderError type: %1").
arg(reader.errorString());
754 switch(reader.error())
756 case QImageReader::ImageReaderError::FileNotFoundError:
757 errorDesc =
tr(
"File not found at path \"%1\". Please check the image is present at the specified location and try again.").
arg(filePath);
760 errorDesc =
tr(
"Image format is not supported. Please convert the image file to one of the following formats and try again:\n%1")
761 .
arg((
QString)reader.supportedImageFormats().join(
", "));
764 errorDesc =
tr(
"An error has occurred while reading the image. Please check that the file is a valid image and try again.");
767 return Status(Status::FAIL, dd,
tr(
"Import failed"), errorDesc);
770 if (!bitmapLayer->keyExists(mFrame))
774 BitmapImage* bitmapImage = bitmapLayer->getBitmapImageAtFrame(mFrame);
776 bitmapImage->paste(&importedBitmapImage);
784 scrubTo(mFrame + frameSpacing);
786 backup(
tr(
"Import Image"));
788 progressChanged(qFloor(qMin(
static_cast<double>(reader.currentImageNumber()) / totalFrames, 1.0) * 100));
794void Editor::selectAll()
const
796 Layer* layer = layers()->currentLayer();
799 if (layer->type() == Layer::BITMAP)
804 if (bitmapImage ==
nullptr) {
return; }
806 rect = bitmapImage->bounds();
808 else if (layer->type() == Layer::VECTOR)
811 if (vectorImage !=
nullptr)
814 rect = vectorImage->getSelectionRect();
820void Editor::deselectAll()
const
822 select()->resetSelectionProperties();
824 Layer* layer = layers()->currentLayer();
825 if (layer ==
nullptr) {
return; }
827 if (layer->type() == Layer::VECTOR)
830 if (vectorImage !=
nullptr)
836 if (layer->hasAnySelectedFrames()) {
837 layer->deselectAll();
838 emit updateTimeLine();
847void Editor::setCurrentLayerIndex(
int i)
849 mCurrentLayerIndex = i;
851 Layer* layer = mObject->getLayer(i);
852 for (
auto mgr : mAllManagers)
854 mgr->workingLayerChanged(layer);
858void Editor::scrubTo(
int frame)
860 if (select() && select()->somethingSelected()) {
861 static_cast<MoveTool*
>(tools()->getTool(MOVE))->applyTransformationAndDeselect();
864 if (frame < 1) { frame = 1; }
870 if (mPlaybackManager && !mPlaybackManager->isPlaying())
872 emit updateTimeLineCached();
874 mObject->updateActiveFrames(frame);
878void Editor::scrubForward()
880 int nextFrame = mFrame + 1;
881 if (!playback()->isPlaying()) {
882 playback()->playScrub(nextFrame);
887void Editor::scrubBackward()
889 if (currentFrame() > 1)
891 int previousFrame = mFrame - 1;
892 if (!playback()->isPlaying()) {
893 playback()->playScrub(previousFrame);
895 scrubTo(previousFrame);
901 return addKeyFrame(layers()->currentLayerIndex(), currentFrame());
906 Layer* layer = mObject->getLayer(layerNumber);
909 if (!layer->visible())
911 mScribbleArea->showLayerNotVisibleWarning();
916 while (layer->keyExists(frameIndex))
918 if (layer->type() == Layer::SOUND
919 && layer->getKeyFrameAt(frameIndex)->fileName().
isEmpty()
920 && layer->removeKeyFrame(frameIndex))
934 SAVESTATE_ID saveStateId = undoRedo()->
createState(UndoRedoRecordType::KEYFRAME_ADD);
937 KeyFrame* newFrame = layer->getKeyFrameAt(frameIndex);
939 undoRedo()->
record(saveStateId,
tr(
"Add frame"));
944void Editor::removeKey()
946 Layer* layer = layers()->currentLayer();
947 Q_ASSERT(layer !=
nullptr);
949 if (!layer->visible())
951 mScribbleArea->showLayerNotVisibleWarning();
955 if (!layer->keyExistsWhichCovers(currentFrame()))
961 SAVESTATE_ID saveStateId = undoRedo()->
createState(UndoRedoRecordType::KEYFRAME_REMOVE);
962 backup(
tr(
"Remove frame"));
965 layer->removeKeyFrame(currentFrame());
967 emit layers()->currentLayerChanged(layers()->currentLayerIndex());
969 undoRedo()->
record(saveStateId,
tr(
"Remove frame"));
972void Editor::scrubNextKeyFrame()
974 Layer* currentLayer = layers()->currentLayer();
975 Q_ASSERT(currentLayer);
977 int nextPosition = currentLayer->getNextKeyFramePosition(currentFrame());
978 if (currentFrame() >= currentLayer->getMaxKeyFramePosition()) nextPosition = currentFrame() + 1;
979 scrubTo(nextPosition);
982void Editor::scrubPreviousKeyFrame()
984 Layer* layer = mObject->getLayer(layers()->currentLayerIndex());
987 int prevPosition = layer->getPreviousKeyFramePosition(currentFrame());
988 scrubTo(prevPosition);
991void Editor::switchVisibilityOfLayer(
int layerNumber)
993 Layer* layer = mObject->getLayer(layerNumber);
994 if (layer !=
nullptr) layer->switchVisibility();
997 emit updateTimeLine();
1000void Editor::swapLayers(
int i,
int j)
1002 bool didSwapLayer = mObject->swapLayers(i, j);
1003 if (!didSwapLayer) {
return; }
1007 layers()->setCurrentLayer(j + 1);
1011 layers()->setCurrentLayer(j - 1);
1013 emit updateTimeLine();
1017bool Editor::canSwapLayers(
int layerIndexLeft,
int layerIndexRight)
const
1019 return mObject->canSwapLayers(layerIndexLeft, layerIndexRight);
1022void Editor::prepareSave()
1024 for (
auto mgr : mAllManagers)
1026 mgr->save(mObject.get());
1030void Editor::clearCurrentFrame()
1032 mScribbleArea->clearImage();
1035bool Editor::canCopy()
const
1037 Layer* layer = layers()->currentLayer();
1038 KeyFrame* keyframe = layer->getLastKeyFrameAtPosition(mFrame);
1040 switch (layer->type())
1044 return canCopyFrames(layer);
1046 return canCopyBitmapImage(
static_cast<BitmapImage*
>(keyframe)) || canCopyFrames(layer);
1048 return canCopyVectorImage(
static_cast<VectorImage*
>(keyframe)) || canCopyFrames(layer);
1054bool Editor::canPaste()
const
1056 Layer* layer = layers()->currentLayer();
1057 auto clipboardMan = clipboards();
1058 auto layerType = layer->type();
1060 return (layerType == clipboardMan->framesLayerType() && !clipboardMan->framesIsEmpty()) ||
1061 (layerType == Layer::BITMAP && clipboardMan->getBitmapClipboard().isLoaded()) ||
1062 (layerType == Layer::VECTOR && !clipboardMan->getVectorClipboard().isEmpty());
1065bool Editor::canCopyFrames(
const Layer* layer)
const
1067 Q_ASSERT(layer !=
nullptr);
1068 return layer->hasAnySelectedFrames();
1071bool Editor::canCopyBitmapImage(
BitmapImage* bitmapImage)
const
1073 return bitmapImage !=
nullptr && bitmapImage->isLoaded() && !bitmapImage->bounds().
isEmpty();
1076bool Editor::canCopyVectorImage(
const VectorImage* vectorImage)
const
1078 return vectorImage !=
nullptr && !vectorImage->isEmpty();
1081void Editor::backup(
const QString &undoText)
1083 undoRedo()->legacyBackup(undoText);
1084 updateAutoSaveCounter();
1087bool Editor::backup(
int layerNumber,
int frameNumber,
const QString &undoText)
1089 bool didBackup = undoRedo()->legacyBackup(layerNumber, frameNumber, undoText);
1091 updateAutoSaveCounter();
std::map< int, KeyFrame * > getClipboardFrames()
Return a copy of all clipboard frames keyed by their position.
void copySelectedFrames(const Layer *currentLayer)
Copy selected keyframes of any given layer and remember its type.
void copyVectorImage(const VectorImage *vectorImage)
Copy the entire vector image to clipboard, this operation does not yet support partial selections.
void copyBitmapImage(BitmapImage *image, QRectF selectionRect)
Copy bitmap image to clipboard and save its latest position Additionally only a part of the image wil...
KeyFrame * addNewKey()
Attempts to create a new keyframe at the current frame and layer.
void frameModified(int frameNumber)
This should be emitted after modifying the frame content.
void updateFrame()
Will call update() and update the canvas Only call this directly If you need the cache to be intact a...
void scrubbed(int frameNumber)
This should be emitted after scrubbing.
void setLayerVisibility(LayerVisibility visibility)
The visibility value should match any of the VISIBILITY enum values.
KeyFrame * addKeyFrame(int layerNumber, int frameIndex)
Attempts to create a new keyframe at the given position and layer.
bool newSelectionOfConnectedFrames(int position)
Make a selection from specified position until a blank spot appears The search is only looking forwar...
bool addNewKeyFrameAt(int position)
Creates a new keyframe at the given position, unless one already exists.
QList< int > selectedKeyFramesPositions() const
Get selected keyframe positions sorted by position.
virtual bool addKeyFrame(int position, KeyFrame *pKeyFrame)
Adds a keyframe at the given position, unless one already exists.
void notifyAnimationLengthChanged()
This should be emitted whenever the animation length frames, eg.
void updateFrame()
Update frame.
void handleDrawingOnEmptyFrame()
Call this when starting to use a paint tool.
void onOnionSkinTypeChanged()
Onion skin type changed, all frames will be affected.
void onLayerChanged()
Layer changed, invalidate relevant cache.
The SelectionManager class acts as the "Brain" of the selection system.
void setSelection(QRectF rect, bool roundPixels=false)
Defines the selection area.
void sanitizeLegacyBackupElementsAfterLayerDeletion(int layerIndex)
Restores integrity of the backup elements after a layer has been deleted.
void record(SAVESTATE_ID SaveStateId, const QString &description)
Records the given save state.
SAVESTATE_ID createState(UndoRedoRecordType recordType)
Prepares and returns an save state with common data.
void deselectAll()
VectorImage::deselectAll.
void paste(VectorImage &)
VectorImage::paste.
bool read(QString filePath)
VectorImage::read.
void selectAll()
VectorImage::selectAll.
qreal getScaleInversed() const
void append(const T &value)
bool isEmpty() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString tr(const char *sourceText, const char *disambiguation, int n)
bool isEmpty() const const
QPoint topLeft() const const
qreal height() const const
QRect toRect() const const
QPointF topLeft() const const
qreal width() const const
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString fromUtf8(const char *str, int size)
bool isEmpty() const const