Ticket #1028: 0adTicket_1028.patch
File 0adTicket_1028.patch, 4.6 KB (added by , 11 years ago) |
---|
-
binaries/data/mods/public/gui/session/input.js
1659 1659 } 1660 1660 1661 1661 // Called by unit selection buttons 1662 function changePrimarySelectionGroup(templateName )1662 function changePrimarySelectionGroup(templateName, deselectGroup) 1663 1663 { 1664 if (Engine.HotkeyIsPressed("session.deselectgroup") )1664 if (Engine.HotkeyIsPressed("session.deselectgroup") || deselectGroup) 1665 1665 g_Selection.makePrimarySelection(templateName, true); 1666 1666 else 1667 1667 g_Selection.makePrimarySelection(templateName, false); -
binaries/data/mods/public/gui/session/unit_commands.js
533 533 // Button Function (need nested functions to get the closure right) 534 534 // Items can have a callback element that overrides the normal caller-supplied callback function. 535 535 button.onpress = (function(e){ return function() { e.callback ? e.callback(e) : callback(e) } })(item); 536 537 if(guiName == SELECTION) 538 { 539 button.onpressright = (function(e){return function() {callback(e, true) } })(item); 540 button.onpress = (function(e){ return function() {callback(e, false) } })(item); 541 } 536 542 537 543 if (guiName == RESEARCH) 538 544 { … … 973 979 974 980 if (selection.length > 1) 975 981 setupUnitPanel(SELECTION, usedPanels, entState, playerState, g_Selection.groups.getTemplateNames(), 976 function (entType ) { changePrimarySelectionGroup(entType); } );982 function (entType, rightPressed) { changePrimarySelectionGroup(entType, rightPressed); } ); 977 983 978 984 var commands = getEntityCommandsList(entState); 979 985 if (commands.length) -
source/gui/IGUIButtonBehavior.h
115 115 // Notify the gui that we aren't hovered anymore 116 116 UpdateMouseOver(NULL); 117 117 m_Pressed = false; 118 m_PressedRight = false; 118 119 } 119 120 120 121 /** … … 125 126 * this lets us know we are done with step one (clicking). 126 127 */ 127 128 bool m_Pressed; 129 bool m_PressedRight; 128 130 }; 129 131 130 132 #endif -
source/gui/IGUIButtonBehavior.cpp
1 /* Copyright (C) 20 09Wildfire Games.1 /* Copyright (C) 2012 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 48 48 break; 49 49 50 50 m_Pressed = true; 51 } break; 51 } 52 break; 52 53 54 case GUIM_MOUSE_DBLCLICK_RIGHT: 55 case GUIM_MOUSE_RELEASE_RIGHT: 56 { 57 bool enabled; 58 GUI<bool>::GetSetting(this, "enabled", enabled); 59 60 if (!enabled) 61 break; 62 63 if (m_PressedRight) 64 { 65 m_PressedRight = false; 66 if (Message.type == GUIM_MOUSE_RELEASE_RIGHT) 67 { 68 // Button was right-clicked 69 SendEvent(GUIM_PRESSED_MOUSE_RIGHT, "pressright"); 70 } 71 else 72 { 73 // Button was clicked a second time. We can't tell if the button 74 // expects to receive doublepress events or just a second press 75 // event, so send both of them (and assume the extra unwanted press 76 // is harmless on buttons that expect doublepress) 77 SendEvent(GUIM_PRESSED_MOUSE_RIGHT, "pressright"); 78 SendEvent(GUIM_DOUBLE_PRESSED_MOUSE_RIGHT, "doublepressright"); 79 } 80 } 81 } 82 break; 83 84 case GUIM_MOUSE_PRESS_RIGHT: 85 { 86 bool enabled; 87 GUI<bool>::GetSetting(this, "enabled", enabled); 88 89 if (!enabled) 90 break; 91 92 m_PressedRight = true; 93 } 94 break; 95 53 96 case GUIM_MOUSE_DBLCLICK_LEFT: 54 97 case GUIM_MOUSE_RELEASE_LEFT: 55 98 { … … 77 120 SendEvent(GUIM_DOUBLE_PRESSED, "doublepress"); 78 121 } 79 122 } 80 } break; 123 } 124 break; 81 125 82 126 default: 83 127 break; -
source/gui/GUIbase.h
1 /* Copyright (C) 20 09Wildfire Games.1 /* Copyright (C) 2012 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 93 93 GUIM_MOUSE_MOTION, 94 94 GUIM_LOAD, // Called when an object is added to the GUI. 95 95 GUIM_GOT_FOCUS, 96 GUIM_LOST_FOCUS 96 GUIM_LOST_FOCUS, 97 GUIM_PRESSED_MOUSE_RIGHT, 98 GUIM_DOUBLE_PRESSED_MOUSE_RIGHT 97 99 }; 98 100 99 101 /**