Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
gui_main.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "fc_cmdline.h"
#include "fciconv.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "support.h"
#include "dataio.h"
#include "featured_text.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "unitlist.h"
#include "version.h"
#include "audio.h"
#include "client_main.h"
#include "climisc.h"
#include "clinet.h"
#include "colors.h"
#include "connectdlg_common.h"
#include "control.h"
#include "editor.h"
#include "gui_properties.h"
#include "options.h"
#include "text.h"
#include "tilespec.h"
#include "zoom.h"
#include "chatline.h"
#include "citizensinfo.h"
#include "connectdlg.h"
#include "cma_fe.h"
#include "dialogs.h"
#include "diplodlg.h"
#include "editgui.h"
#include "gotodlg.h"
#include "graphics.h"
#include "gui_stuff.h"
#include "happiness.h"
#include "helpdlg.h"
#include "inteldlg.h"
#include "mapctrl.h"
#include "mapview.h"
#include "menu.h"
#include "messagewin.h"
#include "optiondlg.h"
#include "pages.h"
#include "plrdlg.h"
#include "luaconsole.h"
#include "spaceshipdlg.h"
#include "repodlgs.h"
#include "voteinfo_bar.h"
#include "gui_main.h"

Go to the source code of this file.

Data Structures

struct  callback
 

Macros

#define OVERVIEW_CANVAS_STORE_WIDTH_NETBOOK   (2 * 64)
 
#define OVERVIEW_CANVAS_STORE_HEIGHT_NETBOOK   (2 * 46)
 
#define OVERVIEW_CANVAS_STORE_WIDTH    (2 * OVERVIEW_CANVAS_STORE_WIDTH_NETBOOK)
 
#define OVERVIEW_CANVAS_STORE_HEIGHT    (2 * OVERVIEW_CANVAS_STORE_HEIGHT_NETBOOK)
 
#define MIGRATE_OPTION(opt)   gui_options.gui_gtk3_##opt = gui_options.gui_gtk2_##opt;
 
#define MIGRATE_STR_OPTION(opt)
 
#define MIGRATE_OPTION(opt)   GUI_GTK_OPTION(opt) = gui_options.gui_gtk3_##opt;
 
#define MIGRATE_STR_OPTION(opt)
 
#define option_var_set_callback(var, callback)
 

Functions

static void set_g_log_callbacks (void)
 
static gboolean show_info_button_release (GtkWidget *w, GdkEventButton *ev, gpointer data)
 
static gboolean show_info_popup (GtkWidget *w, GdkEventButton *ev, gpointer data)
 
static void end_turn_callback (GtkWidget *w, gpointer data)
 
static gboolean get_net_input (GIOChannel *source, GIOCondition condition, gpointer data)
 
static void set_wait_for_writable_socket (struct connection *pc, bool socket_writable)
 
static void print_usage (void)
 
static bool parse_options (int argc, char **argv)
 
static gboolean toplevel_key_press_handler (GtkWidget *w, GdkEventKey *ev, gpointer data)
 
static gboolean toplevel_key_release_handler (GtkWidget *w, GdkEventKey *ev, gpointer data)
 
static gboolean mouse_scroll_mapcanvas (GtkWidget *w, GdkEventScroll *ev)
 
static void tearoff_callback (GtkWidget *b, gpointer data)
 
static GtkWidgetdetached_widget_new (void)
 
static GtkWidgetdetached_widget_fill (GtkWidget *tearbox)
 
static gboolean select_unit_image_callback (GtkWidget *w, GdkEvent *ev, gpointer data)
 
static gboolean select_more_arrow_pixmap_callback (GtkWidget *w, GdkEvent *ev, gpointer data)
 
static gboolean quit_dialog_callback (void)
 
static void allied_chat_button_toggled (GtkToggleButton *button, gpointer user_data)
 
static void free_unit_table (void)
 
static void adjust_default_options (void)
 
static void log_callback_utf8 (enum log_level level, const char *message, bool file_too)
 
static gboolean timer_callback (gpointer data)
 
static gboolean toplevel_focus (GtkWidget *w, GtkDirectionType arg)
 
static void main_message_area_size_allocate (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
 
gboolean map_canvas_focus (void)
 
static gboolean toplevel_handler (GtkWidget *w, GdkEvent *ev, gpointer data)
 
static gboolean key_press_map_canvas (GtkWidget *w, GdkEventKey *ev, gpointer data)
 
gboolean fc_lost_focus (GtkWidget *w, GdkEventKey *ev, gpointer data)
 
gboolean fc_gained_focus (GtkWidget *w, GdkEventKey *ev, gpointer data)
 
static void tearoff_destroy (GtkWidget *w, gpointer data)
 
static gboolean propagate_keypress (GtkWidget *w, GdkEvent *ev)
 
static void populate_unit_image_table (void)
 
void reset_unit_table (void)
 
void enable_menus (bool enable)
 
static gboolean right_notebook_button_release (GtkWidget *widget, GdkEventButton *event)
 
void update_turn_done_tooltip (void)
 
static void setup_widgets (void)
 
static void g_log_to_freelog_cb (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
 
static GLogWriterOutput g_log_writer_to_freelog_cb (GLogLevelFlags log_level, const GLogField *fields, gsize n_fields, gpointer user_data)
 
static void set_g_log_callback_domain (const char *domain)
 
void ui_init (void)
 
int main (int argc, char **argv)
 
static void migrate_options_from_gtk2 (void)
 
static void migrate_options_from_gtk3 (void)
 
int ui_main (int argc, char **argv)
 
bool is_gui_up (void)
 
void ui_exit (void)
 
enum gui_type get_gui_type (void)
 
void sound_bell (void)
 
void set_unit_icon (int idx, struct unit *punit)
 
void set_unit_icons_more_arrow (bool onoff)
 
void real_focus_units_changed (void)
 
void add_net_input (int sock)
 
void remove_net_input (void)
 
static void quit_dialog_response (GtkWidget *dialog, gint response)
 
void quit_gtk_main (void)
 
void popup_quit_dialog (void)
 
static gboolean idle_callback_wrapper (gpointer data)
 
void add_idle_callback (void(callback)(void *), void *data)
 
static void allied_chat_only_callback (struct option *poption)
 
void fullscreen_opt_refresh (struct option *poption)
 
static void apply_city_names_font (struct option *poption)
 
static void apply_city_productions_font (struct option *poption)
 
static void apply_reqtree_text_font (struct option *poption)
 
void options_extra_init (void)
 
void refresh_chat_buttons (void)
 
void insert_client_build_info (char *outbuf, size_t outlen)
 
static bool monitor_size (GdkRectangle *rect_p)
 
int screen_width (void)
 
int screen_height (void)
 
struct video_moderesolution_request_get (void)
 
void setup_gui_properties (void)
 

Variables

const charclient_string = GUI_NAME_FULL
 
GtkWidgetmap_canvas
 
GtkWidgetmap_horizontal_scrollbar
 
GtkWidgetmap_vertical_scrollbar
 
GtkWidgetoverview_canvas
 
GtkWidgetoverview_scrolled_window
 
int overview_canvas_store_width = OVERVIEW_CANVAS_STORE_WIDTH
 
int overview_canvas_store_height = OVERVIEW_CANVAS_STORE_HEIGHT
 
GtkWidgettoplevel
 
GdkWindowroot_window
 
GtkWidgettoplevel_tabs
 
GtkWidgettop_vbox
 
GtkWidgettop_notebook
 
GtkWidgetbottom_notebook
 
GtkWidgetright_notebook
 
GtkWidgetmap_widget
 
static GtkWidgetbottom_hpaned
 
PangoFontDescriptioncity_names_style = NULL
 
PangoFontDescriptioncity_productions_style = NULL
 
PangoFontDescriptionreqtree_text_style = NULL
 
GtkWidgetmain_frame_civ_name
 
GtkWidgetmain_label_info
 
GtkWidgetavbox
 
GtkWidgetahbox
 
GtkWidgetconn_box
 
GtkWidgetscroll_panel
 
GtkWidgetecon_label [10]
 
GtkWidgetbulb_label
 
GtkWidgetsun_label
 
GtkWidgetflake_label
 
GtkWidgetgovernment_label
 
GtkWidgettimeout_label
 
GtkWidgetturn_done_button
 
GtkWidgetunit_info_label
 
GtkWidgetunit_info_box
 
GtkWidgetunit_info_frame
 
GtkWidgetecon_ebox
 
GtkWidgetbulb_ebox
 
GtkWidgetsun_ebox
 
GtkWidgetflake_ebox
 
GtkWidgetgovernment_ebox
 
const char *const gui_character_encoding = "UTF-8"
 
const bool gui_use_transliteration = FALSE
 
static GtkWidgetmain_menubar
 
static GtkWidgetunit_image_table
 
static GtkWidgetunit_image
 
static GtkWidgetunit_image_button
 
static GtkWidgetunit_below_image [MAX_NUM_UNITS_BELOW]
 
static GtkWidgetunit_below_image_button [MAX_NUM_UNITS_BELOW]
 
static GtkWidgetmore_arrow_pixmap
 
static GtkWidgetmore_arrow_pixmap_button
 
static GtkWidgetmore_arrow_pixmap_container
 
static int unit_id_top
 
static int unit_ids [MAX_NUM_UNITS_BELOW]
 
GtkTextViewmain_message_area
 
GtkTextBuffermessage_buffer = NULL
 
static GtkWidgetallied_chat_toggle_button
 
static gint timer_id
 
static GIOChannelsrv_channel
 
static guint srv_id
 
gint cur_x
 
gint cur_y
 
static bool gui_up = FALSE
 
static bool audio_paused = FALSE
 
static bool client_focus = TRUE
 
static struct video_mode vmode = { -1, -1 }
 

Macro Definition Documentation

◆ MIGRATE_OPTION [1/2]

#define MIGRATE_OPTION (   opt)    gui_options.gui_gtk3_##opt = gui_options.gui_gtk2_##opt;

◆ MIGRATE_OPTION [2/2]

#define MIGRATE_OPTION (   opt)    GUI_GTK_OPTION(opt) = gui_options.gui_gtk3_##opt;

◆ MIGRATE_STR_OPTION [1/2]

#define MIGRATE_STR_OPTION (   opt)
Value:
strncpy(gui_options.gui_gtk3_##opt, gui_options.gui_gtk2_##opt, \
sizeof(gui_options.gui_gtk3_##opt));
char * incite_cost
Definition comments.c:76
struct client_options gui_options
Definition options.c:71

◆ MIGRATE_STR_OPTION [2/2]

#define MIGRATE_STR_OPTION (   opt)
Value:
sizeof(GUI_GTK_OPTION(opt)));
#define GUI_GTK_OPTION(optname)
Definition gui_main.h:25

◆ option_var_set_callback

#define option_var_set_callback (   var,
  callback 
)
Value:
} else { \
log_error("Didn't find option %s!", GUI_GTK_OPTION_STR(var)); \
}
#define GUI_GTK_OPTION_STR(optname)
Definition gui_main.h:26
const struct option_set * client_optset
Definition options.c:1316
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:467

◆ OVERVIEW_CANVAS_STORE_HEIGHT

#define OVERVIEW_CANVAS_STORE_HEIGHT    (2 * OVERVIEW_CANVAS_STORE_HEIGHT_NETBOOK)

Definition at line 121 of file gui_main.c.

◆ OVERVIEW_CANVAS_STORE_HEIGHT_NETBOOK

#define OVERVIEW_CANVAS_STORE_HEIGHT_NETBOOK   (2 * 46)

Definition at line 118 of file gui_main.c.

◆ OVERVIEW_CANVAS_STORE_WIDTH

#define OVERVIEW_CANVAS_STORE_WIDTH    (2 * OVERVIEW_CANVAS_STORE_WIDTH_NETBOOK)

Definition at line 119 of file gui_main.c.

◆ OVERVIEW_CANVAS_STORE_WIDTH_NETBOOK

#define OVERVIEW_CANVAS_STORE_WIDTH_NETBOOK   (2 * 64)

Definition at line 117 of file gui_main.c.

Function Documentation

◆ add_idle_callback()

void add_idle_callback ( void(callback)(void *)  ,
void data 
)

Enqueue a callback to be called during an idle moment. The 'callback' function should be called sometimes soon, and passed the 'data' pointer as its data.

Definition at line 2406 of file gui_main.c.

Referenced by animation_idle_cb(), main_message_area_resize(), queue_add_callback(), real_set_client_page(), update_queue_push(), and update_queue_thaw().

◆ add_net_input()

void add_net_input ( int  sock)

This function is called after the client has successfully connected to the server

Definition at line 2294 of file gui_main.c.

Referenced by make_connection().

◆ adjust_default_options()

static void adjust_default_options ( void  )
static

Make dynamic adjustments to first-launch default options.

Definition at line 2624 of file gui_main.c.

Referenced by activate_gui(), and ui_main().

◆ allied_chat_button_toggled()

static void allied_chat_button_toggled ( GtkToggleButton button,
gpointer  user_data 
)
static

Handle a toggle of the "Allies Only" chat button.

Definition at line 2531 of file gui_main.c.

Referenced by setup_widgets().

◆ allied_chat_only_callback()

static void allied_chat_only_callback ( struct option poption)
static

Option callback for the 'allied_chat_only' gtk-gui option. This updates the state of the associated toggle button.

Definition at line 2419 of file gui_main.c.

Referenced by options_extra_init().

◆ apply_city_names_font()

static void apply_city_names_font ( struct option poption)
static

Change the city names font.

Definition at line 2446 of file gui_main.c.

Referenced by options_extra_init().

◆ apply_city_productions_font()

static void apply_city_productions_font ( struct option poption)
static

Change the city productions font.

Definition at line 2457 of file gui_main.c.

Referenced by options_extra_init().

◆ apply_reqtree_text_font()

static void apply_reqtree_text_font ( struct option poption)
static

Change the city productions font.

Definition at line 2468 of file gui_main.c.

Referenced by options_extra_init().

◆ detached_widget_fill()

static GtkWidget * detached_widget_fill ( GtkWidget tearbox)
static

Creates the toggle button necessary to detach and reattach the widget and returns a vbox in which you fill your goodies.

Definition at line 846 of file gui_main.c.

Referenced by setup_widgets().

◆ detached_widget_new()

static GtkWidget * detached_widget_new ( void  )
static

Create the container for the widget that's able to be detached

Definition at line 835 of file gui_main.c.

Referenced by setup_widgets().

◆ enable_menus()

void enable_menus ( bool  enable)

Enable/Disable the game page menu bar.

Definition at line 1053 of file gui_main.c.

Referenced by real_set_client_page().

◆ end_turn_callback()

static void end_turn_callback ( GtkWidget w,
gpointer  data 
)
static

User clicked "Turn Done" button

Definition at line 2249 of file gui_main.c.

Referenced by setup_widgets().

◆ fc_gained_focus()

gboolean fc_gained_focus ( GtkWidget w,
GdkEventKey ev,
gpointer  data 
)

Freeciv window has gained focus

Definition at line 746 of file gui_main.c.

Referenced by activate_gui(), setup_dialog(), and ui_main().

◆ fc_lost_focus()

gboolean fc_lost_focus ( GtkWidget w,
GdkEventKey ev,
gpointer  data 
)

Freeciv window has lost focus

Definition at line 736 of file gui_main.c.

Referenced by activate_gui(), setup_dialog(), and ui_main().

◆ free_unit_table()

static void free_unit_table ( void  )
static

Free unit image table.

Definition at line 996 of file gui_main.c.

Referenced by reset_unit_table(), and ui_main().

◆ fullscreen_opt_refresh()

void fullscreen_opt_refresh ( struct option poption)

Option callback for the 'fullscreen' gtk-gui option.

Definition at line 2434 of file gui_main.c.

Referenced by full_screen_callback(), full_screen_callback(), and options_extra_init().

◆ g_log_to_freelog_cb()

static void g_log_to_freelog_cb ( const gchar log_domain,
GLogLevelFlags  log_level,
const gchar message,
gpointer  user_data 
)
static

g_log callback to log with freelog

Definition at line 1684 of file gui_main.c.

Referenced by g_log_writer_to_freelog_cb(), set_g_log_callback_domain(), and set_g_log_callbacks().

◆ g_log_writer_to_freelog_cb()

static GLogWriterOutput g_log_writer_to_freelog_cb ( GLogLevelFlags  log_level,
const GLogField fields,
gsize  n_fields,
gpointer  user_data 
)
static

g_log callback to log with freelog

Definition at line 1712 of file gui_main.c.

Referenced by set_g_log_callbacks().

◆ get_gui_type()

enum gui_type get_gui_type ( void  )

Return our GUI type

Definition at line 2078 of file gui_main.c.

Referenced by client_option_next_valid(), handle_server_join_reply(), and tileset_use_preferred_theme().

◆ get_net_input()

static gboolean get_net_input ( GIOChannel source,
GIOCondition  condition,
gpointer  data 
)
static

Read input from server socket

Definition at line 2258 of file gui_main.c.

Referenced by add_net_input(), and set_wait_for_writable_socket().

◆ idle_callback_wrapper()

static gboolean idle_callback_wrapper ( gpointer  data)
static

A wrapper for the callback called through add_idle_callback.

Definition at line 2391 of file gui_main.c.

Referenced by add_idle_callback().

◆ insert_client_build_info()

void insert_client_build_info ( char outbuf,
size_t  outlen 
)

Insert build information to help

Empty function required by helpdata

Definition at line 2540 of file gui_main.c.

Referenced by insert_generated_text().

◆ is_gui_up()

bool is_gui_up ( void  )

Return whether gui is currently running.

Definition at line 2059 of file gui_main.c.

Referenced by show_tileset_error().

◆ key_press_map_canvas()

static gboolean key_press_map_canvas ( GtkWidget w,
GdkEventKey ev,
gpointer  data 
)
static

Handle keypress events when map canvas is in focus

Definition at line 401 of file gui_main.c.

Referenced by toplevel_key_press_handler(), and toplevel_key_press_handler().

◆ log_callback_utf8()

static void log_callback_utf8 ( enum log_level  level,
const char message,
bool  file_too 
)
static

Callback for freelog

Definition at line 231 of file gui_main.c.

Referenced by ui_init().

◆ main()

int main ( int  argc,
char **  argv 
)

Entry point for whole freeciv client program.

Definition at line 1766 of file gui_main.c.

◆ main_message_area_size_allocate()

static void main_message_area_size_allocate ( GtkWidget widget,
GtkAllocation allocation,
gpointer  data 
)
static

When the chatline text view is resized, scroll it to the bottom. This prevents users from accidentally missing messages when the chatline gets scrolled up a small amount and stops scrolling down automatically.

Definition at line 343 of file gui_main.c.

Referenced by setup_widgets().

◆ map_canvas_focus()

gboolean map_canvas_focus ( void  )

Focus on map canvas

Definition at line 360 of file gui_main.c.

Referenced by map_view_callback(), map_view_callback(), toplevel_key_press_handler(), and toplevel_key_press_handler().

◆ migrate_options_from_gtk2()

static void migrate_options_from_gtk2 ( void  )
static

Migrate gtk3 client specific options from gtk2 client options.

Definition at line 1774 of file gui_main.c.

Referenced by activate_gui(), and ui_main().

◆ migrate_options_from_gtk3()

static void migrate_options_from_gtk3 ( void  )
static

Migrate gtk3.22 client specific options from gtk3 client options.

Definition at line 1829 of file gui_main.c.

Referenced by activate_gui(), and ui_main().

◆ monitor_size()

static bool monitor_size ( GdkRectangle rect_p)
static

Return dimensions of primary monitor, if any (in 'application pixels')

Definition at line 2554 of file gui_main.c.

Referenced by screen_height(), and screen_width().

◆ mouse_scroll_mapcanvas()

static gboolean mouse_scroll_mapcanvas ( GtkWidget w,
GdkEventScroll ev 
)
static

Mouse/touchpad scrolling over the mapview

Definition at line 684 of file gui_main.c.

Referenced by setup_widgets().

◆ options_extra_init()

void options_extra_init ( void  )

Extra initializers for client options. Here we make set the callback for the specific gui-gtk-3.22 options.

Definition at line 2480 of file gui_main.c.

◆ parse_options()

static bool parse_options ( int  argc,
char **  argv 
)
static

Search for gui-specific command-line options.

Definition at line 287 of file gui_main.c.

Referenced by gui_ui_main(), ui_main(), and ui_main().

◆ populate_unit_image_table()

static void populate_unit_image_table ( void  )
static

Called to build the unit_below pixmap table. This is the table on the left of the screen that shows all of the inactive units in the current tile.

It may be called again if the tileset changes.

Definition at line 891 of file gui_main.c.

Referenced by reset_unit_table().

◆ popup_quit_dialog()

void popup_quit_dialog ( void  )

Popups the dialog with the message: Are you sure you want to quit?

Definition at line 2350 of file gui_main.c.

Referenced by fc_client::closeEvent(), quit_callback(), quit_callback(), quit_dialog_callback(), and mr_menu::quit_game().

◆ print_usage()

static void print_usage ( void  )
static

Print extra usage information, including one line help on each option, to stderr.

Definition at line 266 of file gui_main.c.

Referenced by parse_options().

◆ propagate_keypress()

static gboolean propagate_keypress ( GtkWidget w,
GdkEvent ev 
)
static

Propagates a keypress in a tearoff back to the toplevel window.

Definition at line 779 of file gui_main.c.

Referenced by tearoff_callback().

◆ quit_dialog_callback()

static gboolean quit_dialog_callback ( void  )
static

Popups the quit dialog.

Definition at line 2376 of file gui_main.c.

Referenced by activate_gui(), and ui_main().

◆ quit_dialog_response()

static void quit_dialog_response ( GtkWidget dialog,
gint  response 
)
static

This is the response callback for the dialog with the message: Are you sure you want to quit?

Definition at line 2323 of file gui_main.c.

Referenced by popup_quit_dialog().

◆ quit_gtk_main()

void quit_gtk_main ( void  )

Exit gtk main loop.

Definition at line 2338 of file gui_main.c.

Referenced by create_main_page(), quit_dialog_response(), and quit_dialog_response().

◆ real_focus_units_changed()

void real_focus_units_changed ( void  )

Called when the set of units in focus (get_units_in_focus()) changes. Standard updates like update_unit_info_label() are handled in the platform- independent code; we use this to keep the goto/airlift dialog up to date, if it's visible.

Definition at line 2150 of file gui_main.c.

Referenced by focus_units_changed().

◆ refresh_chat_buttons()

void refresh_chat_buttons ( void  )

Set the chatline buttons to reflect the state of the game and current client options. This function should be called on game start.

Definition at line 2510 of file gui_main.c.

Referenced by real_set_client_page().

◆ remove_net_input()

void remove_net_input ( void  )

This function is called if the client disconnects from the server

Definition at line 2312 of file gui_main.c.

Referenced by close_socket_nomessage().

◆ reset_unit_table()

void reset_unit_table ( void  )

Called when the tileset is changed to reset the unit pixmap table.

Definition at line 1024 of file gui_main.c.

Referenced by real_set_client_page(), and tileset_changed().

◆ resolution_request_get()

struct video_mode * resolution_request_get ( void  )

Give resolution requested by user, if any.

Definition at line 2612 of file gui_main.c.

Referenced by real_set_client_page().

◆ right_notebook_button_release()

static gboolean right_notebook_button_release ( GtkWidget widget,
GdkEventButton event 
)
static

Workaround for a crash that occurs when a button release event is emitted for a notebook with no pages. See PR#40743. FIXME: Remove this hack once gtk_notebook_button_release() in gtk/gtknotebook.c checks for NULL notebook->cur_page.

Definition at line 1076 of file gui_main.c.

Referenced by setup_widgets().

◆ screen_height()

int screen_height ( void  )

Return height of the primary monitor

Definition at line 2594 of file gui_main.c.

Referenced by adjust_default_options(), create_main_page(), and initialize_city_dialogs().

◆ screen_width()

int screen_width ( void  )

Return width of the primary monitor

Definition at line 2576 of file gui_main.c.

◆ select_more_arrow_pixmap_callback()

static gboolean select_more_arrow_pixmap_callback ( GtkWidget w,
GdkEvent ev,
gpointer  data 
)
static

Callback for clicking a unit icon underneath unit info box. these are the units on the same tile as the focus unit.

Definition at line 2190 of file gui_main.c.

Referenced by populate_unit_image_table().

◆ select_unit_image_callback()

static gboolean select_unit_image_callback ( GtkWidget w,
GdkEvent ev,
gpointer  data 
)
static

Callback for clicking a unit icon underneath unit info box. these are the units on the same tile as the focus unit.

Definition at line 2159 of file gui_main.c.

Referenced by populate_unit_image_table().

◆ set_g_log_callback_domain()

static void set_g_log_callback_domain ( const char domain)
static

Set up g_log callback for a single domain.

Definition at line 1728 of file gui_main.c.

Referenced by set_g_log_callbacks().

◆ set_g_log_callbacks()

static void set_g_log_callbacks ( void  )
static

Set up g_log callbacks.

Definition at line 1740 of file gui_main.c.

Referenced by ui_init().

◆ set_unit_icon()

void set_unit_icon ( int  idx,
struct unit punit 
)

Set one of the unit icons in information area based on punit. Use punit == NULL to clear icon. Index 'idx' is -1 for "active unit", or 0 to (num_units_below - 1) for units below. Also updates unit_ids[idx] for idx >= 0.

Definition at line 2097 of file gui_main.c.

Referenced by reset_unit_table(), and update_unit_pix_label().

◆ set_unit_icons_more_arrow()

void set_unit_icons_more_arrow ( bool  onoff)

Set the "more arrow" for the unit icons to on(1) or off(0). Maintains a static record of current state to avoid unnecessary redraws. Note initial state should match initial gui setup (off).

Definition at line 2127 of file gui_main.c.

Referenced by reset_unit_table(), and update_unit_pix_label().

◆ set_wait_for_writable_socket()

static void set_wait_for_writable_socket ( struct connection pc,
bool  socket_writable 
)
static

Set socket writability state

Definition at line 2269 of file gui_main.c.

Referenced by add_net_input().

◆ setup_gui_properties()

void setup_gui_properties ( void  )

Define properties of this gui.

Definition at line 2650 of file gui_main.c.

Referenced by gui_properties_init().

◆ setup_widgets()

static void setup_widgets ( void  )
static

Do the heavy lifting for the widget setup.

Definition at line 1128 of file gui_main.c.

Referenced by activate_gui(), and ui_main().

◆ show_info_button_release()

static gboolean show_info_button_release ( GtkWidget w,
GdkEventButton ev,
gpointer  data 
)
static

Button released when showing info popup

Definition at line 2205 of file gui_main.c.

Referenced by show_info_popup().

◆ show_info_popup()

static gboolean show_info_popup ( GtkWidget w,
GdkEventButton ev,
gpointer  data 
)
static

Popup info box

Definition at line 2218 of file gui_main.c.

Referenced by setup_widgets().

◆ sound_bell()

void sound_bell ( void  )

obvious...

Definition at line 2086 of file gui_main.c.

Referenced by none_audio_play().

◆ tearoff_callback()

static void tearoff_callback ( GtkWidget b,
gpointer  data 
)
static

Callback for the toggle button in the detachable widget: causes the widget to detach or reattach.

Definition at line 790 of file gui_main.c.

Referenced by detached_widget_fill().

◆ tearoff_destroy()

static void tearoff_destroy ( GtkWidget w,
gpointer  data 
)
static

Reattaches the detached widget when the user destroys it.

Definition at line 756 of file gui_main.c.

Referenced by tearoff_callback().

◆ timer_callback()

static gboolean timer_callback ( gpointer  data)
static

Called while in gtk_main() (which is all of the time) TIMER_INTERVAL is now set by real_timer_callback()

Definition at line 243 of file gui_main.c.

Referenced by activate_gui(), timer_callback(), and ui_main().

◆ toplevel_focus()

static gboolean toplevel_focus ( GtkWidget w,
GtkDirectionType  arg 
)
static

Focus on widget. Returns whether focus was really changed.

Definition at line 316 of file gui_main.c.

Referenced by activate_gui(), and ui_main().

◆ toplevel_handler()

static gboolean toplevel_handler ( GtkWidget w,
GdkEvent ev,
gpointer  data 
)
static

In GTK+ keyboard events are recursively propagated from the hierarchy parent down to its children. Sometimes this is not what we want. E.g. The inputline is active, the user presses the 's' key, we want it to be sent to the inputline, but because the main menu is further up the hierarchy, it wins and the inputline never gets anything! This function ensures an entry widget (like the inputline) always gets first dibs at handling a keyboard event.

Definition at line 377 of file gui_main.c.

Referenced by ui_main().

◆ toplevel_key_press_handler()

static gboolean toplevel_key_press_handler ( GtkWidget w,
GdkEventKey ev,
gpointer  data 
)
static

Handle a keyboard key press made in the client's toplevel window.

Definition at line 600 of file gui_main.c.

Referenced by setup_widgets().

◆ toplevel_key_release_handler()

static gboolean toplevel_key_release_handler ( GtkWidget w,
GdkEventKey ev,
gpointer  data 
)
static

Handler for "key release" for toplevel window

Definition at line 582 of file gui_main.c.

Referenced by setup_widgets().

◆ ui_exit()

void ui_exit ( void  )

Do any necessary UI-specific cleanup

Definition at line 2067 of file gui_main.c.

Referenced by client_exit().

◆ ui_init()

void ui_init ( void  )

Called from main().

Definition at line 1756 of file gui_main.c.

Referenced by client_main().

◆ ui_main()

int ui_main ( int  argc,
char **  argv 
)

Called from client_main(), is what it's named.

Definition at line 1888 of file gui_main.c.

Referenced by client_main().

◆ update_turn_done_tooltip()

void update_turn_done_tooltip ( void  )

Override background color for canvases Update tooltip of the Turn Done button

Definition at line 1109 of file gui_main.c.

Referenced by set_turn_done_button_state(), and setup_widgets().

Variable Documentation

◆ ahbox

GtkWidget * ahbox

Definition at line 141 of file gui_main.c.

Referenced by setup_widgets().

◆ allied_chat_toggle_button

GtkWidget* allied_chat_toggle_button
static

Definition at line 180 of file gui_main.c.

Referenced by allied_chat_only_callback(), refresh_chat_buttons(), and setup_widgets().

◆ audio_paused

bool audio_paused = FALSE
static

Definition at line 189 of file gui_main.c.

Referenced by timer_callback().

◆ avbox

GtkWidget* avbox

Definition at line 141 of file gui_main.c.

Referenced by setup_widgets().

◆ bottom_hpaned

GtkWidget* bottom_hpaned
static

Definition at line 132 of file gui_main.c.

Referenced by setup_widgets().

◆ bottom_notebook

GtkWidget * bottom_notebook

◆ bulb_ebox

GtkWidget* bulb_ebox

Definition at line 157 of file gui_main.c.

Referenced by setup_widgets(), and update_info_label().

◆ bulb_label

GtkWidget* bulb_label

Definition at line 145 of file gui_main.c.

Referenced by set_indicator_icons(), setup_widgets(), and update_info_label().

◆ city_names_style

PangoFontDescription* city_names_style = NULL

Definition at line 134 of file gui_main.c.

Referenced by activate_gui(), apply_city_names_font(), and ui_main().

◆ city_productions_style

PangoFontDescription* city_productions_style = NULL

Definition at line 135 of file gui_main.c.

Referenced by activate_gui(), apply_city_productions_font(), and ui_main().

◆ client_focus

bool client_focus = TRUE
static

◆ client_string

const char* client_string = GUI_NAME_FULL

◆ conn_box

GtkWidget * conn_box

Definition at line 141 of file gui_main.c.

◆ cur_x

gint cur_x

Definition at line 185 of file gui_main.c.

Referenced by mouse_scroll_mapcanvas(), and mouse_scroll_mapcanvas().

◆ cur_y

gint cur_y

Definition at line 185 of file gui_main.c.

Referenced by mouse_scroll_mapcanvas(), and mouse_scroll_mapcanvas().

◆ econ_ebox

GtkWidget* econ_ebox

Definition at line 156 of file gui_main.c.

Referenced by setup_widgets(), and update_info_label().

◆ econ_label

GtkWidget* econ_label[10]

Definition at line 144 of file gui_main.c.

Referenced by setup_widgets(), and update_info_label().

◆ flake_ebox

GtkWidget* flake_ebox

Definition at line 159 of file gui_main.c.

Referenced by setup_widgets(), and update_info_label().

◆ flake_label

GtkWidget* flake_label

Definition at line 147 of file gui_main.c.

Referenced by set_indicator_icons(), setup_widgets(), and update_info_label().

◆ government_ebox

GtkWidget* government_ebox

Definition at line 160 of file gui_main.c.

Referenced by setup_widgets(), and update_info_label().

◆ government_label

GtkWidget* government_label

Definition at line 148 of file gui_main.c.

Referenced by set_indicator_icons(), setup_widgets(), and update_info_label().

◆ gui_character_encoding

const char* const gui_character_encoding = "UTF-8"

Definition at line 162 of file gui_main.c.

◆ gui_up

bool gui_up = FALSE
static

Definition at line 187 of file gui_main.c.

Referenced by is_gui_up(), and ui_main().

◆ gui_use_transliteration

const bool gui_use_transliteration = FALSE

Definition at line 163 of file gui_main.c.

◆ main_frame_civ_name

GtkWidget* main_frame_civ_name

Definition at line 138 of file gui_main.c.

Referenced by setup_widgets(), and update_info_label().

◆ main_label_info

GtkWidget* main_label_info

Definition at line 139 of file gui_main.c.

Referenced by setup_widgets(), and update_info_label().

◆ main_menubar

GtkWidget* main_menubar
static

Definition at line 165 of file gui_main.c.

Referenced by enable_menus().

◆ main_message_area

GtkTextView* main_message_area

◆ map_canvas

GtkWidget* map_canvas

◆ map_horizontal_scrollbar

GtkWidget* map_horizontal_scrollbar

Definition at line 109 of file gui_main.c.

Referenced by setup_widgets(), and update_map_canvas_scrollbars_size().

◆ map_vertical_scrollbar

GtkWidget* map_vertical_scrollbar

Definition at line 110 of file gui_main.c.

Referenced by setup_widgets(), and update_map_canvas_scrollbars_size().

◆ map_widget

GtkWidget* map_widget

Definition at line 131 of file gui_main.c.

Referenced by leave_mapcanvas(), and setup_widgets().

◆ message_buffer

GtkTextBuffer* message_buffer = NULL

◆ more_arrow_pixmap

GtkWidget* more_arrow_pixmap
static

Definition at line 171 of file gui_main.c.

Referenced by free_unit_table(), and populate_unit_image_table().

◆ more_arrow_pixmap_button

GtkWidget* more_arrow_pixmap_button
static

◆ more_arrow_pixmap_container

GtkWidget* more_arrow_pixmap_container
static

Definition at line 173 of file gui_main.c.

Referenced by free_unit_table(), and populate_unit_image_table().

◆ overview_canvas

GtkWidget* overview_canvas

◆ overview_canvas_store_height

int overview_canvas_store_height = OVERVIEW_CANVAS_STORE_HEIGHT

Definition at line 124 of file gui_main.c.

Referenced by setup_widgets(), and update_overview_scroll_window_pos().

◆ overview_canvas_store_width

int overview_canvas_store_width = OVERVIEW_CANVAS_STORE_WIDTH

◆ overview_scrolled_window

GtkWidget* overview_scrolled_window

Definition at line 113 of file gui_main.c.

Referenced by setup_widgets(), and update_overview_scroll_window_pos().

◆ reqtree_text_style

PangoFontDescription* reqtree_text_style = NULL

Definition at line 136 of file gui_main.c.

Referenced by activate_gui(), apply_reqtree_text_font(), and ui_main().

◆ right_notebook

GtkWidget * right_notebook

Definition at line 130 of file gui_main.c.

Referenced by luaconsole_dialog_create(), meswin_dialog_init(), and setup_widgets().

◆ root_window

GdkWindow* root_window

Definition at line 127 of file gui_main.c.

Referenced by anim_cursor_cb(), remove_net_input(), and ui_main().

◆ scroll_panel

GtkWidget* scroll_panel

Definition at line 142 of file gui_main.c.

◆ srv_channel

GIOChannel* srv_channel
static

Definition at line 183 of file gui_main.c.

Referenced by add_net_input(), remove_net_input(), and set_wait_for_writable_socket().

◆ srv_id

guint srv_id
static

Definition at line 184 of file gui_main.c.

Referenced by add_net_input(), remove_net_input(), and set_wait_for_writable_socket().

◆ sun_ebox

GtkWidget* sun_ebox

Definition at line 158 of file gui_main.c.

Referenced by setup_widgets(), and update_info_label().

◆ sun_label

GtkWidget* sun_label

Definition at line 146 of file gui_main.c.

Referenced by set_indicator_icons(), setup_widgets(), and update_info_label().

◆ timeout_label

GtkWidget* timeout_label

Definition at line 149 of file gui_main.c.

Referenced by setup_widgets(), and update_timeout_label().

◆ timer_id

gint timer_id
static

Definition at line 182 of file gui_main.c.

Referenced by activate_gui(), timer_callback(), and ui_main().

◆ top_notebook

GtkWidget* top_notebook

◆ top_vbox

GtkWidget* top_vbox

◆ toplevel

GtkWidget* toplevel

Definition at line 126 of file gui_main.c.

Referenced by activate_gui(), anim_cursor_cb(), buy_callback(), choice_dialog_start(), confirm_cancel_pact(), create_advances_list(), create_city_dialog(), create_city_info_table(), create_goto_dialog(), create_help_dialog(), create_improvements_list(), create_intel_dialog(), create_intel_wonder_dialog(), create_line_at_mouse_pos(), create_multiplier_dialog(), create_races_dialog(), create_rates_dialog(), create_tool_value_selector(), create_worklists_report(), detached_widget_fill(), dlg_tab_provider_prepare(), enable_menus(), fullscreen_opt_refresh(), get_text_size(), gui_clear_theme(), gui_dialog_detach(), gui_dialog_new(), gui_load_theme(), gui_update_font(), infra_dialog_popup(), leave_callback(), leave_callback(), luaconsole_load_file_popup(), main(), map_canvas_focus(), modinst_setup_widgets(), option_color_select_callback(), option_dialog_new(), popit(), popup_action_selection(), popup_bribe_stack_dialog(), popup_bribe_unit_dialog(), popup_connect_msg(), popup_disband_dialog(), popup_help_dialog_typed(), popup_incite_dialog(), popup_newcity_dialog(), popup_notify_goto_dialog(), popup_quit_dialog(), popup_revolution_dialog(), popup_soundset_suggestion_dialog(), popup_tileset_suggestion_dialog(), popup_upgrade_dialog(), popup_workertask_dlg(), propagate_keypress(), property_editor_new(), rally_dialog_popup(), real_set_client_page(), remove_net_input(), request_action_confirmation(), save_dialog_file_chooser_popup(), save_dialog_new(), select_color_callback(), select_color_callback(), select_impr_or_unit_callback(), select_tgt_extra(), select_tgt_unit(), setup_widgets(), show_conn_popup(), show_info_popup(), show_tileset_error(), surface_put_text(), tearoff_callback(), tileset_changed(), toplevel_handler(), try_to_set_editor_tool(), ui_main(), update_rect_at_mouse_pos(), update_turn_done_button(), and usdlg_create().

◆ toplevel_tabs

GtkWidget* toplevel_tabs

Definition at line 128 of file gui_main.c.

Referenced by real_set_client_page(), setup_widgets(), and ui_main().

◆ turn_done_button

GtkWidget* turn_done_button

◆ unit_below_image

GtkWidget* unit_below_image[MAX_NUM_UNITS_BELOW]
static

Definition at line 169 of file gui_main.c.

Referenced by free_unit_table(), populate_unit_image_table(), and set_unit_icon().

◆ unit_below_image_button

GtkWidget* unit_below_image_button[MAX_NUM_UNITS_BELOW]
static

Definition at line 170 of file gui_main.c.

Referenced by free_unit_table(), and populate_unit_image_table().

◆ unit_id_top

int unit_id_top
static

◆ unit_ids

int unit_ids[MAX_NUM_UNITS_BELOW]
static

Definition at line 176 of file gui_main.c.

Referenced by select_unit_image_callback(), select_unit_pic_callback(), and set_unit_icon().

◆ unit_image

GtkWidget* unit_image
static

Definition at line 167 of file gui_main.c.

Referenced by free_unit_table(), populate_unit_image_table(), and set_unit_icon().

◆ unit_image_button

GtkWidget* unit_image_button
static

Definition at line 168 of file gui_main.c.

Referenced by free_unit_table(), and populate_unit_image_table().

◆ unit_image_table

GtkWidget* unit_image_table
static

Definition at line 166 of file gui_main.c.

Referenced by free_unit_table(), populate_unit_image_table(), and setup_widgets().

◆ unit_info_box

GtkWidget* unit_info_box

Definition at line 153 of file gui_main.c.

Referenced by editinfobox_refresh(), setup_widgets(), and ui_main().

◆ unit_info_frame

GtkWidget* unit_info_frame

Definition at line 154 of file gui_main.c.

Referenced by setup_widgets(), and update_unit_info_label().

◆ unit_info_label

GtkWidget* unit_info_label

Definition at line 152 of file gui_main.c.

Referenced by popup_unit_info(), setup_widgets(), and update_unit_info_label().

◆ vmode

struct video_mode vmode = { -1, -1 }
static