Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-gtk-3.0/mapview.c Source File

Freeciv-3.1

Loading...
Searching...
No Matches
mapview.c
Go to the documentation of this file.
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.
7
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***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <stdio.h>
19
20#ifdef HAVE_UNISTD_H
21#include <unistd.h>
22#endif
23
24#include <gtk/gtk.h>
25
26/* utility */
27#include "fcintl.h"
28#include "log.h"
29#include "mem.h"
30#include "rand.h"
31#include "support.h"
32#include "timing.h"
33
34/* common */
35#include "game.h"
36#include "government.h" /* government_graphic() */
37#include "map.h"
38#include "player.h"
39
40/* client */
41#include "client_main.h"
42#include "climap.h"
43#include "climisc.h"
44#include "colors.h"
45#include "control.h" /* get_unit_in_focus() */
46#include "editor.h"
47#include "options.h"
48#include "overview_common.h"
49#include "tilespec.h"
50#include "text.h"
51#include "zoom.h"
52
53/* client/gui-gtk-3.0 */
54#include "citydlg.h" /* For reset_city_dialogs() */
55#include "editgui.h"
56#include "graphics.h"
57#include "gui_main.h"
58#include "gui_stuff.h"
59#include "mapctrl.h"
60#include "repodlgs.h"
61#include "wldlg.h"
62
63#include "mapview.h"
64
65 static GtkAdjustment *map_hadj, *map_vadj;
66 static int cursor_timer_id = 0, cursor_type = -1, cursor_frame = 0;
67 static int mapview_frozen_level = 0;
68
69/**********************************************************************/
75 void update_turn_done_button(bool do_restore)
76{
77 static bool flip = FALSE;
78
79 if (!get_turn_done_button_state()) {
80 return;
81 }
82
83 if ((do_restore && flip) || !do_restore) {
84 GdkRGBA fore;
85 GdkRGBA back;
86 GtkStyleContext *context = gtk_widget_get_style_context(turn_done_button);
87
88 gtk_style_context_get_color(context, GTK_STATE_FLAG_NORMAL, &fore);
89 gtk_style_context_get_background_color(context, GTK_STATE_FLAG_NORMAL, &back);
90
91 gtk_widget_override_color(turn_done_button, GTK_STATE_FLAG_NORMAL, &back);
92 gtk_widget_override_background_color(turn_done_button, GTK_STATE_FLAG_NORMAL, &fore);
93
94 flip = !flip;
95 }
96}
97
98/**********************************************************************/
101 void update_timeout_label(void)
102{
103 gtk_label_set_text(GTK_LABEL(timeout_label), get_timeout_label_text());
104
105 if (current_turn_timeout() > 0) {
106 gtk_widget_set_tooltip_text(timeout_label,
107 _("Time to forced turn change,\n"
108 "or estimated time to finish turn change "
109 "processing."));
110 } else {
111 gtk_widget_set_tooltip_text(timeout_label,
112 _("Turn timeout disabled.\n"
113 "Between turns this shows estimated time "
114 "to finish turn change processing."));
115 }
116}
117
118/**********************************************************************/
121 void update_info_label(void)
122{
123 GtkWidget *label;
124 const struct player *pplayer = client_player();
125
126 label = gtk_frame_get_label_widget(GTK_FRAME(main_frame_civ_name));
127 if (pplayer != NULL) {
128 const gchar *name;
129 gunichar c;
130
131 /* Capitalize the first character of the translated nation
132 * plural name so that the frame label looks good. */
133 name = nation_plural_for_player(pplayer);
134 c = g_utf8_get_char_validated(name, -1);
135 if ((gunichar) -1 != c && (gunichar) -2 != c) {
136 const char *obstext = NULL;
137 int obstextlen = 0;
138
139 if (client_is_observer()) {
140 obstext = _(" (observer)");
141 obstextlen = strlen(obstext);
142 }
143
144 {
145 gchar nation[MAX_LEN_NAME + obstextlen];
146 gchar *next;
147 gint len;
148
149 len = g_unichar_to_utf8(g_unichar_toupper(c), nation);
150 nation[len] = '\0';
151 next = g_utf8_find_next_char(name, NULL);
152 if (NULL != next) {
153 sz_strlcat(nation, next);
154 }
155 if (obstext != NULL) {
156 sz_strlcat(nation, obstext);
157 }
158 gtk_label_set_text(GTK_LABEL(label), nation);
159 }
160 } else {
161 gtk_label_set_text(GTK_LABEL(label), name);
162 }
163 } else {
164 gtk_label_set_text(GTK_LABEL(label), "-");
165 }
166
167 gtk_label_set_text(GTK_LABEL(main_label_info),
168 get_info_label_text(!GUI_GTK_OPTION(small_display_layout)));
169
170 set_indicator_icons(client_research_sprite(),
171 client_warming_sprite(),
172 client_cooling_sprite(),
173 client_government_sprite());
174
175 if (NULL != pplayer) {
176 int d = 0;
177
178 for (; d < pplayer->economic.luxury / 10; d++) {
179 struct sprite *spr = get_tax_sprite(tileset, O_LUXURY);
180
181 gtk_image_set_from_surface(GTK_IMAGE(econ_label[d]), spr->surface);
182 }
183
184 for (; d < (pplayer->economic.science
185 + pplayer->economic.luxury) / 10; d++) {
186 struct sprite *spr = get_tax_sprite(tileset, O_SCIENCE);
187
188 gtk_image_set_from_surface(GTK_IMAGE(econ_label[d]), spr->surface);
189 }
190
191 for (; d < 10; d++) {
192 struct sprite *spr = get_tax_sprite(tileset, O_GOLD);
193
194 gtk_image_set_from_surface(GTK_IMAGE(econ_label[d]), spr->surface);
195 }
196 }
197
198 update_timeout_label();
199
200 /* Update tooltips. */
201 gtk_widget_set_tooltip_text(econ_ebox,
202 _("Shows your current luxury/science/tax rates; "
203 "click to toggle them."));
204
205 gtk_widget_set_tooltip_text(bulb_ebox, get_bulb_tooltip());
206 gtk_widget_set_tooltip_text(sun_ebox, get_global_warming_tooltip());
207 gtk_widget_set_tooltip_text(flake_ebox, get_nuclear_winter_tooltip());
208 gtk_widget_set_tooltip_text(government_ebox, get_government_tooltip());
209}
210
211/**********************************************************************/
214 static gboolean anim_cursor_cb(gpointer data)
215{
216 if (!cursor_timer_id) {
217 return FALSE;
218 }
219
220 cursor_frame++;
221 if (cursor_frame == NUM_CURSOR_FRAMES) {
222 cursor_frame = 0;
223 }
224
225 if (cursor_type == CURSOR_DEFAULT) {
226 gdk_window_set_cursor(root_window, NULL);
227 cursor_timer_id = 0;
228 return FALSE;
229 }
230
231 gdk_window_set_cursor(root_window,
232 fc_cursors[cursor_type][cursor_frame]);
233 control_mouse_cursor(NULL);
234 return TRUE;
235}
236
237/**********************************************************************/
240 void update_mouse_cursor(enum cursor_type new_cursor_type)
241{
242 cursor_type = new_cursor_type;
243 if (!cursor_timer_id) {
244 cursor_timer_id = g_timeout_add(CURSOR_INTERVAL, anim_cursor_cb, NULL);
245 }
246}
247
248/**********************************************************************/
258 void update_unit_info_label(struct unit_list *punits)
259{
260 GtkWidget *label;
261
262 label = gtk_frame_get_label_widget(GTK_FRAME(unit_info_frame));
263 gtk_label_set_text(GTK_LABEL(label),
264 get_unit_info_label_text1(punits));
265
266 gtk_label_set_text(GTK_LABEL(unit_info_label),
267 get_unit_info_label_text2(punits, 0));
268
269 update_unit_pix_label(punits);
270}
271
272/**********************************************************************/
275GdkPixbuf *get_thumb_pixbuf(int onoff)
276{
277 return sprite_get_pixbuf(get_treaty_thumb_sprite(tileset, BOOL_VAL(onoff)));
278}
279
280/**********************************************************************/
285 void set_indicator_icons(struct sprite *bulb, struct sprite *sol,
286 struct sprite *flake, struct sprite *gov)
287{
288 gtk_image_set_from_surface(GTK_IMAGE(bulb_label), bulb->surface);
289 gtk_image_set_from_surface(GTK_IMAGE(sun_label), sol->surface);
290 gtk_image_set_from_surface(GTK_IMAGE(flake_label), flake->surface);
291 gtk_image_set_from_surface(GTK_IMAGE(government_label), gov->surface);
292}
293
294/**********************************************************************/
300 void get_overview_area_dimensions(int *width, int *height)
301{
302 *width = GUI_GTK_OVERVIEW_MIN_XSIZE;
303 *height = GUI_GTK_OVERVIEW_MIN_YSIZE;
304}
305
306/**********************************************************************/
309 void overview_size_changed(void)
310{
311 gtk_widget_set_size_request(overview_canvas,
312 gui_options.overview.width,
313 gui_options.overview.height);
314 update_map_canvas_scrollbars_size();
315}
316
317/**********************************************************************/
320 struct canvas *get_overview_window(void)
321{
322#if 0
323 static struct canvas store;
324
325 store.surface = NULL;
326 store.drawable = gdk_cairo_create(gtk_widget_get_window(overview_canvas));
327
328 return &store;
329#endif /* 0 */
330 if (can_client_change_view()) {
331 gtk_widget_queue_draw(overview_canvas);
332 }
333 return NULL;
334}
335
336/**********************************************************************/
339gboolean overview_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
340{
341 gpointer source = (can_client_change_view()) ?
342 (gpointer)gui_options.overview.window : NULL;
343
344 if (source) {
345 cairo_surface_t *surface = gui_options.overview.window->surface;
346
347 cairo_set_source_surface(cr, surface, 0, 0);
348 cairo_paint(cr);
349 }
350 return TRUE;
351}
352
353/**********************************************************************/
356 void mapview_freeze(void)
357{
358 mapview_frozen_level++;
359}
360
361/**********************************************************************/
364 void mapview_thaw(void)
365{
366 if (1 < mapview_frozen_level) {
367 mapview_frozen_level--;
368 } else {
369 fc_assert(0 < mapview_frozen_level);
370 mapview_frozen_level = 0;
371 dirty_all();
372 }
373}
374
375/**********************************************************************/
378 bool mapview_is_frozen(void)
379{
380 return (0 < mapview_frozen_level);
381}
382
383/**********************************************************************/
386gboolean map_canvas_configure(GtkWidget *w, GdkEventConfigure *ev,
387 gpointer data)
388{
389 map_canvas_resized(ev->width, ev->height);
390
391 return TRUE;
392}
393
394/**********************************************************************/
397 void map_canvas_size_refresh(void)
398{
399 /* Needed only with full screen zoom mode.
400 * Not needed, nor implemented, in this client. */
401 fc_assert(FALSE);
402}
403
404/**********************************************************************/
407gboolean map_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
408{
409 if (can_client_change_view() && !map_is_empty() && !mapview_is_frozen()) {
410 /* First we mark the area to be updated as dirty. Then we unqueue
411 * any pending updates, to make sure only the most up-to-date data
412 * is written (otherwise drawing bugs happen when old data is copied
413 * to screen). Then we draw all changed areas to the screen. */
414 update_animation();
415 unqueue_mapview_updates(FALSE);
416 cairo_set_source_surface(cr, mapview.store->surface, 0, 0);
417 cairo_paint(cr);
418 }
419 return TRUE;
420}
421
422/**********************************************************************/
426 void dirty_rect(int canvas_x, int canvas_y,
427 int pixel_width, int pixel_height)
428{
429 GdkRectangle rectangle = {canvas_x, canvas_y, pixel_width, pixel_height};
430 if (gtk_widget_get_realized(map_canvas)) {
431 gdk_window_invalidate_rect(gtk_widget_get_window(map_canvas), &rectangle, FALSE);
432 }
433}
434
435/**********************************************************************/
438 void dirty_all(void)
439{
440 if (gtk_widget_get_realized(map_canvas)) {
441 gdk_window_invalidate_rect(gtk_widget_get_window(map_canvas), NULL, FALSE);
442 }
443}
444
445/**********************************************************************/
450 void flush_dirty(void)
451{
452 if (map_canvas != NULL && gtk_widget_get_realized(map_canvas)) {
453 gdk_window_process_updates(gtk_widget_get_window(map_canvas), FALSE);
454 }
455}
456
457/**********************************************************************/
462 void gui_flush(void)
463{
464 cairo_surface_flush(mapview.store->surface);
465}
466
467/**********************************************************************/
470 void update_city_descriptions(void)
471{
472 update_map_canvas_visible();
473}
474
475/**********************************************************************/
478 void put_unit_image(struct unit *punit, GtkImage *p, int height)
479{
480 struct canvas store = FC_STATIC_CANVAS_INIT;
481 int width;
482
483 if (height <= 0) {
484 height = tileset_full_tile_height(tileset);
485 }
486 width = tileset_full_tile_width(tileset);
487
488 store.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
489 width, height);
490
491 put_unit(punit, &store, 1.0, 0, 0);
492
493 gtk_image_set_from_surface(p, store.surface);
494 cairo_surface_destroy(store.surface);
495}
496
497/**********************************************************************/
503 void put_unit_image_city_overlays(struct unit *punit, GtkImage *p,
504 int height,
505 int *upkeep_cost, int happy_cost)
506{
507 struct canvas store = FC_STATIC_CANVAS_INIT;
508 int width = tileset_full_tile_width(tileset);
509
510 store.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
511 width, height);
512
513 put_unit(punit, &store, 1.0, 0, 0);
514
515 put_unit_city_overlays(punit, &store, 0, tileset_unit_layout_offset_y(tileset),
516 upkeep_cost, happy_cost);
517
518 gtk_image_set_from_surface(p, store.surface);
519 cairo_surface_destroy(store.surface);
520}
521
522/**********************************************************************/
525 void pixmap_put_overlay_tile(GdkWindow *pixmap, float zoom,
526 int canvas_x, int canvas_y,
527 struct sprite *ssprite)
528{
529 cairo_t *cr;
530
531 if (!ssprite) {
532 return;
533 }
534
535 cr = gdk_cairo_create(pixmap);
536 cairo_scale(cr, zoom, zoom);
537 cairo_set_source_surface(cr, ssprite->surface, canvas_x, canvas_y);
538 cairo_paint(cr);
539 cairo_destroy(cr);
540}
541
542/**********************************************************************/
545 void pixmap_put_overlay_tile_draw(struct canvas *pcanvas,
546 int canvas_x, int canvas_y,
547 struct sprite *ssprite,
548 bool fog)
549{
550 cairo_t *cr;
551 int sswidth, ssheight;
552 const double bright = 0.65; /* Fogged brightness compared to unfogged */
553
554 if (!ssprite) {
555 return;
556 }
557
558 get_sprite_dimensions(ssprite, &sswidth, &ssheight);
559
560 if (fog) {
561 struct color *fogcol = color_alloc(0.0, 0.0, 0.0); /* black */
562 cairo_surface_t *fog_surface;
563 struct sprite *fogged;
564 unsigned char *mask_in;
565 unsigned char *mask_out;
566 int i, j;
567
568 /* Create sprites initially fully transparent */
569 fogcol->color.alpha = 0.0;
570 fogged = create_sprite(sswidth, ssheight, fogcol);
571 fog_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, sswidth, ssheight);
572
573 /* Calculate black fog mask from the original sprite's alpha channel;
574 * we don't want to blacken transparent parts of the sprite. */
575 mask_in = cairo_image_surface_get_data(ssprite->surface);
576 mask_out = cairo_image_surface_get_data(fog_surface);
577
578 for (i = 0; i < sswidth; i++) {
579 for (j = 0; j < ssheight; j++) {
580 /* In order to darken pixels of ssprite to 'bright' fraction of
581 * their original value, we need to overlay blackness of
582 * (1-bright) transparency. */
583 if (!is_bigendian()) {
584 mask_out[(j * sswidth + i) * 4 + 3]
585 = (1-bright) * mask_in[(j * sswidth + i) * 4 + 3];
586 } else {
587 mask_out[(j * sswidth + i) * 4 + 0]
588 = (1-bright) * mask_in[(j * sswidth + i) * 4 + 0];
589 }
590 }
591 }
592
593 cairo_surface_mark_dirty(fog_surface);
594
595 /* First copy original sprite canvas to intermediate sprite canvas */
596 cr = cairo_create(fogged->surface);
597 cairo_set_source_surface(cr, ssprite->surface, 0, 0);
598 cairo_paint(cr);
599
600 /* Then apply created fog to the intermediate sprite to darken it */
601 cairo_set_source_surface(cr, fog_surface, 0, 0);
602 cairo_paint(cr);
603 cairo_destroy(cr);
604
605 /* Put intermediate sprite to the target canvas */
606 canvas_put_sprite(pcanvas, canvas_x, canvas_y,
607 fogged, 0, 0, sswidth, ssheight);
608
609 /* Free intermediate stuff */
610 cairo_surface_destroy(fog_surface);
611 free_sprite(fogged);
612 color_free(fogcol);
613 } else {
614 canvas_put_sprite(pcanvas, canvas_x, canvas_y,
615 ssprite, 0, 0, sswidth, ssheight);
616 }
617}
618
619/**********************************************************************/
622 void put_cross_overlay_tile(struct tile *ptile)
623{
624 float canvas_x, canvas_y;
625
626 if (tile_to_canvas_pos(&canvas_x, &canvas_y, map_zoom, ptile)) {
627 pixmap_put_overlay_tile(gtk_widget_get_window(map_canvas), map_zoom,
628 canvas_x / map_zoom, canvas_y / map_zoom,
629 get_attention_crosshair_sprite(tileset));
630 }
631}
632
633/**********************************************************************/
636 void update_overview_scroll_window_pos(int x, int y)
637{
638 gdouble ov_scroll_x, ov_scroll_y;
639 GtkAdjustment *ov_hadj, *ov_vadj;
640
641 ov_hadj = gtk_scrolled_window_get_hadjustment(
642 GTK_SCROLLED_WINDOW(overview_scrolled_window));
643 ov_vadj = gtk_scrolled_window_get_vadjustment(
644 GTK_SCROLLED_WINDOW(overview_scrolled_window));
645
646 ov_scroll_x = MIN(x - (overview_canvas_store_width / 2),
647 gtk_adjustment_get_upper(ov_hadj)
648 - gtk_adjustment_get_page_size(ov_hadj));
649 ov_scroll_y = MIN(y - (overview_canvas_store_height / 2),
650 gtk_adjustment_get_upper(ov_vadj)
651 - gtk_adjustment_get_page_size(ov_vadj));
652
653 gtk_adjustment_set_value(ov_hadj, ov_scroll_x);
654 gtk_adjustment_set_value(ov_vadj, ov_scroll_y);
655}
656
657/**********************************************************************/
660 void update_map_canvas_scrollbars(void)
661{
662 int scroll_x, scroll_y;
663
664 get_mapview_scroll_pos(&scroll_x, &scroll_y);
665 gtk_adjustment_set_value(map_hadj, scroll_x);
666 gtk_adjustment_set_value(map_vadj, scroll_y);
667 if (can_client_change_view()) {
668 gtk_widget_queue_draw(overview_canvas);
669 }
670}
671
672/**********************************************************************/
675 void update_map_canvas_scrollbars_size(void)
676{
677 float xmin, ymin, xmax, ymax;
678 int xsize, ysize, xstep, ystep;
679
680 get_mapview_scroll_window(&xmin, &ymin, &xmax, &ymax, &xsize, &ysize);
681 get_mapview_scroll_step(&xstep, &ystep);
682
683 map_hadj = gtk_adjustment_new(-1, xmin, xmax, xstep, xsize, xsize);
684 map_vadj = gtk_adjustment_new(-1, ymin, ymax, ystep, ysize, ysize);
685
686 gtk_range_set_adjustment(GTK_RANGE(map_horizontal_scrollbar), map_hadj);
687 gtk_range_set_adjustment(GTK_RANGE(map_vertical_scrollbar), map_vadj);
688
689 g_signal_connect(map_hadj, "value_changed",
690 G_CALLBACK(scrollbar_jump_callback),
691 GINT_TO_POINTER(TRUE));
692 g_signal_connect(map_vadj, "value_changed",
693 G_CALLBACK(scrollbar_jump_callback),
694 GINT_TO_POINTER(FALSE));
695}
696
697/**********************************************************************/
700 void scrollbar_jump_callback(GtkAdjustment *adj, gpointer hscrollbar)
701{
702 int scroll_x, scroll_y;
703
704 if (!can_client_change_view()) {
705 return;
706 }
707
708 get_mapview_scroll_pos(&scroll_x, &scroll_y);
709
710 if (hscrollbar) {
711 scroll_x = gtk_adjustment_get_value(adj);
712 } else {
713 scroll_y = gtk_adjustment_get_value(adj);
714 }
715
716 set_mapview_scroll_pos(scroll_x, scroll_y, mouse_zoom);
717}
718
719/**********************************************************************/
728 void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
729{
730 double dashes[2] = {4.0, 4.0};
731 struct color *pcolor;
732 cairo_t *cr;
733
734 if (w == 0 || h == 0) {
735 return;
736 }
737
738 pcolor = get_color(tileset, COLOR_MAPVIEW_SELECTION);
739 if (!pcolor) {
740 return;
741 }
742
743 cr = gdk_cairo_create(gtk_widget_get_window(map_canvas));
744 gdk_cairo_set_source_rgba(cr, &pcolor->color);
745 cairo_set_line_width(cr, 2.0);
746 cairo_set_dash(cr, dashes, 2, 0);
747#ifdef FREECIV_MSWINDOWS
748 if (cairo_version() < CAIRO_VERSION_ENCODE(1, 12, 0)) {
749 /* Cairo has crashing CAIRO_OPERATOR_DIFFERENCE on win32 surface */
750 cairo_set_operator(cr, CAIRO_OPERATOR_XOR);
751 } else
752#endif /* FREECIV_MSWINDOWS */
753 {
754 cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
755 }
756 cairo_rectangle(cr, canvas_x, canvas_y, w, h);
757 cairo_stroke(cr);
758 cairo_destroy(cr);
759}
760
761/**********************************************************************/
764 void tileset_changed(void)
765{
766 science_report_dialog_redraw();
767 reset_city_dialogs();
768 reset_unit_table();
769 blank_max_unit_size();
770 editgui_tileset_changed();
771
772 /* keep the icon of the executable on Windows (see PR#36491) */
773#ifndef FREECIV_MSWINDOWS
774 {
775 GdkPixbuf *pixbuf = sprite_get_pixbuf(get_icon_sprite(tileset, ICON_FREECIV));
776
777 /* Only call this after tileset_load_tiles is called. */
778 gtk_window_set_icon(GTK_WINDOW(toplevel), pixbuf);
779 g_object_unref(pixbuf);
780 }
781#endif /* FREECIV_MSWINDOWS */
782}
783
784/**********************************************************************/
787 void start_turn(void)
788{}
height
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
pcolor
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color * pcolor
Definition canvas_g.h:57
canvas_y
struct canvas int int canvas_y
Definition canvas_g.h:43
canvas_x
struct canvas int canvas_x
Definition canvas_g.h:43
canvas_put_sprite
canvas_put_sprite
Definition canvas_g.h:42
width
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
pcanvas
struct canvas * pcanvas
Definition canvas_g.h:42
fog
struct canvas int int struct sprite bool fog
Definition canvas_g.h:51
client_is_observer
bool client_is_observer(void)
Definition client_main.c:1086
can_client_change_view
bool can_client_change_view(void)
Definition client_main.c:1313
client_main.h
client_player
#define client_player()
Definition client_main.h:106
climap.h
client_warming_sprite
struct sprite * client_warming_sprite(void)
Definition climisc.c:371
client_cooling_sprite
struct sprite * client_cooling_sprite(void)
Definition climisc.c:388
client_research_sprite
struct sprite * client_research_sprite(void)
Definition climisc.c:348
client_government_sprite
struct sprite * client_government_sprite(void)
Definition climisc.c:406
climisc.h
get_color
struct color * get_color(const struct tileset *t, enum color_std stdcolor)
Definition colors_common.c:100
update_unit_pix_label
void update_unit_pix_label(struct unit_list *punitlist)
Definition control.c:966
control_mouse_cursor
void control_mouse_cursor(struct tile *ptile)
Definition control.c:1188
control.h
punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:73
editor.h
get_turn_done_button_state
bool get_turn_done_button_state()
Definition mapctrl_common.c:519
MAX_LEN_NAME
#define MAX_LEN_NAME
Definition fc_types.h:66
O_SCIENCE
@ O_SCIENCE
Definition fc_types.h:91
O_LUXURY
@ O_LUXURY
Definition fc_types.h:91
O_GOLD
@ O_GOLD
Definition fc_types.h:91
fcintl.h
_
#define _(String)
Definition fcintl.h:67
current_turn_timeout
int current_turn_timeout(void)
Definition game.c:828
game.h
government.h
FC_STATIC_CANVAS_INIT
#define FC_STATIC_CANVAS_INIT
Definition canvas.h:27
reset_city_dialogs
void reset_city_dialogs(void)
Definition citydlg.c:357
color_alloc
struct color * color_alloc(int r, int g, int b)
Definition colors.c:38
color_free
void color_free(struct color *color)
Definition colors.c:53
editgui_tileset_changed
void editgui_tileset_changed(void)
Definition editgui.c:1861
source
static GtkWidget * source
Definition gotodlg.c:58
fc_cursors
GdkCursor * fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]
Definition graphics.c:48
map_vertical_scrollbar
GtkWidget * map_vertical_scrollbar
Definition gui_main.c:108
main_label_info
GtkWidget * main_label_info
Definition gui_main.c:137
unit_info_label
GtkWidget * unit_info_label
Definition gui_main.c:150
timeout_label
GtkWidget * timeout_label
Definition gui_main.c:147
overview_scrolled_window
GtkWidget * overview_scrolled_window
Definition gui_main.c:111
econ_ebox
GtkWidget * econ_ebox
Definition gui_main.c:154
government_label
GtkWidget * government_label
Definition gui_main.c:146
sun_label
GtkWidget * sun_label
Definition gui_main.c:144
turn_done_button
GtkWidget * turn_done_button
Definition gui_main.c:148
reset_unit_table
void reset_unit_table(void)
Definition gui_main.c:971
unit_info_frame
GtkWidget * unit_info_frame
Definition gui_main.c:152
root_window
GdkWindow * root_window
Definition gui_main.c:125
sun_ebox
GtkWidget * sun_ebox
Definition gui_main.c:156
bulb_ebox
GtkWidget * bulb_ebox
Definition gui_main.c:155
flake_label
GtkWidget * flake_label
Definition gui_main.c:145
bulb_label
GtkWidget * bulb_label
Definition gui_main.c:143
overview_canvas
GtkWidget * overview_canvas
Definition gui_main.c:110
toplevel
GtkWidget * toplevel
Definition gui_main.c:124
map_horizontal_scrollbar
GtkWidget * map_horizontal_scrollbar
Definition gui_main.c:107
map_canvas
GtkWidget * map_canvas
Definition gui_main.c:106
econ_label
GtkWidget * econ_label[10]
Definition gui_main.c:142
government_ebox
GtkWidget * government_ebox
Definition gui_main.c:158
flake_ebox
GtkWidget * flake_ebox
Definition gui_main.c:157
overview_canvas_store_width
int overview_canvas_store_width
Definition gui_main.c:121
overview_canvas_store_height
int overview_canvas_store_height
Definition gui_main.c:122
main_frame_civ_name
GtkWidget * main_frame_civ_name
Definition gui_main.c:136
GUI_GTK_OPTION
#define GUI_GTK_OPTION(optname)
Definition gui_main.h:25
update_timeout_label
void update_timeout_label(void)
Definition mapview.c:101
flush_dirty
void flush_dirty(void)
Definition mapview.c:450
cursor_frame
static int cursor_frame
Definition mapview.c:66
update_info_label
void update_info_label(void)
Definition mapview.c:121
update_turn_done_button
void update_turn_done_button(bool do_restore)
Definition mapview.c:75
scrollbar_jump_callback
void scrollbar_jump_callback(GtkAdjustment *adj, gpointer hscrollbar)
Definition mapview.c:700
dirty_all
void dirty_all(void)
Definition mapview.c:438
tileset_changed
void tileset_changed(void)
Definition mapview.c:764
put_cross_overlay_tile
void put_cross_overlay_tile(struct tile *ptile)
Definition mapview.c:622
draw_selection_rectangle
void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
Definition mapview.c:728
update_map_canvas_scrollbars_size
void update_map_canvas_scrollbars_size(void)
Definition mapview.c:675
get_overview_area_dimensions
void get_overview_area_dimensions(int *width, int *height)
Definition mapview.c:300
mapview_freeze
void mapview_freeze(void)
Definition mapview.c:356
get_thumb_pixbuf
GdkPixbuf * get_thumb_pixbuf(int onoff)
Definition mapview.c:275
start_turn
void start_turn(void)
Definition mapview.c:787
update_unit_info_label
void update_unit_info_label(struct unit_list *punits)
Definition mapview.c:258
update_overview_scroll_window_pos
void update_overview_scroll_window_pos(int x, int y)
Definition mapview.c:636
update_city_descriptions
void update_city_descriptions(void)
Definition mapview.c:470
map_canvas_draw
gboolean map_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
Definition mapview.c:407
pixmap_put_overlay_tile
void pixmap_put_overlay_tile(GdkWindow *pixmap, float zoom, int canvas_x, int canvas_y, struct sprite *ssprite)
Definition mapview.c:525
gui_flush
void gui_flush(void)
Definition mapview.c:462
put_unit_image_city_overlays
void put_unit_image_city_overlays(struct unit *punit, GtkImage *p, int height, int *upkeep_cost, int happy_cost)
Definition mapview.c:503
pixmap_put_overlay_tile_draw
void pixmap_put_overlay_tile_draw(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *ssprite, bool fog)
Definition mapview.c:545
update_map_canvas_scrollbars
void update_map_canvas_scrollbars(void)
Definition mapview.c:660
mapview_is_frozen
bool mapview_is_frozen(void)
Definition mapview.c:378
anim_cursor_cb
static gboolean anim_cursor_cb(gpointer data)
Definition mapview.c:214
overview_size_changed
void overview_size_changed(void)
Definition mapview.c:309
map_canvas_size_refresh
void map_canvas_size_refresh(void)
Definition mapview.c:397
cursor_timer_id
static int cursor_timer_id
Definition mapview.c:66
map_vadj
static GtkAdjustment * map_vadj
Definition mapview.c:65
mapview_frozen_level
static int mapview_frozen_level
Definition mapview.c:67
mapview_thaw
void mapview_thaw(void)
Definition mapview.c:364
get_overview_window
struct canvas * get_overview_window(void)
Definition mapview.c:320
map_canvas_configure
gboolean map_canvas_configure(GtkWidget *w, GdkEventConfigure *ev, gpointer data)
Definition mapview.c:386
put_unit_image
void put_unit_image(struct unit *punit, GtkImage *p, int height)
Definition mapview.c:478
update_mouse_cursor
void update_mouse_cursor(enum cursor_type new_cursor_type)
Definition mapview.c:240
map_hadj
static GtkAdjustment * map_hadj
Definition mapview.c:65
set_indicator_icons
void set_indicator_icons(struct sprite *bulb, struct sprite *sol, struct sprite *flake, struct sprite *gov)
Definition mapview.c:285
overview_canvas_draw
gboolean overview_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
Definition mapview.c:339
CURSOR_INTERVAL
#define CURSOR_INTERVAL
Definition mapview.h:32
science_report_dialog_redraw
void science_report_dialog_redraw(void)
Definition repodlgs.c:761
get_sprite_dimensions
void get_sprite_dimensions(struct sprite *sprite, int *width, int *height)
Definition sprite.c:107
free_sprite
void free_sprite(struct sprite *s)
Definition sprite.c:278
sprite_get_pixbuf
GdkPixbuf * sprite_get_pixbuf(struct sprite *sprite)
Definition sprite.c:402
blank_max_unit_size
void blank_max_unit_size(void)
Definition wldlg.c:79
editgui.h
gui_stuff.h
citydlg.h
colors.h
graphics.h
gui_main.h
mapctrl.h
mapview.h
repodlgs.h
wldlg.h
name
const char * name
Definition inputfile.c:127
log.h
fc_assert
#define fc_assert(condition)
Definition log.h:176
map_is_empty
bool map_is_empty(void)
Definition map.c:149
map.h
get_timeout_label_text
const char * get_timeout_label_text()
Definition text.c:1590
update_map_canvas_visible
void update_map_canvas_visible(void)
Definition mapview_common.c:1843
mapview
struct view mapview
Definition mapview_common.c:74
put_unit
void put_unit(const struct unit *punit, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
Definition mapview_common.c:1374
get_mapview_scroll_pos
void get_mapview_scroll_pos(int *scroll_x, int *scroll_y)
Definition mapview_common.c:1191
get_mapview_scroll_window
void get_mapview_scroll_window(float *xmin, float *ymin, float *xmax, float *ymax, int *xsize, int *ysize)
Definition mapview_common.c:1093
unqueue_mapview_updates
void unqueue_mapview_updates(bool write_to_screen)
Definition mapview_common.c:3067
get_mapview_scroll_step
void get_mapview_scroll_step(int *xstep, int *ystep)
Definition mapview_common.c:1177
set_mapview_scroll_pos
void set_mapview_scroll_pos(int scroll_x, int scroll_y, float zoom)
Definition mapview_common.c:1200
put_unit_city_overlays
void put_unit_city_overlays(struct unit *punit, struct canvas *pcanvas, int canvas_x, int canvas_y, int *upkeep_cost, int happy_cost)
Definition mapview_common.c:1438
update_animation
void update_animation(void)
Definition mapview_common.c:428
map_canvas_resized
bool map_canvas_resized(int width, int height)
Definition mapview_common.c:3592
tile_to_canvas_pos
bool tile_to_canvas_pos(float *canvas_x, float *canvas_y, float zoom, const struct tile *ptile)
Definition mapview_common.c:694
dirty_rect
dirty_rect
Definition mapview_g.h:47
pixel_width
int int int pixel_width
Definition mapview_g.h:48
mem.h
nation_plural_for_player
const char * nation_plural_for_player(const struct player *pplayer)
Definition nation.c:177
gui_options
struct client_options gui_options
Definition options.c:71
options.h
GUI_GTK_OVERVIEW_MIN_XSIZE
#define GUI_GTK_OVERVIEW_MIN_XSIZE
Definition options.h:574
GUI_GTK_OVERVIEW_MIN_YSIZE
#define GUI_GTK_OVERVIEW_MIN_YSIZE
Definition options.h:575
overview_common.h
len
int len
Definition packhand.c:125
get_government_tooltip
const char * get_government_tooltip(void)
Definition text.c:1511
get_nuclear_winter_tooltip
const char * get_nuclear_winter_tooltip(void)
Definition text.c:1484
get_bulb_tooltip
const char * get_bulb_tooltip(void)
Definition text.c:1400
get_info_label_text
const char * get_info_label_text(bool)
Definition text.c:950
get_global_warming_tooltip
const char * get_global_warming_tooltip(void)
Definition text.c:1457
player.h
rand.h
MIN
#define MIN(x, y)
Definition shared.h:55
BOOL_VAL
#define BOOL_VAL(x)
Definition shared.h:70
create_sprite
create_sprite
Definition sprite_g.h:30
canvas
Definition canvas.h:21
canvas::zoom
float zoom
Definition canvas.h:24
canvas::surface
cairo_surface_t * surface
Definition canvas.h:22
canvas::drawable
cairo_t * drawable
Definition canvas.h:23
client_options::overview
struct overview overview
Definition options.h:402
color
Definition colors.h:20
color::color
GdkRGBA color
Definition colors.h:21
overview::width
int width
Definition options.h:93
overview::window
struct canvas * window
Definition options.h:99
overview::height
int height
Definition options.h:93
player_economic::luxury
int luxury
Definition player.h:73
player_economic::science
int science
Definition player.h:72
player
Definition player.h:249
player::economic
struct player_economic economic
Definition player.h:284
player::nation
struct nation_type * nation
Definition player.h:260
sprite
Definition sprite.h:22
sprite::surface
cairo_surface_t * surface
Definition sprite.h:23
tile
Definition tile.h:49
tileset
Definition tilespec.c:459
unit
Definition unit.h:138
view::store
struct canvas * store
Definition mapview_common.h:42
support.h
is_bigendian
static bool is_bigendian(void)
Definition support.h:201
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
sz_strlcat
#define sz_strlcat(dest, src)
Definition support.h:162
get_unit_info_label_text2
const char * get_unit_info_label_text2(struct unit_list *punits, int linebreaks)
Definition text.c:1112
get_unit_info_label_text1
const char * get_unit_info_label_text1(struct unit_list *punits)
Definition text.c:1087
text.h
get_attention_crosshair_sprite
struct sprite * get_attention_crosshair_sprite(const struct tileset *t)
Definition tilespec.c:6689
tileset_full_tile_height
int tileset_full_tile_height(const struct tileset *t)
Definition tilespec.c:752
tileset_unit_layout_offset_y
int tileset_unit_layout_offset_y(const struct tileset *t)
Definition tilespec.c:845
get_treaty_thumb_sprite
struct sprite * get_treaty_thumb_sprite(const struct tileset *t, bool on_off)
Definition tilespec.c:6609
get_icon_sprite
struct sprite * get_icon_sprite(const struct tileset *t, enum icon_type icon)
Definition tilespec.c:6678
tileset_full_tile_width
int tileset_full_tile_width(const struct tileset *t)
Definition tilespec.c:739
get_tax_sprite
struct sprite * get_tax_sprite(const struct tileset *t, Output_type_id otype)
Definition tilespec.c:6579
tilespec.h
NUM_CURSOR_FRAMES
#define NUM_CURSOR_FRAMES
Definition tilespec.h:300
ICON_FREECIV
@ ICON_FREECIV
Definition tilespec.h:310
cursor_type
cursor_type
Definition tilespec.h:285
CURSOR_DEFAULT
@ CURSOR_DEFAULT
Definition tilespec.h:297
timing.h
mouse_zoom
float mouse_zoom
Definition zoom.c:28
map_zoom
float map_zoom
Definition zoom.c:25
zoom.h