File indexing completed on 2024-05-12 16:23:27
0001 /*************************************************************************** 0002 * Copyright (C) 2013 by Linuxstopmotion contributors; * 0003 * see the AUTHORS file for details. * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 #ifndef COMMANDADD_H 0021 #define COMMANDADD_H 0022 0023 #include "command.h" 0024 0025 #include <stdint.h> 0026 #include <string> 0027 #include <vector> 0028 0029 class ErrorHandler; 0030 class FileNameVisitor; 0031 class Frame; 0032 class AnimationImpl; 0033 class TemporaryWorkspaceFile; 0034 0035 class CommandAdd : public Command { 0036 public: 0037 /** 0038 * @param count The number of frames to reserve; {@ref addFrame} can 0039 * subsequently be called this many times without throwing an exception. 0040 */ 0041 CommandAdd(AnimationImpl& model, int toScene, int toFrame, int count); 0042 ~CommandAdd(); 0043 /** 0044 * Adds a frame to the add command. 0045 * @param frame Ownership is passed. 0046 */ 0047 void addFrame(Frame* frame); 0048 Command* execute(); 0049 void accept(FileNameVisitor& v) const; 0050 private: 0051 AnimationImpl& sv; 0052 std::vector<Frame*> frames; 0053 int scene; 0054 int frame; 0055 }; 0056 0057 class CommandAddFactory : public CommandFactory { 0058 AnimationImpl& sv; 0059 public: 0060 CommandAddFactory(AnimationImpl& model); 0061 ~CommandAddFactory(); 0062 Command* create(::Parameters& ps, ErrorHandler& e); 0063 class Parameters : public ::Parameters { 0064 int32_t sc; 0065 int32_t fr; 0066 int32_t frameCount; 0067 TemporaryWorkspaceFile* twfs; 0068 int32_t twfCount; 0069 int32_t parameterCount; 0070 public: 0071 Parameters(int scene, int frame, int count); 0072 ~Parameters(); 0073 /** 0074 * Add a frame. 0075 * @filename The filename of the image. Ownership is not passed. 0076 * @return The full path of the workspace file created. 0077 */ 0078 const char* addFrame(const char* filename); 0079 int32_t getInteger(int32_t min, int32_t max); 0080 int32_t getHowMany(); 0081 void getString(std::string& out, const char* pattern); 0082 /** 0083 * If this function is not called before destruction, copied files 0084 * held by this function are deleted. 0085 */ 0086 void retainFiles(); 0087 }; 0088 }; 0089 0090 #endif