Commit ca80c3e8 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: added menu item and advanced option to hide the main window's sidebar

parent 16e6cbda
......@@ -21,10 +21,11 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="5132"/>
<integer value="5260"/>
<integer value="2730"/>
<integer value="4850"/>
<integer value="5238"/>
<integer value="5260"/>
<integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -57,7 +58,7 @@
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<object class="NSView" key="NSWindowView" id="429932428">
<nil key="NSNextResponder"/>
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -193,6 +194,7 @@
</object>
<string key="NSFrame">{{1, 1}, {199, 272}}</string>
<reference key="NSSuperview" ref="979766179"/>
<reference key="NSNextKeyView" ref="1064884668"/>
<reference key="NSDocView" ref="1064884668"/>
<reference key="NSBGColor" ref="885475112"/>
<int key="NScvFlags">4</int>
......@@ -219,6 +221,7 @@
</object>
<string key="NSFrameSize">{201, 274}</string>
<reference key="NSSuperview" ref="824340487"/>
<reference key="NSNextKeyView" ref="18556274"/>
<int key="NSsFlags">133650</int>
<reference key="NSVScroller" ref="252983915"/>
<reference key="NSHScroller" ref="11557666"/>
......@@ -441,6 +444,7 @@
</object>
<string key="NSFrame">{{1, 17}, {402, 236}}</string>
<reference key="NSSuperview" ref="915491793"/>
<reference key="NSNextKeyView" ref="23448837"/>
<reference key="NSDocView" ref="23448837"/>
<reference key="NSBGColor" ref="885475112"/>
<int key="NScvFlags">4</int>
......@@ -473,6 +477,7 @@
</object>
<string key="NSFrame">{{1, 0}, {402, 17}}</string>
<reference key="NSSuperview" ref="915491793"/>
<reference key="NSNextKeyView" ref="823165105"/>
<reference key="NSDocView" ref="823165105"/>
<reference key="NSBGColor" ref="885475112"/>
<int key="NScvFlags">4</int>
......@@ -480,6 +485,7 @@
</object>
<string key="NSFrameSize">{404, 254}</string>
<reference key="NSSuperview" ref="440594360"/>
<reference key="NSNextKeyView" ref="343242432"/>
<int key="NSsFlags">133682</int>
<reference key="NSVScroller" ref="573737110"/>
<reference key="NSHScroller" ref="297523533"/>
......@@ -1027,6 +1033,7 @@
</object>
</object>
<string key="NSFrameSize">{604, 310}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
......@@ -1620,6 +1627,14 @@
<reference key="NSOnImage" ref="447396056"/>
<reference key="NSMixedImage" ref="100133332"/>
</object>
<object class="NSMenuItem" id="35710136">
<reference key="NSMenu" ref="815243229"/>
<string key="NSTitle">Show Sidebar</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="447396056"/>
<reference key="NSMixedImage" ref="100133332"/>
</object>
<object class="NSMenuItem" id="710935977">
<reference key="NSMenu" ref="815243229"/>
<bool key="NSIsDisabled">YES</bool>
......@@ -7938,6 +7953,22 @@ LCAuLi4</string>
</object>
<int key="connectionID">5412</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">o_mi_toggleSidebar</string>
<reference key="source" ref="651263286"/>
<reference key="destination" ref="35710136"/>
</object>
<int key="connectionID">5415</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">toggleSidebar:</string>
<reference key="source" ref="651263286"/>
<reference key="destination" ref="35710136"/>
</object>
<int key="connectionID">5416</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
......@@ -10682,6 +10713,7 @@ LCAuLi4</string>
<reference ref="709859089"/>
<reference ref="710935977"/>
<reference ref="338106467"/>
<reference ref="35710136"/>
</object>
<reference key="parent" ref="939296045"/>
</object>
......@@ -11041,6 +11073,11 @@ LCAuLi4</string>
<reference key="object" ref="634067619"/>
<reference key="parent" ref="1056513052"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5413</int>
<reference key="object" ref="35710136"/>
<reference key="parent" ref="815243229"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
......@@ -11856,6 +11893,7 @@ LCAuLi4</string>
<string>5335.IBViewBoundsToFrameTransform</string>
<string>5339.IBPluginDependency</string>
<string>5409.IBPluginDependency</string>
<string>5413.IBPluginDependency</string>
<string>56.IBPluginDependency</string>
<string>56.ImportedFromIB2</string>
<string>57.IBEditorWindowLastContentRect</string>
......@@ -12249,7 +12287,7 @@ LCAuLi4</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{762, 736}, {518, 20}}</string>
<string>{{487, 663}, {518, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
......@@ -12714,7 +12752,7 @@ LCAuLi4</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{616, 901}, {260, 73}}</string>
<string>{{631, 570}, {260, 93}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
......@@ -12828,6 +12866,7 @@ LCAuLi4</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{329, 186}, {267, 263}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
......@@ -12884,7 +12923,7 @@ LCAuLi4</string>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">5412</int>
<int key="maxID">5416</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
......@@ -15970,6 +16009,7 @@ LCAuLi4</string>
<string>togglePlaylistColumnTable:</string>
<string>togglePlaymodeButtons:</string>
<string>toggleRecord:</string>
<string>toggleSidebar:</string>
<string>toggleVar:</string>
<string>viewAbout:</string>
<string>viewErrorsAndWarnings:</string>
......@@ -16012,6 +16052,7 @@ LCAuLi4</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
......@@ -16047,6 +16088,7 @@ LCAuLi4</string>
<string>togglePlaylistColumnTable:</string>
<string>togglePlaymodeButtons:</string>
<string>toggleRecord:</string>
<string>toggleSidebar:</string>
<string>toggleVar:</string>
<string>viewAbout:</string>
<string>viewErrorsAndWarnings:</string>
......@@ -16171,6 +16213,10 @@ LCAuLi4</string>
<string key="name">toggleRecord:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">toggleSidebar:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">toggleVar:</string>
<string key="candidateClassName">id</string>
......@@ -16299,6 +16345,7 @@ LCAuLi4</string>
<string>o_mi_title</string>
<string>o_mi_toggleJumpButtons</string>
<string>o_mi_togglePlaymodeButtons</string>
<string>o_mi_toggleSidebar</string>
<string>o_mi_trackSynchronization</string>
<string>o_mi_videoeffects</string>
<string>o_mi_videotrack</string>
......@@ -16456,6 +16503,7 @@ LCAuLi4</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
<string>NSMenu</string>
<string>NSMenu</string>
<string>NSMenu</string>
......@@ -16602,6 +16650,7 @@ LCAuLi4</string>
<string>o_mi_title</string>
<string>o_mi_toggleJumpButtons</string>
<string>o_mi_togglePlaymodeButtons</string>
<string>o_mi_toggleSidebar</string>
<string>o_mi_trackSynchronization</string>
<string>o_mi_videoeffects</string>
<string>o_mi_videotrack</string>
......@@ -17058,6 +17107,10 @@ LCAuLi4</string>
<string key="name">o_mi_togglePlaymodeButtons</string>
<string key="candidateClassName">NSMenuItem</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_mi_toggleSidebar</string>
<string key="candidateClassName">NSMenuItem</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_mi_trackSynchronization</string>
<string key="candidateClassName">NSMenuItem</string>
......
......@@ -80,6 +80,7 @@
IBOutlet NSMenu * o_mu_view;
IBOutlet NSMenuItem * o_mi_toggleJumpButtons;
IBOutlet NSMenuItem * o_mi_togglePlaymodeButtons;
IBOutlet NSMenuItem * o_mi_toggleSidebar;
IBOutlet NSMenu * o_mu_playlistTableColumns;
NSMenu * o_mu_playlistTableColumnsContextMenu;
......@@ -215,6 +216,7 @@
- (void)setSubmenusEnabled:(BOOL)b_enabled;
- (void)setRateControlsEnabled:(BOOL)b_enabled;
- (void)setupExtensionsMenu;
- (void)updateSidebarMenuItem;
- (IBAction)intfOpenFile:(id)sender;
- (IBAction)intfOpenFileGeneric:(id)sender;
......@@ -224,6 +226,7 @@
- (IBAction)toggleJumpButtons:(id)sender;
- (IBAction)togglePlaymodeButtons:(id)sender;
- (IBAction)toggleSidebar:(id)sender;
- (IBAction)togglePlaylistColumnTable:(id)sender;
- (void)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column;
- (NSMenu *)setupPlaylistTableColumnsMenu;
......
......@@ -302,6 +302,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_toggleJumpButtons setState: config_GetInt(VLCIntf, "macosx-show-playback-buttons")];
[o_mi_togglePlaymodeButtons setTitle: _NS("Show Shuffle & Repeat Buttons")];
[o_mi_togglePlaymodeButtons setState: config_GetInt(VLCIntf, "macosx-show-playmode-buttons")];
[o_mi_toggleSidebar setTitle: _NS("Show Sidebar")];
[o_mi_toggleSidebar setState: config_GetInt(VLCIntf, "macosx-show-sidebar")];
[o_mu_playlistTableColumns setTitle: _NS("Playlist Table Columns")];
[o_mu_controls setTitle: _NS("Playback")];
......@@ -647,6 +649,19 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_togglePlaymodeButtons setState: b_value];
}
- (IBAction)toggleSidebar:(id)sender
{
BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-sidebar");
config_PutInt(VLCIntf, "macosx-show-sidebar", b_value);
[[[VLCMain sharedInstance] mainWindow] toggleLeftSubSplitView];
[o_mi_toggleSidebar setState: b_value];
}
- (void)updateSidebarMenuItem
{
[o_mi_toggleSidebar setState: config_GetInt(VLCIntf, "macosx-show-sidebar")];
}
- (IBAction)togglePlaylistColumnTable:(id)sender
{
NSInteger i_new_state = ![sender state];
......
......@@ -82,7 +82,8 @@
BOOL b_splitview_removed;
BOOL b_minimized_view;
int i_lastSplitViewHeight;
NSUInteger i_lastSplitViewHeight;
NSUInteger i_lastLeftSplitViewWidth;
NSMutableArray *o_sidebaritems;
......@@ -120,6 +121,7 @@
- (void)windowResizedOrMoved:(NSNotification *)notification;
- (void)toggleLeftSubSplitView;
- (void)showDropZone;
- (void)hideDropZone;
- (void)showSplitView;
......
......@@ -370,8 +370,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillClose:) name: NSWindowWillCloseNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mainSplitViewWillResizeSubviews:) name:NSSplitViewWillResizeSubviewsNotification object:o_split_view];
[o_split_view setAutosaveName:@"10thanniversary-splitview"];
if (b_splitviewShouldBeHidden) {
[self hideSplitView];
i_lastSplitViewHeight = 300;
......@@ -385,13 +385,19 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self resizeWindow];
}
// update fs button to reflect state for next startup
if (var_InheritBool(pl_Get(VLCIntf), "fullscreen")) {
/* update fs button to reflect state for next startup */
if (var_InheritBool(pl_Get(VLCIntf), "fullscreen"))
[o_controls_bar setFullscreenState:YES];
}
/* restore split view */
i_lastLeftSplitViewWidth = 200;
/* trick NSSplitView implementation, which pretends to know better than us */
if (!config_GetInt(VLCIntf, "macosx-show-sidebar"))
[self performSelector:@selector(toggleLeftSubSplitView) withObject:nil afterDelay:0.05];
}
#pragma mark -
#pragma mark appearance management
- (VLCMainWindowControlsBar *)controlsBar;
{
......@@ -518,6 +524,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)applicationWillTerminate:(NSNotification *)notification
{
config_PutInt(VLCIntf, "macosx-show-sidebar", ![o_split_view isSubviewCollapsed:o_left_split_view]);
[self saveFrameUsingName: [self frameAutosaveName]];
}
......@@ -959,6 +967,22 @@ static VLCMainWindow *_o_sharedInstance = nil;
return YES;
}
- (void)mainSplitViewWillResizeSubviews:(id)object
{
i_lastLeftSplitViewWidth = [o_left_split_view frame].size.width;
config_PutInt(VLCIntf, "macosx-show-sidebar", ![o_split_view isSubviewCollapsed:o_left_split_view]);
[[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
}
- (void)toggleLeftSubSplitView
{
[o_split_view adjustSubviews];
if ([o_split_view isSubviewCollapsed:o_left_split_view])
[o_split_view setPosition:i_lastLeftSplitViewWidth ofDividerAtIndex:0];
else
[o_split_view setPosition:[o_split_view minPossiblePositionOfDividerAtIndex:0] ofDividerAtIndex:0];
}
#pragma mark -
#pragma mark Side Bar Data handling
/* taken under BSD-new from the PXSourceList sample project, adapted for VLC */
......
......@@ -116,6 +116,9 @@ void WindowClose (vout_window_t *);
#define PLAYMODEBUTTONS_TEXT N_("Show play mode control buttons")
#define PLAYMODEBUTTONS_LONGTEXT N_("Shows the shuffle and repeat buttons in the main window")
#define SIDEBAR_TEXT N_("Show sidebar")
#define SIDEBAR_LONGTEXT N_("Shows a sidebar in the main window listing media sources")
vlc_module_begin ()
set_description(N_("Mac OS X interface"))
set_capability("interface", 200)
......@@ -141,6 +144,7 @@ vlc_module_begin ()
add_bool("macosx-icon-change", true, ICONCHANGE_TEXT, ICONCHANGE_LONGTEXT, true)
add_bool("macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, JUMPBUTTONS_LONGTEXT, false)
add_bool("macosx-show-playmode-buttons", true, PLAYMODEBUTTONS_TEXT, PLAYMODEBUTTONS_LONGTEXT, false)
add_bool("macosx-show-sidebar", true, SIDEBAR_TEXT, SIDEBAR_LONGTEXT, false)
add_submodule ()
set_description("Mac OS X Video Output Provider")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment