annotate Gui/mplayer/gtk/fs.c @ 18034:1dcf0ea2f7ba

reverse previous patch which caused sig11. 1000000000000000l: broken codecs.conf code modifies every page of a huge object -> tons of page faults and cannot be const. this needs to be fixed! do we have a volunteer to remove the whole codecs.conf shit?
author rfelker
date Mon, 03 Apr 2006 07:11:29 +0000
parents 0e1471d9da74
children 6a08d0dabca8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
1
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
2 #include <stdlib.h>
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
3 #include <stdio.h>
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
4 #include <string.h>
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
5 #include <sys/stat.h>
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
6 #include <glob.h>
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
7 #include <unistd.h>
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
8
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6623
diff changeset
9 #include "../mplayer.h"
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
10
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6623
diff changeset
11 #include "mplayer/pixmaps/up.xpm"
54cfbaaf161b remove unneded config files
pontscho
parents: 6623
diff changeset
12 #include "mplayer/pixmaps/dir.xpm"
54cfbaaf161b remove unneded config files
pontscho
parents: 6623
diff changeset
13 #include "mplayer/pixmaps/file.xpm"
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
14
17144
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13570
diff changeset
15 #include "../app.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13570
diff changeset
16 #include "../interface.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13570
diff changeset
17 #include "../../config.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13570
diff changeset
18 #include "../../help_mp.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13570
diff changeset
19 #include "../../libmpdemux/stream.h"
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
20
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
21 #include "../widgets.h"
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
22 #include "fs.h"
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
23 #include "opts.h"
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
24 #include "common.h"
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
25
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
26 #ifndef __linux__
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
27 #define get_current_dir_name() getcwd(NULL, PATH_MAX)
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
28 #endif
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
29
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
30 #ifndef get_current_dir_name
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
31 extern char * get_current_dir_name( void );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
32 #endif
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
33
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
34 gchar * fsSelectedFile = NULL;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
35 gchar * fsSelectedDirectory = NULL;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
36 unsigned char * fsThatDir = ".";
7540
2a1766fec13e fix filter handling bug
pontscho
parents: 7539
diff changeset
37 gchar * fsFilter = "*";
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
38
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
39 int fsPressed = 0;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
40 int fsType = 0;
3054
9507f90d8254 add half dvd support for gui
pontscho
parents: 2986
diff changeset
41
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
42 char * fsVideoFilterNames[][2] =
7531
3eb3d3d832d9 akarki fs pecse
pontscho
parents: 7387
diff changeset
43 { { "MPEG files (*.mpg,*.mpeg,*.m1v)", "*.mpg,*.mpeg,*.m1v" },
11569
403ddb6b24f6 VCD/SVCD Images (*.bin) option in file selector by Spammail <spammail01@gmx.net>
alex
parents: 10879
diff changeset
44 { "VCD/SVCD Images (*.bin)", "*.bin" },
5786
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
45 { "VOB files (*.vob)", "*.vob" },
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
46 { "AVI files (*.avi)", "*.avi" },
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
47 { "DiVX files (*.divx)", "*.divx" },
7531
3eb3d3d832d9 akarki fs pecse
pontscho
parents: 7387
diff changeset
48 { "QuickTime files (*.mov,*.qt)", "*.mov,*.qt" },
5786
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
49 { "ASF files (*.asf)", "*.asf" },
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
50 { "VIVO files (*.viv)", "*.viv" },
7217
7527dc997596 rewrite eq interface and add *.rm to fs
pontscho
parents: 7203
diff changeset
51 { "RealVideo files (*.rm)", "*.rm" },
5786
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
52 { "Windows Media Video (*.wmv)", "*.wmv" },
7531
3eb3d3d832d9 akarki fs pecse
pontscho
parents: 7387
diff changeset
53 { "OGG Media files (*.ogm)", "*.ogm" },
10879
27f8546f53c4 Added Matroska file extensions to the GUI. Patch by t0nik@yandex.ru.
mosu
parents: 9202
diff changeset
54 { "Matroska Media files (*.mkv)", "*.mkv" },
7531
3eb3d3d832d9 akarki fs pecse
pontscho
parents: 7387
diff changeset
55 { "Autodesk animations (*.fli,*.flc)", "*.fli,*.flc" },
3eb3d3d832d9 akarki fs pecse
pontscho
parents: 7387
diff changeset
56 { "NuppelVideo files (*.nuv)", "*.nuv" },
10879
27f8546f53c4 Added Matroska file extensions to the GUI. Patch by t0nik@yandex.ru.
mosu
parents: 9202
diff changeset
57 { "MP3 files (*.mp3,*.mp2)", "*.mp3,*.mp2" },
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
58 { "Wave files (*.wav)", "*.wav" },
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
59 { "WMA files (*.wma)", "*.wma" },
10879
27f8546f53c4 Added Matroska file extensions to the GUI. Patch by t0nik@yandex.ru.
mosu
parents: 9202
diff changeset
60 { "Matroska Audio files (*.mka)", "*.mka" },
27f8546f53c4 Added Matroska file extensions to the GUI. Patch by t0nik@yandex.ru.
mosu
parents: 9202
diff changeset
61 { "Audio files", "*.wav,*.ogg,*.mp2,*.mp3,*.wma,*.mka" },
11569
403ddb6b24f6 VCD/SVCD Images (*.bin) option in file selector by Spammail <spammail01@gmx.net>
alex
parents: 10879
diff changeset
62 { "Video files", "*.asf,*.avi,*.divx,*.fli,*.flc,*.ogm,*.mpg,*.mpeg,*.m1v,*.mov,*.nuv,*.qt,*.rm,*.vob,*.viv,*.wmv,*.mkv,*.bin" },
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
63 { "All files", "*" },
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
64 { NULL,NULL }
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
65 };
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
66 int fsLastVideoFilterSelected = -1;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
67
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
68 char * fsSubtitleFilterNames[][2] =
5786
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
69 { { "UTF (*.utf)", "*.utf" },
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
70 { "SUB (*.sub)", "*.sub" },
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
71 { "SRT (*.srt)", "*.str" },
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
72 { "SMI (*.smi)", "*.smi" },
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
73 { "RT (*.rt) ", "*.rt" },
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
74 { "TXT (*.txt)", "*.txt" },
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
75 { "SSA (*.ssa)", "*.ssa" },
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
76 { "AQT (*.aqt)", "*.aqt" },
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
77 { "Subtitles", "*.utf,*.sub,*.srt,*.smi,*.rt,*.txt,*.ssa,*.aqt" },
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
78 { "All files", "*" },
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
79 { NULL,NULL }
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
80 };
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
81 int fsLastSubtitleFilterSelected = -1;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
82
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
83 char * fsOtherFilterNames[][2] =
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
84 {
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
85 { "All files", "*" },
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
86 { NULL,NULL }
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
87 };
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
88
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
89 char * fsAudioFileNames[][2] =
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
90 {
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
91 { "WAV files (*.wav)", "*.wav" },
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
92 { "MP3 files (*.mp2, *.mp3)", "*.mp2,*.mp3" },
7531
3eb3d3d832d9 akarki fs pecse
pontscho
parents: 7387
diff changeset
93 { "OGG Vorbis files (*.ogg)", "*.ogg" },
10879
27f8546f53c4 Added Matroska file extensions to the GUI. Patch by t0nik@yandex.ru.
mosu
parents: 9202
diff changeset
94 { "WMA files (*.wma)", "*.wma" },
27f8546f53c4 Added Matroska file extensions to the GUI. Patch by t0nik@yandex.ru.
mosu
parents: 9202
diff changeset
95 { "Matroska Audio files (*.mka)", "*.mka" },
27f8546f53c4 Added Matroska file extensions to the GUI. Patch by t0nik@yandex.ru.
mosu
parents: 9202
diff changeset
96 { "Audio files", "*.ogg,*.mp2,*.mp3,*.wav,*.wma,*.mka" },
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
97 { "All files", "*" },
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
98 { NULL, NULL }
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
99 };
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
100 int fsLastAudioFilterSelected = -1;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
101
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
102 char * fsFontFileNames[][2] =
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
103 {
7139
dd1e21e775b6 - add freetype support for gui
pontscho
parents: 7019
diff changeset
104 #ifdef HAVE_FREETYPE
9195
bb4ae7a49e33 add Type1 and fix one 10l
pontscho
parents: 9192
diff changeset
105 { "True Type fonts (*.ttf)", "*.ttf" },
bb4ae7a49e33 add Type1 and fix one 10l
pontscho
parents: 9192
diff changeset
106 { "Type1 fonts (*.pfb)", "*.pfb" },
bb4ae7a49e33 add Type1 and fix one 10l
pontscho
parents: 9192
diff changeset
107 { "All fonts", "*.ttf,*.pfb" },
7139
dd1e21e775b6 - add freetype support for gui
pontscho
parents: 7019
diff changeset
108 #else
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
109 { "font files (*.desc)", "*.desc" },
7139
dd1e21e775b6 - add freetype support for gui
pontscho
parents: 7019
diff changeset
110 #endif
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
111 { "All files", "*" },
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
112 { NULL,NULL }
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
113 };
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
114 int fsLastFontFilterSelected = -1;
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
115
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
116 GtkWidget * fsFileNamesList;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
117 GtkWidget * fsFNameList;
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
118 GtkWidget * fsFileSelect = NULL;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
119 GdkColormap * fsColorMap;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
120 GtkWidget * fsOk;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
121 GtkWidget * fsUp;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
122 GtkWidget * fsCancel;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
123 GtkWidget * fsCombo4;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
124 GtkWidget * fsPathCombo;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
125 GList * fsList_items = NULL;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
126 GList * fsTopList_items = NULL;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
127 GtkWidget * List;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
128 GtkWidget * fsFilterCombo;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
129
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
130 GtkStyle * style;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
131 GdkPixmap * dpixmap;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
132 GdkPixmap * fpixmap;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
133 GdkBitmap * dmask;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
134 GdkBitmap * fmask;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
135
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
136 static char * Filter( char * name )
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
137 {
7387
072a85aa31c6 Can't return pointer to automatic C array, gmplayer file selector box does
jkeil
parents: 7237
diff changeset
138 static char tmp[32];
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
139 int i,c;
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
140 for ( i=0,c=0;i < strlen( name );i++ )
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
141 {
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
142 if ( ( name[i] >='a' )&&( name[i] <= 'z' ) ) { tmp[c++]='['; tmp[c++]=name[i]; tmp[c++]=name[i] - 32; tmp[c++]=']'; }
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
143 else tmp[c++]=name[i];
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
144 }
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
145 tmp[c]=0;
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
146 return tmp;
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
147 }
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
148
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
149 void CheckDir( GtkWidget * list,char * directory )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
150 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
151 struct stat fs;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
152 int i,c=2;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
153 gchar * str[1][2];
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
154 GdkPixmap * pixmap;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
155 GdkBitmap * mask;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
156 glob_t gg;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
157
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
158 if ( !fsFilter[0] ) return;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
159
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
160 gtk_widget_hide( list );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
161 gtk_clist_clear( GTK_CLIST( list ) );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
162 str[0][0]=NULL;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
163
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
164 pixmap=dpixmap; mask=dmask;
8980
pontscho
parents: 8719
diff changeset
165 str[0][0]=NULL;
pontscho
parents: 8719
diff changeset
166 str[0][1]="."; gtk_clist_append( GTK_CLIST( list ),str[0] ); gtk_clist_set_pixmap( GTK_CLIST( list ),0,0,pixmap,mask );
pontscho
parents: 8719
diff changeset
167 str[0][1]=".."; gtk_clist_append( GTK_CLIST( list ),str[0] ); gtk_clist_set_pixmap( GTK_CLIST( list ),1,0,pixmap,mask );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
168
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
169 glob( "*",0,NULL,&gg );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
170 // glob( ".*",GLOB_NOSORT | GLOB_APPEND,NULL,&gg );
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
171 for( i=0;(unsigned)i<gg.gl_pathc;i++ )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
172 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
173 stat( gg.gl_pathv[i],&fs );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
174 if( !S_ISDIR( fs.st_mode ) ) continue;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
175
8980
pontscho
parents: 8719
diff changeset
176 str[0][1]=gg.gl_pathv[i];
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
177 pixmap=dpixmap; mask=dmask;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
178 gtk_clist_append( GTK_CLIST( list ),str[0] );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
179 gtk_clist_set_pixmap( GTK_CLIST( list ),c++,0,pixmap,mask );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
180 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
181 globfree( &gg );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
182
5786
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
183 if ( strchr( fsFilter,',' ) )
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
184 {
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
185 char tmp[8];
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
186 int i,c,glob_param = 0;
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
187 //printf( "sub item detected.\n" );
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
188 for ( i=0,c=0;i<(int)strlen( fsFilter ) + 1;i++,c++ )
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
189 {
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
190 tmp[c]=fsFilter[i];
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
191 if ( ( tmp[c] == ',' )||( tmp[c] == '\0' ) )
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
192 {
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
193 tmp[c]=0; c=-1;
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
194 // printf( "substr: %s\n",tmp );
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
195 glob( Filter( tmp ),glob_param,NULL,&gg );
5786
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
196 glob_param=GLOB_APPEND;
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
197 }
a0e8ae26de14 add multiple filter types
pontscho
parents: 4846
diff changeset
198 }
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
199 } else glob( Filter( fsFilter ),0,NULL,&gg );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
200
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
201 #if 0
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
202 if ( !strcmp( fsFilter,"*" ) )
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
203 {
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
204 char * f = strdup( fsFilter );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
205 int i;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
206 for( i=0;i<strlen( f );i++ )
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
207 if ( ( f[i] >= 'A' )&&( f[i] <= 'Z' ) ) f[i]+=32;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
208 glob( f,GLOB_APPEND,NULL,&gg );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
209
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
210 for( i=0;i<strlen( f );i++ )
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
211 if ( ( f[i] >= 'a' )&&( f[i] <= 'z' ) ) f[i]-=32;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
212 glob( f,GLOB_APPEND,NULL,&gg );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
213 free( f );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
214 }
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
215 #endif
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
216
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
217 // glob( ".*",GLOB_NOSORT | GLOB_APPEND,NULL,&gg );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
218 pixmap=fpixmap; mask=fmask;
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
219 for( i=0;(unsigned)i<gg.gl_pathc;i++ )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
220 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
221 stat( gg.gl_pathv[i],&fs );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
222 if( S_ISDIR( fs.st_mode ) ) continue;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
223
8980
pontscho
parents: 8719
diff changeset
224 str[0][1]=gg.gl_pathv[i];
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
225 gtk_clist_append( GTK_CLIST( list ),str[0] );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
226 gtk_clist_set_pixmap( GTK_CLIST( list ),c++,0,pixmap,mask );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
227 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
228 globfree( &gg );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
229
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
230 gtk_clist_set_column_width( GTK_CLIST( list ),0,17 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
231 gtk_clist_select_row( GTK_CLIST( list ),0,1 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
232 gtk_widget_show( list );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
233 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
234
9192
c167de07f81d save only video files place
pontscho
parents: 9190
diff changeset
235 void fs_PersistantHistory( char *subject ); /* forward declaration */
9190
aa55f2f0b057 commit Dominik Mierzejewski's patch
pontscho
parents: 9088
diff changeset
236
6622
da08877b9512 fix window hiding bug with some wms (kde, gnome, icewm, mwm, wmaker)
pontscho
parents: 6146
diff changeset
237 void ShowFileSelect( int type,int modal )
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
238 {
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
239 int i, k;
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
240 char * tmp = NULL;
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
241
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
242 if ( fsFileSelect ) gtkActive( fsFileSelect );
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
243 else fsFileSelect=create_FileSelect();
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
244
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
245 fsType=type;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
246 switch ( type )
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
247 {
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
248 case fsVideoSelector:
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
249 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
250 fsList_items=NULL;
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
251 for( i=0;fsVideoFilterNames[i][0];i++ )
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
252 fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] );
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
253 k = fsLastVideoFilterSelected;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
254 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
255 g_list_free( fsList_items );
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
256 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[k >= 0 ? k : i-2][0] );
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
257 tmp=guiIntfStruct.Filename;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
258 break;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
259 case fsSubtitleSelector:
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
260 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
261 fsList_items=NULL;
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
262 for( i=0;fsSubtitleFilterNames[i][0];i++ )
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
263 fsList_items=g_list_append( fsList_items,fsSubtitleFilterNames[i][0] );
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
264 k = fsLastSubtitleFilterSelected;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
265 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
266 g_list_free( fsList_items );
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
267 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[k >= 0 ? k : i-2][0] );
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
268 tmp=guiIntfStruct.Subtitlename;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
269 break;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
270 case fsOtherSelector:
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
271 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
272 fsList_items=NULL;
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
273 for( i=0;fsOtherFilterNames[i][0];i++ )
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
274 fsList_items=g_list_append( fsList_items,fsOtherFilterNames[i][0] );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
275 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
276 g_list_free( fsList_items );
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
277 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsOtherFilterNames[0][0] );
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
278 tmp=guiIntfStruct.Othername;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
279 break;
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
280 case fsAudioSelector:
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
281 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_AudioFileSelect );
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
282 fsList_items=NULL;
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
283 for( i=0;fsAudioFileNames[i][0];i++ )
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
284 fsList_items=g_list_append( fsList_items,fsAudioFileNames[i][0] );
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
285 k = fsLastAudioFilterSelected;
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
286 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
287 g_list_free( fsList_items );
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
288 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsAudioFileNames[k >= 0 ? k : i-2][0] );
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
289 tmp=guiIntfStruct.AudioFile;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
290 break;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
291 case fsFontSelector:
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
292 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FontSelect );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
293 fsList_items=NULL;
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
294 for( i=0;fsFontFileNames[i][0];i++ )
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
295 fsList_items=g_list_append( fsList_items,fsFontFileNames[i][0] );
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
296 k = fsLastFontFilterSelected;
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
297 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
298 g_list_free( fsList_items );
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
299 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsFontFileNames[k >= 0 ? k : i-2][0] );
7019
e37a67d5e117 fix (?) cmd line handling
pontscho
parents: 6912
diff changeset
300 tmp=font_name;
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
301 break;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
302 }
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
303
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
304 if ( tmp && tmp[0] )
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
305 {
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
306 struct stat f;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
307 char * dir = strdup( tmp );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
308
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
309 do
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
310 {
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
311 char * c = strrchr( dir,'/' );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
312 stat( dir,&f );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
313 if ( S_ISDIR( f.st_mode ) ) break;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
314 if ( c ) *c=0;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
315 } while ( strrchr( dir,'/' ) );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
316
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
317 if ( dir[0] ) chdir( dir );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
318
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
319 free( dir );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
320 }
6622
da08877b9512 fix window hiding bug with some wms (kde, gnome, icewm, mwm, wmaker)
pontscho
parents: 6146
diff changeset
321
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
322 if ( fsTopList_items ) g_list_free( fsTopList_items ); fsTopList_items=NULL;
8713
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
323 {
9055
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8980
diff changeset
324 char * hist;
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8980
diff changeset
325 int i, c = 1;
8713
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
326
9195
bb4ae7a49e33 add Type1 and fix one 10l
pontscho
parents: 9192
diff changeset
327 if ( fsType == fsVideoSelector )
bb4ae7a49e33 add Type1 and fix one 10l
pontscho
parents: 9192
diff changeset
328 {
bb4ae7a49e33 add Type1 and fix one 10l
pontscho
parents: 9192
diff changeset
329 for ( i=0;i < fsPersistant_MaxPos;i++ )
bb4ae7a49e33 add Type1 and fix one 10l
pontscho
parents: 9192
diff changeset
330 if ( fsHistory[i] ) { fsTopList_items=g_list_append( fsTopList_items,fsHistory[i] ); c=0; }
bb4ae7a49e33 add Type1 and fix one 10l
pontscho
parents: 9192
diff changeset
331 }
9055
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8980
diff changeset
332 if ( c ) fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name() );
8713
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
333 }
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
334 if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
335 fsTopList_items=g_list_append( fsTopList_items,"/home" );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
336 fsTopList_items=g_list_append( fsTopList_items,"/mnt" );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
337 fsTopList_items=g_list_append( fsTopList_items,"/" );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
338 gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
339
6622
da08877b9512 fix window hiding bug with some wms (kde, gnome, icewm, mwm, wmaker)
pontscho
parents: 6146
diff changeset
340 gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal );
da08877b9512 fix window hiding bug with some wms (kde, gnome, icewm, mwm, wmaker)
pontscho
parents: 6146
diff changeset
341
6903
c2d4100c964e - fix mixer handling
pontscho
parents: 6854
diff changeset
342 gtk_widget_show( fsFileSelect );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
343 }
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
344
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
345 void HideFileSelect( void )
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
346 {
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
347 if ( !fsFileSelect ) return;
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
348 gtk_widget_hide( fsFileSelect );
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
349 gtk_widget_destroy( fsFileSelect );
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
350 fsFileSelect=NULL;
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
351 }
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
352
9192
c167de07f81d save only video files place
pontscho
parents: 9190
diff changeset
353 void fs_PersistantHistory( char * subject )
9055
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8980
diff changeset
354 {
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8980
diff changeset
355 int i;
8713
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
356
9192
c167de07f81d save only video files place
pontscho
parents: 9190
diff changeset
357 if ( fsType != fsVideoSelector ) return;
c167de07f81d save only video files place
pontscho
parents: 9190
diff changeset
358
9056
3086611e8213 - add subcp
pontscho
parents: 9055
diff changeset
359 for ( i=0;i < fsPersistant_MaxPos;i++ )
3086611e8213 - add subcp
pontscho
parents: 9055
diff changeset
360 if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) )
3086611e8213 - add subcp
pontscho
parents: 9055
diff changeset
361 {
3086611e8213 - add subcp
pontscho
parents: 9055
diff changeset
362 char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp;
9192
c167de07f81d save only video files place
pontscho
parents: 9190
diff changeset
363 return;
9056
3086611e8213 - add subcp
pontscho
parents: 9055
diff changeset
364 }
9055
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8980
diff changeset
365 gfree( (void **)&fsHistory[fsPersistant_MaxPos - 1] );
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8980
diff changeset
366 for ( i=fsPersistant_MaxPos - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1];
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8980
diff changeset
367 fsHistory[0]=gstrdup( subject );
8713
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
368 }
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
369 //-----------------------------------------------
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
370
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
371 void fs_fsFilterCombo_activate( GtkEditable * editable,gpointer user_data )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
372 {
7540
2a1766fec13e fix filter handling bug
pontscho
parents: 7539
diff changeset
373 fsFilter=gtk_entry_get_text( GTK_ENTRY( user_data ) );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
374 CheckDir( fsFNameList,get_current_dir_name() );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
375 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
376
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
377 void fs_fsFilterCombo_changed( GtkEditable * editable,gpointer user_data )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
378 {
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
379 char * str;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
380 int i;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
381
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
382 str=gtk_entry_get_text( GTK_ENTRY(user_data ) );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
383
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
384 switch ( fsType )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
385 {
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
386 case fsVideoSelector:
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
387 for( i=0;fsVideoFilterNames[i][0];i++ )
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
388 if( !strcmp( str,fsVideoFilterNames[i][0] ) )
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
389 { fsFilter=fsVideoFilterNames[i][1]; fsLastVideoFilterSelected = i; break; }
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
390 break;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
391 case fsSubtitleSelector:
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
392 for( i=0;fsSubtitleFilterNames[i][0];i++ )
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
393 if( !strcmp( str,fsSubtitleFilterNames[i][0] ) )
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
394 { fsFilter=fsSubtitleFilterNames[i][1]; fsLastSubtitleFilterSelected = i; break; }
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
395 break;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
396 case fsOtherSelector:
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
397 for( i=0;fsOtherFilterNames[i][0];i++ )
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
398 if( !strcmp( str,fsOtherFilterNames[i][0] ) )
7540
2a1766fec13e fix filter handling bug
pontscho
parents: 7539
diff changeset
399 { fsFilter=fsOtherFilterNames[i][1]; break; }
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
400 break;
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
401 case fsAudioSelector:
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
402 for( i=0;fsAudioFileNames[i][0];i++ )
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
403 if( !strcmp( str,fsAudioFileNames[i][0] ) )
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
404 { fsFilter=fsAudioFileNames[i][1]; fsLastAudioFilterSelected = i; break; }
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
405 break;
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
406 case fsFontSelector:
7203
69cc665855dc - add None to audio/video family selection
pontscho
parents: 7150
diff changeset
407 for( i=0;fsFontFileNames[i][0];i++ )
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
408 if( !strcmp( str,fsFontFileNames[i][0] ) )
13570
a3c3b27d3fb2 File filter dropdown box value is now preserved between dialog invocations.
diego
parents: 11569
diff changeset
409 { fsFilter=fsFontFileNames[i][1]; fsLastFontFilterSelected = i; break; }
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
410 break;
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
411 default: return;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
412 }
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
413 CheckDir( fsFNameList,get_current_dir_name() );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
414 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
415
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
416 void fs_fsPathCombo_activate( GtkEditable * editable,gpointer user_data )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
417 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
418 unsigned char * str;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
419
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
420 str=gtk_entry_get_text( GTK_ENTRY( user_data ) );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
421 if ( chdir( str ) != -1 ) CheckDir( fsFNameList,get_current_dir_name() );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
422 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
423
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
424 void fs_fsPathCombo_changed( GtkEditable * editable,gpointer user_data )
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
425 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
426 unsigned char * str;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
427
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
428 str=gtk_entry_get_text( GTK_ENTRY( user_data ) );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
429 fsPressed=2;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
430 if ( chdir( str ) != -1 ) CheckDir( fsFNameList,get_current_dir_name() );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
431 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
432
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
433 void fs_Up_released( GtkButton * button,gpointer user_data )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
434 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
435 chdir( ".." );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
436 fsSelectedFile=fsThatDir;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
437 CheckDir( fsFNameList,get_current_dir_name() );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
438 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name() );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
439 return;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
440 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
441
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
442 int fsFileExist( unsigned char * fname )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
443 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
444 FILE * f = fopen( fname,"r" );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
445 if ( f == NULL ) return 0;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
446 fclose( f );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
447 return 1;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
448 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
449
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
450 void fs_Ok_released( GtkButton * button,gpointer user_data )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
451 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
452 unsigned char * str;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
453 GList * item;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
454 int size,j,i = 1;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
455 struct stat fs;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
456
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
457 stat( fsSelectedFile,&fs );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
458 if( S_ISDIR(fs.st_mode ) )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
459 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
460 chdir( fsSelectedFile );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
461 fsSelectedFile=fsThatDir;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
462 CheckDir( fsFNameList,get_current_dir_name() );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
463 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name() );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
464 return;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
465 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
466
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
467 switch( fsPressed )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
468 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
469 case 1:
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
470 fsSelectedDirectory=(unsigned char *)get_current_dir_name();
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
471 break;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
472 case 2:
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
473 str=gtk_entry_get_text( GTK_ENTRY( fsPathCombo ) );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
474 fsSelectedFile=str;
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
475 if ( !fsFileExist( fsSelectedFile ) ) { HideFileSelect(); return; }
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
476 fsSelectedDirectory=fsSelectedFile;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
477 size=strlen( fsSelectedDirectory );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
478 for ( j=0;j<size;j++ )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
479 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
480 if ( fsSelectedDirectory[ size - j ] == '/' )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
481 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
482 fsSelectedFile+=size - j + 1;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
483 fsSelectedDirectory[ size - j ]=0;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
484 break;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
485 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
486 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
487 break;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
488 }
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
489 switch ( fsType )
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
490 {
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
491 case fsVideoSelector:
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
492 guiSetDF( guiIntfStruct.Filename,fsSelectedDirectory,fsSelectedFile );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
493 guiIntfStruct.StreamType=STREAMTYPE_FILE;
9088
731e5dc57436 - fix -fs
pontscho
parents: 9056
diff changeset
494 guiIntfStruct.FilenameChanged=1; sub_fps=0;
6840
ed02bae611d5 - some cosmetic change in preferences
pontscho
parents: 6794
diff changeset
495 gfree( (void **)&guiIntfStruct.AudioFile );
ed02bae611d5 - some cosmetic change in preferences
pontscho
parents: 6794
diff changeset
496 gfree( (void **)&guiIntfStruct.Subtitlename );
9055
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8980
diff changeset
497 fs_PersistantHistory( fsSelectedDirectory ); //totem, write into history
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
498 break;
7150
b212f74e14ec - add play time subtitle change support
pontscho
parents: 7139
diff changeset
499 #ifdef USE_SUB
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
500 case fsSubtitleSelector:
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
501 guiSetDF( guiIntfStruct.Subtitlename,fsSelectedDirectory,fsSelectedFile );
7150
b212f74e14ec - add play time subtitle change support
pontscho
parents: 7139
diff changeset
502 guiLoadSubtitle( guiIntfStruct.Subtitlename );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
503 break;
7150
b212f74e14ec - add play time subtitle change support
pontscho
parents: 7139
diff changeset
504 #endif
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
505 case fsOtherSelector:
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
506 guiSetDF( guiIntfStruct.Othername,fsSelectedDirectory,fsSelectedFile );
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
507 break;
6623
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
508 case fsAudioSelector:
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
509 guiSetDF( guiIntfStruct.AudioFile,fsSelectedDirectory,fsSelectedFile );
7bc4c6ba9485 add -audiofile support for gui
pontscho
parents: 6622
diff changeset
510 break;
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
511 case fsFontSelector:
7019
e37a67d5e117 fix (?) cmd line handling
pontscho
parents: 6912
diff changeset
512 guiSetDF( font_name,fsSelectedDirectory,fsSelectedFile );
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
513 #if defined( USE_OSD ) || defined( USE_SUB )
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
514 guiLoadFont();
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
515 #endif
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
516 if ( Preferences ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name );
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6755
diff changeset
517 break;
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
518 }
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
519
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
520 HideFileSelect();
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
521
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
522 item=fsTopList_items;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
523 while( item )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
524 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
525 if ( !strcmp( item->data,fsSelectedDirectory ) ) i=0;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
526 item=item->next;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
527 }
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
528 if ( i ) fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name() );
6912
5ddd609550d5 - fix equ handling
pontscho
parents: 6903
diff changeset
529 if ( mplMainAutoPlay ) { mplMainAutoPlay=0; mplEventHandling( evPlay,0 ); }
9202
c2f31ca14a92 - rewrite Jan Spitalnik's patch
pontscho
parents: 9195
diff changeset
530 else guiGetEvent( guiCEvent,guiSetStop );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
531 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
532
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
533 void fs_Cancel_released( GtkButton * button,gpointer user_data )
8713
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
534 {
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
535 HideFileSelect();
9055
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8980
diff changeset
536 fs_PersistantHistory( get_current_dir_name() ); //totem, write into history file
8713
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
537 }
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
538
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
539 void fs_fsFNameList_select_row( GtkWidget * widget,gint row,gint column,GdkEventButton *bevent,gpointer user_data )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
540 {
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4779
diff changeset
541 gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
542 fsPressed=1;
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
543 if( bevent && bevent->type == GDK_BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
544 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
545
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
546 gboolean on_FileSelect_key_release_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
547 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
548 switch ( event->keyval )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
549 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
550 case GDK_Escape:
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
551 gtk_button_released( GTK_BUTTON( fsCancel ) );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
552 break;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
553 case GDK_Return:
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
554 gtk_button_released( GTK_BUTTON( fsOk ) );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
555 break;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
556 case GDK_BackSpace:
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
557 gtk_button_released( GTK_BUTTON( fsUp ) );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
558 break;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
559 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
560 return FALSE;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
561 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
562
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
563 GtkWidget * create_FileSelect( void )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
564 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
565 GtkWidget * FSFrame;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
566 GtkWidget * frame2;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
567 GtkWidget * frame3;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
568 GtkWidget * frame4;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
569 GtkWidget * vbox4;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
570 GtkWidget * hbox4;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
571 GtkWidget * vseparator1;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
572 GtkWidget * hseparator1;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
573 GtkWidget * hbox6;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
574 GtkWidget * fsFNameListWindow;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
575 GtkWidget * label1;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
576 GtkWidget * hseparator2;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
577 GtkWidget * hseparator3;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
578 GtkWidget * hbuttonbox3;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
579
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
580 GtkWidget * uppixmapwid;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
581 GdkPixmap * uppixmap;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
582 GdkBitmap * upmask;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
583 GtkStyle * upstyle;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
584
8713
d9639f835ecf persistant history path from Pavel Rousar <p.rousar@sh.cvut.cz>
pontscho
parents: 8299
diff changeset
585
4779
5c844c0d1d7f add fselector changes (pwilkins@lashwhip.com)
pontscho
parents: 3587
diff changeset
586 fsFileSelect=gtk_window_new( GTK_WINDOW_TOPLEVEL );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
587 gtk_widget_set_name( fsFileSelect,"fsFileSelect" );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
588 gtk_object_set_data( GTK_OBJECT( fsFileSelect ),"fsFileSelect",fsFileSelect );
4779
5c844c0d1d7f add fselector changes (pwilkins@lashwhip.com)
pontscho
parents: 3587
diff changeset
589 gtk_widget_set_usize( fsFileSelect,512,300 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
590 GTK_WIDGET_SET_FLAGS( fsFileSelect,GTK_CAN_DEFAULT );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
591 gtk_widget_set_events( fsFileSelect,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
592 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
593 gtk_window_set_position( GTK_WINDOW( fsFileSelect ),GTK_WIN_POS_CENTER );
4779
5c844c0d1d7f add fselector changes (pwilkins@lashwhip.com)
pontscho
parents: 3587
diff changeset
594 gtk_window_set_policy( GTK_WINDOW( fsFileSelect ),TRUE,TRUE,TRUE );
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
595 gtk_window_set_wmclass( GTK_WINDOW( fsFileSelect ),"FileSelect","MPlayer" );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
596 fsColorMap=gdk_colormap_get_system();
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6625
diff changeset
597
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6625
diff changeset
598 gtk_widget_realize( fsFileSelect );
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6625
diff changeset
599 gtkAddIcon( fsFileSelect );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
600
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
601 style=gtk_widget_get_style( fsFileSelect );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
602 dpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&dmask,&style->bg[GTK_STATE_NORMAL],(gchar **)dir_xpm );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
603 fpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&fmask,&style->bg[GTK_STATE_NORMAL],(gchar **)file_xpm );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
604
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
605 vbox4=AddVBox( AddDialogFrame( fsFileSelect ),0 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
606 hbox4=AddHBox( vbox4,1 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
607
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
608 fsCombo4=gtk_combo_new();
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
609 gtk_widget_set_name( fsCombo4,"fsCombo4" );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
610 gtk_widget_show( fsCombo4 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
611 gtk_box_pack_start( GTK_BOX( hbox4 ),fsCombo4,TRUE,TRUE,0 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
612 gtk_widget_set_usize( fsCombo4,-2,20 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
613
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
614 fsPathCombo=GTK_COMBO( fsCombo4 )->entry;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
615 gtk_widget_set_name( fsPathCombo,"fsPathCombo" );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
616 gtk_widget_show( fsPathCombo );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
617 gtk_widget_set_usize( fsPathCombo,-2,20 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
618
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
619 vseparator1=gtk_vseparator_new();
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
620 gtk_widget_set_name( vseparator1,"vseparator1" );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
621 gtk_widget_show( vseparator1 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
622 gtk_box_pack_start( GTK_BOX( hbox4 ),vseparator1,FALSE,TRUE,0 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
623 gtk_widget_set_usize( vseparator1,7,20 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
624
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
625 upstyle=gtk_widget_get_style( fsFileSelect );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
626 uppixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&upmask,&upstyle->bg[GTK_STATE_NORMAL],(gchar **)up_xpm );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
627 uppixmapwid=gtk_pixmap_new( uppixmap,upmask );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
628 gtk_widget_show( uppixmapwid );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
629
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
630 fsUp=gtk_button_new();
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
631 gtk_container_add( GTK_CONTAINER(fsUp ),uppixmapwid );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
632 gtk_widget_show( fsUp );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
633 gtk_box_pack_start( GTK_BOX( hbox4 ),fsUp,FALSE,FALSE,0 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
634 gtk_widget_set_usize( fsUp,65,15 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
635
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
636 AddHSeparator( vbox4 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
637
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
638 hbox6=AddHBox( NULL,0 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
639 gtk_box_pack_start( GTK_BOX( vbox4 ),hbox6,TRUE,TRUE,0 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
640
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
641 fsFNameListWindow=gtk_scrolled_window_new( NULL,NULL );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
642 gtk_widget_set_name( fsFNameListWindow,"fsFNameListWindow" );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
643 gtk_widget_show( fsFNameListWindow );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
644 gtk_box_pack_start( GTK_BOX( hbox6 ),fsFNameListWindow,TRUE,TRUE,0 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
645 gtk_widget_set_usize( fsFNameListWindow,-2,145 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
646 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( fsFNameListWindow ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
647
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
648 fsFNameList=gtk_clist_new( 2 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
649 gtk_widget_set_name( fsFNameList,"fsFNameList" );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
650 gtk_container_add( GTK_CONTAINER( fsFNameListWindow ),fsFNameList );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
651 gtk_clist_set_column_width( GTK_CLIST( fsFNameList ),0,80 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
652 gtk_clist_set_selection_mode( GTK_CLIST( fsFNameList ),GTK_SELECTION_BROWSE );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
653 gtk_clist_column_titles_hide( GTK_CLIST( fsFNameList ) );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
654 gtk_clist_set_shadow_type( GTK_CLIST( fsFNameList ),GTK_SHADOW_ETCHED_OUT );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
655
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
656 AddHSeparator( vbox4 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
657
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
658 List=gtk_combo_new();
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
659 gtk_widget_set_name( List,"List" );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
660 gtk_widget_ref( List );
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
661 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"List",List,(GtkDestroyNotify)gtk_widget_unref );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
662 gtk_widget_show( List );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
663 gtk_box_pack_start( GTK_BOX( vbox4 ),List,FALSE,FALSE,0 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
664 gtk_widget_set_usize( List,-2,20 );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
665
3499
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
666 fsFilterCombo=GTK_COMBO( List )->entry;
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
667 gtk_widget_set_name( fsFilterCombo,"fsFilterCombo" );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
668 gtk_widget_show( fsFilterCombo );
93351eec9f1f Add subtitle loader for gui
pontscho
parents: 3054
diff changeset
669 gtk_entry_set_editable (GTK_ENTRY( fsFilterCombo ),FALSE );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
670
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
671 AddHSeparator( vbox4 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
672
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
673 hbuttonbox3=AddHButtonBox( vbox4 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
674 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox3 ),GTK_BUTTONBOX_END );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
675 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox3 ),10 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
676
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
677 fsOk=AddButton( MSGTR_Ok,hbuttonbox3 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
678 fsCancel=AddButton( MSGTR_Cancel,hbuttonbox3 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
679
8719
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8713
diff changeset
680 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&fsFileSelect );
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
681 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL );
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
682
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
683 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsFilterCombo_changed ),fsFilterCombo );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
684 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsFilterCombo_activate ),fsFilterCombo );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
685 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsPathCombo_changed ),fsPathCombo );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
686 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsPathCombo_activate ),fsPathCombo );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
687 gtk_signal_connect( GTK_OBJECT( fsUp ),"released",GTK_SIGNAL_FUNC( fs_Up_released ),fsFNameList );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
688 gtk_signal_connect( GTK_OBJECT( fsOk ),"released",GTK_SIGNAL_FUNC( fs_Ok_released ),fsCombo4 );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
689 gtk_signal_connect( GTK_OBJECT( fsCancel ),"released",GTK_SIGNAL_FUNC( fs_Cancel_released ),NULL );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 5786
diff changeset
690 gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",(GtkSignalFunc)fs_fsFNameList_select_row,NULL );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
691
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
692 gtk_widget_grab_focus( fsFNameList );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
693
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
694 return fsFileSelect;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
695 }
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
696