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 #897860 ยป 0026-sdl2-Rename-p-ActiveWidgetList.patch

Marko Lindqvist, 2020-11-17 05:22 AM

View differences:

client/gui-sdl2/action_dialog.c
/* --------------------------------------------------------- */
FREEUTF8STR(pstr);
pDiplomat_Dlg->pdialog->begin_widget_list = pBuf;
pDiplomat_Dlg->pdialog->pBeginActiveWidgetList = pDiplomat_Dlg->pdialog->begin_widget_list;
pDiplomat_Dlg->pdialog->pEndActiveWidgetList = pDiplomat_Dlg->pdialog->end_widget_list->prev->prev;
pDiplomat_Dlg->pdialog->begin_active_widget_list = pDiplomat_Dlg->pdialog->begin_widget_list;
pDiplomat_Dlg->pdialog->end_active_widget_list = pDiplomat_Dlg->pdialog->end_widget_list->prev->prev;
/* -------------------------------------------------------------- */
......
if (count > col) {
count = (count + (col - 1)) / col;
if (count > max_row) {
pDiplomat_Dlg->pdialog->pActiveWidgetList = pDiplomat_Dlg->pdialog->pEndActiveWidgetList;
pDiplomat_Dlg->pdialog->active_widget_list = pDiplomat_Dlg->pdialog->end_active_widget_list;
count = max_row;
idx = create_vertical_scrollbar(pDiplomat_Dlg->pdialog, col, count, TRUE, TRUE);
}
......
pBuf->size.y = pwindow->size.y + adj_size(2);
setup_vertical_widgets_position(col, area.x + 1,
area.y, 0, 0,
pDiplomat_Dlg->pdialog->pBeginActiveWidgetList,
pDiplomat_Dlg->pdialog->pEndActiveWidgetList);
area.y, 0, 0,
pDiplomat_Dlg->pdialog->begin_active_widget_list,
pDiplomat_Dlg->pdialog->end_active_widget_list);
if (pDiplomat_Dlg->pdialog->pScroll) {
setup_vertical_scrollbar_area(pDiplomat_Dlg->pdialog->pScroll,
area.x + area.w, area.y,
area.h, TRUE);
area.x + area.w, area.y,
area.h, TRUE);
}
redraw_group(pDiplomat_Dlg->pdialog->begin_widget_list, pwindow, FALSE);
......
add_to_gui_list(ID_SEPARATOR, pBuf);
area.h += pBuf->next->size.h;
pDiplomat_Dlg->pdialog->pEndActiveWidgetList = pBuf;
pDiplomat_Dlg->pdialog->end_active_widget_list = pBuf;
}
/* ------------------ */
......
}
} city_built_iterate_end;
pDiplomat_Dlg->pdialog->pBeginActiveWidgetList = pBuf;
pDiplomat_Dlg->pdialog->begin_active_widget_list = pBuf;
if (n > 0
&& action_prob_possible(actor->client.act_prob_cache[
......
pLast = pBuf;
pDiplomat_Dlg->pdialog->begin_widget_list = pLast;
pDiplomat_Dlg->pdialog->pActiveWidgetList = pDiplomat_Dlg->pdialog->pEndActiveWidgetList;
pDiplomat_Dlg->pdialog->active_widget_list = pDiplomat_Dlg->pdialog->end_active_widget_list;
/* ---------- */
if (n > 10) {
......
pBuf = pBuf->prev;
while (pBuf) {
if (pBuf == pDiplomat_Dlg->pdialog->pEndActiveWidgetList) {
if (pBuf == pDiplomat_Dlg->pdialog->end_active_widget_list) {
w -= n;
}
......
break;
}
if (pBuf == pDiplomat_Dlg->pdialog->pBeginActiveWidgetList) {
if (pBuf == pDiplomat_Dlg->pdialog->begin_active_widget_list) {
/* Reset to end of scrolling area */
y = MIN(y, pDiplomat_Dlg->pdialog->pEndActiveWidgetList->size.y
y = MIN(y, pDiplomat_Dlg->pdialog->end_active_widget_list->size.y
+ 9 * pBuf->size.h);
w += n;
}
......
if (pDiplomat_Dlg->pdialog->pScroll) {
setup_vertical_scrollbar_area(pDiplomat_Dlg->pdialog->pScroll,
area.x + area.w,
pDiplomat_Dlg->pdialog->pEndActiveWidgetList->size.y,
pDiplomat_Dlg->pdialog->pBeginActiveWidgetList->prev->size.y
- pDiplomat_Dlg->pdialog->pEndActiveWidgetList->size.y,
pDiplomat_Dlg->pdialog->end_active_widget_list->size.y,
pDiplomat_Dlg->pdialog->begin_active_widget_list->prev->size.y
- pDiplomat_Dlg->pdialog->end_active_widget_list->size.y,
TRUE);
}
client/gui-sdl2/chatline.c
} else {
add_widget_to_vertical_scroll_widget_list(pLoadDialog,
pFilenameLabel,
pLoadDialog->pBeginActiveWidgetList,
pLoadDialog->begin_active_widget_list,
FALSE,
area.x + 1,
area.y + adj_size(2));
......
pBuf->size.w = pConnDlg->text_width;
add_widget_to_vertical_scroll_widget_list(pConnDlg->pChat_Dlg, pBuf,
pConnDlg->pChat_Dlg->pBeginActiveWidgetList, FALSE,
pConnDlg->pChat_Dlg->begin_active_widget_list, FALSE,
pwindow->size.x + adj_size(10 + 60 + 10),
pwindow->size.y + adj_size(14));
count++;
......
pBuf->size.w = pConnDlg->text_width;
if (add_widget_to_vertical_scroll_widget_list(pConnDlg->pChat_Dlg, pBuf,
pConnDlg->pChat_Dlg->pBeginActiveWidgetList, FALSE,
pConnDlg->pChat_Dlg->begin_active_widget_list, FALSE,
pwindow->size.x + adj_size(10 + 60 + 10),
pwindow->size.y + adj_size(14))) {
redraw_group(pConnDlg->pChat_Dlg->begin_widget_list,
......
pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
if (pConnDlg->pUsers_Dlg) {
del_group(pConnDlg->pUsers_Dlg->pBeginActiveWidgetList,
pConnDlg->pUsers_Dlg->pEndActiveWidgetList);
pConnDlg->pUsers_Dlg->pActiveWidgetList = NULL;
del_group(pConnDlg->pUsers_Dlg->begin_active_widget_list,
pConnDlg->pUsers_Dlg->end_active_widget_list);
pConnDlg->pUsers_Dlg->active_widget_list = NULL;
pConnDlg->pUsers_Dlg->begin_widget_list =
pConnDlg->pUsers_Dlg->pScroll->pScrollBar;
pConnDlg->pUsers_Dlg->pScroll->count = 0;
......
create = FALSE;
} else {
add_widget_to_vertical_scroll_widget_list(pConnDlg->pUsers_Dlg,
pBuf, pConnDlg->pUsers_Dlg->pBeginActiveWidgetList, FALSE,
pBuf, pConnDlg->pUsers_Dlg->begin_active_widget_list, FALSE,
pwindow->area.x + pwindow->area.w - adj_size(130),
pwindow->size.y + adj_size(14));
}
......
pConnDlg->pChat_Dlg->begin_widget_list = pLabel;
pConnDlg->pChat_Dlg->end_widget_list = pLabel;
pConnDlg->pChat_Dlg->pBeginActiveWidgetList = pConnDlg->pChat_Dlg->begin_widget_list;
pConnDlg->pChat_Dlg->pEndActiveWidgetList = pConnDlg->pChat_Dlg->end_widget_list;
pConnDlg->pChat_Dlg->begin_active_widget_list = pConnDlg->pChat_Dlg->begin_widget_list;
pConnDlg->pChat_Dlg->end_active_widget_list = pConnDlg->pChat_Dlg->end_widget_list;
n = (pwindow->size.h - adj_size(44) - adj_size(40)) / pLabel->size.h;
pConnDlg->active = n;
client/gui-sdl2/citydlg.c
pcity_dlg->pPanel = fc_calloc(1, sizeof(struct advanced_dialog));
pcity_dlg->pPanel->end_widget_list = pEnd;
pcity_dlg->pPanel->begin_widget_list = pBuf;
pcity_dlg->pPanel->pEndActiveWidgetList = pcity_dlg->pPanel->end_widget_list;
pcity_dlg->pPanel->pBeginActiveWidgetList = pcity_dlg->pPanel->begin_widget_list;
pcity_dlg->pPanel->pActiveWidgetList = pcity_dlg->pPanel->pEndActiveWidgetList;
pcity_dlg->pPanel->end_active_widget_list = pcity_dlg->pPanel->end_widget_list;
pcity_dlg->pPanel->begin_active_widget_list = pcity_dlg->pPanel->begin_widget_list;
pcity_dlg->pPanel->active_widget_list = pcity_dlg->pPanel->end_active_widget_list;
setup_vertical_widgets_position(num_x,
pwindow->area.x + adj_size(5),
pwindow->area.y + adj_size(44),
0, 0, pcity_dlg->pPanel->pBeginActiveWidgetList,
pcity_dlg->pPanel->pEndActiveWidgetList);
0, 0, pcity_dlg->pPanel->begin_active_widget_list,
pcity_dlg->pPanel->end_active_widget_list);
if (i > num_x * num_y) {
create_vertical_scrollbar(pcity_dlg->pPanel,
......
enable_city_dlg_widgets();
if (pcity_dlg->pImprv->end_widget_list) {
set_group_state(pcity_dlg->pImprv->pBeginActiveWidgetList,
pcity_dlg->pImprv->pEndActiveWidgetList, FC_WS_DISABLED);
set_group_state(pcity_dlg->pImprv->begin_active_widget_list,
pcity_dlg->pImprv->end_active_widget_list, FC_WS_DISABLED);
}
redraw_city_dialog(pcity_dlg->pCity);
......
set_group_state(pcity_dlg->pBeginCityWidgetList,
pcity_dlg->pEndCityWidgetList->prev, FC_WS_NORMAL);
if (pcity_dlg->pImprv->pEndActiveWidgetList) {
if (pcity_dlg->pImprv->end_active_widget_list) {
if (pcity_dlg->pImprv->pScroll) {
set_wstate(pcity_dlg->pImprv->pScroll->pScrollBar, FC_WS_NORMAL); /* vscroll */
set_wstate(pcity_dlg->pImprv->pScroll->pUp_Left_Button, FC_WS_NORMAL); /* up */
......
* when possible */
if (pcity_dlg->pCity->did_sell
|| pcity_dlg->pCity->owner != client.conn.playing) {
set_group_state(pcity_dlg->pImprv->pBeginActiveWidgetList,
pcity_dlg->pImprv->pEndActiveWidgetList, FC_WS_DISABLED);
set_group_state(pcity_dlg->pImprv->begin_active_widget_list,
pcity_dlg->pImprv->end_active_widget_list, FC_WS_DISABLED);
} else {
struct widget *tmp_widget = pcity_dlg->pImprv->pEndActiveWidgetList;
struct widget *tmp_widget = pcity_dlg->pImprv->end_active_widget_list;
while (TRUE) {
struct impr_type *pimpr = improvement_by_number(MAX_ID - 3000 -
......
set_wstate(tmp_widget, FC_WS_NORMAL);
}
if (tmp_widget == pcity_dlg->pImprv->pBeginActiveWidgetList) {
if (tmp_widget == pcity_dlg->pImprv->begin_active_widget_list) {
break;
}
......
pcity_dlg->pImprv->end_widget_list);
pcity_dlg->pImprv->end_widget_list = NULL;
pcity_dlg->pImprv->begin_widget_list = NULL;
pcity_dlg->pImprv->pEndActiveWidgetList = NULL;
pcity_dlg->pImprv->pBeginActiveWidgetList = NULL;
pcity_dlg->pImprv->pActiveWidgetList = NULL;
pcity_dlg->pImprv->end_active_widget_list = NULL;
pcity_dlg->pImprv->begin_active_widget_list = NULL;
pcity_dlg->pImprv->active_widget_list = NULL;
FC_FREE(pcity_dlg->pImprv->pScroll);
}
......
if (count) {
pcity_dlg->pImprv->end_widget_list = pLast->prev;
pcity_dlg->pImprv->pEndActiveWidgetList = pcity_dlg->pImprv->end_widget_list;
pcity_dlg->pImprv->end_active_widget_list = pcity_dlg->pImprv->end_widget_list;
pcity_dlg->pImprv->begin_widget_list = pBuf;
pcity_dlg->pImprv->pBeginActiveWidgetList = pcity_dlg->pImprv->begin_widget_list;
pcity_dlg->pImprv->begin_active_widget_list = pcity_dlg->pImprv->begin_widget_list;
if (count > 7) {
pcity_dlg->pImprv->pActiveWidgetList = pcity_dlg->pImprv->pEndActiveWidgetList;
pcity_dlg->pImprv->active_widget_list = pcity_dlg->pImprv->end_active_widget_list;
create_vertical_scrollbar(pcity_dlg->pImprv, 1, 7, TRUE, TRUE);
client/gui-sdl2/cityrep.c
+ pUnits_Icon->w + adj_size(6) + prod_w + adj_size(170);
if (count) {
pCityRep->pEndActiveWidgetList = pLast->prev;
pCityRep->pBeginActiveWidgetList = pCityRep->begin_widget_list;
pCityRep->end_active_widget_list = pLast->prev;
pCityRep->begin_active_widget_list = pCityRep->begin_widget_list;
if (count > 14 * COL) {
pCityRep->pActiveWidgetList = pCityRep->pEndActiveWidgetList;
pCityRep->active_widget_list = pCityRep->end_active_widget_list;
if (pCityRep->pScroll) {
pCityRep->pScroll->count = count;
}
......
pbuf->size.w = prod_w;
start_y += H;
if (pbuf == pCityRep->pBeginActiveWidgetList) {
if (pbuf == pCityRep->begin_active_widget_list) {
break;
}
pbuf = pbuf->prev;
......
int count;
/* find if the lists are identical (if not then rebuild all) */
pwidget = pCityRep->pEndActiveWidgetList;/* name of first city */
pwidget = pCityRep->end_active_widget_list; /* name of first city */
city_list_iterate(client.conn.playing->cities, pCity) {
if (pCity->id == MAX_ID - pwidget->ID) {
count = COL;
......
}
} else {
real_info_city_report_dialog_update();
return;
}
} city_list_iterate_end;
/* check it there are some city widgets left on list */
if (pwidget && pwidget->next != pCityRep->pBeginActiveWidgetList) {
if (pwidget && pwidget->next != pCityRep->begin_active_widget_list) {
real_info_city_report_dialog_update();
return;
}
/* update widget city list (widget list is the same that city list) */
pwidget = pCityRep->pEndActiveWidgetList;
pwidget = pCityRep->end_active_widget_list;
city_list_iterate(client.conn.playing->cities, pCity) {
pwidget = real_city_report_dialog_update_city(pwidget, pCity);
} city_list_iterate_end;
......
void real_city_report_update_city(struct city *pCity)
{
if (pCityRep && pCity) {
struct widget *pBuf = pCityRep->pEndActiveWidgetList;
struct widget *pBuf = pCityRep->end_active_widget_list;
while (pCity->id != MAX_ID - pBuf->ID
&& pBuf != pCityRep->pBeginActiveWidgetList) {
&& pBuf != pCityRep->begin_active_widget_list) {
pBuf = pBuf->prev;
}
if (pBuf == pCityRep->pBeginActiveWidgetList) {
if (pBuf == pCityRep->begin_active_widget_list) {
real_info_city_report_dialog_update();
return;
}
client/gui-sdl2/cma_fe.c
}
}
pCma->pAdv->begin_widget_list = pBuf;
pCma->pAdv->pBeginActiveWidgetList = pCma->pAdv->begin_widget_list;
pCma->pAdv->pEndActiveWidgetList = pwindow->prev->prev;
pCma->pAdv->pActiveWidgetList = pCma->pAdv->pEndActiveWidgetList;
pCma->pAdv->begin_active_widget_list = pCma->pAdv->begin_widget_list;
pCma->pAdv->end_active_widget_list = pwindow->prev->prev;
pCma->pAdv->active_widget_list = pCma->pAdv->end_active_widget_list;
area.w += adj_size(2);
area.h += 1;
......
hh = (pCma->pAdv->pScroll ? pCma->pAdv->pScroll->pUp_Left_Button->size.h + 1 : 0);
setup_vertical_widgets_position(1, area.x + 1,
area.y + 1 + hh, area.w - 1, 0,
pCma->pAdv->pBeginActiveWidgetList, pBuf);
pCma->pAdv->begin_active_widget_list, pBuf);
if (pCma->pAdv->pScroll) {
pCma->pAdv->pScroll->pUp_Left_Button->size.x = area.x;
client/gui-sdl2/connectdlg.c
}
pMeta_Server->begin_widget_list = pNewWidget;
pMeta_Server->pBeginActiveWidgetList = pMeta_Server->begin_widget_list;
pMeta_Server->pEndActiveWidgetList = pMeta_Server->end_widget_list->prev->prev;
pMeta_Server->pActiveWidgetList = pMeta_Server->pEndActiveWidgetList;
pMeta_Server->begin_active_widget_list = pMeta_Server->begin_widget_list;
pMeta_Server->end_active_widget_list = pMeta_Server->end_widget_list->prev->prev;
pMeta_Server->active_widget_list = pMeta_Server->end_active_widget_list;
if (count > 10) {
meta_h = 10 * h;
......
pNewWidget->size.y = pNewWidget->next->size.y + pNewWidget->next->size.h;
pNewWidget = convert_iconlabel_to_themeiconlabel2(pNewWidget);
if (pNewWidget == pMeta_Server->pBeginActiveWidgetList) {
if (pNewWidget == pMeta_Server->begin_active_widget_list) {
break;
}
pNewWidget = pNewWidget->prev;
......
if (pMeta_Server->pScroll) {
setup_vertical_scrollbar_area(pMeta_Server->pScroll,
area.x + area.w - adj_size(6),
pMeta_Server->pEndActiveWidgetList->size.y,
pMeta_Server->end_active_widget_list->size.y,
area.h - adj_size(24) - pwindow->prev->size.h, TRUE);
}
......
widget_redraw(pwindow);
area2.x = pMeta_Server->pEndActiveWidgetList->size.x;
area2.y = pMeta_Server->pEndActiveWidgetList->size.y;
area2.x = pMeta_Server->end_active_widget_list->size.x;
area2.y = pMeta_Server->end_active_widget_list->size.y;
fill_rect_alpha(pwindow->dst->surface, &area2, &bg_color);
client/gui-sdl2/dialogs.c
}
pUnit_Select_Dlg->begin_widget_list = pBuf;
pUnit_Select_Dlg->pBeginActiveWidgetList = pUnit_Select_Dlg->begin_widget_list;
pUnit_Select_Dlg->pEndActiveWidgetList = pwindow->prev->prev;
pUnit_Select_Dlg->pActiveWidgetList = pUnit_Select_Dlg->pEndActiveWidgetList;
pUnit_Select_Dlg->begin_active_widget_list = pUnit_Select_Dlg->begin_widget_list;
pUnit_Select_Dlg->end_active_widget_list = pwindow->prev->prev;
pUnit_Select_Dlg->active_widget_list = pUnit_Select_Dlg->end_active_widget_list;
area.w += adj_size(2);
if (n > NUM_SEEN) {
......
pBuf = pBuf->prev;
setup_vertical_widgets_position(1, area.x + 1, area.y, w, 0,
pUnit_Select_Dlg->pBeginActiveWidgetList,
pUnit_Select_Dlg->begin_active_widget_list,
pBuf);
if (pUnit_Select_Dlg->pScroll) {
......
{
if (terrain_info_dlg) {
popdown_window_group_dialog(terrain_info_dlg->begin_widget_list,
terrain_info_dlg->end_widget_list);
terrain_info_dlg->end_widget_list);
FC_FREE(terrain_info_dlg);
flush_dirty();
}
......
}
}
create_active_iconlabel(pBuf, pwindow->dst, pstr, cBuf, NULL);
create_active_iconlabel(pBuf, pwindow->dst, pstr, cBuf, NULL);
if (reset) {
if (reset) {
pstr->fgcol = *get_theme_color(COLOR_THEME_ADVANCEDTERRAINDLG_TEXT);
reset = FALSE;
}
}
add_to_gui_list(ID_LABEL, pBuf);
}
add_to_gui_list(ID_LABEL, pBuf);
}
area.w = MAX(area.w, pBuf->size.w);
units_h += pBuf->size.h;
......
}
}
pAdvanced_Terrain_Dlg->pEndActiveWidgetList = pLast->prev;
pAdvanced_Terrain_Dlg->pActiveWidgetList = pAdvanced_Terrain_Dlg->pEndActiveWidgetList;
pAdvanced_Terrain_Dlg->end_active_widget_list = pLast->prev;
pAdvanced_Terrain_Dlg->active_widget_list = pAdvanced_Terrain_Dlg->end_active_widget_list;
pAdvanced_Terrain_Dlg->begin_widget_list = pBuf;
pAdvanced_Terrain_Dlg->pBeginActiveWidgetList = pAdvanced_Terrain_Dlg->begin_widget_list;
pAdvanced_Terrain_Dlg->begin_active_widget_list = pAdvanced_Terrain_Dlg->begin_widget_list;
if (n > ADV_NUM_SEEN) {
units_h = ADV_NUM_SEEN * pBuf->size.h;
......
fc_snprintf(cBuf, sizeof(cBuf), "%s (%d)", _("Ready all"), my_units);
create_active_iconlabel(pBuf, pwindow->dst, pstr,
cBuf, adv_unit_select_all_callback);
pBuf->data.unit = pAdvanced_Terrain_Dlg->pEndActiveWidgetList->data.unit;
pBuf->data.unit = pAdvanced_Terrain_Dlg->end_active_widget_list->data.unit;
set_wstate(pBuf, FC_WS_NORMAL);
pBuf->ID = ID_LABEL;
widget_add_as_prev(pBuf, pLast);
......
fc_snprintf(cBuf, sizeof(cBuf), "%s (%d)", _("Sentry idle"), my_units);
create_active_iconlabel(pBuf, pwindow->dst, pstr,
cBuf, adv_unit_sentry_idle_callback);
pBuf->data.unit = pAdvanced_Terrain_Dlg->pEndActiveWidgetList->data.unit;
pBuf->data.unit = pAdvanced_Terrain_Dlg->end_active_widget_list->data.unit;
set_wstate(pBuf, FC_WS_NORMAL);
pBuf->ID = ID_LABEL;
widget_add_as_prev(pBuf, pLast->prev);
......
pBuf = pBuf->prev;
while (pBuf) {
if (pBuf == pAdvanced_Terrain_Dlg->pEndActiveWidgetList) {
if (pBuf == pAdvanced_Terrain_Dlg->end_active_widget_list) {
w -= units_h;
}
......
}
if (pBuf == pAdvanced_Terrain_Dlg->begin_widget_list
|| pBuf == pAdvanced_Terrain_Dlg->pBeginActiveWidgetList) {
|| pBuf == pAdvanced_Terrain_Dlg->begin_active_widget_list) {
break;
}
pBuf = pBuf->prev;
......
if (pAdvanced_Terrain_Dlg->pScroll) {
setup_vertical_scrollbar_area(pAdvanced_Terrain_Dlg->pScroll,
area.x + area.w,
pAdvanced_Terrain_Dlg->pEndActiveWidgetList->size.y,
area.y - pAdvanced_Terrain_Dlg->pEndActiveWidgetList->size.y + area.h,
area.x + area.w,
pAdvanced_Terrain_Dlg->end_active_widget_list->size.y,
area.y - pAdvanced_Terrain_Dlg->end_active_widget_list->size.y + area.h,
TRUE);
}
......
/* first special to pillage */
pBuf = pBuf->prev;
setup_vertical_widgets_position(1,
area.x, area.y + 1, area.w, 0,
pPillage_Dlg->begin_widget_list, pBuf);
area.x, area.y + 1, area.w, 0,
pPillage_Dlg->begin_widget_list, pBuf);
/* --------------------- */
/* redraw */
......
remake_label_size(pLabel);
pLabel->size.x = pwindow->size.x + pwindow->size.w / 2 +
(pwindow->size.w/2 - pLabel->size.w) / 2;
(pwindow->size.w / 2 - pLabel->size.w) / 2;
}
......
FREESURFACE(pMain_Bg);
pNationDlg->pEndActiveWidgetList = pwindow->prev;
pNationDlg->end_active_widget_list = pwindow->prev;
pNationDlg->begin_widget_list = pwidget;
pNationDlg->pBeginActiveWidgetList = pNationDlg->begin_widget_list;
pNationDlg->begin_active_widget_list = pNationDlg->begin_widget_list;
if (get_playable_nation_count() > TARGETS_ROW * TARGETS_COL) {
pNationDlg->pActiveWidgetList = pNationDlg->pEndActiveWidgetList;
pNationDlg->active_widget_list = pNationDlg->end_active_widget_list;
create_vertical_scrollbar(pNationDlg,
TARGETS_COL, TARGETS_ROW, TRUE, TRUE);
}
......
/* nations */
h = pNationDlg->pEndActiveWidgetList->size.h * TARGETS_ROW;
h = pNationDlg->end_active_widget_list->size.h * TARGETS_ROW;
i = (area.h - adj_size(43) - h) / 2;
setup_vertical_widgets_position(TARGETS_COL,
area.x + adj_size(10),
area.y + i - adj_size(4),
0, 0, pNationDlg->pBeginActiveWidgetList,
pNationDlg->pEndActiveWidgetList);
0, 0, pNationDlg->begin_active_widget_list,
pNationDlg->end_active_widget_list);
if (pNationDlg->pScroll) {
SDL_Rect area2;
w = pNationDlg->pEndActiveWidgetList->size.w * TARGETS_COL;
w = pNationDlg->end_active_widget_list->size.w * TARGETS_COL;
setup_vertical_scrollbar_area(pNationDlg->pScroll,
area.x + w + adj_size(12),
area.y + i - adj_size(4), h, FALSE);
client/gui-sdl2/diplodlg.c
} /* Cities */
pDlg->begin_widget_list = pBuf;
pDlg->pBeginActiveWidgetList = pDlg->begin_widget_list;
pDlg->pEndActiveWidgetList = pDlg->end_widget_list->prev;
pDlg->begin_active_widget_list = pDlg->begin_widget_list;
pDlg->end_active_widget_list = pDlg->end_widget_list->prev;
pDlg->pScroll = NULL;
area.h = (main_window_height() - adj_size(100) - (pwindow->size.h - pwindow->area.h));
if (area.h < (count * height)) {
pDlg->pActiveWidgetList = pDlg->pEndActiveWidgetList;
pDlg->active_widget_list = pDlg->end_active_widget_list;
count = area.h / height;
scroll_w = create_vertical_scrollbar(pDlg, 1, count, TRUE, TRUE);
pBuf = pwindow;
......
} else {
set_wflag(pBuf, WF_HIDDEN);
}
} while (pBuf != pDlg->pBeginActiveWidgetList);
} while (pBuf != pDlg->begin_active_widget_list);
}
area.w = MAX(width + adj_size(4) + scroll_w, adj_size(150) - (pwindow->size.w - pwindow->area.w));
......
setup_vertical_widgets_position(1,
area.x + adj_size(2), area.y + 1,
width, height, pDlg->pBeginActiveWidgetList,
pDlg->pEndActiveWidgetList);
width, height, pDlg->begin_active_widget_list,
pDlg->end_active_widget_list);
if (pDlg->pScroll) {
setup_vertical_scrollbar_area(pDlg->pScroll,
......
utf8_str *pstr;
struct widget *pbuf, *pwindow = pdialog->pdialog->end_widget_list;
char cBuf[128];
bool redraw_all, scroll = (pdialog->pdialog->pActiveWidgetList != NULL);
bool redraw_all, scroll = (pdialog->pdialog->active_widget_list != NULL);
int len = pdialog->pdialog->pScroll->pUp_Left_Button->size.w;
clause_list_iterate(pdialog->treaty.clauses, pclause) {
......
pwindow->size.x + adj_size(12),
pdialog->pdialog->pScroll->pUp_Left_Button->size.y + adj_size(2));
if (!scroll && (pdialog->pdialog->pActiveWidgetList != NULL)) {
if (!scroll && (pdialog->pdialog->active_widget_list != NULL)) {
/* -> the scrollbar has been activated */
pbuf = pdialog->pdialog->pEndActiveWidgetList->next;
pbuf = pdialog->pdialog->end_active_widget_list->next;
do {
pbuf = pbuf->prev;
pbuf->size.w -= len;
/* we need to save a new background because the width has changed */
FREESURFACE(pbuf->gfx);
} while (pbuf != pdialog->pdialog->pBeginActiveWidgetList);
} while (pbuf != pdialog->pdialog->begin_active_widget_list);
scroll = TRUE;
}
......
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(counterpart);
/* find widget with clause */
pBuf = pdialog->pdialog->pEndActiveWidgetList->next;
pBuf = pdialog->pdialog->end_active_widget_list->next;
do {
pBuf = pBuf->prev;
} while (!((pBuf->data.cont->id0 == giver)
&& (((pBuf->data.cont->value >> 16) & 0xFFFF) == (int)type)
&& ((pBuf->data.cont->value & 0xFFFF) == value))
&& (pBuf != pdialog->pdialog->pBeginActiveWidgetList));
&& (pBuf != pdialog->pdialog->begin_active_widget_list));
if (!(pBuf->data.cont->id0 == giver
&& ((pBuf->data.cont->value >> 16) & 0xFFFF) == (int)type
......
return;
}
scroll = (pdialog->pdialog->pActiveWidgetList != NULL);
scroll = (pdialog->pdialog->active_widget_list != NULL);
del_widget_from_vertical_scroll_widget_list(pdialog->pdialog, pBuf);
if (scroll && (pdialog->pdialog->pActiveWidgetList == NULL)) {
if (scroll && (pdialog->pdialog->active_widget_list == NULL)) {
/* -> the scrollbar has been deactivated */
int len = pdialog->pdialog->pScroll->pUp_Left_Button->size.w;
pBuf = pdialog->pdialog->pEndActiveWidgetList->next;
pBuf = pdialog->pdialog->end_active_widget_list->next;
do {
pBuf = pBuf->prev;
widget_undraw(pBuf);
pBuf->size.w += len;
/* we need to save a new background because the width has changed */
FREESURFACE(pBuf->gfx);
} while (pBuf != pdialog->pdialog->pBeginActiveWidgetList);
} while (pBuf != pdialog->pdialog->begin_active_widget_list);
scroll = FALSE;
}
client/gui-sdl2/finddlg.c
} players_iterate_end;
pFind_City_Dlg->begin_widget_list = pBuf;
pFind_City_Dlg->pBeginActiveWidgetList = pFind_City_Dlg->begin_widget_list;
pFind_City_Dlg->pEndActiveWidgetList = pwindow->prev->prev;
pFind_City_Dlg->pActiveWidgetList = pFind_City_Dlg->pEndActiveWidgetList;
pFind_City_Dlg->begin_active_widget_list = pFind_City_Dlg->begin_widget_list;
pFind_City_Dlg->end_active_widget_list = pwindow->prev->prev;
pFind_City_Dlg->active_widget_list = pFind_City_Dlg->end_active_widget_list;
/* ---------- */
......
/* cities */
pBuf = pBuf->prev;
setup_vertical_widgets_position(1, area.x, area.y, w, 0,
pFind_City_Dlg->pBeginActiveWidgetList,
pFind_City_Dlg->begin_active_widget_list,
pBuf);
if (pFind_City_Dlg->pScroll) {
client/gui-sdl2/gotodlg.c
int n = 0;
struct player *owner = NULL;
if (pGotoDlg->pEndActiveWidgetList) {
add_dock = pGotoDlg->pEndActiveWidgetList->next;
if (pGotoDlg->end_active_widget_list) {
add_dock = pGotoDlg->end_active_widget_list->next;
pGotoDlg->begin_widget_list = add_dock;
del_group(pGotoDlg->pBeginActiveWidgetList, pGotoDlg->pEndActiveWidgetList);
pGotoDlg->pActiveWidgetList = NULL;
del_group(pGotoDlg->begin_active_widget_list, pGotoDlg->end_active_widget_list);
pGotoDlg->active_widget_list = NULL;
} else {
add_dock = pGotoDlg->begin_widget_list;
}
......
if (n > 0) {
pGotoDlg->begin_widget_list = pBuf;
pGotoDlg->pBeginActiveWidgetList = pGotoDlg->begin_widget_list;
pGotoDlg->pEndActiveWidgetList = pLast->prev;
pGotoDlg->pActiveWidgetList = pGotoDlg->pEndActiveWidgetList;
pGotoDlg->begin_active_widget_list = pGotoDlg->begin_widget_list;
pGotoDlg->end_active_widget_list = pLast->prev;
pGotoDlg->active_widget_list = pGotoDlg->end_active_widget_list;
pGotoDlg->pScroll->count = n;
if (n > pGotoDlg->pScroll->active) {
......
pGotoDlg->end_widget_list->area.y,
pGotoDlg->pScroll->pUp_Left_Button->size.x -
pGotoDlg->end_widget_list->area.x - adj_size(2),
0, pGotoDlg->pBeginActiveWidgetList,
pGotoDlg->pEndActiveWidgetList);
0, pGotoDlg->begin_active_widget_list,
pGotoDlg->end_active_widget_list);
} else {
hide_scrollbar(pGotoDlg->pScroll);
client/gui-sdl2/helpdlg.c
FREESURFACE(background_tmpl);
help_dlg->pEndActiveWidgetList = dock->prev;
help_dlg->end_active_widget_list = dock->prev;
help_dlg->begin_widget_list = improvement_button ? improvement_button : pCloseButton;
help_dlg->pBeginActiveWidgetList = help_dlg->begin_widget_list;
help_dlg->begin_active_widget_list = help_dlg->begin_widget_list;
if (impr_type_count > 10) {
help_dlg->pActiveWidgetList = help_dlg->pEndActiveWidgetList;
help_dlg->active_widget_list = help_dlg->end_active_widget_list;
scrollbar_width = create_vertical_scrollbar(help_dlg, 1, 10, TRUE, TRUE);
}
......
store->pObsoleteByButton = pObsoleteByLabel2;
/* helptext */
start_x = (area.x + 1 + scrollbar_width + help_dlg->pEndActiveWidgetList->size.w + adj_size(20));
start_x = (area.x + 1 + scrollbar_width + help_dlg->end_active_widget_list->size.w + adj_size(20));
buffer[0] = '\0';
helptext_building(buffer, sizeof(buffer), client.conn.playing, NULL,
......
/* list entries */
h = setup_vertical_widgets_position(1, area.x + scrollbar_width,
area.y + pListToggleButton->size.h, 0, 0,
help_dlg->pBeginActiveWidgetList,
help_dlg->pEndActiveWidgetList);
help_dlg->begin_active_widget_list,
help_dlg->end_active_widget_list);
/* scrollbar */
if (help_dlg->pScroll) {
......
FREESURFACE(background_tmpl);
help_dlg->pEndActiveWidgetList = dock->prev;
help_dlg->end_active_widget_list = dock->prev;
help_dlg->begin_widget_list = pUnitButton ? pUnitButton : pCloseButton;
help_dlg->pBeginActiveWidgetList = help_dlg->begin_widget_list;
help_dlg->begin_active_widget_list = help_dlg->begin_widget_list;
if (utype_count > 10) {
help_dlg->pActiveWidgetList = help_dlg->pEndActiveWidgetList;
help_dlg->active_widget_list = help_dlg->end_active_widget_list;
scrollbar_width = create_vertical_scrollbar(help_dlg, 1, 10, TRUE, TRUE);
}
......
store->pObsoleteByButton = pObsoleteByLabel2;
/* helptext */
start_x = (area.x + 1 + scrollbar_width + help_dlg->pActiveWidgetList->size.w + adj_size(20));
start_x = (area.x + 1 + scrollbar_width + help_dlg->active_widget_list->size.w + adj_size(20));
buffer[0] = '\0';
helptext_unit(buffer, sizeof(buffer), client.conn.playing, "", utype_by_number(type_id));
......
/* list entries */
h = setup_vertical_widgets_position(1, area.x + scrollbar_width,
area.y + pListToggleButton->size.h, 0, 0,
help_dlg->pBeginActiveWidgetList,
help_dlg->pEndActiveWidgetList);
help_dlg->begin_active_widget_list,
help_dlg->end_active_widget_list);
/* scrollbar */
if (help_dlg->pScroll) {
......
char buffer[bufsz];
SDL_Surface *surf;
start_x = (pwindow->area.x + adj_size(1) + width + help_dlg->pActiveWidgetList->size.w + adj_size(20));
start_x = (pwindow->area.x + adj_size(1) + width + help_dlg->active_widget_list->size.w + adj_size(20));
/* tech tree icon */
pwidget = create_icon2(current_theme->Tech_Tree_Icon, pwindow->dst,
......
FREEUTF8STR(pstr);
help_dlg->pEndActiveWidgetList = dock->prev;
help_dlg->end_active_widget_list = dock->prev;
help_dlg->begin_widget_list = pAdvanceLabel ? pAdvanceLabel : pCloseButton;
help_dlg->pBeginActiveWidgetList = help_dlg->begin_widget_list;
help_dlg->begin_active_widget_list = help_dlg->begin_widget_list;
if (tech_count > 10) {
help_dlg->pActiveWidgetList = help_dlg->pEndActiveWidgetList;
help_dlg->active_widget_list = help_dlg->end_active_widget_list;
scrollbar_width = create_vertical_scrollbar(help_dlg, 1, 10, TRUE, TRUE);
}
......
if (store->show_full_tree) {
/* all entries are visible without scrolling */
hide_group(help_dlg->pBeginActiveWidgetList,
help_dlg->pEndActiveWidgetList);
hide_group(help_dlg->begin_active_widget_list,
help_dlg->end_active_widget_list);
hide_scrollbar(help_dlg->pScroll);
} else {
int count = help_dlg->pScroll->active;
pAdvanceLabel = help_dlg->pActiveWidgetList;
pAdvanceLabel = help_dlg->active_widget_list;
while (pAdvanceLabel && count--) {
pAdvanceLabel = pAdvanceLabel->prev;
}
pAdvanceLabel = pAdvanceLabel->next;
show_group(pAdvanceLabel, help_dlg->pActiveWidgetList);
show_group(pAdvanceLabel, help_dlg->active_widget_list);
show_scrollbar(help_dlg->pScroll);
}
}
......
/* list entries */
h = setup_vertical_widgets_position(1, area.x + scrollbar_width,
area.y + pListToggleButton->size.h, 0, 0,
help_dlg->pBeginActiveWidgetList,
help_dlg->pEndActiveWidgetList);
help_dlg->begin_active_widget_list,
help_dlg->end_active_widget_list);
/* scrollbar */
if (help_dlg->pScroll) {
setup_vertical_scrollbar_area(help_dlg->pScroll,
client/gui-sdl2/inteldlg.c
pdialog->pdialog->begin_widget_list = pBuf;
if (n > 0) {
pdialog->pdialog->pEndActiveWidgetList = pLast->prev;
pdialog->pdialog->pBeginActiveWidgetList = pdialog->pdialog->begin_widget_list;
pdialog->pdialog->end_active_widget_list = pLast->prev;
pdialog->pdialog->begin_active_widget_list = pdialog->pdialog->begin_widget_list;
if (n > 2 * col) {
pdialog->pdialog->pActiveWidgetList = pdialog->pdialog->pEndActiveWidgetList;
pdialog->pdialog->active_widget_list = pdialog->pdialog->end_active_widget_list;
count = create_vertical_scrollbar(pdialog->pdialog, col, 2, TRUE, TRUE);
area.h += (2 * pBuf->size.h + adj_size(10));
} else {
......
FREESURFACE(pText2);
setup_vertical_widgets_position(col, area.x, dst.y, 0, 0,
pdialog->pdialog->pBeginActiveWidgetList,
pdialog->pdialog->pEndActiveWidgetList);
pdialog->pdialog->begin_active_widget_list,
pdialog->pdialog->end_active_widget_list);
if (pdialog->pdialog->pScroll) {
setup_vertical_scrollbar_area(pdialog->pdialog->pScroll,
client/gui-sdl2/mapctrl.c
set_wstate(pIcon_Widget, FC_WS_NORMAL);
selected_widget = NULL;
if (pUnits_Info_Window->private_data.adv_dlg->pEndActiveWidgetList) {
del_group(pUnits_Info_Window->private_data.adv_dlg->pBeginActiveWidgetList,
pUnits_Info_Window->private_data.adv_dlg->pEndActiveWidgetList);
if (pUnits_Info_Window->private_data.adv_dlg->end_active_widget_list) {
del_group(pUnits_Info_Window->private_data.adv_dlg->begin_active_widget_list,
pUnits_Info_Window->private_data.adv_dlg->end_active_widget_list);
}
if (pUnits_Info_Window->private_data.adv_dlg->pScroll) {
hide_scrollbar(pUnits_Info_Window->private_data.adv_dlg->pScroll);
client/gui-sdl2/mapview.c
const struct unit_type *putype;
int num_w, num_h;
if (pDlg->pEndActiveWidgetList && pDlg->pBeginActiveWidgetList) {
del_group(pDlg->pBeginActiveWidgetList, pDlg->pEndActiveWidgetList);
if (pDlg->end_active_widget_list && pDlg->begin_active_widget_list) {
del_group(pDlg->begin_active_widget_list, pDlg->end_active_widget_list);
}
num_w = (pInfo_Window->area.w - BLOCKU_W) / 68;
num_h = (pInfo_Window->area.h - sy) / 52;
......
} unit_list_iterate_end;
pDlg->pBeginActiveWidgetList = pBuf;
pDlg->pEndActiveWidgetList = pEnd;
pDlg->pActiveWidgetList = pDlg->pEndActiveWidgetList;
pDlg->begin_active_widget_list = pBuf;
pDlg->end_active_widget_list = pEnd;
pDlg->active_widget_list = pDlg->end_active_widget_list;
if (n > num_w * num_h) {
if (!pDlg->pScroll) {
......
pInfo_Window->area.x + BLOCKU_W + adj_size(2),
pInfo_Window->size.y + sy +
(pInfo_Window->size.h - sy - num_h * 52) / 2,
0, 0, pDlg->pBeginActiveWidgetList,
pDlg->pEndActiveWidgetList);
0, 0, pDlg->begin_active_widget_list,
pDlg->end_active_widget_list);
} else {
if (pInfo_Window->private_data.adv_dlg->pEndActiveWidgetList) {
del_group(pInfo_Window->private_data.adv_dlg->pBeginActiveWidgetList,
pInfo_Window->private_data.adv_dlg->pEndActiveWidgetList);
if (pInfo_Window->private_data.adv_dlg->end_active_widget_list) {
del_group(pInfo_Window->private_data.adv_dlg->begin_active_widget_list,
pInfo_Window->private_data.adv_dlg->end_active_widget_list);
}
if (pInfo_Window->private_data.adv_dlg->pScroll) {
hide_scrollbar(pInfo_Window->private_data.adv_dlg->pScroll);
......
}
} else { /* pUnit */
if (pInfo_Window->private_data.adv_dlg->pEndActiveWidgetList) {
del_group(pInfo_Window->private_data.adv_dlg->pBeginActiveWidgetList,
pInfo_Window->private_data.adv_dlg->pEndActiveWidgetList);
if (pInfo_Window->private_data.adv_dlg->end_active_widget_list) {
del_group(pInfo_Window->private_data.adv_dlg->begin_active_widget_list,
pInfo_Window->private_data.adv_dlg->end_active_widget_list);
}
if (pInfo_Window->private_data.adv_dlg->pScroll) {
hide_scrollbar(pInfo_Window->private_data.adv_dlg->pScroll);
client/gui-sdl2/messagewin.c
current_count = pMsg_Dlg->pScroll->count;
if (current_count > 0) {
undraw_group(pMsg_Dlg->pBeginActiveWidgetList, pMsg_Dlg->pEndActiveWidgetList);
del_group_of_widgets_from_gui_list(pMsg_Dlg->pBeginActiveWidgetList,
pMsg_Dlg->pEndActiveWidgetList);
pMsg_Dlg->pBeginActiveWidgetList = NULL;
pMsg_Dlg->pEndActiveWidgetList = NULL;
pMsg_Dlg->pActiveWidgetList = NULL;
undraw_group(pMsg_Dlg->begin_active_widget_list, pMsg_Dlg->end_active_widget_list);
del_group_of_widgets_from_gui_list(pMsg_Dlg->begin_active_widget_list,
pMsg_Dlg->end_active_widget_list);
pMsg_Dlg->begin_active_widget_list = NULL;
pMsg_Dlg->end_active_widget_list = NULL;
pMsg_Dlg->active_widget_list = NULL;
/* hide scrollbar */
hide_scrollbar(pMsg_Dlg->pScroll);
pMsg_Dlg->pScroll->count = 0;
......
create = FALSE;
} else {
add_widget_to_vertical_scroll_widget_list(pMsg_Dlg, pBuf,
pMsg_Dlg->pBeginActiveWidgetList,
pMsg_Dlg->begin_active_widget_list,
FALSE, area.x, area.y);
}
}
......
create = FALSE;
} else {
add_widget_to_vertical_scroll_widget_list(pMsg_Dlg, pBuf,
pMsg_Dlg->pBeginActiveWidgetList,
pMsg_Dlg->begin_active_widget_list,
FALSE, area.x, area.y);
}
}
client/gui-sdl2/optiondlg.c
/* Scrollbar. */
pdialog->advanced = fc_calloc(1, sizeof(*pdialog->advanced));
pdialog->advanced->end_widget_list = pdialog->end_widget_list;
pdialog->advanced->pEndActiveWidgetList = apply_button->prev;
pdialog->advanced->end_active_widget_list = apply_button->prev;
pdialog->advanced->begin_widget_list = widget;
pdialog->advanced->pBeginActiveWidgetList = widget;
pdialog->advanced->begin_active_widget_list = widget;
create_vertical_scrollbar(pdialog->advanced, 2, MAX_SHOWN, TRUE, TRUE);
if (i >= MAX_SHOWN) {
pdialog->advanced->pActiveWidgetList =
pdialog->advanced->pEndActiveWidgetList;
pdialog->advanced->active_widget_list =
pdialog->advanced->end_active_widget_list;
} else {
hide_scrollbar(pdialog->advanced->pScroll);
}
......
pdialog->begin_widget_list = pdialog->advanced->begin_widget_list;
arrange_widgets(window, 2, MAX_SHOWN,
pdialog->advanced->pBeginActiveWidgetList,
pdialog->advanced->begin_active_widget_list,
apply_button, pdialog->core_widget_list,
apply_button, NULL);
......
area.h - adj_size(32), TRUE);
redraw_group(pdialog->begin_widget_list,
pdialog->advanced->pActiveWidgetList, 0);
pdialog->advanced->active_widget_list, 0);
widget_flush(window);
}
......
{
/* Delete. */
struct advanced_dialog *advanced = option_dialog->advanced;
bool scroll = (NULL != advanced->pActiveWidgetList);
bool scroll = (NULL != advanced->active_widget_list);
global_worklist_destroy(pgwl);
del_widget_from_vertical_scroll_widget_list(advanced, widget);
/* Find if there was scrollbar hide. */
if (scroll && advanced->pActiveWidgetList == NULL) {
if (scroll && advanced->active_widget_list == NULL) {
int len = advanced->pScroll->pUp_Left_Button->size.w;
widget = advanced->pEndActiveWidgetList->next;
widget = advanced->end_active_widget_list->next;
do {
widget = widget->prev;
widget->size.w += len;
FREESURFACE(widget->gfx);
} while (widget != advanced->pBeginActiveWidgetList);
} while (widget != advanced->begin_active_widget_list);
}
redraw_group(option_dialog->begin_widget_list,
......
struct widget *window = option_dialog->end_widget_list;
struct global_worklist *pgwl = global_worklist_new(_("empty worklist"));
struct advanced_dialog *advanced = option_dialog->advanced;
bool scroll = advanced->pActiveWidgetList == NULL;
bool scroll = advanced->active_widget_list == NULL;
bool redraw_all = FALSE;
set_wstate(widget, FC_WS_NORMAL);
......
window->area.y + adj_size(17));
/* Find if there was scrollbar shown. */
if (scroll && advanced->pActiveWidgetList != NULL) {
if (scroll && advanced->active_widget_list != NULL) {
int len = advanced->pScroll->pUp_Left_Button->size.w;
window = advanced->pEndActiveWidgetList->next;
window = advanced->end_active_widget_list->next;
do {
window = window->prev;
window->size.w -= len;
window->area.w -= len;
FREESURFACE(window->gfx);
} while (window != advanced->pBeginActiveWidgetList);
} while (window != advanced->begin_active_widget_list);
}
if (redraw_all) {
......
/* Advanced dialog. */
pdialog->advanced = fc_calloc(1, sizeof(*pdialog->advanced));
pdialog->advanced->end_widget_list = pdialog->end_widget_list;
pdialog->advanced->pEndActiveWidgetList =
pdialog->advanced->end_active_widget_list =
pdialog->main_widget_list->prev->prev;
pdialog->advanced->begin_widget_list = widget;
pdialog->advanced->pBeginActiveWidgetList = widget;
pdialog->advanced->begin_active_widget_list = widget;
/* Clear former area. */
area = window->area;
......
area.h - adj_size(32), TRUE);
if (count > 13) {
pdialog->advanced->pActiveWidgetList =
pdialog->advanced->pEndActiveWidgetList;
pdialog->advanced->active_widget_list =
pdialog->advanced->end_active_widget_list;
} else {
hide_scrollbar(pdialog->advanced->pScroll);
scrollbar_width = 0;
......
setup_vertical_widgets_position(1, area.x + adj_size(5),
area.y + adj_size(5),
area.w - adj_size(10) - scrollbar_width, 0,
pdialog->advanced->pBeginActiveWidgetList,
pdialog->advanced->pEndActiveWidgetList);
pdialog->advanced->begin_active_widget_list,
pdialog->advanced->end_active_widget_list);
pdialog->begin_widget_list = pdialog->advanced->begin_widget_list;
client/gui-sdl2/plrdlg.c
}
} players_iterate_end;
pShort_Players_Dlg->begin_widget_list = pBuf;
pShort_Players_Dlg->pBeginActiveWidgetList = pShort_Players_Dlg->begin_widget_list;
pShort_Players_Dlg->pEndActiveWidgetList = pwindow->prev->prev;
pShort_Players_Dlg->pActiveWidgetList = pShort_Players_Dlg->pEndActiveWidgetList;
pShort_Players_Dlg->begin_active_widget_list = pShort_Players_Dlg->begin_widget_list;
pShort_Players_Dlg->end_active_widget_list = pwindow->prev->prev;
pShort_Players_Dlg->active_widget_list = pShort_Players_Dlg->end_active_widget_list;
/* ---------- */
......
/* cities */
pBuf = pBuf->prev;
setup_vertical_widgets_position(1, area.x, area.y, w, 0,
pShort_Players_Dlg->pBeginActiveWidgetList,
pShort_Players_Dlg->begin_active_widget_list,
pBuf);
if (pShort_Players_Dlg->pScroll) {
client/gui-sdl2/repodlgs.c
+ (adj_size(4) * pText1->w + adj_size(46)) + (pText2->w + adj_size(16))
+ (pText5->w + adj_size(6)) + adj_size(2));
if (count > 0) {
pUnitsDlg->pEndActiveWidgetList = pLast->prev;
pUnitsDlg->pBeginActiveWidgetList = pUnitsDlg->begin_widget_list;
pUnitsDlg->end_active_widget_list = pLast->prev;
pUnitsDlg->begin_active_widget_list = pUnitsDlg->begin_widget_list;
if (count > adj_size(80)) {
pUnitsDlg->pActiveWidgetList = pUnitsDlg->pEndActiveWidgetList;
pUnitsDlg->active_widget_list = pUnitsDlg->end_active_widget_list;
if (pUnitsDlg->pScroll) {
pUnitsDlg->pScroll->count = count;
}
......
pBuf->size.y = start_y + (hh - pBuf->size.h) / 2;
start_y += (hh >> 1);
if (pBuf == pUnitsDlg->pBeginActiveWidgetList) {
if (pBuf == pUnitsDlg->begin_active_widget_list) {
break;
}
pBuf = pBuf->prev;
......
get_units_report_data(units, &units_total);
/* find if there are new units entry (if not then rebuild all) */
pwidget = pUnitsDlg->pEndActiveWidgetList; /* icon of first list entry */
pwidget = pUnitsDlg->end_active_widget_list; /* icon of first list entry */
unit_type_iterate(i) {
if ((units[utype_index(i)].active_count > 0)
|| (units[utype_index(i)].building_count > 0)) {
......
break;
}
if (pbuf->prev->prev->prev->prev->prev->prev->prev ==
pUnitsDlg->pBeginActiveWidgetList) {
pUnitsDlg->begin_active_widget_list) {
break;
}
......
} unit_type_iterate_end;
/* update list */
pwidget = pUnitsDlg->pEndActiveWidgetList;
pwidget = pUnitsDlg->end_active_widget_list;
unit_type_iterate(i) {
pbuf = pwidget; /* first widget (icon) of the first list entry */
......
do {
del_widget_from_vertical_scroll_widget_list(pUnitsDlg, pbuf->prev);
} while (((MAX_ID - pbuf->prev->ID) != utype_number(i))
&& (pbuf->prev != pUnitsDlg->pBeginActiveWidgetList));
&& (pbuf->prev != pUnitsDlg->begin_active_widget_list));
if (pbuf->prev == pUnitsDlg->pBeginActiveWidgetList) {
if (pbuf->prev == pUnitsDlg->begin_active_widget_list) {
/* list entry not found - can this really happen? */
del_widget_from_vertical_scroll_widget_list(pUnitsDlg, pbuf->prev);
pwidget = pbuf->prev; /* pUnitsDlg->pBeginActiveWidgetList */
pwidget = pbuf->prev; /* pUnitsDlg->begin_active_widget_list */
search_finished = TRUE;
} else {
/* found it */
......
}
}
} else { /* player has no unit of this type */
if (pbuf && pbuf->next != pUnitsDlg->pBeginActiveWidgetList) {
if (pbuf && pbuf->next != pUnitsDlg->begin_active_widget_list) {
if (utype_number(i) < (MAX_ID - pbuf->ID)) {
continue;
} else {
......
del_widget_from_vertical_scroll_widget_list(pUnitsDlg,
pbuf->prev);
} while (((MAX_ID - pbuf->prev->ID) == utype_number(i))
&& (pbuf->prev != pUnitsDlg->pBeginActiveWidgetList));
if (pbuf->prev == pUnitsDlg->pBeginActiveWidgetList) {
&& (pbuf->prev != pUnitsDlg->begin_active_widget_list));
if (pbuf->prev == pUnitsDlg->begin_active_widget_list) {
del_widget_from_vertical_scroll_widget_list(pUnitsDlg,
pbuf->prev);
}
......
pBuf = pBuf->prev;
set_wstate(pBuf, FC_WS_NORMAL);
set_group_state(pEconomyDlg->pBeginActiveWidgetList,
pEconomyDlg->pEndActiveWidgetList, FC_WS_NORMAL);
if (pEconomyDlg->pScroll && pEconomyDlg->pActiveWidgetList) {
set_group_state(pEconomyDlg->begin_active_widget_list,
pEconomyDlg->end_active_widget_list, FC_WS_NORMAL);
if (pEconomyDlg->pScroll && pEconomyDlg->active_widget_list) {
set_wstate(pEconomyDlg->pScroll->pUp_Left_Button, FC_WS_NORMAL);
set_wstate(pEconomyDlg->pScroll->pDown_Right_Button, FC_WS_NORMAL);
set_wstate(pEconomyDlg->pScroll->pScrollBar, FC_WS_NORMAL);
......
pBuf = pBuf->prev;
set_wstate(pBuf, FC_WS_DISABLED);
set_group_state(pEconomyDlg->pBeginActiveWidgetList,
pEconomyDlg->pEndActiveWidgetList, FC_WS_DISABLED);
if (pEconomyDlg->pScroll && pEconomyDlg->pActiveWidgetList) {
set_group_state(pEconomyDlg->begin_active_widget_list,
pEconomyDlg->end_active_widget_list, FC_WS_DISABLED);
if (pEconomyDlg->pScroll && pEconomyDlg->active_widget_list) {
set_wstate(pEconomyDlg->pScroll->pUp_Left_Button, FC_WS_DISABLED);
set_wstate(pEconomyDlg->pScroll->pDown_Right_Button, FC_WS_DISABLED);
set_wstate(pEconomyDlg->pScroll->pScrollBar, FC_WS_DISABLED);
......
FREEUTF8STR(pstr);
FREESURFACE(background);
pEconomyDlg->pEndActiveWidgetList = pLast->prev;
pEconomyDlg->end_active_widget_list = pLast->prev;
pEconomyDlg->begin_widget_list = pBuf;
pEconomyDlg->pBeginActiveWidgetList = pEconomyDlg->begin_widget_list;
pEconomyDlg->begin_active_widget_list = pEconomyDlg->begin_widget_list;
if (entries_used > (TARGETS_ROW * TARGETS_COL)) {
pEconomyDlg->pActiveWidgetList = pEconomyDlg->pEndActiveWidgetList;
pEconomyDlg->active_widget_list = pEconomyDlg->end_active_widget_list;
count = create_vertical_scrollbar(pEconomyDlg,
TARGETS_COL, TARGETS_ROW, TRUE, TRUE);
h += (TARGETS_ROW * pBuf->size.h + adj_size(10));
......
setup_vertical_widgets_position(TARGETS_COL,
area.x,
area.y + h,
0, 0, pEconomyDlg->pBeginActiveWidgetList,
pEconomyDlg->pEndActiveWidgetList);
0, 0, pEconomyDlg->begin_active_widget_list,
pEconomyDlg->end_active_widget_list);
if (pEconomyDlg->pScroll) {
setup_vertical_scrollbar_area(pEconomyDlg->pScroll,
area.x + area.w - 1,
......
FREEUTF8STR(pstr);
pChangeTechDlg->begin_widget_list = pBuf;
pChangeTechDlg->pBeginActiveWidgetList = pChangeTechDlg->begin_widget_list;
pChangeTechDlg->pEndActiveWidgetList = pChangeTechDlg->end_widget_list->prev->prev;
pChangeTechDlg->begin_active_widget_list = pChangeTechDlg->begin_widget_list;
pChangeTechDlg->end_active_widget_list = pChangeTechDlg->end_widget_list->prev->prev;
/* -------------------------------------------------------------- */
......
if (count > col) {
count = (count + (col - 1)) / col;
if (count > max_row) {
pChangeTechDlg->pActiveWidgetList = pChangeTechDlg->pEndActiveWidgetList;
pChangeTechDlg->active_widget_list = pChangeTechDlg->end_active_widget_list;
count = max_row;
i = create_vertical_scrollbar(pChangeTechDlg, col, count, TRUE, TRUE);
}
......
setup_vertical_widgets_position(col, area.x + 1,
area.y, 0, 0,
pChangeTechDlg->pBeginActiveWidgetList,
pChangeTechDlg->pEndActiveWidgetList);
pChangeTechDlg->begin_active_widget_list,
pChangeTechDlg->end_active_widget_list);
if (pChangeTechDlg->pScroll) {
setup_vertical_scrollbar_area(pChangeTechDlg->pScroll,
......
FREEUTF8STR(pstr);
pChangeTechDlg->begin_widget_list = pBuf;
pChangeTechDlg->pBeginActiveWidgetList = pChangeTechDlg->begin_widget_list;
pChangeTechDlg->pEndActiveWidgetList = pChangeTechDlg->end_widget_list->prev->prev;
pChangeTechDlg->begin_active_widget_list = pChangeTechDlg->begin_widget_list;
pChangeTechDlg->end_active_widget_list = pChangeTechDlg->end_widget_list->prev->prev;
/* -------------------------------------------------------------- */
......
if (count > col) {
count = (count + (col-1)) / col;
if (count > max_row) {
pChangeTechDlg->pActiveWidgetList = pChangeTechDlg->pEndActiveWidgetList;
pChangeTechDlg->active_widget_list = pChangeTechDlg->end_active_widget_list;
count = max_row;
i = create_vertical_scrollbar(pChangeTechDlg, col, count, TRUE, TRUE);
}
......
setup_vertical_widgets_position(col, area.x + 1,
area.y, 0, 0,
pChangeTechDlg->pBeginActiveWidgetList,
pChangeTechDlg->pEndActiveWidgetList);
pChangeTechDlg->begin_active_widget_list,
pChangeTechDlg->end_active_widget_list);
if (pChangeTechDlg->pScroll) {
setup_vertical_scrollbar_area(pChangeTechDlg->pScroll,
client/gui-sdl2/widget.h
struct widget *begin_widget_list;
struct widget *end_widget_list; /* window */
struct widget *pBeginActiveWidgetList;
struct widget *pEndActiveWidgetList;
struct widget *pActiveWidgetList; /* first seen widget */
struct widget *begin_active_widget_list;
struct widget *end_active_widget_list;
struct widget *active_widget_list; /* first seen widget */
struct ScrollBar *pScroll;
};
client/gui-sdl2/widget_scrollbar.c
**************************************************************************/
static int get_position(struct advanced_dialog *pDlg)
{
struct widget *pBuf = pDlg->pActiveWidgetList;
struct widget *pBuf = pDlg->active_widget_list;
int count = pDlg->pScroll->active * pDlg->pScroll->step - 1;
int step = get_step(pDlg->pScroll);
/* find last seen widget */
while (count) {
if (pBuf == pDlg->pBeginActiveWidgetList) {
if (pBuf == pDlg->begin_active_widget_list) {
break;
}
count--;
......
}
count = 0;
if (pBuf != pDlg->pBeginActiveWidgetList) {
if (pBuf != pDlg->begin_active_widget_list) {
do {
count++;
pBuf = pBuf->prev;
} while (pBuf != pDlg->pBeginActiveWidgetList);
} while (pBuf != pDlg->begin_active_widget_list);
}
if (pDlg->pScroll->pScrollBar) {
......
struct advanced_dialog *pDlg = pwidget->private_data.adv_dlg;
struct widget *pBegin = up_scroll_widget_list(
pDlg->pScroll,
pDlg->pActiveWidgetList,
pDlg->pBeginActiveWidgetList,
pDlg->pEndActiveWidgetList);
pDlg->active_widget_list,
pDlg->begin_active_widget_list,
pDlg->end_active_widget_list);
if (pBegin) {
pDlg->pActiveWidgetList = pBegin;
pDlg->active_widget_list = pBegin;
}
unselect_widget_action();
......
struct advanced_dialog *pDlg = pwidget->private_data.adv_dlg;
struct widget *pBegin = down_scroll_widget_list(
pDlg->pScroll,
pDlg->pActiveWidgetList,
pDlg->pBeginActiveWidgetList,
pDlg->pEndActiveWidgetList);
pDlg->active_widget_list,
pDlg->begin_active_widget_list,
pDlg->end_active_widget_list);
if (pBegin) {
pDlg->pActiveWidgetList = pBegin;
pDlg->active_widget_list = pBegin;
}
unselect_widget_action();
......
struct advanced_dialog *pDlg = pScrollBar->private_data.adv_dlg;
struct widget *pBegin = vertic_scroll_widget_list(
pDlg->pScroll,
pDlg->pActiveWidgetList,
pDlg->pBeginActiveWidgetList,
pDlg->pEndActiveWidgetList);
pDlg->active_widget_list,
pDlg->begin_active_widget_list,
pDlg->end_active_widget_list);
if (pBegin) {
pDlg->pActiveWidgetList = pBegin;
pDlg->active_widget_list = pBegin;
}
unselect_widget_action();
......
if (!pDlg->pScroll) {
pDlg->pScroll = fc_calloc(1, sizeof(struct ScrollBar));
pBuf = pDlg->pEndActiveWidgetList;
while (pBuf && (pBuf != pDlg->pBeginActiveWidgetList->prev)) {
pBuf = pDlg->end_active_widget_list;
while (pBuf && (pBuf != pDlg->begin_active_widget_list->prev)) {
pBuf = pBuf->prev;
count++;
}
......
dir :
TRUE - upper add => add_dock->next = new_widget.
FALSE - down add => add_dock->prev = new_widget.
start_x, start_y - positions of first seen widget (pActiveWidgetList).
start_x, start_y - positions of first seen widget (active_widget_list).
pDlg->pScroll ( scrollbar ) must exist.
It isn't full secure to multi widget list.
**************************************************************************/
......
if (pDlg->pScroll->count > (pDlg->pScroll->active * pDlg->pScroll->step)) {
/* -> scrollbar needed */
if (pDlg->pActiveWidgetList) {
if (pDlg->active_widget_list) {
/* -> scrollbar is already visible */
int i = 0;
/* find last active widget */
pOld_End = add_dock;
while (pOld_End != pDlg->pActiveWidgetList) {
while (pOld_End != pDlg->active_widget_list) {
pOld_End = pOld_End->next;
i++;
if (pOld_End == pDlg->pEndActiveWidgetList) {
/* implies (pOld_End == pDlg->pActiveWidgetList)? */
if (pOld_End == pDlg->end_active_widget_list) {
/* implies (pOld_End == pDlg->active_widget_list)? */
seen = FALSE;
break;
}
......
} else {
last = TRUE;
pDlg->pActiveWidgetList = pDlg->pEndActiveWidgetList;
pDlg->active_widget_list = pDlg->end_active_widget_list;
show_scrollbar(pDlg->pScroll);
}
}
......
if (add_dock == pDlg->end_widget_list) {
pDlg->end_widget_list = new_widget;
}
if (add_dock == pDlg->pEndActiveWidgetList) {
pDlg->pEndActiveWidgetList = new_widget;
if (add_dock == pDlg->end_active_widget_list) {
pDlg->end_active_widget_list = new_widget;
}
if (add_dock == pDlg->pActiveWidgetList) {
pDlg->pActiveWidgetList = new_widget;
if (add_dock == pDlg->active_widget_list) {
pDlg->active_widget_list = new_widget;
}
} else {
/* down add */
......
pDlg->begin_widget_list = new_widget;
}
if (add_dock == pDlg->pBeginActiveWidgetList) {
pDlg->pBeginActiveWidgetList = new_widget;
if (add_dock == pDlg->begin_active_widget_list) {
pDlg->begin_active_widget_list = new_widget;
}
}
/* setup draw positions */
if (seen) {
if (!pDlg->pBeginActiveWidgetList) {
if (!pDlg->begin_active_widget_list) {
/* first element ( active list empty ) */
fc_assert_msg(FALSE == dir, "Forbided List Operation");
new_widget->size.x = start_x;
new_widget->size.y = start_y;
pDlg->pBeginActiveWidgetList = new_widget;
pDlg->pEndActiveWidgetList = new_widget;
pDlg->begin_active_widget_list = new_widget;
pDlg->end_active_widget_list = new_widget;
if (!pDlg->begin_widget_list) {
pDlg->begin_widget_list = new_widget;
pDlg->end_widget_list = new_widget;
......
pBuf->gfx = pBuf->next->gfx;
pBuf->next->gfx = NULL;
pBuf = pBuf->next;
} while (pBuf != pDlg->pActiveWidgetList);
} while (pBuf != pDlg->active_widget_list);
pBuf->gfx = NULL;
set_wflag(pBuf, WF_HIDDEN);
pDlg->pActiveWidgetList = pDlg->pActiveWidgetList->prev;
pDlg->active_widget_list = pDlg->active_widget_list->prev;
}
} else { /* !last */
pBuf = new_widget;
/* find last seen widget */
if (pDlg->pActiveWidgetList) {
pEnd = pDlg->pActiveWidgetList;
if (pDlg->active_widget_list) {
pEnd = pDlg->active_widget_list;
count = pDlg->pScroll->active * pDlg->pScroll->step - 1;
while (count && pEnd != pDlg->pBeginActiveWidgetList) {
while (count && pEnd != pDlg->begin_active_widget_list) {
pEnd = pEnd->prev;
count--;
}
}
while (pBuf) {
if (pBuf == pDlg->pBeginActiveWidgetList) {
if (pBuf == pDlg->begin_active_widget_list) {
struct widget *pTmp = pBuf;
count = pDlg->pScroll->step;
......
set_wflag(pOld_End, WF_HIDDEN);
}
} /* !last */
} /* pDlg->pBeginActiveWidgetList */
} /* pDlg->begin_active_widget_list */
} else { /* !seen */
set_wflag(new_widget, WF_HIDDEN);
}
if (pDlg->pActiveWidgetList && pDlg->pScroll->pScrollBar) {
if (pDlg->active_widget_list && pDlg->pScroll->pScrollBar) {
widget_undraw(pDlg->pScroll->pScrollBar);
widget_mark_dirty(pDlg->pScroll->pScrollBar);
......
fc_assert_ret_val(pDlg != NULL, FALSE);
/* if begin == end -> size = 1 */
if (pDlg->pBeginActiveWidgetList == pDlg->pEndActiveWidgetList) {
if (pDlg->begin_active_widget_list == pDlg->end_active_widget_list) {
if (pDlg->pScroll) {
pDlg->pScroll->count = 0;
}
if (pDlg->pBeginActiveWidgetList == pDlg->begin_widget_list) {
if (pDlg->begin_active_widget_list == pDlg->begin_widget_list) {
pDlg->begin_widget_list = pDlg->begin_widget_list->next;
}
if (pDlg->pEndActiveWidgetList == pDlg->end_widget_list) {
if (pDlg->end_active_widget_list == pDlg->end_widget_list) {
pDlg->end_widget_list = pDlg->end_widget_list->prev;
}
pDlg->pBeginActiveWidgetList = NULL;
pDlg->pActiveWidgetList = NULL;
pDlg->pEndActiveWidgetList = NULL;
pDlg->begin_active_widget_list = NULL;
pDlg->active_widget_list = NULL;
pDlg->end_active_widget_list = NULL;
widget_undraw(pwidget);
widget_mark_dirty(pwidget);
......
return FALSE;
}
if (pDlg->pScroll && pDlg->pActiveWidgetList) {
if (pDlg->pScroll && pDlg->active_widget_list) {
/* scrollbar exist and active, start mod. from last seen label */
struct widget *pLast;
bool widget_found = FALSE;
......
count = pDlg->pScroll->active * pDlg->pScroll->step;
/* find last */
pBuf = pDlg->pActiveWidgetList;
pBuf = pDlg->active_widget_list;
while (count > 0) {
pBuf = pBuf->prev;
count--;
}
if (!pBuf) {
pLast = pDlg->pBeginActiveWidgetList;
pLast = pDlg->begin_active_widget_list;
} else {
pLast = pBuf->next;
}
if (pLast == pDlg->pBeginActiveWidgetList) {
if (pLast == pDlg->begin_active_widget_list) {
if (pDlg->pScroll->step == 1) {
pDlg->pActiveWidgetList = pDlg->pActiveWidgetList->next;
clear_wflag(pDlg->pActiveWidgetList, WF_HIDDEN);
pDlg->active_widget_list = pDlg->active_widget_list->next;
clear_wflag(pDlg->active_widget_list, WF_HIDDEN);
/* look for the widget in the non-visible part */
pBuf = pDlg->pEndActiveWidgetList;
while (pBuf != pDlg->pActiveWidgetList) {
pBuf = pDlg->end_active_widget_list;
while (pBuf != pDlg->active_widget_list) {
if (pBuf == pwidget) {
widget_found = TRUE;
pBuf = pDlg->pActiveWidgetList;
pBuf = pDlg->active_widget_list;
break;
}
pBuf = pBuf->prev;
......
if ((pDlg->pScroll->count - 1) <= (pDlg->pScroll->active * pDlg->pScroll->step)) {
/* scrollbar not needed anymore */
hide_scrollbar(pDlg->pScroll);
pDlg->pActiveWidgetList = NULL;
pDlg->active_widget_list = NULL;
}
pDlg->pScroll->count--;
if (pDlg->pActiveWidgetList) {
if (pDlg->active_widget_list) {
if (pDlg->pScroll->pScrollBar) {
widget_undraw(pDlg->pScroll->pScrollBar);
pDlg->pScroll->pScrollBar->size.h = scrollbar_size(pDlg->pScroll);
......
}
} else { /* no scrollbar */
pBuf = pDlg->pBeginActiveWidgetList;
pBuf = pDlg->begin_active_widget_list;
/* undraw last widget */
widget_undraw(pBuf);
......
pDlg->begin_widget_list = pwidget->next;
}
if (pwidget == pDlg->pBeginActiveWidgetList) {
pDlg->pBeginActiveWidgetList = pwidget->next;
if (pwidget == pDlg->begin_active_widget_list) {
pDlg->begin_active_widget_list = pwidget->next;
}
if (pwidget == pDlg->pEndActiveWidgetList) {
if (pwidget == pDlg->end_active_widget_list) {
if (pwidget == pDlg->end_widget_list) {
pDlg->end_widget_list = pwidget->prev;
}
if (pwidget == pDlg->pActiveWidgetList) {
pDlg->pActiveWidgetList = pwidget->prev;
if (pwidget == pDlg->active_widget_list) {
pDlg->active_widget_list = pwidget->prev;
}
pDlg->pEndActiveWidgetList = pwidget->prev;
pDlg->end_active_widget_list = pwidget->prev;
}
if (pDlg->pActiveWidgetList && (pDlg->pActiveWidgetList == pwidget)) {
pDlg->pActiveWidgetList = pwidget->prev;
if (pDlg->active_widget_list && (pDlg->active_widget_list == pwidget)) {
pDlg->active_widget_list = pwidget->prev;
}
del_widget_from_gui_list(pwidget);
if (pDlg->pScroll && pDlg->pScroll->pScrollBar && pDlg->pActiveWidgetList) {
if (pDlg->pScroll && pDlg->pScroll->pScrollBar && pDlg->active_widget_list) {
widget_undraw(pDlg->pScroll->pScrollBar);
pDlg->pScroll->pScrollBar->size.y = get_position(pDlg);
refresh_widget_background(pDlg->pScroll->pScrollBar);
......
pDlg->pScroll->active = active;
pBuf = pDlg->pEndActiveWidgetList;
while (pBuf && pBuf != pDlg->pBeginActiveWidgetList->prev) {
pBuf = pDlg->end_active_widget_list;
while (pBuf && pBuf != pDlg->begin_active_widget_list->prev) {
pBuf = pBuf->prev;
count++;
}
client/gui-sdl2/wldlg.c
pBuf->ID = MAX_ID - cid_encode(prod);
if (pEditor->pWork->pBeginActiveWidgetList) {
dock = pEditor->pWork->pBeginActiveWidgetList;
if (pEditor->pWork->begin_active_widget_list) {
dock = pEditor->pWork->begin_active_widget_list;
} else {
dock = pEditor->dock;
}
......
change_production(&prod);
/* change Production Text Label in Worklist Widget list */
copy_chars_to_utf8_str(pEditor->pWork->pEndActiveWidgetList->string_utf8,
copy_chars_to_utf8_str(pEditor->pWork->end_active_widget_list->string_utf8,
get_production_name(pEditor->pCity, prod, &dummy));
pEditor->pWork->pEndActiveWidgetList->ID = MAX_ID - cid_encode(prod);
pEditor->pWork->end_active_widget_list->ID = MAX_ID - cid_encode(prod);
widget_redraw(pEditor->pWork->pEndActiveWidgetList);
widget_mark_dirty(pEditor->pWork->pEndActiveWidgetList);
widget_redraw(pEditor->pWork->end_active_widget_list);
widget_mark_dirty(pEditor->pWork->end_active_widget_list);
flush_dirty();
}
......
/* correct "data" widget fiels */
struct widget *pBuf = pItem;
if (pBuf != pEditor->pWork->pBeginActiveWidgetList) {
if (pBuf != pEditor->pWork->begin_active_widget_list) {
do {
pBuf = pBuf->prev;
*((int *)pBuf->data.ptr) = *((int *)pBuf->data.ptr) - 1;
} while (pBuf != pEditor->pWork->pBeginActiveWidgetList);
} while (pBuf != pEditor->pWork->begin_active_widget_list);
}
/* remove element from worklist */
......
worklist_advance(&pEditor->worklist_copy);
del_widget_from_vertical_scroll_widget_list(pEditor->pWork, pItem);
FC_FREE(pBuf->data.ptr);
if (pBuf != pEditor->pWork->pBeginActiveWidgetList) {
if (pBuf != pEditor->pWork->begin_active_widget_list) {
do {
pBuf = pBuf->prev;
*((int *)pBuf->data.ptr) = *((int *)pBuf->data.ptr) - 1;
} while (pBuf != pEditor->pWork->pBeginActiveWidgetList);
} while (pBuf != pEditor->pWork->begin_active_widget_list);
}
}
......
bool changed = FALSE;
struct universal tmp;
if (pItem == pEditor->pWork->pBeginActiveWidgetList) {
if (pItem == pEditor->pWork->begin_active_widget_list) {
remove_item_from_worklist(pItem);
return;
}
......
struct universal tmp;
/* first item was clicked -> remove */
if (pItem == pEditor->pWork->pEndActiveWidgetList) {
if (pItem == pEditor->pWork->end_active_widget_list) {
remove_item_from_worklist(pItem);
return;
}
......
static void add_global_worklist(struct widget *pwidget)
{
struct global_worklist *pGWL = global_worklist_by_id(MAX_ID - pwidget->ID);
struct widget *pBuf = pEditor->pWork->pEndActiveWidgetList;
struct widget *pBuf = pEditor->pWork->end_active_widget_list;
const struct worklist *pWorkList;
int count, firstfree;
......
*((int *)pBuf->data.ptr) = firstfree;
add_widget_to_vertical_scroll_widget_list(pEditor->pWork,
pBuf, pEditor->pWork->pBeginActiveWidgetList,
pBuf, pEditor->pWork->begin_active_widget_list,
FALSE,
pEditor->end_widget_list->area.x + adj_size(2),
pEditor->end_widget_list->area.y + adj_size(152));
......
static void set_global_worklist(struct widget *pwidget)
{
struct global_worklist *pGWL = global_worklist_by_id(MAX_ID - pwidget->ID);
struct widget *pBuf = pEditor->pWork->pEndActiveWidgetList;
struct widget *pBuf = pEditor->pWork->end_active_widget_list;
const struct worklist *pWorkList;
struct worklist wl;
int count, wl_count;
......
if (!worklist_is_empty(&wl)) {
/* free old widget list */
if (pBuf != pEditor->pWork->pBeginActiveWidgetList) {
if (pBuf != pEditor->pWork->begin_active_widget_list) {
pBuf = pBuf->prev;
if (pBuf != pEditor->pWork->pBeginActiveWidgetList) {
if (pBuf != pEditor->pWork->begin_active_widget_list) {
do {
pBuf = pBuf->prev;
del_widget_from_vertical_scroll_widget_list(pEditor->pWork, pBuf->next);
} while (pBuf != pEditor->pWork->pBeginActiveWidgetList);
} while (pBuf != pEditor->pWork->begin_active_widget_list);
}
del_widget_from_vertical_scroll_widget_list(pEditor->pWork, pBuf);
}
......
*((int *)pBuf->data.ptr) = count;
add_widget_to_vertical_scroll_widget_list(pEditor->pWork,
pBuf, pEditor->pWork->pBeginActiveWidgetList, FALSE,
pBuf, pEditor->pWork->begin_active_widget_list, FALSE,
pEditor->end_widget_list->area.x + adj_size(2),
pEditor->end_widget_list->area.y + adj_size(152));
}
......
pEditor->pWork->end_widget_list = pBuf;
pEditor->pWork->begin_widget_list = pBuf;
pEditor->pWork->pEndActiveWidgetList = pEditor->pWork->end_widget_list;
pEditor->pWork->pBeginActiveWidgetList = pEditor->pWork->begin_widget_list;
pEditor->pWork->end_active_widget_list = pEditor->pWork->end_widget_list;
pEditor->pWork->begin_active_widget_list = pEditor->pWork->begin_widget_list;
pEditor->pWork->pScroll->count++;
}
......
if (count) {
if (!pCity) {
pEditor->pWork->end_widget_list = pLast->prev;
pEditor->pWork->pEndActiveWidgetList = pEditor->pWork->end_widget_list;
pEditor->pWork->end_active_widget_list = pEditor->pWork->end_widget_list;
}
pEditor->pWork->begin_widget_list = pBuf;
pEditor->pWork->pBeginActiveWidgetList = pEditor->pWork->begin_widget_list;
pEditor->pWork->begin_active_widget_list = pEditor->pWork->begin_widget_list;
} else {
if (!pCity) {
pEditor->pWork->end_widget_list = pLast;
......
/* FIXME */
#if 0
pEditor->pWork->pActiveWidgetList = pEditor->pWork->pEndActiveWidgetList;
pEditor->pWork->active_widget_list = pEditor->pWork->end_active_widget_list;
create_vertical_scrollbar(pEditor->pWork, 1,
pEditor->pWork->pScroll->active, FALSE, TRUE);
pEditor->pWork->pScroll->pUp_Left_Button->size.w = adj_size(122);
......
if (count) {
pEditor->pGlobal = fc_calloc(1, sizeof(struct advanced_dialog));
pEditor->pGlobal->end_widget_list = pLast->prev;
pEditor->pGlobal->pEndActiveWidgetList = pEditor->pGlobal->end_widget_list;
pEditor->pGlobal->end_active_widget_list = pEditor->pGlobal->end_widget_list;
pEditor->pGlobal->begin_widget_list = pBuf;
pEditor->pGlobal->pBeginActiveWidgetList = pEditor->pGlobal->begin_widget_list;
pEditor->pGlobal->begin_active_widget_list = pEditor->pGlobal->begin_widget_list;
if (count > 6) {
pEditor->pGlobal->pActiveWidgetList = pEditor->pGlobal->pEndActiveWidgetList;
pEditor->pGlobal->active_widget_list = pEditor->pGlobal->end_active_widget_list;
create_vertical_scrollbar(pEditor->pGlobal, 1, 4, FALSE, TRUE);
pEditor->pGlobal->pScroll->pUp_Left_Button->size.w = adj_size(122);
......
pEditor->pTargets->end_widget_list = pLast->prev;
pEditor->pTargets->begin_widget_list = pBuf;
pEditor->pTargets->pEndActiveWidgetList = pEditor->pTargets->end_widget_list;
pEditor->pTargets->pBeginActiveWidgetList = pEditor->pTargets->begin_widget_list;
pEditor->pTargets->pActiveWidgetList = pEditor->pTargets->pEndActiveWidgetList;
pEditor->pTargets->end_active_widget_list = pEditor->pTargets->end_widget_list;
pEditor->pTargets->begin_active_widget_list = pEditor->pTargets->begin_widget_list;
pEditor->pTargets->active_widget_list = pEditor->pTargets->end_active_widget_list;
/* --------------- */
if (count > (TARGETS_ROW * TARGETS_COL - 1)) {
    (1-1/1)