Changeset - r13158:008df0730a98
[Not reviewed]
master
0 6 0
rubidium - 15 years ago 2009-09-30 21:00:35
rubidium@openttd.org
(svn r17673) -Codechange: make InvalidateThisWindowData a function of the window class
6 files changed with 18 insertions and 22 deletions:
0 comments (0 inline, 0 general)
src/main_gui.cpp
Show inline comments
 
@@ -166,9 +166,8 @@ bool DoZoomInOutWindow(int how, Window *
 
		vp->virtual_left = w->viewport->scrollpos_x;
 
		vp->virtual_top = w->viewport->scrollpos_y;
 
	}
 
	w->SetDirty();
 
	/* Update the windows that have zoom-buttons to perhaps disable their buttons */
 
	InvalidateThisWindowData(w);
 
	w->InvalidateData();
 
	return true;
 
}
 

	
src/newgrf_gui.cpp
Show inline comments
 
@@ -344,7 +344,7 @@ public:
 
					this->sel = NULL;
 
					this->sel_pos = -1;
 
				}
 
				InvalidateThisWindowData(this, 1);
 
				this->InvalidateData(1);
 
				break;
 
			}
 

	
 
@@ -379,7 +379,7 @@ public:
 

	
 
			case ANGRFW_RESCAN: // Rescan list
 
				ScanNewGRFFiles();
 
				InvalidateThisWindowData(this, 0);
 
				this->InvalidateData();
 
				break;
 
		}
 
	}
 
@@ -437,8 +437,7 @@ public:
 
			this->sel = this->grfs[this->sel_pos];
 

	
 
			this->ScrollToSelected();
 

	
 
			InvalidateThisWindowData(this, 1);
 
			this->InvalidateData(1);
 
		}
 

	
 
		return ES_HANDLED;
 
@@ -448,7 +447,7 @@ public:
 
	{
 
		this->grfs.SetFilterState(!StrEmpty(this->edit_str_buf));
 
		this->grfs.ForceRebuild();
 
		InvalidateThisWindowData(this, 1);
 
		this->InvalidateData(1);
 
	}
 
};
 

	
src/vehicle_gui.cpp
Show inline comments
 
@@ -663,7 +663,7 @@ static inline void ChangeVehicleWindow(W
 
	if (w != NULL) {
 
		w->window_number = to_index;
 
		if (w->viewport != NULL) w->viewport->follow_vehicle = to_index;
 
		if (to_index != INVALID_VEHICLE) InvalidateThisWindowData(w, 0);
 
		if (to_index != INVALID_VEHICLE) w->InvalidateData();
 
	}
 
}
 

	
src/window.cpp
Show inline comments
 
@@ -2477,17 +2477,6 @@ void SetWindowClassesDirty(WindowClass c
 
}
 

	
 
/**
 
 * Mark window data as invalid (in need of re-computing)
 
 * @param w Window with invalid data
 
 * @param data The data to invalidate with
 
 */
 
void InvalidateThisWindowData(Window *w, int data)
 
{
 
	w->OnInvalidateData(data);
 
	w->SetDirty();
 
}
 

	
 
/**
 
 * Mark window data of the window of a given class and specific window number as invalid (in need of re-computing)
 
 * @param cls Window class
 
 * @param number Window number within the class
 
@@ -2497,7 +2486,7 @@ void InvalidateWindowData(WindowClass cl
 
{
 
	Window *w;
 
	FOR_ALL_WINDOWS_FROM_BACK(w) {
 
		if (w->window_class == cls && w->window_number == number) InvalidateThisWindowData(w, data);
 
		if (w->window_class == cls && w->window_number == number) w->InvalidateData(data);
 
	}
 
}
 

	
 
@@ -2511,7 +2500,7 @@ void InvalidateWindowClassesData(WindowC
 
	Window *w;
 

	
 
	FOR_ALL_WINDOWS_FROM_BACK(w) {
 
		if (w->window_class == cls) InvalidateThisWindowData(w, data);
 
		if (w->window_class == cls) w->InvalidateData(data);
 
	}
 
}
 

	
src/window_func.h
Show inline comments
 
@@ -27,7 +27,6 @@ void ResetWindowSystem();
 
void SetupColoursAndInitialWindow();
 
void InputLoop();
 

	
 
void InvalidateThisWindowData(Window *w, int data = 0);
 
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data = 0);
 
void InvalidateWindowClassesData(WindowClass cls, int data = 0);
 

	
src/window_gui.h
Show inline comments
 
@@ -634,6 +634,16 @@ public:
 
	void SetDirty() const;
 
	void ReInit();
 

	
 
	/**
 
	 * Mark this window's data as invalid (in need of re-computing)
 
	 * @param data The data to invalidate with
 
	 */
 
	void InvalidateData(int data = 0)
 
	{
 
		this->SetDirty();
 
		this->OnInvalidateData(data);
 
	}
 

	
 
	/*** Event handling ***/
 

	
 
	/**
0 comments (0 inline, 0 general)