OSDN Git Service

イニシャルコミット。
[marathon/ShapeFusion.git] / Shapes / ShapesView.h
1 /*
2  * This file is part of ShapeFusion (Copyright 2000 Tito Dal Canton)
3  *
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.
8  *
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.
13  *
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
17 */
18
19 #ifndef SHAPESVIEW_H
20 #define SHAPESVIEW_H
21
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"
29 #include "CTView.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"
36
37 class ShapesView: public wxView
38 {
39     DECLARE_DYNAMIC_CLASS(ShapesView)
40 private:
41         // control ids
42         enum {
43                 // color tables
44                 CB_SELF_LUMINESCENT,
45                 BTN_GRADIENT,
46                 // bitmaps
47                 BITMAP_BROWSER,
48                 CB_COLUMN_ORDER,
49                 CB_ENABLE_TRANSPARENCY,
50                 // frames
51                 FRAME_BROWSER,
52                 FRAME_VIEW,
53                 FIELD_BITMAP_INDEX,
54                 CB_XMIRROR,
55                 CB_YMIRROR,
56                 CB_KEYPOINT,
57                 FIELD_ORIGIN_X,
58                 FIELD_ORIGIN_Y,
59                 FIELD_KEY_X,
60                 FIELD_KEY_Y,
61                 FIELD_FRAME_SCALEFACTOR,
62                 FIELD_MIN_LIGHT_INT,
63                 // sequences
64                 FIELD_SEQ_NAME,
65                 BTN_DELETE_SEQ,
66                 MENU_SEQ_TYPE,
67                 FIELD_SEQ_NUMBER_OF_VIEWS,
68                 FIELD_SEQ_FRAMES_PER_VIEW,
69                 FIELD_SEQ_TICKS_PER_FRAME,
70                 FIELD_SEQ_LOOP_FRAME,
71                 FIELD_SEQ_KEY_FRAME,
72                 MENU_SEQ_XFER_MODE,
73                 FIELD_SEQ_XFER_MODE_PERIOD,
74                 FIELD_SEQ_FIRST_FRAME_SND,
75                 FIELD_SEQ_KEY_FRAME_SND,
76                 FIELD_SEQ_LAST_FRAME_SND,
77         };
78
79         wxBoxSizer                      *mainbox;
80         wxPanel                         *main_panel;
81         wxMenuBar                       *menubar;
82         wxTreeCtrl                      *colltree;
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,
96                                                                 *chunk_type_label,
97                                                                 *chunk_flags_label,
98                                                                 *chunk_sf_label;
99         wxTextCtrl                                      *chunk_version_field,
100                                                                 *chunk_flags_field,
101                                                                 *chunk_sf_field;
102         wxChoice                                        *chunk_type_menu;
103         // widgets for color tables section
104         wxBoxSizer                      *ct_outer_sizer;
105         CTBrowser                       *ctb;
106         wxStaticText            *ct_count_label;
107         wxStaticBox                     *ct_edit_static_box;
108         wxStaticBoxSizer        *ct_edit_box;
109         CTView                                  *ct_view;
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,
115                                                 *b_edit_inner_box;
116         BitmapBrowser           *bb;
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;
123         BitmapView                      *b_view;
124         // widgets for frames section
125         wxBoxSizer                      *f_outer_sizer,
126                                                 *f_edit_inner_box;
127         FrameBrowser            *fb;
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,
134                                                 *f_origin_y_field,
135                                                 *f_key_x_field,
136                                                 *f_key_y_field,
137                                                 *f_scalefactor_field;
138         wxCheckBox                      *f_xmirror_checkbox,
139                                                 *f_ymirror_checkbox,
140                                                 *f_keypoint_checkbox;
141         FrameView                       *f_view;
142         wxFlexGridSizer         *f_origin_box;
143         wxStaticText            *f_origin_x_label,
144                                                 *f_origin_y_label,
145                                                 *f_key_x_label,
146                                                 *f_key_y_label,
147                                                 *f_scalefactor_label,
148                                                 *f_mli_label,
149                                                 *f_w_left_label,
150                                                 *f_w_right_label,
151                                                 *f_w_top_label,
152                                                 *f_w_bottom_label,
153                                                 *f_w_x0_label,
154                                                 *f_w_y0_label;
155         wxTextCtrl                      *f_mli_field,
156                                                 *f_w_left_field,
157                                                 *f_w_right_field,
158                                                 *f_w_top_field,
159                                                 *f_w_bottom_field,
160                                                 *f_w_x0_field,
161                                                 *f_w_y0_field;
162         // widgets for sequences section
163         wxStaticBoxSizer        *s_outer_sizer;
164         wxStaticBox                     *s_outer_static_box;
165         wxBoxSizer                      *s_box1;
166         wxStaticText                    *s_name_label;
167         wxTextCtrl                              *s_name_field;
168         wxButton                                *s_delete_button;
169         wxBoxSizer                      *s_box2;
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,
188                                                                 *s_kfs_label,
189                                                                 *s_lfs_label;
190         wxTextCtrl                                      *s_ffs_field,
191                                                                 *s_kfs_field,
192                                                                 *s_lfs_field;
193         SequenceView            *s_fb;
194
195         int             mSelectedColl,
196                         mSelectedVers,
197                         mSelectedSequence,
198                         mViewColorTable;
199     wxFrame     *mFrame;
200         
201 protected:
202         DECLARE_EVENT_TABLE();
203
204 public:
205         ShapesView();
206         ~ShapesView(void);
207         
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);
236         // control callbacks
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);
256
257         void DoCopyBitmap(int which);
258         void DoPasteBitmap(int which);
259
260         void DoCopyChunk(unsigned int coll, unsigned int chunk);
261         void DoPasteChunk(unsigned int coll, unsigned int chunk);
262
263         void DoDeleteColorTable(int which);
264         void DoDeleteBitmap(int which);
265         void DoDeleteFrame(int which);
266
267 };
268
269 #endif