2 * This file is part of ShapeFusion (Copyright 2000 Tito Dal Canton)
4 * ShapeFusion is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * ShapeFusion is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with ShapeFusion; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wx/docview.h"
23 #include "wx/treectrl.h"
24 #include "wx/spinctrl.h"
25 #include "wx/statline.h"
26 #include "../ShapeFusionApp.h"
27 #include "ShapesTreeItemData.h"
28 #include "CTBrowser.h"
30 #include "BitmapBrowser.h"
31 #include "BitmapView.h"
32 #include "FrameBrowser.h"
33 #include "FrameView.h"
34 #include "SequenceView.h"
35 #include "../ShapeFusionMenus.h"
37 class ShapesView: public wxView
39 DECLARE_DYNAMIC_CLASS(ShapesView)
49 CB_ENABLE_TRANSPARENCY,
61 FIELD_FRAME_SCALEFACTOR,
67 FIELD_SEQ_NUMBER_OF_VIEWS,
68 FIELD_SEQ_FRAMES_PER_VIEW,
69 FIELD_SEQ_TICKS_PER_FRAME,
73 FIELD_SEQ_XFER_MODE_PERIOD,
74 FIELD_SEQ_FIRST_FRAME_SND,
75 FIELD_SEQ_KEY_FRAME_SND,
76 FIELD_SEQ_LAST_FRAME_SND,
83 wxBoxSizer *dummy_sizer;
84 // widgets for collection info
85 wxBoxSizer *coll_sizer;
86 wxStaticBox *coll_static_box;
87 wxStaticBoxSizer *coll_inner_box;
88 wxStaticText *coll_text;
89 // widgets for chunk info
90 wxBoxSizer *chunk_sizer;
91 wxStaticBox *chunk_static_box;
92 wxStaticBoxSizer *chunk_inner_box;
93 wxStaticText *chunk_undef_label;
94 wxFlexGridSizer *chunk_grid;
95 wxStaticText *chunk_version_label,
99 wxTextCtrl *chunk_version_field,
102 wxChoice *chunk_type_menu;
103 // widgets for color tables section
104 wxBoxSizer *ct_outer_sizer;
106 wxStaticText *ct_count_label;
107 wxStaticBox *ct_edit_static_box;
108 wxStaticBoxSizer *ct_edit_box;
110 wxBoxSizer *ct_inner_edit_box;
111 wxCheckBox *ct_self_lumin_checkbox;
112 wxButton *ct_gradient_button;
113 // widgets for bitmaps section
114 wxBoxSizer *b_outer_sizer,
117 wxStaticText *b_count_label;
118 wxStaticBox *b_edit_static_box;
119 wxStaticBoxSizer *b_edit_box;
120 wxCheckBox *b_order_checkbox,
121 *b_transparency_checkbox;
122 wxStaticText *b_info_label;
124 // widgets for frames section
125 wxBoxSizer *f_outer_sizer,
128 wxStaticText *f_count_label;
129 wxStaticBox *f_edit_static_box;
130 wxStaticBoxSizer *f_edit_box;
131 wxStaticText *f_bitmap_label;
132 wxSpinCtrl *f_bitmap_id;
133 wxTextCtrl *f_origin_x_field,
137 *f_scalefactor_field;
138 wxCheckBox *f_xmirror_checkbox,
140 *f_keypoint_checkbox;
142 wxFlexGridSizer *f_origin_box;
143 wxStaticText *f_origin_x_label,
147 *f_scalefactor_label,
155 wxTextCtrl *f_mli_field,
162 // widgets for sequences section
163 wxStaticBoxSizer *s_outer_sizer;
164 wxStaticBox *s_outer_static_box;
166 wxStaticText *s_name_label;
167 wxTextCtrl *s_name_field;
168 wxButton *s_delete_button;
170 wxFlexGridSizer *s_grid_box;
171 wxStaticText *s_type_label;
172 wxChoice *s_type_menu;
173 wxStaticText *s_fpv_label;
174 wxTextCtrl *s_fpv_field;
175 wxStaticText *s_tpf_label;
176 wxTextCtrl *s_tpf_field;
177 wxStaticText *s_lf_label;
178 wxTextCtrl *s_lf_field;
179 wxStaticText *s_kf_label;
180 wxTextCtrl *s_kf_field;
181 wxPanel *s_separator;
182 wxFlexGridSizer *s_grid_box2;
183 wxStaticText *s_xfermode_label;
184 wxChoice *s_xfermode_menu;
185 wxStaticText *s_xferperiod_label;
186 wxTextCtrl *s_xferperiod_field;
187 wxStaticText *s_ffs_label,
190 wxTextCtrl *s_ffs_field,
202 DECLARE_EVENT_TABLE();
208 bool OnCreate(wxDocument *doc, long flags);
209 void OnDraw(wxDC *dc);
210 void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
211 bool OnClose(bool deleteWindow = true);
212 wxTreeItemId GetSequencesTreeItem(unsigned int collection, unsigned int version) const;
213 // menu event callbacks
214 void MenuFileOpen(wxCommandEvent &e);
215 void MenuFileSave(wxCommandEvent&);
216 void MenuFileQuit(wxCommandEvent &e);
217 void MenuEditCopy(wxCommandEvent& e);
218 void MenuEditDelete(wxCommandEvent &e);
219 void MenuEditPaste(wxCommandEvent& e);
220 void MenuViewCT(wxCommandEvent &e);
221 void MenuViewTNSize(wxCommandEvent &e);
222 void MenuViewTransparency(wxCommandEvent &e);
223 void MenuViewCenterOrigin(wxCommandEvent &e);
224 void MenuShapesAddColorTable(wxCommandEvent &e);
225 void MenuShapesSaveColorTable(wxCommandEvent &e);
226 void MenuShapesSaveColorTableToPS(wxCommandEvent &e);
227 void MenuShapesAddBitmap(wxCommandEvent &e);
228 void MenuShapesExportBitmap(wxCommandEvent &e);
229 void MenuShapesExportBitmapMask(wxCommandEvent &e);
230 void MenuShapesExportBitmaps(wxCommandEvent &e);
231 void MenuShapesExportBitmapMasks(wxCommandEvent &e);
232 void MenuShapesNewFrame(wxCommandEvent &e);
233 void MenuShapesNewSequence(wxCommandEvent &e);
234 void MenuShapesGeneratePatch(wxCommandEvent& e);
235 void MenuShapesImportPatch(wxCommandEvent& e);
237 void OnTreeSelect(wxTreeEvent &e);
238 void OnBitmapSelect(wxCommandEvent &e);
239 void BitmapDelete(wxCommandEvent &e);
240 void OnCTSelect(wxCommandEvent &e);
241 void CTColorSelect(wxCommandEvent &e);
242 void CTColorChanged(wxCommandEvent &e);
243 void ToggleSelfLuminCheckbox(wxCommandEvent &e);
244 void MakeCTGradient(wxCommandEvent &e);
245 void ToggleBitmapCheckboxes(wxCommandEvent &e);
246 void OnFrameSelect(wxCommandEvent &e);
247 void FrameDelete(wxCommandEvent &e);
248 void OnFramePointDrag(wxCommandEvent &e);
249 void BitmapIndexSpin(wxSpinEvent &e);
250 void ToggleFrameCheckboxes(wxCommandEvent &e);
251 void EditFrameFields(wxCommandEvent &e);
252 void DeleteSequence(wxCommandEvent &e);
253 void EditSequenceType(wxCommandEvent &e);
254 void EditSequenceXferMode(wxCommandEvent &e);
255 void EditSequenceFields(wxCommandEvent &e);
257 void DoCopyBitmap(int which);
258 void DoPasteBitmap(int which);
260 void DoCopyChunk(unsigned int coll, unsigned int chunk);
261 void DoPasteChunk(unsigned int coll, unsigned int chunk);
263 void DoDeleteColorTable(int which);
264 void DoDeleteBitmap(int which);
265 void DoDeleteFrame(int which);