File diff r16430:b3f65f9bc976 → r16431:ec558deca9d7
src/window.cpp
Show inline comments
 
@@ -570,13 +570,13 @@ void Window::ReInit(int rx, int ry)
 
	int window_width  = this->width;
 
	int window_height = this->height;
 

	
 
	this->OnInit();
 
	/* Re-initialize the window from the ground up. No need to change the nested_array, as all widgets stay where they are. */
 
	this->nested_root->SetupSmallestSize(this, false);
 
	this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _dynlang.text_dir == TD_RTL);
 
	this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _current_text_dir == TD_RTL);
 
	this->width  = this->nested_root->smallest_x;
 
	this->height = this->nested_root->smallest_y;
 
	this->resize.step_width  = this->nested_root->resize_x;
 
	this->resize.step_height = this->nested_root->resize_y;
 

	
 
	/* Resize as close to the original size + requested resize as possible. */
 
@@ -904,13 +904,13 @@ void Window::InitializeData(const Window
 
		this->nested_array = CallocT<NWidgetBase *>(this->nested_array_size);
 
		this->nested_root->SetupSmallestSize(this, true);
 
	} else {
 
		this->nested_root->SetupSmallestSize(this, false);
 
	}
 
	/* Initialize to smallest size. */
 
	this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _dynlang.text_dir == TD_RTL);
 
	this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _current_text_dir == TD_RTL);
 

	
 
	/* Further set up window properties,
 
	 * this->left, this->top, this->width, this->height, this->resize.width, and this->resize.height are initialized later. */
 
	this->resize.step_width  = this->nested_root->resize_x;
 
	this->resize.step_height = this->nested_root->resize_y;
 

	
 
@@ -1183,13 +1183,13 @@ restart:
 
 * @return Coordinate of the top-left corner of the new window.
 
 */
 
Point GetToolbarAlignedWindowPosition(int window_width)
 
{
 
	const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
 
	assert(w != NULL);
 
	Point pt = { _dynlang.text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width, w->top + w->height };
 
	Point pt = { _current_text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width, w->top + w->height };
 
	return pt;
 
}
 

	
 
/**
 
 * Compute the position of the top-left corner of a new window that is opened.
 
 *
 
@@ -1591,13 +1591,13 @@ void ResizeWindow(Window *w, int delta_x
 

	
 
		uint new_xinc = max(0, (w->nested_root->resize_x == 0) ? 0 : (int)(w->nested_root->current_x - w->nested_root->smallest_x) + delta_x);
 
		uint new_yinc = max(0, (w->nested_root->resize_y == 0) ? 0 : (int)(w->nested_root->current_y - w->nested_root->smallest_y) + delta_y);
 
		assert(w->nested_root->resize_x == 0 || new_xinc % w->nested_root->resize_x == 0);
 
		assert(w->nested_root->resize_y == 0 || new_yinc % w->nested_root->resize_y == 0);
 

	
 
		w->nested_root->AssignSizePosition(ST_RESIZE, 0, 0, w->nested_root->smallest_x + new_xinc, w->nested_root->smallest_y + new_yinc, _dynlang.text_dir == TD_RTL);
 
		w->nested_root->AssignSizePosition(ST_RESIZE, 0, 0, w->nested_root->smallest_x + new_xinc, w->nested_root->smallest_y + new_yinc, _current_text_dir == TD_RTL);
 
		w->width  = w->nested_root->current_x;
 
		w->height = w->nested_root->current_y;
 
	}
 

	
 
	EnsureVisibleCaption(w, w->left, w->top);
 

	
 
@@ -1858,13 +1858,13 @@ static EventState HandleScrollbarScrolli
 
			int i;
 
			NWidgetScrollbar *sb = w->GetWidget<NWidgetScrollbar>(w->scrolling_scrollbar);
 
			bool rtl = false;
 

	
 
			if (sb->type == NWID_HSCROLLBAR) {
 
				i = _cursor.pos.x - _cursorpos_drag_start.x;
 
				rtl = _dynlang.text_dir == TD_RTL;
 
				rtl = _current_text_dir == TD_RTL;
 
			} else {
 
				i = _cursor.pos.y - _cursorpos_drag_start.y;
 
			}
 

	
 
			if (sb->disp_flags & ND_SCROLLBAR_BTN) {
 
				if (_scroller_click_timeout == 1) {