aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-10-12 00:51:28 -0700
committerMcCabe Maxsted2009-10-12 00:51:28 -0700
commite0561134ee559f9ea729f940cf9d4390f60c66d5 (patch)
treee4d25df45c1f2f959b315ef90a3f6badd5133157 /linden/indra/newview/llpreviewscript.cpp
parentAdded particle count to windlight toolbar (diff)
downloadmeta-impy-e0561134ee559f9ea729f940cf9d4390f60c66d5.zip
meta-impy-e0561134ee559f9ea729f940cf9d4390f60c66d5.tar.gz
meta-impy-e0561134ee559f9ea729f940cf9d4390f60c66d5.tar.bz2
meta-impy-e0561134ee559f9ea729f940cf9d4390f60c66d5.tar.xz
Added script load/save from Meerkat viewer
Diffstat (limited to 'linden/indra/newview/llpreviewscript.cpp')
-rw-r--r--linden/indra/newview/llpreviewscript.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/linden/indra/newview/llpreviewscript.cpp b/linden/indra/newview/llpreviewscript.cpp
index 1e9def3..6273011 100644
--- a/linden/indra/newview/llpreviewscript.cpp
+++ b/linden/indra/newview/llpreviewscript.cpp
@@ -436,6 +436,14 @@ void LLScriptEdCore::initMenu()
436 menuItem->setMenuCallback(onBtnHelp, this); 436 menuItem->setMenuCallback(onBtnHelp, this);
437 menuItem->setEnabledCallback(NULL); 437 menuItem->setEnabledCallback(NULL);
438 438
439 menuItem = getChild<LLMenuItemCallGL>("Load from Disk");
440 menuItem->setMenuCallback(onBtnLoadFromDisc, this);
441 menuItem->setEnabledCallback(NULL);
442
443 menuItem = getChild<LLMenuItemCallGL>("Save to Disk");
444 menuItem->setMenuCallback(onBtnSaveToDisc, this);
445 menuItem->setEnabledCallback(NULL);
446
439 menuItem = getChild<LLMenuItemCallGL>("LSL Wiki Help..."); 447 menuItem = getChild<LLMenuItemCallGL>("LSL Wiki Help...");
440 menuItem->setMenuCallback(onBtnDynamicHelp, this); 448 menuItem->setMenuCallback(onBtnDynamicHelp, this);
441 menuItem->setEnabledCallback(NULL); 449 menuItem->setEnabledCallback(NULL);
@@ -547,6 +555,7 @@ void LLScriptEdCore::setHelpPage(const std::string& help_string)
547 if (!history_combo) return; 555 if (!history_combo) return;
548 556
549 LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); 557 LLUIString url_string = gSavedSettings.getString("LSLHelpURL");
558 url_string.setArg("[APP_DIRECTORY]", gDirUtilp->getWorkingDir());
550 url_string.setArg("[LSL_STRING]", help_string); 559 url_string.setArg("[LSL_STRING]", help_string);
551 560
552 addHelpItemToHistory(help_string); 561 addHelpItemToHistory(help_string);
@@ -773,6 +782,7 @@ void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata)
773 782
774 LLWebBrowserCtrl* web_browser = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); 783 LLWebBrowserCtrl* web_browser = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html");
775 LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); 784 LLUIString url_string = gSavedSettings.getString("LSLHelpURL");
785 url_string.setArg("[APP_DIRECTORY]", gDirUtilp->getWorkingDir());
776 url_string.setArg("[LSL_STRING]", help_string); 786 url_string.setArg("[LSL_STRING]", help_string);
777 web_browser->navigateTo(url_string); 787 web_browser->navigateTo(url_string);
778 } 788 }
@@ -823,6 +833,60 @@ void LLScriptEdCore::onBtnUndoChanges( void* userdata )
823 } 833 }
824} 834}
825 835
836void LLScriptEdCore::onBtnSaveToDisc( void* userdata )
837{
838
839 LLViewerStats::getInstance()->incStat( LLViewerStats::ST_LSL_SAVE_COUNT );
840
841 LLScriptEdCore* self = (LLScriptEdCore*) userdata;
842
843 if( self->mSaveCallback )
844 {
845 LLFilePicker& file_picker = LLFilePicker::instance();
846 if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_TEXT ) )
847 {
848 return;
849 }
850
851 std::string filename = file_picker.getFirstFile();
852 std::string scriptText=self->mEditor->getText();
853 std::ofstream fout(filename.c_str());
854 fout<<(scriptText);
855 fout.close();
856 self->mSaveCallback( self->mUserdata, FALSE );
857
858 }
859
860}
861void LLScriptEdCore::onBtnLoadFromDisc( void* data )
862{
863
864 LLScriptEdCore* self = (LLScriptEdCore*) data;
865
866 LLFilePicker& file_picker = LLFilePicker::instance();
867 if( !file_picker.getOpenFile( LLFilePicker::FFLOAD_TEXT ) )
868 {
869 return;
870 }
871
872 std::string filename = file_picker.getFirstFile();
873
874 std::ifstream fin(filename.c_str());
875
876 std::string line;
877 std::string linetotal;
878 self->mEditor->clear();
879 while (!fin.eof())
880 {
881 getline(fin,line);
882 line=line+"\n";
883 self->mEditor->insertText(line);
884
885 }
886 fin.close();
887
888}
889
826void LLScriptEdCore::onSearchMenu(void* userdata) 890void LLScriptEdCore::onSearchMenu(void* userdata)
827{ 891{
828 LLScriptEdCore* sec = (LLScriptEdCore*)userdata; 892 LLScriptEdCore* sec = (LLScriptEdCore*)userdata;