]> git.sesse.net Git - vlc/blob - modules/gui/macosx/macosx.m
b78676025161d24df157885930d57568faab2359
[vlc] / modules / gui / macosx / macosx.m
1 /*****************************************************************************
2  * macosx.m: Mac OS X module for vlc
3  *****************************************************************************
4  * Copyright (C) 2001-2014 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Authors: Felix Paul Kühne <fkuehne at videolan dot org>
8  *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 /*****************************************************************************
26  * Preamble
27  *****************************************************************************/
28 #include <stdlib.h>                                      /* malloc(), free() */
29
30 #ifdef HAVE_CONFIG_H
31 # include "config.h"
32 #endif
33
34 #include <vlc_common.h>
35 #include <vlc_plugin.h>
36 #include <vlc_vout_window.h>
37
38 /*****************************************************************************
39  * External prototypes
40  *****************************************************************************/
41 int  OpenIntf     (vlc_object_t *);
42 void CloseIntf    (vlc_object_t *);
43
44 int  WindowOpen   (vout_window_t *, const vout_window_cfg_t *);
45 void WindowClose  (vout_window_t *);
46
47 /*****************************************************************************
48  * Module descriptor
49  *****************************************************************************/
50 #define VDEV_TEXT N_("Video device")
51 #define VDEV_LONGTEXT N_("Number of the screen to use by default to display " \
52                          "videos in 'fullscreen'. The screen number correspondance can be found in "\
53                          "the video device selection menu.")
54
55 #define OPAQUENESS_TEXT N_("Opaqueness")
56 #define OPAQUENESS_LONGTEXT N_("Set the transparency of the video output. 1 is non-transparent (default) " \
57                                 "0 is fully transparent.")
58
59 #define BLACK_TEXT N_("Black screens in fullscreen")
60 #define BLACK_LONGTEXT N_("In fullscreen mode, keep screen where there is no " \
61                           "video displayed black")
62
63 #define FSPANEL_TEXT N_("Show Fullscreen controller")
64 #define FSPANEL_LONGTEXT N_("Shows a lucent controller when moving the mouse " \
65                             "in fullscreen mode.")
66
67 #define AUTOPLAY_OSX_TEST N_("Auto-playback of new items")
68 #define AUTOPLAY_OSX_LONGTEXT N_("Start playback of new items immediately " \
69                                  "once they were added.")
70
71 #define RECENT_ITEMS_TEXT N_("Keep Recent Items")
72 #define RECENT_ITEMS_LONGTEXT N_("By default, VLC keeps a list of the last 10 items. " \
73                                  "This feature can be disabled here.")
74
75 #define USE_APPLE_REMOTE_TEXT N_("Control playback with the Apple Remote")
76 #define USE_APPLE_REMOTE_LONGTEXT N_("By default, VLC can be remotely controlled with the Apple Remote.")
77
78 #define USE_APPLE_REMOTE_VOLUME_TEXT N_("Control system volume with the Apple Remote")
79 #define USE_APPLE_REMOTE_VOLUME_LONGTEXT N_("By default, VLC will control its own volume with the Apple Remote. However, you can choose to control the global system volume instead.")
80
81 #define USE_APPLE_REMOTE_PREVNEXT_TEXT N_("Control playlist items with the Apple Remote")
82 #define USE_APPLE_REMOTE_PREVNEXT_LONGTEXT N_("By default, VLC will allow you to switch to the next or previous item with the Apple Remote. You can disable this behavior with this option.")
83
84 #define USE_MEDIAKEYS_TEXT N_("Control playback with media keys")
85 #define USE_MEDIAKEYS_LONGTEXT N_("By default, VLC can be controlled using the media keys on modern Apple " \
86                                   "keyboards.")
87
88 #define INTERFACE_STYLE_TEXT N_("Run VLC with dark interface style")
89 #define INTERFACE_STYLE_LONGTEXT N_("If this option is enabled, VLC will use the dark interface style. Otherwise, the grey interface style is used.")
90
91 #define NATIVE_FULLSCREEN_MODE_ON_LION_TEXT N_("Use the native fullscreen mode")
92 #define NATIVE_FULLSCREEN_MODE_ON_LION_LONGTEXT N_("By default, VLC uses the fullscreen mode known from previous Mac OS X releases. It can also use the native fullscreen mode on Mac OS X 10.7 and later.")
93
94 #define KEEPSIZE_TEXT N_("Resize interface to the native video size")
95 #define KEEPSIZE_LONGTEXT N_("You have two choices:\n" \
96 " - The interface will resize to the native video size\n" \
97 " - The video will fit to the interface size\n " \
98 "By default, interface resize to the native video size.")
99
100 #define PAUSE_MINIMIZED_TEXT N_("Pause the video playback when minimized")
101 #define PAUSE_MINIMIZED_LONGTEXT N_(\
102 "With this option enabled, the playback will be automatically paused when minimizing the window.")
103
104 #define ICONCHANGE_TEXT N_("Allow automatic icon changes")
105 #define ICONCHANGE_LONGTEXT N_("This option allows the interface to change its icon on various occasions.")
106
107 #define LOCK_ASPECT_RATIO_TEXT N_("Lock Aspect Ratio")
108
109 #define JUMPBUTTONS_TEXT N_("Show Previous & Next Buttons")
110 #define JUMPBUTTONS_LONGTEXT N_("Shows the previous and next buttons in the main window.")
111
112 #define PLAYMODEBUTTONS_TEXT N_("Show Shuffle & Repeat Buttons")
113 #define PLAYMODEBUTTONS_LONGTEXT N_("Shows the shuffle and repeat buttons in the main window.")
114
115 #define EFFECTSBUTTON_TEXT N_("Show Audio Effects Button")
116 #define EFFECTSBUTTON_LONGTEXT N_("Shows the audio effects button in the main window.")
117
118 #define SIDEBAR_TEXT N_("Show Sidebar")
119 #define SIDEBAR_LONGTEXT N_("Shows a sidebar in the main window listing media sources.")
120
121 #define ITUNES_TEXT N_("Control external music players")
122 #define ITUNES_LONGTEXT N_("VLC will pause and resume supported music players on playback.")
123
124 #define LARGE_LISTFONT_TEXT N_("Use large text for list views")
125
126 static const int itunes_list[] =
127     { 0, 1, 2 };
128 static const char *const itunes_list_text[] = {
129     N_("Do nothing"), N_("Pause iTunes / Spotify"), N_("Pause and resume iTunes / Spotify")
130 };
131
132 #define CONTINUE_PLAYBACK_TEXT N_("Continue playback where you left off")
133 #define CONTINUE_PLAYBACK_LONGTEXT N_("VLC will store playback positions of the last 30 items you played. If you re-open one of those, playback will continue.")
134
135 static const int continue_playback_list[] =
136 { 0, 1, 2 };
137 static const char *const continue_playback_list_text[] = {
138     N_("Ask"), N_("Always"), N_("Never")
139 };
140
141 #define VOLUME_MAX_TEXT N_("Maximum Volume displayed")
142
143
144 vlc_module_begin()
145     set_description(N_("Mac OS X interface"))
146     set_capability("interface", 200)
147     set_callbacks(OpenIntf, NULL)
148     set_category(CAT_INTERFACE)
149     set_subcategory(SUBCAT_INTERFACE_MAIN)
150     cannot_unload_broken_library()
151
152     set_section(N_("Appearance"), 0)
153         add_bool("macosx-interfacestyle", false, INTERFACE_STYLE_TEXT, INTERFACE_STYLE_LONGTEXT, false)
154         add_bool("macosx-nativefullscreenmode", false, NATIVE_FULLSCREEN_MODE_ON_LION_TEXT, NATIVE_FULLSCREEN_MODE_ON_LION_LONGTEXT, false)
155         add_bool("macosx-icon-change", true, ICONCHANGE_TEXT, ICONCHANGE_LONGTEXT, true)
156         add_bool("macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, JUMPBUTTONS_LONGTEXT, false)
157         add_bool("macosx-show-playmode-buttons", false, PLAYMODEBUTTONS_TEXT, PLAYMODEBUTTONS_LONGTEXT, false)
158         add_bool("macosx-show-effects-button", false, EFFECTSBUTTON_TEXT, EFFECTSBUTTON_LONGTEXT, false)
159         add_bool("macosx-show-sidebar", true, SIDEBAR_TEXT, SIDEBAR_LONGTEXT, false)
160         add_integer_with_range("macosx-max-volume", 125, 60, 200, VOLUME_MAX_TEXT, VOLUME_MAX_TEXT, true)
161         add_bool("macosx-large-text", false, LARGE_LISTFONT_TEXT, LARGE_LISTFONT_TEXT, false)
162
163     set_section(N_("Behavior"), 0)
164         add_bool("macosx-autoplay", true, AUTOPLAY_OSX_TEST, AUTOPLAY_OSX_LONGTEXT, false)
165         add_bool("macosx-recentitems", true, RECENT_ITEMS_TEXT, RECENT_ITEMS_LONGTEXT, false)
166         add_bool("macosx-fspanel", true, FSPANEL_TEXT, FSPANEL_LONGTEXT, false)
167         add_bool("macosx-video-autoresize", true, KEEPSIZE_TEXT, KEEPSIZE_LONGTEXT, false)
168         add_bool("macosx-pause-minimized", false, PAUSE_MINIMIZED_TEXT, PAUSE_MINIMIZED_LONGTEXT, false)
169         add_bool("macosx-lock-aspect-ratio", true, LOCK_ASPECT_RATIO_TEXT, LOCK_ASPECT_RATIO_TEXT, true)
170         add_integer("macosx-control-itunes", 1, ITUNES_TEXT, ITUNES_LONGTEXT, false)
171         change_integer_list(itunes_list, itunes_list_text)
172         add_integer("macosx-continue-playback", 0, CONTINUE_PLAYBACK_TEXT, CONTINUE_PLAYBACK_LONGTEXT, false)
173         change_integer_list(continue_playback_list, continue_playback_list_text)
174
175     set_section(N_("Apple Remote and media keys"), 0)
176         add_bool("macosx-appleremote", true, USE_APPLE_REMOTE_TEXT, USE_APPLE_REMOTE_LONGTEXT, false)
177         add_bool("macosx-appleremote-sysvol", false, USE_APPLE_REMOTE_VOLUME_TEXT, USE_APPLE_REMOTE_VOLUME_LONGTEXT, false)
178         add_bool("macosx-appleremote-prevnext", false, USE_APPLE_REMOTE_PREVNEXT_TEXT, USE_APPLE_REMOTE_PREVNEXT_LONGTEXT, false)
179         add_bool("macosx-mediakeys", true, USE_MEDIAKEYS_TEXT, USE_MEDIAKEYS_LONGTEXT, false)
180
181     add_obsolete_bool("macosx-stretch") /* since 2.0.0 */
182     add_obsolete_bool("macosx-eq-keep") /* since 2.0.0 */
183     add_obsolete_bool("macosx-autosave-volume") /* since 2.1.0 */
184
185     add_submodule()
186         set_description("Mac OS X Video Output Provider")
187         set_capability("vout window", 100)
188         set_callbacks(WindowOpen, WindowClose)
189
190         set_section(N_("Video output"), 0)
191         add_integer("macosx-vdev", 0, VDEV_TEXT, VDEV_LONGTEXT, false)
192         add_float_with_range("macosx-opaqueness", 1, 0, 1, OPAQUENESS_TEXT, OPAQUENESS_LONGTEXT, true);
193         add_bool("macosx-black", false, BLACK_TEXT, BLACK_LONGTEXT, false)
194 vlc_module_end()
195