diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llfilepicker.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llfilepicker.h')
-rw-r--r-- | linden/indra/newview/llfilepicker.h | 186 |
1 files changed, 186 insertions, 0 deletions
diff --git a/linden/indra/newview/llfilepicker.h b/linden/indra/newview/llfilepicker.h new file mode 100644 index 0000000..88530f6 --- /dev/null +++ b/linden/indra/newview/llfilepicker.h | |||
@@ -0,0 +1,186 @@ | |||
1 | /** | ||
2 | * @file llfilepicker.h | ||
3 | * @brief OS-specific file picker | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * 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 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | // OS specific file selection dialog. This is implemented as a | ||
29 | // singleton class, so call the instance() method to get the working | ||
30 | // instance. When you call getMultipleOpenFile(), it locks the picker | ||
31 | // until you iterate to the end of the list of selected files with | ||
32 | // getNextFile() or call reset(). | ||
33 | |||
34 | #ifndef LL_LLFILEPICKER_H | ||
35 | #define LL_LLFILEPICKER_H | ||
36 | |||
37 | #include "stdtypes.h" | ||
38 | |||
39 | #if LL_DARWIN | ||
40 | #include <Carbon/Carbon.h> | ||
41 | |||
42 | // AssertMacros.h does bad things. | ||
43 | #undef verify | ||
44 | #undef check | ||
45 | #undef require | ||
46 | |||
47 | #include <vector> | ||
48 | #include "llstring.h" | ||
49 | |||
50 | #endif | ||
51 | |||
52 | // Need commdlg.h for OPENFILENAMEA | ||
53 | #ifdef LL_WINDOWS | ||
54 | #include <commdlg.h> | ||
55 | #endif | ||
56 | |||
57 | // mostly for Linux, possible on others | ||
58 | #if LL_GTK | ||
59 | # include "gtk/gtk.h" | ||
60 | #endif // LL_GTK | ||
61 | |||
62 | // also mostly for Linux, for some X11-specific filepicker usability tweaks | ||
63 | #if LL_X11 | ||
64 | #include "SDL/SDL_syswm.h" | ||
65 | #endif | ||
66 | |||
67 | #if LL_GTK | ||
68 | // we use an aggregate structure so we can pass its pointer through a C callback | ||
69 | typedef struct { | ||
70 | GtkWidget *win; | ||
71 | std::vector<LLString> fileVector; | ||
72 | } StoreFilenamesStruct; | ||
73 | #endif // LL_GTK | ||
74 | |||
75 | class LLFilePicker | ||
76 | { | ||
77 | public: | ||
78 | // calling this before main() is undefined | ||
79 | static LLFilePicker& instance( void ) { return sInstance; } | ||
80 | |||
81 | enum ELoadFilter | ||
82 | { | ||
83 | FFLOAD_ALL = 1, | ||
84 | FFLOAD_WAV = 2, | ||
85 | FFLOAD_IMAGE = 3, | ||
86 | FFLOAD_ANIM = 4, | ||
87 | #ifdef _CORY_TESTING | ||
88 | FFLOAD_GEOMETRY = 5, | ||
89 | #endif | ||
90 | FFLOAD_XML = 6, | ||
91 | FFLOAD_SLOBJECT = 7, | ||
92 | FFLOAD_RAW = 8, | ||
93 | }; | ||
94 | |||
95 | enum ESaveFilter | ||
96 | { | ||
97 | FFSAVE_ALL = 1, | ||
98 | FFSAVE_WAV = 3, | ||
99 | FFSAVE_TGA = 4, | ||
100 | FFSAVE_BMP = 5, | ||
101 | FFSAVE_AVI = 6, | ||
102 | FFSAVE_ANIM = 7, | ||
103 | #ifdef _CORY_TESTING | ||
104 | FFSAVE_GEOMETRY = 8, | ||
105 | #endif | ||
106 | FFSAVE_XML = 9, | ||
107 | FFSAVE_COLLADA = 10, | ||
108 | FFSAVE_RAW = 11, | ||
109 | }; | ||
110 | |||
111 | // open the dialog. This is a modal operation | ||
112 | BOOL getSaveFile( ESaveFilter filter = FFSAVE_ALL, const char* filename = NULL ); | ||
113 | BOOL getOpenFile( ELoadFilter filter = FFLOAD_ALL ); | ||
114 | BOOL getMultipleOpenFiles( ELoadFilter filter = FFLOAD_ALL ); | ||
115 | |||
116 | // Get the filename(s) found. getFirstFile() sets the pointer to | ||
117 | // the start of the structure and allows the start of iteration. | ||
118 | const char* getFirstFile(); | ||
119 | |||
120 | // getNextFile() increments the internal representation and | ||
121 | // returns the next file specified by the user. Returns NULL when | ||
122 | // no more files are left. Further calls to getNextFile() are | ||
123 | // undefined. | ||
124 | const char* getNextFile(); | ||
125 | |||
126 | // This utility function extracts the directory name but doesn't | ||
127 | // do any incrementing. This is currently only supported when | ||
128 | // you're opening multiple files. | ||
129 | const char* getDirname(); | ||
130 | |||
131 | // clear any lists of buffers or whatever, and make sure the file | ||
132 | // picker isn't locked. | ||
133 | void reset(); | ||
134 | |||
135 | private: | ||
136 | enum | ||
137 | { | ||
138 | SINGLE_FILENAME_BUFFER_SIZE = 1024, | ||
139 | //FILENAME_BUFFER_SIZE = 65536 | ||
140 | FILENAME_BUFFER_SIZE = 65000 | ||
141 | }; | ||
142 | |||
143 | void buildFilename( void ); | ||
144 | |||
145 | #if LL_WINDOWS | ||
146 | OPENFILENAMEW mOFN; // for open and save dialogs | ||
147 | char *mOpenFilter; | ||
148 | WCHAR mFilesW[FILENAME_BUFFER_SIZE]; | ||
149 | |||
150 | BOOL setupFilter(ELoadFilter filter); | ||
151 | #endif | ||
152 | |||
153 | #if LL_DARWIN | ||
154 | NavDialogCreationOptions mNavOptions; | ||
155 | std::vector<LLString> mFileVector; | ||
156 | UInt32 mFileIndex; | ||
157 | |||
158 | OSStatus doNavChooseDialog(ELoadFilter filter); | ||
159 | OSStatus doNavSaveDialog(ESaveFilter filter, const char* filename); | ||
160 | void getFilePath(SInt32 index); | ||
161 | void getFileName(SInt32 index); | ||
162 | static Boolean navOpenFilterProc(AEDesc *theItem, void *info, void *callBackUD, NavFilterModes filterMode); | ||
163 | #endif | ||
164 | |||
165 | #if LL_GTK | ||
166 | StoreFilenamesStruct mStoreFilenames; | ||
167 | |||
168 | GtkWindow* buildFilePicker(void); | ||
169 | U32 mNextFileIndex; | ||
170 | #endif | ||
171 | |||
172 | char mFiles[FILENAME_BUFFER_SIZE]; | ||
173 | char mFilename[LL_MAX_PATH]; | ||
174 | char* mCurrentFile; | ||
175 | BOOL mLocked; | ||
176 | BOOL mMultiFile; | ||
177 | |||
178 | static LLFilePicker sInstance; | ||
179 | |||
180 | public: | ||
181 | // don't call these directly please. | ||
182 | LLFilePicker(); | ||
183 | ~LLFilePicker(); | ||
184 | }; | ||
185 | |||
186 | #endif | ||