diff options
author | McCabe Maxsted | 2009-10-12 00:51:28 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-10-12 00:51:28 -0700 |
commit | e0561134ee559f9ea729f940cf9d4390f60c66d5 (patch) | |
tree | e4d25df45c1f2f959b315ef90a3f6badd5133157 /linden | |
parent | Added particle count to windlight toolbar (diff) | |
download | meta-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')
7 files changed, 87 insertions, 99 deletions
diff --git a/linden/indra/newview/llfilepicker.cpp b/linden/indra/newview/llfilepicker.cpp index 954a274..ece30dd 100644 --- a/linden/indra/newview/llfilepicker.cpp +++ b/linden/indra/newview/llfilepicker.cpp | |||
@@ -327,6 +327,18 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename) | |||
327 | L"Targa, Bitmap Images (*.tga; *.bmp)\0*.tga;*.bmp\0" \ | 327 | L"Targa, Bitmap Images (*.tga; *.bmp)\0*.tga;*.bmp\0" \ |
328 | L"\0"; | 328 | L"\0"; |
329 | break; | 329 | break; |
330 | case FFSAVE_TEXT: | ||
331 | if (filename.empty()) | ||
332 | { | ||
333 | wcsncpy( mFilesW,L"untitled.txt", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ | ||
334 | } | ||
335 | mOFN.lpstrDefExt = L"txt"; | ||
336 | mOFN.lpstrFilter = | ||
337 | L"Text files (*.txt)\0*.txt\0" | ||
338 | L"RTF Files (*.rtf)\0*.rtf\0" | ||
339 | L"LSL Files (*.lsl)\0*.lsl\0" | ||
340 | L"\0"; | ||
341 | break; | ||
330 | case FFSAVE_WAV: | 342 | case FFSAVE_WAV: |
331 | if (filename.empty()) | 343 | if (filename.empty()) |
332 | { | 344 | { |
diff --git a/linden/indra/newview/llfilepicker.h b/linden/indra/newview/llfilepicker.h index aea414a..f9f859f 100644 --- a/linden/indra/newview/llfilepicker.h +++ b/linden/indra/newview/llfilepicker.h | |||
@@ -90,6 +90,7 @@ public: | |||
90 | FFLOAD_XML = 6, | 90 | FFLOAD_XML = 6, |
91 | FFLOAD_SLOBJECT = 7, | 91 | FFLOAD_SLOBJECT = 7, |
92 | FFLOAD_RAW = 8, | 92 | FFLOAD_RAW = 8, |
93 | FFLOAD_TEXT = 9, | ||
93 | }; | 94 | }; |
94 | 95 | ||
95 | enum ESaveFilter | 96 | enum ESaveFilter |
@@ -109,6 +110,8 @@ public: | |||
109 | FFSAVE_J2C = 12, | 110 | FFSAVE_J2C = 12, |
110 | FFSAVE_PNG = 13, | 111 | FFSAVE_PNG = 13, |
111 | FFSAVE_JPEG = 14, | 112 | FFSAVE_JPEG = 14, |
113 | FFSAVE_HPA = 15, | ||
114 | FFSAVE_TEXT = 16, | ||
112 | }; | 115 | }; |
113 | 116 | ||
114 | // open the dialog. This is a modal operation | 117 | // open the dialog. This is a modal operation |
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 | ||
836 | void 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 | } | ||
861 | void 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 | |||
826 | void LLScriptEdCore::onSearchMenu(void* userdata) | 890 | void LLScriptEdCore::onSearchMenu(void* userdata) |
827 | { | 891 | { |
828 | LLScriptEdCore* sec = (LLScriptEdCore*)userdata; | 892 | LLScriptEdCore* sec = (LLScriptEdCore*)userdata; |
diff --git a/linden/indra/newview/llpreviewscript.h b/linden/indra/newview/llpreviewscript.h index 7026482..97e721d 100644 --- a/linden/indra/newview/llpreviewscript.h +++ b/linden/indra/newview/llpreviewscript.h | |||
@@ -95,6 +95,8 @@ public: | |||
95 | static void doSave( void* userdata, BOOL close_after_save ); | 95 | static void doSave( void* userdata, BOOL close_after_save ); |
96 | static void onBtnSave(void*); | 96 | static void onBtnSave(void*); |
97 | static void onBtnUndoChanges(void*); | 97 | static void onBtnUndoChanges(void*); |
98 | static void onBtnSaveToDisc(void*); | ||
99 | static void onBtnLoadFromDisc(void*); | ||
98 | static void onSearchMenu(void* userdata); | 100 | static void onSearchMenu(void* userdata); |
99 | 101 | ||
100 | static void onUndoMenu(void* userdata); | 102 | static void onUndoMenu(void* userdata); |
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_script_ed_panel.xml b/linden/indra/newview/skins/default/xui/en-us/floater_script_ed_panel.xml index b83a6df..653c75b 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_script_ed_panel.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_script_ed_panel.xml | |||
@@ -35,6 +35,12 @@ | |||
35 | width="138" /> | 35 | width="138" /> |
36 | <menu_item_call bottom_delta="-58" height="20" label="Revert All Changes" left="0" | 36 | <menu_item_call bottom_delta="-58" height="20" label="Revert All Changes" left="0" |
37 | mouse_opaque="true" name="Revert All Changes" width="138" /> | 37 | mouse_opaque="true" name="Revert All Changes" width="138" /> |
38 | <menu_item_separator bottom_delta="-66" height="8" left="0" mouse_opaque="true" name="separator" | ||
39 | width="138" /> | ||
40 | <menu_item_call bottom_delta="-76" height="20" label="Save to Disk" left="0" | ||
41 | mouse_opaque="true" name="Save to Disk" width="138" /> | ||
42 | <menu_item_call bottom_delta="-96" height="20" label="Load from Disk" left="0" | ||
43 | mouse_opaque="true" name="Load from Disk" width="138" /> | ||
38 | </menu> | 44 | </menu> |
39 | <menu bottom="665" drop_shadow="true" enabled="true" height="198" | 45 | <menu bottom="665" drop_shadow="true" enabled="true" height="198" |
40 | left="222" mouse_opaque="false" name="Edit" opaque="true" tear_off="false" | 46 | left="222" mouse_opaque="false" name="Edit" opaque="true" tear_off="false" |
diff --git a/linden/indra/newview/skins/silver/xui/en-us/floater_script_ed_panel.xml b/linden/indra/newview/skins/silver/xui/en-us/floater_script_ed_panel.xml deleted file mode 100644 index 12ae6dc..0000000 --- a/linden/indra/newview/skins/silver/xui/en-us/floater_script_ed_panel.xml +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" standalone="yes" ?> | ||
2 | <panel bottom="-550" enabled="true" follows="left|top|right|bottom" height="508" | ||
3 | left="0" mouse_opaque="true" name="script panel" width="500"> | ||
4 | <text_editor type="string" length="1" bottom="-393" | ||
5 | embedded_items="false" enabled="true" follows="left|top|right|bottom" | ||
6 | font="Monospace" height="376" ignore_tab="false" left="4" | ||
7 | max_length="65536" mouse_opaque="true" name="Script Editor" width="492" | ||
8 | word_wrap="true" show_line_numbers="true"> | ||
9 | Loading... | ||
10 | </text_editor> | ||
11 | <button bottom="-499" enabled="true" follows="right|bottom" font="SansSerif" | ||
12 | halign="center" height="20" label="Save" label_selected="Save" left="360" | ||
13 | mouse_opaque="true" name="Save_btn" width="128" /> | ||
14 | <scroll_list background_visible="true" bottom="-457" column_padding="5" draw_border="true" | ||
15 | draw_heading="false" draw_stripes="true" enabled="true" | ||
16 | follows="left|right|bottom" height="60" left="4" mouse_opaque="true" | ||
17 | multi_select="false" name="lsl errors" width="492" /> | ||
18 | <combo_box allow_text_entry="false" bottom="-499" enabled="true" follows="left|bottom" | ||
19 | height="20" label="Insert..." left="12" max_chars="20" mouse_opaque="true" | ||
20 | name="Insert..." width="128" /> | ||
21 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
22 | bottom="-473" drop_shadow_visible="true" enabled="true" | ||
23 | follows="left|bottom" font="SansSerifSmall" h_pad="0" halign="left" | ||
24 | height="12" left="12" mouse_opaque="true" name="line_col" v_pad="0" | ||
25 | width="128" /> | ||
26 | <menu_bar bottom="-15" drop_shadow="false" enabled="true" follows="left|top|right" | ||
27 | height="18" left="8" mouse_opaque="false" name="script_menu" opaque="false" | ||
28 | tear_off="false" width="476"> | ||
29 | <menu bottom="0" drop_shadow="true" enabled="true" height="62" | ||
30 | left="0" mouse_opaque="false" name="File" opaque="true" tear_off="false" | ||
31 | width="138"> | ||
32 | <menu_item_call bottom_delta="-30" height="20" label="Save" left="0" mouse_opaque="true" | ||
33 | name="Save" width="138" /> | ||
34 | <menu_item_separator bottom_delta="-38" height="8" left="0" mouse_opaque="true" name="separator" | ||
35 | width="138" /> | ||
36 | <menu_item_call bottom_delta="-58" height="20" label="Revert All Changes" left="0" | ||
37 | mouse_opaque="true" name="Revert All Changes" width="138" /> | ||
38 | </menu> | ||
39 | <menu bottom="665" drop_shadow="true" enabled="true" height="198" | ||
40 | left="222" mouse_opaque="false" name="Edit" opaque="true" tear_off="false" | ||
41 | width="139"> | ||
42 | <menu_item_call bottom_delta="-30" enabled="false" height="20" label="Undo" left="0" | ||
43 | mouse_opaque="true" name="Undo" width="139" /> | ||
44 | <menu_item_call bottom_delta="-50" enabled="false" height="20" label="Redo" left="0" | ||
45 | mouse_opaque="true" name="Redo" width="139" /> | ||
46 | <menu_item_separator bottom_delta="-58" enabled="true" height="8" label="-----------" left="0" | ||
47 | mouse_opaque="true" name="separator" width="139" /> | ||
48 | <menu_item_call bottom_delta="-78" enabled="false" height="20" label="Cut" left="0" | ||
49 | mouse_opaque="true" name="Cut" width="139" /> | ||
50 | <menu_item_call bottom_delta="-98" enabled="false" height="20" label="Copy" left="0" | ||
51 | mouse_opaque="true" name="Copy" width="139" /> | ||
52 | <menu_item_call bottom_delta="-118" enabled="false" height="20" label="Paste" left="0" | ||
53 | mouse_opaque="true" name="Paste" width="139" /> | ||
54 | <menu_item_separator bottom_delta="-126" enabled="true" height="8" label="-----------" left="0" | ||
55 | mouse_opaque="true" name="separator2" width="139" /> | ||
56 | <menu_item_call bottom_delta="-146" enabled="true" height="20" label="Select All" left="0" | ||
57 | mouse_opaque="true" name="Select All" width="139" /> | ||
58 | <menu_item_call bottom_delta="-166" enabled="false" height="20" label="Deselect" left="0" | ||
59 | mouse_opaque="true" name="Deselect" width="139" /> | ||
60 | <menu_item_separator bottom_delta="-174" enabled="true" height="8" label="-----------" left="0" | ||
61 | mouse_opaque="true" name="separator3" width="139" /> | ||
62 | <menu_item_call bottom_delta="-194" enabled="true" height="20" label="Search / Replace..." | ||
63 | left="0" mouse_opaque="true" name="Search / Replace..." width="139" /> | ||
64 | </menu> | ||
65 | <menu bottom="-18" drop_shadow="true" enabled="true" height="34" | ||
66 | left="0" mouse_opaque="false" name="Help" opaque="true" tear_off="false" | ||
67 | width="112"> | ||
68 | <menu_item_call bottom="-30" enabled="true" height="20" label="Help..." left="0" | ||
69 | mouse_opaque="true" name="Help..." width="112" /> | ||
70 | <menu_item_call bottom="-30" enabled="true" height="20" label="LSL Wiki Help..." left="0" | ||
71 | mouse_opaque="true" name="LSL Wiki Help..." width="112" /> | ||
72 | </menu> | ||
73 | </menu_bar> | ||
74 | <string name="loading"> | ||
75 | Loading... | ||
76 | </string> | ||
77 | <string name="can_not_view"> | ||
78 | You are not allowed to view this script. | ||
79 | </string> | ||
80 | <string name="public_objects_can_not_run"> | ||
81 | Public Objects cannot run scripts | ||
82 | </string> | ||
83 | <string name="script_running"> | ||
84 | Running | ||
85 | </string> | ||
86 | </panel> | ||
diff --git a/linden/indra/newview/skins/silver/xui/en-us/floater_script_queue.xml b/linden/indra/newview/skins/silver/xui/en-us/floater_script_queue.xml deleted file mode 100644 index c44457c..0000000 --- a/linden/indra/newview/skins/silver/xui/en-us/floater_script_queue.xml +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" standalone="yes" ?> | ||
2 | <floater bottom="-763" can_close="true" can_drag_on_left="false" can_minimize="true" | ||
3 | can_resize="true" enabled="true" height="400" left="408" min_height="100" | ||
4 | min_width="100" mouse_opaque="true" name="queue" title="Reset Progress" | ||
5 | width="300"> | ||
6 | <button bottom="-392" enabled="true" follows="right|bottom" font="SansSerif" | ||
7 | halign="center" height="24" label="Close" label_selected="Close" left="220" | ||
8 | mouse_opaque="true" name="close" width="64" /> | ||
9 | <scroll_list background_visible="true" bottom="-364" column_padding="5" draw_border="true" | ||
10 | draw_heading="false" draw_stripes="true" enabled="true" | ||
11 | follows="left|top|right|bottom" height="344" left="4" mouse_opaque="true" | ||
12 | multi_select="false" name="queue output" width="292" /> | ||
13 | </floater> | ||