File diff r13023:9f6499c8d4fb → r13024:48c81d0b078a
src/road_gui.cpp
Show inline comments
 
@@ -258,25 +258,25 @@ enum RoadToolbarWidgets {
 
	RTW_REMOVE,
 
};
 

	
 
typedef void OnButtonClick(Window *w);
 

	
 

	
 
/** Toogles state of the Remove button of Build road toolbar
 
 * @param w window the button belongs to
 
 */
 
static void ToggleRoadButton_Remove(Window *w)
 
{
 
	w->ToggleWidgetLoweredState(RTW_REMOVE);
 
	w->InvalidateWidget(RTW_REMOVE);
 
	w->SetWidgetDirty(RTW_REMOVE);
 
	_remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE);
 
	SetSelectionRed(_remove_button_clicked);
 
}
 

	
 
/** Updates the Remove button because of Ctrl state change
 
 * @param w window the button belongs to
 
 * @return true iff the remove buton was changed
 
 */
 
static bool RoadToolbar_CtrlChanged(Window *w)
 
{
 
	if (w->IsWidgetDisabled(RTW_REMOVE)) return false;
 

	
 
@@ -438,30 +438,30 @@ struct BuildRoadToolbarWindow : Window {
 
	 * Update the remove button lowered state of the road toolbar
 
	 *
 
	 * @param clicked_widget The widget which the client clicked just now
 
	 */
 
	void UpdateOptionWidgetStatus(RoadToolbarWidgets clicked_widget)
 
	{
 
		/* The remove and the one way button state is driven
 
		 * by the other buttons so they don't act on themselfs.
 
		 * Both are only valid if they are able to apply as options. */
 
		switch (clicked_widget) {
 
			case RTW_REMOVE:
 
				this->RaiseWidget(RTW_ONE_WAY);
 
				this->InvalidateWidget(RTW_ONE_WAY);
 
				this->SetWidgetDirty(RTW_ONE_WAY);
 
				break;
 

	
 
			case RTW_ONE_WAY:
 
				this->RaiseWidget(RTW_REMOVE);
 
				this->InvalidateWidget(RTW_REMOVE);
 
				this->SetWidgetDirty(RTW_REMOVE);
 
				break;
 

	
 
			case RTW_BUS_STATION:
 
			case RTW_TRUCK_STATION:
 
				this->DisableWidget(RTW_ONE_WAY);
 
				this->SetWidgetDisabledState(RTW_REMOVE, !this->IsWidgetLowered(clicked_widget));
 
				break;
 

	
 
			case RTW_ROAD_X:
 
			case RTW_ROAD_Y:
 
			case RTW_AUTOROAD:
 
				this->SetWidgetsDisabledState(!this->IsWidgetLowered(clicked_widget),
 
@@ -524,26 +524,26 @@ struct BuildRoadToolbarWindow : Window {
 
		_remove_button_clicked = this->IsWidgetLowered(RTW_REMOVE);
 
		_one_way_button_clicked = this->IsWidgetLowered(RTW_ONE_WAY);
 
		_place_proc(tile);
 
	}
 

	
 
	virtual void OnPlaceObjectAbort()
 
	{
 
		this->RaiseButtons();
 
		this->SetWidgetsDisabledState(true,
 
			RTW_REMOVE,
 
			RTW_ONE_WAY,
 
			WIDGET_LIST_END);
 
		this->InvalidateWidget(RTW_REMOVE);
 
		this->InvalidateWidget(RTW_ONE_WAY);
 
		this->SetWidgetDirty(RTW_REMOVE);
 
		this->SetWidgetDirty(RTW_ONE_WAY);
 

	
 
		DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
 
		DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
 
		DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
 
		DeleteWindowById(WC_SELECT_STATION, 0);
 
		DeleteWindowByClass(WC_BUILD_BRIDGE);
 
	}
 

	
 
	virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
 
	{
 
		/* Here we update the end tile flags
 
		 * of the road placement actions.