| 1556 | } |
| 1557 | |
| 1558 | void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override |
| 1559 | { |
| 1560 | switch (widget) { |
| 1561 | case WID_BS_SEMAPHORE_NORM: |
| 1562 | case WID_BS_SEMAPHORE_ENTRY: |
| 1563 | case WID_BS_SEMAPHORE_EXIT: |
| 1564 | case WID_BS_SEMAPHORE_COMBO: |
| 1565 | case WID_BS_SEMAPHORE_PBS: |
| 1566 | case WID_BS_SEMAPHORE_PBS_OWAY: |
| 1567 | case WID_BS_ELECTRIC_NORM: |
| 1568 | case WID_BS_ELECTRIC_ENTRY: |
| 1569 | case WID_BS_ELECTRIC_EXIT: |
| 1570 | case WID_BS_ELECTRIC_COMBO: |
| 1571 | case WID_BS_ELECTRIC_PBS: |
| 1572 | case WID_BS_ELECTRIC_PBS_OWAY: |
| 1573 | this->RaiseWidget((_cur_signal_variant == SIG_ELECTRIC ? WID_BS_ELECTRIC_NORM : WID_BS_SEMAPHORE_NORM) + _cur_signal_type); |
| 1574 | |
| 1575 | _cur_signal_type = (SignalType)((uint)((widget - WID_BS_SEMAPHORE_NORM) % (SIGTYPE_LAST + 1))); |
| 1576 | _cur_signal_variant = widget >= WID_BS_ELECTRIC_NORM ? SIG_ELECTRIC : SIG_SEMAPHORE; |
| 1577 | |
| 1578 | /* Update default (last-used) signal type in config file. */ |
| 1579 | _settings_client.gui.default_signal_type = _cur_signal_type; |
| 1580 | |
| 1581 | /* If 'remove' button of rail build toolbar is active, disable it. */ |
| 1582 | if (_remove_button_clicked) { |
| 1583 | Window *w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); |
| 1584 | if (w != nullptr) ToggleRailButton_Remove(w); |
| 1585 | } |
| 1586 | |
| 1587 | SndClickBeep(); |
| 1588 | break; |
| 1589 | |
| 1590 | case WID_BS_CONVERT: |
| 1591 | _convert_signal_button = !_convert_signal_button; |
| 1592 | SndClickBeep(); |
| 1593 | break; |
| 1594 | |
| 1595 | case WID_BS_DRAG_SIGNALS_DENSITY_DECREASE: |
| 1596 | if (_settings_client.gui.drag_signals_density > 1) { |
| 1597 | _settings_client.gui.drag_signals_density--; |
| 1598 | SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_SETTINGS); |
| 1599 | } |
| 1600 | break; |
| 1601 | |
| 1602 | case WID_BS_DRAG_SIGNALS_DENSITY_INCREASE: |
| 1603 | if (_settings_client.gui.drag_signals_density < 20) { |
| 1604 | _settings_client.gui.drag_signals_density++; |
| 1605 | SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_SETTINGS); |
| 1606 | } |
| 1607 | break; |
| 1608 | |
| 1609 | default: break; |
| 1610 | } |
| 1611 | |
| 1612 | this->InvalidateData(); |
| 1613 | } |
| 1614 | |
| 1615 | /** |
nothing calls this directly
no test coverage detected