|
@@ -761,13 +761,14 @@ restart_search:
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Delete all windows of a company. We identify windows of a company
|
|
|
* by looking at the caption colour. If it is equal to the company ID
|
|
|
* then we say the window belongs to the company and should be deleted
|
|
|
* @param id company identifier */
|
|
|
* @param id company identifier
|
|
|
*/
|
|
|
void DeleteCompanyWindows(CompanyID id)
|
|
|
{
|
|
|
Window *w;
|
|
|
|
|
|
restart_search:
|
|
|
/* When we find the window to delete, we need to restart the search
|
|
@@ -786,13 +787,14 @@ restart_search:
|
|
|
|
|
|
/**
|
|
|
* Change the owner of all the windows one company can take over from another
|
|
|
* company in the case of a company merger. Do not change ownership of windows
|
|
|
* that need to be deleted once takeover is complete
|
|
|
* @param old_owner original owner of the window
|
|
|
* @param new_owner the new owner of the window */
|
|
|
* @param new_owner the new owner of the window
|
|
|
*/
|
|
|
void ChangeWindowOwner(Owner old_owner, Owner new_owner)
|
|
|
{
|
|
|
Window *w;
|
|
|
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
|
|
if (w->owner != old_owner) continue;
|
|
|
|
|
@@ -819,13 +821,14 @@ static void BringWindowToFront(Window *w
|
|
|
|
|
|
/**
|
|
|
* Find a window and make it the top-window on the screen.
|
|
|
* The window gets unshaded if it was shaded, and a white border is drawn at its edges for a brief period of time to visualize its "activation".
|
|
|
* @param cls WindowClass of the window to activate
|
|
|
* @param number WindowNumber of the window to activate
|
|
|
* @return a pointer to the window thus activated */
|
|
|
* @return a pointer to the window thus activated
|
|
|
*/
|
|
|
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number)
|
|
|
{
|
|
|
Window *w = FindWindowById(cls, number);
|
|
|
|
|
|
if (w != NULL) {
|
|
|
if (w->IsShaded()) w->SetShaded(false); // Restore original window size if it was shaded.
|
|
@@ -1319,13 +1322,14 @@ Window::Window() : hscroll(false), vscro
|
|
|
|
|
|
/**
|
|
|
* Do a search for a window at specific coordinates. For this we start
|
|
|
* at the topmost window, obviously and work our way down to the bottom
|
|
|
* @param x position x to query
|
|
|
* @param y position y to query
|
|
|
* @return a pointer to the found window if any, NULL otherwise */
|
|
|
* @return a pointer to the found window if any, NULL otherwise
|
|
|
*/
|
|
|
Window *FindWindowFromPt(int x, int y)
|
|
|
{
|
|
|
Window *w;
|
|
|
FOR_ALL_WINDOWS_FROM_FRONT(w) {
|
|
|
if (IsInsideBS(x, w->left, w->width) && IsInsideBS(y, w->top, w->height)) {
|
|
|
return w;
|
|
@@ -1929,13 +1933,14 @@ static EventState HandleViewportScroll()
|
|
|
* it. If a window does not obscure any other windows, it will not
|
|
|
* be brought to the foreground. Also if the only obscuring windows
|
|
|
* are so-called system-windows, the window will not be moved.
|
|
|
* The function will return false when a child window of this window is a
|
|
|
* modal-popup; function returns a false and child window gets a white border
|
|
|
* @param w Window to bring on-top
|
|
|
* @return false if the window has an active modal child, true otherwise */
|
|
|
* @return false if the window has an active modal child, true otherwise
|
|
|
*/
|
|
|
static bool MaybeBringWindowToFront(Window *w)
|
|
|
{
|
|
|
bool bring_to_front = false;
|
|
|
|
|
|
if (w->window_class == WC_MAIN_WINDOW ||
|
|
|
IsVitalWindow(w) ||
|
|
@@ -2561,13 +2566,14 @@ restart_search:
|
|
|
|
|
|
/**
|
|
|
* It is possible that a stickied window gets to a position where the
|
|
|
* 'close' button is outside the gaming area. You cannot close it then; except
|
|
|
* with this function. It closes all windows calling the standard function,
|
|
|
* then, does a little hacked loop of closing all stickied windows. Note
|
|
|
* that standard windows (status bar, etc.) are not stickied, so these aren't affected */
|
|
|
* that standard windows (status bar, etc.) are not stickied, so these aren't affected
|
|
|
*/
|
|
|
void DeleteAllNonVitalWindows()
|
|
|
{
|
|
|
Window *w;
|
|
|
|
|
|
/* Delete every window except for stickied ones, then sticky ones as well */
|
|
|
DeleteNonVitalWindows();
|