/**************************************************************** Remove the preset selected in the preset list. *****************************************************************/ static void remove_preset_yes(Widget w, XtPointer row, XtPointer call_data) { cmafec_preset_remove(XTPOINTER_TO_INT(row)); update_cma_preset_list(); destroy_message_dialog(w); }
/************************************************************************** User requested closing of pillage dialog. **************************************************************************/ static void pillage_callback(Widget w, XtPointer client_data, XtPointer call_data) { if (!is_showing_pillage_dialog) { destroy_message_dialog (w); return; } if (client_data) { struct unit *punit = game_unit_by_number(unit_to_use_to_pillage); if (punit) { struct act_tgt target; int what = XTPOINTER_TO_INT(client_data); if (what >= S_LAST + game.control.num_base_types) { target.type = ATT_ROAD; target.obj.road = what - S_LAST - game.control.num_base_types; } else if (what >= S_LAST) { target.type = ATT_BASE; target.obj.base = what - S_LAST; } else { target.type = ATT_SPECIAL; target.obj.spe = what; } request_new_unit_activity_targeted(punit, ACTIVITY_PILLAGE, &target); } } destroy_message_dialog (w); is_showing_pillage_dialog = FALSE; }
/************************************************************************** ... **************************************************************************/ void rates_scroll_scroll_callback(Widget w, XtPointer client_data, XtPointer position_val) { int val, pos = XTPOINTER_TO_INT(position_val); if(w==rates_tax_scroll) { if(pos<0) val=MAX(rates_tax_value-10, 0); else val=MIN(rates_tax_value+10, 100); rates_set_values(val,0, rates_lux_value,0, rates_sci_value,0); } else if(w==rates_lux_scroll) { if(pos<0) val=MAX(rates_lux_value-10, 0); else val=MIN(rates_lux_value+10, 100); rates_set_values(rates_tax_value,0, val,0, rates_sci_value,0); } else { if(pos<0) val=MAX(rates_sci_value-10, 0); else val=MIN(rates_sci_value+10, 100); rates_set_values(rates_tax_value,0, rates_lux_value,0, val,0); } }
/************************************************************************** ... **************************************************************************/ void races_toggles_callback(Widget w, XtPointer client_data, XtPointer call_data) { int index = XTPOINTER_TO_INT(client_data); struct nation_type *race = races_toggles_to_nations[index]; int j; Widget entry; if(races_leader_pick_popupmenu) XtDestroyWidget(races_leader_pick_popupmenu); races_leader_pick_popupmenu = XtVaCreatePopupShell("menu", simpleMenuWidgetClass, races_leader_pick_menubutton, NULL); local_nation_count = nation_count(); j = 0; nation_leader_list_iterate(nation_leaders(race), pleader) { entry = XtVaCreateManagedWidget(nation_leader_name(pleader), smeBSBObjectClass, races_leader_pick_popupmenu, NULL); XtAddCallback(entry, XtNcallback, races_leader_pick_callback, INT_TO_XTPOINTER(local_nation_count * j + nation_index(race))); j++; } nation_leader_list_iterate_end;
/************************************************************************** ... **************************************************************************/ void scrollbar_scroll_callback(Widget w, XtPointer client_data, XtPointer position_val) { int position = XTPOINTER_TO_INT(position_val); int scroll_x, scroll_y, xstep, ystep; get_mapview_scroll_pos(&scroll_x, &scroll_y); get_mapview_scroll_step(&xstep, &ystep); if (!can_client_change_view()) { return; } if(w==map_horizontal_scrollbar) { if (position > 0) { scroll_x += xstep; } else { scroll_x -= xstep; } } else { if (position > 0) { scroll_y += ystep; } else { scroll_y -= ystep; } } set_mapview_scroll_pos(scroll_x, scroll_y); update_map_canvas_scrollbars(); }