00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef ANIMATIONMODEL_H
00021 #define ANIMATIONMODEL_H
00022
00023 #include "src/config.h"
00024 #include "src/presentation/observer.h"
00025 #include "src/presentation/frontends/frontend.h"
00026 #include "src/technical/video/videoencoder.h"
00027 #include "frame.h"
00028
00029 #include <cstring>
00030 #include <vector>
00031
00032 using namespace std;
00033
00043 class AnimationModel
00044 {
00045 public:
00046 AnimationModel();
00047 virtual ~AnimationModel();
00048
00054 void attatch(Observer *o);
00055
00061 void detatch(Observer *o);
00062
00068 void registerFrontend(Frontend *frontend);
00069
00074 Frontend* getFrontend();
00075
00081 void notifyAdd(const vector<char*>& frames, unsigned int index);
00082
00088 void notifyRemove(unsigned int fromFrame, unsigned int toFrame);
00089
00096 void notifyMove(unsigned int fromFrame, unsigned int toFrame, unsigned int movePosition);
00097
00102 void notifyNewActiveFrame(int frameNumber);
00103
00107 void notifyClear();
00108
00113 void notifyPlayFrame(int frameNumber);
00114
00119 void notifyNewScene(int index);
00120
00125 void notifyRemoveScene(int sceneNumber);
00126
00132 void notifyMoveScene(int sceneNumber, int movePosition);
00133
00140 void notifyNewActiveScene(int sceneNumber, vector<char*> framePaths,
00141 Frontend *frontend);
00142
00148 void notifyAnimationChanged(int frameNumber);
00149
00157 virtual const vector<char*> addFrames(const vector<char*>& frameNames,
00158 unsigned int index) = 0;
00159
00168 virtual const vector<char*> removeFrames( unsigned int fromFrame,
00169 unsigned int toFrame) = 0;
00170
00178 virtual void moveFrames(unsigned int fromFrame, unsigned int toFrame,
00179 unsigned int movePosition) = 0;
00180
00190 virtual int addSound(unsigned int frameNumber, const char *filename) = 0;
00191
00198 virtual void removeSound(unsigned int frameNumber, unsigned int soundNumber) = 0;
00199
00207 virtual void setSoundName(unsigned int frameNumber, unsigned int soundNumber,
00208 char* soundName) = 0;
00209
00217 virtual Frame* getFrame(unsigned int frameNumber, unsigned int sceneNumber) = 0;
00218
00225 virtual Frame* getFrame(unsigned int frameNumber) = 0;
00226
00231 virtual unsigned int getModelSize() = 0;
00232
00238 virtual unsigned int getSceneSize(int sceneNumber) = 0;
00239
00244 virtual unsigned int getNumberOfScenes() = 0;
00245
00250 virtual void setActiveFrame(int frameNumber) = 0;
00251
00256 virtual void playFrame(int frameNumber) = 0;
00257
00263 virtual int getActiveFrameNumber() = 0;
00264
00265
00269 virtual void clear() = 0;
00270
00275 virtual const char* getProjectFile() = 0;
00276
00281 virtual bool openProject(const char *filename) = 0;
00282
00288 virtual bool saveProject(const char *filename) = 0;
00289
00294 virtual bool newProject() = 0;
00295
00300 virtual bool isUnsavedChanges() = 0;
00301
00306 virtual void setActiveScene(int sceneNumber) = 0;
00307
00312 virtual int getActiveSceneNumber() = 0;
00313
00319 virtual void newScene(int index) = 0;
00320
00326 virtual void removeScene(int sceneNumber) = 0;
00327
00334 virtual void moveScene(int sceneNumber, int movePosition) = 0;
00335
00341 virtual bool initAudioDevice() = 0;
00342
00347 virtual void shutdownAudioDevice() = 0;
00348
00354 virtual void animationChanged(const char *alteredFile) = 0;
00355
00362 virtual bool exportToVideo(VideoEncoder *encoder) = 0;
00363
00369 virtual bool exportToCinerella(const char *file) = 0;
00370
00371 protected:
00376 Frontend *frontend;
00377
00378 private:
00383 vector<Observer*> observers;
00384 };
00385
00386 #endif