|
@@ -435,29 +435,25 @@ struct RefitWindow : public Window {
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnDoubleClick(Point pt, int widget)
|
|
|
{
|
|
|
if (widget == VRW_MATRIX) this->OnClick(pt, VRW_REFITBUTTON);
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
switch (widget) {
|
|
|
case VRW_MATRIX: { // listbox
|
|
|
int y = pt.y - this->GetWidget<NWidgetBase>(VRW_MATRIX)->pos_y;
|
|
|
if (y >= 0) {
|
|
|
this->sel = (y / (int)this->resize.step_height) + this->vscroll.GetPosition();
|
|
|
this->SetDirty();
|
|
|
}
|
|
|
break;
|
|
|
/* FIXME We need to call some InvalidateData to make this->cargo valid */
|
|
|
if (click_count == 1) break;
|
|
|
}
|
|
|
|
|
|
/* FALL THROUGH */
|
|
|
case VRW_REFITBUTTON: // refit button
|
|
|
if (this->cargo != NULL) {
|
|
|
const Vehicle *v = Vehicle::Get(this->window_number);
|
|
|
|
|
|
if (this->order == INVALID_VEH_ORDER_ID) {
|
|
|
if (DoCommandP(v->tile, v->index, this->cargo->cargo | this->cargo->subtype << 8, GetCmdRefitVeh(v))) delete this;
|
|
@@ -1113,13 +1109,13 @@ public:
|
|
|
/* Set text of sort by dropdown widget. */
|
|
|
this->GetWidget<NWidgetCore>(VLW_WIDGET_SORT_BY_PULLDOWN)->widget_data = this->vehicle_sorter_names[this->vehicles.SortType()];
|
|
|
|
|
|
this->DrawWidgets();
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
switch (widget) {
|
|
|
case VLW_WIDGET_SORT_ORDER: // Flip sorting method ascending/descending
|
|
|
this->vehicles.ToggleSortOrder();
|
|
|
this->SetDirty();
|
|
|
break;
|
|
@@ -1608,13 +1604,13 @@ struct VehicleDetailsWindow : Window {
|
|
|
VLD_WIDGET_DECREASE_SERVICING_INTERVAL,
|
|
|
WIDGET_LIST_END);
|
|
|
|
|
|
this->DrawWidgets();
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
switch (widget) {
|
|
|
case VLD_WIDGET_RENAME_VEHICLE: { // rename
|
|
|
const Vehicle *v = Vehicle::Get(this->window_number);
|
|
|
SetDParam(0, v->index);
|
|
|
ShowQueryString(STR_VEHICLE_NAME, STR_QUERY_RENAME_TRAIN_CAPTION + v->type,
|
|
@@ -2038,13 +2034,13 @@ public:
|
|
|
|
|
|
/* draw the flag plus orders */
|
|
|
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP);
|
|
|
DrawString(r.left + WD_FRAMERECT_LEFT + 6, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_CENTER);
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
const Vehicle *v = Vehicle::Get(this->window_number);
|
|
|
|
|
|
switch (widget) {
|
|
|
case VVW_WIDGET_START_STOP_VEH: // start stop
|
|
|
DoCommandP(v->tile, v->index, 0,
|