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)
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 ***********************************************************************/
15 #include <fc_config.h>
30 #include "client_main.h"
33 #include "mapctrl_common.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
41 ****************************************************************************/
42 void update_info_label(void)
47 fc_snprintf(buffer
, sizeof(buffer
),
51 "Tax: %d Lux: %d Sci: %d"),
52 population_to_text(civ_population(client_player())),
54 client
.conn
.playing
->economic
.gold
,
55 client
.conn
.playing
->economic
.tax
,
56 client
.conn
.playing
->economic
.luxury
,
57 client
.conn
.playing
->economic
.science
);
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
)
79 /****************************************************************************
80 Update the mouse cursor. Cursor type depends on what user is doing and
82 ****************************************************************************/
83 void update_mouse_cursor(enum cursor_type new_cursor_type
)
88 /****************************************************************************
89 Update the timeout display. The timeout is the time until the turn
91 ****************************************************************************/
92 void gui_update_timeout_label(void)
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()) {
113 if ((do_restore
&& flip
) || !do_restore
) {
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
125 ****************************************************************************/
126 void set_indicator_icons(struct sprite
*bulb
, struct sprite
*sol
,
127 struct sprite
*flake
, struct sprite
*gov
)
132 /****************************************************************************
133 Return a canvas that is the overview window.
134 ****************************************************************************/
135 struct canvas
*get_overview_window(void)
141 /****************************************************************************
142 Flush the given part of the canvas buffer (if there is one) to the
144 ****************************************************************************/
145 void flush_mapcanvas(int canvas_x
, int canvas_y
,
146 int pixel_width
, int pixel_height
)
151 /****************************************************************************
152 Mark the rectangular region as "dirty" so that we know to flush it
154 ****************************************************************************/
155 void dirty_rect(int canvas_x
, int canvas_y
,
156 int pixel_width
, int pixel_height
)
161 /****************************************************************************
162 Mark the entire screen area as "dirty" so that we can flush it later.
163 ****************************************************************************/
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)
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 ****************************************************************************/
189 /****************************************************************************
190 Update (refresh) the locations of the mapview scrollbars (if it uses
192 ****************************************************************************/
193 void update_map_canvas_scrollbars(void)
198 /****************************************************************************
199 Update the size of the sliders on the scrollbars.
200 ****************************************************************************/
201 void update_map_canvas_scrollbars_size(void)
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
)
222 /****************************************************************************
224 ****************************************************************************/
225 void draw_selection_rectangle(int canvas_x
, int canvas_y
, int w
, int h
)
230 /****************************************************************************
231 This function is called when the tileset is changed.
232 ****************************************************************************/
233 void tileset_changed(void)
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
243 ****************************************************************************/
244 void get_overview_area_dimensions(int *width
, int *height
)
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
256 ****************************************************************************/
257 void overview_size_changed(void)
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
)