annotate Gui/mplayer/gtk/fs.c @ 9363:6398c11b1bef

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