123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- /* GCSx
- ** ANIMGROUPEDIT.H
- **
- ** Animation group support
- ** Expands basic AnimGroup to include editor functionality
- */
- /*****************************************************************************
- ** Copyright (C) 2003-2006 Janson
- **
- ** 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
- #ifndef __GCSx_ANIMGROUPEDIT_H_
- #define __GCSx_ANIMGROUPEDIT_H_
- class AnimGroupEdit : public AnimGroup, virtual public SaveLoad {
- protected:
- // Has the library been modified from initial state (from empty if new)
- int headerModified;
- int contentModified;
- int disassociated;
- // Our node on the world browser
- TreeView* browserNode;
- // Set us as modified
- // Setting content modified also loads from cache if needed
- // Call these before actually making any modifications
- // (if header changes affect content, call both modifieds first)
- void setHeaderModified();
- void setContentModified();
- public:
- // Id of 0 = we're going to load immediately
- // Any other id = we start out modified
- AnimGroupEdit(class WorldEdit* myWorld, int myId = 0); // Starts with default settings
- virtual ~AnimGroupEdit();
-
- // Tells us to disassociate ourselves from anything, we've been "deleted"
- // or that we've been "readded" again
- // FileException means couldn't decache, and nothing was done
- void disassociate() throw_File;
- // Node is world browser node that we readd to
- void reassociate(TreeView* node);
- class WorldEdit* getWorldEdit() { return dynamic_cast<WorldEdit*>(world); }
-
- // Change properties; handles undo/update events
- void setName(const std::string& newName, Window* srcWin = NULL, Window* exWin = NULL) throw_Undo;
- void setSize(int newCount, Window* srcWin = NULL, Window* exWin = NULL) throw_Undo; // Must LOCK first
- // Make changes to animations and sequence names
- // Sends update events; Must LOCK first
- // load/saveAnim doesn't touch name
- // IDs are one-based!
- void loadAnim(int id, AnimSequence* copyAnim);
- void saveAnim(int id, const AnimSequence* newAnim, class Window* exWin = NULL);
- void loadAnimName(int id, std::string* copyName);
- void saveAnimName(int id, const std::string* newName, class Window* exWin = NULL);
-
- // Returns true if OK pressed
- // Locks and unlocks library
- int propertiesDialog(Window* srcWin = NULL, Window* exWin = NULL);
-
- // Browse window (editor)
- void openBrowseWindow();
-
- // Animation edit window (editor)
- void openEditWindow(int subid = 0);
- // Tells animgroup to add itself to the world browser node
- void addToBrowser(TreeView* node, int makeCurrent = 1);
- void dropBrowser(); // Called if animgroup gets dropped from browser
- // Treeview event handling
- int treeviewEvent(int code, int command, int check);
- static int treeviewEventWrap(void* ptr, int code, int command, int check);
-
- // File access
- int isHeaderModified() const;
- int isContentModified() const;
- Uint32 saveHeader(FileWrite* file) throw_File;
- void saveContent(FileWrite* file) throw_File;
- void saveSuccess();
- void cachedContent(FileRead* file, int oldData);
- };
- #endif
|