diff options
Diffstat (limited to 'linden/indra/newview/lltoolpie.cpp')
-rw-r--r-- | linden/indra/newview/lltoolpie.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/linden/indra/newview/lltoolpie.cpp b/linden/indra/newview/lltoolpie.cpp index 0e8ba56..de10045 100644 --- a/linden/indra/newview/lltoolpie.cpp +++ b/linden/indra/newview/lltoolpie.cpp | |||
@@ -67,10 +67,6 @@ | |||
67 | #include "llui.h" | 67 | #include "llui.h" |
68 | #include "llweb.h" | 68 | #include "llweb.h" |
69 | 69 | ||
70 | LLPointer<LLViewerObject> LLToolPie::sClickActionObject; | ||
71 | LLSafeHandle<LLObjectSelection> LLToolPie::sLeftClickSelection = NULL; | ||
72 | U8 LLToolPie::sClickAction = 0; | ||
73 | |||
74 | extern void handle_buy(void*); | 70 | extern void handle_buy(void*); |
75 | 71 | ||
76 | extern BOOL gDebugClicks; | 72 | extern BOOL gDebugClicks; |
@@ -84,7 +80,8 @@ LLToolPie::LLToolPie() | |||
84 | : LLTool(std::string("Select")), | 80 | : LLTool(std::string("Select")), |
85 | mPieMouseButtonDown( FALSE ), | 81 | mPieMouseButtonDown( FALSE ), |
86 | mGrabMouseButtonDown( FALSE ), | 82 | mGrabMouseButtonDown( FALSE ), |
87 | mMouseOutsideSlop( FALSE ) | 83 | mMouseOutsideSlop( FALSE ), |
84 | mClickAction(0) | ||
88 | { } | 85 | { } |
89 | 86 | ||
90 | 87 | ||
@@ -168,17 +165,17 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) | |||
168 | // If it's a left-click, and we have a special action, do it. | 165 | // If it's a left-click, and we have a special action, do it. |
169 | if (useClickAction(always_show, mask, object, parent)) | 166 | if (useClickAction(always_show, mask, object, parent)) |
170 | { | 167 | { |
171 | sClickAction = 0; | 168 | mClickAction = 0; |
172 | if (object && object->getClickAction()) | 169 | if (object && object->getClickAction()) |
173 | { | 170 | { |
174 | sClickAction = object->getClickAction(); | 171 | mClickAction = object->getClickAction(); |
175 | } | 172 | } |
176 | else if (parent && parent->getClickAction()) | 173 | else if (parent && parent->getClickAction()) |
177 | { | 174 | { |
178 | sClickAction = parent->getClickAction(); | 175 | mClickAction = parent->getClickAction(); |
179 | } | 176 | } |
180 | 177 | ||
181 | switch(sClickAction) | 178 | switch(mClickAction) |
182 | { | 179 | { |
183 | case CLICK_ACTION_TOUCH: | 180 | case CLICK_ACTION_TOUCH: |
184 | default: | 181 | default: |
@@ -196,27 +193,27 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) | |||
196 | || parent && parent->flagTakesMoney()) | 193 | || parent && parent->flagTakesMoney()) |
197 | { | 194 | { |
198 | // pay event goes to object actually clicked on | 195 | // pay event goes to object actually clicked on |
199 | sClickActionObject = object; | 196 | mClickActionObject = object; |
200 | sLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); | 197 | mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); |
201 | return TRUE; | 198 | return TRUE; |
202 | } | 199 | } |
203 | break; | 200 | break; |
204 | case CLICK_ACTION_BUY: | 201 | case CLICK_ACTION_BUY: |
205 | sClickActionObject = parent; | 202 | mClickActionObject = parent; |
206 | sLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); | 203 | mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); |
207 | return TRUE; | 204 | return TRUE; |
208 | case CLICK_ACTION_OPEN: | 205 | case CLICK_ACTION_OPEN: |
209 | if (parent && parent->allowOpen()) | 206 | if (parent && parent->allowOpen()) |
210 | { | 207 | { |
211 | sClickActionObject = parent; | 208 | mClickActionObject = parent; |
212 | sLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); | 209 | mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); |
213 | } | 210 | } |
214 | return TRUE; | 211 | return TRUE; |
215 | case CLICK_ACTION_PLAY: | 212 | case CLICK_ACTION_PLAY: |
216 | handle_click_action_play(); | 213 | handle_click_action_play(); |
217 | return TRUE; | 214 | return TRUE; |
218 | case CLICK_ACTION_OPEN_MEDIA: | 215 | case CLICK_ACTION_OPEN_MEDIA: |
219 | // sClickActionObject = object; | 216 | // mClickActionObject = object; |
220 | handle_click_action_open_media(object); | 217 | handle_click_action_open_media(object); |
221 | return TRUE; | 218 | return TRUE; |
222 | } | 219 | } |
@@ -471,8 +468,16 @@ ECursorType cursor_from_object(LLViewerObject* object) | |||
471 | return cursor; | 468 | return cursor; |
472 | } | 469 | } |
473 | 470 | ||
471 | void LLToolPie::resetSelection() | ||
472 | { | ||
473 | mLeftClickSelection = NULL; | ||
474 | mClickActionObject = NULL; | ||
475 | mClickAction = 0; | ||
476 | } | ||
477 | |||
474 | // When we get object properties after left-clicking on an object | 478 | // When we get object properties after left-clicking on an object |
475 | // with left-click = buy, if it's the same object, do the buy. | 479 | // with left-click = buy, if it's the same object, do the buy. |
480 | |||
476 | // static | 481 | // static |
477 | void LLToolPie::selectionPropertiesReceived() | 482 | void LLToolPie::selectionPropertiesReceived() |
478 | { | 483 | { |
@@ -483,14 +488,16 @@ void LLToolPie::selectionPropertiesReceived() | |||
483 | return; | 488 | return; |
484 | } | 489 | } |
485 | 490 | ||
486 | if (!sLeftClickSelection->isEmpty()) | 491 | LLObjectSelection* selection = LLToolPie::getInstance()->getLeftClickSelection(); |
492 | if (selection) | ||
487 | { | 493 | { |
488 | LLViewerObject* selected_object = sLeftClickSelection->getPrimaryObject(); | 494 | LLViewerObject* selected_object = selection->getPrimaryObject(); |
489 | // since we don't currently have a way to lock a selection, it could have changed | 495 | // since we don't currently have a way to lock a selection, it could have changed |
490 | // after we initially clicked on the object | 496 | // after we initially clicked on the object |
491 | if (selected_object == sClickActionObject) | 497 | if (selected_object == LLToolPie::getInstance()->getClickActionObject()) |
492 | { | 498 | { |
493 | switch (sClickAction) | 499 | U8 click_action = LLToolPie::getInstance()->getClickAction(); |
500 | switch (click_action) | ||
494 | { | 501 | { |
495 | case CLICK_ACTION_BUY: | 502 | case CLICK_ACTION_BUY: |
496 | handle_buy(NULL); | 503 | handle_buy(NULL); |
@@ -506,9 +513,7 @@ void LLToolPie::selectionPropertiesReceived() | |||
506 | } | 513 | } |
507 | } | 514 | } |
508 | } | 515 | } |
509 | sLeftClickSelection = NULL; | 516 | LLToolPie::getInstance()->resetSelection(); |
510 | sClickActionObject = NULL; | ||
511 | sClickAction = 0; | ||
512 | } | 517 | } |
513 | 518 | ||
514 | BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) | 519 | BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) |