Mercurial > mplayer.hg
comparison Gui/mplayer/gtk/fs.c @ 13570:a3c3b27d3fb2
File filter dropdown box value is now preserved between dialog invocations.
patch by Deomid Ryabkov aka Rojer <myself at rojer dot pp dot ru>
author | diego |
---|---|
date | Wed, 06 Oct 2004 15:46:54 +0000 |
parents | 403ddb6b24f6 |
children | 0e1471d9da74 |
comparison
equal
deleted
inserted
replaced
13569:9dabcdf189e0 | 13570:a3c3b27d3fb2 |
---|---|
61 { "Audio files", "*.wav,*.ogg,*.mp2,*.mp3,*.wma,*.mka" }, | 61 { "Audio files", "*.wav,*.ogg,*.mp2,*.mp3,*.wma,*.mka" }, |
62 { "Video files", "*.asf,*.avi,*.divx,*.fli,*.flc,*.ogm,*.mpg,*.mpeg,*.m1v,*.mov,*.nuv,*.qt,*.rm,*.vob,*.viv,*.wmv,*.mkv,*.bin" }, | 62 { "Video files", "*.asf,*.avi,*.divx,*.fli,*.flc,*.ogm,*.mpg,*.mpeg,*.m1v,*.mov,*.nuv,*.qt,*.rm,*.vob,*.viv,*.wmv,*.mkv,*.bin" }, |
63 { "All files", "*" }, | 63 { "All files", "*" }, |
64 { NULL,NULL } | 64 { NULL,NULL } |
65 }; | 65 }; |
66 int fsLastVideoFilterSelected = -1; | |
66 | 67 |
67 char * fsSubtitleFilterNames[][2] = | 68 char * fsSubtitleFilterNames[][2] = |
68 { { "UTF (*.utf)", "*.utf" }, | 69 { { "UTF (*.utf)", "*.utf" }, |
69 { "SUB (*.sub)", "*.sub" }, | 70 { "SUB (*.sub)", "*.sub" }, |
70 { "SRT (*.srt)", "*.str" }, | 71 { "SRT (*.srt)", "*.str" }, |
75 { "AQT (*.aqt)", "*.aqt" }, | 76 { "AQT (*.aqt)", "*.aqt" }, |
76 { "Subtitles", "*.utf,*.sub,*.srt,*.smi,*.rt,*.txt,*.ssa,*.aqt" }, | 77 { "Subtitles", "*.utf,*.sub,*.srt,*.smi,*.rt,*.txt,*.ssa,*.aqt" }, |
77 { "All files", "*" }, | 78 { "All files", "*" }, |
78 { NULL,NULL } | 79 { NULL,NULL } |
79 }; | 80 }; |
81 int fsLastSubtitleFilterSelected = -1; | |
80 | 82 |
81 char * fsOtherFilterNames[][2] = | 83 char * fsOtherFilterNames[][2] = |
82 { | 84 { |
83 { "All files", "*" }, | 85 { "All files", "*" }, |
84 { NULL,NULL } | 86 { NULL,NULL } |
93 { "Matroska Audio files (*.mka)", "*.mka" }, | 95 { "Matroska Audio files (*.mka)", "*.mka" }, |
94 { "Audio files", "*.ogg,*.mp2,*.mp3,*.wav,*.wma,*.mka" }, | 96 { "Audio files", "*.ogg,*.mp2,*.mp3,*.wav,*.wma,*.mka" }, |
95 { "All files", "*" }, | 97 { "All files", "*" }, |
96 { NULL, NULL } | 98 { NULL, NULL } |
97 }; | 99 }; |
100 int fsLastAudioFilterSelected = -1; | |
98 | 101 |
99 char * fsFontFileNames[][2] = | 102 char * fsFontFileNames[][2] = |
100 { | 103 { |
101 #ifdef HAVE_FREETYPE | 104 #ifdef HAVE_FREETYPE |
102 { "True Type fonts (*.ttf)", "*.ttf" }, | 105 { "True Type fonts (*.ttf)", "*.ttf" }, |
106 { "font files (*.desc)", "*.desc" }, | 109 { "font files (*.desc)", "*.desc" }, |
107 #endif | 110 #endif |
108 { "All files", "*" }, | 111 { "All files", "*" }, |
109 { NULL,NULL } | 112 { NULL,NULL } |
110 }; | 113 }; |
114 int fsLastFontFilterSelected = -1; | |
111 | 115 |
112 GtkWidget * fsFileNamesList; | 116 GtkWidget * fsFileNamesList; |
113 GtkWidget * fsFNameList; | 117 GtkWidget * fsFNameList; |
114 GtkWidget * fsFileSelect = NULL; | 118 GtkWidget * fsFileSelect = NULL; |
115 GdkColormap * fsColorMap; | 119 GdkColormap * fsColorMap; |
230 | 234 |
231 void fs_PersistantHistory( char *subject ); /* forward declaration */ | 235 void fs_PersistantHistory( char *subject ); /* forward declaration */ |
232 | 236 |
233 void ShowFileSelect( int type,int modal ) | 237 void ShowFileSelect( int type,int modal ) |
234 { | 238 { |
235 int i; | 239 int i, k; |
236 char * tmp = NULL; | 240 char * tmp = NULL; |
237 | 241 |
238 if ( fsFileSelect ) gtkActive( fsFileSelect ); | 242 if ( fsFileSelect ) gtkActive( fsFileSelect ); |
239 else fsFileSelect=create_FileSelect(); | 243 else fsFileSelect=create_FileSelect(); |
240 | 244 |
244 case fsVideoSelector: | 248 case fsVideoSelector: |
245 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect ); | 249 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect ); |
246 fsList_items=NULL; | 250 fsList_items=NULL; |
247 for( i=0;fsVideoFilterNames[i][0];i++ ) | 251 for( i=0;fsVideoFilterNames[i][0];i++ ) |
248 fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] ); | 252 fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] ); |
253 k = fsLastVideoFilterSelected; | |
249 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); | 254 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); |
250 g_list_free( fsList_items ); | 255 g_list_free( fsList_items ); |
251 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[i-2][0] ); | 256 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[k >= 0 ? k : i-2][0] ); |
252 tmp=guiIntfStruct.Filename; | 257 tmp=guiIntfStruct.Filename; |
253 break; | 258 break; |
254 case fsSubtitleSelector: | 259 case fsSubtitleSelector: |
255 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect ); | 260 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect ); |
256 fsList_items=NULL; | 261 fsList_items=NULL; |
257 for( i=0;fsSubtitleFilterNames[i][0];i++ ) | 262 for( i=0;fsSubtitleFilterNames[i][0];i++ ) |
258 fsList_items=g_list_append( fsList_items,fsSubtitleFilterNames[i][0] ); | 263 fsList_items=g_list_append( fsList_items,fsSubtitleFilterNames[i][0] ); |
264 k = fsLastSubtitleFilterSelected; | |
259 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); | 265 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); |
260 g_list_free( fsList_items ); | 266 g_list_free( fsList_items ); |
261 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[i-2][0] ); | 267 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[k >= 0 ? k : i-2][0] ); |
262 tmp=guiIntfStruct.Subtitlename; | 268 tmp=guiIntfStruct.Subtitlename; |
263 break; | 269 break; |
264 case fsOtherSelector: | 270 case fsOtherSelector: |
265 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect ); | 271 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect ); |
266 fsList_items=NULL; | 272 fsList_items=NULL; |
274 case fsAudioSelector: | 280 case fsAudioSelector: |
275 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_AudioFileSelect ); | 281 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_AudioFileSelect ); |
276 fsList_items=NULL; | 282 fsList_items=NULL; |
277 for( i=0;fsAudioFileNames[i][0];i++ ) | 283 for( i=0;fsAudioFileNames[i][0];i++ ) |
278 fsList_items=g_list_append( fsList_items,fsAudioFileNames[i][0] ); | 284 fsList_items=g_list_append( fsList_items,fsAudioFileNames[i][0] ); |
285 k = fsLastAudioFilterSelected; | |
279 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); | 286 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); |
280 g_list_free( fsList_items ); | 287 g_list_free( fsList_items ); |
281 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsAudioFileNames[i-2][0] ); | 288 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsAudioFileNames[k >= 0 ? k : i-2][0] ); |
282 tmp=guiIntfStruct.AudioFile; | 289 tmp=guiIntfStruct.AudioFile; |
283 break; | 290 break; |
284 case fsFontSelector: | 291 case fsFontSelector: |
285 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FontSelect ); | 292 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FontSelect ); |
286 fsList_items=NULL; | 293 fsList_items=NULL; |
287 for( i=0;fsFontFileNames[i][0];i++ ) | 294 for( i=0;fsFontFileNames[i][0];i++ ) |
288 fsList_items=g_list_append( fsList_items,fsFontFileNames[i][0] ); | 295 fsList_items=g_list_append( fsList_items,fsFontFileNames[i][0] ); |
296 k = fsLastFontFilterSelected; | |
289 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); | 297 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); |
290 g_list_free( fsList_items ); | 298 g_list_free( fsList_items ); |
291 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsFontFileNames[i-2][0] ); | 299 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsFontFileNames[k >= 0 ? k : i-2][0] ); |
292 tmp=font_name; | 300 tmp=font_name; |
293 break; | 301 break; |
294 } | 302 } |
295 | 303 |
296 if ( tmp && tmp[0] ) | 304 if ( tmp && tmp[0] ) |
376 switch ( fsType ) | 384 switch ( fsType ) |
377 { | 385 { |
378 case fsVideoSelector: | 386 case fsVideoSelector: |
379 for( i=0;fsVideoFilterNames[i][0];i++ ) | 387 for( i=0;fsVideoFilterNames[i][0];i++ ) |
380 if( !strcmp( str,fsVideoFilterNames[i][0] ) ) | 388 if( !strcmp( str,fsVideoFilterNames[i][0] ) ) |
381 { fsFilter=fsVideoFilterNames[i][1]; break; } | 389 { fsFilter=fsVideoFilterNames[i][1]; fsLastVideoFilterSelected = i; break; } |
382 break; | 390 break; |
383 case fsSubtitleSelector: | 391 case fsSubtitleSelector: |
384 for( i=0;fsSubtitleFilterNames[i][0];i++ ) | 392 for( i=0;fsSubtitleFilterNames[i][0];i++ ) |
385 if( !strcmp( str,fsSubtitleFilterNames[i][0] ) ) | 393 if( !strcmp( str,fsSubtitleFilterNames[i][0] ) ) |
386 { fsFilter=fsSubtitleFilterNames[i][1]; break; } | 394 { fsFilter=fsSubtitleFilterNames[i][1]; fsLastSubtitleFilterSelected = i; break; } |
387 break; | 395 break; |
388 case fsOtherSelector: | 396 case fsOtherSelector: |
389 for( i=0;fsOtherFilterNames[i][0];i++ ) | 397 for( i=0;fsOtherFilterNames[i][0];i++ ) |
390 if( !strcmp( str,fsOtherFilterNames[i][0] ) ) | 398 if( !strcmp( str,fsOtherFilterNames[i][0] ) ) |
391 { fsFilter=fsOtherFilterNames[i][1]; break; } | 399 { fsFilter=fsOtherFilterNames[i][1]; break; } |
392 break; | 400 break; |
393 case fsAudioSelector: | 401 case fsAudioSelector: |
394 for( i=0;fsAudioFileNames[i][0];i++ ) | 402 for( i=0;fsAudioFileNames[i][0];i++ ) |
395 if( !strcmp( str,fsAudioFileNames[i][0] ) ) | 403 if( !strcmp( str,fsAudioFileNames[i][0] ) ) |
396 { fsFilter=fsAudioFileNames[i][1]; break; } | 404 { fsFilter=fsAudioFileNames[i][1]; fsLastAudioFilterSelected = i; break; } |
397 break; | 405 break; |
398 case fsFontSelector: | 406 case fsFontSelector: |
399 for( i=0;fsFontFileNames[i][0];i++ ) | 407 for( i=0;fsFontFileNames[i][0];i++ ) |
400 if( !strcmp( str,fsFontFileNames[i][0] ) ) | 408 if( !strcmp( str,fsFontFileNames[i][0] ) ) |
401 { fsFilter=fsFontFileNames[i][1]; break; } | 409 { fsFilter=fsFontFileNames[i][1]; fsLastFontFilterSelected = i; break; } |
402 break; | 410 break; |
403 default: return; | 411 default: return; |
404 } | 412 } |
405 CheckDir( fsFNameList,get_current_dir_name() ); | 413 CheckDir( fsFNameList,get_current_dir_name() ); |
406 } | 414 } |