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