379 switch (e->we.click.widget) { |
379 switch (e->we.click.widget) { |
380 case 3: { // listbox |
380 case 3: { // listbox |
381 int y = e->we.click.pt.y - w->widget[3].top; |
381 int y = e->we.click.pt.y - w->widget[3].top; |
382 if (y >= 0) { |
382 if (y >= 0) { |
383 WP(w, refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos; |
383 WP(w, refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos; |
384 SetWindowDirty(w); |
384 w->SetDirty(); |
385 } |
385 } |
386 } break; |
386 } break; |
387 case 6: // refit button |
387 case 6: // refit button |
388 if (WP(w, refit_d).cargo != NULL) { |
388 if (WP(w, refit_d).cargo != NULL) { |
389 const Vehicle *v = GetVehicle(w->window_number); |
389 const Vehicle *v = GetVehicle(w->window_number); |
739 Window *w = FindWindowById(WC_VEHICLE_VIEW, from_index); |
739 Window *w = FindWindowById(WC_VEHICLE_VIEW, from_index); |
740 |
740 |
741 if (w != NULL) { |
741 if (w != NULL) { |
742 w->window_number = to_index; |
742 w->window_number = to_index; |
743 WP(w, vp_d).follow_vehicle = to_index; |
743 WP(w, vp_d).follow_vehicle = to_index; |
744 SetWindowDirty(w); |
744 w->SetDirty(); |
745 |
745 |
746 w = FindWindowById(WC_VEHICLE_ORDERS, from_index); |
746 w = FindWindowById(WC_VEHICLE_ORDERS, from_index); |
747 if (w != NULL) { |
747 if (w != NULL) { |
748 w->window_number = to_index; |
748 w->window_number = to_index; |
749 SetWindowDirty(w); |
749 w->SetDirty(); |
750 } |
750 } |
751 |
751 |
752 w = FindWindowById(WC_VEHICLE_REFIT, from_index); |
752 w = FindWindowById(WC_VEHICLE_REFIT, from_index); |
753 if (w != NULL) { |
753 if (w != NULL) { |
754 w->window_number = to_index; |
754 w->window_number = to_index; |
755 SetWindowDirty(w); |
755 w->SetDirty(); |
756 } |
756 } |
757 |
757 |
758 w = FindWindowById(WC_VEHICLE_DETAILS, from_index); |
758 w = FindWindowById(WC_VEHICLE_DETAILS, from_index); |
759 if (w != NULL) { |
759 if (w != NULL) { |
760 w->window_number = to_index; |
760 w->window_number = to_index; |
761 SetWindowDirty(w); |
761 w->SetDirty(); |
762 } |
762 } |
763 |
763 |
764 w = FindWindowById(WC_VEHICLE_TIMETABLE, from_index); |
764 w = FindWindowById(WC_VEHICLE_TIMETABLE, from_index); |
765 if (w != NULL) { |
765 if (w != NULL) { |
766 w->window_number = to_index; |
766 w->window_number = to_index; |
767 SetWindowDirty(w); |
767 w->SetDirty(); |
768 } |
768 } |
769 } |
769 } |
770 } |
770 } |
771 |
771 |
772 enum VehicleListWindowWidgets { |
772 enum VehicleListWindowWidgets { |
1080 case VLW_WIDGET_SORT_ORDER: /* Flip sorting method ascending/descending */ |
1080 case VLW_WIDGET_SORT_ORDER: /* Flip sorting method ascending/descending */ |
1081 vl->l.flags ^= VL_DESC; |
1081 vl->l.flags ^= VL_DESC; |
1082 vl->l.flags |= VL_RESORT; |
1082 vl->l.flags |= VL_RESORT; |
1083 |
1083 |
1084 vl->_sorting->order = !!(vl->l.flags & VL_DESC); |
1084 vl->_sorting->order = !!(vl->l.flags & VL_DESC); |
1085 SetWindowDirty(w); |
1085 w->SetDirty(); |
1086 break; |
1086 break; |
1087 case VLW_WIDGET_SORT_BY_PULLDOWN:/* Select sorting criteria dropdown menu */ |
1087 case VLW_WIDGET_SORT_BY_PULLDOWN:/* Select sorting criteria dropdown menu */ |
1088 ShowDropDownMenu(w, _vehicle_sort_listing, vl->l.sort_type, VLW_WIDGET_SORT_BY_PULLDOWN, 0, (vl->vehicle_type == VEH_TRAIN || vl->vehicle_type == VEH_ROAD) ? 0 : (1 << 10)); |
1088 ShowDropDownMenu(w, _vehicle_sort_listing, vl->l.sort_type, VLW_WIDGET_SORT_BY_PULLDOWN, 0, (vl->vehicle_type == VEH_TRAIN || vl->vehicle_type == VEH_ROAD) ? 0 : (1 << 10)); |
1089 return; |
1089 return; |
1090 case VLW_WIDGET_LIST: { /* Matrix to show vehicles */ |
1090 case VLW_WIDGET_LIST: { /* Matrix to show vehicles */ |
1183 PlayerID owner = (PlayerID)w->caption_color; |
1183 PlayerID owner = (PlayerID)w->caption_color; |
1184 |
1184 |
1185 DEBUG(misc, 3, "Periodic resort %d list player %d at station %d", vl->vehicle_type, owner, station); |
1185 DEBUG(misc, 3, "Periodic resort %d list player %d at station %d", vl->vehicle_type, owner, station); |
1186 vl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; |
1186 vl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; |
1187 vl->l.flags |= VL_RESORT; |
1187 vl->l.flags |= VL_RESORT; |
1188 SetWindowDirty(w); |
1188 w->SetDirty(); |
1189 } |
1189 } |
1190 break; |
1190 break; |
1191 |
1191 |
1192 case WE_RESIZE: /* Update the scroll + matrix */ |
1192 case WE_RESIZE: /* Update the scroll + matrix */ |
1193 w->vscroll.cap += e->we.sizing.diff.y / (int)w->resize.step_height; |
1193 w->vscroll.cap += e->we.sizing.diff.y / (int)w->resize.step_height; |
2166 w->SetWidgetHiddenState(VVW_WIDGET_CLONE_VEH, !veh_stopped); // clone |
2166 w->SetWidgetHiddenState(VVW_WIDGET_CLONE_VEH, !veh_stopped); // clone |
2167 if (v->type == VEH_ROAD || v->type == VEH_TRAIN) { |
2167 if (v->type == VEH_ROAD || v->type == VEH_TRAIN) { |
2168 w->SetWidgetHiddenState( VVW_WIDGET_REFIT_VEH, !veh_stopped); // refit |
2168 w->SetWidgetHiddenState( VVW_WIDGET_REFIT_VEH, !veh_stopped); // refit |
2169 w->SetWidgetHiddenState(VVW_WIDGET_TURN_AROUND, veh_stopped); // force turn around |
2169 w->SetWidgetHiddenState(VVW_WIDGET_TURN_AROUND, veh_stopped); // force turn around |
2170 } |
2170 } |
2171 SetWindowDirty(w); |
2171 w->SetDirty(); |
2172 } |
2172 } |
2173 } break; |
2173 } break; |
2174 } |
2174 } |
2175 } |
2175 } |
2176 |
2176 |