Freeciv-3.3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gui_interface.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* client */
19#include "client_main.h"
20#include "editgui_g.h"
21#include "options.h"
22
23#include "chatline_g.h"
24#include "citydlg_g.h"
25#include "connectdlg_g.h"
26#include "dialogs_g.h"
27#include "diplodlg_g.h"
28#include "editgui_g.h"
29#include "graphics_g.h"
30#include "gui_main_g.h"
31#include "mapview_g.h"
32#include "repodlgs_g.h"
33#include "themes_g.h"
34
35#include "gui_interface.h"
36
37static struct gui_funcs funcs;
38
39/**********************************************************************/
44{
45 return &funcs;
46}
47
48/**********************************************************************/
51void ui_init(void)
52{
53 funcs.ui_init();
54}
55
56/**********************************************************************/
59int ui_main(int argc, char *argv[])
60{
61 return funcs.ui_main(argc, argv);
62}
63
64/**********************************************************************/
67void ui_exit(void)
68{
69 funcs.ui_exit();
70}
71
72/**********************************************************************/
75void version_message(const char *vertext)
76{
78}
79
80/**********************************************************************/
84 const struct text_tag_list *tags,
85 int conn_id)
86{
88}
89
90/**********************************************************************/
93enum gui_type get_gui_type(void)
94{
95 return funcs.get_gui_type();
96}
97
98/**********************************************************************/
105
106/**********************************************************************/
110{
112}
113
114/**********************************************************************/
121
122/**********************************************************************/
125struct sprite *load_gfxfile(const char *filename, bool svgflag)
126{
127 return funcs.load_gfxfile(filename, svgflag);
128}
129
130/**********************************************************************/
133struct sprite *load_gfxnumber(int num)
134{
135 return funcs.load_gfxnumber(num);
136}
137
138/**********************************************************************/
141struct sprite *create_sprite(int width, int height, struct color *pcolor)
142{
144}
145
146/**********************************************************************/
153
154/**********************************************************************/
158 int x, int y, int width, int height,
159 struct sprite *mask, int mask_offset_x, int mask_offset_y,
160 float scale, bool smooth)
161{
164}
165
166/**********************************************************************/
169void free_sprite(struct sprite *s)
170{
172}
173
174/**********************************************************************/
177struct color *color_alloc(int r, int g, int b)
178{
179 return funcs.color_alloc(r, g, b);
180}
181
182/**********************************************************************/
186{
187 return funcs.color_free(pcolor);
188}
189
190/**********************************************************************/
194{
196}
197
198/**********************************************************************/
201void canvas_free(struct canvas *store)
202{
203 funcs.canvas_free(store);
204}
205
206/**********************************************************************/
209void canvas_set_zoom(struct canvas *store, float zoom)
210{
211 funcs.canvas_set_zoom(store, zoom);
212}
213
214/**********************************************************************/
218{
219 return funcs.has_zoom_support();
220}
221
222/**********************************************************************/
225void canvas_mapview_init(struct canvas *store)
226{
228}
229
230/**********************************************************************/
233void canvas_copy(struct canvas *dest, struct canvas *src,
234 int src_x, int src_y, int dest_x, int dest_y, int width,
235 int height)
236{
238}
239
240/**********************************************************************/
244 int canvas_x, int canvas_y,
245 struct sprite *psprite,
246 int offset_x, int offset_y, int width, int height)
247{
250}
251
252/**********************************************************************/
261
262/**********************************************************************/
273
274/**********************************************************************/
278 int canvas_x, int canvas_y,
279 struct sprite *psprite,
280 bool fog, int fog_x, int fog_y)
281{
283 psprite, fog, fog_x, fog_y);
284}
285
286/**********************************************************************/
296
297/**********************************************************************/
306
307/**********************************************************************/
311 enum line_type ltype, int start_x, int start_y,
312 int dx, int dy)
313{
314 funcs.canvas_put_line(pcanvas, pcolor, ltype, start_x, start_y, dx, dy);
315}
316
317/**********************************************************************/
321 enum line_type ltype, int start_x, int start_y,
322 int dx, int dy)
323{
325 dx, dy);
326}
327
328/**********************************************************************/
331void get_text_size(int *width, int *height,
332 enum client_font font, const char *text)
333{
334 funcs.get_text_size(width, height, font, text);
335}
336
337/**********************************************************************/
341 enum client_font font, struct color *pcolor,
342 const char *text)
343{
345}
346
347/**********************************************************************/
354
355/**********************************************************************/
358void set_rulesets(int num_rulesets, char **rulesets)
359{
361}
362
363/**********************************************************************/
367{
369}
370
371/**********************************************************************/
375{
377}
378
379/**********************************************************************/
382void add_net_input(int sock)
383{
384 funcs.add_net_input(sock);
385}
386
387/**********************************************************************/
391{
393}
394
395/**********************************************************************/
402
403/**********************************************************************/
410
411/**********************************************************************/
414void add_idle_callback(void (callback)(void *), void *data)
415{
417}
418
419/**********************************************************************/
422void sound_bell(void)
423{
425}
426
427/**********************************************************************/
431{
433}
434
435/**********************************************************************/
442
443/**********************************************************************/
446void set_unit_icon(int idx, struct unit *punit)
447{
449}
450
451/**********************************************************************/
458
459/**********************************************************************/
466
467/**********************************************************************/
470void gui_update_font(const char *font_name, const char *font_value)
471{
473}
474
475/**********************************************************************/
479{
481}
482
483/**********************************************************************/
486void editgui_notify_object_created(int tag, int id)
487{
489}
490
491/**********************************************************************/
494void editgui_notify_object_changed(int objtype, int object_id, bool removal)
495{
496 funcs.editgui_notify_object_changed(objtype, object_id, removal);
497}
498
499/**********************************************************************/
502void editgui_popup_properties(const struct tile_list *tiles, int objtype)
503{
505}
506
507/**********************************************************************/
514
515/**********************************************************************/
522
523/**********************************************************************/
526void popup_combat_info(int attacker_unit_id, int defender_unit_id,
527 int attacker_hp, int defender_hp,
528 bool make_att_veteran, bool make_def_veteran)
529{
530 funcs.popup_combat_info(attacker_unit_id, defender_unit_id,
531 attacker_hp, defender_hp, make_att_veteran,
532 make_def_veteran);
533}
534
535/**********************************************************************/
542
543/**********************************************************************/
546void start_turn(void)
547{
549}
550
551/**********************************************************************/
558
559/**********************************************************************/
566
567/**********************************************************************/
574
575/**********************************************************************/
582
583/**********************************************************************/
590
591/**********************************************************************/
598
599/**********************************************************************/
603{
605}
606
607/**********************************************************************/
610bool request_transport(struct unit *pcargo, struct tile *ptile)
611{
612 return funcs.request_transport(pcargo, ptile);
613}
614
615/**********************************************************************/
622
623/**********************************************************************/
626void gui_load_theme(const char *directory, const char *theme_name)
627{
629}
630
631/**********************************************************************/
635{
637}
638
639/**********************************************************************/
646
647/**********************************************************************/
650char **get_usable_themes_in_directory(const char *directory, int *count)
651{
653}
654
655/**********************************************************************/
659 struct player *initiator)
660{
662}
663
664/**********************************************************************/
672
673/**********************************************************************/
680
681/**********************************************************************/
688
689/**********************************************************************/
696
697/**********************************************************************/
704
705/**********************************************************************/
709 struct act_confirmation_data *data)
710{
712}
713
714/**********************************************************************/
721
722/**********************************************************************/
729
730/**********************************************************************/
737
738/**********************************************************************/
745
746/**********************************************************************/
753
754/**********************************************************************/
761
762/**********************************************************************/
769
770/**********************************************************************/
773void popup_image(const char *tag)
774{
775 funcs.popup_image(tag);
776}
777
778/**********************************************************************/
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
struct canvas int int int int struct sprite *sprite struct canvas struct color * pcolor
Definition canvas_g.h:56
struct canvas int int int int struct sprite *sprite canvas_put_rectangle
Definition canvas_g.h:55
struct canvas int int canvas_y
Definition canvas_g.h:43
struct canvas int canvas_x
Definition canvas_g.h:43
struct canvas int int int int struct sprite *sprite struct canvas struct color int int int int height canvas_put_line
Definition canvas_g.h:62
canvas_put_sprite
Definition canvas_g.h:42
struct canvas int int int canvas_w
Definition canvas_g.h:49
struct canvas int int int int canvas_h
Definition canvas_g.h:49
struct canvas * pcanvas
Definition canvas_g.h:42
canvas_put_sprite_full_scaled
Definition canvas_g.h:48
canvas_put_text
Definition canvas_g.h:80
struct canvas int int struct sprite int int offset_y
Definition canvas_g.h:44
struct canvas int int struct sprite int offset_x
Definition canvas_g.h:44
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
line_type
Definition canvas_g.h:25
char * incite_cost
Definition comments.c:76
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 int const struct action *paction struct unit struct city const struct action *paction const char * expl
Definition dialogs_g.h:94
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
Definition dialogs_g.h:74
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 int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
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 int const struct action *paction struct unit struct city const struct action *paction request_action_confirmation
Definition dialogs_g.h:94
struct treaty * ptreaty
Definition diplodlg_g.h:28
struct treaty struct player struct player *initiator gui_recv_create_clause
Definition diplodlg_g.h:32
gui_recv_cancel_meeting
Definition diplodlg_g.h:27
struct treaty struct player * they
Definition diplodlg_g.h:28
struct treaty struct player struct player *initiator struct treaty struct player *they gui_recv_accept_treaty
Definition diplodlg_g.h:36
int objtype
Definition editgui_g.h:28
editgui_notify_object_changed
Definition editgui_g.h:27
static GtkWidget * source
Definition gotodlg.c:58
GType type
Definition repodlgs.c:1313
void update_timeout_label(void)
struct gui_funcs * get_gui_funcs(void)
void gui_init_meeting(struct treaty *ptreaty, struct player *they, struct player *initiator)
void real_focus_units_changed(void)
void set_unit_icons_more_arrow(bool onoff)
void science_report_dialog_popup(bool raise)
void free_sprite(struct sprite *s)
void editgui_popup_properties(const struct tile_list *tiles, int objtype)
void set_unit_icon(int idx, struct unit *punit)
void editgui_notify_object_created(int tag, int id)
struct sprite * create_sprite(int width, int height, struct color *pcolor)
char ** get_gui_specific_themes_directories(int *count)
void gui_clear_theme(void)
void real_city_dialog_popup(struct city *pcity)
void set_rulesets(int num_rulesets, char **rulesets)
void endgame_report_dialog_start(const struct packet_endgame_report *packet)
void version_message(const char *vertext)
enum client_pages get_current_client_page(void)
void ui_exit(void)
bool city_dialog_is_open(struct city *pcity)
enum gui_type get_gui_type(void)
void ui_init(void)
void real_units_report_dialog_update(void *unused)
void real_city_dialog_refresh(struct city *pcity)
void gui_load_theme(const char *directory, const char *theme_name)
void real_economy_report_dialog_update(void *unused)
void server_connect(void)
void editgui_popdown_all(void)
struct sprite * load_gfxnumber(int num)
void add_idle_callback(void(callback)(void *), void *data)
void canvas_set_zoom(struct canvas *store, float zoom)
void canvas_mapview_init(struct canvas *store)
void options_extra_init(void)
void popdown_all_city_dialogs(void)
void gui_recv_remove_clause(struct treaty *ptreaty, struct player *they)
void canvas_fill_sprite_area(struct canvas *pcanvas, struct sprite *psprite, struct color *pcolor, int canvas_x, int canvas_y)
void refresh_unit_city_dialogs(struct unit *punit)
void start_turn(void)
void real_conn_list_dialog_update(void *unused)
void real_set_client_page(enum client_pages page)
void get_text_size(int *width, int *height, enum client_font font, const char *text)
void setup_gui_properties(void)
void insert_client_build_info(char *outbuf, size_t outlen)
void canvas_free(struct canvas *store)
bool request_transport(struct unit *pcargo, struct tile *ptile)
void canvas_put_curved_line(struct canvas *pcanvas, struct color *pcolor, enum line_type ltype, int start_x, int start_y, int dx, int dy)
void close_connection_dialog(void)
void science_report_dialog_redraw(void)
void remove_net_input(void)
bool handmade_scenario_warning(void)
struct sprite * load_gfxfile(const char *filename, bool svgflag)
void gui_prepare_clause_updt(struct treaty *ptreaty, struct player *they)
void sound_bell(void)
bool is_view_supported(enum ts_type type)
void update_infra_dialog(void)
void map_canvas_size_refresh(void)
void real_output_window_append(const char *astring, const struct text_tag_list *tags, int conn_id)
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)
void canvas_put_sprite_full(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *psprite)
void tileset_type_set(enum ts_type type)
bool has_zoom_support(void)
void color_free(struct color *pcolor)
struct color * color_alloc(int r, int g, int b)
void editgui_refresh(void)
void canvas_copy(struct canvas *dest, struct canvas *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
void add_net_input(int sock)
static struct gui_funcs funcs
struct canvas * canvas_create(int width, int height)
void editgui_tileset_changed(void)
void real_science_report_dialog_update(void *unused)
void popdown_city_dialog(struct city *pcity)
void canvas_put_sprite_fogged(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *psprite, bool fog, int fog_x, int fog_y)
void popup_image(const char *tag)
int ui_main(int argc, char *argv[])
const char * font_name
Definition gui_main_g.h:43
gui_update_font
Definition gui_main_g.h:43
endgame_report_dialog_player
Definition repodlgs_g.h:33
struct sprite int int int int struct sprite * mask
Definition sprite_g.h:32
struct sprite int int y
Definition sprite_g.h:31
struct sprite int int int int struct sprite int int float scale
Definition sprite_g.h:33
struct sprite int int int int struct sprite int mask_offset_x
Definition sprite_g.h:32
struct sprite int x
Definition sprite_g.h:31
crop_sprite
Definition sprite_g.h:30
struct sprite int int int int struct sprite int int float bool smooth get_sprite_dimensions
Definition sprite_g.h:36
struct sprite int int int int struct sprite int int mask_offset_y
Definition sprite_g.h:32
float zoom
Definition canvas.h:25
Definition city.h:317
Definition colors.h:21
int g
Definition colors.h:21
int r
Definition colors.h:21
int b
Definition colors.h:21
void(* request_action_confirmation)(const char *expl, struct act_confirmation_data *data)
void(* server_connect)(void)
void(* editgui_tileset_changed)(void)
struct sprite *(* load_gfxnumber)(int num)
int(* ui_main)(int argc, char *argv[])
void(* real_economy_report_dialog_update)(void *unused)
void(* gui_recv_accept_treaty)(struct treaty *ptreaty, struct player *they)
void(* canvas_put_text)(struct canvas *pcanvas, int canvas_x, int canvas_y, enum client_font font, struct color *pcolor, const char *text)
void(* science_report_dialog_redraw)(void)
char **(* get_gui_specific_themes_directories)(int *count)
void(* gui_load_theme)(const char *directory, const char *theme_name)
void(* update_timeout_label)(void)
void(* canvas_put_sprite)(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *psprite, int offset_x, int offset_y, int width, int height)
void(* gui_recv_remove_clause)(struct treaty *ptreaty, struct player *they)
void(* popup_image)(const char *tag)
void(* editgui_refresh)(void)
void(* set_unit_icon)(int idx, struct unit *punit)
void(* canvas_copy)(struct canvas *dest, struct canvas *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
void(* add_idle_callback)(void(callback)(void *), void *data)
void(* canvas_put_sprite_full)(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *psprite)
void(* gui_prepare_clause_updt)(struct treaty *ptreaty, struct player *they)
void(* gui_recv_cancel_meeting)(struct treaty *ptreaty, struct player *they, struct player *initiator)
void(* endgame_report_dialog_player)(const struct packet_endgame_player *packet)
void(* add_net_input)(int sock)
void(* tileset_type_set)(enum ts_type type)
struct sprite *(* load_gfxfile)(const char *filename, bool svgflag)
void(* editgui_notify_object_created)(int tag, int id)
enum client_pages(* get_current_client_page)(void)
void(* real_city_dialog_refresh)(struct city *pcity)
void(* gui_clear_theme)(void)
void(* remove_net_input)(void)
void(* real_city_dialog_popup)(struct city *pcity)
void(* endgame_report_dialog_start)(const struct packet_endgame_report *packet)
void(* color_free)(struct color *pcolor)
void(* refresh_unit_city_dialogs)(struct unit *punit)
void(* real_science_report_dialog_update)(void *unused)
bool(* is_view_supported)(enum ts_type type)
void(* setup_gui_properties)(void)
void(* get_text_size)(int *width, int *height, enum client_font font, const char *text)
void(* editgui_popup_properties)(const struct tile_list *tiles, int objtype)
void(* gui_recv_create_clause)(struct treaty *ptreaty, struct player *they)
void(* update_infra_dialog)(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)
void(* map_canvas_size_refresh)(void)
void(* editgui_notify_object_changed)(int objtype, int object_id, bool removal)
bool(* handmade_scenario_warning)(void)
void(* canvas_fill_sprite_area)(struct canvas *pcanvas, struct sprite *psprite, struct color *pcolor, int canvas_x, int canvas_y)
bool(* request_transport)(struct unit *pcargo, struct tile *ptile)
void(* set_rulesets)(int num_rulesets, char **rulesets)
void(* version_message)(const char *vertext)
void(* real_units_report_dialog_update)(void *unused)
void(* real_output_window_append)(const char *astring, const struct text_tag_list *tags, int conn_id)
struct sprite *(* create_sprite)(int width, int height, struct color *pcolor)
bool(* has_zoom_support)(void)
void(* get_sprite_dimensions)(struct sprite *sprite, int *width, int *height)
void(* set_unit_icons_more_arrow)(bool onoff)
void(* gui_update_font)(const char *font_name, const char *font_value)
struct canvas *(* canvas_create)(int width, int height)
void(* science_report_dialog_popup)(bool raise)
void(* ui_exit)(void)
void(* canvas_put_sprite_fogged)(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *psprite, bool fog, int fog_x, int fog_y)
void(* free_sprite)(struct sprite *s)
char **(* get_usable_themes_in_directory)(const char *directory, int *count)
void(* canvas_put_curved_line)(struct canvas *pcanvas, struct color *pcolor, enum line_type ltype, int start_x, int start_y, int dx, int dy)
void(* options_extra_init)(void)
void(* popdown_city_dialog)(struct city *pcity)
void(* canvas_put_line)(struct canvas *pcanvas, struct color *pcolor, enum line_type ltype, int start_x, int start_y, int dx, int dy)
void(* start_turn)(void)
void(* canvas_free)(struct canvas *store)
void(* canvas_set_zoom)(struct canvas *store, float zoom)
void(* insert_client_build_info)(char *outbuf, size_t outlen)
struct sprite *(* crop_sprite)(struct sprite *source, int x, int y, int width, int height, struct sprite *mask, int mask_offset_x, int mask_offset_y, float scale, bool smooth)
void(* canvas_put_rectangle)(struct canvas *pcanvas, struct color *pcolor, int canvas_x, int canvas_y, int width, int height)
void(* gui_init_meeting)(struct treaty *ptreaty, struct player *they, struct player *initiator)
enum gui_type(* get_gui_type)(void)
void(* editgui_popdown_all)(void)
void(* canvas_put_sprite_full_scaled)(struct canvas *pcanvas, int canvas_x, int canvas_y, int canvas_w, int canvas_h, struct sprite *psprite)
void(* popdown_all_city_dialogs)(void)
void(* canvas_mapview_init)(struct canvas *store)
void(* close_connection_dialog)(void)
void(* sound_bell)(void)
void(* real_focus_units_changed)(void)
void(* real_set_client_page)(enum client_pages page)
void(* ui_init)(void)
void(* real_conn_list_dialog_update)(void *unused)
struct color *(* color_alloc)(int r, int g, int b)
bool(* city_dialog_is_open)(struct city *pcity)
Definition tile.h:50
Definition unit.h:140
get_usable_themes_in_directory
Definition themes_g.h:22
const char * directory
Definition themes_g.h:23