00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Bjoern Erik Nilsen & Fredrik Berg Kjoelstad * 00003 * bjoern_erik_nilsen@hotmail.com & fredrikbk@hotmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef DOMAINFACADE_H 00021 #define DOMAINFACADE_H 00022 00023 #include "src/config.h" 00024 #include "animation/animationmodel.h" 00025 #include "src/domain/undo/undohistory.h" 00026 #include "src/presentation/frontends/frontend.h" 00027 #include "src/technical/video/videoencoder.h" 00028 00029 #include <vector> 00030 using namespace std; 00031 00041 class DomainFacade 00042 { 00043 public: 00044 ~DomainFacade(); 00045 00051 static DomainFacade* getFacade(); 00052 00058 void attatch(Observer *o); 00059 00065 void detatch(Observer *o); 00066 00072 void registerFrontend(Frontend *frontend); 00073 00078 Frontend* getFrontend(); 00079 00084 void setActiveFrame(int frameNumber); 00085 00090 int getActiveFrameNumber(); 00091 00097 void addFrames(const vector<char*>& frameNames); 00098 00105 void removeFrames(unsigned int fromFrame, unsigned int toFrame); 00106 00113 void moveFrames(unsigned int fromFrame, unsigned int toFrame, 00114 unsigned int movePosition); 00115 00123 int addSound(unsigned int frameNumber, const char* filename); 00124 00131 void removeSound(unsigned int frameNumber, unsigned int soundNumber); 00132 00140 void setSoundName(unsigned int frameNumber, unsigned int soundNumber, 00141 char* soundName); 00142 00147 void playFrame(int frameNumber); 00148 00152 bool openProject(const char *filename); 00153 00157 bool saveProject(const char *filename); 00158 00162 bool newProject(); 00163 00168 bool isUnsavedChanges(); 00169 00176 Frame* getFrame(unsigned int frameNumber, unsigned int sceneNumber); 00177 00184 Frame* getFrame(unsigned int frameNumber); 00185 00190 unsigned int getModelSize(); 00191 00197 unsigned int getSceneSize(int sceneNumber); 00198 00203 unsigned int getNumberOfScenes(); 00204 00209 const char* getProjectFile(); 00210 00214 bool undo(); 00215 00219 bool redo(); 00220 00224 void clearHistory(); 00225 00230 void setActiveScene(int sceneNumber); 00231 00236 int getActiveSceneNumber(); 00237 00242 void newScene(int index); 00243 00248 void removeScene(int sceneNumber); 00249 00255 void moveScene(int sceneNumber, int movePosition); 00256 00263 bool initAudioDevice(); 00264 00268 void shutdownAudioDevice(); 00269 00275 bool exportToVideo(VideoEncoder *encoder); 00276 00282 bool exportToCinerella(const char *file); 00283 00289 void animationChanged(const char *alteredFile); 00290 00291 protected: 00296 DomainFacade(); 00297 00298 private: 00300 static DomainFacade *domainFacade; 00301 00303 AnimationModel *animationModel; 00304 00307 UndoHistory *undoHistory; 00308 }; 00309 00310 #endif