webperimental: killstack decides stack protects.
[freeciv.git] / client / gui-stub / mapview.c
blob5d2712367e595d3597978072a0aad26b6af02ac8
1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif
18 /* utility */
19 #include "fcintl.h"
20 #include "support.h"
22 /* common */
23 #include "calendar.h"
24 #include "game.h"
26 /* gui main header */
27 #include "gui_stub.h"
29 /* client */
30 #include "client_main.h"
31 #include "climisc.h"
32 #include "control.h"
33 #include "mapctrl_common.h"
35 #include "mapview.h"
37 /****************************************************************************
38 Typically an info box is provided to tell the player about the state
39 of their civilization. This function is called when the label is
40 changed.
41 ****************************************************************************/
42 void update_info_label(void)
44 /* PORTME */
45 char buffer[512];
47 fc_snprintf(buffer, sizeof(buffer),
48 _("Population: %s\n"
49 "Year: %s\n"
50 "Gold %d\n"
51 "Tax: %d Lux: %d Sci: %d"),
52 population_to_text(civ_population(client_player())),
53 calendar_text(),
54 client.conn.playing->economic.gold,
55 client.conn.playing->economic.tax,
56 client.conn.playing->economic.luxury,
57 client.conn.playing->economic.science);
59 /* ... */
62 /****************************************************************************
63 Update the information label which gives info on the current unit
64 and the tile under the current unit, for specified unit. Note that
65 in practice punit is always the focus unit.
67 Clears label if punit is NULL.
69 Typically also updates the cursor for the map_canvas (this is
70 related because the info label may includes "select destination"
71 prompt etc). And it may call update_unit_pix_label() to update the
72 icons for units on this tile.
73 ****************************************************************************/
74 void update_unit_info_label(struct unit_list *punitlist)
76 /* PORTME */
79 /****************************************************************************
80 Update the mouse cursor. Cursor type depends on what user is doing and
81 pointing.
82 ****************************************************************************/
83 void update_mouse_cursor(enum cursor_type new_cursor_type)
85 /* PORTME */
88 /****************************************************************************
89 Update the timeout display. The timeout is the time until the turn
90 ends, in seconds.
91 ****************************************************************************/
92 void gui_update_timeout_label(void)
94 /* PORTME */
96 /* set some widget based on get_timeout_label_text() */
99 /****************************************************************************
100 If do_restore is FALSE it should change the turn button style (to
101 draw the user's attention to it). If called regularly from a timer
102 this will give a blinking turn done button. If do_restore is TRUE
103 this should reset the turn done button to the default style.
104 ****************************************************************************/
105 void update_turn_done_button(bool do_restore)
107 static bool flip = FALSE;
109 if (!get_turn_done_button_state()) {
110 return;
113 if ((do_restore && flip) || !do_restore) {
114 /* ... */
116 flip = !flip;
118 /* PORTME */
121 /****************************************************************************
122 Set information for the indicator icons typically shown in the main
123 client window. The parameters tell which sprite to use for the
124 indicator.
125 ****************************************************************************/
126 void set_indicator_icons(struct sprite *bulb, struct sprite *sol,
127 struct sprite *flake, struct sprite *gov)
129 /* PORTME */
132 /****************************************************************************
133 Return a canvas that is the overview window.
134 ****************************************************************************/
135 struct canvas *get_overview_window(void)
137 /* PORTME */
138 return NULL;
141 /****************************************************************************
142 Flush the given part of the canvas buffer (if there is one) to the
143 screen.
144 ****************************************************************************/
145 void flush_mapcanvas(int canvas_x, int canvas_y,
146 int pixel_width, int pixel_height)
148 /* PORTME */
151 /****************************************************************************
152 Mark the rectangular region as "dirty" so that we know to flush it
153 later.
154 ****************************************************************************/
155 void dirty_rect(int canvas_x, int canvas_y,
156 int pixel_width, int pixel_height)
158 /* PORTME */
161 /****************************************************************************
162 Mark the entire screen area as "dirty" so that we can flush it later.
163 ****************************************************************************/
164 void dirty_all(void)
166 /* PORTME */
169 /****************************************************************************
170 Flush all regions that have been previously marked as dirty. See
171 dirty_rect and dirty_all. This function is generally called after we've
172 processed a batch of drawing operations.
173 ****************************************************************************/
174 void flush_dirty(void)
176 /* PORTME */
179 /****************************************************************************
180 Do any necessary synchronization to make sure the screen is up-to-date.
181 The canvas should have already been flushed to screen via flush_dirty -
182 all this function does is make sure the hardware has caught up.
183 ****************************************************************************/
184 void gui_flush(void)
186 /* PORTME */
189 /****************************************************************************
190 Update (refresh) the locations of the mapview scrollbars (if it uses
191 them).
192 ****************************************************************************/
193 void update_map_canvas_scrollbars(void)
195 /* PORTME */
198 /****************************************************************************
199 Update the size of the sliders on the scrollbars.
200 ****************************************************************************/
201 void update_map_canvas_scrollbars_size(void)
203 /* PORTME */
206 /****************************************************************************
207 Update (refresh) all city descriptions on the mapview.
208 ****************************************************************************/
209 void update_city_descriptions(void)
211 update_map_canvas_visible();
214 /****************************************************************************
215 Draw a cross-hair overlay on a tile.
216 ****************************************************************************/
217 void put_cross_overlay_tile(struct tile *ptile)
219 /* PORTME */
222 /****************************************************************************
223 Area Selection
224 ****************************************************************************/
225 void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
227 /* PORTME */
230 /****************************************************************************
231 This function is called when the tileset is changed.
232 ****************************************************************************/
233 void tileset_changed(void)
235 /* PORTME */
236 /* Here you should do any necessary redraws (for instance, the city
237 * dialogs usually need to be resized). */
240 /****************************************************************************
241 Return the dimensions of the area (container widget; maximum size) for
242 the overview.
243 ****************************************************************************/
244 void get_overview_area_dimensions(int *width, int *height)
246 /* PORTME */
247 *width = 0;
248 *height = 0;
251 /****************************************************************************
252 Called when the map size changes. This may be used to change the
253 size of the GUI element holding the overview canvas. The
254 overview.width and overview.height are updated if this function is
255 called.
256 ****************************************************************************/
257 void overview_size_changed(void)
259 /* PORTME */
262 /**************************************************************************
263 Sets the position of the overview scroll window based on mapview position.
264 **************************************************************************/
265 void update_overview_scroll_window_pos(int x, int y)
267 /* TODO: PORTME. */