80 static bool flip =
FALSE;
86 if ((do_restore && flip) || !do_restore) {
87 static GtkCssProvider *tdb_provider = NULL;
89 if (tdb_provider == NULL) {
90 tdb_provider = gtk_css_provider_new();
92 gtk_css_provider_load_from_data(tdb_provider,
94 "color: rgba(235, 127, 235, 255);\n"
95 "background-color: rgba(127, 127, 127, 255);\n"
101 gtk_style_context_add_provider_for_display(
103 GTK_STYLE_PROVIDER(tdb_provider),
104 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
126 _(
"Time to forced turn change,\n"
127 "or estimated time to finish turn change "
131 _(
"Turn timeout disabled.\n"
132 "Between turns this shows estimated time "
133 "to finish turn change processing."));
146 if (pplayer != NULL) {
153 c = g_utf8_get_char_validated(
name, -1);
154 if ((gunichar) -1 != c && (gunichar) -2 != c) {
155 const char *obstext = NULL;
159 obstext =
_(
" (observer)");
160 obstextlen = strlen(obstext);
168 len = g_unichar_to_utf8(g_unichar_toupper(c),
nation);
170 next = g_utf8_find_next_char(
name, NULL);
174 if (obstext != NULL) {
177 gtk_label_set_text(GTK_LABEL(label),
nation);
180 gtk_label_set_text(GTK_LABEL(label),
name);
183 gtk_label_set_text(GTK_LABEL(label),
"-");
194 if (NULL != pplayer) {
210 for (; d < 10; d++) {
221 _(
"Shows your current luxury/science/tax rates; "
222 "click to toggle them."));
245 gtk_widget_set_cursor(
toplevel, NULL);
282 gtk_label_set_text(GTK_LABEL(label),
342 static struct canvas store;
346 store.
drawable = gdk_cairo_create(gtk_native_get_surface(nat));
368 cairo_set_source_surface(cr,
surface, 0, 0);
502 store.
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
508 cairo_surface_destroy(store.
surface);
519 int *upkeep_cost,
int happy_cost)
524 store.
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
530 upkeep_cost, happy_cost);
533 cairo_surface_destroy(store.
surface);
545 GdkDrawingContext *ctx;
551 ctx = gdk_window_begin_draw_frame(pixmap, NULL,
552 gdk_window_get_clip_region(pixmap));
553 cr = gdk_drawing_context_get_cairo_context(ctx);
557 gdk_window_end_draw_frame(pixmap, ctx);
570 int sswidth, ssheight;
571 const double bright = 0.65;
581 cairo_surface_t *fog_surface;
583 unsigned char *mask_in;
584 unsigned char *mask_out;
588 fogcol->
color.alpha = 0.0;
590 fog_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, sswidth, ssheight);
594 mask_in = cairo_image_surface_get_data(ssprite->
surface);
595 mask_out = cairo_image_surface_get_data(fog_surface);
597 for (i = 0; i < sswidth; i++) {
598 for (j = 0; j < ssheight; j++) {
603 mask_out[(j * sswidth + i) * 4 + 3]
604 = (1-bright) * mask_in[(j * sswidth + i) * 4 + 3];
606 mask_out[(j * sswidth + i) * 4 + 0]
607 = (1-bright) * mask_in[(j * sswidth + i) * 4 + 0];
612 cairo_surface_mark_dirty(fog_surface);
615 cr = cairo_create(fogged->
surface);
616 cairo_set_source_surface(cr, ssprite->
surface, 0, 0);
620 cairo_set_source_surface(cr, fog_surface, 0, 0);
626 fogged, 0, 0, sswidth, ssheight);
629 cairo_surface_destroy(fog_surface);
634 ssprite, 0, 0, sswidth, ssheight);
646 GtkNative *nat = gtk_widget_get_native(
map_canvas);
659 gdouble ov_scroll_x, ov_scroll_y;
660 GtkAdjustment *ov_hadj, *ov_vadj;
662 ov_hadj = gtk_scrolled_window_get_hadjustment(
664 ov_vadj = gtk_scrolled_window_get_vadjustment(
668 gtk_adjustment_get_upper(ov_hadj)
669 - gtk_adjustment_get_page_size(ov_hadj));
671 gtk_adjustment_get_upper(ov_vadj)
672 - gtk_adjustment_get_page_size(ov_vadj));
674 gtk_adjustment_set_value(ov_hadj, ov_scroll_x);
675 gtk_adjustment_set_value(ov_vadj, ov_scroll_y);
683 int scroll_x, scroll_y;
686 gtk_adjustment_set_value(
map_hadj, scroll_x);
687 gtk_adjustment_set_value(
map_vadj, scroll_y);
698 float xmin, ymin, xmax, ymax;
699 int xsize, ysize, xstep, ystep;
704 map_hadj = gtk_adjustment_new(-1, xmin, xmax, xstep, xsize, xsize);
705 map_vadj = gtk_adjustment_new(-1, ymin, ymax, ystep, ysize, ysize);
712 g_signal_connect(
map_hadj,
"value_changed",
714 GINT_TO_POINTER(
TRUE));
715 g_signal_connect(
map_vadj,
"value_changed",
717 GINT_TO_POINTER(
FALSE));
725 int scroll_x, scroll_y;
734 scroll_x = gtk_adjustment_get_value(adj);
736 scroll_y = gtk_adjustment_get_value(adj);
755 if (w == 0 || h == 0) {
786#ifndef FREECIV_MSWINDOWS
789 gtk_window_set_icon_name(GTK_WINDOW(
toplevel),
"freeciv");
struct canvas int int struct sprite int int int int height
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color * pcolor
struct canvas int int canvas_y
struct canvas int canvas_x
struct canvas int int struct sprite int int int width
struct canvas int int struct sprite bool fog
bool client_is_observer(void)
bool can_client_change_view(void)
struct sprite * client_warming_sprite(void)
struct sprite * client_cooling_sprite(void)
struct sprite * client_research_sprite(void)
struct sprite * client_government_sprite(void)
struct color * get_color(const struct tileset *t, enum color_std stdcolor)
void update_unit_pix_label(struct unit_list *punitlist)
void control_mouse_cursor(struct tile *ptile)
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
bool get_turn_done_button_state()
int current_turn_timeout(void)
void canvas_put_line(struct canvas *pcanvas, struct color *pcolor, enum line_type ltype, int start_x, int start_y, int dx, int dy)
#define FC_STATIC_CANVAS_INIT
void reset_city_dialogs(void)
struct color * color_alloc(int r, int g, int b)
void color_free(struct color *color)
void editgui_tileset_changed(void)
static GtkWidget * source
GdkCursor * fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]
GtkWidget * map_vertical_scrollbar
GtkWidget * main_label_info
GtkWidget * unit_info_label
GtkWidget * timeout_label
GtkWidget * overview_scrolled_window
GtkWidget * government_label
GtkWidget * turn_done_button
void reset_unit_table(void)
GtkWidget * unit_info_frame
GtkWidget * overview_canvas
GtkWidget * map_horizontal_scrollbar
GtkWidget * econ_label[10]
int overview_canvas_store_width
int overview_canvas_store_height
GtkWidget * main_frame_civ_name
#define GUI_GTK_OPTION(optname)
void update_timeout_label(void)
void update_info_label(void)
void update_turn_done_button(bool do_restore)
void scrollbar_jump_callback(GtkAdjustment *adj, gpointer hscrollbar)
void tileset_changed(void)
void put_cross_overlay_tile(struct tile *ptile)
void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
void update_map_canvas_scrollbars_size(void)
void get_overview_area_dimensions(int *width, int *height)
void mapview_freeze(void)
GdkPixbuf * get_thumb_pixbuf(int onoff)
void update_unit_info_label(struct unit_list *punits)
void update_overview_scroll_window_pos(int x, int y)
void update_city_descriptions(void)
gboolean map_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
void pixmap_put_overlay_tile(GdkWindow *pixmap, float zoom, int canvas_x, int canvas_y, struct sprite *ssprite)
void pixmap_put_overlay_tile_draw(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *ssprite, bool fog)
void update_map_canvas_scrollbars(void)
bool mapview_is_frozen(void)
static gboolean anim_cursor_cb(gpointer data)
void overview_size_changed(void)
void map_canvas_size_refresh(void)
static int cursor_timer_id
static GtkAdjustment * map_vadj
static int mapview_frozen_level
struct canvas * get_overview_window(void)
void update_mouse_cursor(enum cursor_type new_cursor_type)
static GtkAdjustment * map_hadj
void set_indicator_icons(struct sprite *bulb, struct sprite *sol, struct sprite *flake, struct sprite *gov)
gboolean overview_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
void science_report_dialog_redraw(void)
void get_sprite_dimensions(struct sprite *sprite, int *width, int *height)
void free_sprite(struct sprite *s)
GdkPixbuf * sprite_get_pixbuf(struct sprite *sprite)
void blank_max_unit_size(void)
static int mc_actual_width
static int mc_actual_height
void map_canvas_resize(GtkWidget *w, int width, int height, gpointer data)
void put_unit_picture_city_overlays(struct unit *punit, GtkPicture *p, int height, int *upkeep_cost, int happy_cost)
void put_unit_picture(struct unit *punit, GtkPicture *p, int height)
void picture_set_from_surface(GtkPicture *pic, cairo_surface_t *surf)
#define fc_assert(condition)
const char * get_timeout_label_text()
void update_map_canvas_visible(void)
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)
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)
const char * nation_plural_for_player(const struct player *pplayer)
struct client_options gui_options
#define GUI_GTK_OVERVIEW_MIN_XSIZE
#define GUI_GTK_OVERVIEW_MIN_YSIZE
const char * get_government_tooltip(void)
const char * get_nuclear_winter_tooltip(void)
const char * get_bulb_tooltip(void)
const char * get_info_label_text(bool)
const char * get_global_warming_tooltip(void)
cairo_surface_t * surface
struct player_economic economic
struct nation_type * nation
cairo_surface_t * surface
static bool is_bigendian(void)
#define sz_strlcat(dest, src)
const char * get_unit_info_label_text2(struct unit_list *punits, int linebreaks)
const char * get_unit_info_label_text1(struct unit_list *punits)
struct sprite * get_attention_crosshair_sprite(const struct tileset *t)
int tileset_full_tile_height(const struct tileset *t)
int tileset_unit_layout_offset_y(const struct tileset *t)
struct sprite * get_treaty_thumb_sprite(const struct tileset *t, bool on_off)
int tileset_full_tile_width(const struct tileset *t)
struct sprite * get_tax_sprite(const struct tileset *t, Output_type_id otype)
#define NUM_CURSOR_FRAMES