Commit 3a07082a authored by David Fuhrmann's avatar David Fuhrmann

macosx: Convert VLCBookmarks to NSWindowController subclass

parent 5ef42a88
......@@ -2,7 +2,7 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">14E46</string>
<string key="IBDocument.SystemVersion">14F19a</string>
<string key="IBDocument.InterfaceBuilderVersion">7706</string>
<string key="IBDocument.AppKitVersion">1348.17</string>
<string key="IBDocument.HIToolboxVersion">758.70</string>
......@@ -206,7 +206,7 @@
<string key="NSFrameSize">{392, 257}</string>
<reference key="NSSuperview" ref="536774820"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="829105237"/>
<reference key="NSNextKeyView" ref="529141156"/>
<string key="NSReuseIdentifierKey">_NS:447</string>
<bool key="NSEnabled">YES</bool>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
......@@ -396,7 +396,6 @@
<string key="NSFrame">{{1, 260}, {377, 15}}</string>
<reference key="NSSuperview" ref="384668170"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<string key="NSControlAction">_doScroller:</string>
<reference key="NSControlTarget" ref="384668170"/>
......@@ -409,7 +408,7 @@
<string key="NSFrame">{{126, 20}, {394, 276}}</string>
<reference key="NSSuperview" ref="638255441"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="529141156"/>
<reference key="NSNextKeyView" ref="536774820"/>
<string key="NSReuseIdentifierKey">_NS:443</string>
<int key="NSsFlags">133681</int>
<reference key="NSVScroller" ref="829105237"/>
......@@ -607,14 +606,6 @@
</object>
<int key="connectionID">163</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">bookmarksWindow</string>
<reference key="source" ref="33654090"/>
<reference key="destination" ref="483319126"/>
</object>
<int key="connectionID">164</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">clearButton</string>
......@@ -767,6 +758,14 @@
</object>
<int key="connectionID">183</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="33654090"/>
<reference key="destination" ref="483319126"/>
</object>
<int key="connectionID">184</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
......@@ -1317,13 +1316,13 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">183</int>
<int key="maxID">184</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">VLCBookmarks</string>
<string key="superclassName">NSObject</string>
<string key="superclassName">NSWindowController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="add:">id</string>
<string key="clear:">id</string>
......@@ -1370,7 +1369,6 @@
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="addButton">NSButton</string>
<string key="bookmarksWindow">NSWindow</string>
<string key="clearButton">NSButton</string>
<string key="dataTable">NSTableView</string>
<string key="editBookmarksWindow">NSWindow</string>
......@@ -1389,10 +1387,6 @@
<string key="name">addButton</string>
<string key="candidateClassName">NSButton</string>
</object>
<object class="IBToOneOutletInfo" key="bookmarksWindow">
<string key="name">bookmarksWindow</string>
<string key="candidateClassName">NSWindow</string>
</object>
<object class="IBToOneOutletInfo" key="clearButton">
<string key="name">clearButton</string>
<string key="candidateClassName">NSButton</string>
......@@ -1500,6 +1494,54 @@
</object>
</array>
<array class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<object class="IBPartialClassDescription">
<string key="className">BGHUDButtonCell</string>
<string key="superclassName">NSButtonCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">BGHUDAppKit.framework/Headers/BGHUDButtonCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">BGHUDLabel</string>
<string key="superclassName">NSTextField</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">BGHUDAppKit.framework/Headers/BGHUDLabel.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">BGHUDScrollView</string>
<string key="superclassName">NSScrollView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">BGHUDAppKit.framework/Headers/BGHUDScrollView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">BGHUDScroller</string>
<string key="superclassName">NSScroller</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">BGHUDAppKit.framework/Headers/BGHUDScroller.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">BGHUDTableView</string>
<string key="superclassName">NSTableView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">BGHUDAppKit.framework/Headers/BGHUDTableView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">BGHUDTextFieldCell</string>
<string key="superclassName">NSTextFieldCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">BGHUDAppKit.framework/Headers/BGHUDTextFieldCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSActionCell</string>
<string key="superclassName">NSCell</string>
......@@ -1524,6 +1566,14 @@
<string key="minorKey">AppKit.framework/Headers/NSButton.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSButtonCell</string>
<string key="superclassName">NSActionCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSCell</string>
<string key="superclassName">NSObject</string>
......@@ -1572,6 +1622,22 @@
<string key="minorKey">AppKit.framework/Headers/NSResponder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSScrollView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSScrollView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSScroller</string>
<string key="superclassName">NSControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSScroller.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSTableColumn</string>
<string key="superclassName">NSObject</string>
......@@ -1628,6 +1694,25 @@
<string key="minorKey">AppKit.framework/Headers/NSWindow.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSWindowController</string>
<string key="superclassName">NSResponder</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">showWindow:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">showWindow:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">showWindow:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
......
......@@ -25,10 +25,9 @@
#import "intf.h"
#import <vlc_common.h>
@interface VLCBookmarks : NSObject
@interface VLCBookmarks : NSWindowController
/* main window */
@property (readwrite, weak) IBOutlet NSWindow *bookmarksWindow;
@property (readwrite, weak) IBOutlet NSButton *addButton;
@property (readwrite, weak) IBOutlet NSButton *clearButton;
@property (readwrite, weak) IBOutlet NSButton *editButton;
......
......@@ -49,9 +49,24 @@
* GUI methods
*****************************************************************************/
- (void)awakeFromNib
- (id)init
{
[_bookmarksWindow setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
self = [super initWithWindowNibName:@"Bookmarks"];
return self;
}
- (void)dealloc
{
if (p_old_input)
vlc_object_release(p_old_input);
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)windowDidLoad
{
[self.window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
_dataTable.dataSource = self;
_dataTable.delegate = self;
......@@ -59,7 +74,7 @@
_dataTable.target = self;
/* main window */
[_bookmarksWindow setTitle: _NS("Bookmarks")];
[self.window setTitle: _NS("Bookmarks")];
[_addButton setTitle: _NS("Add")];
[_clearButton setTitle: _NS("Clear")];
[_editButton setTitle: _NS("Edit")];
......@@ -82,26 +97,18 @@
object:nil];
}
- (void)dealloc
{
if (p_old_input)
vlc_object_release(p_old_input);
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)updateCocoaWindowLevel:(NSInteger)i_level
{
if (_bookmarksWindow && [_bookmarksWindow isVisible] && [_bookmarksWindow level] != i_level)
[_bookmarksWindow setLevel: i_level];
if (self.window && [self.window isVisible] && [self.window level] != i_level)
[self.window setLevel: i_level];
}
- (void)showBookmarks
{
/* show the window, called from intf.m */
[_bookmarksWindow displayIfNeeded];
[_bookmarksWindow setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
[_bookmarksWindow makeKeyAndOrderFront:nil];
[self.window displayIfNeeded];
[self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
[self.window makeKeyAndOrderFront:nil];
}
-(void)inputChangedEvent:(NSNotification *)o_notification
......@@ -181,7 +188,7 @@
p_old_input = p_input;
vlc_object_release(p_input);
[NSApp beginSheet: _editBookmarksWindow modalForWindow: _bookmarksWindow modalDelegate: _editBookmarksWindow didEndSelector: nil contextInfo: nil];
[NSApp beginSheet: _editBookmarksWindow modalForWindow: self.window modalDelegate: _editBookmarksWindow didEndSelector: nil contextInfo: nil];
// Clear the bookmark list
for (int i = 0; i < i_bookmarks; i++)
......@@ -204,11 +211,11 @@
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (!p_input) {
NSBeginCriticalAlertSheet(_NS("No input"), _NS("OK"), @"", @"", _bookmarksWindow, nil, nil, nil, nil, @"%@",_NS("No input found. A stream must be playing or paused for bookmarks to work."));
NSBeginCriticalAlertSheet(_NS("No input"), _NS("OK"), @"", @"", self.window, nil, nil, nil, nil, @"%@",_NS("No input found. A stream must be playing or paused for bookmarks to work."));
return;
}
if (p_old_input != p_input) {
NSBeginCriticalAlertSheet(_NS("Input has changed"), _NS("OK"), @"", @"", _bookmarksWindow, nil, nil, nil, nil, @"%@",_NS("Input has changed, unable to save bookmark. Suspending playback with \"Pause\" while editing bookmarks to ensure to keep the same input."));
NSBeginCriticalAlertSheet(_NS("Input has changed"), _NS("OK"), @"", @"", self.window, nil, nil, nil, nil, @"%@",_NS("Input has changed, unable to save bookmark. Suspending playback with \"Pause\" while editing bookmarks to ensure to keep the same input."));
vlc_object_release(p_input);
return;
}
......@@ -260,12 +267,12 @@ clear:
#warning this does not work anymore
#if 0
if ([_dataTable numberOfSelectedRows] < 2) {
NSBeginAlertSheet(_NS("Invalid selection"), _NS("OK"), @"", @"", _bookmarksWindow, nil, nil, nil, nil, @"%@",_NS("Two bookmarks have to be selected."));
NSBeginAlertSheet(_NS("Invalid selection"), _NS("OK"), @"", @"", self.window, nil, nil, nil, nil, @"%@",_NS("Two bookmarks have to be selected."));
return;
}
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (!p_input) {
NSBeginCriticalAlertSheet(_NS("No input found"), _NS("OK"), @"", @"", _bookmarksWindow, nil, nil, nil, nil, @"%@",_NS("The stream must be playing or paused for bookmarks to work."));
NSBeginCriticalAlertSheet(_NS("No input found"), _NS("OK"), @"", @"", self.window, nil, nil, nil, nil, @"%@",_NS("The stream must be playing or paused for bookmarks to work."));
return;
}
......
......@@ -145,7 +145,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
BOOL nib_prefs_loaded; /* preferences xibfile */
BOOL nib_sprefs_loaded; /* simple preferences xibfile */
BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
BOOL nib_bookmarks_loaded; /* Bookmarks nibfile */
BOOL b_active_videoplayback;
VLCMainMenu *_mainmenu;
......@@ -536,9 +535,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
if (!_bookmarks)
_bookmarks = [[VLCBookmarks alloc] init];
if (!nib_bookmarks_loaded)
nib_bookmarks_loaded = [NSBundle loadNibNamed:@"Bookmarks" owner:_bookmarks];
return _bookmarks;
}
......
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