Changeset - r25966:8233c136b1b0
[Not reviewed]
master
0 2 0
Bernard Teo - 3 years ago 2021-05-31 07:59:17
btzy1996@hotmail.com
Feature: Ctrl-Clicking GB_SHARED_ORDERS vehicle list opens order window
2 files changed with 19 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/group_gui.cpp
Show inline comments
 
@@ -15,24 +15,25 @@
 
#include "string_func.h"
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 
#include "autoreplace_gui.h"
 
#include "company_func.h"
 
#include "widgets/dropdown_func.h"
 
#include "tilehighlight_func.h"
 
#include "vehicle_gui_base.h"
 
#include "core/geometry_func.hpp"
 
#include "company_base.h"
 
#include "company_gui.h"
 
#include "gui.h"
 

	
 
#include "widgets/group_widget.h"
 

	
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
static const int LEVEL_WIDTH = 10; ///< Indenting width of a sub-group in pixels
 

	
 
typedef GUIList<const Group*> GUIGroupList;
 

	
 
static const NWidgetPart _nested_group_widgets[] = {
 
@@ -736,35 +737,37 @@ public:
 
						v = vehgroup.vehicles_begin[0];
 
						/*
 
						 * No VehicleClicked(v) support for now, because don't want
 
						 * to enable any contextual actions except perhaps clicking/ctrl-clicking to clone orders.
 
						 */
 
						break;
 
					}
 

	
 
					default:
 
						NOT_REACHED();
 
				}
 
				if (v) {
 
					this->vehicle_sel = v->index;
 

	
 
					if (_ctrl_pressed) {
 
						this->SelectGroup(v->group_id);
 
						if (this->grouping == GB_NONE) {
 
							this->SelectGroup(v->group_id);
 
						} else {
 
							ShowOrdersWindow(v);
 
						}
 
					} else {
 
						this->vehicle_sel = v->index;
 
						SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
 
						SetMouseCursorVehicle(v, EIT_IN_LIST);
 
						_cursor.vehchain = true;
 
						this->SetDirty();
 
					}
 

	
 
					SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
 
					SetMouseCursorVehicle(v, EIT_IN_LIST);
 
					_cursor.vehchain = true;
 

	
 
					this->SetDirty();
 
				}
 

	
 
				break;
 
			}
 

	
 
			case WID_GL_CREATE_GROUP: { // Create a new group
 
				DoCommandP(0, this->vli.vtype, this->vli.index, CMD_CREATE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_CREATE), CcCreateGroup);
 
				break;
 
			}
 

	
 
			case WID_GL_DELETE_GROUP: { // Delete the selected group
 
				this->group_confirm = this->vli.index;
src/vehicle_gui.cpp
Show inline comments
 
@@ -1834,28 +1834,32 @@ public:
 
							} else {
 
								ShowVehicleViewWindow(v);
 
							}
 
						}
 
						break;
 
					}
 

	
 
					case GB_SHARED_ORDERS: {
 
						assert(vehgroup.NumVehicles() > 0);
 
						const Vehicle *v = vehgroup.vehicles_begin[0];
 
						/* We do not support VehicleClicked() here since the contextual action may only make sense for individual vehicles */
 

	
 
						if (vehgroup.NumVehicles() == 1) {
 
							ShowVehicleViewWindow(v);
 
						if (_ctrl_pressed) {
 
							ShowOrdersWindow(v);
 
						} else {
 
							ShowVehicleListWindow(v);
 
							if (vehgroup.NumVehicles() == 1) {
 
								ShowVehicleViewWindow(v);
 
							} else {
 
								ShowVehicleListWindow(v);
 
							}
 
						}
 
						break;
 
					}
 

	
 
					default: NOT_REACHED();
 
				}
 

	
 
				break;
 
			}
 

	
 
			case WID_VL_AVAILABLE_VEHICLES:
 
				ShowBuildVehicleWindow(INVALID_TILE, this->vli.vtype);
0 comments (0 inline, 0 general)