]> git.sesse.net Git - vlc/blob - modules/gui/win32/control.cpp
* ./modules/*: moved plugins to the new tree. Yet untested builds include
[vlc] / modules / gui / win32 / control.cpp
1 /*****************************************************************************\r
2  * control.cpp: functions to handle stream control buttons.\r
3  *****************************************************************************\r
4  * Copyright (C) 2002 VideoLAN\r
5  *\r
6  * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>\r
7  *\r
8  * This program is free software; you can redistribute it and/or modify\r
9  * it under the terms of the GNU General Public License as published by\r
10  * the Free Software Foundation; either version 2 of the License, or\r
11  * (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  *\r
18  * You should have received a copy of the GNU General Public License\r
19  * along with this program; if not, write to the Free Software\r
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.\r
21  *****************************************************************************/\r
22 \r
23 #include <vcl.h>\r
24 \r
25 #include <vlc/vlc.h>\r
26 #include <vlc/intf.h>\r
27 \r
28 #include "win32_common.h"\r
29 \r
30 extern  intf_thread_t *p_intfGlobal;\r
31 \r
32 /****************************************************************************\r
33  * Control functions: this is where the functions are defined\r
34  ****************************************************************************\r
35  * These functions are used by toolbuttons callbacks\r
36  ****************************************************************************/\r
37 bool ControlBack( TObject *Sender )\r
38 {\r
39     /* FIXME: TODO */\r
40     \r
41     return false;\r
42 }\r
43 \r
44 \r
45 bool ControlStop( TObject *Sender )\r
46 {\r
47     playlist_t * p_playlist = (playlist_t *)\r
48         vlc_object_find( p_intfGlobal, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );\r
49     if( p_playlist == NULL )\r
50     {\r
51         return false;\r
52     }\r
53 \r
54     playlist_Stop( p_playlist );\r
55     vlc_object_release( p_playlist );\r
56 \r
57     return true;\r
58 }\r
59 \r
60 \r
61 bool ControlPlay( TObject *Sender )\r
62 {\r
63     playlist_t * p_playlist = (playlist_t *)\r
64         vlc_object_find( p_intfGlobal, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );\r
65     if( p_playlist == NULL )\r
66     {\r
67         p_intfGlobal->p_sys->p_window->MenuOpenFileClick( Sender );\r
68         return false;\r
69     }\r
70 \r
71     vlc_mutex_lock( &p_playlist->object_lock );\r
72     if( p_playlist->i_size )\r
73     {\r
74         vlc_mutex_unlock( &p_playlist->object_lock );\r
75         playlist_Play( p_playlist );\r
76         vlc_object_release( p_playlist );\r
77     }\r
78     else\r
79     {\r
80         vlc_mutex_unlock( &p_playlist->object_lock );\r
81         vlc_object_release( p_playlist );\r
82         p_intfGlobal->p_sys->p_window->MenuOpenFileClick( Sender );\r
83     }\r
84 \r
85     return true;\r
86 }\r
87 \r
88 \r
89 bool ControlPause( TObject *Sender )\r
90 {\r
91     if( p_intfGlobal->p_sys->p_input != NULL )\r
92     {\r
93         input_SetStatus( p_intfGlobal->p_sys->p_input, INPUT_STATUS_PAUSE );\r
94     }\r
95 \r
96     return true;\r
97 }\r
98 \r
99 \r
100 bool ControlSlow( TObject *Sender )\r
101 {\r
102     if( p_intfGlobal->p_sys->p_input != NULL )\r
103     {\r
104         input_SetStatus( p_intfGlobal->p_sys->p_input, INPUT_STATUS_SLOWER );\r
105     }\r
106 \r
107     return true;\r
108 }\r
109 \r
110 \r
111 bool ControlFast( TObject *Sender )\r
112 {\r
113     if( p_intfGlobal->p_sys->p_input != NULL )\r
114     {\r
115         input_SetStatus( p_intfGlobal->p_sys->p_input, INPUT_STATUS_FASTER );\r
116     }\r
117 \r
118     return true;\r
119 }\r
120 \r