gcsx_animgroupedit.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* GCSx
  2. ** ANIMGROUPEDIT.H
  3. **
  4. ** Animation group support
  5. ** Expands basic AnimGroup to include editor functionality
  6. */
  7. /*****************************************************************************
  8. ** Copyright (C) 2003-2006 Janson
  9. **
  10. ** This program is free software; you can redistribute it and/or modify
  11. ** it under the terms of the GNU General Public License as published by
  12. ** the Free Software Foundation; either version 2 of the License, or
  13. ** (at your option) any later version.
  14. **
  15. ** This program is distributed in the hope that it will be useful,
  16. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ** GNU General Public License for more details.
  19. **
  20. ** You should have received a copy of the GNU General Public License
  21. ** along with this program; if not, write to the Free Software
  22. ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
  23. *****************************************************************************/
  24. #ifndef __GCSx_ANIMGROUPEDIT_H_
  25. #define __GCSx_ANIMGROUPEDIT_H_
  26. class AnimGroupEdit : public AnimGroup, virtual public SaveLoad {
  27. protected:
  28. // Has the library been modified from initial state (from empty if new)
  29. int headerModified;
  30. int contentModified;
  31. int disassociated;
  32. // Our node on the world browser
  33. TreeView* browserNode;
  34. // Set us as modified
  35. // Setting content modified also loads from cache if needed
  36. // Call these before actually making any modifications
  37. // (if header changes affect content, call both modifieds first)
  38. void setHeaderModified();
  39. void setContentModified();
  40. public:
  41. // Id of 0 = we're going to load immediately
  42. // Any other id = we start out modified
  43. AnimGroupEdit(class WorldEdit* myWorld, int myId = 0); // Starts with default settings
  44. virtual ~AnimGroupEdit();
  45. // Tells us to disassociate ourselves from anything, we've been "deleted"
  46. // or that we've been "readded" again
  47. // FileException means couldn't decache, and nothing was done
  48. void disassociate() throw_File;
  49. // Node is world browser node that we readd to
  50. void reassociate(TreeView* node);
  51. class WorldEdit* getWorldEdit() { return dynamic_cast<WorldEdit*>(world); }
  52. // Change properties; handles undo/update events
  53. void setName(const std::string& newName, Window* srcWin = NULL, Window* exWin = NULL) throw_Undo;
  54. void setSize(int newCount, Window* srcWin = NULL, Window* exWin = NULL) throw_Undo; // Must LOCK first
  55. // Make changes to animations and sequence names
  56. // Sends update events; Must LOCK first
  57. // load/saveAnim doesn't touch name
  58. // IDs are one-based!
  59. void loadAnim(int id, AnimSequence* copyAnim);
  60. void saveAnim(int id, const AnimSequence* newAnim, class Window* exWin = NULL);
  61. void loadAnimName(int id, std::string* copyName);
  62. void saveAnimName(int id, const std::string* newName, class Window* exWin = NULL);
  63. // Returns true if OK pressed
  64. // Locks and unlocks library
  65. int propertiesDialog(Window* srcWin = NULL, Window* exWin = NULL);
  66. // Browse window (editor)
  67. void openBrowseWindow();
  68. // Animation edit window (editor)
  69. void openEditWindow(int subid = 0);
  70. // Tells animgroup to add itself to the world browser node
  71. void addToBrowser(TreeView* node, int makeCurrent = 1);
  72. void dropBrowser(); // Called if animgroup gets dropped from browser
  73. // Treeview event handling
  74. int treeviewEvent(int code, int command, int check);
  75. static int treeviewEventWrap(void* ptr, int code, int command, int check);
  76. // File access
  77. int isHeaderModified() const;
  78. int isContentModified() const;
  79. Uint32 saveHeader(FileWrite* file) throw_File;
  80. void saveContent(FileWrite* file) throw_File;
  81. void saveSuccess();
  82. void cachedContent(FileRead* file, int oldData);
  83. };
  84. #endif