Skip to content

Commit

Permalink
from Kage Studio's sourceforge r813
Browse files Browse the repository at this point in the history
  • Loading branch information
creek23 committed Feb 25, 2024
1 parent c1cdac8 commit ce0f9b2
Show file tree
Hide file tree
Showing 4 changed files with 208 additions and 1 deletion.
Binary file modified studio/installers/windows/gdbus.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion studio/kage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ Kage::Kage(std::string p_filePath) :
m_HPane_DrawingArea.property_position() = _area_properties_pane2;

if (p_filePath != "") {
ksfPath = p_filePath;
kagePath = p_filePath;
doOpenKAGE();
}
_UPDATE_SHAPE_COLORS = false;
Expand Down
116 changes: 116 additions & 0 deletions studio/kage/project.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Kage Studio - a simple free and open source vector-based 2D animation software
* Copyright (C) 2011~2024 Mj Mendoza IV
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA. Or, see <https://www.gnu.org/licenses/>.
*
*/

#include "document.h"
#include "../kage.h"

KageProject::KageProject(Kage *p_kage) {
init(p_kage);
}
KageProject KageProject::operator=(const KageProject &p_project) {
KageDocument::operator= (p_project);

if (this == &p_project) {
return *this;
}

this->_name = p_project._name;
this->_width = p_project._width;
this->_height = p_project._height;
this->_backgroundColor = p_project._backgroundColor;
this->_fps = p_project._fps;
this->_kage = p_project._kage;
this->sceneCtr = p_project.sceneCtr;

return *this;
}
KageProject KageProject::operator=(const KageDocument &p_document) {
if (this == &p_document) {
return *this;
}

KageDocument::operator= (p_document);

return *this;
}

void KageProject::init(Kage *p_kage) {
_name = "Untitled";
_width = 960.0f;
_height = 720.0f;
_backgroundColor = ColorData(255, 255, 255);
_fps = 12;

sceneCtr = 0;
_kage = p_kage;

_activeSceneID = UINT_MAX;
addScene(StringHelper::unsignedIntegerToString(sceneCtr+1));

_activeSceneIndex = 0;
_activeSceneID = Scenes[_activeSceneIndex]->getID();
_activeScene = _activeSceneIndex + 1;
}

KageProject::~KageProject() {
//TODO: revisit
//_kage = NULL;
}

std::string KageProject::toString() {
return "name=\"" + _name
+ "\" width=\"" + StringHelper::doubleToString(_width)
+ "\" height=\"" + StringHelper::doubleToString(_height)
+ "\" background=\"rgb(" + StringHelper::integerToString(_backgroundColor.getR()) + ", " + StringHelper::integerToString(_backgroundColor.getG()) + ", " + StringHelper::integerToString(_backgroundColor.getB()) + ")\" " +
+ "\" fps=\"" + StringHelper::unsignedIntegerToString(_fps) + "\"";
}

/** For use of Kage when User clicked Layer->Rename
* \sa renameLayer(KageLayer)
*/
void KageProject::renameLayer() {
try {
std::string l_layerLabel = getScene()->getLayerLabel();

LabelRenameDialog* pDialog = new LabelRenameDialog(*_kage, l_layerLabel);
pDialog->run();
getScene()->setLayerLabel(pDialog->getLabel());
delete pDialog;
} catch (std::exception& e) {
std::cout << "KageProject::renameLayer Exception : " << e.what() << std::endl;
}
}

/** For use of Kage when User clicked Scene->Rename
* \sa renameScene(KageScenesUI)
*/
void KageProject::renameScene() {
try {
std::string l_sceneLabel = getScene()->getLabel();

LabelRenameDialog* pDialog = new LabelRenameDialog(*_kage, l_sceneLabel);
pDialog->run();
getScene()->setLabel(pDialog->getLabel());
delete pDialog;
} catch (std::exception& e) {
std::cout << "KageProject::renameScene Exception : " << e.what() << std::endl;
}
}
91 changes: 91 additions & 0 deletions studio/kage/project.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Kage Studio - a simple free and open source vector-based 2D animation software
* Copyright (C) 2011~2024 Mj Mendoza IV
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA. Or, see <https://www.gnu.org/licenses/>.
*
*/
/*Project
Info
Name
Width
Height
BG Color
Assets
asset01 Image
asset02 Image
asset03 SceneID
Scene01
layer01
frame01
data Move X Y
data Line X Y
data Color
frame02
data Move X Y
data Line X Y
data Asset ID
layer02
...
Scene02
...
Scene03
layer01
frame01
data Move X Y
data Line X Y
data Color
frame02
...
layer02
...
layer03
...
*/
#ifndef GTKMM_KAGE_PROJECT_H
#define GTKMM_KAGE_PROJECT_H

#include <vector>
#include "data/color.h"
#include "./data/scene.h"

#include "../util/string/stringhelper.h"

#include <gdkmm/color.h>
class Kage; //forward declaration

class KageProject: public KageDocument {
public:
std::string _name;
double _width; //made double for zoom
double _height; //ditto
ColorData _backgroundColor;
unsigned int _fps;

std::string toString();

Kage *_kage;

KageProject(Kage *p_kage);
KageProject operator=(const KageProject &p_project);
KageProject operator=(const KageDocument &p_document);
void init(Kage *p_kage);
virtual ~KageProject();

void renameLayer();
void renameScene();
};
#endif //GTKMM_KAGE_PROJECT_H

0 comments on commit ce0f9b2

Please sign in to comment.