19#ifdef SDL2_PLAIN_INCLUDE
102 log_debug(
"popup_help_dialog_typed : PORT ME");
191 dst.x, dst.y, dst.w, dst.h,
204 SDL_Color bg_color = {255, 255, 255, 128};
228 struct advance *obsTech = NULL;
235 SDL_Surface *background_tmpl, *background, *impr_name, *icon;
248 title->style |= TTF_STYLE_BOLD;
253 pwindow->
data.
ptr = (
void *)store;
258 area = pwindow->
area;
271 close_button->
key = SDLK_ESCAPE;
283 SDL_FillRect(background_tmpl, NULL,
map_rgba(background_tmpl->format, bg_color));
286 0, 0, background_tmpl->w - 1, background_tmpl->h - 1,
299 dst.y = (background->h - impr_name->h) / 2;
300 alphablit(impr_name, NULL, background, &dst, 255);
307 dst.y = (background->h - icon->h) / 2;
308 alphablit(icon, NULL, background, &dst, 255);
318 if (impr_type_count++ >= 10) {
330 if (impr_type_count > 10) {
343 if (store->show_tree) {
353 dock = list_toggle_button;
362 area = pwindow->
area;
384 dock = impr_name_label;
387 sprintf(buffer,
"%s %d",
_(
"Base Cost:"),
397 sprintf(buffer,
"%s %d",
_(
"Upkeep:"), pimpr_type->
upkeep);
413 dock = requirement_label;
420 if (!preq->present) {
428 if (preq->source.kind != VUT_ADVANCE) {
439 if (requirement_label2 == NULL) {
447 dock = requirement_label2;
456 dock = obsolete_by_label;
459 if (pobs->source.kind == VUT_ADVANCE) {
460 obsTech = pobs->source.value.advance;
465 if (obsTech == NULL) {
483 dock = obsolete_by_label2;
492 if (buffer[0] !=
'\0') {
511 area = pwindow->
area;
518 close_button = pwindow->
prev;
520 area.x + area.w - close_button->
size.w - 1,
524 list_toggle_button = store->
dock;
529 area.y + list_toggle_button->
size.h, 0, 0,
536 area.x, area.y + list_toggle_button->
size.h,
541 impr_name_label = store->
dock->
prev;
547 cost_label = impr_name_label->
prev;
550 upkeep_label = cost_label->
prev;
555 start_y += cost_label->
size.h;
577 start_y += obsolete_by_label2->
size.h;
606 SDL_Color bg_color = {255, 255, 255, 64};
621 dst.x, dst.y, dst.w, dst.h,
634 SDL_Color bg_color = {255, 255, 255, 128};
664 SDL_Surface *background_tmpl, *background, *unit_name, *icon;
676 title->style |= TTF_STYLE_BOLD;
681 pwindow->
data.
ptr = (
void *)store;
686 area = pwindow->
area;
699 close_button->
key = SDLK_ESCAPE;
713 SDL_FillRect(background_tmpl, NULL,
map_rgba(background_tmpl->format, bg_color));
716 0, 0, background_tmpl->w - 1, background_tmpl->h - 1,
729 dst.y = (background->h - unit_name->h) / 2;
730 alphablit(unit_name, NULL, background, &dst, 255);
736 dst.x = (
adj_size(35) - icon->w) / 2;
737 dst.y = (background->h - icon->h) / 2;
738 alphablit(icon, NULL, background, &dst, 255);
773 if (store->show_tree) {
783 dock = list_toggle_button;
792 area = pwindow->
area;
806 direction8_invalid())),
812 dock = unit_name_label;
850 cat_snprintf(buf,
sizeof(buf),
"\n%s %d %s %d %s %s\n%s %d %s %d %s %d",
856 _(
"Hitpoints:"), punittype->
hp);
871 dock = requirement_label;
891 dock = requirement_label2;
900 dock = obsolete_by_label;
921 dock = obsolete_by_label2;
929 if (buffer[0] !=
'\0') {
949 area = pwindow->
area;
956 close_button = pwindow->
prev;
958 area.x + area.w - close_button->
size.w - 1,
962 list_toggle_button = store->
dock;
967 area.y + list_toggle_button->
size.h, 0, 0,
974 area.x, area.y + list_toggle_button->
size.h,
979 unit_name_label = store->
dock->
prev;
1057 SDL_Color bg_color = {255, 255, 255, 64};
1060 SDL_Surface *text0, *text1 = NULL;
1074 dst.x, dst.y, dst.w, dst.h,
1079 pstr->
style |= TTF_STYLE_BOLD;
1302 if (buffer[0] !=
'\0') {
1323 pwidget = pwidget->
prev;
1324 pwidget->
size.x = start_x;
1360 pwidget->
size.x = pwindow->
size.x + start_x;
1363 pwidget = pwidget->
prev;
1372 pwidget->
size.x = pwindow->
size.x + start_x;
1375 pwidget = pwidget->
prev;
1383 while (unit_count-- && pwidget) {
1384 pwidget->
size.x = pwindow->
size.x + start_x;
1387 pwidget = pwidget->
prev;
1396 pwidget->
size.x = pwindow->
size.x + start_x;
1399 pwidget = pwidget->
prev;
1417 int i,j, tech, count;
1450 for (j = count - 1; j >= 0; j--) {
1458 for (j = count - 1; j >= 0; j--) {
1466 for (j = 0; j < 4 && store->
sub_req[j]; j++) {
1474 for (j = 0; j < 4 && store->
sub_req[j]; j++) {
1544 for (
i = 0;
i < count;
i++) {
1548 switch ((
i %
mod)) {
1565 for (j = 0; j < 6 && store->
sub_targets[j]; j++) {
1577 for (j = 0; j < 6 && store->
sub_targets[j]; j++) {
1601 y =
sub0->size.y +
sub0->size.h / 2;
1624 y =
sub1->size.y +
sub1->size.h / 2;
1702 if (NULL != vap &&
A_NONE != ar) {
1721 for (j = 0; j < req_count; j++) {
1727 if (NULL != vap &&
A_NONE != ar) {
1737 store->
sub_req[sub_req_count++] = pwidget;
1743 if (sub_req_count < 4) {
1744 store->
sub_req[sub_req_count] = NULL;
1749 if ((targets_count < 6)
1762 store->
targets[targets_count++] = pwidget;
1765 if (targets_count < 6) {
1766 store->
targets[targets_count] = NULL;
1769 sub_targets_count = 0;
1770 if (targets_count > 0) {
1773 for (i = 0; i < targets_count; i++) {
1794 store->
sub_targets[sub_targets_count++] = pwidget;
1797 if (sub_targets_count < 6) {
1804 if (sub_req_count > 0) {
1808 if (req_count > 0) {
1809 w = (pwindow->
area.x + 1
1812 + w + ptech->
size.w)) / 2;
1814 w = (pwindow->
size.w - ptech->
size.w) / 2;
1818 ptech->
size.x = pwindow->
size.x + w;
1821 if (req_count > 0) {
1824 h = ptech->
size.y + (ptech->
size.h - h) / 2;
1825 for (i = 0; i < req_count; i++) {
1833 if (sub_req_count > 0) {
1834 h = (sub_req_count == 1 ? store->
sub_req[0]->
size.h :
1836 h = ptech->
size.y + (ptech->
size.h - h) / 2;
1837 for (i = 0; i < sub_req_count; i++) {
1845 if (targets_count > 0) {
1846 h = (targets_count == 1 ? store->
targets[0]->
size.h :
1848 h = ptech->
size.y + (ptech->
size.h - h) / 2;
1849 for (i = 0; i < targets_count; i++) {
1856 if (sub_targets_count > 0) {
1857 if (sub_targets_count < 3) {
1868 if (sub_targets_count < 5) {
1869 for (i = 0; i <
MIN(sub_targets_count, 4); i++) {
1883 for (i = 0; i <
MIN(sub_targets_count, 6); i++) {
1968 pwindow->
data.
ptr = (
void *)store;
1991 dock = close_button;
2011 if (tech_count++ >= 10) {
2023 if (tech_count > 10) {
2043 dock = list_toggle_button;
2059 list_toggle_button =
dock;
2076 while (advance_label->
prev != NULL && --count > 0) {
2077 advance_label = advance_label->
prev;
2092 area = pwindow->
area;
2099 close_button = pwindow->
prev;
2101 area.x + area.w - close_button->
size.w - 1,
2105 list_toggle_button = store->
dock;
2110 area.y + list_toggle_button->
size.h, 0, 0,
2116 area.x, area.y + list_toggle_button->
size.h,
struct canvas int int struct sprite int int int width
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
#define PL_(String1, String2, n)
const char * government_name_translation(const struct government *pgovern)
Government_type_id government_index(const struct government *pgovern)
#define governments_iterate(NAME_pgov)
#define governments_iterate_end
GtkWidget * unit_info_label
static void create_tech_tree(int tech, int levels, GtkTreeIter *parent)
void popdown_help_dialog(void)
void popup_help_dialog_string(const char *item)
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
SDL_Color * get_theme_color(enum theme_color themecolor)
int main_window_width(void)
int fill_rect_alpha(SDL_Surface *surf, SDL_Rect *prect, SDL_Color *pcolor)
void create_line(SDL_Surface *dest, Sint16 x0, Sint16 y0, Sint16 x1, Sint16 y1, SDL_Color *pcolor)
SDL_Surface * copy_surface(SDL_Surface *src)
int alphablit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect, unsigned char alpha_mod)
struct sdl2_data main_data
SDL_Surface * create_surf(int width, int height, Uint32 flags)
void create_frame(SDL_Surface *dest, Sint16 left, Sint16 top, Sint16 width, Sint16 height, SDL_Color *pcolor)
int main_window_height(void)
SDL_Surface * resize_surface_box(const SDL_Surface *psrc, Uint16 new_width, Uint16 new_height, int smooth, bool scale_up, bool absolute_dimensions)
#define map_rgba(format, color)
#define PRESSED_EVENT(event)
static int exit_help_dlg_callback(struct widget *pwidget)
void popup_gov_info(int gov)
void popup_tech_info(Tech_type_id tech)
static struct advanced_dialog * help_dlg
static int show_tech_tree_callback(struct widget *pwidget)
enum help_page_type current_help_dlg
static void redraw_tech_info_dlg(void)
static void redraw_unit_info_dlg(void)
static int change_tech_callback(struct widget *pwidget)
void popup_help_browser(void)
static struct widget * create_tech_info(Tech_type_id tech, int width, struct widget *pwindow, struct techs_buttons *store)
void popup_impr_info(Impr_type_id impr)
static void redraw_tech_tree_dlg(void)
static int help_dlg_window_callback(struct widget *pwindow)
static int change_unit_callback(struct widget *pwidget)
void popup_unit_info(Unit_type_id type_id)
static int change_gov_callback(struct widget *pwidget)
static void redraw_impr_info_dlg(void)
static int toggle_full_tree_mode_in_help_dlg_callback(struct widget *pwidget)
static int change_impr_callback(struct widget *pwidget)
SDL_Surface * create_select_tech_icon(utf8_str *pstr, Tech_type_id tech_id, enum tech_info_mode mode)
utf8_str * copy_chars_to_utf8_str(utf8_str *pstr, const char *pchars)
SDL_Surface * create_text_surf_from_utf8(utf8_str *pstr)
void change_fonto_utf8(utf8_str *pstr, enum font_origin origin)
utf8_str * create_utf8_str_fonto(char *in_text, size_t n_alloc, enum font_origin origin)
bool convert_utf8_str_to_const_surface_width(utf8_str *pstr, int width)
SDL_Surface * create_text_surf_smaller_than_w(utf8_str *pstr, int w)
#define FREEUTF8STR(pstr)
#define create_utf8_from_char_fonto(string_in, fonto)
SDL_Color * get_tech_color(Tech_type_id tech_id)
SDL_Surface * get_tech_icon(Tech_type_id tech)
static SDL_Surface * get_government_surface(const struct government *gov)
static SDL_Surface * get_building_surface(const struct impr_type *pimprove)
static SDL_Surface * get_unittype_surface(const struct unit_type *punittype, enum direction8 facing)
void helptext_advance(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, int i)
char * helptext_building(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct impr_type *pimprove)
char * helptext_unit(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct unit_type *utype)
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
struct impr_type * improvement_by_number(const Impr_type_id id)
int impr_base_build_shield_cost(const struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
bool improvement_has_flag(const struct impr_type *pimprove, enum impr_flag_id flag)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define log_debug(message,...)
#define fc_calloc(n, esz)
const char * move_points_text(int mp, bool reduce)
const char * universal_name_translation(const struct universal *psource, char *buf, size_t bufsz)
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
struct widget * active_widget_list
struct widget * end_widget_list
struct widget * begin_widget_list
struct widget * begin_active_widget_list
struct widget * end_active_widget_list
struct scroll_bar * scroll
struct requirement_vector obsolete_by
struct requirement_vector reqs
const struct unit_type * obsoleted_by
struct advance * require_advance
int fc_snprintf(char *str, size_t n, const char *format,...)
int cat_snprintf(char *str, size_t n, const char *format,...)
struct advance * advance_by_number(const Tech_type_id atype)
const char * advance_name_translation(const struct advance *padvance)
struct advance * valid_advance_by_number(const Tech_type_id id)
Tech_type_id advance_required(const Tech_type_id tech, enum tech_req require)
Tech_type_id advance_number(const struct advance *padvance)
#define advance_index_iterate_end
#define advance_index_iterate(_start, _index)
SDL_Surface * theme_get_background(const struct theme *t, enum theme_background background)
@ COLOR_THEME_HELPDLG_FRAME
@ COLOR_THEME_HELPDLG_TEXT
@ COLOR_THEME_HELPDLG_LINE3
@ COLOR_THEME_CITYDLG_LUX
@ COLOR_THEME_HELPDLG_LINE
@ COLOR_THEME_HELPDLG_LINE2
struct theme * active_theme
int utype_build_shield_cost_base(const struct unit_type *punittype)
Unit_type_id utype_count(void)
struct unit_type * utype_by_number(const Unit_type_id id)
Unit_type_id utype_number(const struct unit_type *punittype)
const char * utype_name_translation(const struct unit_type *punittype)
#define unit_type_iterate(_p)
#define unit_type_iterate_end