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.22 */
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
65static GtkAdjustment *map_hadj, *map_vadj;
66static int cursor_timer_id = 0, cursor_type = -1, cursor_frame = 0;
67static int mapview_frozen_level = 0;
68
69/**********************************************************************/
75void update_turn_done_button(bool do_restore)
76{
77 static bool flip = FALSE;
78
80 return;
81 }
82
83 if ((do_restore && flip) || !do_restore) {
84 static GtkCssProvider *tdb_provider = NULL;
85 GtkStyleContext *scontext = gtk_widget_get_style_context(turn_done_button);
86
87 if (tdb_provider == NULL) {
88 tdb_provider = gtk_css_provider_new();
89
90 gtk_css_provider_load_from_data(tdb_provider,
91 ".lighted {\n"
92 "color: rgba(235, 127, 235, 255);\n"
93 "background-color: rgba(127, 127, 127, 255);\n"
94 "}\n",
95 -1, NULL);
96
97 /* Turn Done button is persistent, so we only need to do this
98 * once too. */
99 gtk_style_context_add_provider(scontext,
100 GTK_STYLE_PROVIDER(tdb_provider),
101 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
102 }
103
104 if (flip) {
105 gtk_style_context_add_class(scontext, "lighted");
106 } else {
107 gtk_style_context_remove_class(scontext, "lighted");
108 }
109
110 flip = !flip;
111 }
112}
113
114/**********************************************************************/
118{
119 gtk_label_set_text(GTK_LABEL(timeout_label), get_timeout_label_text());
120
121 if (current_turn_timeout() > 0) {
122 gtk_widget_set_tooltip_text(timeout_label,
123 _("Time to forced turn change,\n"
124 "or estimated time to finish turn change "
125 "processing."));
126 } else {
127 gtk_widget_set_tooltip_text(timeout_label,
128 _("Turn timeout disabled.\n"
129 "Between turns this shows estimated time "
130 "to finish turn change processing."));
131 }
132}
133
134/**********************************************************************/
138{
139 GtkWidget *label;
140 const struct player *pplayer = client_player();
141
142 label = gtk_frame_get_label_widget(GTK_FRAME(main_frame_civ_name));
143 if (pplayer != NULL) {
144 const gchar *name;
145 gunichar c;
146
147 /* Capitalize the first character of the translated nation
148 * plural name so that the frame label looks good. */
150 c = g_utf8_get_char_validated(name, -1);
151 if ((gunichar) -1 != c && (gunichar) -2 != c) {
152 const char *obstext = NULL;
153 int obstextlen = 0;
154
155 if (client_is_observer()) {
156 obstext = _(" (observer)");
157 obstextlen = strlen(obstext);
158 }
159
160 {
161 gchar nation[MAX_LEN_NAME + obstextlen];
162 gchar *next;
163 gint len;
164
165 len = g_unichar_to_utf8(g_unichar_toupper(c), nation);
166 nation[len] = '\0';
167 next = g_utf8_find_next_char(name, NULL);
168 if (NULL != next) {
169 sz_strlcat(nation, next);
170 }
171 if (obstext != NULL) {
172 sz_strlcat(nation, obstext);
173 }
174 gtk_label_set_text(GTK_LABEL(label), nation);
175 }
176 } else {
177 gtk_label_set_text(GTK_LABEL(label), name);
178 }
179 } else {
180 gtk_label_set_text(GTK_LABEL(label), "-");
181 }
182
183 gtk_label_set_text(GTK_LABEL(main_label_info),
184 get_info_label_text(!GUI_GTK_OPTION(small_display_layout)));
185
190
191 if (NULL != pplayer) {
192 int d = 0;
193
194 for (; d < pplayer->economic.luxury / 10; d++) {
195 struct sprite *spr = get_tax_sprite(tileset, O_LUXURY);
196
197 gtk_image_set_from_surface(GTK_IMAGE(econ_label[d]), spr->surface);
198 }
199
200 for (; d < (pplayer->economic.science
201 + pplayer->economic.luxury) / 10; d++) {
202 struct sprite *spr = get_tax_sprite(tileset, O_SCIENCE);
203
204 gtk_image_set_from_surface(GTK_IMAGE(econ_label[d]), spr->surface);
205 }
206
207 for (; d < 10; d++) {
208 struct sprite *spr = get_tax_sprite(tileset, O_GOLD);
209
210 gtk_image_set_from_surface(GTK_IMAGE(econ_label[d]), spr->surface);
211 }
212 }
213
215
216 /* Update tooltips. */
217 gtk_widget_set_tooltip_text(econ_ebox,
218 _("Shows your current luxury/science/tax rates; "
219 "click to toggle them."));
220
221 gtk_widget_set_tooltip_text(bulb_ebox, get_bulb_tooltip());
222 gtk_widget_set_tooltip_text(sun_ebox, get_global_warming_tooltip());
223 gtk_widget_set_tooltip_text(flake_ebox, get_nuclear_winter_tooltip());
224 gtk_widget_set_tooltip_text(government_ebox, get_government_tooltip());
225}
226
227/**********************************************************************/
230static gboolean anim_cursor_cb(gpointer data)
231{
232 if (!cursor_timer_id) {
233 return FALSE;
234 }
235
236 cursor_frame++;
238 cursor_frame = 0;
239 }
240
242 gdk_window_set_cursor(root_window, NULL);
243 cursor_timer_id = 0;
244 return FALSE;
245 }
246
247 gdk_window_set_cursor(root_window,
250 return TRUE;
251}
252
253/**********************************************************************/
256void update_mouse_cursor(enum cursor_type new_cursor_type)
257{
258 cursor_type = new_cursor_type;
259 if (!cursor_timer_id) {
260 cursor_timer_id = g_timeout_add(CURSOR_INTERVAL, anim_cursor_cb, NULL);
261 }
262}
263
264/**********************************************************************/
274void update_unit_info_label(struct unit_list *punits)
275{
276 GtkWidget *label;
277
278 label = gtk_frame_get_label_widget(GTK_FRAME(unit_info_frame));
279 gtk_label_set_text(GTK_LABEL(label),
281
282 gtk_label_set_text(GTK_LABEL(unit_info_label),
283 get_unit_info_label_text2(punits, 0));
284
285 update_unit_pix_label(punits);
286}
287
288/**********************************************************************/
291GdkPixbuf *get_thumb_pixbuf(int onoff)
292{
294}
295
296/**********************************************************************/
301void set_indicator_icons(struct sprite *bulb, struct sprite *sol,
302 struct sprite *flake, struct sprite *gov)
303{
304 gtk_image_set_from_surface(GTK_IMAGE(bulb_label), bulb->surface);
305 gtk_image_set_from_surface(GTK_IMAGE(sun_label), sol->surface);
306 gtk_image_set_from_surface(GTK_IMAGE(flake_label), flake->surface);
307 gtk_image_set_from_surface(GTK_IMAGE(government_label), gov->surface);
308}
309
310/**********************************************************************/
321
322/**********************************************************************/
332
333/**********************************************************************/
337{
338#if 0
339 static struct canvas store;
340
341 store.surface = NULL;
342 store.drawable = gdk_cairo_create(gtk_widget_get_window(overview_canvas));
343
344 return &store;
345#endif /* 0 */
347 gtk_widget_queue_draw(overview_canvas);
348 }
349 return NULL;
350}
351
352/**********************************************************************/
355gboolean overview_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
356{
357 gpointer source = (can_client_change_view()) ?
358 (gpointer)gui_options.overview.window : NULL;
359
360 if (source) {
361 cairo_surface_t *surface = gui_options.overview.window->surface;
362
363 cairo_set_source_surface(cr, surface, 0, 0);
364 cairo_paint(cr);
365 }
366 return TRUE;
367}
368
369/**********************************************************************/
373{
375}
376
377/**********************************************************************/
380void mapview_thaw(void)
381{
382 if (1 < mapview_frozen_level) {
384 } else {
387 dirty_all();
388 }
389}
390
391/**********************************************************************/
395{
396 return (0 < mapview_frozen_level);
397}
398
399/**********************************************************************/
402gboolean map_canvas_configure(GtkWidget *w, GdkEventConfigure *ev,
403 gpointer data)
404{
405 map_canvas_resized(ev->width, ev->height);
406
407 return TRUE;
408}
409
410/**********************************************************************/
414{
415 /* Needed only with full screen zoom mode.
416 * Not needed, nor implemented, in this client. */
418}
419
420/**********************************************************************/
423gboolean map_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
424{
426 /* First we mark the area to be updated as dirty. Then we unqueue
427 * any pending updates, to make sure only the most up-to-date data
428 * is written (otherwise drawing bugs happen when old data is copied
429 * to screen). Then we draw all changed areas to the screen. */
432 cairo_set_source_surface(cr, mapview.store->surface, 0, 0);
433 cairo_paint(cr);
434 }
435 return TRUE;
436}
437
438/**********************************************************************/
443 int pixel_width, int pixel_height)
444{
445 GdkRectangle rectangle = {canvas_x, canvas_y, pixel_width, pixel_height};
446
447 if (gtk_widget_get_realized(map_canvas)) {
448 gdk_window_invalidate_rect(gtk_widget_get_window(map_canvas), &rectangle, FALSE);
449 }
450}
451
452/**********************************************************************/
455void dirty_all(void)
456{
457 if (gtk_widget_get_realized(map_canvas)) {
458 gdk_window_invalidate_rect(gtk_widget_get_window(map_canvas), NULL, FALSE);
459 }
460}
461
462/**********************************************************************/
467void flush_dirty(void)
468{
469 if (map_canvas != NULL && gtk_widget_get_realized(map_canvas)) {
470 gdk_window_process_updates(gtk_widget_get_window(map_canvas), FALSE);
471 }
472}
473
474/**********************************************************************/
479void gui_flush(void)
480{
481 cairo_surface_flush(mapview.store->surface);
482}
483
484/**********************************************************************/
491
492/**********************************************************************/
495void put_unit_image(struct unit *punit, GtkImage *p, int height)
496{
497 struct canvas store = FC_STATIC_CANVAS_INIT;
498 int width;
499
500 if (height <= 0) {
502 }
504
505 store.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
506 width, height);
507
508 put_unit(punit, &store, 1.0, 0, 0);
509
510 gtk_image_set_from_surface(p, store.surface);
511 cairo_surface_destroy(store.surface);
512}
513
514/**********************************************************************/
520void put_unit_image_city_overlays(struct unit *punit, GtkImage *p,
521 int height,
522 int *upkeep_cost, int happy_cost)
523{
524 struct canvas store = FC_STATIC_CANVAS_INIT;
526
527 store.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
528 width, height);
529
530 put_unit(punit, &store, 1.0, 0, 0);
531
533 upkeep_cost, happy_cost);
534
535 gtk_image_set_from_surface(p, store.surface);
536 cairo_surface_destroy(store.surface);
537}
538
539/**********************************************************************/
542void pixmap_put_overlay_tile(GdkWindow *pixmap, float zoom,
543 int canvas_x, int canvas_y,
544 struct sprite *ssprite)
545{
546 cairo_t *cr;
547 GdkDrawingContext *ctx;
548
549 if (!ssprite) {
550 return;
551 }
552
553 ctx = gdk_window_begin_draw_frame(pixmap,
554 gdk_window_get_clip_region(pixmap));
555 cr = gdk_drawing_context_get_cairo_context(ctx);
556 cairo_scale(cr, zoom, zoom);
557 cairo_set_source_surface(cr, ssprite->surface, canvas_x, canvas_y);
558 cairo_paint(cr);
559 gdk_window_end_draw_frame(pixmap, ctx);
560}
561
562/**********************************************************************/
566 int canvas_x, int canvas_y,
567 struct sprite *ssprite,
568 bool fog)
569{
570 cairo_t *cr;
571 int sswidth, ssheight;
572 const double bright = 0.65; /* Fogged brightness compared to unfogged */
573
574 if (!ssprite) {
575 return;
576 }
577
578 get_sprite_dimensions(ssprite, &sswidth, &ssheight);
579
580 if (fog) {
581 struct color *fogcol = color_alloc(0.0, 0.0, 0.0); /* black */
582 cairo_surface_t *fog_surface;
583 struct sprite *fogged;
584 unsigned char *mask_in;
585 unsigned char *mask_out;
586 int i, j;
587
588 /* Create sprites initially fully transparent */
589 fogcol->color.alpha = 0.0;
590 fogged = create_sprite(sswidth, ssheight, fogcol);
591 fog_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, sswidth, ssheight);
592
593 /* Calculate black fog mask from the original sprite's alpha channel;
594 * we don't want to blacken transparent parts of the sprite. */
595 mask_in = cairo_image_surface_get_data(ssprite->surface);
596 mask_out = cairo_image_surface_get_data(fog_surface);
597
598 for (i = 0; i < sswidth; i++) {
599 for (j = 0; j < ssheight; j++) {
600 /* In order to darken pixels of ssprite to 'bright' fraction of
601 * their original value, we need to overlay blackness of
602 * (1-bright) transparency. */
603 if (!is_bigendian()) {
604 mask_out[(j * sswidth + i) * 4 + 3]
605 = (1-bright) * mask_in[(j * sswidth + i) * 4 + 3];
606 } else {
607 mask_out[(j * sswidth + i) * 4 + 0]
608 = (1-bright) * mask_in[(j * sswidth + i) * 4 + 0];
609 }
610 }
611 }
612
613 cairo_surface_mark_dirty(fog_surface);
614
615 /* First copy original sprite canvas to intermediate sprite canvas */
616 cr = cairo_create(fogged->surface);
617 cairo_set_source_surface(cr, ssprite->surface, 0, 0);
618 cairo_paint(cr);
619
620 /* Then apply created fog to the intermediate sprite to darken it */
621 cairo_set_source_surface(cr, fog_surface, 0, 0);
622 cairo_paint(cr);
623 cairo_destroy(cr);
624
625 /* Put intermediate sprite to the target canvas */
627 fogged, 0, 0, sswidth, ssheight);
628
629 /* Free intermediate stuff */
630 cairo_surface_destroy(fog_surface);
631 free_sprite(fogged);
632 color_free(fogcol);
633 } else {
635 ssprite, 0, 0, sswidth, ssheight);
636 }
637}
638
639/**********************************************************************/
642void put_cross_overlay_tile(struct tile *ptile)
643{
644 float canvas_x, canvas_y;
645
647 pixmap_put_overlay_tile(gtk_widget_get_window(map_canvas), map_zoom,
650 }
651}
652
653/**********************************************************************/
657{
658 gdouble ov_scroll_x, ov_scroll_y;
659 GtkAdjustment *ov_hadj, *ov_vadj;
660
661 ov_hadj = gtk_scrolled_window_get_hadjustment(
662 GTK_SCROLLED_WINDOW(overview_scrolled_window));
663 ov_vadj = gtk_scrolled_window_get_vadjustment(
664 GTK_SCROLLED_WINDOW(overview_scrolled_window));
665
666 ov_scroll_x = MIN(x - (overview_canvas_store_width / 2),
667 gtk_adjustment_get_upper(ov_hadj)
668 - gtk_adjustment_get_page_size(ov_hadj));
669 ov_scroll_y = MIN(y - (overview_canvas_store_height / 2),
670 gtk_adjustment_get_upper(ov_vadj)
671 - gtk_adjustment_get_page_size(ov_vadj));
672
673 gtk_adjustment_set_value(ov_hadj, ov_scroll_x);
674 gtk_adjustment_set_value(ov_vadj, ov_scroll_y);
675}
676
677/**********************************************************************/
681{
682 int scroll_x, scroll_y;
683
684 get_mapview_scroll_pos(&scroll_x, &scroll_y);
685 gtk_adjustment_set_value(map_hadj, scroll_x);
686 gtk_adjustment_set_value(map_vadj, scroll_y);
688 gtk_widget_queue_draw(overview_canvas);
689 }
690}
691
692/**********************************************************************/
696{
697 float xmin, ymin, xmax, ymax;
698 int xsize, ysize, xstep, ystep;
699
700 get_mapview_scroll_window(&xmin, &ymin, &xmax, &ymax, &xsize, &ysize);
701 get_mapview_scroll_step(&xstep, &ystep);
702
703 map_hadj = gtk_adjustment_new(-1, xmin, xmax, xstep, xsize, xsize);
704 map_vadj = gtk_adjustment_new(-1, ymin, ymax, ystep, ysize, ysize);
705
706 gtk_range_set_adjustment(GTK_RANGE(map_horizontal_scrollbar), map_hadj);
707 gtk_range_set_adjustment(GTK_RANGE(map_vertical_scrollbar), map_vadj);
708
709 g_signal_connect(map_hadj, "value_changed",
710 G_CALLBACK(scrollbar_jump_callback),
711 GINT_TO_POINTER(TRUE));
712 g_signal_connect(map_vadj, "value_changed",
713 G_CALLBACK(scrollbar_jump_callback),
714 GINT_TO_POINTER(FALSE));
715}
716
717/**********************************************************************/
720void scrollbar_jump_callback(GtkAdjustment *adj, gpointer hscrollbar)
721{
722 int scroll_x, scroll_y;
723
724 if (!can_client_change_view()) {
725 return;
726 }
727
728 get_mapview_scroll_pos(&scroll_x, &scroll_y);
729
730 if (hscrollbar) {
731 scroll_x = gtk_adjustment_get_value(adj);
732 } else {
733 scroll_y = gtk_adjustment_get_value(adj);
734 }
735
736 set_mapview_scroll_pos(scroll_x, scroll_y, mouse_zoom);
737}
738
739/**********************************************************************/
748void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
749{
750 double dashes[2] = {4.0, 4.0};
751 struct color *pcolor;
752 cairo_t *cr;
753 GdkDrawingContext *ctx;
754 GdkWindow *wndw;
755
756 if (w == 0 || h == 0) {
757 return;
758 }
759
760 pcolor = get_color(tileset, COLOR_MAPVIEW_SELECTION);
761 if (!pcolor) {
762 return;
763 }
764
765 wndw = gtk_widget_get_window(map_canvas);
766 ctx = gdk_window_begin_draw_frame(wndw,
767 gdk_window_get_clip_region(wndw));
768 cr = gdk_drawing_context_get_cairo_context(ctx);
769 gdk_cairo_set_source_rgba(cr, &pcolor->color);
770 cairo_set_line_width(cr, 2.0);
771 cairo_set_dash(cr, dashes, 2, 0);
772 cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
773 cairo_rectangle(cr, canvas_x, canvas_y, w, h);
774 cairo_stroke(cr);
775 gdk_window_end_draw_frame(wndw, ctx);
776}
777
778/**********************************************************************/
782{
788
789 /* keep the icon of the executable on Windows (see PR#36491) */
790#ifndef FREECIV_MSWINDOWS
791 {
793
794 /* Only call this after tileset_load_tiles is called. */
795 gtk_window_set_icon(GTK_WINDOW(toplevel), pixbuf);
796 g_object_unref(pixbuf);
797 }
798#endif /* FREECIV_MSWINDOWS */
799}
800
801/**********************************************************************/
804void start_turn(void)
805{}
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color * pcolor
Definition canvas_g.h:57
struct canvas int int canvas_y
Definition canvas_g.h:43
struct canvas int canvas_x
Definition canvas_g.h:43
canvas_put_sprite
Definition canvas_g.h:42
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
struct canvas * pcanvas
Definition canvas_g.h:42
struct canvas int int struct sprite bool fog
Definition canvas_g.h:51
bool client_is_observer(void)
bool can_client_change_view(void)
#define client_player()
struct sprite * client_warming_sprite(void)
Definition climisc.c:371
struct sprite * client_cooling_sprite(void)
Definition climisc.c:388
struct sprite * client_research_sprite(void)
Definition climisc.c:348
struct sprite * client_government_sprite(void)
Definition climisc.c:406
struct color * get_color(const struct tileset *t, enum color_std stdcolor)
void update_unit_pix_label(struct unit_list *punitlist)
Definition control.c:984
void control_mouse_cursor(struct tile *ptile)
Definition control.c:1214
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
bool get_turn_done_button_state()
#define MAX_LEN_NAME
Definition fc_types.h:66
@ O_SCIENCE
Definition fc_types.h:91
@ O_LUXURY
Definition fc_types.h:91
@ O_GOLD
Definition fc_types.h:91
#define _(String)
Definition fcintl.h:67
int current_turn_timeout(void)
Definition game.c:828
#define FC_STATIC_CANVAS_INIT
Definition canvas.h:27
void reset_city_dialogs(void)
Definition citydlg.c:357
struct color * color_alloc(int r, int g, int b)
Definition colors.c:38
void color_free(struct color *color)
Definition colors.c:53
void editgui_tileset_changed(void)
Definition editgui.c:1861
static GtkWidget * source
Definition gotodlg.c:58
GdkCursor * fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]
Definition graphics.c:48
GtkWidget * map_vertical_scrollbar
Definition gui_main.c:108
GtkWidget * main_label_info
Definition gui_main.c:137
GtkWidget * unit_info_label
Definition gui_main.c:150
GtkWidget * timeout_label
Definition gui_main.c:147
GtkWidget * overview_scrolled_window
Definition gui_main.c:111
GtkWidget * econ_ebox
Definition gui_main.c:154
GtkWidget * government_label
Definition gui_main.c:146
GtkWidget * sun_label
Definition gui_main.c:144
GtkWidget * turn_done_button
Definition gui_main.c:148
void reset_unit_table(void)
Definition gui_main.c:972
GtkWidget * unit_info_frame
Definition gui_main.c:152
GdkWindow * root_window
Definition gui_main.c:125
GtkWidget * sun_ebox
Definition gui_main.c:156
GtkWidget * bulb_ebox
Definition gui_main.c:155
GtkWidget * flake_label
Definition gui_main.c:145
GtkWidget * bulb_label
Definition gui_main.c:143
GtkWidget * overview_canvas
Definition gui_main.c:110
GtkWidget * toplevel
Definition gui_main.c:124
GtkWidget * map_horizontal_scrollbar
Definition gui_main.c:107
GtkWidget * map_canvas
Definition gui_main.c:106
GtkWidget * econ_label[10]
Definition gui_main.c:142
GtkWidget * government_ebox
Definition gui_main.c:158
GtkWidget * flake_ebox
Definition gui_main.c:157
int overview_canvas_store_width
Definition gui_main.c:121
int overview_canvas_store_height
Definition gui_main.c:122
GtkWidget * main_frame_civ_name
Definition gui_main.c:136
#define GUI_GTK_OPTION(optname)
Definition gui_main.h:25
void update_timeout_label(void)
Definition mapview.c:101
void flush_dirty(void)
Definition mapview.c:450
static int cursor_frame
Definition mapview.c:66
void update_info_label(void)
Definition mapview.c:121
void update_turn_done_button(bool do_restore)
Definition mapview.c:75
void scrollbar_jump_callback(GtkAdjustment *adj, gpointer hscrollbar)
Definition mapview.c:700
void dirty_all(void)
Definition mapview.c:438
void tileset_changed(void)
Definition mapview.c:764
void put_cross_overlay_tile(struct tile *ptile)
Definition mapview.c:622
void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
Definition mapview.c:728
void update_map_canvas_scrollbars_size(void)
Definition mapview.c:675
void get_overview_area_dimensions(int *width, int *height)
Definition mapview.c:300
void mapview_freeze(void)
Definition mapview.c:356
GdkPixbuf * get_thumb_pixbuf(int onoff)
Definition mapview.c:275
void start_turn(void)
Definition mapview.c:787
void update_unit_info_label(struct unit_list *punits)
Definition mapview.c:258
void update_overview_scroll_window_pos(int x, int y)
Definition mapview.c:636
void update_city_descriptions(void)
Definition mapview.c:470
gboolean map_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
Definition mapview.c:407
void pixmap_put_overlay_tile(GdkWindow *pixmap, float zoom, int canvas_x, int canvas_y, struct sprite *ssprite)
Definition mapview.c:525
void gui_flush(void)
Definition mapview.c:462
void put_unit_image_city_overlays(struct unit *punit, GtkImage *p, int height, int *upkeep_cost, int happy_cost)
Definition mapview.c:503
void pixmap_put_overlay_tile_draw(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *ssprite, bool fog)
Definition mapview.c:545
void update_map_canvas_scrollbars(void)
Definition mapview.c:660
bool mapview_is_frozen(void)
Definition mapview.c:378
static gboolean anim_cursor_cb(gpointer data)
Definition mapview.c:214
void overview_size_changed(void)
Definition mapview.c:309
void map_canvas_size_refresh(void)
Definition mapview.c:397
static int cursor_timer_id
Definition mapview.c:66
static GtkAdjustment * map_vadj
Definition mapview.c:65
static int mapview_frozen_level
Definition mapview.c:67
void mapview_thaw(void)
Definition mapview.c:364
struct canvas * get_overview_window(void)
Definition mapview.c:320
gboolean map_canvas_configure(GtkWidget *w, GdkEventConfigure *ev, gpointer data)
Definition mapview.c:386
void put_unit_image(struct unit *punit, GtkImage *p, int height)
Definition mapview.c:478
void update_mouse_cursor(enum cursor_type new_cursor_type)
Definition mapview.c:240
static GtkAdjustment * map_hadj
Definition mapview.c:65
void set_indicator_icons(struct sprite *bulb, struct sprite *sol, struct sprite *flake, struct sprite *gov)
Definition mapview.c:285
gboolean overview_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
Definition mapview.c:339
#define CURSOR_INTERVAL
Definition mapview.h:32
void science_report_dialog_redraw(void)
Definition repodlgs.c:761
void get_sprite_dimensions(struct sprite *sprite, int *width, int *height)
Definition sprite.c:107
void free_sprite(struct sprite *s)
Definition sprite.c:278
GdkPixbuf * sprite_get_pixbuf(struct sprite *sprite)
Definition sprite.c:402
void blank_max_unit_size(void)
Definition wldlg.c:79
const char * name
Definition inputfile.c:127
#define fc_assert(condition)
Definition log.h:176
bool map_is_empty(void)
Definition map.c:149
const char * get_timeout_label_text()
Definition text.c:1590
void update_map_canvas_visible(void)
struct view mapview
void put_unit(const struct unit *punit, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
void get_mapview_scroll_pos(int *scroll_x, int *scroll_y)
void get_mapview_scroll_window(float *xmin, float *ymin, float *xmax, float *ymax, int *xsize, int *ysize)
void unqueue_mapview_updates(bool write_to_screen)
void get_mapview_scroll_step(int *xstep, int *ystep)
void set_mapview_scroll_pos(int scroll_x, int scroll_y, float zoom)
void put_unit_city_overlays(struct unit *punit, struct canvas *pcanvas, int canvas_x, int canvas_y, int *upkeep_cost, int happy_cost)
void update_animation(void)
bool map_canvas_resized(int width, int height)
bool tile_to_canvas_pos(float *canvas_x, float *canvas_y, float zoom, const struct tile *ptile)
dirty_rect
Definition mapview_g.h:47
int int int pixel_width
Definition mapview_g.h:48
const char * nation_plural_for_player(const struct player *pplayer)
Definition nation.c:177
struct client_options gui_options
Definition options.c:71
#define GUI_GTK_OVERVIEW_MIN_XSIZE
Definition options.h:574
#define GUI_GTK_OVERVIEW_MIN_YSIZE
Definition options.h:575
int len
Definition packhand.c:125
const char * get_government_tooltip(void)
Definition text.c:1511
const char * get_nuclear_winter_tooltip(void)
Definition text.c:1484
const char * get_bulb_tooltip(void)
Definition text.c:1400
const char * get_info_label_text(bool)
Definition text.c:950
const char * get_global_warming_tooltip(void)
Definition text.c:1457
#define MIN(x, y)
Definition shared.h:55
#define BOOL_VAL(x)
Definition shared.h:70
create_sprite
Definition sprite_g.h:30
float zoom
Definition canvas.h:24
cairo_surface_t * surface
Definition canvas.h:22
cairo_t * drawable
Definition canvas.h:23
struct overview overview
Definition options.h:402
Definition colors.h:20
GdkRGBA color
Definition colors.h:21
int width
Definition options.h:93
struct canvas * window
Definition options.h:99
int height
Definition options.h:93
struct player_economic economic
Definition player.h:284
struct nation_type * nation
Definition player.h:260
cairo_surface_t * surface
Definition sprite.h:23
Definition tile.h:49
Definition unit.h:138
struct canvas * store
static bool is_bigendian(void)
Definition support.h:207
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
#define sz_strlcat(dest, src)
Definition support.h:168
const char * get_unit_info_label_text2(struct unit_list *punits, int linebreaks)
Definition text.c:1112
const char * get_unit_info_label_text1(struct unit_list *punits)
Definition text.c:1087
struct sprite * get_attention_crosshair_sprite(const struct tileset *t)
Definition tilespec.c:6685
int tileset_full_tile_height(const struct tileset *t)
Definition tilespec.c:752
int tileset_unit_layout_offset_y(const struct tileset *t)
Definition tilespec.c:845
struct sprite * get_treaty_thumb_sprite(const struct tileset *t, bool on_off)
Definition tilespec.c:6605
struct sprite * get_icon_sprite(const struct tileset *t, enum icon_type icon)
Definition tilespec.c:6674
int tileset_full_tile_width(const struct tileset *t)
Definition tilespec.c:739
struct sprite * get_tax_sprite(const struct tileset *t, Output_type_id otype)
Definition tilespec.c:6575
#define NUM_CURSOR_FRAMES
Definition tilespec.h:300
@ ICON_FREECIV
Definition tilespec.h:310
cursor_type
Definition tilespec.h:285
@ CURSOR_DEFAULT
Definition tilespec.h:297
float mouse_zoom
Definition zoom.c:28
float map_zoom
Definition zoom.c:25