Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
helpdlg.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <gtk/gtk.h>
#include "fcintl.h"
#include "mem.h"
#include "shared.h"
#include "support.h"
#include "city.h"
#include "game.h"
#include "government.h"
#include "movement.h"
#include "nation.h"
#include "specialist.h"
#include "tech.h"
#include "unit.h"
#include "map.h"
#include "research.h"
#include "version.h"
#include "client_main.h"
#include "climisc.h"
#include "helpdata.h"
#include "options.h"
#include "tilespec.h"
#include "colors.h"
#include "graphics.h"
#include "gui_main.h"
#include "gui_stuff.h"
#include "helpdlg.h"

Go to the source code of this file.

Data Structures

struct  help_page_selection
 

Macros

#define TECH_TREE_DEPTH   20
 
#define REQ_LABEL_NONE   _("?tech:None")
 
#define REQ_LABEL_NEVER   _("(Never)")
 

Functions

static void create_help_dialog (void)
 
static void help_update_dialog (const struct help_item *pitem)
 
static void select_help_item_string (const char *item, enum help_page_type htype)
 
static void help_command_update (void)
 
static void help_command_callback (GtkWidget *w, gint response_id)
 
void help_system_init (void)
 
static void set_title_topic (char *topic)
 
void popdown_help_dialog (void)
 
void popup_help_dialog_typed (const char *item, enum help_page_type htype)
 
void popup_help_dialog_string (const char *item)
 
static void create_tech_tree (int tech, int levels, GtkTreeIter *parent)
 
static void help_tech_tree_activated_callback (GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
 
static void help_tech_tree_expand_callback (GtkWidget *w, gpointer data)
 
static void help_tech_tree_collapse_callback (GtkWidget *w, gpointer data)
 
static void help_hyperlink_callback (GtkWidget *w)
 
static GtkWidgethelp_hyperlink_new (GtkWidget *label, struct help_page_selection *select)
 
static GtkWidgethelp_hyperlink_new_page (GtkWidget *label, enum help_page_type page)
 
static GtkWidgethelp_slink_new (const gchar *txt, struct help_page_selection *select)
 
static GtkWidgethelp_slink_new_page (const gchar *txt, enum help_page_type page)
 
static void help_box_hide (void)
 
static void help_box_add (GtkWidget *wdg)
 
static void help_box_clear (void)
 
static void help_destroy_callback (GtkWidget *w, gpointer data)
 
static void activated_topic (GtkTreeView *view, gpointer data)
 
static void set_help_tile_from_sprite (struct sprite *spr)
 
static void set_help_tile_from_terrain (struct terrain *pterr)
 
static void set_help_tile_from_extra (const struct extra_type *pextra)
 
static void help_update_improvement (const struct help_item *pitem, char *title)
 
static void help_update_wonder (const struct help_item *pitem, char *title)
 
static void help_update_unit_type (const struct help_item *pitem, char *title)
 
static charfc_chomp (char *str, size_t len)
 
static void help_update_tech (const struct help_item *pitem, char *title)
 
static void add_act_help_for_terrain (const char *act_label, const char *result_link_label, enum help_page_type result_link_type, const char *descr_label)
 
static void help_extras_of_act_for_terrain (struct terrain *pterr, enum unit_activity act, char *label)
 
static void help_update_terrain (const struct help_item *pitem, char *title)
 
static void help_update_extra (const struct help_item *pitem, char *title)
 
static void help_update_goods (const struct help_item *pitem, char *title)
 
static void help_update_specialist (const struct help_item *pitem, char *title)
 
static void help_update_government (const struct help_item *pitem, char *title)
 
static void help_update_nation (const struct help_item *pitem, char *title, struct nation_type *pnation)
 
static void help_item_zoom (GtkTreePath *path)
 
static GtkTreePathhelp_item_path (const struct help_item *pitem)
 

Variables

static GtkWidgethelp_dialog_shell
 
static GtkWidgethelp_view_sw
 
static GtkWidgethelp_view
 
static GtkWidgethelp_frame
 
static GtkTextBufferhelp_text
 
static GtkWidgethelp_text_sw
 
static GtkWidgethelp_vbox
 
static GtkWidgethelp_tile
 
static GtkWidgethelp_box
 
static GtkWidgethelp_itable
 
static GtkWidgethelp_wtable
 
static GtkWidgethelp_utable
 
static GtkWidgethelp_ttable
 
static GtkWidgethelp_etable
 
static GtkWidgethelp_tree
 
static GtkTreeStoretstore
 
static GtkWidgethelp_tree_sw
 
static GtkWidgethelp_tree_expand
 
static GtkWidgethelp_tree_collapse
 
static GtkWidgethelp_tree_buttons_hbox
 
static GtkWidgethelp_ilabel [6]
 
static GtkWidgethelp_wlabel [6]
 
static GtkWidgethelp_ulabel [5][5]
 
static GtkWidgethelp_tlabel [2][5]
 
static GtkWidgethelp_elabel [6]
 
static bool help_advances [A_LAST]
 
static GPtrArrayhelp_history
 
static int help_history_pos
 
static const charhelp_ilabel_name [6]
 
static struct help_page_selection help_impr_req
 
static const charhelp_wlabel_name [6]
 
static struct help_page_selection help_wndr_req
 
static struct help_page_selection page_selections [HELP_LAST]
 
static const charhelp_ulabel_name [5][5]
 
static const charhelp_tlabel_name [2][5]
 
static const charhelp_elabel_name [6]
 

Macro Definition Documentation

◆ REQ_LABEL_NEVER

#define REQ_LABEL_NEVER   _("(Never)")

Definition at line 144 of file helpdlg.c.

◆ REQ_LABEL_NONE

#define REQ_LABEL_NONE   _("?tech:None")

Definition at line 143 of file helpdlg.c.

◆ TECH_TREE_DEPTH

#define TECH_TREE_DEPTH   20

Definition at line 59 of file helpdlg.c.

Function Documentation

◆ activated_topic()

static void activated_topic ( GtkTreeView view,
gpointer  data 
)
static

New topic activated from help dialog.

Definition at line 485 of file helpdlg.c.

◆ add_act_help_for_terrain()

static void add_act_help_for_terrain ( const char act_label,
const char result_link_label,
enum help_page_type  result_link_type,
const char descr_label 
)
static

Add a line for an activity linking to help for result.

Definition at line 1288 of file helpdlg.c.

◆ create_help_dialog()

static void create_help_dialog ( void  )
static

Create help dialog.

Definition at line 529 of file helpdlg.c.

◆ create_tech_tree()

static void create_tech_tree ( int  tech,
int  levels,
GtkTreeIter parent 
)
static

Called by help_update_tech and itself Creates a node in the given tree for the given tech, and creates child nodes for any children it has up to levels deep. These are then expanded if they are less than expanded_levels deep. Avoids generating redundant subtrees, so that if Literacy occurs twice in a tech tree, only the first will have children. Color codes the node based on when it will be discovered: red >2 turns, yellow 1 turn, green 0 turns (discovered).

Definition at line 223 of file helpdlg.c.

◆ fc_chomp()

static char * fc_chomp ( char str,
size_t  len 
)
static

Cut str to at max len bytes in a utf8 friendly way.

Definition at line 1087 of file helpdlg.c.

◆ help_box_add()

static void help_box_add ( GtkWidget wdg)
static

Add widget to help box.

Definition at line 455 of file helpdlg.c.

◆ help_box_clear()

static void help_box_clear ( void  )
static

Clear help box.

Definition at line 463 of file helpdlg.c.

◆ help_box_hide()

static void help_box_hide ( void  )
static

Hide help box.

Definition at line 433 of file helpdlg.c.

◆ help_command_callback()

static void help_command_callback ( GtkWidget w,
gint  response_id 
)
static

User gave response to help dialog.

Definition at line 1779 of file helpdlg.c.

◆ help_command_update()

static void help_command_update ( void  )
static

Set sensitivity of help dialog response buttons.

Definition at line 1756 of file helpdlg.c.

◆ help_destroy_callback()

static void help_destroy_callback ( GtkWidget w,
gpointer  data 
)
static

Completely destroy help dialog.

Definition at line 476 of file helpdlg.c.

◆ help_extras_of_act_for_terrain()

static void help_extras_of_act_for_terrain ( struct terrain pterr,
enum unit_activity  act,
char label 
)
static

Create widgets about all extras of one cause activity to the terrain.

Definition at line 1311 of file helpdlg.c.

◆ help_hyperlink_callback()

static void help_hyperlink_callback ( GtkWidget w)
static

Hyperlink clicked

Definition at line 341 of file helpdlg.c.

◆ help_hyperlink_new()

static GtkWidget * help_hyperlink_new ( GtkWidget label,
struct help_page_selection select 
)
static

Create new hyperlink button.

Definition at line 377 of file helpdlg.c.

◆ help_hyperlink_new_page()

static GtkWidget * help_hyperlink_new_page ( GtkWidget label,
enum help_page_type  page 
)
static

Create new hyperlink button for a known page.

Definition at line 399 of file helpdlg.c.

◆ help_item_path()

static GtkTreePath * help_item_path ( const struct help_item pitem)
static

Return path to help item.

Definition at line 1691 of file helpdlg.c.

◆ help_item_zoom()

static void help_item_zoom ( GtkTreePath path)
static

Add item at path to selection and scroll to its cell.

Definition at line 1665 of file helpdlg.c.

◆ help_slink_new()

static GtkWidget * help_slink_new ( const gchar txt,
struct help_page_selection select 
)
static

Create new hyperlink button with text.

Definition at line 408 of file helpdlg.c.

◆ help_slink_new_page()

static GtkWidget * help_slink_new_page ( const gchar txt,
enum help_page_type  page 
)
static

Create new hyperlink button with text for known page.

Definition at line 424 of file helpdlg.c.

◆ help_system_init()

void help_system_init ( void  )

Initialize help system.

Definition at line 157 of file helpdlg.c.

◆ help_tech_tree_activated_callback()

static void help_tech_tree_activated_callback ( GtkTreeView view,
GtkTreePath path,
GtkTreeViewColumn col,
gpointer  data 
)
static

Selects the help page for the tech in the tree that was double clicked.

Definition at line 308 of file helpdlg.c.

◆ help_tech_tree_collapse_callback()

static void help_tech_tree_collapse_callback ( GtkWidget w,
gpointer  data 
)
static

Called when "Collapse All" button is clicked

Definition at line 333 of file helpdlg.c.

◆ help_tech_tree_expand_callback()

static void help_tech_tree_expand_callback ( GtkWidget w,
gpointer  data 
)
static

Called when "Expand All" button is clicked

Definition at line 325 of file helpdlg.c.

◆ help_update_dialog()

static void help_update_dialog ( const struct help_item pitem)
static

Display updated help dialog.

Definition at line 1606 of file helpdlg.c.

◆ help_update_extra()

static void help_update_extra ( const struct help_item pitem,
char title 
)
static

Help page for extras.

Definition at line 1446 of file helpdlg.c.

◆ help_update_goods()

static void help_update_goods ( const struct help_item pitem,
char title 
)
static

This is currently just a text page, with special text.

Definition at line 1526 of file helpdlg.c.

◆ help_update_government()

static void help_update_government ( const struct help_item pitem,
char title 
)
static

This is currently just a text page, with special text.

Definition at line 1566 of file helpdlg.c.

◆ help_update_improvement()

static void help_update_improvement ( const struct help_item pitem,
char title 
)
static

Display updated help about improvement

Definition at line 904 of file helpdlg.c.

◆ help_update_nation()

static void help_update_nation ( const struct help_item pitem,
char title,
struct nation_type pnation 
)
static

Show nation flag and legend.

Definition at line 1586 of file helpdlg.c.

◆ help_update_specialist()

static void help_update_specialist ( const struct help_item pitem,
char title 
)
static

This is currently just a text page, with special text.

Definition at line 1546 of file helpdlg.c.

◆ help_update_tech()

static void help_update_tech ( const struct help_item pitem,
char title 
)
static

Display updated help about tech.

Definition at line 1108 of file helpdlg.c.

◆ help_update_terrain()

static void help_update_terrain ( const struct help_item pitem,
char title 
)
static

Display updated help about terrain.

Definition at line 1331 of file helpdlg.c.

◆ help_update_unit_type()

static void help_update_unit_type ( const struct help_item pitem,
char title 
)
static

Display updated help about unit type.

Definition at line 1014 of file helpdlg.c.

◆ help_update_wonder()

static void help_update_wonder ( const struct help_item pitem,
char title 
)
static

Display updated help about wonder.

Definition at line 952 of file helpdlg.c.

◆ popdown_help_dialog()

void popdown_help_dialog ( void  )

Close help dialog.

Definition at line 185 of file helpdlg.c.

◆ popup_help_dialog_string()

void popup_help_dialog_string ( const char item)

Not sure if this should call Q_(item) as it does, or whether all callers of this function should do so themselves... –dwp

Definition at line 209 of file helpdlg.c.

◆ popup_help_dialog_typed()

void popup_help_dialog_typed ( const char item,
enum help_page_type  htype 
)

Popup help dialog for given item of given type.

Definition at line 195 of file helpdlg.c.

◆ select_help_item_string()

static void select_help_item_string ( const char item,
enum help_page_type  htype 
)
static

Add item to selection.

Definition at line 1734 of file helpdlg.c.

◆ set_help_tile_from_extra()

static void set_help_tile_from_extra ( const struct extra_type pextra)
static

Set sprite to show for current extra.

Definition at line 876 of file helpdlg.c.

◆ set_help_tile_from_sprite()

static void set_help_tile_from_sprite ( struct sprite spr)
static

Set sprite to show for current help item.

Definition at line 832 of file helpdlg.c.

◆ set_help_tile_from_terrain()

static void set_help_tile_from_terrain ( struct terrain pterr)
static

Set sprite to show for current terrain.

Definition at line 845 of file helpdlg.c.

◆ set_title_topic()

static void set_title_topic ( char topic)
static

Set topic specific title for help_frame

Definition at line 173 of file helpdlg.c.

Variable Documentation

◆ help_advances

bool help_advances[A_LAST]
static

Definition at line 93 of file helpdlg.c.

◆ help_box

GtkWidget* help_box
static

Definition at line 74 of file helpdlg.c.

◆ help_dialog_shell

GtkWidget* help_dialog_shell
static

Definition at line 64 of file helpdlg.c.

◆ help_elabel

GtkWidget* help_elabel[6]
static

Definition at line 91 of file helpdlg.c.

◆ help_elabel_name

const char* help_elabel_name[6]
static
Initial value:
=
{ N_("Build:"), NULL,
N_("Conflicts with:"), NULL,
N_("Bonus (F/P/T):"), NULL }
char * incite_cost
Definition comments.c:76
#define N_(String)
Definition fcintl.h:69

Definition at line 132 of file helpdlg.c.

◆ help_etable

GtkWidget* help_etable
static

Definition at line 79 of file helpdlg.c.

◆ help_frame

GtkWidget* help_frame
static

Definition at line 69 of file helpdlg.c.

◆ help_history

GPtrArray* help_history
static

Definition at line 95 of file helpdlg.c.

◆ help_history_pos

int help_history_pos
static

Definition at line 96 of file helpdlg.c.

◆ help_ilabel

GtkWidget* help_ilabel[6]
static

Definition at line 87 of file helpdlg.c.

◆ help_ilabel_name

const char* help_ilabel_name[6]
static
Initial value:
=
{ N_("Base Cost:"), NULL, N_("Upkeep:"), NULL, N_("Requirement:"), NULL }

Definition at line 107 of file helpdlg.c.

◆ help_impr_req

struct help_page_selection help_impr_req
static

Definition at line 109 of file helpdlg.c.

◆ help_itable

GtkWidget* help_itable
static

Definition at line 75 of file helpdlg.c.

◆ help_text

GtkTextBuffer* help_text
static

Definition at line 70 of file helpdlg.c.

◆ help_text_sw

GtkWidget* help_text_sw
static

Definition at line 71 of file helpdlg.c.

◆ help_tile

GtkWidget* help_tile
static

Definition at line 73 of file helpdlg.c.

◆ help_tlabel

GtkWidget* help_tlabel[2][5]
static

Definition at line 90 of file helpdlg.c.

◆ help_tlabel_name

const char* help_tlabel_name[2][5]
static
Initial value:
=
{
{ N_("Move/Defense:"), NULL, NULL, N_("Food/Res/Trade:"), NULL },
{ N_("Resources:"), NULL, NULL, NULL, NULL }
}

Definition at line 126 of file helpdlg.c.

◆ help_tree

GtkWidget* help_tree
static

Definition at line 80 of file helpdlg.c.

◆ help_tree_buttons_hbox

GtkWidget* help_tree_buttons_hbox
static

Definition at line 86 of file helpdlg.c.

◆ help_tree_collapse

GtkWidget* help_tree_collapse
static

Definition at line 85 of file helpdlg.c.

◆ help_tree_expand

GtkWidget* help_tree_expand
static

Definition at line 84 of file helpdlg.c.

◆ help_tree_sw

GtkWidget* help_tree_sw
static

Definition at line 83 of file helpdlg.c.

◆ help_ttable

GtkWidget* help_ttable
static

Definition at line 78 of file helpdlg.c.

◆ help_ulabel

GtkWidget* help_ulabel[5][5]
static

Definition at line 89 of file helpdlg.c.

◆ help_ulabel_name

const char* help_ulabel_name[5][5]
static
Initial value:
=
{
{ N_("Cost:"), NULL, NULL, N_("Attack:"), NULL },
{ N_("Defense:"), NULL, NULL, N_("Move:"), NULL },
{ N_("Firepower:"), NULL, NULL, N_("Hitpoints:"), NULL },
{ N_("Basic Upkeep:"), NULL, NULL, N_("Vision:"), NULL },
{ N_("Requirement:"), NULL, NULL, N_("Obsolete by:"), NULL }
}

Definition at line 117 of file helpdlg.c.

◆ help_utable

GtkWidget* help_utable
static

Definition at line 77 of file helpdlg.c.

◆ help_vbox

GtkWidget* help_vbox
static

Definition at line 72 of file helpdlg.c.

◆ help_view

GtkWidget* help_view
static

Definition at line 67 of file helpdlg.c.

◆ help_view_sw

GtkWidget* help_view_sw
static

Definition at line 65 of file helpdlg.c.

◆ help_wlabel

GtkWidget* help_wlabel[6]
static

Definition at line 88 of file helpdlg.c.

◆ help_wlabel_name

const char* help_wlabel_name[6]
static
Initial value:
=
{ N_("Base Cost:"), NULL, N_("Requirement:"), NULL, N_("Obsolete by:"), NULL }

Definition at line 111 of file helpdlg.c.

◆ help_wndr_req

struct help_page_selection help_wndr_req
static

Definition at line 113 of file helpdlg.c.

◆ help_wtable

GtkWidget* help_wtable
static

Definition at line 76 of file helpdlg.c.

◆ page_selections

struct help_page_selection page_selections[HELP_LAST]
static

Definition at line 115 of file helpdlg.c.

◆ tstore

GtkTreeStore* tstore
static

Definition at line 81 of file helpdlg.c.