diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llpreviewscript.cpp | 313 |
1 files changed, 280 insertions, 33 deletions
diff --git a/linden/indra/newview/llpreviewscript.cpp b/linden/indra/newview/llpreviewscript.cpp index 75371b2..39938d4 100644 --- a/linden/indra/newview/llpreviewscript.cpp +++ b/linden/indra/newview/llpreviewscript.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | 5 | * Copyright (c) 2002-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -76,6 +77,7 @@ | |||
76 | #include "llviewertexteditor.h" | 77 | #include "llviewertexteditor.h" |
77 | #include "llviewerwindow.h" | 78 | #include "llviewerwindow.h" |
78 | #include "llvieweruictrlfactory.h" | 79 | #include "llvieweruictrlfactory.h" |
80 | #include "llwebbrowserctrl.h" | ||
79 | #include "lluictrlfactory.h" | 81 | #include "lluictrlfactory.h" |
80 | 82 | ||
81 | #include "viewer.h" | 83 | #include "viewer.h" |
@@ -134,6 +136,9 @@ const S32 SCRIPT_SEARCH_HEIGHT = 120; | |||
134 | const S32 SCRIPT_SEARCH_LABEL_WIDTH = 50; | 136 | const S32 SCRIPT_SEARCH_LABEL_WIDTH = 50; |
135 | const S32 SCRIPT_SEARCH_BUTTON_WIDTH = 80; | 137 | const S32 SCRIPT_SEARCH_BUTTON_WIDTH = 80; |
136 | const S32 TEXT_EDIT_COLUMN_HEIGHT = 16; | 138 | const S32 TEXT_EDIT_COLUMN_HEIGHT = 16; |
139 | const S32 MAX_HISTORY_COUNT = 10; | ||
140 | const F32 LIVE_HELP_REFRESH_TIME = 1.f; | ||
141 | |||
137 | /// --------------------------------------------------------------------------- | 142 | /// --------------------------------------------------------------------------- |
138 | /// LLFloaterScriptSearch | 143 | /// LLFloaterScriptSearch |
139 | /// --------------------------------------------------------------------------- | 144 | /// --------------------------------------------------------------------------- |
@@ -273,6 +278,7 @@ void LLFloaterScriptSearch::open() /*Flawfinder: ignore*/ | |||
273 | LLFloater::open(); /*Flawfinder: ignore*/ | 278 | LLFloater::open(); /*Flawfinder: ignore*/ |
274 | childSetFocus("search_text", TRUE); | 279 | childSetFocus("search_text", TRUE); |
275 | } | 280 | } |
281 | |||
276 | /// --------------------------------------------------------------------------- | 282 | /// --------------------------------------------------------------------------- |
277 | /// LLScriptEdCore | 283 | /// LLScriptEdCore |
278 | /// --------------------------------------------------------------------------- | 284 | /// --------------------------------------------------------------------------- |
@@ -295,7 +301,9 @@ LLScriptEdCore::LLScriptEdCore( | |||
295 | mLoadCallback( load_callback ), | 301 | mLoadCallback( load_callback ), |
296 | mSaveCallback( save_callback ), | 302 | mSaveCallback( save_callback ), |
297 | mUserdata( userdata ), | 303 | mUserdata( userdata ), |
298 | mForceClose( FALSE ) | 304 | mForceClose( FALSE ), |
305 | mLastHelpToken(NULL), | ||
306 | mLiveHelpHistorySize(0) | ||
299 | { | 307 | { |
300 | setFollowsAll(); | 308 | setFollowsAll(); |
301 | setBorderVisible(FALSE); | 309 | setBorderVisible(FALSE); |
@@ -355,14 +363,13 @@ LLScriptEdCore::LLScriptEdCore( | |||
355 | 363 | ||
356 | initMenu(); | 364 | initMenu(); |
357 | 365 | ||
358 | |||
359 | // Do the work that addTabPanel() normally does. | 366 | // Do the work that addTabPanel() normally does. |
360 | //LLRect tab_panel_rect( 0, mRect.getHeight(), mRect.getWidth(), 0 ); | 367 | //LLRect tab_panel_rect( 0, mRect.getHeight(), mRect.getWidth(), 0 ); |
361 | //tab_panel_rect.stretch( -LLPANEL_BORDER_WIDTH ); | 368 | //tab_panel_rect.stretch( -LLPANEL_BORDER_WIDTH ); |
362 | //mCodePanel->setFollowsAll(); | 369 | //mCodePanel->setFollowsAll(); |
363 | //mCodePanel->translate( tab_panel_rect.mLeft - mCodePanel->getRect().mLeft, tab_panel_rect.mBottom - mCodePanel->getRect().mBottom); | 370 | //mCodePanel->translate( tab_panel_rect.mLeft - mCodePanel->getRect().mLeft, tab_panel_rect.mBottom - mCodePanel->getRect().mBottom); |
364 | //mCodePanel->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE ); | 371 | //mCodePanel->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE ); |
365 | 372 | ||
366 | } | 373 | } |
367 | 374 | ||
368 | LLScriptEdCore::~LLScriptEdCore() | 375 | LLScriptEdCore::~LLScriptEdCore() |
@@ -421,6 +428,9 @@ void LLScriptEdCore::initMenu() | |||
421 | menuItem->setMenuCallback(onBtnHelp, this); | 428 | menuItem->setMenuCallback(onBtnHelp, this); |
422 | menuItem->setEnabledCallback(NULL); | 429 | menuItem->setEnabledCallback(NULL); |
423 | 430 | ||
431 | menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "LSL Wiki Help..."); | ||
432 | menuItem->setMenuCallback(onBtnDynamicHelp, this); | ||
433 | menuItem->setEnabledCallback(NULL); | ||
424 | } | 434 | } |
425 | 435 | ||
426 | BOOL LLScriptEdCore::hasChanged(void* userdata) | 436 | BOOL LLScriptEdCore::hasChanged(void* userdata) |
@@ -442,7 +452,7 @@ void LLScriptEdCore::draw() | |||
442 | S32 column = 0; | 452 | S32 column = 0; |
443 | mEditor->getCurrentLineAndColumn( &line, &column, FALSE ); // don't include wordwrap | 453 | mEditor->getCurrentLineAndColumn( &line, &column, FALSE ); // don't include wordwrap |
444 | char cursor_pos[STD_STRING_BUF_SIZE]; /*Flawfinder: ignore*/ | 454 | char cursor_pos[STD_STRING_BUF_SIZE]; /*Flawfinder: ignore*/ |
445 | snprintf( cursor_pos, STD_STRING_BUF_SIZE, "Line %d, Column %d", line, column ); /*Flawfinder: ignore*/ | 455 | snprintf( cursor_pos, STD_STRING_BUF_SIZE, "Line %d, Column %d", line, column ); /* Flawfinder: ignore */ |
446 | childSetText("line_col", cursor_pos); | 456 | childSetText("line_col", cursor_pos); |
447 | } | 457 | } |
448 | else | 458 | else |
@@ -450,9 +460,135 @@ void LLScriptEdCore::draw() | |||
450 | childSetText("line_col", ""); | 460 | childSetText("line_col", ""); |
451 | } | 461 | } |
452 | 462 | ||
463 | updateDynamicHelp(); | ||
464 | |||
453 | LLPanel::draw(); | 465 | LLPanel::draw(); |
454 | } | 466 | } |
455 | 467 | ||
468 | void LLScriptEdCore::updateDynamicHelp(BOOL immediate) | ||
469 | { | ||
470 | LLFloater* help_floater = LLFloater::getFloaterByHandle(mLiveHelpHandle); | ||
471 | if (!help_floater) return; | ||
472 | |||
473 | // update back and forward buttons | ||
474 | LLButton* fwd_button = LLUICtrlFactory::getButtonByName(help_floater, "fwd_btn"); | ||
475 | LLButton* back_button = LLUICtrlFactory::getButtonByName(help_floater, "back_btn"); | ||
476 | LLWebBrowserCtrl* browser = LLUICtrlFactory::getWebBrowserCtrlByName(help_floater, "lsl_guide_html"); | ||
477 | back_button->setEnabled(browser->canNavigateBack()); | ||
478 | fwd_button->setEnabled(browser->canNavigateForward()); | ||
479 | |||
480 | if (!immediate && !gSavedSettings.getBOOL("ScriptHelpFollowsCursor")) | ||
481 | { | ||
482 | return; | ||
483 | } | ||
484 | |||
485 | LLTextSegment* segment = NULL; | ||
486 | std::vector<LLTextSegment*> selected_segments; | ||
487 | mEditor->getSelectedSegments(selected_segments); | ||
488 | |||
489 | // try segments in selection range first | ||
490 | std::vector<LLTextSegment*>::iterator segment_iter; | ||
491 | for (segment_iter = selected_segments.begin(); segment_iter != selected_segments.end(); ++segment_iter) | ||
492 | { | ||
493 | if((*segment_iter)->getToken() && (*segment_iter)->getToken()->getType() == LLKeywordToken::WORD) | ||
494 | { | ||
495 | segment = *segment_iter; | ||
496 | break; | ||
497 | } | ||
498 | } | ||
499 | |||
500 | // then try previous segment in case we just typed it | ||
501 | if (!segment) | ||
502 | { | ||
503 | LLTextSegment* test_segment = mEditor->getPreviousSegment(); | ||
504 | if(test_segment->getToken() && test_segment->getToken()->getType() == LLKeywordToken::WORD) | ||
505 | { | ||
506 | segment = test_segment; | ||
507 | } | ||
508 | } | ||
509 | |||
510 | if (segment) | ||
511 | { | ||
512 | if (segment->getToken() != mLastHelpToken) | ||
513 | { | ||
514 | mLastHelpToken = segment->getToken(); | ||
515 | mLiveHelpTimer.start(); | ||
516 | } | ||
517 | if (immediate || (mLiveHelpTimer.getStarted() && mLiveHelpTimer.getElapsedTimeF32() > LIVE_HELP_REFRESH_TIME)) | ||
518 | { | ||
519 | LLString help_string = mEditor->getText().substr(segment->getStart(), segment->getEnd() - segment->getStart()); | ||
520 | setHelpPage(help_string); | ||
521 | mLiveHelpTimer.stop(); | ||
522 | } | ||
523 | } | ||
524 | else | ||
525 | { | ||
526 | setHelpPage(""); | ||
527 | } | ||
528 | } | ||
529 | |||
530 | void LLScriptEdCore::setHelpPage(const LLString& help_string) | ||
531 | { | ||
532 | LLFloater* help_floater = LLFloater::getFloaterByHandle(mLiveHelpHandle); | ||
533 | if (!help_floater) return; | ||
534 | |||
535 | LLWebBrowserCtrl* web_browser = gUICtrlFactory->getWebBrowserCtrlByName(help_floater, "lsl_guide_html"); | ||
536 | if (!web_browser) return; | ||
537 | |||
538 | LLComboBox* history_combo = gUICtrlFactory->getComboBoxByName(help_floater, "history_combo"); | ||
539 | if (!history_combo) return; | ||
540 | |||
541 | LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); | ||
542 | url_string.setArg("[APP_DIRECTORY]", gDirUtilp->getWorkingDir()); | ||
543 | url_string.setArg("[LSL_STRING]", help_string); | ||
544 | |||
545 | addHelpItemToHistory(help_string); | ||
546 | web_browser->navigateTo(url_string); | ||
547 | } | ||
548 | |||
549 | void LLScriptEdCore::addHelpItemToHistory(const LLString& help_string) | ||
550 | { | ||
551 | if (help_string.empty()) return; | ||
552 | |||
553 | LLFloater* help_floater = LLFloater::getFloaterByHandle(mLiveHelpHandle); | ||
554 | if (!help_floater) return; | ||
555 | |||
556 | LLComboBox* history_combo = gUICtrlFactory->getComboBoxByName(help_floater, "history_combo"); | ||
557 | if (!history_combo) return; | ||
558 | |||
559 | // separate history items from full item list | ||
560 | if (mLiveHelpHistorySize == 0) | ||
561 | { | ||
562 | LLSD row; | ||
563 | row["columns"][0]["type"] = "separator"; | ||
564 | history_combo->addElement(row, ADD_TOP); | ||
565 | } | ||
566 | // delete all history items over history limit | ||
567 | while(mLiveHelpHistorySize > MAX_HISTORY_COUNT - 1) | ||
568 | { | ||
569 | history_combo->remove(mLiveHelpHistorySize - 1); | ||
570 | mLiveHelpHistorySize--; | ||
571 | } | ||
572 | |||
573 | history_combo->setSimple(help_string); | ||
574 | S32 index = history_combo->getCurrentIndex(); | ||
575 | |||
576 | // if help string exists in the combo box | ||
577 | if (index >= 0) | ||
578 | { | ||
579 | S32 cur_index = history_combo->getCurrentIndex(); | ||
580 | if (cur_index < mLiveHelpHistorySize) | ||
581 | { | ||
582 | // item found in history, bubble up to top | ||
583 | history_combo->remove(history_combo->getCurrentIndex()); | ||
584 | mLiveHelpHistorySize--; | ||
585 | } | ||
586 | } | ||
587 | history_combo->add(help_string, LLSD(help_string), ADD_TOP); | ||
588 | history_combo->selectFirstItem(); | ||
589 | mLiveHelpHistorySize++; | ||
590 | } | ||
591 | |||
456 | BOOL LLScriptEdCore::canClose() | 592 | BOOL LLScriptEdCore::canClose() |
457 | { | 593 | { |
458 | if(mForceClose || mEditor->isPristine()) | 594 | if(mForceClose || mEditor->isPristine()) |
@@ -517,6 +653,92 @@ void LLScriptEdCore::onBtnHelp(void* userdata) | |||
517 | } | 653 | } |
518 | 654 | ||
519 | // static | 655 | // static |
656 | void LLScriptEdCore::onBtnDynamicHelp(void* userdata) | ||
657 | { | ||
658 | LLScriptEdCore* corep = (LLScriptEdCore*)userdata; | ||
659 | |||
660 | LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle); | ||
661 | if (live_help_floater) | ||
662 | { | ||
663 | live_help_floater->setFocus(TRUE); | ||
664 | corep->updateDynamicHelp(TRUE); | ||
665 | |||
666 | return; | ||
667 | } | ||
668 | |||
669 | live_help_floater = new LLFloater("lsl_help"); | ||
670 | gUICtrlFactory->buildFloater(live_help_floater, "floater_lsl_guide.xml"); | ||
671 | ((LLFloater*)corep->getParent())->addDependentFloater(live_help_floater, TRUE); | ||
672 | live_help_floater->childSetCommitCallback("lock_check", onCheckLock, userdata); | ||
673 | live_help_floater->childSetValue("lock_check", gSavedSettings.getBOOL("ScriptHelpFollowsCursor")); | ||
674 | live_help_floater->childSetCommitCallback("history_combo", onHelpComboCommit, userdata); | ||
675 | live_help_floater->childSetAction("back_btn", onClickBack, userdata); | ||
676 | live_help_floater->childSetAction("fwd_btn", onClickForward, userdata); | ||
677 | |||
678 | LLWebBrowserCtrl* browser = LLUICtrlFactory::getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html"); | ||
679 | browser->setAlwaysRefresh(TRUE); | ||
680 | |||
681 | LLComboBox* help_combo = LLUICtrlFactory::getComboBoxByName(live_help_floater, "history_combo"); | ||
682 | LLKeywordToken *token; | ||
683 | LLKeywords::word_token_map_t::iterator token_it; | ||
684 | for (token_it = corep->mEditor->mKeywords.mWordTokenMap.begin(); | ||
685 | token_it != corep->mEditor->mKeywords.mWordTokenMap.end(); | ||
686 | ++token_it) | ||
687 | { | ||
688 | token = token_it->second; | ||
689 | help_combo->add(wstring_to_utf8str(token->mToken)); | ||
690 | } | ||
691 | help_combo->sortByName(); | ||
692 | |||
693 | // re-initialize help variables | ||
694 | corep->mLastHelpToken = NULL; | ||
695 | corep->mLiveHelpHandle = live_help_floater->getHandle(); | ||
696 | corep->mLiveHelpHistorySize = 0; | ||
697 | corep->updateDynamicHelp(TRUE); | ||
698 | } | ||
699 | |||
700 | //static | ||
701 | void LLScriptEdCore::onClickBack(void* userdata) | ||
702 | { | ||
703 | LLScriptEdCore* corep = (LLScriptEdCore*)userdata; | ||
704 | LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle); | ||
705 | if (live_help_floater) | ||
706 | { | ||
707 | LLWebBrowserCtrl* browserp = LLUICtrlFactory::getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html"); | ||
708 | if (browserp) | ||
709 | { | ||
710 | browserp->navigateBack(); | ||
711 | } | ||
712 | } | ||
713 | } | ||
714 | |||
715 | //static | ||
716 | void LLScriptEdCore::onClickForward(void* userdata) | ||
717 | { | ||
718 | LLScriptEdCore* corep = (LLScriptEdCore*)userdata; | ||
719 | LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle); | ||
720 | if (live_help_floater) | ||
721 | { | ||
722 | LLWebBrowserCtrl* browserp = LLUICtrlFactory::getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html"); | ||
723 | if (browserp) | ||
724 | { | ||
725 | browserp->navigateForward(); | ||
726 | } | ||
727 | } | ||
728 | } | ||
729 | |||
730 | // static | ||
731 | void LLScriptEdCore::onCheckLock(LLUICtrl* ctrl, void* userdata) | ||
732 | { | ||
733 | LLScriptEdCore* corep = (LLScriptEdCore*)userdata; | ||
734 | |||
735 | // clear out token any time we lock the frame, so we will refresh web page immediately when unlocked | ||
736 | gSavedSettings.setBOOL("ScriptHelpFollowsCursor", ctrl->getValue().asBoolean()); | ||
737 | |||
738 | corep->mLastHelpToken = NULL; | ||
739 | } | ||
740 | |||
741 | // static | ||
520 | void LLScriptEdCore::onBtnInsertSample(void* userdata) | 742 | void LLScriptEdCore::onBtnInsertSample(void* userdata) |
521 | { | 743 | { |
522 | LLScriptEdCore* self = (LLScriptEdCore*) userdata; | 744 | LLScriptEdCore* self = (LLScriptEdCore*) userdata; |
@@ -528,6 +750,27 @@ void LLScriptEdCore::onBtnInsertSample(void* userdata) | |||
528 | } | 750 | } |
529 | 751 | ||
530 | // static | 752 | // static |
753 | void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata) | ||
754 | { | ||
755 | LLScriptEdCore* corep = (LLScriptEdCore*)userdata; | ||
756 | |||
757 | LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle); | ||
758 | if (live_help_floater) | ||
759 | { | ||
760 | LLWebBrowserCtrl* web_browser = gUICtrlFactory->getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html"); | ||
761 | |||
762 | LLString help_string = ctrl->getValue().asString(); | ||
763 | |||
764 | corep->addHelpItemToHistory(help_string); | ||
765 | |||
766 | LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); | ||
767 | url_string.setArg("[APP_DIRECTORY]", gDirUtilp->getWorkingDir()); | ||
768 | url_string.setArg("[LSL_STRING]", help_string); | ||
769 | web_browser->navigateTo(url_string); | ||
770 | } | ||
771 | } | ||
772 | |||
773 | // static | ||
531 | void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata) | 774 | void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata) |
532 | { | 775 | { |
533 | LLScriptEdCore* self = (LLScriptEdCore*) userdata; | 776 | LLScriptEdCore* self = (LLScriptEdCore*) userdata; |
@@ -538,6 +781,7 @@ void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata) | |||
538 | self->mEditor->insertText(self->mFunctions->getSimple()); | 781 | self->mEditor->insertText(self->mFunctions->getSimple()); |
539 | } | 782 | } |
540 | self->mEditor->setFocus(TRUE); | 783 | self->mEditor->setFocus(TRUE); |
784 | self->setHelpPage(self->mFunctions->getSimple()); | ||
541 | } | 785 | } |
542 | 786 | ||
543 | // static | 787 | // static |
@@ -878,15 +1122,14 @@ void LLPreviewLSL::callbackLSLCompileFailed(const LLSD& compile_errors) | |||
878 | { | 1122 | { |
879 | llinfos << "Compile failed!" << llendl; | 1123 | llinfos << "Compile failed!" << llendl; |
880 | 1124 | ||
881 | const LLFontGL* err_font = gResMgr->getRes(LLFONT_OCRA); | ||
882 | LLScrollListItem* item = NULL; | ||
883 | for(LLSD::array_const_iterator line = compile_errors.beginArray(); | 1125 | for(LLSD::array_const_iterator line = compile_errors.beginArray(); |
884 | line < compile_errors.endArray(); | 1126 | line < compile_errors.endArray(); |
885 | line++) | 1127 | line++) |
886 | { | 1128 | { |
887 | item = new LLScrollListItem(); | 1129 | LLSD row; |
888 | item->addColumn(line->asString(), err_font); | 1130 | row["columns"][0]["value"] = line->asString(); |
889 | mScriptEd->mErrorList->addItem(item); | 1131 | row["columns"][0]["font"] = "OCRA"; |
1132 | mScriptEd->mErrorList->addElement(row); | ||
890 | } | 1133 | } |
891 | mScriptEd->selectFirstError(); | 1134 | mScriptEd->selectFirstError(); |
892 | closeIfNeeded(); | 1135 | closeIfNeeded(); |
@@ -1011,9 +1254,11 @@ void LLPreviewLSL::saveIfNeeded() | |||
1011 | if(!fp) | 1254 | if(!fp) |
1012 | { | 1255 | { |
1013 | llwarns << "Unable to write to " << filename << llendl; | 1256 | llwarns << "Unable to write to " << filename << llendl; |
1014 | LLScrollListItem* item = new LLScrollListItem(); | 1257 | |
1015 | item->addColumn("Error writing to local file. Is your hard drive full?", LLFontGL::sSansSerifSmall); | 1258 | LLSD row; |
1016 | mScriptEd->mErrorList->addItem(item); | 1259 | row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?"; |
1260 | row["columns"][0]["font"] = "SANSSERIF_SMALL"; | ||
1261 | mScriptEd->mErrorList->addElement(row); | ||
1017 | return; | 1262 | return; |
1018 | } | 1263 | } |
1019 | 1264 | ||
@@ -1068,8 +1313,6 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, | |||
1068 | std::string dst_filename = llformat("%s.lso", filepath.c_str()); | 1313 | std::string dst_filename = llformat("%s.lso", filepath.c_str()); |
1069 | std::string err_filename = llformat("%s.out", filepath.c_str()); | 1314 | std::string err_filename = llformat("%s.out", filepath.c_str()); |
1070 | 1315 | ||
1071 | LLScrollListItem* item = NULL; | ||
1072 | const LLFontGL* err_font = gResMgr->getRes(LLFONT_OCRA); | ||
1073 | if(!lscript_compile(filename.c_str(), | 1316 | if(!lscript_compile(filename.c_str(), |
1074 | dst_filename.c_str(), | 1317 | dst_filename.c_str(), |
1075 | err_filename.c_str(), | 1318 | err_filename.c_str(), |
@@ -1101,9 +1344,11 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, | |||
1101 | { | 1344 | { |
1102 | line.assign(buffer); | 1345 | line.assign(buffer); |
1103 | LLString::stripNonprintable(line); | 1346 | LLString::stripNonprintable(line); |
1104 | item = new LLScrollListItem(); | 1347 | |
1105 | item->addColumn(line, err_font); | 1348 | LLSD row; |
1106 | mScriptEd->mErrorList->addItem(item); | 1349 | row["columns"][0]["value"] = line; |
1350 | row["columns"][0]["font"] = "OCRA"; | ||
1351 | mScriptEd->mErrorList->addElement(row); | ||
1107 | } | 1352 | } |
1108 | } | 1353 | } |
1109 | fclose(fp); | 1354 | fclose(fp); |
@@ -1195,9 +1440,10 @@ void LLPreviewLSL::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_d | |||
1195 | { | 1440 | { |
1196 | if (self) | 1441 | if (self) |
1197 | { | 1442 | { |
1198 | LLScrollListItem* item = new LLScrollListItem(); | 1443 | LLSD row; |
1199 | item->addColumn("Compile successful!", LLFontGL::sSansSerifSmall); | 1444 | row["columns"][0]["value"] = "Compile successful!"; |
1200 | self->mScriptEd->mErrorList->addItem(item); | 1445 | row["columns"][0]["font"] = "SANSSERIF_SMALL"; |
1446 | self->mScriptEd->mErrorList->addElement(row); | ||
1201 | 1447 | ||
1202 | // Find our window and close it if requested. | 1448 | // Find our window and close it if requested. |
1203 | self->getWindow()->decBusyCount(); | 1449 | self->getWindow()->decBusyCount(); |
@@ -1418,15 +1664,14 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id, | |||
1418 | void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors) | 1664 | void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors) |
1419 | { | 1665 | { |
1420 | lldebugs << "Compile failed!" << llendl; | 1666 | lldebugs << "Compile failed!" << llendl; |
1421 | const LLFontGL* err_font = gResMgr->getRes(LLFONT_OCRA); | ||
1422 | LLScrollListItem* item = NULL; | ||
1423 | for(LLSD::array_const_iterator line = compile_errors.beginArray(); | 1667 | for(LLSD::array_const_iterator line = compile_errors.beginArray(); |
1424 | line < compile_errors.endArray(); | 1668 | line < compile_errors.endArray(); |
1425 | line++) | 1669 | line++) |
1426 | { | 1670 | { |
1427 | item = new LLScrollListItem(); | 1671 | LLSD row; |
1428 | item->addColumn(line->asString(), err_font); | 1672 | row["columns"][0]["value"] = line->asString(); |
1429 | mScriptEd->mErrorList->addItem(item); | 1673 | row["columns"][0]["font"] = "OCRA"; |
1674 | mScriptEd->mErrorList->addElement(row); | ||
1430 | } | 1675 | } |
1431 | mScriptEd->selectFirstError(); | 1676 | mScriptEd->selectFirstError(); |
1432 | closeIfNeeded(); | 1677 | closeIfNeeded(); |
@@ -1788,9 +2033,11 @@ void LLLiveLSLEditor::saveIfNeeded() | |||
1788 | if(!fp) | 2033 | if(!fp) |
1789 | { | 2034 | { |
1790 | llwarns << "Unable to write to " << filename << llendl; | 2035 | llwarns << "Unable to write to " << filename << llendl; |
1791 | LLScrollListItem* item = new LLScrollListItem(); | 2036 | |
1792 | item->addColumn("Error writing to local file. Is your hard drive full?", LLFontGL::sSansSerifSmall); | 2037 | LLSD row; |
1793 | mScriptEd->mErrorList->addItem(item); | 2038 | row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?"; |
2039 | row["columns"][0]["font"] = "SANSSERIF_SMALL"; | ||
2040 | mScriptEd->mErrorList->addElement(row); | ||
1794 | return; | 2041 | return; |
1795 | } | 2042 | } |
1796 | LLString utf8text = mScriptEd->mEditor->getText(); | 2043 | LLString utf8text = mScriptEd->mEditor->getText(); |
@@ -1848,8 +2095,6 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, | |||
1848 | std::string dst_filename = llformat("%s.lso", filepath.c_str()); | 2095 | std::string dst_filename = llformat("%s.lso", filepath.c_str()); |
1849 | std::string err_filename = llformat("%s.out", filepath.c_str()); | 2096 | std::string err_filename = llformat("%s.out", filepath.c_str()); |
1850 | 2097 | ||
1851 | LLScrollListItem* item = NULL; | ||
1852 | const LLFontGL* err_font = gResMgr->getRes(LLFONT_OCRA); | ||
1853 | FILE *fp; | 2098 | FILE *fp; |
1854 | if(!lscript_compile(filename.c_str(), | 2099 | if(!lscript_compile(filename.c_str(), |
1855 | dst_filename.c_str(), | 2100 | dst_filename.c_str(), |
@@ -1878,9 +2123,11 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, | |||
1878 | { | 2123 | { |
1879 | line.assign(buffer); | 2124 | line.assign(buffer); |
1880 | LLString::stripNonprintable(line); | 2125 | LLString::stripNonprintable(line); |
1881 | item = new LLScrollListItem(); | 2126 | |
1882 | item->addColumn(line, err_font); | 2127 | LLSD row; |
1883 | mScriptEd->mErrorList->addItem(item); | 2128 | row["columns"][0]["value"] = line; |
2129 | row["columns"][0]["font"] = "OCRA"; | ||
2130 | mScriptEd->mErrorList->addElement(row); | ||
1884 | } | 2131 | } |
1885 | } | 2132 | } |
1886 | fclose(fp); | 2133 | fclose(fp); |