equal
deleted
inserted
replaced
1215 int x = _cursor.pos.x + _drag_delta.x; |
1215 int x = _cursor.pos.x + _drag_delta.x; |
1216 int y = _cursor.pos.y + _drag_delta.y; |
1216 int y = _cursor.pos.y + _drag_delta.y; |
1217 int nx = x; |
1217 int nx = x; |
1218 int ny = y; |
1218 int ny = y; |
1219 |
1219 |
1220 if (_patches.window_snap_radius != 0) { |
1220 if (_settings.gui.window_snap_radius != 0) { |
1221 Window* const *vz; |
1221 Window* const *vz; |
1222 |
1222 |
1223 int hsnap = _patches.window_snap_radius; |
1223 int hsnap = _settings.gui.window_snap_radius; |
1224 int vsnap = _patches.window_snap_radius; |
1224 int vsnap = _settings.gui.window_snap_radius; |
1225 int delta; |
1225 int delta; |
1226 |
1226 |
1227 FOR_ALL_WINDOWS(vz) { |
1227 FOR_ALL_WINDOWS(vz) { |
1228 const Window *v = *vz; |
1228 const Window *v = *vz; |
1229 |
1229 |
1465 return false; |
1465 return false; |
1466 } |
1466 } |
1467 |
1467 |
1468 static bool HandleViewportScroll() |
1468 static bool HandleViewportScroll() |
1469 { |
1469 { |
1470 bool scrollwheel_scrolling = _patches.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); |
1470 bool scrollwheel_scrolling = _settings.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); |
1471 |
1471 |
1472 if (!_scrolling_viewport) return true; |
1472 if (!_scrolling_viewport) return true; |
1473 |
1473 |
1474 Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y); |
1474 Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y); |
1475 |
1475 |
1485 ScrollMainWindowTo(veh->x_pos, veh->y_pos, true); /* This also resets follow_vehicle */ |
1485 ScrollMainWindowTo(veh->x_pos, veh->y_pos, true); /* This also resets follow_vehicle */ |
1486 return true; |
1486 return true; |
1487 } |
1487 } |
1488 |
1488 |
1489 Point delta; |
1489 Point delta; |
1490 if (_patches.reverse_scroll) { |
1490 if (_settings.gui.reverse_scroll) { |
1491 delta.x = -_cursor.delta.x; |
1491 delta.x = -_cursor.delta.x; |
1492 delta.y = -_cursor.delta.y; |
1492 delta.y = -_cursor.delta.y; |
1493 } else { |
1493 } else { |
1494 delta.x = _cursor.delta.x; |
1494 delta.x = _cursor.delta.x; |
1495 delta.y = _cursor.delta.y; |
1495 delta.y = _cursor.delta.y; |
1665 _input_events_this_tick = 0; |
1665 _input_events_this_tick = 0; |
1666 /* there were some inputs this tick, don't scroll ??? */ |
1666 /* there were some inputs this tick, don't scroll ??? */ |
1667 return; |
1667 return; |
1668 } |
1668 } |
1669 |
1669 |
1670 if (_patches.autoscroll && _game_mode != GM_MENU && !IsGeneratingWorld()) { |
1670 if (_settings.gui.autoscroll && _game_mode != GM_MENU && !IsGeneratingWorld()) { |
1671 int x = _cursor.pos.x; |
1671 int x = _cursor.pos.x; |
1672 int y = _cursor.pos.y; |
1672 int y = _cursor.pos.y; |
1673 Window *w = FindWindowFromPt(x, y); |
1673 Window *w = FindWindowFromPt(x, y); |
1674 if (w == NULL || w->flags4 & WF_DISABLE_VP_SCROLL) return; |
1674 if (w == NULL || w->flags4 & WF_DISABLE_VP_SCROLL) return; |
1675 ViewPort *vp = IsPtInWindowViewport(w, x, y); |
1675 ViewPort *vp = IsPtInWindowViewport(w, x, y); |
1717 if (!HandleWindowDragging()) return; |
1717 if (!HandleWindowDragging()) return; |
1718 if (!HandleScrollbarScrolling()) return; |
1718 if (!HandleScrollbarScrolling()) return; |
1719 if (!HandleViewportScroll()) return; |
1719 if (!HandleViewportScroll()) return; |
1720 if (!HandleMouseOver()) return; |
1720 if (!HandleMouseOver()) return; |
1721 |
1721 |
1722 bool scrollwheel_scrolling = _patches.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); |
1722 bool scrollwheel_scrolling = _settings.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); |
1723 if (click == MC_NONE && mousewheel == 0 && !scrollwheel_scrolling) return; |
1723 if (click == MC_NONE && mousewheel == 0 && !scrollwheel_scrolling) return; |
1724 |
1724 |
1725 int x = _cursor.pos.x; |
1725 int x = _cursor.pos.x; |
1726 int y = _cursor.pos.y; |
1726 int y = _cursor.pos.y; |
1727 Window *w = FindWindowFromPt(x, y); |
1727 Window *w = FindWindowFromPt(x, y); |
1732 |
1732 |
1733 /* Don't allow any action in a viewport if either in menu of in generating world */ |
1733 /* Don't allow any action in a viewport if either in menu of in generating world */ |
1734 if (vp != NULL && (_game_mode == GM_MENU || IsGeneratingWorld())) return; |
1734 if (vp != NULL && (_game_mode == GM_MENU || IsGeneratingWorld())) return; |
1735 |
1735 |
1736 if (mousewheel != 0) { |
1736 if (mousewheel != 0) { |
1737 if (_patches.scrollwheel_scrolling == 0) { |
1737 if (_settings.gui.scrollwheel_scrolling == 0) { |
1738 /* Send mousewheel event to window */ |
1738 /* Send mousewheel event to window */ |
1739 w->OnMouseWheel(mousewheel); |
1739 w->OnMouseWheel(mousewheel); |
1740 } |
1740 } |
1741 |
1741 |
1742 /* Dispatch a MouseWheelEvent for widgets if it is not a viewport */ |
1742 /* Dispatch a MouseWheelEvent for widgets if it is not a viewport */ |
2057 |
2057 |
2058 if (w == NULL || w->window_class != WC_MAIN_TOOLBAR) { |
2058 if (w == NULL || w->window_class != WC_MAIN_TOOLBAR) { |
2059 w = FindWindowById(WC_MAIN_TOOLBAR, 0); |
2059 w = FindWindowById(WC_MAIN_TOOLBAR, 0); |
2060 } |
2060 } |
2061 |
2061 |
2062 switch (_patches.toolbar_pos) { |
2062 switch (_settings.gui.toolbar_pos) { |
2063 case 1: w->left = (_screen.width - w->width) / 2; break; |
2063 case 1: w->left = (_screen.width - w->width) / 2; break; |
2064 case 2: w->left = _screen.width - w->width; break; |
2064 case 2: w->left = _screen.width - w->width; break; |
2065 default: w->left = 0; |
2065 default: w->left = 0; |
2066 } |
2066 } |
2067 SetDirtyBlocks(0, 0, _screen.width, w->height); // invalidate the whole top part |
2067 SetDirtyBlocks(0, 0, _screen.width, w->height); // invalidate the whole top part |