| 74 | } |
| 75 | |
| 76 | void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override |
| 77 | { |
| 78 | switch (widget) { |
| 79 | case WID_EV_ZOOM_IN: DoZoomInOutWindow(ZOOM_IN, this); break; |
| 80 | case WID_EV_ZOOM_OUT: DoZoomInOutWindow(ZOOM_OUT, this); break; |
| 81 | |
| 82 | case WID_EV_MAIN_TO_VIEW: { // location button (move main view to same spot as this view) 'Paste Location' |
| 83 | Window *w = GetMainWindow(); |
| 84 | int x = this->viewport->scrollpos_x; // Where is the main looking at |
| 85 | int y = this->viewport->scrollpos_y; |
| 86 | |
| 87 | /* set this view to same location. Based on the center, adjusting for zoom */ |
| 88 | w->viewport->dest_scrollpos_x = x - (w->viewport->virtual_width - this->viewport->virtual_width) / 2; |
| 89 | w->viewport->dest_scrollpos_y = y - (w->viewport->virtual_height - this->viewport->virtual_height) / 2; |
| 90 | w->viewport->follow_vehicle = VehicleID::Invalid(); |
| 91 | break; |
| 92 | } |
| 93 | |
| 94 | case WID_EV_VIEW_TO_MAIN: { // inverse location button (move this view to same spot as main view) 'Copy Location' |
| 95 | const Window *w = GetMainWindow(); |
| 96 | int x = w->viewport->scrollpos_x; |
| 97 | int y = w->viewport->scrollpos_y; |
| 98 | |
| 99 | this->viewport->dest_scrollpos_x = x + (w->viewport->virtual_width - this->viewport->virtual_width) / 2; |
| 100 | this->viewport->dest_scrollpos_y = y + (w->viewport->virtual_height - this->viewport->virtual_height) / 2; |
| 101 | break; |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | void OnResize() override |
| 107 | { |
nothing calls this directly
no test coverage detected