#1028 closed enhancement (fixed)
[PATCH] UI Enhancement: Right Click selection removal
Reported by: | michael | Owned by: | kingadami |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 13 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
Currently, when multiple units are selected, the player can remove a unit (or group of like units) from the selection by ctrl+left clicking the icon portrait of that unit in the selection UI (center panel).
An enhancement here would be to also allow removal of units from the selection via simply right-clicking their icons in the center panel (no Ctrl key necessary). This does not replace the ctrl-left click, but adds a redundant method. Currently right-clicking icons in the center panel does nothing.
This is a GUI enhancement only/does not effect ctrl-clicking behavior in the game world.
Attachments (2)
Change History (31)
comment:1 by , 12 years ago
Type: | defect → enhancement |
---|
comment:2 by , 12 years ago
Description: | modified (diff) |
---|
comment:3 by , 12 years ago
Keywords: | simple added |
---|
comment:4 by , 12 years ago
Priority: | Nice to Have → If Time Permits |
---|
comment:5 by , 12 years ago
Component: | Game engine → Simulation |
---|
comment:6 by , 12 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
follow-up: 12 comment:7 by , 12 years ago
Keywords: | review added |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Summary: | UI Enhancement: Right Click selection removal → [PATCH]UI Enhancement: Right Click selection removal |
First time coding C++, although I reused the code from left-clicks... pretty exciting to have gotten something done!
follow-up: 10 comment:8 by , 12 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:9 by , 12 years ago
Status: | reopened → new |
---|
comment:10 by , 12 years ago
Replying to gerbilOFdoom:
Why you discharge your solution? Are not good?
comment:11 by , 12 years ago
Oh, I accidentally closed it before it was reviewed and applied. In order for it to show up in the review query, it has to be new, so I reset it to new. When it's applied, it should be closed by whoever applies it.
comment:12 by , 12 years ago
Keywords: | review removed |
---|---|
Summary: | [PATCH]UI Enhancement: Right Click selection removal → [PATCH] UI Enhancement: Right Click selection removal |
Replying to gerbilOFdoom:
First time coding C++, although I reused the code from left-clicks... pretty exciting to have gotten something done!
Thanks, sorry it's taken a while to review :) Your patch seems to work well, I do have a few suggestions:
changePrimarySelectionGroup
ininput.js
: it probably shouldn't have a parameter calledrightPressed
, because generally the function doesn't care about the mouse state, we only want to indicate what type of action should be performed. I think it would be more appropriate to call it something likedeselectGroup
. Then inunit_commands.js
when the button callbacks are set up, you can still passtrue
for right button presses (because no matter whether the hotkey was used or not, it's a deselect action) and then pass theEngine.HotkeyIsPressed(...)
for the other press event callback.- Right-click-press now toggles checkboxes and radio buttons, which is unusual behavior for GUIs, and it could lead to undesired behavior in future GUI objects if they handle the
GUIM_PRESSED
event expecting only left clicks. So I think you should add e.g.GUIM_PRESSED_MOUSE_RIGHT
enums toEGUIMessageType
inGUIbase.h
, because they should be handled separately than the current press and double press events. (At first I was thinking we would need to likewise refactor the left-click-press events, but it may be possible in the future for buttons to be pressed in response to keystrokes, which would have no logical difference from a standard left-click-press, so it seems best to leave them for now.) - It's nothing introduced by your script, but the
switch
blocks inIGUIButtonBehavior.cpp
are unconventional in that thebreak
statements for eachcase
are on the same line as the closing "}
" bracket. This is a good chance to correct that by moving each of them onto a new line. - I think the added comment in
IGUIButtonBehavior.h
should either go before the end of the line (inside the period) or just be removed, it looks strange hanging at the end. - Usually we update the copyright date at the top of C++ source files when modifying them, though inconsistently.
comment:13 by , 12 years ago
Milestone: | Alpha 9 → Alpha 10 |
---|---|
Priority: | If Time Permits → Nice to Have |
comment:14 by , 12 years ago
Cc: | added |
---|---|
Keywords: | patch added |
Hey gerbilOFdoom. Any progress with implementing historic_bruno's suggestions? Keep to have this in Alpha 10 if we can.
comment:15 by , 12 years ago
Keywords: | ui added; UI simple removed |
---|---|
Priority: | Nice to Have → Should Have |
comment:16 by , 12 years ago
Sorry, forgot to do anything about his suggestions. I'll hop on it soon, once I wrap up my current web development ticket!
comment:17 by , 12 years ago
Keywords: | ui removed |
---|
comment:18 by , 12 years ago
Milestone: | Alpha 10 → Alpha 11 |
---|
comment:20 by , 12 years ago
Milestone: | Alpha 11 → Backlog |
---|
comment:21 by , 11 years ago
Cc: | removed |
---|---|
Owner: | removed |
I haven't fixed up the patch yet, not sure if I ever will. Removing myself from this so someone else can pick up where I left off.
comment:22 by , 11 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:23 by , 11 years ago
Keywords: | review added |
---|
comment:24 by , 11 years ago
Milestone: | Backlog → Alpha 13 |
---|
comment:25 by , 11 years ago
Thanks for picking up this patch. Generally it looks ok, a few comments.
guiName == "Selection" should be guiName == SELECTION
Engine.HotkeyIsPressed("selection.remove") should not be used, the hotkey is session.deselectgroup and this is already checked for in changePrimarySelectionGroup.
Also it would be better if you copy what has been done for research, so leave line 535 untouched and then add an if (guiName == SELECTION) {} block afterwards which sets onpress and onrightpress correctly for the selection case. This is so that you are not passing an unexpected boolean to all of the other callbacks.
by , 11 years ago
Attachment: | 0adTicket_1028.patch added |
---|
Implemented quantumstate's suggestions. Thanks for the input. Picking up this patch is introducing me to the code without being overwelmed (along with making me learn javascript).
comment:26 by , 11 years ago
Updated patch file with quantumstate's suggestions. Thanks for the input.
comment:28 by , 11 years ago
Keywords: | review removed |
---|
This is pretty nice to use, thanks for the joint effort on the patch. And of course it also makes things easier for other right click actions we might want to add.
Working on it... just give me some time.