Freeciv-3.3
Loading...
Searching...
No Matches
Functions | Variables
dialogs.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "astring.h"
#include "bitvector.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "rand.h"
#include "support.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "packets.h"
#include "player.h"
#include "sex.h"
#include "client_main.h"
#include "climisc.h"
#include "connectdlg_common.h"
#include "control.h"
#include "helpdata.h"
#include "goto.h"
#include "options.h"
#include "packhand.h"
#include "text.h"
#include "tilespec.h"
#include "chatline.h"
#include "choice_dialog.h"
#include "citydlg.h"
#include "editprop.h"
#include "graphics.h"
#include "gui_main.h"
#include "gui_stuff.h"
#include "mapview.h"
#include "plrdlg.h"
#include "wldlg.h"
#include "unitselect.h"
#include "unitselextradlg.h"
#include "dialogs.h"

Go to the source code of this file.

Functions

static void create_races_dialog (struct player *pplayer)
 
static void races_response (GtkWidget *w, gint response, gpointer data)
 
static void races_nation_callback (GtkTreeSelection *select, gpointer data)
 
static void races_leader_callback (void)
 
static void races_sex_callback (GtkWidget *w, gpointer data)
 
static void races_style_callback (GtkTreeSelection *select, gpointer data)
 
static gboolean races_selection_func (GtkTreeSelection *select, GtkTreeModel *model, GtkTreePath *path, gboolean selected, gpointer data)
 
void popup_notify_dialog (const char *caption, const char *headline, const char *lines)
 
static void notify_goto_response (GtkWidget *w, gint response)
 
static void notify_connect_msg_response (GtkWidget *w, gint response)
 
void popup_notify_goto_dialog (const char *headline, const char *lines, const struct text_tag_list *tags, struct tile *ptile)
 
void popup_connect_msg (const char *headline, const char *message)
 
static void revolution_response (GtkWidget *w, gint response, gpointer data)
 
void popup_revolution_dialog (struct government *government)
 
static void pillage_callback (GtkWidget *dlg, gint arg)
 
void popup_pillage_dialog (struct unit *punit, bv_extras extras)
 
void unit_select_dialog_popup (struct tile *ptile)
 
void unit_select_dialog_update_real (void *unused)
 
static GtkTreePathpath_to_nation_on_list (Nation_type_id nation, GtkTreeView *list)
 
static void select_nation_on_tab (GtkWidget *tab_list, int nation)
 
static void sync_tabs_to_nation (int nation)
 
static void populate_leader_list (void)
 
static void select_nation (int nation, const char *leadername, bool is_male, int style_id)
 
static GtkWidgetcreate_list_of_nations_in_group (struct nation_group *group, int index)
 
static void create_nation_selection_lists (void)
 
void races_update_pickable (bool nationset_change)
 
void nationset_sync_to_server (const char *nationset)
 
static void nationset_callback (GtkComboBox *b, gpointer data)
 
void popup_races_dialog (struct player *pplayer)
 
void popdown_races_dialog (void)
 
void races_toggles_set_sensitive (void)
 
gboolean taxrates_callback (GtkWidget *w, GdkEventButton *ev, gpointer data)
 
void popup_upgrade_dialog (struct unit_list *punits)
 
void popup_disband_dialog (struct unit_list *punits)
 
void popdown_all_game_dialogs (void)
 
void show_tech_gained_dialog (Tech_type_id tech)
 
void show_tileset_error (bool fatal, const char *tset_name, const char *msg)
 
bool handmade_scenario_warning (void)
 
void popup_combat_info (int attacker_unit_id, int defender_unit_id, int attacker_hp, int defender_hp, bool make_att_veteran, bool make_def_veteran)
 
static void act_conf_response (GtkWidget *dialog, gint response, gpointer data)
 
void request_action_confirmation (const char *expl, struct act_confirmation_data *data)
 
void popup_image (const char *tag)
 

Variables

static GtkWidgetraces_shell
 
static GtkWidgetnationsets_chooser
 
struct playerraces_player
 
static GtkWidgetraces_nation_list [MAX_NUM_NATION_GROUPS+1]
 
static GtkWidgetraces_notebook
 
static GtkWidgetraces_properties
 
static GtkWidgetraces_leader
 
static GtkWidgetraces_sex [2]
 
static GtkWidgetraces_style_list
 
static GtkTextBufferraces_text
 
static int selected_nation
 
static int selected_sex
 
static int selected_style
 
static int is_showing_pillage_dialog = FALSE
 

Function Documentation

◆ act_conf_response()

static void act_conf_response ( GtkWidget dialog,
gint  response,
gpointer  data 
)
static

This is the response callback for the action confirmation dialog.

Definition at line 1592 of file dialogs.c.

Referenced by request_action_confirmation().

◆ create_list_of_nations_in_group()

static GtkWidget * create_list_of_nations_in_group ( struct nation_group group,
int  index 
)
static

Creates a list of currently-pickable nations in the given group Inserts appropriate gtk_tree_view into races_nation_list[index] (or NULL if the group has no nations) If group == NULL, create a list of all nations

Definition at line 609 of file dialogs.c.

Referenced by create_nation_selection_lists().

◆ create_nation_selection_lists()

static void create_nation_selection_lists ( void  )
static

Creates lists of nations for left side of nation selection dialog

Definition at line 696 of file dialogs.c.

Referenced by create_races_dialog(), and races_update_pickable().

◆ create_races_dialog()

static void create_races_dialog ( struct player pplayer)
static

Create nations dialog

Definition at line 839 of file dialogs.c.

Referenced by popup_races_dialog().

◆ handmade_scenario_warning()

bool handmade_scenario_warning ( void  )

Give a warning when user is about to edit scenario with manually set properties.

Definition at line 1573 of file dialogs.c.

Referenced by handle_game_info().

◆ nationset_callback()

static void nationset_callback ( GtkComboBox b,
gpointer  data 
)
static

Called when the nationset control's value has changed.

Definition at line 814 of file dialogs.c.

Referenced by create_races_dialog().

◆ nationset_sync_to_server()

void nationset_sync_to_server ( const char nationset)

Sync nationset control with the current state of the server.

Definition at line 801 of file dialogs.c.

Referenced by create_races_dialog(), and option_gui_update_extra().

◆ notify_connect_msg_response()

static void notify_connect_msg_response ( GtkWidget w,
gint  response 
)
static

User clicked close for connect message dialog

Definition at line 186 of file dialogs.c.

Referenced by popup_connect_msg().

◆ notify_goto_response()

static void notify_goto_response ( GtkWidget w,
gint  response 
)
static

User has responded to notify dialog with possibility to center (goto) on event location.

Definition at line 159 of file dialogs.c.

Referenced by popup_notify_goto_dialog().

◆ path_to_nation_on_list()

static GtkTreePath * path_to_nation_on_list ( Nation_type_id  nation,
GtkTreeView list 
)
static

Return the GtkTreePath for a given nation on the specified list, or NULL if it's not there at all. Caller must free with gtk_tree_path_free().

Definition at line 399 of file dialogs.c.

Referenced by select_nation_on_tab().

◆ pillage_callback()

static void pillage_callback ( GtkWidget dlg,
gint  arg 
)
static

Callback for pillage dialog.

Definition at line 313 of file dialogs.c.

Referenced by popup_pillage_dialog().

◆ popdown_all_game_dialogs()

void popdown_all_game_dialogs ( void  )

This function is called when the client disconnects or the game is over. It should close all dialog windows for that game.

Definition at line 1514 of file dialogs.c.

Referenced by popup_optiondlg(), set_client_state(), themespec_reread(), and tileset_changed().

◆ popdown_races_dialog()

void popdown_races_dialog ( void  )

◆ populate_leader_list()

static void populate_leader_list ( void  )
static

Populates leader list. If no nation selected, blanks it.

Definition at line 487 of file dialogs.c.

Referenced by select_nation().

◆ popup_combat_info()

void popup_combat_info ( int  attacker_unit_id,
int  defender_unit_id,
int  attacker_hp,
int  defender_hp,
bool  make_att_veteran,
bool  make_def_veteran 
)

Popup detailed information about battle or save information for some kind of statistics

Definition at line 1583 of file dialogs.c.

Referenced by handle_unit_combat_info().

◆ popup_connect_msg()

void popup_connect_msg ( const char headline,
const char message 
)

Popup a dialog to display connection message from server.

Definition at line 239 of file dialogs.c.

Referenced by handle_connect_msg().

◆ popup_disband_dialog()

void popup_disband_dialog ( struct unit_list *  punits)

Pops up a dialog to confirm disband of the unit(s).

Definition at line 1473 of file dialogs.c.

Referenced by unit_item::disband(), mr_menu::slot_disband(), unit_disband_callback(), unit_disband_callback(), unit_disband_callback(), and unit_disband_callback().

◆ popup_image()

void popup_image ( const char tag)

Popup image window

Definition at line 1636 of file dialogs.c.

Referenced by handle_popup_image().

◆ popup_notify_dialog()

void popup_notify_dialog ( const char caption,
const char headline,
const char lines 
)

Popup a generic dialog to display some generic information.

Definition at line 103 of file dialogs.c.

◆ popup_notify_goto_dialog()

void popup_notify_goto_dialog ( const char headline,
const char lines,
const struct text_tag_list tags,
struct tile ptile 
)

Popup a dialog to display information about an event that has a specific location. The user should be given the option to goto that location.

Definition at line 196 of file dialogs.c.

Referenced by handle_event().

◆ popup_pillage_dialog()

void popup_pillage_dialog ( struct unit punit,
bv_extras  extras 
)

Opens pillage dialog listing possible pillage targets.

Definition at line 338 of file dialogs.c.

Referenced by request_unit_pillage().

◆ popup_races_dialog()

void popup_races_dialog ( struct player pplayer)

◆ popup_revolution_dialog()

void popup_revolution_dialog ( struct government government)

Popup revolution dialog for user

Definition at line 284 of file dialogs.c.

◆ popup_upgrade_dialog()

void popup_upgrade_dialog ( struct unit_list *  punits)

Pops up a dialog to confirm upgrading of the unit.

Definition at line 1435 of file dialogs.c.

Referenced by mr_menu::slot_upgrade(), unit_upgrade_callback(), unit_upgrade_callback(), unit_upgrade_callback(), unit_upgrade_callback(), upgrade_callback(), and unit_item::upgrade_unit().

◆ races_leader_callback()

static void races_leader_callback ( void  )
static

Leader name has been chosen

Definition at line 1322 of file dialogs.c.

Referenced by create_races_dialog().

◆ races_nation_callback()

static void races_nation_callback ( GtkTreeSelection select,
gpointer  data 
)
static

Called whenever a user selects a nation in nation list

Definition at line 1293 of file dialogs.c.

Referenced by create_list_of_nations_in_group(), and select_nation_on_tab().

◆ races_response()

static void races_response ( GtkWidget w,
gint  response,
gpointer  data 
)
static

User has selected some of the responses for whole nations dialog

Definition at line 1380 of file dialogs.c.

Referenced by create_races_dialog().

◆ races_selection_func()

static gboolean races_selection_func ( GtkTreeSelection select,
GtkTreeModel model,
GtkTreePath path,
gboolean  selected,
gpointer  data 
)
static

Determines which nations can be selected in the UI

Definition at line 1350 of file dialogs.c.

Referenced by create_list_of_nations_in_group().

◆ races_sex_callback()

static void races_sex_callback ( GtkWidget w,
gpointer  data 
)
static

Leader sex has been chosen

Definition at line 1342 of file dialogs.c.

Referenced by create_races_dialog().

◆ races_style_callback()

static void races_style_callback ( GtkTreeSelection select,
gpointer  data 
)
static

City style has been chosen

Definition at line 1365 of file dialogs.c.

Referenced by create_races_dialog().

◆ races_toggles_set_sensitive()

void races_toggles_set_sensitive ( void  )

Update which nations are allowed to be selected (due to e.g. another player choosing a nation).

Definition at line 1245 of file dialogs.c.

Referenced by handle_player_info().

◆ races_update_pickable()

void races_update_pickable ( bool  nationset_change)

The server has changed the set of selectable nations. Update any current nations dialog accordingly.

Definition at line 731 of file dialogs.c.

Referenced by handle_nation_availability().

◆ request_action_confirmation()

void request_action_confirmation ( const char expl,
struct act_confirmation_data data 
)

Common code wants confirmation for an action.

Definition at line 1607 of file dialogs.c.

◆ revolution_response()

static void revolution_response ( GtkWidget w,
gint  response,
gpointer  data 
)
static

User has responded to revolution dialog

Definition at line 265 of file dialogs.c.

Referenced by popup_revolution_dialog().

◆ select_nation()

static void select_nation ( int  nation,
const char leadername,
bool  is_male,
int  style_id 
)
static

Update dialog state by selecting a nation and choosing values for its parameters, and update the right-hand side of the dialog accordingly. If 'leadername' is NULL, pick a random leader name and sex from the nation's list (ignoring the 'is_male' parameter).

Definition at line 513 of file dialogs.c.

Referenced by create_races_dialog(), races_nation_callback(), and races_update_pickable().

◆ select_nation_on_tab()

static void select_nation_on_tab ( GtkWidget tab_list,
int  nation 
)
static

Make sure the given nation is selected in the list on a given groups notebook tab, if it's present on that tab. Intended for synchronising the tabs to the current selection, so does not disturb the controls on the right-hand side.

Definition at line 427 of file dialogs.c.

Referenced by sync_tabs_to_nation().

◆ show_tech_gained_dialog()

void show_tech_gained_dialog ( Tech_type_id  tech)

Player has gained a new tech.

Definition at line 1524 of file dialogs.c.

Referenced by handle_research_info().

◆ show_tileset_error()

void show_tileset_error ( bool  fatal,
const char tset_name,
const char msg 
)

Show tileset error dialog. It's blocking as client will shutdown as soon as this function returns.

Definition at line 1540 of file dialogs.c.

Referenced by tileset_error().

◆ sync_tabs_to_nation()

static void sync_tabs_to_nation ( int  nation)
static

Select the given nation in the nation lists in the left-hand-side notebook.

Definition at line 471 of file dialogs.c.

Referenced by races_update_pickable(), and select_nation().

◆ taxrates_callback()

gboolean taxrates_callback ( GtkWidget w,
GdkEventButton ev,
gpointer  data 
)

Adjust tax rates from main window

Definition at line 1425 of file dialogs.c.

Referenced by setup_widgets().

◆ unit_select_dialog_popup()

void unit_select_dialog_popup ( struct tile ptile)

Popup unit selection dialog. It is a wrapper for the main function; see unitselect.c:unit_select_dialog_popup_main().

Definition at line 377 of file dialogs.c.

Referenced by do_map_click(), select_dialog_callback(), select_dialog_callback(), select_more_arrow_callback(), select_more_arrow_pixmap_callback(), and show_units_response().

◆ unit_select_dialog_update_real()

void unit_select_dialog_update_real ( void unused)

Update unit selection dialog. It is a wrapper for the main function; see unitselect.c:unit_select_dialog_popup_main().

Definition at line 386 of file dialogs.c.

Referenced by unit_select_dialog_update().

Variable Documentation

◆ is_showing_pillage_dialog

int is_showing_pillage_dialog = FALSE
static

Definition at line 98 of file dialogs.c.

Referenced by pillage_callback(), and popup_pillage_dialog().

◆ nationsets_chooser

GtkWidget* nationsets_chooser
static

Definition at line 73 of file dialogs.c.

Referenced by create_races_dialog(), and nationset_sync_to_server().

◆ races_leader

GtkWidget* races_leader
static

◆ races_nation_list

GtkWidget* races_nation_list[MAX_NUM_NATION_GROUPS+1]
static

◆ races_notebook

GtkWidget* races_notebook
static

◆ races_player

struct player* races_player

◆ races_properties

GtkWidget* races_properties
static

Definition at line 78 of file dialogs.c.

Referenced by create_races_dialog(), and select_nation().

◆ races_sex

GtkWidget* races_sex[2]
static

Definition at line 80 of file dialogs.c.

Referenced by create_races_dialog(), races_leader_callback(), and select_nation().

◆ races_shell

GtkWidget* races_shell
static

◆ races_style_list

GtkWidget* races_style_list
static

Definition at line 81 of file dialogs.c.

Referenced by create_races_dialog(), and select_nation().

◆ races_text

GtkTextBuffer* races_text
static

Definition at line 82 of file dialogs.c.

Referenced by create_races_dialog(), and select_nation().

◆ selected_nation

int selected_nation
static

◆ selected_sex

int selected_sex
static

Definition at line 95 of file dialogs.c.

Referenced by races_leader_callback(), races_response(), and races_sex_callback().

◆ selected_style

int selected_style
static

Definition at line 96 of file dialogs.c.

Referenced by races_response(), and races_style_callback().