summaryrefslogtreecommitdiff
path: root/indra/newview/llfilepicker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfilepicker.cpp')
-rw-r--r--indra/newview/llfilepicker.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index 4897cf1885..8024755e86 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -58,6 +58,7 @@ LLFilePicker LLFilePicker::sInstance;
#define SLOBJECT_FILTER L"Objects (*.slobject)\0*.slobject\0"
#define RAW_FILTER L"RAW files (*.raw)\0*.raw\0"
#define MODEL_FILTER L"Model files (*.dae)\0*.dae\0"
+#define SCRIPT_FILTER L"Script files (*.lsl)\0*.lsl\0"
#endif
//
@@ -213,6 +214,10 @@ BOOL LLFilePicker::setupFilter(ELoadFilter filter)
mOFN.lpstrFilter = MODEL_FILTER \
L"\0";
break;
+ case FFLOAD_SCRIPT:
+ mOFN.lpstrFilter = SCRIPT_FILTER \
+ L"\0";
+ break;
default:
res = FALSE;
break;
@@ -497,6 +502,14 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename)
L"Compressed Images (*.j2c)\0*.j2c\0" \
L"\0";
break;
+ case FFSAVE_SCRIPT:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.lsl", FILENAME_BUFFER_SIZE);
+ }
+ mOFN.lpstrDefExt = L"txt";
+ mOFN.lpstrFilter = L"LSL Files (*.lsl)\0*.lsl\0" L"\0";
+ break;
default:
return FALSE;
}
@@ -620,6 +633,14 @@ Boolean LLFilePicker::navOpenFilterProc(AEDesc *theItem, void *info, void *callB
result = false;
}
}
+ else if (filter == FFLOAD_SCRIPT)
+ {
+ if (fileInfo.filetype != 'LSL ' &&
+ (fileInfo.extension && (CFStringCompare(fileInfo.extension, CFSTR("lsl"), kCFCompareCaseInsensitive) != kCFCompareEqualTo)) )
+ {
+ result = false;
+ }
+ }
if (fileInfo.extension)
{
@@ -766,6 +787,12 @@ OSStatus LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& fi
extension = CFSTR(".j2c");
break;
+ case FFSAVE_SCRIPT:
+ type = 'LSL ';
+ creator = '\?\?\?\?';
+ extension = CFSTR(".lsl");
+ break;
+
case FFSAVE_ALL:
default:
type = '\?\?\?\?';
@@ -1192,7 +1219,12 @@ static std::string add_imageload_filter_to_gtkchooser(GtkWindow *picker)
add_common_filters_to_gtkchooser(gfilter, picker, filtername);
return filtername;
}
-
+
+static std::string add_script_filter_to_gtkchooser(GtkWindow *picker)
+{
+ return add_simple_mime_filter_to_gtkchooser(picker, "text/plain",
+ LLTrans::getString("script_files") + " (*.lsl)");
+}
BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename )
{
@@ -1258,6 +1290,10 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename
LLTrans::getString("compressed_image_files") + " (*.j2c)");
suggest_ext = ".j2c";
break;
+ case FFSAVE_SCRIPT:
+ caption += add_script_filter_to_gtkchooser(picker);
+ suggest_ext = ".lsl";
+ break;
default:;
break;
}
@@ -1323,6 +1359,9 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
case FFLOAD_IMAGE:
filtername = add_imageload_filter_to_gtkchooser(picker);
break;
+ case FFLOAD_SCRIPT:
+ filtername = add_script_filter_to_gtkchooser(picker);
+ break;
default:;
break;
}