source: golgotha/src/golg/editor/editor.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 6.0 KB
RevLine 
[80]1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef G1_EDITOR_HH
10#define G1_EDITOR_HH
11
12#include "editor/contedit.hh"
13#include "math/num_type.hh"
14#include "device/event.hh"
15#include "device/device.hh"
16#include "string/string.hh"
17#include "editor/pmenu.hh"
18#include "objs/model_id.hh"
19#include "map.hh"
20#include "mess_id.hh"
21#include "cwin_man.hh"
22#include "editor/dialogs/scene.hh"
23#include "math/vector.hh"
24#include "controller.hh"
25#include "editor/dialogs/debug_win.hh"
26#include "map_man.hh"
27
28class r1_render_window_class;
29class i4_pull_menu_class;
30class g1_editor_key_item;
31class r1_render_api_class;
32class g1_object_class;
33class i4_image_class;
34class g1_movie_flow_class;
35class g1_time_line;
36class i4_text_input_class;
37class g1_path_window_class;
38
39class g1_editor_class : public g1_cwin_man_class
40{
41  struct undo_info
42  {
43    int head, tail, redo_tail, max, allow;
44    undo_info()
45    {
46      allow=1;
47      head=tail=redo_tail=0;
48      max=32;
49    }
50  } undo;
51
52  void show_undo_state();
53  void save_undo_info(w32 sections, i4_const_str &fname);
54
55
56  i4_window_class **tool_window;
57  g1_time_line *time_line;
58
59  int t_views;
60  int vert_noise_amount;
61  enum { MAX_VIEWS=4};
62  g1_controller_edit_class *views[MAX_VIEWS];
63  r1_render_window_class *view_wins[MAX_VIEWS];
64
65  i4_bool use_view_state;
66  g1_view_state_class view_states[MAX_VIEWS];
67
68  void set_edit_mode(i4_bool yes_no);
69
70  i4_bool need_save, can_undo, can_redo, selection, paste_buffer_valid, edit_mode,
71    profile_view, debug_view;
72
73  i4_image_class *pick_act, *pick_pass;
74 
75  g1_path_window_class *path_window;
76
77  i4_parent_window_class *objects_window;
78
79  i4_event_handler_reference_class<i4_parent_window_class> radar_parent;
80  void create_radar();
81
82  i4_string_manager_class e_strs;
83
84  g1_map_class *create_default_map(int w, int h,
85                                   const i4_const_str &name);
86
87  i4_pull_menu_class *menu;
88  g1_editor_key_item *command_keys[G1_EDITOR_LAST];
89  void save();
90
91
92  virtual void init(i4_parent_window_class *parent,
93                    i4_graphical_style_class *style,
94                    i4_image_class *root_window,
95                    i4_display_class *display,
96                    i4_window_manager_class *wm);
97
98
99  virtual void uninit();
100
101  // this will load an image an convert it to be a compatable bit depth with the frame buffer
102  i4_image_class *load_compatiable_image(const i4_const_str &fname);
103
104  void create_objects_window();
105  void get_map_cell_from_type(w32 type, g1_map_cell_class &ct);
106  void close_windows();
107
108  struct window_info
109  {   
110    sw32 x,y;   
111    window_info() { x=0; y=0; }
112    void save(i4_window_class *w) { x=w->x(); y=w->y(); }
113  };
114
115  window_info wi_scene, wi_objects;
116 
117  g1_scene_editor_class scene_edit;
118
119  void merge_terrain();
120  i4_bool merge_terrain_ok(i4_user_message_event_class *ev);
121
122  void open_file();
123  void open_dll();
124
125  void open_file_ok(i4_user_message_event_class *ev);
126  void open_dll_ok(i4_user_message_event_class *ev);
127
128  void open_saveas();
129  void open_saveas_ok(i4_user_message_event_class *ev);
130
131  void open_resize_level_window();
132  void resize_level();
133
134  void open_new_level_window(); 
135
136  void new_level_from_dialog();
137
138  struct { i4_text_input_class *w, *h; int orient; } resize_dialog;
139  struct { i4_text_input_class *amount; } terrain_noise_dialog;
140  struct { i4_text_input_class *w, *h, *name; } new_dialog;
141
142
143  struct { i4_text_input_class *name; } sky_dialog;
144  void create_sky_window();
145  void set_sky();
146
147  void load_height_bitmap();
148  void save_height_bitmap();
149  void load_height_bitmap_ok(i4_event *ev);
150  void save_height_bitmap_ok(i4_event *ev);
151
152public:
153  struct movement_info
154  {
155    i4_bool pan_up, pan_down,
156      pan_left, pan_right,
157      pan_forward, pan_backward,
158      rotate_left, rotate_right,
159      rotate_up, rotate_down;
160  } movement;
161
162
163  // used for dialog boxes that need to be completed
164  i4_event_handler_reference_class<i4_parent_window_class> modal_window;   
165
166  void close_modal();
167  i4_parent_window_class *create_modal(w32 w, w32 h, char *title_res);
168
169  void add_undo(w32 sections);
170  void do_undo();
171  void do_redo();
172
173  i4_bool have_map() { return g1_map_is_loaded(); }
174  g1_map_class *get_map() { return g1_get_map(); }
175
176  i4_image_class *delete_icon;
177
178 
179  virtual void create_views();
180
181  virtual void destroy_views();
182
183  void redraw_all();
184  const i4_const_str &get_editor_string(char *res_name) { return e_strs.get(res_name); }
185  i4_const_str *get_editor_array(char *res_name) { return e_strs.get_array(res_name); }
186
187  // the pointer 'window' is passed via reference because it will be set to 0,
188  // when the tool window is replaced (at a later time)
189  void set_tool_window(i4_window_class **window);
190
191  void changed();
192  void do_command(w16 command_id);
193  void select_all_verts();
194
195  g1_editor_class();
196
197  virtual void receive_event(i4_event *ev);
198
199
200  void major_mode_change()
201  {
202    if (edit_mode)
203      for (w32 i=0; i<t_views; i++)
204        views[i]->setup_mode();
205  }
206
207  i4_bool in_editor() { return edit_mode; }
208  void flatten_terrain();
209
210  void smooth_terrain();
211  void smooth_terrain_ok();
212
213  void noise_terrain();
214  void noise_terrain_ok();
215
216  int get_current_splines(i4_spline_class **buffer, int buf_size);
217
218  void mark_selected_verts_for_undo_save();
219  void unmark_all_selected_verts_for_undo_save();
220
221  virtual void save_views(g1_saver_class *fp);
222  virtual void load_views(g1_loader_class *fp);
223
224
225  g1_controller_edit_class *get_current_view();
226};
227
228extern g1_editor_class g1_editor_instance;
229
230
231#endif
Note: See TracBrowser for help on using the repository browser.