Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #896053 ยป 0012-sdl2-Rename-pBackground-pLogo-and-pIcon.patch

Marko Lindqvist, 2020-11-12 12:32 AM

View differences:

client/gui-sdl2/citydlg.c
int count = 0;
struct widget *pwindow = pcity_dlg->pEndCityWidgetList;
struct widget *add_dock, *pBuf, *pLast;
SDL_Surface *pLogo = NULL;
SDL_Surface *logo = NULL;
utf8_str *pstr = NULL;
struct player *pOwner = city_owner(pCity);
int prev_y = 0;
......
pstr->style |= TTF_STYLE_BOLD;
pLogo = get_building_surface(pimprove);
pLogo = ResizeSurfaceBox(pLogo, adj_size(22), adj_size(22), 1, TRUE, TRUE);
logo = get_building_surface(pimprove);
logo = ResizeSurfaceBox(logo, adj_size(22), adj_size(22), 1, TRUE, TRUE);
pBuf = create_iconlabel(pLogo, pwindow->dst, pstr,
pBuf = create_iconlabel(logo, pwindow->dst, pstr,
(WF_FREE_THEME | WF_RESTORE_BACKGROUND));
pBuf->size.x = pwindow->size.x + adj_size(450);
......
void real_city_dialog_popup(struct city *pCity)
{
struct widget *pwindow = NULL, *pBuf = NULL;
SDL_Surface *pLogo = NULL;
SDL_Surface *logo = NULL;
utf8_str *pstr = NULL;
int cs;
struct player *pOwner = city_owner(pCity);
......
pcity_dlg->pEndCityWidgetList = pwindow;
/* create window background */
pLogo = theme_get_background(theme, BACKGROUND_CITYDLG);
if (resize_window(pwindow, pLogo, NULL, adj_size(640), adj_size(480))) {
FREESURFACE(pLogo);
logo = theme_get_background(theme, BACKGROUND_CITYDLG);
if (resize_window(pwindow, logo, NULL, adj_size(640), adj_size(480))) {
FREESURFACE(logo);
}
pLogo = get_city_gfx();
alphablit(pLogo, NULL, pwindow->theme, NULL, 255);
logo = get_city_gfx();
alphablit(logo, NULL, pwindow->theme, NULL, 255);
area = pwindow->area;
......
rebuild_imprm_list(pCity);
/* ===================================================== */
pLogo = get_scaled_city_map(pCity);
logo = get_scaled_city_map(pCity);
pBuf = create_themelabel(pLogo, pwindow->dst, NULL,
pLogo->w, pLogo->h, WF_SELECT_WITHOUT_BAR);
pBuf = create_themelabel(logo, pwindow->dst, NULL,
logo->w, logo->h, WF_SELECT_WITHOUT_BAR);
pcity_dlg->pResource_Map = pBuf;
client/gui-sdl2/cityrep.c
struct widget *pwindow, *pLast;
utf8_str *pstr;
SDL_Surface *pText1, *pText2, *pText3, *pUnits_Icon, *pCMA_Icon, *pText4;
SDL_Surface *pLogo;
SDL_Surface *logo;
int togrow, w = 0 , count, ww = 0, hh = 0, name_w = 0, prod_w = 0, H;
char cbuf[128];
const char *pName;
......
if (VUT_UTYPE == pCity->production.kind) {
const struct unit_type *punittype = pCity->production.value.utype;
pLogo = ResizeSurfaceBox(get_unittype_surface(punittype, direction8_invalid()),
logo = ResizeSurfaceBox(get_unittype_surface(punittype, direction8_invalid()),
adj_size(36), adj_size(24), 1,
TRUE, TRUE);
togrow = utype_build_shield_cost(pCity, punittype);
......
} else {
const struct impr_type *pimprove = pCity->production.value.building;
pLogo = ResizeSurfaceBox(get_building_surface(pCity->production.value.building),
logo = ResizeSurfaceBox(get_building_surface(pCity->production.value.building),
adj_size(36), adj_size(24), 1,
TRUE, TRUE);
togrow = impr_build_shield_cost(pCity, pimprove);
......
}
if (!worklist_is_empty(&(pCity->worklist))) {
dst.x = pLogo->w - pIcons->pWorklist->w;
dst.x = logo->w - pIcons->pWorklist->w;
dst.y = 0;
alphablit(pIcons->pWorklist, NULL, pLogo, &dst, 255);
alphablit(pIcons->pWorklist, NULL, logo, &dst, 255);
fc_snprintf(cbuf, sizeof(cbuf), "%s\n(%d/%d)\n%s",
pName, pCity->shield_stock, togrow, _("worklist"));
} else {
......
togrow, PL_("turn", "turns", togrow));
}
pbuf = create_icon2(pLogo, pwindow->dst,
pbuf = create_icon2(logo, pwindow->dst,
WF_WIDGET_HAS_INFO_LABEL |WF_RESTORE_BACKGROUND
| WF_FREE_THEME);
pbuf->info_label = pstr;
......
area.h += pText2->h + adj_size(6);
area.w += adj_size(2);
pLogo = theme_get_background(theme, BACKGROUND_CITYREP);
resize_window(pwindow, pLogo, NULL,
logo = theme_get_background(theme, BACKGROUND_CITYREP);
resize_window(pwindow, logo, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h);
FREESURFACE(pLogo);
FREESURFACE(logo);
#if 0
pLogo = SDL_DisplayFormat(pwindow->theme);
logo = SDL_DisplayFormat(pwindow->theme);
FREESURFACE(pwindow->theme);
pwindow->theme = pLogo;
pLogo = NULL;
pwindow->theme = logo;
logo = NULL;
#endif
area = pwindow->area;
......
char cbuf[64];
const char *pName;
int togrow;
SDL_Surface *pLogo;
SDL_Surface *logo;
SDL_Rect dst;
/* city name status */
......
if (VUT_UTYPE == pCity->production.kind) {
const struct unit_type *punittype = pCity->production.value.utype;
pLogo = ResizeSurface(get_unittype_surface(punittype, direction8_invalid()),
logo = ResizeSurface(get_unittype_surface(punittype, direction8_invalid()),
adj_size(36), adj_size(24), 1);
togrow = utype_build_shield_cost(pCity, punittype);
pName = utype_name_translation(punittype);
} else {
const struct impr_type *pimprove = pCity->production.value.building;
pLogo = ResizeSurface(get_building_surface(pCity->production.value.building),
logo = ResizeSurface(get_building_surface(pCity->production.value.building),
adj_size(36), adj_size(24), 1);
togrow = impr_build_shield_cost(pCity, pimprove);
pName = improvement_name_translation(pimprove);
}
if (!worklist_is_empty(&(pCity->worklist))) {
dst.x = pLogo->w - pIcons->pWorklist->w;
dst.x = logo->w - pIcons->pWorklist->w;
dst.y = 0;
alphablit(pIcons->pWorklist, NULL, pLogo, &dst, 255);
alphablit(pIcons->pWorklist, NULL, logo, &dst, 255);
fc_snprintf(cbuf, sizeof(cbuf), "%s\n(%d/%d)\n%s",
pName, pCity->shield_stock, togrow, _("worklist"));
} else {
......
pwidget = pwidget->prev;
copy_chars_to_utf8_str(pwidget->info_label, cbuf);
FREESURFACE(pwidget->theme);
pwidget->theme = pLogo;
pwidget->theme = logo;
/* hurry productions */
pwidget = pwidget->prev;
client/gui-sdl2/cma_fe.c
SDL_Color bg_color = {255, 255, 255, 136};
struct widget *pwindow, *pBuf;
SDL_Surface *pLogo, *pText[O_LAST + 1], *pMinimal, *pFactor;
SDL_Surface *logo, *pText[O_LAST + 1], *pMinimal, *pFactor;
SDL_Surface *pcity_map;
utf8_str *pstr;
char cBuf[128];
......
area.h = adj_size(360) - (pwindow->size.w - pwindow->area.w);
#endif /* SMALL_SCREEN */
pLogo = theme_get_background(theme, BACKGROUND_CITYGOVDLG);
if (resize_window(pwindow, pLogo, NULL,
logo = theme_get_background(theme, BACKGROUND_CITYGOVDLG);
if (resize_window(pwindow, logo, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.w - pwindow->area.w) + area.h)) {
FREESURFACE(pLogo);
FREESURFACE(logo);
}
#if 0
pLogo = SDL_DisplayFormat(pwindow->theme);
logo = SDL_DisplayFormat(pwindow->theme);
FREESURFACE(pwindow->theme);
pwindow->theme = pLogo;
pwindow->theme = logo;
#endif
area = pwindow->area;
client/gui-sdl2/connectdlg.c
int w = 0, h = 0, count = 0, meta_h;
struct widget *pNewWidget, *pwindow, *pLabelWindow;
utf8_str *pstr;
SDL_Surface *pLogo;
SDL_Surface *logo;
SDL_Rect area, area2;
struct srv_list *srvrs;
......
meta_h += pMeta_Server->pEndWidgetList->prev->size.h + adj_size(10) + adj_size(20);
pLogo = theme_get_background(theme, BACKGROUND_CONNECTDLG);
if (resize_window(pwindow, pLogo, NULL, w, meta_h)) {
FREESURFACE(pLogo);
logo = theme_get_background(theme, BACKGROUND_CONNECTDLG);
if (resize_window(pwindow, logo, NULL, w, meta_h)) {
FREESURFACE(logo);
}
area = pwindow->area;
......
utf8_str *plrname = NULL;
utf8_str *srvname = NULL;
utf8_str *port_nr = NULL;
SDL_Surface *pLogo;
SDL_Surface *logo;
SDL_Rect area;
int start_x;
int pos_y;
......
dialog_h = area.h + (pwindow->size.h - pwindow->area.h);
#endif
pLogo = theme_get_background(theme, BACKGROUND_JOINGAMEDLG);
if (resize_window(pwindow, pLogo, NULL, dialog_w, dialog_h)) {
FREESURFACE(pLogo);
logo = theme_get_background(theme, BACKGROUND_JOINGAMEDLG);
if (resize_window(pwindow, logo, NULL, dialog_w, dialog_h)) {
FREESURFACE(logo);
}
area = pwindow->area;
......
{
struct widget *pBuf, *pwindow;
utf8_str *label_str = NULL;
SDL_Surface *pBackground;
SDL_Surface *background;
int start_x, start_y;
int start_button_y;
SDL_Rect area;
......
area.w = MAX(area.w, pwindow->prev->size.w);
area.w += adj_size(80);
pBackground = theme_get_background(theme, BACKGROUND_USERPASSWDDLG);
if (resize_window(pwindow, pBackground, NULL,
background = theme_get_background(theme, BACKGROUND_USERPASSWDDLG);
if (resize_window(pwindow, background, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h)) {
FREESURFACE(pBackground);
FREESURFACE(background);
}
area = pwindow->area;
......
{
struct widget *pBuf, *pwindow;
utf8_str *label_str = NULL;
SDL_Surface *pBackground;
SDL_Surface *background;
int start_x, start_y;
int start_button_y;
SDL_Rect area;
......
area.w = MAX(area.w, pwindow->prev->size.w);
area.w += adj_size(80);
pBackground = theme_get_background(theme, BACKGROUND_USERPASSWDDLG);
if (resize_window(pwindow, pBackground, NULL,
background = theme_get_background(theme, BACKGROUND_USERPASSWDDLG);
if (resize_window(pwindow, background, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h)) {
FREESURFACE(pBackground);
FREESURFACE(background);
}
area = pwindow->area;
client/gui-sdl2/dialogs.c
**************************************************************************/
void popup_government_dialog(void)
{
SDL_Surface *pLogo = NULL;
SDL_Surface *logo = NULL;
struct utf8_str *pstr = NULL;
struct widget *pGov_Button = NULL;
struct widget *pwindow = NULL;
......
area.h = MAX(area.h, j * (max_h + adj_size(10)) + adj_size(5));
/* create window background */
pLogo = theme_get_background(theme, BACKGROUND_CHOOSEGOVERNMENTDLG);
if (resize_window(pwindow, pLogo, NULL,
logo = theme_get_background(theme, BACKGROUND_CHOOSEGOVERNMENTDLG);
if (resize_window(pwindow, logo, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h)) {
FREESURFACE(pLogo);
FREESURFACE(logo);
}
area = pwindow->area;
client/gui-sdl2/finddlg.c
void popup_find_dialog(void)
{
struct widget *pwindow = NULL, *pBuf = NULL;
SDL_Surface *pLogo = NULL;
SDL_Surface *logo = NULL;
utf8_str *pstr;
char cBuf[128];
int h = 0, n = 0, w = 0, units_h = 0;
......
pstr->style |= (TTF_STYLE_BOLD|SF_CENTER);
if (!player_owns_city(owner, pCity)) {
pLogo = get_nation_flag_surface(nation_of_player(city_owner(pCity)));
pLogo = crop_visible_part_from_surface(pLogo);
logo = get_nation_flag_surface(nation_of_player(city_owner(pCity)));
logo = crop_visible_part_from_surface(logo);
}
pBuf = create_iconlabel(pLogo, pwindow->dst, pstr,
pBuf = create_iconlabel(logo, pwindow->dst, pstr,
(WF_RESTORE_BACKGROUND|WF_DRAW_TEXT_LABEL_WITH_SPACE));
if (!player_owns_city(owner, pCity)) {
client/gui-sdl2/gotodlg.c
static void update_goto_dialog(void)
{
struct widget *pBuf = NULL, *add_dock, *pLast;
SDL_Surface *pLogo = NULL;
SDL_Surface *logo = NULL;
utf8_str *pstr;
char cBuf[128];
int n = 0;
......
pstr->style |= TTF_STYLE_BOLD;
if (!player_owns_city(owner, pCity)) {
pLogo = get_nation_flag_surface(nation_of_player(city_owner(pCity)));
pLogo = crop_visible_part_from_surface(pLogo);
logo = get_nation_flag_surface(nation_of_player(city_owner(pCity)));
logo = crop_visible_part_from_surface(logo);
}
pBuf = create_iconlabel(pLogo, pGotoDlg->pEndWidgetList->dst, pstr,
pBuf = create_iconlabel(logo, pGotoDlg->pEndWidgetList->dst, pstr,
(WF_RESTORE_BACKGROUND|WF_DRAW_TEXT_LABEL_WITH_SPACE));
if (!player_owns_city(owner, pCity)) {
client/gui-sdl2/helpdlg.c
}
if (!pHelpDlg) {
SDL_Surface *pBackgroundTmpl, *pBackground, *pText, *pIcon;
SDL_Surface *background_tmpl, *background, *pText, *icon;
SDL_Rect dst;
current_help_dlg = HELP_IMPROVEMENT;
......
pstr->style |= (TTF_STYLE_BOLD | SF_CENTER);
/* background template for entries in scroll list */
pBackgroundTmpl = create_surf(adj_size(135), adj_size(40), SDL_SWSURFACE);
SDL_FillRect(pBackgroundTmpl, NULL, map_rgba(pBackgroundTmpl->format, bg_color));
background_tmpl = create_surf(adj_size(135), adj_size(40), SDL_SWSURFACE);
SDL_FillRect(background_tmpl, NULL, map_rgba(background_tmpl->format, bg_color));
create_frame(pBackgroundTmpl,
0, 0, pBackgroundTmpl->w - 1, pBackgroundTmpl->h - 1,
create_frame(background_tmpl,
0, 0, background_tmpl->w - 1, background_tmpl->h - 1,
get_theme_color(COLOR_THEME_HELPDLG_FRAME));
impr_type_count = 0;
improvement_iterate(pimprove) {
/* copy background surface */
pBackground = copy_surface(pBackgroundTmpl);
background = copy_surface(background_tmpl);
/* blit improvement name */
copy_chars_to_utf8_str(pstr, improvement_name_translation(pimprove));
pText = create_text_surf_smaller_than_w(pstr, adj_size(100 - 4));
dst.x = adj_size(40) + (pBackground->w - pText->w - adj_size(40)) / 2;
dst.y = (pBackground->h - pText->h) / 2;
alphablit(pText, NULL, pBackground, &dst, 255);
dst.x = adj_size(40) + (background->w - pText->w - adj_size(40)) / 2;
dst.y = (background->h - pText->h) / 2;
alphablit(pText, NULL, background, &dst, 255);
FREESURFACE(pText);
/* blit improvement icon */
pIcon = ResizeSurfaceBox(get_building_surface(pimprove),
adj_size(36), adj_size(36), 1, TRUE, TRUE);
icon = ResizeSurfaceBox(get_building_surface(pimprove),
adj_size(36), adj_size(36), 1, TRUE, TRUE);
dst.x = adj_size(5);
dst.y = (pBackground->h - pIcon->h) / 2;
alphablit(pIcon, NULL, pBackground, &dst, 255);
FREESURFACE(pIcon);
dst.y = (background->h - icon->h) / 2;
alphablit(icon, NULL, background, &dst, 255);
FREESURFACE(icon);
improvement_button = create_icon2(pBackground, pwindow->dst,
improvement_button = create_icon2(background, pwindow->dst,
WF_FREE_THEME | WF_RESTORE_BACKGROUND);
set_wstate(improvement_button, FC_WS_NORMAL);
......
} improvement_iterate_end;
FREESURFACE(pBackgroundTmpl);
FREESURFACE(background_tmpl);
pHelpDlg->pEndActiveWidgetList = pDock->prev;
pHelpDlg->pBeginWidgetList = improvement_button ? improvement_button : pCloseButton;
......
/* create new dialog if it doesn't exist yet */
if (!pHelpDlg) {
SDL_Surface *pBackgroundTmpl, *pBackground, *pText, *pIcon;
SDL_Surface *background_tmpl, *background, *pText, *icon;
SDL_Rect dst;
current_help_dlg = HELP_UNIT;
......
pstr->style |= (TTF_STYLE_BOLD | SF_CENTER);
/* background template for entries in scroll list */
pBackgroundTmpl = create_surf(adj_size(135), adj_size(40), SDL_SWSURFACE);
SDL_FillRect(pBackgroundTmpl, NULL, map_rgba(pBackgroundTmpl->format, bg_color));
background_tmpl = create_surf(adj_size(135), adj_size(40), SDL_SWSURFACE);
SDL_FillRect(background_tmpl, NULL, map_rgba(background_tmpl->format, bg_color));
create_frame(pBackgroundTmpl,
0, 0, pBackgroundTmpl->w - 1, pBackgroundTmpl->h - 1,
create_frame(background_tmpl,
0, 0, background_tmpl->w - 1, background_tmpl->h - 1,
get_theme_color(COLOR_THEME_HELPDLG_FRAME));
utype_count = 0;
unit_type_iterate(ut) {
/* copy background surface */
pBackground = copy_surface(pBackgroundTmpl);
background = copy_surface(background_tmpl);
/* blit unit name */
copy_chars_to_utf8_str(pstr, utype_name_translation(ut));
pText = create_text_surf_smaller_than_w(pstr, adj_size(100 - 4));
dst.x = adj_size(35) + (pBackground->w - pText->w - adj_size(35)) / 2;
dst.y = (pBackground->h - pText->h) / 2;
alphablit(pText, NULL, pBackground, &dst, 255);
dst.x = adj_size(35) + (background->w - pText->w - adj_size(35)) / 2;
dst.y = (background->h - pText->h) / 2;
alphablit(pText, NULL, background, &dst, 255);
FREESURFACE(pText);
/* blit unit icon */
pIcon = ResizeSurfaceBox(get_unittype_surface(ut, direction8_invalid()),
adj_size(36), adj_size(36), 1, TRUE, TRUE);
dst.x = (adj_size(35) - pIcon->w) / 2;
dst.y = (pBackground->h - pIcon->h) / 2;
alphablit(pIcon, NULL, pBackground, &dst, 255);
FREESURFACE(pIcon);
pUnitButton = create_icon2(pBackground, pwindow->dst,
icon = ResizeSurfaceBox(get_unittype_surface(ut, direction8_invalid()),
adj_size(36), adj_size(36), 1, TRUE, TRUE);
dst.x = (adj_size(35) - icon->w) / 2;
dst.y = (background->h - icon->h) / 2;
alphablit(icon, NULL, background, &dst, 255);
FREESURFACE(icon);
pUnitButton = create_icon2(background, pwindow->dst,
WF_FREE_THEME | WF_RESTORE_BACKGROUND);
set_wstate(pUnitButton, FC_WS_NORMAL);
......
} unit_type_iterate_end;
FREESURFACE(pBackgroundTmpl);
FREESURFACE(background_tmpl);
pHelpDlg->pEndActiveWidgetList = pDock->prev;
pHelpDlg->pBeginWidgetList = pUnitButton ? pUnitButton : pCloseButton;
client/gui-sdl2/inteldlg.c
const struct research *mresearch, *presearch;
struct intel_dialog *pdialog = get_intel_dialog(p);
struct widget *pwindow = NULL, *pBuf = NULL, *pLast;
SDL_Surface *pLogo = NULL, *pTmpSurf = NULL;
SDL_Surface *logo = NULL, *pTmpSurf = NULL;
SDL_Surface *pText1, *pInfo, *pText2 = NULL;
utf8_str *pstr;
SDL_Rect dst;
......
add_to_gui_list(ID_BUTTON, pBuf);
/* ---------- */
pLogo = get_nation_flag_surface(nation_of_player(p));
logo = get_nation_flag_surface(nation_of_player(p));
{
double zoom = DEFAULT_ZOOM * 60.0 / pLogo->h;
double zoom = DEFAULT_ZOOM * 60.0 / logo->h;
pText1 = zoomSurface(pLogo, zoom, zoom, 1);
pText1 = zoomSurface(logo, zoom, zoom, 1);
}
pLogo = pText1;
logo = pText1;
pBuf = create_icon2(pLogo, pwindow->dst,
pBuf = create_icon2(logo, pwindow->dst,
WF_RESTORE_BACKGROUND | WF_WIDGET_HAS_INFO_LABEL
| WF_FREE_THEME);
pBuf->action = spaceship_callback;
......
copy_chars_to_utf8_str(pstr, cBuf);
pInfo = create_text_surf_from_utf8(pstr);
area.w = MAX(area.w, pLogo->w + adj_size(10) + pInfo->w + adj_size(20));
area.h += MAX(pLogo->h + adj_size(20), pInfo->h + adj_size(20));
area.w = MAX(area.w, logo->w + adj_size(10) + pInfo->w + adj_size(20));
area.h += MAX(logo->h + adj_size(20), pInfo->h + adj_size(20));
/* ---------- */
pTmpSurf = get_tech_icon(A_FIRST);
client/gui-sdl2/mapctrl.c
**************************************************************************/
void popup_newcity_dialog(struct unit *pUnit, const char *pSuggestname)
{
SDL_Surface *pBackground;
SDL_Surface *background;
utf8_str *pstr = NULL;
struct widget *pLabel = NULL;
struct widget *pwindow = NULL;
......
pEdit->size.w = area.w - adj_size(20);
/* create window background */
pBackground = theme_get_background(theme, BACKGROUND_NEWCITYDLG);
if (resize_window(pwindow, pBackground, NULL,
background = theme_get_background(theme, BACKGROUND_NEWCITYDLG);
if (resize_window(pwindow, background, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h)) {
FREESURFACE(pBackground);
FREESURFACE(background);
}
area = pwindow->area;
client/gui-sdl2/messagewin.c
{
utf8_str *pstr;
struct widget *pwindow = NULL;
SDL_Surface *pBackground;
SDL_Surface *background;
SDL_Rect area;
SDL_Rect size;
......
FREEUTF8STR(pstr);
/* create window background */
pBackground = theme_get_background(theme, BACKGROUND_MESSAGEWIN);
if (resize_window(pwindow, pBackground, NULL,
background = theme_get_background(theme, BACKGROUND_MESSAGEWIN);
if (resize_window(pwindow, background, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h)) {
FREESURFACE(pBackground);
FREESURFACE(background);
}
area = pwindow->area;
client/gui-sdl2/pages.c
SDL_Color line_color = {128, 128, 128, 255};
int count = 0;
struct widget *pwidget = NULL, *pwindow = NULL;
SDL_Surface *pBackground;
SDL_Surface *background;
int h = 0;
SDL_Rect area;
char verbuf[200];
......
/* ------*/
pBackground = theme_get_background(theme, BACKGROUND_STARTMENU);
if (resize_window(pwindow, pBackground, NULL,
background = theme_get_background(theme, BACKGROUND_STARTMENU);
if (resize_window(pwindow, background, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h)) {
FREESURFACE(pBackground);
FREESURFACE(background);
}
area = pwindow->area;
client/gui-sdl2/plrdlg.c
void popup_players_dialog(bool raise)
{
struct widget *pwindow = NULL, *pBuf = NULL;
SDL_Surface *pLogo = NULL, *pZoomed = NULL;
SDL_Surface *logo = NULL, *zoomed = NULL;
utf8_str *pstr;
SDL_Rect dst;
int i, n, h;
......
pstr = create_utf8_str(NULL, 0, adj_font(10));
pstr->style |= (TTF_STYLE_BOLD|SF_CENTER);
pLogo = get_nation_flag_surface(nation_of_player(pplayer));
logo = get_nation_flag_surface(nation_of_player(pplayer));
{
/* Aim for a flag height of 60 pixels, but draw smaller flags if there
* are more players */
double zoom = DEFAULT_ZOOM * (60.0 - n) / pLogo->h;
double zoom = DEFAULT_ZOOM * (60.0 - n) / logo->h;
pZoomed = zoomSurface(pLogo, zoom, zoom, 1);
zoomed = zoomSurface(logo, zoom, zoom, 1);
}
pBuf = create_icon2(pZoomed, pwindow->dst,
pBuf = create_icon2(zoomed, pwindow->dst,
WF_RESTORE_BACKGROUND | WF_WIDGET_HAS_INFO_LABEL
| WF_FREE_THEME);
pBuf->info_label = pstr;
......
pstr = create_utf8_from_char(_("R.I.P.") , adj_font(10));
pstr->style |= TTF_STYLE_BOLD;
pstr->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_TEXT);
pLogo = create_text_surf_from_utf8(pstr);
logo = create_text_surf_from_utf8(pstr);
FREEUTF8STR(pstr);
dst.x = (pZoomed->w - pLogo->w) / 2;
dst.y = (pZoomed->h - pLogo->h) / 2;
alphablit(pLogo, NULL, pZoomed, &dst, 255);
FREESURFACE(pLogo);
dst.x = (zoomed->w - logo->w) / 2;
dst.y = (zoomed->h - logo->h) / 2;
alphablit(logo, NULL, zoomed, &dst, 255);
FREESURFACE(logo);
}
if (pplayer->is_alive) {
......
}
copy_chars_to_utf8_str(pstr, diplstate_type_translated_name(i));
pLogo = create_text_surf_from_utf8(pstr);
logo = create_text_surf_from_utf8(pstr);
pBuf = pBuf->prev;
h = MAX(pBuf->size.h, pLogo->h);
h = MAX(pBuf->size.h, logo->h);
pBuf->size.x = area.x + adj_size(5);
pBuf->size.y = n + (h - pBuf->size.h) / 2;
dst.x = adj_size(5) + pBuf->size.w + adj_size(6);
dst.y = n + (h - pLogo->h) / 2;
alphablit(pLogo, NULL, pwindow->theme, &dst, 255);
dst.y = n + (h - logo->h) / 2;
alphablit(logo, NULL, pwindow->theme, &dst, 255);
n += h;
FREESURFACE(pLogo);
FREESURFACE(logo);
}
FREEUTF8STR(pstr);
......
void popup_players_nations_dialog(void)
{
struct widget *pwindow = NULL, *pBuf = NULL;
SDL_Surface *pLogo = NULL;
SDL_Surface *logo = NULL;
utf8_str *pstr;
char cBuf[128], *state;
int n = 0, w = 0, units_h = 0;
......
pstr = create_utf8_from_char(cBuf, adj_font(10));
pstr->style |= TTF_STYLE_BOLD;
pLogo = get_nation_flag_surface(nation_of_player(pplayer));
logo = get_nation_flag_surface(nation_of_player(pplayer));
pBuf = create_iconlabel(pLogo, pwindow->dst, pstr,
pBuf = create_iconlabel(logo, pwindow->dst, pstr,
(WF_RESTORE_BACKGROUND|WF_DRAW_TEXT_LABEL_WITH_SPACE));
/* now add some eye candy ... */
client/gui-sdl2/repodlgs.c
struct widget *pBuf = NULL;
struct widget *pwindow, *pLast;
utf8_str *pstr;
SDL_Surface *pText1, *pText2, *pText3 , *pText4, *pText5, *pLogo;
SDL_Surface *pText1, *pText2, *pText3 , *pText4, *pText5, *logo;
int w = 0 , count, ww, hh = 0, name_w = 0;
char cbuf[64];
SDL_Rect dst;
......
area.h += pText1->h + adj_size(10);
area.w += adj_size(2);
pLogo = theme_get_background(theme, BACKGROUND_UNITSREP);
resize_window(pwindow, pLogo, NULL,
logo = theme_get_background(theme, BACKGROUND_UNITSREP);
resize_window(pwindow, logo, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h);
FREESURFACE(pLogo);
FREESURFACE(logo);
#if 0
pLogo = SDL_DisplayFormat(pwindow->theme);
logo = SDL_DisplayFormat(pwindow->theme);
FREESURFACE(pwindow->theme);
pwindow->theme = pLogo;
pLogo = NULL;
pwindow->theme = logo;
logo = NULL;
#endif /* 0 */
area = pwindow->area;
......
struct widget *pBuf;
struct widget *pwindow , *pLast;
utf8_str *pstr, *pstr2;
SDL_Surface *pSurf, *pText_Name, *pText, *pZoom;
SDL_Surface *pBackground;
SDL_Surface *pSurf, *pText_Name, *pText, *zoomed;
SDL_Surface *background;
int i, count , h = 0;
int w = 0; /* left column values */
int w2 = 0; /* right column: lock + scrollbar + ... */
......
if (entries_used > 0) {
/* Create Imprv Background Icon */
pBackground = create_surf(adj_size(116), adj_size(116), SDL_SWSURFACE);
background = create_surf(adj_size(116), adj_size(116), SDL_SWSURFACE);
SDL_FillRect(pBackground, NULL, map_rgba(pBackground->format, bg_color));
SDL_FillRect(background, NULL, map_rgba(background->format, bg_color));
create_frame(pBackground,
0, 0, pBackground->w - 1, pBackground->h - 1,
create_frame(background,
0, 0, background->w - 1, background->h - 1,
get_theme_color(COLOR_THEME_ECONOMYDLG_FRAME));
pstr = create_utf8_str(NULL, 0, adj_font(10));
......
struct improvement_entry *p = &entries[i];
struct impr_type *pimprove = p->type;
pSurf = crop_rect_from_surface(pBackground, NULL);
pSurf = crop_rect_from_surface(background, NULL);
fc_snprintf(cbuf, sizeof(cbuf), "%s", improvement_name_translation(pimprove));
......
/*-----------------*/
pZoom = get_building_surface(pimprove);
pZoom = zoomSurface(pZoom, DEFAULT_ZOOM * ((float)54 / pZoom->w), DEFAULT_ZOOM * ((float)54 / pZoom->w), 1);
zoomed = get_building_surface(pimprove);
zoomed = zoomSurface(zoomed, DEFAULT_ZOOM * ((float)54 / zoomed->w), DEFAULT_ZOOM * ((float)54 / zoomed->w), 1);
dst.x = (pSurf->w - pZoom->w) / 2;
dst.y = (pSurf->h / 2 - pZoom->h) / 2;
alphablit(pZoom, NULL, pSurf, &dst, 255);
dst.y += pZoom->h;
FREESURFACE(pZoom);
dst.x = (pSurf->w - zoomed->w) / 2;
dst.y = (pSurf->h / 2 - zoomed->h) / 2;
alphablit(zoomed, NULL, pSurf, &dst, 255);
dst.y += zoomed->h;
FREESURFACE(zoomed);
dst.x = (pSurf->w - pText_Name->w)/2;
dst.y += ((pSurf->h - dst.y) -
......
}
/*pstr->style &= ~TTF_STYLE_BOLD;*/
pZoom = create_text_surf_from_utf8(pstr);
zoomed = create_text_surf_from_utf8(pstr);
dst.x = (pSurf->w - pZoom->w) / 2;
alphablit(pZoom, NULL, pSurf, &dst, 255);
FREESURFACE(pZoom);
dst.x = (pSurf->w - zoomed->w) / 2;
alphablit(zoomed, NULL, pSurf, &dst, 255);
FREESURFACE(zoomed);
}
dst.y += (pIcons->pBIG_Coin->h + adj_size(2));
......
}
FREEUTF8STR(pstr);
FREESURFACE(pBackground);
FREESURFACE(background);
pEconomyDlg->pEndActiveWidgetList = pLast->prev;
pEconomyDlg->pBeginWidgetList = pBuf;
......
area.w = MAX(area.w, MAX(adj_size(10) + w3 + w + w2, count));
area.h = h;
pBackground = theme_get_background(theme, BACKGROUND_ECONOMYDLG);
if (resize_window(pwindow, pBackground, NULL,
background = theme_get_background(theme, BACKGROUND_ECONOMYDLG);
if (resize_window(pwindow, background, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h)) {
FREESURFACE(pBackground);
FREESURFACE(background);
}
area = pwindow->area;
......
struct widget *pChangeResearchGoalButton;
struct widget *pExitButton;
utf8_str *pstr;
SDL_Surface *pBackground, *pTechIcon;
SDL_Surface *background, *pTechIcon;
int count;
SDL_Rect area;
......
pScienceDlg->pEndWidgetList = pwindow;
pBackground = theme_get_background(theme, BACKGROUND_SCIENCEDLG);
pwindow->theme = ResizeSurface(pBackground, pwindow->size.w, pwindow->size.h, 1);
FREESURFACE(pBackground);
background = theme_get_background(theme, BACKGROUND_SCIENCEDLG);
pwindow->theme = ResizeSurface(background, pwindow->size.w, pwindow->size.h, 1);
FREESURFACE(background);
area = pwindow->area;
client/gui-sdl2/widget.c
int iTile_width_height_end, iTile_width_height_mid, iTile_count_height_mid;
int i, j;
SDL_Rect src, des;
SDL_Surface *pBackground = NULL;
SDL_Surface *background = NULL;
int iStart_y = (ptheme->h / 4) * state;
iTile_width_len_end = ptheme->w / 16;
......
zoom = ((i != width) || (j != height));
/* now allocate memory */
pBackground = create_surf(i, j, SDL_SWSURFACE);
background = create_surf(i, j, SDL_SWSURFACE);
/* copy left end */
......
des.x = 0;
des.y = 0;
alphablit(ptheme, &src, pBackground, &des, 255);
alphablit(ptheme, &src, background, &des, 255);
/* left middle */
src.y = iStart_y + iTile_width_height_end;
src.h = iTile_width_height_mid;
for (i = 0; i < iTile_count_height_mid; i++) {
des.y = iTile_width_height_end + i * iTile_width_height_mid;
alphablit(ptheme, &src, pBackground, &des, 255);
alphablit(ptheme, &src, background, &des, 255);
}
/* left bottom */
src.y = iStart_y + ((ptheme->h / 4) - iTile_width_height_end);
src.h = iTile_width_height_end;
des.y = pBackground->h - iTile_width_height_end;
clear_surface(pBackground, &des);
alphablit(ptheme, &src, pBackground, &des, 255);
des.y = background->h - iTile_width_height_end;
clear_surface(background, &des);
alphablit(ptheme, &src, background, &des, 255);
/* copy middle parts */
......
des.x = iTile_width_len_end + i * iTile_width_len_mid;
des.y = 0;
src.y = iStart_y;
alphablit(ptheme, &src, pBackground, &des, 255);
alphablit(ptheme, &src, background, &des, 255);
/* middle middle */
src.y = iStart_y + iTile_width_height_end;
src.h = iTile_width_height_mid;
for (j = 0; j < iTile_count_height_mid; j++) {
des.y = iTile_width_height_end + j * iTile_width_height_mid;
alphablit(ptheme, &src, pBackground, &des, 255);
alphablit(ptheme, &src, background, &des, 255);
}
/* middle bottom */
src.y = iStart_y + ((ptheme->h / 4) - iTile_width_height_end);
src.h = iTile_width_height_end;
des.y = pBackground->h - iTile_width_height_end;
clear_surface(pBackground, &des);
alphablit(ptheme, &src, pBackground, &des, 255);
des.y = background->h - iTile_width_height_end;
clear_surface(background, &des);
alphablit(ptheme, &src, background, &des, 255);
}
/* copy right end */
......
src.y = iStart_y;
src.w = iTile_width_len_end;
des.x = pBackground->w - iTile_width_len_end;
des.x = background->w - iTile_width_len_end;
des.y = 0;
alphablit(ptheme, &src, pBackground, &des, 255);
alphablit(ptheme, &src, background, &des, 255);
/* right middle */
src.y = iStart_y + iTile_width_height_end;
src.h = iTile_width_height_mid;
for (i = 0; i < iTile_count_height_mid; i++) {
des.y = iTile_width_height_end + i * iTile_width_height_mid;
alphablit(ptheme, &src, pBackground, &des, 255);
alphablit(ptheme, &src, background, &des, 255);
}
/* right bottom */
src.y = iStart_y + ((ptheme->h / 4) - iTile_width_height_end);
src.h = iTile_width_height_end;
des.y = pBackground->h - iTile_width_height_end;
clear_surface(pBackground, &des);
alphablit(ptheme, &src, pBackground, &des, 255);
des.y = background->h - iTile_width_height_end;
clear_surface(background, &des);
alphablit(ptheme, &src, background, &des, 255);
if (zoom) {
SDL_Surface *pZoom = ResizeSurface(pBackground, width, height, 1);
SDL_Surface *zoomed = ResizeSurface(background, width, height, 1);
FREESURFACE(pBackground);
pBackground = pZoom;
FREESURFACE(background);
background = zoomed;
}
return pBackground;
return background;
}
/* =================================================== */
client/gui-sdl2/widget_button.c
{
SDL_Rect dest = { 0, 0, 0, 0 };
utf8_str TMPString;
SDL_Surface *pButton = NULL, *pText = NULL, *pIcon = pIButton->theme2;
SDL_Surface *pButton = NULL, *pText = NULL, *icon = pIButton->theme2;
Uint16 Ix, Iy, x;
Uint16 y = 0; /* FIXME: possibly uninitialized */
int ret;
......
pText = create_text_surf_from_utf8(&TMPString);
}
if (!pText && !pIcon) {
if (!pText && !icon) {
return -1;
}
......
alphablit(pButton, NULL, pIButton->dst->surface, &pIButton->size, 255);
FREESURFACE(pButton);
if (pIcon) { /* Icon */
if (icon) { /* Icon */
if (pText) {
if (get_wflags(pIButton) & WF_ICON_CENTER_RIGHT) {
Ix = pIButton->size.w - pIcon->w - 5;
Ix = pIButton->size.w - icon->w - 5;
} else {
if (get_wflags(pIButton) & WF_ICON_CENTER) {
Ix = (pIButton->size.w - pIcon->w) / 2;
Ix = (pIButton->size.w - icon->w) / 2;
} else {
Ix = 5;
}
......
if (get_wflags(pIButton) & WF_ICON_ABOVE_TEXT) {
Iy = 3;
y = 3 + pIcon->h + 3 + (pIButton->size.h -
(pIcon->h + 6) - pText->h) / 2;
y = 3 + icon->h + 3 + (pIButton->size.h -
(icon->h + 6) - pText->h) / 2;
} else {
if (get_wflags(pIButton) & WF_ICON_UNDER_TEXT) {
y = 3 + (pIButton->size.h - (pIcon->h + 3) - pText->h) / 2;
y = 3 + (pIButton->size.h - (icon->h + 3) - pText->h) / 2;
Iy = y + pText->h + 3;
} else { /* center */
Iy = (pIButton->size.h - pIcon->h) / 2;
Iy = (pIButton->size.h - icon->h) / 2;
y = (pIButton->size.h - pText->h) / 2;
}
}
} else { /* no text */
Iy = (pIButton->size.h - pIcon->h) / 2;
Ix = (pIButton->size.w - pIcon->w) / 2;
Iy = (pIButton->size.h - icon->h) / 2;
Ix = (pIButton->size.w - icon->w) / 2;
}
if (get_wstate(pIButton) == FC_WS_PRESSED) {
......
dest.x = pIButton->size.x + Ix;
dest.y = pIButton->size.y + Iy;
ret = alphablit(pIcon, NULL, pIButton->dst->surface, &dest, 255);
ret = alphablit(icon, NULL, pIButton->dst->surface, &dest, 255);
if (ret) {
FREESURFACE(pText);
return ret - 10;
......
}
if (pText) {
if (pIcon) {
if (icon) {
if (!(get_wflags(pIButton) & WF_ICON_ABOVE_TEXT)
&& !(get_wflags(pIButton) & WF_ICON_UNDER_TEXT)) {
if (get_wflags(pIButton) & WF_ICON_CENTER_RIGHT) {
if (pIButton->string_utf8->style & SF_CENTER) {
x = (pIButton->size.w - (pIcon->w + 5) - pText->w) / 2;
x = (pIButton->size.w - (icon->w + 5) - pText->w) / 2;
} else {
if (pIButton->string_utf8->style & SF_CENTER_RIGHT) {
x = pIButton->size.w - (pIcon->w + 7) - pText->w;
x = pIButton->size.w - (icon->w + 7) - pText->w;
} else {
x = 5;
}
......
/* end WF_ICON_CENTER */
} else { /* icon center left - default */
if (pIButton->string_utf8->style & SF_CENTER) {
x = 5 + pIcon->w + ((pIButton->size.w -
(pIcon->w + 5) - pText->w) / 2);
x = 5 + icon->w + ((pIButton->size.w -
(icon->w + 5) - pText->w) / 2);
} else {
if (pIButton->string_utf8->style & SF_CENTER_RIGHT) {
x = pIButton->size.w - pText->w - 5;
} else { /* text center left */
x = 5 + pIcon->w + 3;
x = 5 + icon->w + 3;
}
}
} /* end icon center left - default */
......
goto Alone;
}
} else {
/* !pIcon */
/* !icon */
y = (pIButton->size.h - pText->h) / 2;
Alone:
if (pIButton->string_utf8->style & SF_CENTER) {
......
static int redraw_tibutton(struct widget *pTIButton)
{
int iRet = 0;
SDL_Surface *pIcon;
SDL_Surface *icon;
SDL_Surface *pCopy_Of_Icon_Theme;
iRet = (*baseclass_redraw)(pTIButton);
......
return iRet;
}
pIcon = create_icon_from_theme(pTIButton->theme2, get_wstate(pTIButton));
icon = create_icon_from_theme(pTIButton->theme2, get_wstate(pTIButton));
pCopy_Of_Icon_Theme = pTIButton->theme2;
pTIButton->theme2 = pIcon;
pTIButton->theme2 = icon;
iRet = redraw_ibutton(pTIButton);
......
/**********************************************************************//**
Create ( malloc ) Icon (theme)Button Widget structure.
Icon graphic is taken from 'pIcon' surface (don't change with button
Icon graphic is taken from 'icon' surface (don't change with button
changes ); Button Theme graphic is taken from current_theme->Button surface;
Text is taken from 'pstr'.
......
function return pointer to allocated Button Widget.
**************************************************************************/
struct widget *create_icon_button(SDL_Surface *pIcon, struct gui_layer *pdest,
struct widget *create_icon_button(SDL_Surface *icon, struct gui_layer *pdest,
utf8_str *pstr, Uint32 flags)
{
SDL_Rect buf = {0, 0, 0, 0};
int w = 0, h = 0;
struct widget *pButton;
if (!pIcon && !pstr) {
if (!icon && !pstr) {
return NULL;
}
pButton = widget_new();
pButton->theme = current_theme->Button;
pButton->theme2 = pIcon;
pButton->theme2 = icon;
pButton->string_utf8 = pstr;
set_wflag(pButton, (WF_FREE_STRING | flags));
set_wstate(pButton, FC_WS_DISABLED);
......
h = MAX(h, buf.h);
}
if (pIcon) {
if (icon) {
if (pstr) {
if ((flags & WF_ICON_UNDER_TEXT) || (flags & WF_ICON_ABOVE_TEXT)) {
w = MAX(w, pIcon->w + adj_size(2));
h = MAX(h, buf.h + pIcon->h + adj_size(4));
w = MAX(w, icon->w + adj_size(2));
h = MAX(h, buf.h + icon->h + adj_size(4));
} else {
w = MAX(w, buf.w + pIcon->w + adj_size(20));
h = MAX(h, pIcon->h + adj_size(2));
w = MAX(w, buf.w + icon->w + adj_size(20));
h = MAX(h, icon->h + adj_size(2));
}
} else {
w = MAX(w, pIcon->w + adj_size(2));
h = MAX(h, pIcon->h + adj_size(2));
w = MAX(w, icon->w + adj_size(2));
h = MAX(h, icon->h + adj_size(2));
}
} else {
w += adj_size(10);
......
Uint32 flags)
{
/* extract a single icon */
SDL_Surface *pIcon = create_icon_from_theme(pIcon_theme, 1);
struct widget *pButton = create_icon_button(pIcon, pdest, pstr, flags);
SDL_Surface *icon = create_icon_from_theme(pIcon_theme, 1);
struct widget *pButton = create_icon_button(icon, pdest, pstr, flags);
FREESURFACE(pButton->theme2);
pButton->theme2 = pIcon_theme;
client/gui-sdl2/widget_button.h
#ifndef FC__WIDGET_BUTTON_H
#define FC__WIDGET_BUTTON_H
#define create_icon_button_from_chars(pIcon, pdest, pCharString, iPtsize, flags) \
create_icon_button(pIcon, pdest, \
#define create_icon_button_from_chars(icon, pdest, pCharString, iPtsize, flags) \
create_icon_button(icon, pdest, \
create_utf8_from_char(pCharString, iPtsize), \
flags)
#define create_themeicon_button_from_unichar(pIcon_theme, pdest, pUniChar, pUniCharSize, iPtsize, flags) \
create_themeicon_button(pIcon, pdest, create_utf8(pUniChar, pUniCharSize, iPtsize), \
create_themeicon_button(icon, pdest, create_utf8(pUniChar, pUniCharSize, iPtsize), \
flags)
#define create_themeicon_button_from_chars(pIcon_theme, pdest, pCharString, iPtsize, flags) \
......
iPtsize), \
flags)
struct widget *create_icon_button(SDL_Surface *pIcon,
struct widget *create_icon_button(SDL_Surface *icon,
struct gui_layer *pdest, utf8_str *pstr,
Uint32 flags);
client/gui-sdl2/widget_checkbox.c
/**********************************************************************//**
Blit checkbox gfx to surface its on.
**************************************************************************/
static int redraw_checkbox(struct widget *pIcon)
static int redraw_checkbox(struct widget *icon)
{
int ret;
SDL_Rect src, area = pIcon->size;
SDL_Rect src, area = icon->size;
ret = (*checkbox_baseclass_redraw)(pIcon);
ret = (*checkbox_baseclass_redraw)(icon);
if (ret != 0) {
return ret;
}
if (!pIcon->theme) {
if (!icon->theme) {
return -3;
}
src.x = (pIcon->theme->w / 4) * (Uint8) (get_wstate(pIcon));
src.x = (icon->theme->w / 4) * (Uint8) (get_wstate(icon));
src.y = 0;
src.w = (pIcon->theme->w / 4);
src.h = pIcon->theme->h;
src.w = (icon->theme->w / 4);
src.h = icon->theme->h;
if (pIcon->size.w != src.w) {
area.x += (pIcon->size.w - src.w) / 2;
if (icon->size.w != src.w) {
area.x += (icon->size.w - src.w) / 2;
}
if (pIcon->size.h != src.h) {
area.y += (pIcon->size.h - src.h) / 2;
if (icon->size.h != src.h) {
area.y += (icon->size.h - src.h) / 2;
}
return alphablit(pIcon->theme, &src, pIcon->dst->surface, &area, 255);
return alphablit(icon->theme, &src, icon->dst->surface, &area, 255);
}
/**********************************************************************//**
......
static int redraw_textcheckbox(struct widget *pCBox)
{
int ret;
SDL_Surface *pTheme_Surface, *pIcon;
SDL_Surface *pTheme_Surface, *icon;
ret = (*textcheckbox_baseclass_redraw)(pCBox);
if (ret != 0) {
......
}
pTheme_Surface = pCBox->theme;
pIcon = create_icon_from_theme(pTheme_Surface, get_wstate(pCBox));
icon = create_icon_from_theme(pTheme_Surface, get_wstate(pCBox));
if (!pIcon) {
if (!icon) {
return -3;
}
pCBox->theme = pIcon;
pCBox->theme = icon;
/* redraw icon label */
ret = redraw_iconlabel(pCBox);
FREESURFACE(pIcon);
FREESURFACE(icon);
pCBox->theme = pTheme_Surface;
return ret;
......
{
struct widget *pCBox;
struct checkbox *ptmp;
SDL_Surface *pSurf, *pIcon;
SDL_Surface *pSurf, *icon;
struct widget *tmp_widget;
if (pstr == NULL) {
......
pSurf = current_theme->CBOX_Unsell_Icon;
}
pIcon = create_icon_from_theme(pSurf, 0);
pCBox = create_iconlabel(pIcon, pdest, pstr, (flags | WF_FREE_PRIVATE_DATA));
icon = create_icon_from_theme(pSurf, 0);
pCBox = create_iconlabel(icon, pdest, pstr, (flags | WF_FREE_PRIVATE_DATA));
pstr->style &= ~SF_CENTER;
pCBox->theme = pSurf;
FREESURFACE(pIcon);
FREESURFACE(icon);
set_wtype(pCBox, WT_TCHECKBOX);
ptmp->state = state;
client/gui-sdl2/widget_edit.c
function return pointer to allocated Edit Widget.
**************************************************************************/
struct widget *create_edit(SDL_Surface *pBackground, struct gui_layer *pdest,
struct widget *create_edit(SDL_Surface *background, struct gui_layer *pdest,
utf8_str *pstr, int length, Uint32 flags)
{
SDL_Rect buf = {0, 0, 0, 0};
struct widget *pEdit = widget_new();
pEdit->theme = current_theme->Edit;
pEdit->theme2 = pBackground; /* FIXME: make somewhere use of it */
pEdit->theme2 = background; /* FIXME: make somewhere use of it */
pEdit->string_utf8 = pstr;
set_wflag(pEdit, (WF_FREE_STRING | WF_FREE_GFX | flags));
set_wstate(pEdit, FC_WS_DISABLED);
client/gui-sdl2/widget_edit.h
ED_FORCE_EXIT = 4
};
#define create_edit_from_chars(pBackground, pdest, pCharString, iPtsize, length, flags) \
create_edit(pBackground, pdest, \
#define create_edit_from_chars(background, pdest, pCharString, iPtsize, length, flags) \
create_edit(background, pdest, \
create_utf8_from_char(pCharString, iPtsize), \
length, flags)
#define edit(pEdit) edit_field(pEdit)
struct widget *create_edit(SDL_Surface *pBackground, struct gui_layer *pdest,
struct widget *create_edit(SDL_Surface *background, struct gui_layer *pdest,
utf8_str *pstr, int length,
Uint32 flags);
enum Edit_Return_Codes edit_field(struct widget *pEdit_Widget);
client/gui-sdl2/widget_icon.c
/**********************************************************************//**
Blit icon gfx to surface its on.
**************************************************************************/
static int redraw_icon(struct widget *pIcon)
static int redraw_icon(struct widget *icon)
{
int ret;
SDL_Rect src, area = pIcon->size;
SDL_Rect src, area = icon->size;
ret = (*baseclass_redraw)(pIcon);
ret = (*baseclass_redraw)(icon);
if (ret != 0) {
return ret;
}
if (!pIcon->theme) {
if (!icon->theme) {
return -3;
}
src.x = (pIcon->theme->w / 4) * (Uint8) (get_wstate(pIcon));
src.x = (icon->theme->w / 4) * (Uint8) (get_wstate(icon));
src.y = 0;
src.w = (pIcon->theme->w / 4);
src.h = pIcon->theme->h;
src.w = (icon->theme->w / 4);
src.h = icon->theme->h;
if (pIcon->size.w != src.w) {
area.x += (pIcon->size.w - src.w) / 2;
if (icon->size.w != src.w) {
area.x += (icon->size.w - src.w) / 2;
}
if (pIcon->size.h != src.h) {
area.y += (pIcon->size.h - src.h) / 2;
if (icon->size.h != src.h) {
area.y += (icon->size.h - src.h) / 2;
}
return alphablit(pIcon->theme, &src, pIcon->dst->surface, &area, 255);
return alphablit(icon->theme, &src, icon->dst->surface, &area, 255);
}
/**********************************************************************//**
Blit icon2 gfx to surface its on.
**************************************************************************/
static int redraw_icon2(struct widget *pIcon)
static int redraw_icon2(struct widget *icon)
{
int ret;
SDL_Rect dest;
ret = (*baseclass_redraw)(pIcon);
ret = (*baseclass_redraw)(icon);
if (ret != 0) {
return ret;
}
if (!pIcon) {
if (!icon) {
return -3;
}
if (!pIcon->theme) {
if (!icon->theme) {
return -4;
}
dest.x = pIcon->size.x;
dest.y = pIcon->size.y;
dest.w = pIcon->theme->w;
dest.h = pIcon->theme->h;
dest.x = icon->size.x;
dest.y = icon->size.y;
dest.w = icon->theme->w;
dest.h = icon->theme->h;
switch (get_wstate(pIcon)) {
switch (get_wstate(icon)) {
case FC_WS_SELECTED:
create_frame(pIcon->dst->surface,
create_frame(icon->dst->surface,
dest.x + 1, dest.y + 1,
dest.w + adj_size(2), dest.h + adj_size(2),
get_theme_color(COLOR_THEME_CUSTOM_WIDGET_SELECTED_FRAME));
break;
case FC_WS_PRESSED:
create_frame(pIcon->dst->surface,
create_frame(icon->dst->surface,
dest.x + 1, dest.y + 1,
dest.w + adj_size(2), dest.h + adj_size(2),
get_theme_color(COLOR_THEME_CUSTOM_WIDGET_SELECTED_FRAME));
create_frame(pIcon->dst->surface,
create_frame(icon->dst->surface,
dest.x, dest.y,
dest.w + adj_size(3), dest.h + adj_size(3),
get_theme_color(COLOR_THEME_CUSTOM_WIDGET_PRESSED_FRAME));
break;
case FC_WS_DISABLED:
create_frame(pIcon->dst->surface,
create_frame(icon->dst->surface,
dest.x + 1, dest.y + 1,
dest.w + adj_size(2), dest.h + adj_size(2),
get_theme_color(COLOR_THEME_WIDGET_DISABLED_TEXT));
......
dest.x += adj_size(2);
dest.y += adj_size(2);
ret = alphablit(pIcon->theme, NULL, pIcon->dst->surface, &dest, 255);
ret = alphablit(icon->theme, NULL, icon->dst->surface, &dest, 255);
if (ret) {
return ret;
}
......
/**********************************************************************//**
Ugly hack to create 4-state icon theme from static icon;
**************************************************************************/
SDL_Surface *create_icon_theme_surf(SDL_Surface *pIcon)
SDL_Surface *create_icon_theme_surf(SDL_Surface *icon)
{
SDL_Color bg_color = { 255, 255, 255, 128 };
SDL_Rect dest, src = get_smaller_surface_rect(pIcon);
SDL_Rect dest, src = get_smaller_surface_rect(icon);
SDL_Surface *pTheme = create_surf((src.w + adj_size(4)) * 4, src.h + adj_size(4),
SDL_SWSURFACE);
......
dest.y = (pTheme->h - src.h) / 2;
/* normal */
alphablit(pIcon, &src, pTheme, &dest, 255);
alphablit(icon, &src, pTheme, &dest, 255);
/* selected */
dest.x += (src.w + adj_size(4));
alphablit(pIcon, &src, pTheme, &dest, 255);
alphablit(icon, &src, pTheme, &dest, 255);
/* draw selected frame */
create_frame(pTheme,
......
/* pressed */
dest.x += (src.w + adj_size(4));
alphablit(pIcon, &src, pTheme, &dest, 255);
alphablit(icon, &src, pTheme, &dest, 255);
/* draw selected frame */
create_frame(pTheme,
......
/* disabled */
dest.x += (src.w + adj_size(4));
alphablit(pIcon, &src, pTheme, &dest, 255);
alphablit(icon, &src, pTheme, &dest, 255);
dest.w = src.w;
dest.h = src.h;
......
/**********************************************************************//**
Draw the icon.
**************************************************************************/
int draw_icon(struct widget *pIcon, Sint16 start_x, Sint16 start_y)
int draw_icon(struct widget *icon, Sint16 start_x, Sint16 start_y)
{
pIcon->size.x = start_x;
pIcon->size.y = start_y;
icon->size.x = start_x;
icon->size.y = start_y;
if (get_wflags(pIcon) & WF_RESTORE_BACKGROUND) {
refresh_widget_background(pIcon);
if (get_wflags(icon) & WF_RESTORE_BACKGROUND) {
refresh_widget_background(icon);
}
return draw_icon_from_theme(pIcon->theme, get_wstate(pIcon), pIcon->dst,
pIcon->size.x, pIcon->size.y);
return draw_icon_from_theme(icon->theme, get_wstate(icon), icon->dst,
icon->size.x, icon->size.y);
}
/**********************************************************************//**
......
if (!pIcon_theme) {
return -3;
}
src.x = 0 + (pIcon_theme->w / 4) * state;
src.y = 0;
src.w = pIcon_theme->w / 4;
......
/**********************************************************************//**
Create ( malloc ) Icon2 Widget ( flat Button )
**************************************************************************/
struct widget *create_icon2(SDL_Surface *pIcon, struct gui_layer *pdest,
struct widget *create_icon2(SDL_Surface *icon, struct gui_layer *pdest,
Uint32 flags)
{
struct widget *pIcon_Widget = widget_new();
pIcon_Widget->theme = pIcon;
pIcon_Widget->theme = icon;
set_wflag(pIcon_Widget, (WF_FREE_STRING | WF_FREE_GFX | flags));
set_wstate(pIcon_Widget, FC_WS_DISABLED);
......
baseclass_redraw = pIcon_Widget->redraw;
pIcon_Widget->redraw = redraw_icon2;
if (pIcon) {
pIcon_Widget->size.w = pIcon->w + adj_size(4);
pIcon_Widget->size.h = pIcon->h + adj_size(4);
if (icon) {
pIcon_Widget->size.w = icon->w + adj_size(4);
pIcon_Widget->size.h = icon->h + adj_size(4);
}
return pIcon_Widget;
client/gui-sdl2/widget_icon.h
/* ICON */
void set_new_icon_theme(struct widget *pIcon_Widget,
SDL_Surface *pNew_Theme);
SDL_Surface *create_icon_theme_surf(SDL_Surface *pIcon);
SDL_Surface *create_icon_theme_surf(SDL_Surface *icon);
struct widget *create_themeicon(SDL_Surface *pIcon_theme,
struct gui_layer *pdest, Uint32 flags);
SDL_Surface *create_icon_from_theme(SDL_Surface *pIcon_theme,
......
int draw_icon_from_theme(SDL_Surface *pIcon_theme, Uint8 state,
struct gui_layer *pdest, Sint16 start_x,
Sint16 start_y);
int draw_icon(struct widget *pIcon, Sint16 start_x, Sint16 start_y);
int draw_icon(struct widget *icon, Sint16 start_x, Sint16 start_y);
/* ICON2 */
void set_new_icon2_theme(struct widget *pIcon_Widget, SDL_Surface *pNew_Theme,
bool free_old_theme);
struct widget *create_icon2(SDL_Surface *pIcon, struct gui_layer *pdest, Uint32 flags);
struct widget *create_icon2(SDL_Surface *icon, struct gui_layer *pdest,
Uint32 flags);
#endif /* FC__WIDGET_ICON_H */
client/gui-sdl2/widget_label.c
**************************************************************************/
void remake_label_size(struct widget *pLabel)
{
SDL_Surface *pIcon = pLabel->theme;
SDL_Surface *icon = pLabel->theme;
utf8_str *text = pLabel->string_utf8;
Uint32 flags = get_wflags(pLabel);
SDL_Rect buf = { 0, 0, 0, 0 };
......
h = MAX(h, buf.h);
}
if (pIcon) {
if (icon) {
if (text != NULL) {
if ((flags & WF_ICON_UNDER_TEXT) || (flags & WF_ICON_ABOVE_TEXT)) {
w = MAX(w, pIcon->w + space);
h = MAX(h, buf.h + pIcon->h + adj_size(3));
w = MAX(w, icon->w + space);
h = MAX(h, buf.h + icon->h + adj_size(3));
} else {
if (flags & WF_ICON_CENTER) {
w = MAX(w, pIcon->w + space);
h = MAX(h, pIcon->h);
w = MAX(w, icon->w + space);
h = MAX(h, icon->h);
} else {
w = MAX(w, buf.w + pIcon->w + adj_size(5) + space);
h = MAX(h, pIcon->h);
w = MAX(w, buf.w + icon->w + adj_size(5) + space);
h = MAX(h, icon->h);
}
}
/* text */
} else {
w = MAX(w, pIcon->w + space);
h = MAX(h, pIcon->h);
w = MAX(w, icon->w + space);
h = MAX(h, icon->h);
}
}
/* pIcon */
/* icon */
pLabel->size.w = w;
pLabel->size.h = h;
}
/**********************************************************************//**
ThemeLabel is utf8_str with Background ( pIcon ).
ThemeLabel is utf8_str with Background ( icon ).
**************************************************************************/
struct widget *create_themelabel(SDL_Surface *pIcon, struct gui_layer *pdest,
struct widget *create_themelabel(SDL_Surface *icon, struct gui_layer *pdest,
utf8_str *pstr, Uint16 w, Uint16 h,
Uint32 flags)
{
struct widget *pLabel = NULL;
if (pIcon == NULL && pstr == NULL) {
if (icon == NULL && pstr == NULL) {
return NULL;
}
pLabel = widget_new();
pLabel->theme = pIcon;
pLabel->theme = icon;
pLabel->string_utf8 = pstr;
set_wflag(pLabel,
(WF_ICON_CENTER | WF_FREE_STRING | WF_FREE_GFX |
......
/**********************************************************************//**
This Label is UTF8 string with Icon.
**************************************************************************/
struct widget *create_iconlabel(SDL_Surface *pIcon, struct gui_layer *pdest,
struct widget *create_iconlabel(SDL_Surface *icon, struct gui_layer *pdest,
utf8_str *pstr, Uint32 flags)
{
struct widget *pILabel = NULL;
pILabel = widget_new();
pILabel->theme = pIcon;
pILabel->theme = icon;
pILabel->string_utf8 = pstr;
set_wflag(pILabel, WF_FREE_STRING | WF_FREE_GFX | flags);
set_wstate(pILabel, FC_WS_DISABLED);
......
}
/**********************************************************************//**
ThemeLabel is UTF8 string with Background ( pIcon ).
ThemeLabel is UTF8 string with Background ( icon ).
**************************************************************************/
struct widget *create_themelabel2(SDL_Surface *pIcon, struct gui_layer *pdest,
struct widget *create_themelabel2(SDL_Surface *icon, struct gui_layer *pdest,
utf8_str *pstr, Uint16 w, Uint16 h,
Uint32 flags)
{
......
SDL_Color bg_color = *get_theme_color(COLOR_THEME_THEMELABEL2_BG);
Uint32 colorkey;
if (pIcon == NULL && pstr == NULL) {
if (icon == NULL && pstr == NULL) {
return NULL;
}
pLabel = widget_new();
pLabel->theme = pIcon;
pLabel->theme = icon;
pLabel->string_utf8 = pstr;
set_wflag(pLabel, (WF_FREE_THEME | WF_FREE_STRING | WF_FREE_GFX | flags));
set_wstate(pLabel, FC_WS_DISABLED);
client/gui-sdl2/widget_label.h
pBuf->action = pCallback; \
} while (FALSE)
struct widget *create_themelabel(SDL_Surface *pBackground, struct gui_layer *pdest,
struct widget *create_themelabel(SDL_Surface *icon, struct gui_layer *pdest,
utf8_str *pstr, Uint16 w, Uint16 h,
Uint32 flags);
struct widget *create_themelabel2(SDL_Surface *pIcon, struct gui_layer *pdest,
struct widget *create_themelabel2(SDL_Surface *icon, struct gui_layer *pdest,
utf8_str *pstr, Uint16 w, Uint16 h, Uint32 flags);
struct widget *create_iconlabel(SDL_Surface *pIcon, struct gui_layer *pdest,
struct widget *create_iconlabel(SDL_Surface *icon, struct gui_layer *pdest,
utf8_str *text, Uint32 flags);
struct widget *convert_iconlabel_to_themeiconlabel2(struct widget *pIconLabel);
int draw_label(struct widget *pLabel, Sint16 start_x, Sint16 start_y);
client/gui-sdl2/wldlg.c
**************************************************************************/
static SDL_Surface *get_progress_icon(int stock, int cost, int *progress)
{
SDL_Surface *pIcon = NULL;
SDL_Surface *icon = NULL;
int width;
fc_assert_ret_val(progress != NULL, NULL);
......
*progress = 100;
}
pIcon = create_bcgnd_surf(current_theme->Edit, 0, adj_size(120), adj_size(30));
icon = create_bcgnd_surf(current_theme->Edit, 0, adj_size(120), adj_size(30));
if (width) {
SDL_Rect dst = {2,1,0,0};
SDL_Surface *pBuf = create_bcgnd_surf(current_theme->Button, 3, width,
adj_size(28));
alphablit(pBuf, NULL, pIcon, &dst, 255);
alphablit(pBuf, NULL, icon, &dst, 255);
FREESURFACE(pBuf);
}
return pIcon;
return icon;
}
/**********************************************************************//**
......
int widget_w = 0, widget_h = 0;
utf8_str *pstr = NULL;
struct widget *pBuf = NULL, *pwindow, *pLast;
SDL_Surface *pText = NULL, *pText_Name = NULL, *pZoom = NULL;
SDL_Surface *pText = NULL, *pText_Name = NULL, *zoomed = NULL;
SDL_Surface *pMain;
SDL_Surface *pIcon;
SDL_Surface *icon;
SDL_Rect dst;
char cbuf[128];
struct unit_type *punittype = NULL;
......
pEditor->pProduction_Name = pBuf;
add_to_gui_list(ID_LABEL, pBuf);
pIcon = get_progress_icon(pCity->shield_stock, count, &turns);
icon = get_progress_icon(pCity->shield_stock, count, &turns);
if (!gold_prod) {
fc_snprintf(cbuf, sizeof(cbuf), "%d%%" , turns);
......
pstr = create_utf8_from_char(cbuf, adj_font(12));
pstr->style |= (TTF_STYLE_BOLD|SF_CENTER);
pBuf = create_iconlabel(pIcon, pwindow->dst, pstr,
pBuf = create_iconlabel(icon, pwindow->dst, pstr,
(WF_RESTORE_BACKGROUND|WF_ICON_CENTER|WF_FREE_THEME));
pIcon = NULL;
icon = NULL;
turns = 0;
pEditor->pProduction_Progres = pBuf;
add_to_gui_list(ID_LABEL, pBuf);
......
if ((advanced_tech && can_eventually_build)
|| (!advanced_tech && can_build)) {
pIcon = crop_rect_from_surface(pMain, NULL);
icon = crop_rect_from_surface(pMain, NULL);
fc_snprintf(cbuf, sizeof(cbuf), "%s", improvement_name_translation(pimprove));
copy_chars_to_utf8_str(pstr, cbuf);
......
pstr->style |= TTF_STYLE_STRIKETHROUGH;
}
pText_Name = create_text_surf_smaller_than_w(pstr, pIcon->w - 4);
pText_Name = create_text_surf_smaller_than_w(pstr, icon->w - 4);
if (is_wonder(pimprove)) {
if (improvement_obsolete(client.conn.playing, pimprove, pCity)) {
......
/*-----------------*/
pZoom = get_building_surface(pimprove);
pZoom = zoomSurface(pZoom, DEFAULT_ZOOM * ((float)54 / pZoom->w), DEFAULT_ZOOM * ((float)54 / pZoom->w), 1);
dst.x = (pIcon->w - pZoom->w) / 2;
dst.y = (pIcon->h/2 - pZoom->h) / 2;
alphablit(pZoom, NULL, pIcon, &dst, 255);
dst.y += pZoom->h;
FREESURFACE(pZoom);
zoomed = get_building_surface(pimprove);
zoomed = zoomSurface(zoomed, DEFAULT_ZOOM * ((float)54 / zoomed->w), DEFAULT_ZOOM * ((float)54 / zoomed->w), 1);
dst.x = (icon->w - zoomed->w) / 2;
dst.y = (icon->h/2 - zoomed->h) / 2;
alphablit(zoomed, NULL, icon, &dst, 255);
dst.y += zoomed->h;
FREESURFACE(zoomed);
dst.x = (pIcon->w - pText_Name->w) / 2;
dst.y += ((pIcon->h - dst.y) - (pText_Name->h + pText->h)) / 2;
alphablit(pText_Name, NULL, pIcon, &dst, 255);
dst.x = (icon->w - pText_Name->w) / 2;
dst.y += ((icon->h - dst.y) - (pText_Name->h + pText->h)) / 2;
alphablit(pText_Name, NULL, icon, &dst, 255);
dst.x = (pIcon->w - pText->w) / 2;
dst.x = (icon->w - pText->w) / 2;
dst.y += pText_Name->h;
alphablit(pText, NULL, pIcon, &dst, 255);
alphablit(pText, NULL, icon, &dst, 255);
FREESURFACE(pText);
FREESURFACE(pText_Name);
pBuf = create_icon2(pIcon, pwindow->dst,
pBuf = create_icon2(icon, pwindow->dst,
WF_RESTORE_BACKGROUND|WF_FREE_THEME);
set_wstate(pBuf, FC_WS_NORMAL);
......
punittype = un;
pIcon = crop_rect_from_surface(pMain, NULL);
icon = crop_rect_from_surface(pMain, NULL);
fc_snprintf(cbuf, sizeof(cbuf), "%s", utype_name_translation(un));
copy_chars_to_utf8_str(pstr, cbuf);
pstr->style |= TTF_STYLE_BOLD;
pText_Name = create_text_surf_smaller_than_w(pstr, pIcon->w - 4);
pText_Name = create_text_surf_smaller_than_w(pstr, icon->w - 4);
if (pCity) {
struct universal univ = cid_production(cid_encode_unit(un));
......
pText = create_text_surf_from_utf8(pstr);
pZoom = adj_surf(get_unittype_surface(un, direction8_invalid()));
dst.x = (pIcon->w - pZoom->w) / 2;
dst.y = (pIcon->h/2 - pZoom->h) / 2;
alphablit(pZoom, NULL, pIcon, &dst, 255);
FREESURFACE(pZoom);
zoomed = adj_surf(get_unittype_surface(un, direction8_invalid()));
dst.x = (icon->w - zoomed->w) / 2;
dst.y = (icon->h / 2 - zoomed->h) / 2;
alphablit(zoomed, NULL, icon, &dst, 255);
FREESURFACE(zoomed);
dst.x = (pIcon->w - pText_Name->w) / 2;
dst.y = pIcon->h/2 + (pIcon->h/2 - (pText_Name->h + pText->h)) / 2;
alphablit(pText_Name, NULL, pIcon, &dst, 255);
dst.x = (icon->w - pText_Name->w) / 2;
dst.y = icon->h / 2 + (icon->h / 2 - (pText_Name->h + pText->h)) / 2;
alphablit(pText_Name, NULL, icon, &dst, 255);
dst.x = (pIcon->w - pText->w) / 2;
dst.x = (icon->w - pText->w) / 2;
dst.y += pText_Name->h;
alphablit(pText, NULL, pIcon, &dst, 255);
alphablit(pText, NULL, icon, &dst, 255);
FREESURFACE(pText);
FREESURFACE(pText_Name);
pBuf = create_icon2(pIcon, pwindow->dst,
pBuf = create_icon2(icon, pwindow->dst,
WF_RESTORE_BACKGROUND|WF_FREE_THEME);
set_wstate(pBuf, FC_WS_NORMAL);
......
area.w = MAX(area.w, widget_w * TARGETS_COL + count + adj_size(130));
area.h = MAX(area.h, widget_h * TARGETS_ROW);
pIcon = theme_get_background(theme, BACKGROUND_WLDLG);
if (resize_window(pwindow, pIcon, NULL,
icon = theme_get_background(theme, BACKGROUND_WLDLG);
if (resize_window(pwindow, icon, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h)) {
FREESURFACE(pIcon);
FREESURFACE(icon);
}
area = pwindow->area;
    (1-1/1)