diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llpreviewgesture.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llpreviewgesture.cpp | 82 |
1 files changed, 36 insertions, 46 deletions
diff --git a/linden/indra/newview/llpreviewgesture.cpp b/linden/indra/newview/llpreviewgesture.cpp index 3594642..4ca6009 100644 --- a/linden/indra/newview/llpreviewgesture.cpp +++ b/linden/indra/newview/llpreviewgesture.cpp | |||
@@ -49,6 +49,7 @@ | |||
49 | #include "llbutton.h" | 49 | #include "llbutton.h" |
50 | #include "llcheckboxctrl.h" | 50 | #include "llcheckboxctrl.h" |
51 | #include "llcombobox.h" | 51 | #include "llcombobox.h" |
52 | #include "lldelayedgestureerror.h" | ||
52 | #include "llfloatergesture.h" // for some label constants | 53 | #include "llfloatergesture.h" // for some label constants |
53 | #include "llgesturemgr.h" | 54 | #include "llgesturemgr.h" |
54 | #include "llinventorymodel.h" | 55 | #include "llinventorymodel.h" |
@@ -58,7 +59,7 @@ | |||
58 | #include "llradiogroup.h" | 59 | #include "llradiogroup.h" |
59 | #include "llscrolllistctrl.h" | 60 | #include "llscrolllistctrl.h" |
60 | #include "lltextbox.h" | 61 | #include "lltextbox.h" |
61 | #include "llvieweruictrlfactory.h" | 62 | #include "lluictrlfactory.h" |
62 | #include "llviewerinventory.h" | 63 | #include "llviewerinventory.h" |
63 | #include "llviewerobject.h" | 64 | #include "llviewerobject.h" |
64 | #include "llviewerobjectlist.h" | 65 | #include "llviewerobjectlist.h" |
@@ -133,7 +134,7 @@ LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& | |||
133 | self->init(item_id, object_id); | 134 | self->init(item_id, object_id); |
134 | 135 | ||
135 | // Builds and adds to gFloaterView | 136 | // Builds and adds to gFloaterView |
136 | gUICtrlFactory->buildFloater(self, "floater_preview_gesture.xml"); | 137 | LLUICtrlFactory::getInstance()->buildFloater(self, "floater_preview_gesture.xml"); |
137 | self->setTitle(title); | 138 | self->setTitle(title); |
138 | 139 | ||
139 | // Move window to top-left of screen | 140 | // Move window to top-left of screen |
@@ -184,18 +185,15 @@ LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& | |||
184 | 185 | ||
185 | 186 | ||
186 | // virtual | 187 | // virtual |
187 | BOOL LLPreviewGesture::handleKeyHere(KEY key, MASK mask, | 188 | BOOL LLPreviewGesture::handleKeyHere(KEY key, MASK mask) |
188 | BOOL called_from_parent) | ||
189 | { | 189 | { |
190 | if(getVisible() && getEnabled()) | 190 | if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL))) |
191 | { | 191 | { |
192 | if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL))) | 192 | saveIfNeeded(); |
193 | { | 193 | return TRUE; |
194 | saveIfNeeded(); | ||
195 | return TRUE; | ||
196 | } | ||
197 | } | 194 | } |
198 | return LLPreview::handleKeyHere(key, mask, called_from_parent); | 195 | |
196 | return LLPreview::handleKeyHere(key, mask); | ||
199 | } | 197 | } |
200 | 198 | ||
201 | 199 | ||
@@ -396,7 +394,7 @@ BOOL LLPreviewGesture::postBuild() | |||
396 | LLTextBox* text; | 394 | LLTextBox* text; |
397 | LLCheckBoxCtrl* check; | 395 | LLCheckBoxCtrl* check; |
398 | 396 | ||
399 | edit = LLViewerUICtrlFactory::getLineEditorByName(this, "trigger_editor"); | 397 | edit = getChild<LLLineEditor>("trigger_editor"); |
400 | edit->setKeystrokeCallback(onKeystrokeCommit); | 398 | edit->setKeystrokeCallback(onKeystrokeCommit); |
401 | edit->setCommitCallback(onCommitSetDirty); | 399 | edit->setCommitCallback(onCommitSetDirty); |
402 | edit->setCommitOnFocusLost(TRUE); | 400 | edit->setCommitOnFocusLost(TRUE); |
@@ -404,11 +402,11 @@ BOOL LLPreviewGesture::postBuild() | |||
404 | edit->setIgnoreTab(TRUE); | 402 | edit->setIgnoreTab(TRUE); |
405 | mTriggerEditor = edit; | 403 | mTriggerEditor = edit; |
406 | 404 | ||
407 | text = LLViewerUICtrlFactory::getTextBoxByName(this, "replace_text"); | 405 | text = getChild<LLTextBox>("replace_text"); |
408 | text->setEnabled(FALSE); | 406 | text->setEnabled(FALSE); |
409 | mReplaceText = text; | 407 | mReplaceText = text; |
410 | 408 | ||
411 | edit = LLViewerUICtrlFactory::getLineEditorByName(this, "replace_editor"); | 409 | edit = getChild<LLLineEditor>("replace_editor"); |
412 | edit->setEnabled(FALSE); | 410 | edit->setEnabled(FALSE); |
413 | edit->setKeystrokeCallback(onKeystrokeCommit); | 411 | edit->setKeystrokeCallback(onKeystrokeCommit); |
414 | edit->setCommitCallback(onCommitSetDirty); | 412 | edit->setCommitCallback(onCommitSetDirty); |
@@ -417,76 +415,76 @@ BOOL LLPreviewGesture::postBuild() | |||
417 | edit->setIgnoreTab(TRUE); | 415 | edit->setIgnoreTab(TRUE); |
418 | mReplaceEditor = edit; | 416 | mReplaceEditor = edit; |
419 | 417 | ||
420 | combo = LLViewerUICtrlFactory::getComboBoxByName(this, "modifier_combo"); | 418 | combo = getChild<LLComboBox>( "modifier_combo"); |
421 | combo->setCommitCallback(onCommitSetDirty); | 419 | combo->setCommitCallback(onCommitSetDirty); |
422 | combo->setCallbackUserData(this); | 420 | combo->setCallbackUserData(this); |
423 | mModifierCombo = combo; | 421 | mModifierCombo = combo; |
424 | 422 | ||
425 | combo = LLViewerUICtrlFactory::getComboBoxByName(this, "key_combo"); | 423 | combo = getChild<LLComboBox>( "key_combo"); |
426 | combo->setCommitCallback(onCommitSetDirty); | 424 | combo->setCommitCallback(onCommitSetDirty); |
427 | combo->setCallbackUserData(this); | 425 | combo->setCallbackUserData(this); |
428 | mKeyCombo = combo; | 426 | mKeyCombo = combo; |
429 | 427 | ||
430 | list = LLViewerUICtrlFactory::getScrollListByName(this, "library_list"); | 428 | list = getChild<LLScrollListCtrl>("library_list"); |
431 | list->setCommitCallback(onCommitLibrary); | 429 | list->setCommitCallback(onCommitLibrary); |
432 | list->setDoubleClickCallback(onClickAdd); | 430 | list->setDoubleClickCallback(onClickAdd); |
433 | list->setCallbackUserData(this); | 431 | list->setCallbackUserData(this); |
434 | mLibraryList = list; | 432 | mLibraryList = list; |
435 | 433 | ||
436 | btn = LLViewerUICtrlFactory::getButtonByName(this, "add_btn"); | 434 | btn = getChild<LLButton>( "add_btn"); |
437 | btn->setClickedCallback(onClickAdd); | 435 | btn->setClickedCallback(onClickAdd); |
438 | btn->setCallbackUserData(this); | 436 | btn->setCallbackUserData(this); |
439 | btn->setEnabled(FALSE); | 437 | btn->setEnabled(FALSE); |
440 | mAddBtn = btn; | 438 | mAddBtn = btn; |
441 | 439 | ||
442 | btn = LLViewerUICtrlFactory::getButtonByName(this, "up_btn"); | 440 | btn = getChild<LLButton>( "up_btn"); |
443 | btn->setClickedCallback(onClickUp); | 441 | btn->setClickedCallback(onClickUp); |
444 | btn->setCallbackUserData(this); | 442 | btn->setCallbackUserData(this); |
445 | btn->setEnabled(FALSE); | 443 | btn->setEnabled(FALSE); |
446 | mUpBtn = btn; | 444 | mUpBtn = btn; |
447 | 445 | ||
448 | btn = LLViewerUICtrlFactory::getButtonByName(this, "down_btn"); | 446 | btn = getChild<LLButton>( "down_btn"); |
449 | btn->setClickedCallback(onClickDown); | 447 | btn->setClickedCallback(onClickDown); |
450 | btn->setCallbackUserData(this); | 448 | btn->setCallbackUserData(this); |
451 | btn->setEnabled(FALSE); | 449 | btn->setEnabled(FALSE); |
452 | mDownBtn = btn; | 450 | mDownBtn = btn; |
453 | 451 | ||
454 | btn = LLViewerUICtrlFactory::getButtonByName(this, "delete_btn"); | 452 | btn = getChild<LLButton>( "delete_btn"); |
455 | btn->setClickedCallback(onClickDelete); | 453 | btn->setClickedCallback(onClickDelete); |
456 | btn->setCallbackUserData(this); | 454 | btn->setCallbackUserData(this); |
457 | btn->setEnabled(FALSE); | 455 | btn->setEnabled(FALSE); |
458 | mDeleteBtn = btn; | 456 | mDeleteBtn = btn; |
459 | 457 | ||
460 | list = LLViewerUICtrlFactory::getScrollListByName(this, "step_list"); | 458 | list = getChild<LLScrollListCtrl>("step_list"); |
461 | list->setCommitCallback(onCommitStep); | 459 | list->setCommitCallback(onCommitStep); |
462 | list->setCallbackUserData(this); | 460 | list->setCallbackUserData(this); |
463 | mStepList = list; | 461 | mStepList = list; |
464 | 462 | ||
465 | // Options | 463 | // Options |
466 | text = LLViewerUICtrlFactory::getTextBoxByName(this, "options_text"); | 464 | text = getChild<LLTextBox>("options_text"); |
467 | text->setBorderVisible(TRUE); | 465 | text->setBorderVisible(TRUE); |
468 | mOptionsText = text; | 466 | mOptionsText = text; |
469 | 467 | ||
470 | combo = LLViewerUICtrlFactory::getComboBoxByName(this, "animation_list"); | 468 | combo = getChild<LLComboBox>( "animation_list"); |
471 | combo->setVisible(FALSE); | 469 | combo->setVisible(FALSE); |
472 | combo->setCommitCallback(onCommitAnimation); | 470 | combo->setCommitCallback(onCommitAnimation); |
473 | combo->setCallbackUserData(this); | 471 | combo->setCallbackUserData(this); |
474 | mAnimationCombo = combo; | 472 | mAnimationCombo = combo; |
475 | 473 | ||
476 | LLRadioGroup* group; | 474 | LLRadioGroup* group; |
477 | group = LLViewerUICtrlFactory::getRadioGroupByName(this, "animation_trigger_type"); | 475 | group = getChild<LLRadioGroup>("animation_trigger_type"); |
478 | group->setVisible(FALSE); | 476 | group->setVisible(FALSE); |
479 | group->setCommitCallback(onCommitAnimationTrigger); | 477 | group->setCommitCallback(onCommitAnimationTrigger); |
480 | group->setCallbackUserData(this); | 478 | group->setCallbackUserData(this); |
481 | mAnimationRadio = group; | 479 | mAnimationRadio = group; |
482 | 480 | ||
483 | combo = LLViewerUICtrlFactory::getComboBoxByName(this, "sound_list"); | 481 | combo = getChild<LLComboBox>( "sound_list"); |
484 | combo->setVisible(FALSE); | 482 | combo->setVisible(FALSE); |
485 | combo->setCommitCallback(onCommitSound); | 483 | combo->setCommitCallback(onCommitSound); |
486 | combo->setCallbackUserData(this); | 484 | combo->setCallbackUserData(this); |
487 | mSoundCombo = combo; | 485 | mSoundCombo = combo; |
488 | 486 | ||
489 | edit = LLViewerUICtrlFactory::getLineEditorByName(this, "chat_editor"); | 487 | edit = getChild<LLLineEditor>("chat_editor"); |
490 | edit->setVisible(FALSE); | 488 | edit->setVisible(FALSE); |
491 | edit->setCommitCallback(onCommitChat); | 489 | edit->setCommitCallback(onCommitChat); |
492 | //edit->setKeystrokeCallback(onKeystrokeCommit); | 490 | //edit->setKeystrokeCallback(onKeystrokeCommit); |
@@ -495,19 +493,19 @@ BOOL LLPreviewGesture::postBuild() | |||
495 | edit->setIgnoreTab(TRUE); | 493 | edit->setIgnoreTab(TRUE); |
496 | mChatEditor = edit; | 494 | mChatEditor = edit; |
497 | 495 | ||
498 | check = LLViewerUICtrlFactory::getCheckBoxByName(this, "wait_anim_check"); | 496 | check = getChild<LLCheckBoxCtrl>( "wait_anim_check"); |
499 | check->setVisible(FALSE); | 497 | check->setVisible(FALSE); |
500 | check->setCommitCallback(onCommitWait); | 498 | check->setCommitCallback(onCommitWait); |
501 | check->setCallbackUserData(this); | 499 | check->setCallbackUserData(this); |
502 | mWaitAnimCheck = check; | 500 | mWaitAnimCheck = check; |
503 | 501 | ||
504 | check = LLViewerUICtrlFactory::getCheckBoxByName(this, "wait_time_check"); | 502 | check = getChild<LLCheckBoxCtrl>( "wait_time_check"); |
505 | check->setVisible(FALSE); | 503 | check->setVisible(FALSE); |
506 | check->setCommitCallback(onCommitWait); | 504 | check->setCommitCallback(onCommitWait); |
507 | check->setCallbackUserData(this); | 505 | check->setCallbackUserData(this); |
508 | mWaitTimeCheck = check; | 506 | mWaitTimeCheck = check; |
509 | 507 | ||
510 | edit = LLViewerUICtrlFactory::getLineEditorByName(this, "wait_time_editor"); | 508 | edit = getChild<LLLineEditor>("wait_time_editor"); |
511 | edit->setEnabled(FALSE); | 509 | edit->setEnabled(FALSE); |
512 | edit->setVisible(FALSE); | 510 | edit->setVisible(FALSE); |
513 | edit->setPrevalidate(LLLineEditor::prevalidateFloat); | 511 | edit->setPrevalidate(LLLineEditor::prevalidateFloat); |
@@ -519,17 +517,17 @@ BOOL LLPreviewGesture::postBuild() | |||
519 | mWaitTimeEditor = edit; | 517 | mWaitTimeEditor = edit; |
520 | 518 | ||
521 | // Buttons at the bottom | 519 | // Buttons at the bottom |
522 | check = LLViewerUICtrlFactory::getCheckBoxByName(this, "active_check"); | 520 | check = getChild<LLCheckBoxCtrl>( "active_check"); |
523 | check->setCommitCallback(onCommitActive); | 521 | check->setCommitCallback(onCommitActive); |
524 | check->setCallbackUserData(this); | 522 | check->setCallbackUserData(this); |
525 | mActiveCheck = check; | 523 | mActiveCheck = check; |
526 | 524 | ||
527 | btn = LLViewerUICtrlFactory::getButtonByName(this, "save_btn"); | 525 | btn = getChild<LLButton>( "save_btn"); |
528 | btn->setClickedCallback(onClickSave); | 526 | btn->setClickedCallback(onClickSave); |
529 | btn->setCallbackUserData(this); | 527 | btn->setCallbackUserData(this); |
530 | mSaveBtn = btn; | 528 | mSaveBtn = btn; |
531 | 529 | ||
532 | btn = LLViewerUICtrlFactory::getButtonByName(this, "preview_btn"); | 530 | btn = getChild<LLButton>( "preview_btn"); |
533 | btn->setClickedCallback(onClickPreview); | 531 | btn->setClickedCallback(onClickPreview); |
534 | btn->setCallbackUserData(this); | 532 | btn->setCallbackUserData(this); |
535 | mPreviewBtn = btn; | 533 | mPreviewBtn = btn; |
@@ -955,24 +953,16 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs, | |||
955 | } | 953 | } |
956 | else | 954 | else |
957 | { | 955 | { |
958 | // Get missing gesture's name. Use UUID if name can't be found. | 956 | LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); |
959 | LLStringBase<char>::format_map_t args; | ||
960 | LLInventoryItem *item = gInventory.getItem( *item_idp ); | ||
961 | args["[NAME]"] = item ? item->getName() : LLString( item_idp->asString() ); | ||
962 | |||
963 | if( gViewerStats ) | ||
964 | { | ||
965 | gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); | ||
966 | } | ||
967 | 957 | ||
968 | if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || | 958 | if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || |
969 | LL_ERR_FILE_EMPTY == status) | 959 | LL_ERR_FILE_EMPTY == status) |
970 | { | 960 | { |
971 | LLNotifyBox::showXml("GestureMissing", args); | 961 | LLDelayedGestureError::gestureMissing( *item_idp ); |
972 | } | 962 | } |
973 | else | 963 | else |
974 | { | 964 | { |
975 | LLNotifyBox::showXml("UnableToLoadGesture", args); | 965 | LLDelayedGestureError::gestureFailedToLoad( *item_idp ); |
976 | } | 966 | } |
977 | 967 | ||
978 | llwarns << "Problem loading gesture: " << status << llendl; | 968 | llwarns << "Problem loading gesture: " << status << llendl; |
@@ -992,7 +982,7 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) | |||
992 | 982 | ||
993 | if (item) | 983 | if (item) |
994 | { | 984 | { |
995 | LLLineEditor* descEditor = LLUICtrlFactory::getLineEditorByName(this, "desc"); | 985 | LLLineEditor* descEditor = getChild<LLLineEditor>("desc"); |
996 | descEditor->setText(item->getDescription()); | 986 | descEditor->setText(item->getDescription()); |
997 | }*/ | 987 | }*/ |
998 | 988 | ||
@@ -1183,7 +1173,7 @@ void LLPreviewGesture::saveIfNeeded() | |||
1183 | } | 1173 | } |
1184 | else if (gAssetStorage) | 1174 | else if (gAssetStorage) |
1185 | { | 1175 | { |
1186 | LLLineEditor* descEditor = LLUICtrlFactory::getLineEditorByName(this, "desc"); | 1176 | LLLineEditor* descEditor = getChild<LLLineEditor>("desc"); |
1187 | LLSaveInfo* info = new LLSaveInfo(mItemUUID, mObjectUUID, descEditor->getText(), tid); | 1177 | LLSaveInfo* info = new LLSaveInfo(mItemUUID, mObjectUUID, descEditor->getText(), tid); |
1188 | gAssetStorage->storeAssetData(tid, LLAssetType::AT_GESTURE, onSaveComplete, info, FALSE); | 1178 | gAssetStorage->storeAssetData(tid, LLAssetType::AT_GESTURE, onSaveComplete, info, FALSE); |
1189 | } | 1179 | } |