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 (GtkGestureClick *gesture, int n_press, double x, double y)
 
gboolean reverse_taxrates_callback (GtkGestureClick *gesture, int n_press, double x, double y)
 
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 1632 of file dialogs.c.

◆ 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 613 of file dialogs.c.

◆ 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 699 of file dialogs.c.

◆ create_races_dialog()

static void create_races_dialog ( struct player pplayer)
static

Create nations dialog

Definition at line 845 of file dialogs.c.

◆ 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 1613 of file dialogs.c.

◆ nationset_callback()

static void nationset_callback ( GtkComboBox b,
gpointer  data 
)
static

Called when the nationset control's value has changed.

Definition at line 819 of file dialogs.c.

◆ 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 806 of file dialogs.c.

◆ 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.

◆ 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 158 of file dialogs.c.

◆ 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.

◆ pillage_callback()

static void pillage_callback ( GtkWidget dlg,
gint  arg 
)
static

Callback for pillage dialog.

Definition at line 313 of file dialogs.c.

◆ 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 1554 of file dialogs.c.

◆ popdown_races_dialog()

void popdown_races_dialog ( void  )

Close nations dialog

Definition at line 1249 of file dialogs.c.

◆ populate_leader_list()

static void populate_leader_list ( void  )
static

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

Definition at line 491 of file dialogs.c.

◆ 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 1623 of file dialogs.c.

◆ 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.

◆ 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 1512 of file dialogs.c.

◆ popup_image()

void popup_image ( const char tag)

Popup image window

Definition at line 1677 of file dialogs.c.

◆ 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.

◆ 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.

◆ popup_races_dialog()

void popup_races_dialog ( struct player pplayer)

Popup the dialog 10% inside the main-window

Definition at line 1234 of file dialogs.c.

◆ 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 1473 of file dialogs.c.

◆ races_leader_callback()

static void races_leader_callback ( void  )
static

Leader name has been chosen

Definition at line 1341 of file dialogs.c.

◆ 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 1312 of file dialogs.c.

◆ 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 1399 of file dialogs.c.

◆ 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 1369 of file dialogs.c.

◆ races_sex_callback()

static void races_sex_callback ( GtkWidget w,
gpointer  data 
)
static

Leader sex has been chosen

Definition at line 1361 of file dialogs.c.

◆ races_style_callback()

static void races_style_callback ( GtkTreeSelection select,
gpointer  data 
)
static

City style has been chosen

Definition at line 1384 of file dialogs.c.

◆ 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 1264 of file dialogs.c.

◆ 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 734 of file dialogs.c.

◆ 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 1647 of file dialogs.c.

◆ reverse_taxrates_callback()

gboolean reverse_taxrates_callback ( GtkGestureClick gesture,
int  n_press,
double  x,
double  y 
)

Adjust tax rates from main window

Definition at line 1459 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.

◆ 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 517 of file dialogs.c.

◆ 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 430 of file dialogs.c.

◆ show_tech_gained_dialog()

void show_tech_gained_dialog ( Tech_type_id  tech)

Player has gained a new tech.

Definition at line 1564 of file dialogs.c.

◆ 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 1580 of file dialogs.c.

◆ 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 475 of file dialogs.c.

◆ taxrates_callback()

gboolean taxrates_callback ( GtkGestureClick gesture,
int  n_press,
double  x,
double  y 
)

Adjust tax rates from main window

Definition at line 1445 of file dialogs.c.

◆ 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.

◆ 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.

Variable Documentation

◆ is_showing_pillage_dialog

int is_showing_pillage_dialog = FALSE
static

Definition at line 98 of file dialogs.c.

◆ nationsets_chooser

GtkWidget* nationsets_chooser
static

Definition at line 73 of file dialogs.c.

◆ races_leader

GtkWidget* races_leader
static

Definition at line 79 of file dialogs.c.

◆ races_nation_list

GtkWidget* races_nation_list[MAX_NUM_NATION_GROUPS+1]
static

Definition at line 76 of file dialogs.c.

◆ races_notebook

GtkWidget* races_notebook
static

Definition at line 77 of file dialogs.c.

◆ races_player

struct player* races_player

Definition at line 74 of file dialogs.c.

◆ races_properties

GtkWidget* races_properties
static

Definition at line 78 of file dialogs.c.

◆ races_sex

GtkWidget* races_sex[2]
static

Definition at line 80 of file dialogs.c.

◆ races_shell

GtkWidget* races_shell
static

Definition at line 72 of file dialogs.c.

◆ races_style_list

GtkWidget* races_style_list
static

Definition at line 81 of file dialogs.c.

◆ races_text

GtkTextBuffer* races_text
static

Definition at line 82 of file dialogs.c.

◆ selected_nation

int selected_nation
static

Definition at line 94 of file dialogs.c.

◆ selected_sex

int selected_sex
static

Definition at line 95 of file dialogs.c.

◆ selected_style

int selected_style
static

Definition at line 96 of file dialogs.c.