Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CmdTheaterDlg.cpp
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: CmdTheaterDlg.cpp
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Operational Command Dialog (Theater Map Tab)
13 */
14 
15 #include "MemDebug.h"
16 #include "CmdTheaterDlg.h"
17 #include "CmdDlg.h"
18 #include "CmpnScreen.h"
19 #include "Galaxy.h"
20 #include "Starshatter.h"
21 #include "StarSystem.h"
22 #include "Campaign.h"
23 #include "Combatant.h"
24 #include "CombatGroup.h"
25 #include "CombatUnit.h"
26 #include "ShipDesign.h"
27 
28 #include "Game.h"
29 #include "DataLoader.h"
30 #include "Button.h"
31 #include "ComboBox.h"
32 #include "ListBox.h"
33 #include "Slider.h"
34 #include "Video.h"
35 #include "Keyboard.h"
36 #include "Mouse.h"
37 #include "ParseUtil.h"
38 #include "FormatUtil.h"
39 
40 // +--------------------------------------------------------------------+
41 // DECLARE MAPPING FUNCTIONS:
42 
47 
48 // Supported Selection Modes:
49 
50 const int SELECT_NONE = -1;
51 const int SELECT_SYSTEM = 0;
52 const int SELECT_PLANET = 1;
53 const int SELECT_REGION = 2;
54 const int SELECT_STATION = 3;
55 const int SELECT_STARSHIP = 4;
56 const int SELECT_FIGHTER = 5;
57 
58 const int VIEW_GALAXY = 0;
59 const int VIEW_SYSTEM = 1;
60 const int VIEW_REGION = 2;
61 
62 // +--------------------------------------------------------------------+
63 
65 : FormWindow(s, 0, 0, s->Width(), s->Height()), CmdDlg(mgr), manager(mgr),
66 map_theater(0), map_view(0), stars(0), campaign(0)
67 {
70 
71  Init(def);
72 }
73 
75 {
76 }
77 
78 // +--------------------------------------------------------------------+
79 
80 void
82 {
83  map_theater = FindControl(400);
84 
85  RegisterCmdControls(this);
86 
87  if (btn_save)
89 
90  if (btn_exit)
92 
93  for (int i = 0; i < 5; i++) {
94  if (btn_mode[i])
96  }
97 
98  if (map_theater)
99  map_view = new(__FILE__,__LINE__) MapView(map_theater);
100 
101  for (int i = 0; i < 3; i++) {
102  view_btn[i] = (Button*) FindControl(401 + i);
104  }
105 
106  zoom_in_btn = (Button*) FindControl(410);
107  zoom_out_btn = (Button*) FindControl(411);
108 }
109 
110 // +--------------------------------------------------------------------+
111 
112 void
114 {
115  mode = MODE_THEATER;
116 
118  ShowCmdDlg();
119 
121 
122  if (campaign && map_theater) {
124  }
125 }
126 
127 // +--------------------------------------------------------------------+
128 
129 void
131 {
133 
134  if (!map_view)
135  return;
136 
137  if (Keyboard::KeyDown(VK_ADD) ||
138  (zoom_in_btn && zoom_in_btn->GetButtonState() > 0)) {
139  map_view->ZoomIn();
140  }
141  else if (Keyboard::KeyDown(VK_SUBTRACT) ||
143  map_view->ZoomOut();
144  }
145 
146  else if (Mouse::Wheel() > 0) {
147  map_view->ZoomIn();
148  map_view->ZoomIn();
149  map_view->ZoomIn();
150  }
151 
152  else if (Mouse::Wheel() < 0) {
153  map_view->ZoomOut();
154  map_view->ZoomOut();
155  map_view->ZoomOut();
156  }
157 }
158 
159 // +--------------------------------------------------------------------+
160 
161 void
163 {
164  CmdDlg::OnSave(event);
165 }
166 
167 void
169 {
170  CmdDlg::OnExit(event);
171 }
172 
173 void
175 {
176  CmdDlg::OnMode(event);
177 }
178 
179 // +--------------------------------------------------------------------+
180 
181 void
183 {
184  int use_filter_mode = -1;
185 
189 
190  if (view_btn[0] == event->window) {
193  use_filter_mode = SELECT_SYSTEM;
194  }
195 
196  else if (view_btn[VIEW_SYSTEM] == event->window) {
199  use_filter_mode = SELECT_REGION;
200  }
201 
202  else if (view_btn[VIEW_REGION] == event->window) {
205  use_filter_mode = SELECT_STARSHIP;
206  }
207 
208  if (use_filter_mode >= 0) {
209  if (map_view) map_view->SetSelectionMode(use_filter_mode);
210  }
211 }
212 
213 // +--------------------------------------------------------------------+
214 
215 
216