Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • managers
clipboardmanager.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; version 2 of the License.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16*/
17#ifndef CLIPBOARDMANAGER_H
18#define CLIPBOARDMANAGER_H
19
20#include "basemanager.h"
21
22#include "bitmapimage.h"
23#include "vectorimage.h"
24#include "layer.h"
25
26class Editor;
27class QClipboard;
28class KeyFrame;
29
30class ClipboardManager: public BaseManager
31{
32 Q_OBJECT
33public:
34 explicit ClipboardManager(Editor* editor);
35 ~ClipboardManager() override;
36
37 bool init() override { return true; }
38 Status load(Object*) override { return Status::OK; }
39 Status save(Object*) override { return Status::OK; }
40 void workingLayerChanged(Layer*) override { }
41
42 void setFromSystemClipboard(const QPointF& pos, const Layer* layer);
43
49 void copyBitmapImage(BitmapImage* image, QRectF selectionRect);
50
55 void copyVectorImage(const VectorImage* vectorImage);
56
60 void copySelectedFrames(const Layer* currentLayer);
61
62 const BitmapImage& getBitmapClipboard() const { return mBitmapImage; }
63 const VectorImage& getVectorClipboard() const { return mVectorImage; }
64
70 std::map<int, KeyFrame*> getClipboardFrames();
71
72 Layer::LAYER_TYPE framesLayerType() const { return mFramesType; }
73 bool framesIsEmpty() const { return mFrames.empty(); }
74
75private:
76
78 void resetStates();
79
80 BitmapImage mBitmapImage;
81 VectorImage mVectorImage;
82 std::map<int, KeyFrame*> mFrames;
83 Layer::LAYER_TYPE mFramesType = Layer::LAYER_TYPE::UNDEFINED;
84};
85
86#endif // CLIPBOARDMANAGER_H
BaseManager
Definition: basemanager.h:29
BitmapImage
Definition: bitmapimage.h:28
ClipboardManager
Definition: clipboardmanager.h:31
ClipboardManager::getClipboardFrames
std::map< int, KeyFrame * > getClipboardFrames()
Return a copy of all clipboard frames keyed by their position.
Definition: clipboardmanager.cpp:100
ClipboardManager::copySelectedFrames
void copySelectedFrames(const Layer *currentLayer)
Copy selected keyframes of any given layer and remember its type.
Definition: clipboardmanager.cpp:82
ClipboardManager::copyVectorImage
void copyVectorImage(const VectorImage *vectorImage)
Copy the entire vector image to clipboard, this operation does not yet support partial selections.
Definition: clipboardmanager.cpp:73
ClipboardManager::resetStates
void resetStates()
This should be called before copying and updating the clipboard to ensure no previous state is saved.
Definition: clipboardmanager.cpp:110
ClipboardManager::copyBitmapImage
void copyBitmapImage(BitmapImage *image, QRectF selectionRect)
Copy bitmap image to clipboard and save its latest position Additionally only a part of the image wil...
Definition: clipboardmanager.cpp:56
Editor
Definition: editor.h:71
KeyFrame
Definition: keyframe.h:30
Layer
Definition: layer.h:33
Object
Definition: object.h:42
Status
Definition: pencilerror.h:40
VectorImage
Definition: vectorimage.h:32
QClipboard
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QPointF
QRectF
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39