Freeciv-3.3: /fast/freeciv/nightly/main/client/gui-gtk-4.0/mapview.c Source File

Freeciv-3.3

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 "nation.h"
39#include "player.h"
40
41/* client */
42#include "client_main.h"
43#include "climap.h"
44#include "climisc.h"
45#include "colors.h"
46#include "control.h" /* get_unit_in_focus() */
47#include "editor.h"
48#include "options.h"
49#include "overview_common.h"
50#include "tilespec.h"
51#include "text.h"
52#include "zoom.h"
53
54/* client/gui-gtk-4.0 */
55#include "citydlg.h" /* For reset_city_dialogs() */
56#include "editgui.h"
57#include "graphics.h"
58#include "gui_main.h"
59#include "gui_stuff.h"
60#include "mapctrl.h"
61#include "repodlgs.h"
62#include "wldlg.h"
63
64#include "mapview.h"
65
66 static GtkAdjustment *map_hadj, *map_vadj;
67 static int cursor_timer_id = 0, cursor_type = -1, cursor_frame = 0;
68 static int mapview_frozen_level = 0;
69
70 static int mc_actual_width = -1;
71 static int mc_actual_height = -1;
72
73/**********************************************************************/
79 void update_turn_done_button(bool do_restore)
80{
81 static bool flip = FALSE;
82
83 if (!get_turn_done_button_state()) {
84 return;
85 }
86
87 if ((do_restore && flip) || !do_restore) {
88 static GtkCssProvider *tdb_provider = NULL;
89
90 if (tdb_provider == NULL) {
91 tdb_provider = gtk_css_provider_new();
92
93 gtk_css_provider_load_from_data(tdb_provider,
94 ".td_lighted {\n"
95 "color: rgba(235, 127, 235, 255);\n"
96 "background-color: rgba(127, 127, 127, 255);\n"
97 "}\n",
98 -1);
99
100 /* Turn Done button is persistent, so we only need to do this
101 * once too. */
102 gtk_style_context_add_provider_for_display(
103 gtk_widget_get_display(toplevel),
104 GTK_STYLE_PROVIDER(tdb_provider),
105 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
106 }
107
108 if (flip) {
109 gtk_widget_add_css_class(turn_done_button, "td_lighted");
110 } else {
111 gtk_widget_remove_css_class(turn_done_button, "td_lighted");
112 }
113
114 flip = !flip;
115 }
116}
117
118/**********************************************************************/
121 void update_timeout_label(void)
122{
123 gtk_label_set_text(GTK_LABEL(timeout_label), get_timeout_label_text());
124
125 if (current_turn_timeout() > 0) {
126 gtk_widget_set_tooltip_text(timeout_label,
127 _("Time to forced turn change,\n"
128 "or estimated time to finish turn change "
129 "processing."));
130 } else {
131 gtk_widget_set_tooltip_text(timeout_label,
132 _("Turn timeout disabled.\n"
133 "Between turns this shows estimated time "
134 "to finish turn change processing."));
135 }
136}
137
138/**********************************************************************/
141 void update_info_label(void)
142{
143 GtkWidget *label;
144 const struct player *pplayer = client_player();
145
146 label = gtk_frame_get_label_widget(GTK_FRAME(main_frame_civ_name));
147 if (pplayer != NULL) {
148 const gchar *name;
149 gunichar c;
150
151 /* Capitalize the first character of the translated nation
152 * plural name so that the frame label looks good. */
153 name = nation_plural_for_player(pplayer);
154 c = g_utf8_get_char_validated(name, -1);
155 if ((gunichar) -1 != c && (gunichar) -2 != c) {
156 const char *obstext = NULL;
157 int obstextlen = 0;
158
159 if (client_is_observer()) {
160 obstext = _(" (observer)");
161 obstextlen = strlen(obstext);
162 }
163
164 {
165 gchar nation[MAX_LEN_NAME + obstextlen];
166 gchar *next;
167 gint len;
168
169 len = g_unichar_to_utf8(g_unichar_toupper(c), nation);
170 nation[len] = '\0';
171 next = g_utf8_find_next_char(name, NULL);
172 if (NULL != next) {
173 sz_strlcat(nation, next);
174 }
175 if (obstext != NULL) {
176 sz_strlcat(nation, obstext);
177 }
178 gtk_label_set_text(GTK_LABEL(label), nation);
179 }
180 } else {
181 gtk_label_set_text(GTK_LABEL(label), name);
182 }
183 } else {
184 gtk_label_set_text(GTK_LABEL(label), "-");
185 }
186
187 gtk_label_set_text(GTK_LABEL(main_label_info),
188 get_info_label_text(!GUI_GTK_OPTION(small_display_layout)));
189
190 set_indicator_icons(client_research_sprite(),
191 client_warming_sprite(),
192 client_cooling_sprite(),
193 client_government_sprite());
194
195 if (NULL != pplayer) {
196 int d = 0;
197
198 for (; d < pplayer->economic.luxury / 10; d++) {
199 struct sprite *spr = get_tax_sprite(tileset, O_LUXURY);
200
201 picture_set_from_surface(GTK_PICTURE(econ_label[d]), spr->surface);
202 }
203
204 for (; d < (pplayer->economic.science
205 + pplayer->economic.luxury) / 10; d++) {
206 struct sprite *spr = get_tax_sprite(tileset, O_SCIENCE);
207
208 picture_set_from_surface(GTK_PICTURE(econ_label[d]), spr->surface);
209 }
210
211 for (; d < 10; d++) {
212 struct sprite *spr = get_tax_sprite(tileset, O_GOLD);
213
214 picture_set_from_surface(GTK_PICTURE(econ_label[d]), spr->surface);
215 }
216 }
217
218 update_timeout_label();
219
220 /* Update tooltips. */
221 gtk_widget_set_tooltip_text(econ_widget,
222 _("Shows your current luxury/science/tax rates; "
223 "click to toggle them."));
224
225 gtk_widget_set_tooltip_text(bulb_label, get_bulb_tooltip());
226 gtk_widget_set_tooltip_text(sun_label, get_global_warming_tooltip());
227 gtk_widget_set_tooltip_text(flake_label, get_nuclear_winter_tooltip());
228 gtk_widget_set_tooltip_text(government_label, get_government_tooltip());
229}
230
231/**********************************************************************/
234 static gboolean anim_cursor_cb(gpointer data)
235{
236 if (!cursor_timer_id) {
237 return FALSE;
238 }
239
240 cursor_frame++;
241 if (cursor_frame == NUM_CURSOR_FRAMES) {
242 cursor_frame = 0;
243 }
244
245 if (cursor_type == CURSOR_DEFAULT) {
246 gtk_widget_set_cursor(toplevel, NULL);
247 cursor_timer_id = 0;
248 return FALSE;
249 }
250
251 gtk_widget_set_cursor(toplevel,
252 fc_cursors[cursor_type][cursor_frame]);
253 control_mouse_cursor(NULL);
254 return TRUE;
255}
256
257/**********************************************************************/
260 void update_mouse_cursor(enum cursor_type new_cursor_type)
261{
262 cursor_type = new_cursor_type;
263 if (!cursor_timer_id) {
264 cursor_timer_id = g_timeout_add(CURSOR_INTERVAL, anim_cursor_cb, NULL);
265 }
266}
267
268/**********************************************************************/
278 void update_unit_info_label(struct unit_list *punits)
279{
280 GtkWidget *label;
281
282 label = gtk_frame_get_label_widget(GTK_FRAME(unit_info_frame));
283 gtk_label_set_text(GTK_LABEL(label),
284 get_unit_info_label_text1(punits));
285
286 gtk_label_set_text(GTK_LABEL(unit_info_label),
287 get_unit_info_label_text2(punits, 0));
288
289 update_unit_pix_label(punits);
290}
291
292/**********************************************************************/
295 GdkPixbuf *get_thumb_pixbuf(int onoff)
296{
297 return sprite_get_pixbuf(get_treaty_thumb_sprite(tileset, BOOL_VAL(onoff)));
298}
299
300/**********************************************************************/
305 void set_indicator_icons(struct sprite *bulb, struct sprite *sol,
306 struct sprite *flake, struct sprite *gov)
307{
308 picture_set_from_surface(GTK_PICTURE(bulb_label), bulb->surface);
309 picture_set_from_surface(GTK_PICTURE(sun_label), sol->surface);
310 picture_set_from_surface(GTK_PICTURE(flake_label), flake->surface);
311 picture_set_from_surface(GTK_PICTURE(government_label), gov->surface);
312}
313
314/**********************************************************************/
320 void get_overview_area_dimensions(int *width, int *height)
321{
322 *width = GUI_GTK_OVERVIEW_MIN_XSIZE;
323 *height = GUI_GTK_OVERVIEW_MIN_YSIZE;
324}
325
326/**********************************************************************/
329 void overview_size_changed(void)
330{
331 gtk_widget_set_size_request(overview_canvas,
332 gui_options.overview.width,
333 gui_options.overview.height);
334 update_map_canvas_scrollbars_size();
335}
336
337/**********************************************************************/
340 struct canvas *get_overview_window(void)
341{
342#if 0
343 static struct canvas store;
344 GtkNative *nat = gtk_widget_get_native(overview_canvas);
345
346 store.surface = NULL;
347 store.drawable = gdk_cairo_create(gtk_native_get_surface(nat));
348
349 return &store;
350#endif /* 0 */
351 if (can_client_change_view()) {
352 gtk_widget_queue_draw(overview_canvas);
353 }
354
355 return NULL;
356}
357
358/**********************************************************************/
361 void overview_canvas_draw(GtkDrawingArea *w, cairo_t *cr,
362 int width, int height, gpointer data)
363{
364 gpointer source = (can_client_change_view()) ?
365 (gpointer)gui_options.overview.window : NULL;
366
367 if (source) {
368 cairo_surface_t *surface = gui_options.overview.window->surface;
369
370 cairo_set_source_surface(cr, surface, 0, 0);
371 cairo_paint(cr);
372 }
373}
374
375/**********************************************************************/
378 void mapview_freeze(void)
379{
380 mapview_frozen_level++;
381}
382
383/**********************************************************************/
386 void mapview_thaw(void)
387{
388 if (1 < mapview_frozen_level) {
389 mapview_frozen_level--;
390 } else {
391 fc_assert(0 < mapview_frozen_level);
392 mapview_frozen_level = 0;
393 dirty_all();
394 }
395}
396
397/**********************************************************************/
400 bool mapview_is_frozen(void)
401{
402 return (0 < mapview_frozen_level);
403}
404
405/**********************************************************************/
408 void map_canvas_resize(GtkWidget *w, int width, int height,
409 gpointer data)
410{
411 mc_actual_width = width;
412 mc_actual_height = height;
413
414 map_canvas_size_refresh();
415}
416
417/**********************************************************************/
420 void map_canvas_size_refresh(void)
421{
422 map_canvas_resized(mc_actual_width / mouse_zoom,
423 mc_actual_height / mouse_zoom);
424}
425
426/**********************************************************************/
429 void map_canvas_draw(GtkDrawingArea *w, cairo_t *cr,
430 int width, int height, gpointer data)
431{
432 if (can_client_change_view() && !map_is_empty() && !mapview_is_frozen()) {
433 /* First we mark the area to be updated as dirty. Then we unqueue
434 * any pending updates, to make sure only the most up-to-date data
435 * is written (otherwise drawing bugs happen when old data is copied
436 * to screen). Then we draw all changed areas to the screen. */
437 unqueue_mapview_updates(FALSE);
438 cairo_scale(cr, mouse_zoom, mouse_zoom);
439 cairo_set_source_surface(cr, mapview.store->surface, 0, 0);
440 cairo_paint(cr);
441 }
442}
443
444/**********************************************************************/
448 void dirty_rect(int canvas_x, int canvas_y,
449 int pixel_width, int pixel_height)
450{
451 dirty_all();
452}
453
454/**********************************************************************/
457 void dirty_all(void)
458{
459 if (gtk_widget_get_realized(map_canvas)) {
460 gtk_widget_queue_draw(map_canvas);
461 }
462}
463
464/**********************************************************************/
469 void flush_dirty(void)
470{
471}
472
473/**********************************************************************/
478 void gui_flush(void)
479{
480 cairo_surface_flush(mapview.store->surface);
481}
482
483/**********************************************************************/
486 void update_city_descriptions(void)
487{
488 update_map_canvas_visible();
489}
490
491/**********************************************************************/
494 void put_unit_picture(struct unit *punit, GtkPicture *p, int height)
495{
496 struct canvas store = FC_STATIC_CANVAS_INIT;
497 int width;
498
499 if (height <= 0) {
500 height = tileset_full_tile_height(tileset);
501 }
502 width = tileset_full_tile_width(tileset);
503
504 store.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
505 width, height);
506
507 put_unit(punit, &store, 1.0, 0, 0);
508
509 picture_set_from_surface(p, store.surface);
510 cairo_surface_destroy(store.surface);
511}
512
513/**********************************************************************/
519 void put_unit_picture_city_overlays(struct unit *punit, GtkPicture *p,
520 int height,
521 int *upkeep_cost, int happy_cost)
522{
523 struct canvas store = FC_STATIC_CANVAS_INIT;
524 int width = tileset_full_tile_width(tileset);
525
526 store.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
527 width, height);
528
529 put_unit(punit, &store, 1.0, 0, 0);
530
531 put_unit_city_overlays(punit, &store, 0, tileset_unit_layout_offset_y(tileset),
532 upkeep_cost, happy_cost);
533
534 picture_set_from_surface(p, store.surface);
535 cairo_surface_destroy(store.surface);
536}
537
538/**********************************************************************/
541 void pixmap_put_overlay_tile(GdkSurface *pixmap, float zoom,
542 int canvas_x, int canvas_y,
543 struct sprite *ssprite)
544{
545#if 0
546 cairo_t *cr;
547 GdkDrawingContext *ctx;
548
549 if (!ssprite) {
550 return;
551 }
552
553 ctx = gdk_window_begin_draw_frame(pixmap, NULL,
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#endif
561}
562
563/**********************************************************************/
566 void pixmap_put_overlay_tile_draw(struct canvas *pcanvas,
567 int canvas_x, int canvas_y,
568 struct sprite *ssprite,
569 bool fog)
570{
571 cairo_t *cr;
572 int sswidth, ssheight;
573 const double bright = 0.65; /* Fogged brightness compared to unfogged */
574
575 if (!ssprite) {
576 return;
577 }
578
579 get_sprite_dimensions(ssprite, &sswidth, &ssheight);
580
581 if (fog) {
582 struct color *fogcol = color_alloc(0.0, 0.0, 0.0); /* black */
583 cairo_surface_t *fog_surface;
584 struct sprite *fogged;
585 unsigned char *mask_in;
586 unsigned char *mask_out;
587 int i, j;
588
589 /* Create sprites initially fully transparent */
590 fogcol->color.alpha = 0.0;
591 fogged = create_sprite(sswidth, ssheight, fogcol);
592 fog_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, sswidth, ssheight);
593
594 /* Calculate black fog mask from the original sprite's alpha channel;
595 * we don't want to blacken transparent parts of the sprite. */
596 mask_in = cairo_image_surface_get_data(ssprite->surface);
597 mask_out = cairo_image_surface_get_data(fog_surface);
598
599 for (i = 0; i < sswidth; i++) {
600 for (j = 0; j < ssheight; j++) {
601 /* In order to darken pixels of ssprite to 'bright' fraction of
602 * their original value, we need to overlay blackness of
603 * (1-bright) transparency. */
604 if (!is_bigendian()) {
605 mask_out[(j * sswidth + i) * 4 + 3]
606 = (1-bright) * mask_in[(j * sswidth + i) * 4 + 3];
607 } else {
608 mask_out[(j * sswidth + i) * 4 + 0]
609 = (1-bright) * mask_in[(j * sswidth + i) * 4 + 0];
610 }
611 }
612 }
613
614 cairo_surface_mark_dirty(fog_surface);
615
616 /* First copy original sprite canvas to intermediate sprite canvas */
617 cr = cairo_create(fogged->surface);
618 cairo_set_source_surface(cr, ssprite->surface, 0, 0);
619 cairo_paint(cr);
620
621 /* Then apply created fog to the intermediate sprite to darken it */
622 cairo_set_source_surface(cr, fog_surface, 0, 0);
623 cairo_paint(cr);
624 cairo_destroy(cr);
625
626 /* Put intermediate sprite to the target canvas */
627 canvas_put_sprite(pcanvas, canvas_x, canvas_y,
628 fogged, 0, 0, sswidth, ssheight);
629
630 /* Free intermediate stuff */
631 cairo_surface_destroy(fog_surface);
632 free_sprite(fogged);
633 color_free(fogcol);
634 } else {
635 canvas_put_sprite(pcanvas, canvas_x, canvas_y,
636 ssprite, 0, 0, sswidth, ssheight);
637 }
638}
639
640/**********************************************************************/
643 void put_cross_overlay_tile(struct tile *ptile)
644{
645 float canvas_x, canvas_y;
646
647 if (tile_to_canvas_pos(&canvas_x, &canvas_y, map_zoom, ptile)) {
648 GtkNative *nat = gtk_widget_get_native(map_canvas);
649
650 pixmap_put_overlay_tile(gtk_native_get_surface(nat), map_zoom,
651 canvas_x / map_zoom, canvas_y / map_zoom,
652 get_attention_crosshair_sprite(tileset));
653 }
654}
655
656/**********************************************************************/
659 void update_overview_scroll_window_pos(int x, int y)
660{
661 gdouble ov_scroll_x, ov_scroll_y;
662 GtkAdjustment *ov_hadj, *ov_vadj;
663
664 ov_hadj = gtk_scrolled_window_get_hadjustment(
665 GTK_SCROLLED_WINDOW(overview_scrolled_window));
666 ov_vadj = gtk_scrolled_window_get_vadjustment(
667 GTK_SCROLLED_WINDOW(overview_scrolled_window));
668
669 ov_scroll_x = MIN(x - (overview_canvas_store_width / 2),
670 gtk_adjustment_get_upper(ov_hadj)
671 - gtk_adjustment_get_page_size(ov_hadj));
672 ov_scroll_y = MIN(y - (overview_canvas_store_height / 2),
673 gtk_adjustment_get_upper(ov_vadj)
674 - gtk_adjustment_get_page_size(ov_vadj));
675
676 gtk_adjustment_set_value(ov_hadj, ov_scroll_x);
677 gtk_adjustment_set_value(ov_vadj, ov_scroll_y);
678}
679
680/**********************************************************************/
683 void update_map_canvas_scrollbars(void)
684{
685 int scroll_x, scroll_y;
686
687 get_mapview_scroll_pos(&scroll_x, &scroll_y);
688 gtk_adjustment_set_value(map_hadj, scroll_x);
689 gtk_adjustment_set_value(map_vadj, scroll_y);
690 if (can_client_change_view()) {
691 gtk_widget_queue_draw(overview_canvas);
692 }
693}
694
695/**********************************************************************/
698 void update_map_canvas_scrollbars_size(void)
699{
700 float xmin, ymin, xmax, ymax;
701 int xsize, ysize, xstep, ystep;
702
703 get_mapview_scroll_window(&xmin, &ymin, &xmax, &ymax, &xsize, &ysize);
704 get_mapview_scroll_step(&xstep, &ystep);
705
706 map_hadj = gtk_adjustment_new(-1, xmin, xmax, xstep, xsize, xsize);
707 map_vadj = gtk_adjustment_new(-1, ymin, ymax, ystep, ysize, ysize);
708
709 gtk_scrollbar_set_adjustment(GTK_SCROLLBAR(map_horizontal_scrollbar),
710 map_hadj);
711 gtk_scrollbar_set_adjustment(GTK_SCROLLBAR(map_vertical_scrollbar),
712 map_vadj);
713
714 g_signal_connect(map_hadj, "value_changed",
715 G_CALLBACK(scrollbar_jump_callback),
716 GINT_TO_POINTER(TRUE));
717 g_signal_connect(map_vadj, "value_changed",
718 G_CALLBACK(scrollbar_jump_callback),
719 GINT_TO_POINTER(FALSE));
720}
721
722/**********************************************************************/
725 void scrollbar_jump_callback(GtkAdjustment *adj, gpointer hscrollbar)
726{
727 int scroll_x, scroll_y;
728
729 if (!can_client_change_view()) {
730 return;
731 }
732
733 get_mapview_scroll_pos(&scroll_x, &scroll_y);
734
735 if (hscrollbar) {
736 scroll_x = gtk_adjustment_get_value(adj);
737 } else {
738 scroll_y = gtk_adjustment_get_value(adj);
739 }
740
741 set_mapview_scroll_pos(scroll_x, scroll_y, mouse_zoom);
742}
743
744/**********************************************************************/
753 void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
754{
755 struct color *pcolor;
756
757 if (w == 0 || h == 0) {
758 return;
759 }
760
761 pcolor = get_color(tileset, COLOR_MAPVIEW_SELECTION);
762 if (!pcolor) {
763 return;
764 }
765
766 canvas_put_line(mapview.store, pcolor, LINE_SELECT_RECT,
767 canvas_x, canvas_y, w, 0);
768 canvas_put_line(mapview.store, pcolor, LINE_SELECT_RECT,
769 canvas_x, canvas_y, 0, h);
770 canvas_put_line(mapview.store, pcolor, LINE_SELECT_RECT,
771 canvas_x, canvas_y + h, w, 0);
772 canvas_put_line(mapview.store, pcolor, LINE_SELECT_RECT,
773 canvas_x + w, canvas_y, 0, h);
774}
775
776/**********************************************************************/
779 void tileset_changed(void)
780{
781 science_report_dialog_redraw();
782 reset_city_dialogs();
783 reset_unit_table();
784 blank_max_unit_size();
785 editgui_tileset_changed();
786
787 /* Keep the icon of the executable on Windows (see PR#36491) */
788#ifndef FREECIV_MSWINDOWS
789 {
790 /* Only call this after tileset_load_tiles is called. */
791 gtk_window_set_icon_name(GTK_WINDOW(toplevel), "freeciv");
792 }
793#endif /* FREECIV_MSWINDOWS */
794}
795
796/**********************************************************************/
799 void start_turn(void)
800{}
height
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
pcolor
struct canvas int int int int struct sprite *sprite struct canvas struct color * pcolor
Definition canvas_g.h:56
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_line
struct canvas int int int int struct sprite *sprite struct canvas struct color int int int int height canvas_put_line
Definition canvas_g.h:62
canvas_put_sprite
canvas_put_sprite
Definition canvas_g.h:42
pcanvas
struct canvas * pcanvas
Definition canvas_g.h:42
width
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
LINE_SELECT_RECT
@ LINE_SELECT_RECT
Definition canvas_g.h:26
client_is_observer
bool client_is_observer(void)
Definition client_main.c:1091
can_client_change_view
bool can_client_change_view(void)
Definition client_main.c:1320
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:377
client_cooling_sprite
struct sprite * client_cooling_sprite(void)
Definition climisc.c:394
client_research_sprite
struct sprite * client_research_sprite(void)
Definition climisc.c:354
client_government_sprite
struct sprite * client_government_sprite(void)
Definition climisc.c:412
climisc.h
get_color
struct color * get_color(const struct tileset *t, enum color_std stdcolor)
Definition colors_common.c:100
incite_cost
char * incite_cost
Definition comments.c:74
update_unit_pix_label
void update_unit_pix_label(struct unit_list *punitlist)
Definition control.c:967
control_mouse_cursor
void control_mouse_cursor(struct tile *ptile)
Definition control.c:1189
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:74
editor.h
get_turn_done_button_state
bool get_turn_done_button_state()
Definition mapctrl_common.c:522
MAX_LEN_NAME
#define MAX_LEN_NAME
Definition fc_types.h:66
O_SCIENCE
@ O_SCIENCE
Definition fc_types.h:101
O_LUXURY
@ O_LUXURY
Definition fc_types.h:101
O_GOLD
@ O_GOLD
Definition fc_types.h:101
fcintl.h
_
#define _(String)
Definition fcintl.h:67
current_turn_timeout
int current_turn_timeout(void)
Definition game.c:851
game.h
government.h
FC_STATIC_CANVAS_INIT
#define FC_STATIC_CANVAS_INIT
Definition canvas.h:28
reset_city_dialogs
void reset_city_dialogs(void)
Definition citydlg.c:365
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:1862
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:109
main_label_info
GtkWidget * main_label_info
Definition gui_main.c:138
unit_info_label
GtkWidget * unit_info_label
Definition gui_main.c:151
timeout_label
GtkWidget * timeout_label
Definition gui_main.c:148
overview_scrolled_window
GtkWidget * overview_scrolled_window
Definition gui_main.c:112
government_label
GtkWidget * government_label
Definition gui_main.c:147
sun_label
GtkWidget * sun_label
Definition gui_main.c:145
turn_done_button
GtkWidget * turn_done_button
Definition gui_main.c:149
reset_unit_table
void reset_unit_table(void)
Definition gui_main.c:1046
unit_info_frame
GtkWidget * unit_info_frame
Definition gui_main.c:153
flake_label
GtkWidget * flake_label
Definition gui_main.c:146
bulb_label
GtkWidget * bulb_label
Definition gui_main.c:144
overview_canvas
GtkWidget * overview_canvas
Definition gui_main.c:111
toplevel
GtkWidget * toplevel
Definition gui_main.c:125
map_horizontal_scrollbar
GtkWidget * map_horizontal_scrollbar
Definition gui_main.c:108
map_canvas
GtkWidget * map_canvas
Definition gui_main.c:107
econ_label
GtkWidget * econ_label[10]
Definition gui_main.c:143
overview_canvas_store_width
int overview_canvas_store_width
Definition gui_main.c:122
overview_canvas_store_height
int overview_canvas_store_height
Definition gui_main.c:123
main_frame_civ_name
GtkWidget * main_frame_civ_name
Definition gui_main.c:137
GUI_GTK_OPTION
#define GUI_GTK_OPTION(optname)
Definition gui_main.h:25
update_timeout_label
void update_timeout_label(void)
Definition mapview.c:118
flush_dirty
void flush_dirty(void)
Definition mapview.c:468
cursor_frame
static int cursor_frame
Definition mapview.c:67
update_info_label
void update_info_label(void)
Definition mapview.c:138
update_turn_done_button
void update_turn_done_button(bool do_restore)
Definition mapview.c:76
scrollbar_jump_callback
void scrollbar_jump_callback(GtkAdjustment *adj, gpointer hscrollbar)
Definition mapview.c:721
dirty_all
void dirty_all(void)
Definition mapview.c:456
tileset_changed
void tileset_changed(void)
Definition mapview.c:782
put_cross_overlay_tile
void put_cross_overlay_tile(struct tile *ptile)
Definition mapview.c:643
draw_selection_rectangle
void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
Definition mapview.c:749
update_map_canvas_scrollbars_size
void update_map_canvas_scrollbars_size(void)
Definition mapview.c:696
get_overview_area_dimensions
void get_overview_area_dimensions(int *width, int *height)
Definition mapview.c:317
mapview_freeze
void mapview_freeze(void)
Definition mapview.c:373
get_thumb_pixbuf
GdkPixbuf * get_thumb_pixbuf(int onoff)
Definition mapview.c:292
start_turn
void start_turn(void)
Definition mapview.c:805
update_unit_info_label
void update_unit_info_label(struct unit_list *punits)
Definition mapview.c:275
update_overview_scroll_window_pos
void update_overview_scroll_window_pos(int x, int y)
Definition mapview.c:657
update_city_descriptions
void update_city_descriptions(void)
Definition mapview.c:488
map_canvas_draw
gboolean map_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
Definition mapview.c:424
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:543
gui_flush
void gui_flush(void)
Definition mapview.c:480
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:566
update_map_canvas_scrollbars
void update_map_canvas_scrollbars(void)
Definition mapview.c:681
mapview_is_frozen
bool mapview_is_frozen(void)
Definition mapview.c:395
anim_cursor_cb
static gboolean anim_cursor_cb(gpointer data)
Definition mapview.c:231
overview_size_changed
void overview_size_changed(void)
Definition mapview.c:326
map_canvas_size_refresh
void map_canvas_size_refresh(void)
Definition mapview.c:414
cursor_timer_id
static int cursor_timer_id
Definition mapview.c:67
map_vadj
static GtkAdjustment * map_vadj
Definition mapview.c:66
mapview_frozen_level
static int mapview_frozen_level
Definition mapview.c:68
mapview_thaw
void mapview_thaw(void)
Definition mapview.c:381
get_overview_window
struct canvas * get_overview_window(void)
Definition mapview.c:337
update_mouse_cursor
void update_mouse_cursor(enum cursor_type new_cursor_type)
Definition mapview.c:257
map_hadj
static GtkAdjustment * map_hadj
Definition mapview.c:66
set_indicator_icons
void set_indicator_icons(struct sprite *bulb, struct sprite *sol, struct sprite *flake, struct sprite *gov)
Definition mapview.c:302
overview_canvas_draw
gboolean overview_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
Definition mapview.c:356
CURSOR_INTERVAL
#define CURSOR_INTERVAL
Definition mapview.h:32
science_report_dialog_redraw
void science_report_dialog_redraw(void)
Definition repodlgs.c:761
free_sprite
void free_sprite(struct sprite *s)
Definition sprite.c:278
create_sprite
struct sprite * create_sprite(int width, int height, struct color *pcolor)
Definition sprite.c:84
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
econ_widget
GtkWidget * econ_widget
Definition gui_main.c:154
mc_actual_width
static int mc_actual_width
Definition mapview.c:70
mc_actual_height
static int mc_actual_height
Definition mapview.c:71
map_canvas_resize
void map_canvas_resize(GtkWidget *w, int width, int height, gpointer data)
Definition mapview.c:408
put_unit_picture_city_overlays
void put_unit_picture_city_overlays(struct unit *punit, GtkPicture *p, int height, int *upkeep_cost, int happy_cost)
Definition mapview.c:519
put_unit_picture
void put_unit_picture(struct unit *punit, GtkPicture *p, int height)
Definition mapview.c:494
picture_set_from_surface
void picture_set_from_surface(GtkPicture *pic, cairo_surface_t *surf)
Definition sprite.c:544
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:148
map.h
get_timeout_label_text
const char * get_timeout_label_text()
Definition text.c:1570
update_map_canvas_visible
void update_map_canvas_visible(void)
Definition mapview_common.c:1860
mapview
struct view mapview
Definition mapview_common.c:75
put_unit
void put_unit(const struct unit *punit, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
Definition mapview_common.c:1389
get_mapview_scroll_pos
void get_mapview_scroll_pos(int *scroll_x, int *scroll_y)
Definition mapview_common.c:1206
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:1108
unqueue_mapview_updates
void unqueue_mapview_updates(bool write_to_screen)
Definition mapview_common.c:3038
get_mapview_scroll_step
void get_mapview_scroll_step(int *xstep, int *ystep)
Definition mapview_common.c:1192
set_mapview_scroll_pos
void set_mapview_scroll_pos(int scroll_x, int scroll_y, float zoom)
Definition mapview_common.c:1215
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:1453
map_canvas_resized
bool map_canvas_resized(int width, int height)
Definition mapview_common.c:3564
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:706
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:178
nation.h
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:635
GUI_GTK_OVERVIEW_MIN_YSIZE
#define GUI_GTK_OVERVIEW_MIN_YSIZE
Definition options.h:636
overview_common.h
len
int len
Definition packhand.c:127
get_government_tooltip
const char * get_government_tooltip(void)
Definition text.c:1491
get_nuclear_winter_tooltip
const char * get_nuclear_winter_tooltip(void)
Definition text.c:1464
get_bulb_tooltip
const char * get_bulb_tooltip(void)
Definition text.c:1380
get_info_label_text
const char * get_info_label_text(bool)
Definition text.c:930
get_global_warming_tooltip
const char * get_global_warming_tooltip(void)
Definition text.c:1437
player.h
rand.h
MIN
#define MIN(x, y)
Definition shared.h:55
BOOL_VAL
#define BOOL_VAL(x)
Definition shared.h:70
y
struct sprite int int y
Definition sprite_g.h:31
x
struct sprite int x
Definition sprite_g.h:31
get_sprite_dimensions
struct sprite int int int int struct sprite int int float bool smooth get_sprite_dimensions
Definition sprite_g.h:36
canvas
Definition canvas.h:22
canvas::zoom
float zoom
Definition canvas.h:25
canvas::surface
cairo_surface_t * surface
Definition canvas.h:23
canvas::drawable
cairo_t * drawable
Definition canvas.h:24
client_options::overview
struct overview overview
Definition options.h:463
color
Definition colors.h:21
overview::width
int width
Definition options.h:94
overview::window
struct canvas * window
Definition options.h:100
overview::height
int height
Definition options.h:94
player_economic::luxury
int luxury
Definition player.h:66
player_economic::science
int science
Definition player.h:65
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:50
tileset
Definition tilespec.c:482
unit
Definition unit.h:140
view::store
struct canvas * store
Definition mapview_common.h:42
support.h
is_bigendian
static bool is_bigendian(void)
Definition support.h:229
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
sz_strlcat
#define sz_strlcat(dest, src)
Definition support.h:190
get_unit_info_label_text2
const char * get_unit_info_label_text2(struct unit_list *punits, int linebreaks)
Definition text.c:1092
get_unit_info_label_text1
const char * get_unit_info_label_text1(struct unit_list *punits)
Definition text.c:1067
text.h
get_attention_crosshair_sprite
struct sprite * get_attention_crosshair_sprite(const struct tileset *t)
Definition tilespec.c:7029
tileset_full_tile_height
int tileset_full_tile_height(const struct tileset *t)
Definition tilespec.c:790
tileset_unit_layout_offset_y
int tileset_unit_layout_offset_y(const struct tileset *t)
Definition tilespec.c:883
get_treaty_thumb_sprite
struct sprite * get_treaty_thumb_sprite(const struct tileset *t, bool on_off)
Definition tilespec.c:6948
tileset_full_tile_width
int tileset_full_tile_width(const struct tileset *t)
Definition tilespec.c:777
get_tax_sprite
struct sprite * get_tax_sprite(const struct tileset *t, Output_type_id otype)
Definition tilespec.c:6918
tilespec.h
NUM_CURSOR_FRAMES
#define NUM_CURSOR_FRAMES
Definition tilespec.h:305
cursor_type
cursor_type
Definition tilespec.h:289
CURSOR_DEFAULT
@ CURSOR_DEFAULT
Definition tilespec.h:302
timing.h
mouse_zoom
float mouse_zoom
Definition zoom.c:28
map_zoom
float map_zoom
Definition zoom.c:25
zoom.h