Add Ctrl+Click to scroll to plan.

This commit is contained in:
Jonathan G Rennison
2017-03-31 14:12:25 +01:00
parent a3d21411e7
commit f3ed6765a5
3 changed files with 45 additions and 1 deletions

View File

@@ -139,6 +139,18 @@ struct PlansWindow : Window {
break;
case WID_PLN_LIST: {
int new_selected = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_PLN_LIST, WD_FRAMERECT_TOP);
if (_ctrl_pressed) {
if (new_selected != INT_MAX) {
TileIndex t;
if (this->list[new_selected].is_plan) {
t = Plan::Get(this->list[new_selected].plan_id)->CalculateCentreTile();
} else {
t = Plan::Get(this->list[new_selected].plan_id)->lines[this->list[new_selected].line_id]->CalculateCentreTile();
}
if (t != INVALID_TILE) ScrollMainWindowToTile(t);
}
return;
}
if (this->selected != INT_MAX) {
_current_plan->SetFocus(false);
}