00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef SPRITEEDITOR_H
00023 #define SPRITEEDITOR_H
00024
00025 #include <gtkmm/button.h>
00026 #include <gtkmm/checkbutton.h>
00027 #include <gtkmm/comboboxtext.h>
00028 #include <gtkmm/dialog.h>
00029 #include <gtkmm/entry.h>
00030 #include <gtkmm/label.h>
00031 #include <gtkmm/image.h>
00032 #include <gtkmm/progressbar.h>
00033 #include <gtkmm/window.h>
00034
00035 #include "sprite.h"
00036
00041 class SpriteEditor: public Gtk::Window {
00042 public:
00044 SpriteEditor();
00045
00047 void clear();
00048
00052 void set_sprite_data(const Sprite &spr);
00053
00057 Sprite get_sprite_data() const { return m_Sprite; }
00058
00059 private:
00061 void construct();
00062
00064 void update_progress_label();
00065
00067 void on_save();
00068
00070 void on_export();
00071
00073 void on_close();
00074
00076 void on_preview_animation();
00077
00079 void on_loop_cb_toggled();
00080
00082 void on_anim_cb_changed();
00083
00085 void on_amend_button_clicked();
00086
00088 void on_new_animation_button_clicked();
00089
00091 void on_delete_animation_button_clicked();
00092
00094 void on_add_frame_button_clicked();
00095
00097 void on_delete_frame_button_clicked();
00098
00100 void on_prev_frame_button_clicked();
00101
00103 void on_next_frame_button_clicked();
00104
00105
00106 Gtk::Label *m_AnimLabel;
00107 Gtk::Label *m_FrameLabel;
00108 Gtk::Label *m_TimeLabel;
00109 Gtk::Label *m_SfxLabel;
00110
00111
00112 Gtk::CheckButton *m_LoopCB;
00113
00114
00115 Gtk::Entry *m_TimeEntry;
00116 Gtk::Entry *m_SfxEntry;
00117
00118
00119 Gtk::Image *m_Image;
00120
00121
00122 Gtk::Button *m_SaveButton;
00123 Gtk::Button *m_ExportButton;
00124 Gtk::Button *m_CloseButton;
00125 Gtk::Button *m_PreviewButton;
00126 Gtk::Button *m_NewAnimButton;
00127 Gtk::Button *m_DeleteAnimButton;
00128 Gtk::Button *m_AddFrameButton;
00129 Gtk::Button *m_DeleteFrameButton;
00130 Gtk::Button *m_PrevFrameButton;
00131 Gtk::Button *m_NextFrameButton;
00132 Gtk::Button *m_AmendButton;
00133
00134
00135 Gtk::ComboBoxText *m_AnimCB;
00136
00138 Glib::ustring m_SpritePath;
00139
00141 Sprite m_Sprite;
00142
00144 int m_CurFrame;
00145 };
00146
00151 class AnimPlayer: public Gtk::Dialog {
00152 public:
00156 AnimPlayer(const Animation &anim);
00157
00158 private:
00160 void construct();
00161
00162
00163 bool on_timeout();
00164
00165
00166 void on_play_clicked();
00167
00168
00169 void on_stop_clicked();
00170
00171
00172 Gtk::Image *m_FrameImg;
00173
00174
00175 Gtk::Label *m_AnimLabel;
00176
00177
00178 Gtk::ProgressBar *m_ProgBar;
00179
00180
00181 Gtk::Button *m_PlayButton;
00182 Gtk::Button *m_StopButton;
00183
00184
00185 sigc::connection m_TimerSlot;
00186
00188 int m_CurFrame;
00189
00191 Animation m_Animation;
00192 };
00193
00194 #endif