Kage Studio 0.7.240121
A Simple Free and Open Source 2D Animation Software
Loading...
Searching...
No Matches
document.h
Go to the documentation of this file.
1/*
2 * Kage Studio - a simple free and open source vector-based 2D animation software
3 * Copyright (C) 2011~2024 Mj Mendoza IV
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA. Or, see <https://www.gnu.org/licenses/>.
19 *
20 */
21/*Project
22 Info
23 Name
24 Width
25 Height
26 BG Color
27 Assets
28 asset01 Image
29 asset02 Image
30 asset03 SceneID
31 Scene01
32 layer01
33 frame01
34 data Move X Y
35 data Line X Y
36 data Color
37 frame02
38 data Move X Y
39 data Line X Y
40 data Asset ID
41 layer02
42 ...
43 Scene02
44 ...
45 Scene03
46 layer01
47 frame01
48 data Move X Y
49 data Line X Y
50 data Color
51 frame02
52 ...
53 layer02
54 ...
55 layer03
56 ...
57*/
58#ifndef GTKMM_KAGE_DOCUMENT_H
59 #define GTKMM_KAGE_DOCUMENT_H
60
61 #include <vector>
62 #include "data/color.h"
63 #include "./data/scene.h"
64
66
67 #include <gdkmm/color.h>
68
70 public:
71 bool _saved;
72 unsigned int _activeSceneID;
73 unsigned int _activeSceneIndex;
74
75 unsigned int sceneCtr;
76
77 unsigned int _activeScene;
78
80 KageDocument(KageDocument &p_document);
81 KageDocument operator=(const KageDocument &p_document);
82 void init();
83 virtual ~KageDocument();
84 unsigned int openScene(std::string p_filepath);
85 bool saveScene(unsigned int p_sceneID);
86 bool openProject();
87 bool saveProject();
88 bool isSaved();
89
90 unsigned int addScene(std::string p_sceneLabel, bool p_asset = false);
91 bool removeAllScenes();
92 bool removeSceneAt(unsigned int p_sceneIndex);
93
99
100 struct Asset {
101 unsigned int ID;
103 std::string Path;
104 std::string Name;
105 };
106 //TODO: each instance of asset will reference to this
107 std::vector<Asset> Assets;
108
109 //TODO: each Scene will be saved as separate KSF file
110 std::vector<KageScene*> Scenes;
112
114 unsigned int getCurrentScene();
115 void setCurrentScene(unsigned int p_newScene); //p_scene-1 is index
116 void setCurrentSceneByID(unsigned int p_newSceneID);
117 unsigned int getActiveSceneID();
118 unsigned int getActiveLayerID();
119 unsigned int getActiveFrameID();
120
121 unsigned int frameCount();
122 void setSceneLayerCurrentFrame(unsigned int p_frame);
123 std::string getLayerLabel();
124 void setLayerLabel(std::string p_label);
126 bool isLayerVisible();
127 void setLayerVisible(bool p_visible);
128 void toggleLayerLock();
129 bool isLayerLocked();
130 void setLayerLocked(bool p_lock);
131
132 bool moveSceneUp();
133 bool moveSceneDown();
134 bool moveSceneToTop();
135 bool moveSceneToBottom();
136
137 bool gotoNextScene();
138
139 static GdkPoint _mouseLocation;
141 static bool ASSET_MODE;
142 };
143#endif //GTKMM_KAGE_DOCUMENT_H
std::vector< Asset > Assets
Definition document.h:107
bool moveSceneDown()
Definition document.cpp:457
unsigned int getCurrentScene()
returns activeSceneIndex+1; to get the actual (pointer to) Scene object, use getScene instead
Definition document.cpp:168
std::vector< KageScene * > Scenes
Definition document.h:110
void setCurrentScene(unsigned int p_newScene)
returns index+1
Definition document.cpp:182
bool openProject()
Definition document.cpp:130
bool isSaved()
Definition document.cpp:151
KageDocument()
Definition document.cpp:25
unsigned int getActiveLayerID()
Definition document.cpp:240
unsigned int frameCount()
Definition document.cpp:321
void init()
Definition document.cpp:87
KageScene * _scenePtr
Definition document.h:111
static bool ASSET_MODE
Definition document.h:141
static GdkPoint _mouseLocation
Definition document.h:139
void setLayerVisible(bool p_visible)
Definition document.cpp:369
bool _saved
Definition document.h:71
void setLayerLocked(bool p_lock)
Definition document.cpp:392
unsigned int _activeSceneID
Definition document.h:72
bool moveSceneToBottom()
Definition document.cpp:484
KageDocument operator=(const KageDocument &p_document)
Definition document.cpp:57
bool saveScene(unsigned int p_sceneID)
Kage Document will contain several scenes. This will allow saving one Scene to be saved each time.
Definition document.cpp:124
virtual ~KageDocument()
Definition document.cpp:98
unsigned int getActiveFrameID()
Definition document.cpp:248
bool gotoNextScene()
For use by Kage when Play is triggered.
Definition document.cpp:511
std::string getLayerLabel()
Definition document.cpp:338
void setLayerLabel(std::string p_label)
Definition document.cpp:346
bool moveSceneUp()
Definition document.cpp:430
bool removeSceneAt(unsigned int p_sceneIndex)
Used by KageDocument; This will gracefully remove all Layers of this Scene along with its Frames.
Definition document.cpp:297
void setSceneLayerCurrentFrame(unsigned int p_frame)
Definition document.cpp:330
bool isLayerVisible()
Definition document.cpp:361
static bool _displayObjectIsShape
Definition document.h:140
unsigned int openScene(std::string p_filepath)
Definition document.cpp:104
bool removeAllScenes()
Definition document.cpp:280
void toggleLayerLock()
Definition document.cpp:377
unsigned int _activeSceneIndex
Definition document.h:73
bool moveSceneToTop()
Definition document.cpp:405
AssetType
Definition document.h:94
@ ASSET_KAGE
Definition document.h:97
@ ASSET_IMAGE
Definition document.h:95
@ ASSET_VIDEO
Definition document.h:96
void toggleLayerVisibility()
Definition document.cpp:354
void setCurrentSceneByID(unsigned int p_newSceneID)
Definition document.cpp:208
unsigned int addScene(std::string p_sceneLabel, bool p_asset=false)
Used by Kage when creating new Scene, or opening KSF file (even if via KAGE file)
Definition document.cpp:262
bool saveProject()
Definition document.cpp:134
unsigned int getActiveSceneID()
Definition document.cpp:237
unsigned int _activeScene
will be used to create Unique sceneCtr IDs
Definition document.h:77
bool isLayerLocked()
Definition document.cpp:384
KageScene * getScene()
Definition document.cpp:154
unsigned int sceneCtr
Definition document.h:75
Definition scene.h:41
Definition document.h:100
std::string Path
Definition document.h:103
std::string Name
Definition document.h:104
unsigned int ID
Definition document.h:101
AssetType Type
Definition document.h:102