diff options
Diffstat (limited to 'linden/indra/newview/llpreviewscript.cpp')
-rw-r--r-- | linden/indra/newview/llpreviewscript.cpp | 173 |
1 files changed, 80 insertions, 93 deletions
diff --git a/linden/indra/newview/llpreviewscript.cpp b/linden/indra/newview/llpreviewscript.cpp index 2f3a8a2..6acd6bf 100644 --- a/linden/indra/newview/llpreviewscript.cpp +++ b/linden/indra/newview/llpreviewscript.cpp | |||
@@ -78,7 +78,7 @@ | |||
78 | #include "llviewerstats.h" | 78 | #include "llviewerstats.h" |
79 | #include "llviewertexteditor.h" | 79 | #include "llviewertexteditor.h" |
80 | #include "llviewerwindow.h" | 80 | #include "llviewerwindow.h" |
81 | #include "llvieweruictrlfactory.h" | 81 | #include "lluictrlfactory.h" |
82 | #include "llwebbrowserctrl.h" | 82 | #include "llwebbrowserctrl.h" |
83 | #include "lluictrlfactory.h" | 83 | #include "lluictrlfactory.h" |
84 | 84 | ||
@@ -176,7 +176,7 @@ LLFloaterScriptSearch::LLFloaterScriptSearch(std::string title, LLRect rect, LLS | |||
176 | : LLFloater("script search",rect,title), mEditorCore(editor_core) | 176 | : LLFloater("script search",rect,title), mEditorCore(editor_core) |
177 | { | 177 | { |
178 | 178 | ||
179 | gUICtrlFactory->buildFloater(this,"floater_script_search.xml"); | 179 | LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_search.xml"); |
180 | 180 | ||
181 | childSetAction("search_btn", onBtnSearch,this); | 181 | childSetAction("search_btn", onBtnSearch,this); |
182 | childSetAction("replace_btn", onBtnReplace,this); | 182 | childSetAction("replace_btn", onBtnReplace,this); |
@@ -198,9 +198,10 @@ LLFloaterScriptSearch::LLFloaterScriptSearch(std::string title, LLRect rect, LLS | |||
198 | LLView* viewp = (LLView*)editor_core; | 198 | LLView* viewp = (LLView*)editor_core; |
199 | while(viewp) | 199 | while(viewp) |
200 | { | 200 | { |
201 | if (viewp->getWidgetType() == WIDGET_TYPE_FLOATER) | 201 | LLFloater* floaterp = dynamic_cast<LLFloater*>(viewp); |
202 | if (floaterp) | ||
202 | { | 203 | { |
203 | ((LLFloater*)viewp)->addDependentFloater(this); | 204 | floaterp->addDependentFloater(this); |
204 | break; | 205 | break; |
205 | } | 206 | } |
206 | viewp = viewp->getParent(); | 207 | viewp = viewp->getParent(); |
@@ -243,7 +244,7 @@ void LLFloaterScriptSearch::onBtnSearch(void *userdata) | |||
243 | 244 | ||
244 | void LLFloaterScriptSearch::handleBtnSearch() | 245 | void LLFloaterScriptSearch::handleBtnSearch() |
245 | { | 246 | { |
246 | LLCheckBoxCtrl* caseChk = LLUICtrlFactory::getCheckBoxByName(this,"case_text"); | 247 | LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text"); |
247 | mEditorCore->mEditor->selectNext(childGetText("search_text"), caseChk->get()); | 248 | mEditorCore->mEditor->selectNext(childGetText("search_text"), caseChk->get()); |
248 | } | 249 | } |
249 | 250 | ||
@@ -256,7 +257,7 @@ void LLFloaterScriptSearch::onBtnReplace(void *userdata) | |||
256 | 257 | ||
257 | void LLFloaterScriptSearch::handleBtnReplace() | 258 | void LLFloaterScriptSearch::handleBtnReplace() |
258 | { | 259 | { |
259 | LLCheckBoxCtrl* caseChk = LLUICtrlFactory::getCheckBoxByName(this,"case_text"); | 260 | LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text"); |
260 | mEditorCore->mEditor->replaceText(childGetText("search_text"), childGetText("replace_text"), caseChk->get()); | 261 | mEditorCore->mEditor->replaceText(childGetText("search_text"), childGetText("replace_text"), caseChk->get()); |
261 | } | 262 | } |
262 | 263 | ||
@@ -269,7 +270,7 @@ void LLFloaterScriptSearch::onBtnReplaceAll(void *userdata) | |||
269 | 270 | ||
270 | void LLFloaterScriptSearch::handleBtnReplaceAll() | 271 | void LLFloaterScriptSearch::handleBtnReplaceAll() |
271 | { | 272 | { |
272 | LLCheckBoxCtrl* caseChk = LLUICtrlFactory::getCheckBoxByName(this,"case_text"); | 273 | LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text"); |
273 | mEditorCore->mEditor->replaceTextAll(childGetText("search_text"), childGetText("replace_text"), caseChk->get()); | 274 | mEditorCore->mEditor->replaceTextAll(childGetText("search_text"), childGetText("replace_text"), caseChk->get()); |
274 | } | 275 | } |
275 | 276 | ||
@@ -311,16 +312,15 @@ LLScriptEdCore::LLScriptEdCore( | |||
311 | setBorderVisible(FALSE); | 312 | setBorderVisible(FALSE); |
312 | 313 | ||
313 | 314 | ||
314 | gUICtrlFactory->buildPanel(this, "floater_script_ed_panel.xml"); | 315 | LLUICtrlFactory::getInstance()->buildPanel(this, "floater_script_ed_panel.xml"); |
315 | 316 | ||
316 | mErrorList = LLUICtrlFactory::getScrollListByName(this, "lsl errors"); | 317 | mErrorList = getChild<LLScrollListCtrl>("lsl errors"); |
317 | 318 | ||
318 | mFunctions = LLUICtrlFactory::getComboBoxByName(this, "Insert..."); | 319 | mFunctions = getChild<LLComboBox>( "Insert..."); |
319 | 320 | ||
320 | childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); | 321 | childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); |
321 | 322 | ||
322 | mEditor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Script Editor"); | 323 | mEditor = getChild<LLViewerTextEditor>("Script Editor"); |
323 | mEditor->setReadOnlyBgColor(gColors.getColor( "ScriptBgReadOnlyColor" ) ); | ||
324 | mEditor->setFollowsAll(); | 324 | mEditor->setFollowsAll(); |
325 | mEditor->setHandleEditKeysDirectly(TRUE); | 325 | mEditor->setHandleEditKeysDirectly(TRUE); |
326 | mEditor->setEnabled(TRUE); | 326 | mEditor->setEnabled(TRUE); |
@@ -389,47 +389,47 @@ LLScriptEdCore::~LLScriptEdCore() | |||
389 | void LLScriptEdCore::initMenu() | 389 | void LLScriptEdCore::initMenu() |
390 | { | 390 | { |
391 | 391 | ||
392 | LLMenuItemCallGL* menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Save"); | 392 | LLMenuItemCallGL* menuItem = getChild<LLMenuItemCallGL>("Save"); |
393 | menuItem->setMenuCallback(onBtnSave, this); | 393 | menuItem->setMenuCallback(onBtnSave, this); |
394 | menuItem->setEnabledCallback(hasChanged); | 394 | menuItem->setEnabledCallback(hasChanged); |
395 | 395 | ||
396 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Revert All Changes"); | 396 | menuItem = getChild<LLMenuItemCallGL>("Revert All Changes"); |
397 | menuItem->setMenuCallback(onBtnUndoChanges, this); | 397 | menuItem->setMenuCallback(onBtnUndoChanges, this); |
398 | menuItem->setEnabledCallback(hasChanged); | 398 | menuItem->setEnabledCallback(hasChanged); |
399 | 399 | ||
400 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Undo"); | 400 | menuItem = getChild<LLMenuItemCallGL>("Undo"); |
401 | menuItem->setMenuCallback(onUndoMenu, this); | 401 | menuItem->setMenuCallback(onUndoMenu, this); |
402 | menuItem->setEnabledCallback(enableUndoMenu); | 402 | menuItem->setEnabledCallback(enableUndoMenu); |
403 | 403 | ||
404 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Redo"); | 404 | menuItem = getChild<LLMenuItemCallGL>("Redo"); |
405 | menuItem->setMenuCallback(onRedoMenu, this); | 405 | menuItem->setMenuCallback(onRedoMenu, this); |
406 | menuItem->setEnabledCallback(enableRedoMenu); | 406 | menuItem->setEnabledCallback(enableRedoMenu); |
407 | 407 | ||
408 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Cut"); | 408 | menuItem = getChild<LLMenuItemCallGL>("Cut"); |
409 | menuItem->setMenuCallback(onCutMenu, this); | 409 | menuItem->setMenuCallback(onCutMenu, this); |
410 | menuItem->setEnabledCallback(enableCutMenu); | 410 | menuItem->setEnabledCallback(enableCutMenu); |
411 | 411 | ||
412 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Copy"); | 412 | menuItem = getChild<LLMenuItemCallGL>("Copy"); |
413 | menuItem->setMenuCallback(onCopyMenu, this); | 413 | menuItem->setMenuCallback(onCopyMenu, this); |
414 | menuItem->setEnabledCallback(enableCopyMenu); | 414 | menuItem->setEnabledCallback(enableCopyMenu); |
415 | 415 | ||
416 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Paste"); | 416 | menuItem = getChild<LLMenuItemCallGL>("Paste"); |
417 | menuItem->setMenuCallback(onPasteMenu, this); | 417 | menuItem->setMenuCallback(onPasteMenu, this); |
418 | menuItem->setEnabledCallback(enablePasteMenu); | 418 | menuItem->setEnabledCallback(enablePasteMenu); |
419 | 419 | ||
420 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Select All"); | 420 | menuItem = getChild<LLMenuItemCallGL>("Select All"); |
421 | menuItem->setMenuCallback(onSelectAllMenu, this); | 421 | menuItem->setMenuCallback(onSelectAllMenu, this); |
422 | menuItem->setEnabledCallback(enableSelectAllMenu); | 422 | menuItem->setEnabledCallback(enableSelectAllMenu); |
423 | 423 | ||
424 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Search / Replace..."); | 424 | menuItem = getChild<LLMenuItemCallGL>("Search / Replace..."); |
425 | menuItem->setMenuCallback(onSearchMenu, this); | 425 | menuItem->setMenuCallback(onSearchMenu, this); |
426 | menuItem->setEnabledCallback(NULL); | 426 | menuItem->setEnabledCallback(NULL); |
427 | 427 | ||
428 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Help..."); | 428 | menuItem = getChild<LLMenuItemCallGL>("Help..."); |
429 | menuItem->setMenuCallback(onBtnHelp, this); | 429 | menuItem->setMenuCallback(onBtnHelp, this); |
430 | menuItem->setEnabledCallback(NULL); | 430 | menuItem->setEnabledCallback(NULL); |
431 | 431 | ||
432 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "LSL Wiki Help..."); | 432 | menuItem = getChild<LLMenuItemCallGL>("LSL Wiki Help..."); |
433 | menuItem->setMenuCallback(onBtnDynamicHelp, this); | 433 | menuItem->setMenuCallback(onBtnDynamicHelp, this); |
434 | menuItem->setEnabledCallback(NULL); | 434 | menuItem->setEnabledCallback(NULL); |
435 | } | 435 | } |
@@ -472,8 +472,8 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate) | |||
472 | if (!help_floater) return; | 472 | if (!help_floater) return; |
473 | 473 | ||
474 | // update back and forward buttons | 474 | // update back and forward buttons |
475 | LLButton* fwd_button = LLUICtrlFactory::getButtonByName(help_floater, "fwd_btn"); | 475 | LLButton* fwd_button = help_floater->getChild<LLButton>("fwd_btn"); |
476 | LLButton* back_button = LLUICtrlFactory::getButtonByName(help_floater, "back_btn"); | 476 | LLButton* back_button = help_floater->getChild<LLButton>("back_btn"); |
477 | LLWebBrowserCtrl* browser = help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); | 477 | LLWebBrowserCtrl* browser = help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); |
478 | back_button->setEnabled(browser->canNavigateBack()); | 478 | back_button->setEnabled(browser->canNavigateBack()); |
479 | fwd_button->setEnabled(browser->canNavigateForward()); | 479 | fwd_button->setEnabled(browser->canNavigateForward()); |
@@ -536,7 +536,7 @@ void LLScriptEdCore::setHelpPage(const LLString& help_string) | |||
536 | LLWebBrowserCtrl* web_browser = help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); | 536 | LLWebBrowserCtrl* web_browser = help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); |
537 | if (!web_browser) return; | 537 | if (!web_browser) return; |
538 | 538 | ||
539 | LLComboBox* history_combo = gUICtrlFactory->getComboBoxByName(help_floater, "history_combo"); | 539 | LLComboBox* history_combo = help_floater->getChild<LLComboBox>("history_combo"); |
540 | if (!history_combo) return; | 540 | if (!history_combo) return; |
541 | 541 | ||
542 | LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); | 542 | LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); |
@@ -556,7 +556,7 @@ void LLScriptEdCore::addHelpItemToHistory(const LLString& help_string) | |||
556 | LLFloater* help_floater = mLiveHelpHandle.get(); | 556 | LLFloater* help_floater = mLiveHelpHandle.get(); |
557 | if (!help_floater) return; | 557 | if (!help_floater) return; |
558 | 558 | ||
559 | LLComboBox* history_combo = gUICtrlFactory->getComboBoxByName(help_floater, "history_combo"); | 559 | LLComboBox* history_combo = help_floater->getChild<LLComboBox>("history_combo"); |
560 | if (!history_combo) return; | 560 | if (!history_combo) return; |
561 | 561 | ||
562 | // separate history items from full item list | 562 | // separate history items from full item list |
@@ -670,7 +670,7 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) | |||
670 | } | 670 | } |
671 | 671 | ||
672 | live_help_floater = new LLFloater("lsl_help"); | 672 | live_help_floater = new LLFloater("lsl_help"); |
673 | gUICtrlFactory->buildFloater(live_help_floater, "floater_lsl_guide.xml"); | 673 | LLUICtrlFactory::getInstance()->buildFloater(live_help_floater, "floater_lsl_guide.xml"); |
674 | ((LLFloater*)corep->getParent())->addDependentFloater(live_help_floater, TRUE); | 674 | ((LLFloater*)corep->getParent())->addDependentFloater(live_help_floater, TRUE); |
675 | live_help_floater->childSetCommitCallback("lock_check", onCheckLock, userdata); | 675 | live_help_floater->childSetCommitCallback("lock_check", onCheckLock, userdata); |
676 | live_help_floater->childSetValue("lock_check", gSavedSettings.getBOOL("ScriptHelpFollowsCursor")); | 676 | live_help_floater->childSetValue("lock_check", gSavedSettings.getBOOL("ScriptHelpFollowsCursor")); |
@@ -681,7 +681,7 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) | |||
681 | LLWebBrowserCtrl* browser = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); | 681 | LLWebBrowserCtrl* browser = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); |
682 | browser->setAlwaysRefresh(TRUE); | 682 | browser->setAlwaysRefresh(TRUE); |
683 | 683 | ||
684 | LLComboBox* help_combo = LLUICtrlFactory::getComboBoxByName(live_help_floater, "history_combo"); | 684 | LLComboBox* help_combo = live_help_floater->getChild<LLComboBox>("history_combo"); |
685 | LLKeywordToken *token; | 685 | LLKeywordToken *token; |
686 | LLKeywords::keyword_iterator_t token_it; | 686 | LLKeywords::keyword_iterator_t token_it; |
687 | for (token_it = corep->mEditor->keywordsBegin(); | 687 | for (token_it = corep->mEditor->keywordsBegin(); |
@@ -789,10 +789,7 @@ void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata) | |||
789 | // static | 789 | // static |
790 | void LLScriptEdCore::doSave( void* userdata, BOOL close_after_save ) | 790 | void LLScriptEdCore::doSave( void* userdata, BOOL close_after_save ) |
791 | { | 791 | { |
792 | if( gViewerStats ) | 792 | LLViewerStats::getInstance()->incStat( LLViewerStats::ST_LSL_SAVE_COUNT ); |
793 | { | ||
794 | gViewerStats->incStat( LLViewerStats::ST_LSL_SAVE_COUNT ); | ||
795 | } | ||
796 | 793 | ||
797 | LLScriptEdCore* self = (LLScriptEdCore*) userdata; | 794 | LLScriptEdCore* self = (LLScriptEdCore*) userdata; |
798 | 795 | ||
@@ -1015,33 +1012,31 @@ void LLScriptEdCore::deleteBridges() | |||
1015 | } | 1012 | } |
1016 | 1013 | ||
1017 | // virtual | 1014 | // virtual |
1018 | BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) | 1015 | BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask) |
1019 | { | 1016 | { |
1020 | if(getVisible() && getEnabled()) | 1017 | bool just_control = MASK_CONTROL == (mask & MASK_MODIFIERS); |
1021 | { | ||
1022 | bool just_control = MASK_CONTROL == (mask & MASK_MODIFIERS); | ||
1023 | 1018 | ||
1024 | if(('S' == key) && just_control) | 1019 | if(('S' == key) && just_control) |
1020 | { | ||
1021 | if(mSaveCallback) | ||
1025 | { | 1022 | { |
1026 | if(mSaveCallback) | 1023 | // don't close after saving |
1027 | { | 1024 | mSaveCallback(mUserdata, FALSE); |
1028 | // don't close after saving | ||
1029 | mSaveCallback(mUserdata, FALSE); | ||
1030 | } | ||
1031 | |||
1032 | return TRUE; | ||
1033 | } | 1025 | } |
1034 | 1026 | ||
1035 | if(('F' == key) && just_control) | 1027 | return TRUE; |
1028 | } | ||
1029 | |||
1030 | if(('F' == key) && just_control) | ||
1031 | { | ||
1032 | if(mSearchReplaceCallback) | ||
1036 | { | 1033 | { |
1037 | if(mSearchReplaceCallback) | 1034 | mSearchReplaceCallback(mUserdata); |
1038 | { | ||
1039 | mSearchReplaceCallback(mUserdata); | ||
1040 | } | ||
1041 | |||
1042 | return TRUE; | ||
1043 | } | 1035 | } |
1036 | |||
1037 | return TRUE; | ||
1044 | } | 1038 | } |
1039 | |||
1045 | return FALSE; | 1040 | return FALSE; |
1046 | } | 1041 | } |
1047 | 1042 | ||
@@ -1096,7 +1091,7 @@ LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect, | |||
1096 | factory_map["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this); | 1091 | factory_map["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this); |
1097 | 1092 | ||
1098 | 1093 | ||
1099 | gUICtrlFactory->buildFloater(this,"floater_script_preview.xml", &factory_map); | 1094 | LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_preview.xml", &factory_map); |
1100 | 1095 | ||
1101 | const LLInventoryItem* item = getItem(); | 1096 | const LLInventoryItem* item = getItem(); |
1102 | 1097 | ||
@@ -1316,7 +1311,7 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, | |||
1316 | const LLUUID& item_id, | 1311 | const LLUUID& item_id, |
1317 | const LLTransactionID& tid) | 1312 | const LLTransactionID& tid) |
1318 | { | 1313 | { |
1319 | LLLineEditor* descEditor = LLUICtrlFactory::getLineEditorByName(this, "desc"); | 1314 | LLLineEditor* descEditor = getChild<LLLineEditor>("desc"); |
1320 | LLScriptSaveInfo* info = new LLScriptSaveInfo(item_id, | 1315 | LLScriptSaveInfo* info = new LLScriptSaveInfo(item_id, |
1321 | descEditor->getText(), | 1316 | descEditor->getText(), |
1322 | tid); | 1317 | tid); |
@@ -1517,10 +1512,7 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset | |||
1517 | } | 1512 | } |
1518 | else | 1513 | else |
1519 | { | 1514 | { |
1520 | if( gViewerStats ) | 1515 | LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); |
1521 | { | ||
1522 | gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); | ||
1523 | } | ||
1524 | 1516 | ||
1525 | if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || | 1517 | if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || |
1526 | LL_ERR_FILE_EMPTY == status) | 1518 | LL_ERR_FILE_EMPTY == status) |
@@ -1627,7 +1619,7 @@ LLLiveLSLEditor::LLLiveLSLEditor(const std::string& name, | |||
1627 | LLCallbackMap::map_t factory_map; | 1619 | LLCallbackMap::map_t factory_map; |
1628 | factory_map["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); | 1620 | factory_map["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); |
1629 | 1621 | ||
1630 | gUICtrlFactory->buildFloater(this,"floater_live_lsleditor.xml", &factory_map); | 1622 | LLUICtrlFactory::getInstance()->buildFloater(this,"floater_live_lsleditor.xml", &factory_map); |
1631 | 1623 | ||
1632 | 1624 | ||
1633 | childSetCommitCallback("running", LLLiveLSLEditor::onRunningCheckboxClicked, this); | 1625 | childSetCommitCallback("running", LLLiveLSLEditor::onRunningCheckboxClicked, this); |
@@ -1830,10 +1822,7 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, | |||
1830 | } | 1822 | } |
1831 | else | 1823 | else |
1832 | { | 1824 | { |
1833 | if( gViewerStats ) | 1825 | LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); |
1834 | { | ||
1835 | gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); | ||
1836 | } | ||
1837 | 1826 | ||
1838 | if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || | 1827 | if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || |
1839 | LL_ERR_FILE_EMPTY == status) | 1828 | LL_ERR_FILE_EMPTY == status) |
@@ -1913,7 +1902,7 @@ void LLLiveLSLEditor::onRunningCheckboxClicked( LLUICtrl*, void* userdata ) | |||
1913 | { | 1902 | { |
1914 | LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata; | 1903 | LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata; |
1915 | LLViewerObject* object = gObjectList.findObject( self->mObjectID ); | 1904 | LLViewerObject* object = gObjectList.findObject( self->mObjectID ); |
1916 | LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(self, "running"); | 1905 | LLCheckBoxCtrl* runningCheckbox = self->getChild<LLCheckBoxCtrl>("running"); |
1917 | BOOL running = runningCheckbox->get(); | 1906 | BOOL running = runningCheckbox->get(); |
1918 | //self->mRunningCheckbox->get(); | 1907 | //self->mRunningCheckbox->get(); |
1919 | if( object ) | 1908 | if( object ) |
@@ -1961,39 +1950,37 @@ void LLLiveLSLEditor::onReset(void *userdata) | |||
1961 | 1950 | ||
1962 | void LLLiveLSLEditor::draw() | 1951 | void LLLiveLSLEditor::draw() |
1963 | { | 1952 | { |
1964 | if(getVisible()) | 1953 | LLViewerObject* object = gObjectList.findObject(mObjectID); |
1954 | LLCheckBoxCtrl* runningCheckbox = getChild<LLCheckBoxCtrl>( "running"); | ||
1955 | if(object && mAskedForRunningInfo && mHaveRunningInfo) | ||
1965 | { | 1956 | { |
1966 | LLViewerObject* object = gObjectList.findObject(mObjectID); | 1957 | if(object->permAnyOwner()) |
1967 | LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(this, "running"); | ||
1968 | if(object && mAskedForRunningInfo && mHaveRunningInfo) | ||
1969 | { | 1958 | { |
1970 | if(object->permAnyOwner()) | 1959 | runningCheckbox->setLabel(getString("script_running")); |
1971 | { | 1960 | runningCheckbox->setEnabled(TRUE); |
1972 | runningCheckbox->setLabel(getString("script_running")); | ||
1973 | runningCheckbox->setEnabled(TRUE); | ||
1974 | } | ||
1975 | else | ||
1976 | { | ||
1977 | runningCheckbox->setLabel(getString("public_objects_can_not_run")); | ||
1978 | runningCheckbox->setEnabled(FALSE); | ||
1979 | // *FIX: Set it to false so that the ui is correct for | ||
1980 | // a box that is released to public. It could be | ||
1981 | // incorrect after a release/claim cycle, but will be | ||
1982 | // correct after clicking on it. | ||
1983 | runningCheckbox->set(FALSE); | ||
1984 | } | ||
1985 | } | 1961 | } |
1986 | else if(!object) | 1962 | else |
1987 | { | 1963 | { |
1988 | // HACK: Display this information in the title bar. | 1964 | runningCheckbox->setLabel(getString("public_objects_can_not_run")); |
1989 | // Really ought to put in main window. | ||
1990 | setTitle("Script (object out of range)"); | ||
1991 | runningCheckbox->setEnabled(FALSE); | 1965 | runningCheckbox->setEnabled(FALSE); |
1992 | // object may have fallen out of range. | 1966 | // *FIX: Set it to false so that the ui is correct for |
1993 | mHaveRunningInfo = FALSE; | 1967 | // a box that is released to public. It could be |
1968 | // incorrect after a release/claim cycle, but will be | ||
1969 | // correct after clicking on it. | ||
1970 | runningCheckbox->set(FALSE); | ||
1994 | } | 1971 | } |
1995 | LLFloater::draw(); | ||
1996 | } | 1972 | } |
1973 | else if(!object) | ||
1974 | { | ||
1975 | // HACK: Display this information in the title bar. | ||
1976 | // Really ought to put in main window. | ||
1977 | setTitle("Script (object out of range)"); | ||
1978 | runningCheckbox->setEnabled(FALSE); | ||
1979 | // object may have fallen out of range. | ||
1980 | mHaveRunningInfo = FALSE; | ||
1981 | } | ||
1982 | |||
1983 | LLFloater::draw(); | ||
1997 | } | 1984 | } |
1998 | 1985 | ||
1999 | 1986 | ||
@@ -2103,7 +2090,7 @@ void LLLiveLSLEditor::saveIfNeeded() | |||
2103 | std::string url = gAgent.getRegion()->getCapability("UpdateScriptTaskInventory"); | 2090 | std::string url = gAgent.getRegion()->getCapability("UpdateScriptTaskInventory"); |
2104 | getWindow()->incBusyCount(); | 2091 | getWindow()->incBusyCount(); |
2105 | mPendingUploads++; | 2092 | mPendingUploads++; |
2106 | BOOL is_running = LLUICtrlFactory::getCheckBoxByName(this, "running")->get(); | 2093 | BOOL is_running = getChild<LLCheckBoxCtrl>( "running")->get(); |
2107 | if (!url.empty()) | 2094 | if (!url.empty()) |
2108 | { | 2095 | { |
2109 | uploadAssetViaCaps(url, filename, mObjectID, | 2096 | uploadAssetViaCaps(url, filename, mObjectID, |
@@ -2221,7 +2208,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, | |||
2221 | LLFile::remove(dst_filename.c_str()); | 2208 | LLFile::remove(dst_filename.c_str()); |
2222 | 2209 | ||
2223 | // If we successfully saved it, then we should be able to check/uncheck the running box! | 2210 | // If we successfully saved it, then we should be able to check/uncheck the running box! |
2224 | LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(this, "running"); | 2211 | LLCheckBoxCtrl* runningCheckbox = getChild<LLCheckBoxCtrl>( "running"); |
2225 | runningCheckbox->setLabel(getString("script_running")); | 2212 | runningCheckbox->setLabel(getString("script_running")); |
2226 | runningCheckbox->setEnabled(TRUE); | 2213 | runningCheckbox->setEnabled(TRUE); |
2227 | } | 2214 | } |
@@ -2389,7 +2376,7 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) | |||
2389 | instance->mHaveRunningInfo = TRUE; | 2376 | instance->mHaveRunningInfo = TRUE; |
2390 | BOOL running; | 2377 | BOOL running; |
2391 | msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, running); | 2378 | msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, running); |
2392 | LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(instance, "running"); | 2379 | LLCheckBoxCtrl* runningCheckbox = instance->getChild<LLCheckBoxCtrl>("running"); |
2393 | runningCheckbox->set(running); | 2380 | runningCheckbox->set(running); |
2394 | } | 2381 | } |
2395 | } | 2382 | } |