Hide all windows when selecting vehicle destination station
This commit is contained in:
@@ -587,6 +587,9 @@ private:
|
||||
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, goto_place_style[type - 1], this);
|
||||
this->goto_type = type;
|
||||
this->SetWidgetDirty(WID_O_GOTO);
|
||||
if (type == OPOS_GOTO) {
|
||||
MoveAllWindowsOffScreen();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2995,6 +2995,7 @@ void ResetObjectToPlace()
|
||||
_last_selected_window_number = _thd.window_number;
|
||||
}
|
||||
SetObjectToPlace(SPR_CURSOR_MOUSE, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
|
||||
MoveAllHiddenWindowsBackToScreen();
|
||||
}
|
||||
|
||||
void ToolbarSelectLastTool()
|
||||
|
||||
@@ -2921,6 +2921,7 @@ static void MouseLoop(MouseClick click, int mousewheel)
|
||||
case MC_LEFT_UP:
|
||||
if (!_left_button_dragged && mouse_down_on_viewport) {
|
||||
HandleViewportMouseUp(vp, x, y);
|
||||
MoveAllHiddenWindowsBackToScreen();
|
||||
}
|
||||
_left_button_dragged = false;
|
||||
mouse_down_on_viewport = false;
|
||||
@@ -3599,6 +3600,64 @@ void RelocateAllWindows(int neww, int newh)
|
||||
}
|
||||
}
|
||||
|
||||
static void MoveAllWindowsOffScreen(bool moveOffScreen)
|
||||
{
|
||||
Window *w;
|
||||
bool updateScreen = false;
|
||||
|
||||
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
||||
switch (w->window_class) {
|
||||
case WC_MAIN_WINDOW:
|
||||
case WC_BOOTSTRAP:
|
||||
case WC_MAIN_TOOLBAR:
|
||||
case WC_MAIN_TOOLBAR_RIGHT:
|
||||
case WC_NEWS_WINDOW:
|
||||
case WC_STATUS_BAR:
|
||||
case WC_SEND_NETWORK_MSG:
|
||||
case WC_CONSOLE:
|
||||
continue;
|
||||
|
||||
default:
|
||||
if (moveOffScreen) {
|
||||
if (w->left < _screen.width) {
|
||||
w->left += _screen.width;
|
||||
if (w->viewport != NULL) {
|
||||
w->viewport->left += _screen.width;
|
||||
}
|
||||
//w->SetDirty();
|
||||
updateScreen = true;
|
||||
}
|
||||
} else {
|
||||
if (w->left >= _screen.width) {
|
||||
w->left -= _screen.width;
|
||||
if (w->viewport != NULL) {
|
||||
w->viewport->left -= _screen.width;
|
||||
}
|
||||
w->SetDirty();
|
||||
//updateScreen = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (updateScreen) {
|
||||
w = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||
if (w) {
|
||||
w->SetDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MoveAllWindowsOffScreen()
|
||||
{
|
||||
MoveAllWindowsOffScreen(true);
|
||||
}
|
||||
|
||||
void MoveAllHiddenWindowsBackToScreen()
|
||||
{
|
||||
MoveAllWindowsOffScreen(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor of the base class PickerWindowBase
|
||||
* Main utility is to stop the base Window destructor from triggering
|
||||
|
||||
@@ -865,6 +865,8 @@ Wcls *AllocateWindowDescFront(WindowDesc *desc, int window_number)
|
||||
}
|
||||
|
||||
void RelocateAllWindows(int neww, int newh);
|
||||
void MoveAllWindowsOffScreen();
|
||||
void MoveAllHiddenWindowsBackToScreen();
|
||||
|
||||
/* misc_gui.cpp */
|
||||
enum TooltipCloseCondition {
|
||||
|
||||
Reference in New Issue
Block a user