Changeset - r9693:d4033b0d7a90
[Not reviewed]
master
0 1 0
smatz - 16 years ago 2008-07-23 15:01:50
smatz@openttd.org
(svn r13800) -Codechange: minor comment style fixes in misc_gui.cpp
1 file changed with 11 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/misc_gui.cpp
Show inline comments
 
@@ -421,13 +421,13 @@ public:
 
		SwitchToNormalRefStack();
 

	
 
		int h = 15 + h1 + h2;
 
		height = max<int>(height, h);
 

	
 
		if (msg1 == INVALID_STRING_ID) {
 
			// only 1 line will be printed
 
			/* only 1 line will be printed */
 
			y[1] = (height - 15) / 2 + 15 - 5;
 
		} else {
 
			int over = (height - h) / 4;
 

	
 
			y[1] = 15 + h2 / 2 + 1 - 5 + over;
 
			y[0] = height - 3 - h1 / 2 - 5 - over;
 
@@ -515,16 +515,16 @@ void ShowErrorMessage(StringID msg_1, St
 
		}
 
		new ErrmsgWindow(pt, 240, 46, msg_1, msg_2, _errmsg_widgets, false);
 
	} else {
 
		if ((x | y) != 0) {
 
			pt = RemapCoords2(x, y);
 
			vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport;
 
			pt.x = Clamp(UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left - (334/2), 0, _screen.width - 334);
 
			pt.y = Clamp(UnScaleByZoom(pt.y - vp->virtual_top, vp->zoom) + vp->top - (137/2), 22, _screen.height - 137);
 
			pt.x = Clamp(UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left - (334 / 2),  0, _screen.width  - 334);
 
			pt.y = Clamp(UnScaleByZoom(pt.y - vp->virtual_top,  vp->zoom) + vp->top  - (137 / 2), 22, _screen.height - 137);
 
		} else {
 
			pt.x = (_screen.width - 334) >> 1;
 
			pt.x = (_screen.width  - 334) >> 1;
 
			pt.y = (_screen.height - 137) >> 1;
 
		}
 
		new ErrmsgWindow(pt, 334, 137, msg_1, msg_2, _errmsg_face_widgets, true);
 
	}
 
}
 

	
 
@@ -1047,13 +1047,13 @@ struct QueryStringWindow : public QueryS
 
	}
 

	
 
	void OnOk()
 
	{
 
		if (this->orig == NULL || strcmp(this->text.buf, this->orig) != 0) {
 
			/* If the parent is NULL, the editbox is handled by general function
 
				* HandleOnEditText */
 
			 * HandleOnEditText */
 
			if (this->parent != NULL) {
 
				this->parent->OnQueryTextFinished(this->text.buf);
 
			} else {
 
				HandleOnEditText(this->text.buf);
 
			}
 
			this->handled = true;
 
@@ -1181,13 +1181,13 @@ struct QueryWindow : public Window {
 
		if (parent == NULL) parent = FindWindowById(WC_MAIN_WINDOW, 0);
 
		this->parent = parent;
 
		this->left = parent->left + (parent->width / 2) - (this->width / 2);
 
		this->top = parent->top + (parent->height / 2) - (this->height / 2);
 

	
 
		/* Create a backup of the variadic arguments to strings because it will be
 
		* overridden pretty often. We will copy these back for drawing */
 
		 * overridden pretty often. We will copy these back for drawing */
 
		CopyOutDParam(this->params, 0, lengthof(this->params));
 
		this->widget[QUERY_WIDGET_CAPTION].data = caption;
 
		this->message    = message;
 
		this->proc       = callback;
 

	
 
		this->FindWindowPlacementAndResize(desc);
 
@@ -1269,13 +1269,14 @@ static const WindowDesc _query_desc = {
 
 * The window is aligned to the centre of its parent.
 
 * NOTE: You cannot use BindCString as parameter for this window!
 
 * @param caption string shown as window caption
 
 * @param message string that will be shown for the window
 
 * @param parent pointer to parent window, if this pointer is NULL the parent becomes
 
 * the main window WC_MAIN_WINDOW
 
 * @param callback callback function pointer to set in the window descriptor*/
 
 * @param callback callback function pointer to set in the window descriptor
 
 */
 
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback)
 
{
 
	new QueryWindow(&_query_desc, caption, message, parent, callback);
 
}
 

	
 

	
 
@@ -1379,13 +1380,13 @@ extern void StartupEngines();
 
struct SaveLoadWindow : public QueryStringBaseWindow {
 
	FiosItem o_dir;
 

	
 
	void GenerateFileName()
 
	{
 
		/* Check if we are not a spectator who wants to generate a name..
 
				Let's use the name of player #0 for now. */
 
		 * Let's use the name of player #0 for now. */
 
		const Player *p = GetPlayer(IsValidPlayerID(_local_player) ? _local_player : PLAYER_FIRST);
 

	
 
		SetDParam(0, p->index);
 
		SetDParam(1, _date);
 
		GetString(this->edit_str_buf, STR_4004, lastof(this->edit_str_buf));
 
		SanitizeFilename(this->edit_str_buf);
 
@@ -1418,13 +1419,13 @@ struct SaveLoadWindow : public QueryStri
 
		this->LowerWidget(7);
 

	
 
		this->afilter = CS_ALPHANUMERAL;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 240);
 

	
 
		/* pause is only used in single-player, non-editor mode, non-menu mode. It
 
		* will be unpaused in the WE_DESTROY event handler. */
 
		 * will be unpaused in the WE_DESTROY event handler. */
 
		if (_game_mode != GM_MENU && !_networking && _game_mode != GM_EDITOR) {
 
			if (_pause_game >= 0) DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
 
		}
 

	
 
		BuildFileList();
 

	
 
@@ -1590,13 +1591,13 @@ struct SaveLoadWindow : public QueryStri
 
		return state;
 
	}
 

	
 
	virtual void OnTimeout()
 
	{
 
		/* This test protects against using widgets 11 and 12 which are only available
 
		 * in those two saveload mode  */
 
		 * in those two saveload mode */
 
		if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) return;
 

	
 
		if (this->IsWidgetLowered(11)) { // Delete button clicked
 
			if (!FiosDelete(this->text.buf)) {
 
				ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0);
 
			} else {
0 comments (0 inline, 0 general)