/*****************************************************************************
* bookmarks.m: MacOS X Bookmarks window
*****************************************************************************
- * Copyright (C) 2005 the VideoLAN team
+ * Copyright (C) 2005, 2006 the VideoLAN team
* $Id$
*
* Authors: Felix Kühne <fkuehne@users.sf.net>
#import "bookmarks.h"
#import "intf.h"
#import "wizard.h"
-#import <vlc/intf.h>
+#import <vlc_interface.h>
/*****************************************************************************
* VLCExtended implementation
- (void)dealloc
{
- if(p_old_input)
+ if( p_old_input )
{
- free(p_old_input);
+ vlc_object_release( p_old_input );
}
[super dealloc];
}
[o_btn_edit setTitle: _NS("Edit")];
[o_btn_extract setTitle: _NS("Extract")];
[o_btn_rm setTitle: _NS("Remove")];
- [[[o_tbl_dataTable tableColumnWithIdentifier:@"description"] headerCell] \
+ [[[o_tbl_dataTable tableColumnWithIdentifier:@"description"] headerCell]
setStringValue: _NS("Description")];
- [[[o_tbl_dataTable tableColumnWithIdentifier:@"size_offset"] headerCell] \
- setStringValue: _NS("Size offset")];
- [[[o_tbl_dataTable tableColumnWithIdentifier:@"time_offset"] headerCell] \
- setStringValue: _NS("Time offset")];
+ [[[o_tbl_dataTable tableColumnWithIdentifier:@"size_offset"] headerCell]
+ setStringValue: _NS("Position")];
+ [[[o_tbl_dataTable tableColumnWithIdentifier:@"time_offset"] headerCell]
+ setStringValue: _NS("Time")];
/* edit window */
[o_edit_btn_ok setTitle: _NS("OK")];
[o_edit_btn_cancel setTitle: _NS("Cancel")];
[o_edit_lbl_name setStringValue: _NS("Name")];
[o_edit_lbl_time setStringValue: _NS("Time")];
- [o_edit_lbl_bytes setStringValue: _NS("Bytes")];
+ [o_edit_lbl_bytes setStringValue: _NS("Position")];
}
- (void)showBookmarks
{
/* add item to list */
intf_thread_t * p_intf = VLCIntf;
- input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \
+ input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf,
VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
return;
{
/* clear table */
intf_thread_t * p_intf = VLCIntf;
- input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, \
+ input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf,
VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
/* we take the values from the core and not the table, because we cannot
* really trust it */
intf_thread_t * p_intf = VLCIntf;
- input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \
+ input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf,
VLC_OBJECT_INPUT, FIND_ANYWHERE );
seekpoint_t **pp_bookmarks;
int i_bookmarks;
- char * toBeReturned;
- toBeReturned = "";
- int i_toBeReturned;
- i_toBeReturned = 0;
int row;
row = [o_tbl_dataTable selectedRow];
{
return;
}
- else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \
+ else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
&i_bookmarks ) != VLC_SUCCESS )
{
vlc_object_release( p_input );
vlc_object_release( p_input );
return;
} else {
- [o_edit_fld_name setStringValue: [NSString stringWithUTF8String: \
+ [o_edit_fld_name setStringValue: [NSString stringWithUTF8String:
pp_bookmarks[row]->psz_name]];
- [o_edit_fld_time setStringValue: [[NSNumber numberWithInt: \
+ [o_edit_fld_time setStringValue: [[NSNumber numberWithInt:
(pp_bookmarks[row]->i_time_offset / 1000000)] stringValue]];
- [o_edit_fld_bytes setStringValue: [[NSNumber numberWithInt: \
+ [o_edit_fld_bytes setStringValue: [[NSNumber numberWithInt:
pp_bookmarks[row]->i_byte_offset] stringValue]];
}
intf_thread_t * p_intf = VLCIntf;
seekpoint_t **pp_bookmarks;
int i_bookmarks, i;
- input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, \
+ input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf,
VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
- NSBeginCriticalAlertSheet(_NS("No input"), _NS("OK"), \
- @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("No " \
- "input found. The stream must be playing or paused for " \
+ NSBeginCriticalAlertSheet(_NS("No input"), _NS("OK"),
+ @"", @"", o_bookmarks_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"), \
- @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("Input " \
- "has changed, unable to save bookmark. Use \"Pause\" while " \
- "editing bookmarks to keep the same input."));
+ NSBeginCriticalAlertSheet(_NS("Input has changed"), _NS("OK"),
+ @"", @"", o_bookmarks_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;
}
- if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \
+ if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
&i_bookmarks ) != VLC_SUCCESS )
{
vlc_object_release( p_input );
pp_bookmarks[i]->i_byte_offset = [[o_edit_fld_bytes stringValue] intValue];
pp_bookmarks[i]->i_time_offset = ([[o_edit_fld_time stringValue] intValue] * 1000000);
- if( input_Control( p_input, INPUT_CHANGE_BOOKMARK, pp_bookmarks[i], i ) \
+ if( input_Control( p_input, INPUT_CHANGE_BOOKMARK, pp_bookmarks[i], i )
!= VLC_SUCCESS )
{
- msg_Warn( p_intf, "VLCBookmarks: changing bookmark failed");
+ msg_Warn( p_intf, "Unable to change the bookmark");
vlc_object_release( p_input );
return;
}
if( [o_tbl_dataTable numberOfSelectedRows] < 2 )
{
- NSBeginAlertSheet(_NS("Invalid selection"), _NS("OK"), \
- @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("" \
- "You have to select two bookmarks."));
+ NSBeginAlertSheet(_NS("Invalid selection"), _NS("OK"),
+ @"", @"", o_bookmarks_window, nil, nil, nil, nil,
+ _NS("Two bookmarks have to be selected."));
return;
}
input_thread_t *p_input =
FIND_ANYWHERE );
if( !p_input )
{
- NSBeginCriticalAlertSheet(_NS("No input found"), _NS("OK"), \
- @"", @"", o_bookmarks_window, nil, nil, nil, nil, _NS("" \
- "The stream must be playing or paused for bookmarks to work."));
+ NSBeginCriticalAlertSheet(_NS("No input found"), _NS("OK"),
+ @"", @"", o_bookmarks_window, nil, nil, nil, nil,
+ _NS("The stream must be playing or paused for bookmarks to work."));
return;
}
msg_Dbg(p_intf, "got the bookmark-indexes");
- if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \
+ if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
&i_bookmarks ) != VLC_SUCCESS )
{
vlc_object_release( p_input );
- msg_Err(p_intf, "bookmarks couldn't be retrieved from core");
+ msg_Err(p_intf, "already defined bookmarks couldn't be retrieved");
return;
}
msg_Dbg(p_intf, "calling wizard");
- [[[VLCMain sharedInstance] getWizard] initWithExtractValuesFrom: \
- [[NSNumber numberWithInt: \
- (pp_bookmarks[i_first]->i_time_offset/1000000)] stringValue] \
- to: [[NSNumber numberWithInt: \
- (pp_bookmarks[i_second]->i_time_offset/1000000)] stringValue] \
- ofItem: [NSString stringWithUTF8String: \
- p_input->input.p_item->psz_uri]];
+ [[[VLCMain sharedInstance] getWizard] initWithExtractValuesFrom:
+ [[NSNumber numberWithInt:
+ (pp_bookmarks[i_first]->i_time_offset/1000000)] stringValue]
+ to: [[NSNumber numberWithInt:
+ (pp_bookmarks[i_second]->i_time_offset/1000000)] stringValue]
+ ofItem: [NSString stringWithUTF8String:
+ input_GetItem(p_input)->psz_uri]];
vlc_object_release( p_input );
msg_Dbg(p_intf, "released input");
}
{
intf_thread_t * p_intf = VLCIntf;
input_thread_t *p_input =
- (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
+ (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
+ FIND_ANYWHERE );
if( !p_input )
{
/* remove selected item */
intf_thread_t * p_intf = VLCIntf;
input_thread_t *p_input =
- (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
+ (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
+ FIND_ANYWHERE );
if( !p_input ) return;
{
/* return the number of bookmarks */
intf_thread_t * p_intf = VLCIntf;
- input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \
+ input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf,
VLC_OBJECT_INPUT, FIND_ANYWHERE );
seekpoint_t **pp_bookmarks;
int i_bookmarks;
{
return 0;
}
- else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \
+ else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
&i_bookmarks ) != VLC_SUCCESS )
{
vlc_object_release( p_input );
}
}
-- (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn: \
+- (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn:
(NSTableColumn *)theTableColumn row: (int)row
{
/* return the corresponding data as NSString */
intf_thread_t * p_intf = VLCIntf;
- input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf, \
+ input_thread_t * p_input = (input_thread_t *)vlc_object_find( p_intf,
VLC_OBJECT_INPUT, FIND_ANYWHERE );
seekpoint_t **pp_bookmarks;
int i_bookmarks;
- char * toBeReturned;
- toBeReturned = "";
- int i_toBeReturned;
- i_toBeReturned = 0;
+ char *toBeReturned;
+ int i_toBeReturned = 0;
if( !p_input )
{
return @"";
}
- else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, \
+ else if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
&i_bookmarks ) != VLC_SUCCESS )
{
vlc_object_release( p_input );
{
i_toBeReturned = pp_bookmarks[row]->i_time_offset;
vlc_object_release( p_input );
- return [[NSNumber numberWithInt: (i_toBeReturned / 1000000)] \
+ return [[NSNumber numberWithInt: (i_toBeReturned / 1000000)]
stringValue];
}
else
{
/* may not happen, but just in case */
vlc_object_release( p_input );
- msg_Err(p_intf, "VLCBookmarks: unknown table column identifier " \
- "(%s) while updating table", [[theTableColumn identifier] \
+ msg_Err(p_intf, "unknown table column identifier (%s) while "
+ "updating the bookmark table", [[theTableColumn identifier]
+
UTF8String] );
return @"unknown identifier";
}