i_old_profile_index = [o_profile_pop indexOfSelectedItem];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- NSUInteger selectedProfile = [o_profile_pop indexOfSelectedItem];
+ NSInteger selectedProfile = [o_profile_pop indexOfSelectedItem];
+ if (selectedProfile < 0)
+ return;
audio_output_t *p_aout = getAout();
playlist_t *p_playlist = pl_Get(p_intf);
}
/* fetch preset */
- NSArray *items = [[[defaults objectForKey:@"AudioEffectProfiles"] objectAtIndex:selectedProfile] componentsSeparatedByString:@";"];
+ NSArray *items = [[[defaults objectForKey:@"AudioEffectProfiles"] objectAtIndex:(NSUInteger) selectedProfile] componentsSeparatedByString:@";"];
/* eq preset */
vlc_object_t *p_object = VLC_OBJECT(getAout());
- (IBAction)spat_sliderUpdated:(id)sender
{
audio_output_t *p_aout = getAout();
- char *value;
+ char *value = NULL;
if (sender == o_spat_band1_sld)
value = "spatializer-roomsize";
else if (sender == o_spat_band2_sld)
// remove fullscreen button for lion fullscreen
if (b_nativeFullscreenMode) {
- float f_width = [o_fullscreen_btn frame].size.width;
+ CGFloat f_width = [o_fullscreen_btn frame].size.width;
NSRect frame = [o_time_fld frame];
frame.origin.x += f_width;
[o_fullscreen_btn setState:b_fullscreen];
}
+- (void)dealloc {
+ [o_play_img release];
+ [o_play_pressed_img release];
+ [o_pause_img release];
+ [o_pause_pressed_img release];
+ [super dealloc];
+}
+
@end
[[item animator] setFrame: frame]
NSRect frame;
- float f_space = [o_effects_btn frame].size.width;
+ CGFloat f_space = [o_effects_btn frame].size.width;
// extra margin between button and volume up button
if (b_nativeFullscreenMode)
f_space += 2;
[[item animator] setFrame: frame]
NSRect frame;
- float f_space = [o_effects_btn frame].size.width;
+ CGFloat f_space = [o_effects_btn frame].size.width;
// extra margin between button and volume up button
if (b_nativeFullscreenMode)
f_space += 2;
- (void)addPlaymodeButtons:(BOOL)b_fast
{
NSRect frame;
- float f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.;
+ CGFloat f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.;
if (b_dark_interface) {
[[o_playlist_btn animator] setImage:[NSImage imageNamed:@"playlist_dark"]];
- (void)removePlaymodeButtons:(BOOL)b_fast
{
NSRect frame;
- float f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.;
+ CGFloat f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.;
[o_repeat_btn setHidden: YES];
[o_shuffle_btn setHidden: YES];
[[VLCMainMenu sharedInstance] setRateControlsEnabled: b_control];
}
+- (void)dealloc {
+ [o_repeat_img release];
+ [o_repeat_pressed_img release];
+ [o_repeat_all_img release];
+ [o_repeat_all_pressed_img release];
+ [o_repeat_one_img release];
+ [o_repeat_one_pressed_img release];
+ [o_shuffle_img release];
+ [o_shuffle_pressed_img release];
+ [o_shuffle_on_img release];
+ [o_shuffle_on_pressed_img release];
+ [super dealloc];
+}
+
@end
- (NSString *)currentEncapsulationFormatAsFileExtension:(BOOL)b_extension
{
- NSUInteger cellTag = [[_customize_encap_matrix selectedCell] tag];
+ NSUInteger cellTag = (NSUInteger) [[_customize_encap_matrix selectedCell] tag];
NSString * returnValue;
switch (cellTag) {
case MPEGTS:
#import <vlc_strings.h>
#import <vlc_url.h>
-@interface VLCMainWindow (Internal)
-- (void)jumpWithValue:(char *)p_value forward:(BOOL)b_value;
-@end
@implementation VLCCoreInteraction
static VLCCoreInteraction *_o_sharedInstance = nil;
[super dealloc];
}
-- (void)awakeFromNib
-{
- [[NSNotificationCenter defaultCenter] addObserver: self
- selector: @selector(applicationWillFinishLaunching:)
- name: NSApplicationWillFinishLaunchingNotification
- object: nil];
-}
#pragma mark -
#pragma mark Playback Controls
NSUInteger count = [o_values count];
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
- BOOL b_returned = NO;
if (count == 1 && p_input) {
- b_returned = input_AddSubtitleOSD(p_input, [[o_values objectAtIndex:0] UTF8String], true, true);
+ int i_result = input_AddSubtitleOSD(p_input, [[o_values objectAtIndex:0] UTF8String], true, true);
vlc_object_release(p_input);
- if (!b_returned)
+ if (i_result == VLC_SUCCESS)
return YES;
}
else if (p_input)
mi = [[NSMenuItem alloc] initWithTitle: _NS(p_item->list_text[i]) action:NULL keyEquivalent: @""];
else if (p_item->list.i[i])
mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: @"%d", p_item->list.i[i]] action:NULL keyEquivalent: @""];
- else
+ else {
msg_Err(p_intf, "item %d of pref %s failed to be created", i, psz_name);
+ continue;
+ }
+
[mi setTarget:self];
[mi setAction:selector];
[mi setTag:p_item->list.i[i]];
- (void)refreshVoutDeviceMenu:(NSNotification *)o_notification
{
- NSUInteger count = [o_mu_screen numberOfItems];
+ NSUInteger count = (NSUInteger) [o_mu_screen numberOfItems];
NSMenu * o_submenu = o_mu_screen;
if (count > 0)
[o_submenu removeAllItems];
config_PutInt(p_intf, [representedObject UTF8String], intValue);
NSMenu *menu = [sender menu];
- NSUInteger count = [menu numberOfItems];
+ NSUInteger count = (NSUInteger) [menu numberOfItems];
for (NSUInteger x = 0; x < count; x++)
[[menu itemAtIndex:x] setState:NSOffState];
[[menu itemWithTag:intValue] setState:NSOnState];
- (IBAction)telxNavLink:(id)sender
{
- intf_thread_t * p_intf = VLCIntf;
vlc_object_t *p_vbi;
int i_page = 0;
BOOL b_splitview_removed;
BOOL b_minimized_view;
- NSUInteger i_lastSplitViewHeight;
- NSUInteger i_lastLeftSplitViewWidth;
+ CGFloat f_lastSplitViewHeight;
+ CGFloat f_lastLeftSplitViewWidth;
NSMutableArray *o_sidebaritems;
[o_podcast_unsubscribe_cancel_btn setTitle: _NS("Cancel")];
/* interface builder action */
- float f_threshold_height = f_min_video_height + [o_controls_bar height];
+ CGFloat f_threshold_height = f_min_video_height + [o_controls_bar height];
if (b_dark_interface)
f_threshold_height += [o_titlebar_view frame].size.height;
if ([[self contentView] frame].size.height < f_threshold_height)
if (b_splitviewShouldBeHidden) {
[self hideSplitView: YES];
- i_lastSplitViewHeight = 300;
+ f_lastSplitViewHeight = 300;
}
/* sanity check for the window size */
[o_controls_bar setFullscreenState:YES];
/* restore split view */
- i_lastLeftSplitViewWidth = 200;
+ f_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];
[self setContentMinSize: NSMakeSize(604., 288.)];
NSRect old_frame = [self frame];
- float newHeight = [self minSize].height;
+ CGFloat newHeight = [self minSize].height;
if (old_frame.size.height < newHeight) {
NSRect new_frame = old_frame;
new_frame.origin.y = old_frame.origin.y + old_frame.size.height - newHeight;
{
if (b_with_resize) {
NSRect winrect = [self frame];
- i_lastSplitViewHeight = [o_split_view frame].size.height;
- winrect.size.height = winrect.size.height - i_lastSplitViewHeight;
- winrect.origin.y = winrect.origin.y + i_lastSplitViewHeight;
+ f_lastSplitViewHeight = [o_split_view frame].size.height;
+ winrect.size.height = winrect.size.height - f_lastSplitViewHeight;
+ winrect.origin.y = winrect.origin.y + f_lastSplitViewHeight;
[self setFrame: winrect display: YES animate: YES];
}
if (b_with_resize) {
NSRect winrect;
winrect = [self frame];
- winrect.size.height = winrect.size.height + i_lastSplitViewHeight;
- winrect.origin.y = winrect.origin.y - i_lastSplitViewHeight;
+ winrect.size.height = winrect.size.height + f_lastSplitViewHeight;
+ winrect.origin.y = winrect.origin.y - f_lastSplitViewHeight;
[self setFrame: winrect display: YES animate: YES];
}
if (!b_nonembedded && (!b_nativeFullscreenMode || (b_nativeFullscreenMode && !b_fullscreen)) && frameBeforePlayback.size.width > 0 && frameBeforePlayback.size.height > 0) {
// only resize back to minimum view of this is still desired final state
- float f_threshold_height = f_min_video_height + [o_controls_bar height];
+ CGFloat f_threshold_height = f_min_video_height + [o_controls_bar height];
if(frameBeforePlayback.size.height > f_threshold_height || b_minimized_view) {
[[self animator] setFrame:frameBeforePlayback display:YES];
}
- (void)mainSplitViewDidResizeSubviews:(id)object
{
- i_lastLeftSplitViewWidth = [o_left_split_view frame].size.width;
+ f_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];
}
{
[o_split_view adjustSubviews];
if ([o_split_view isSubviewCollapsed:o_left_split_view])
- [o_split_view setPosition:i_lastLeftSplitViewWidth ofDividerAtIndex:0];
+ [o_split_view setPosition:f_lastLeftSplitViewWidth ofDividerAtIndex:0];
else
[o_split_view setPosition:[o_split_view minPossiblePositionOfDividerAtIndex:0] ofDividerAtIndex:0];
[[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
{
if ([theEvent type] == NSRightMouseDown || ([theEvent type] == NSLeftMouseDown && ([theEvent modifierFlags] & NSControlKeyMask) == NSControlKeyMask)) {
if (item != nil) {
- NSMenu * m;
if ([item sdtype] > 0)
{
- m = [[NSMenu alloc] init];
+ NSMenu *m = [[NSMenu alloc] init];
playlist_t * p_playlist = pl_Get(VLCIntf);
BOOL sd_loaded = playlist_IsServicesDiscoveryLoaded(p_playlist, [[item identifier] UTF8String]);
if (!sd_loaded)
else
[m addItemWithTitle:_NS("Disable") action:@selector(sdmenuhandler:) keyEquivalent:@""];
[[m itemAtIndex:0] setRepresentedObject: [item identifier]];
+
+ return [m autorelease];
}
- return [m autorelease];
}
}
if (!p_intf || (!b_nativeFullscreenMode && !p_wnd))
return;
playlist_t *p_playlist = pl_Get(p_intf);
- BOOL b_fullscreen = i_full;
+ BOOL b_fullscreen = i_full != 0;
if (!var_GetBool(p_playlist, "fullscreen") != !b_fullscreen)
var_SetBool(p_playlist, "fullscreen", b_fullscreen);
* Preamble
*****************************************************************************/
#import <stdlib.h> /* free() */
-#import <string.h>
#import "CompatibilityFixes.h"
#import "intf.h"
#import "VideoView.h"
#import "CoreInteraction.h"
#import "MainMenu.h"
-#import "MainWindow.h"
-#import <vlc_common.h>
#import <vlc_keys.h>
- (NSRect) customConstrainFrameRect: (NSRect)frameRect toScreen: (NSScreen*)screen
{
NSRect screenRect = [screen visibleFrame];
- float difference;
+ CGFloat difference;
/* Move top edge of the window inside the screen */
difference = NSMaxY (frameRect) - NSMaxY (screenRect);
the window */
difference = NSMaxY (screenRect) - NSMaxY (frameRect);
if (_styleMask & NSResizableWindowMask) {
- float difference2;
+ CGFloat difference2;
difference2 = screenRect.origin.y - frameRect.origin.y;
difference2 -= difference;
NSPoint topleftbase = NSMakePoint(0, [self frame].size.height);
NSPoint topleftscreen = [self convertBaseToScreen: topleftbase];
- unsigned int i_width = size.width;
- unsigned int i_height = size.height;
- if (i_width < windowMinSize.width)
- i_width = windowMinSize.width;
- if (i_height < f_min_video_height)
- i_height = f_min_video_height;
+ CGFloat f_width = size.width;
+ CGFloat f_height = size.height;
+ if (f_width < windowMinSize.width)
+ f_width = windowMinSize.width;
+ if (f_height < f_min_video_height)
+ f_height = f_min_video_height;
/* Calculate the window's new size */
NSRect new_frame;
- new_frame.size.width = [self frame].size.width - [o_video_view frame].size.width + i_width;
- new_frame.size.height = [self frame].size.height - [o_video_view frame].size.height + i_height;
+ new_frame.size.width = [self frame].size.width - [o_video_view frame].size.width + f_width;
+ new_frame.size.height = [self frame].size.height - [o_video_view frame].size.height + f_height;
new_frame.origin.x = topleftscreen.x;
new_frame.origin.y = topleftscreen.y - new_frame.size.height;
NSRect videoWindowFrame = [self frame];
NSRect viewRect = [o_video_view convertRect:[o_video_view bounds] toView: nil];
NSRect contentRect = [self contentRectForFrameRect:videoWindowFrame];
- float marginy = viewRect.origin.y + videoWindowFrame.size.height - contentRect.size.height;
- float marginx = contentRect.size.width - viewRect.size.width;
+ CGFloat marginy = viewRect.origin.y + videoWindowFrame.size.height - contentRect.size.height;
+ CGFloat marginx = contentRect.size.width - viewRect.size.width;
if (o_titlebar_view && b_dark_interface)
marginy += [o_titlebar_view frame].size.height;
NSTimer *o_scroll_timer;
float f_current;
- float f_end;
+ CGFloat f_end;
NSTimeInterval i_start;
BOOL b_restart;
BOOL b_isSetUp;
#import "bookmarks.h"
#import "wizard.h"
-#import <vlc_interface.h>
#import "CompatibilityFixes.h"
@interface VLCBookmarks (Internal)
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
seekpoint_t **pp_bookmarks;
int i_bookmarks;
- id ret;
+ id ret = @"";
if (!p_input)
return @"";
playlist_t * p_playlist = pl_Get(VLCIntf);
PL_LOCK;
- BOOL kidsAround = p_playlist->p_local_category->i_children;
+ BOOL kidsAround = p_playlist->p_local_category->i_children != 0;
PL_UNLOCK;
if (kidsAround && var_GetBool(p_playlist, "playlist-autostart"))
[[self playlist] playItem:nil];
if ([o_names count] == 1 && psz_uri) {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
- BOOL b_returned = input_AddSubtitleOSD(p_input, [[o_names objectAtIndex:0] UTF8String], true, true);
+ int i_result = input_AddSubtitleOSD(p_input, [[o_names objectAtIndex:0] UTF8String], true, true);
vlc_object_release(p_input);
- if (!b_returned) {
+ if (i_result == VLC_SUCCESS) {
free(psz_uri);
return;
}
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
-#include <string.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
- (BOOL)getObjectValue:(id*)obj forString:(NSString*)string errorDescription:(NSString**)error;
-- (bool)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error;
+- (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error;
@end
- (void)scrollWheel:(NSEvent *)o_event
{
- intf_thread_t * p_intf = VLCIntf;
BOOL b_forward = NO;
CGFloat f_deltaY = [o_event deltaY];
CGFloat f_deltaX = [o_event deltaX];
- (void)scrollWheel:(NSEvent *)o_event
{
- intf_thread_t * p_intf = VLCIntf;
BOOL b_up = NO;
CGFloat f_deltaY = [o_event deltaY];
CGFloat f_deltaX = [o_event deltaX];
// positive for left / down, negative otherwise
CGFloat f_delta = f_deltaX + f_deltaY;
CGFloat f_abs;
- int i_vlckey;
if (f_delta > 0.0f)
f_abs = f_delta;
return YES;
}
-- (bool)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error
+- (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error
{
if ([partialString rangeOfCharacterFromSet:o_forbidden_characters options:NSLiteralSearch].location != NSNotFound) {
return NO;
if ([o_file_custom_timing_ckb state] == NSOnState) {
NSArray * components = [[o_file_starttime_fld stringValue] componentsSeparatedByString:@":"];
NSUInteger componentCount = [components count];
- NSInteger tempValue;
+ NSInteger tempValue = 0;
if (componentCount == 1)
tempValue = [[components objectAtIndex:0] intValue];
else if (componentCount == 2)
if (channels) {
NSString *channel;
[[o_eyetv_channels_pop menu] addItem: [NSMenuItem separatorItem]];
- while (channel = [channels nextObject])
+ while ((channel = [channels nextObject]) != nil)
/* we have to add items this way, because we accept duplicates
* additionally, we save a bit of time */
[[[o_eyetv_channels_pop menu] addItemWithTitle: channel action: nil keyEquivalent: @""] setTag:++x];
* port correctly. Not need, if there isn't any path following the
* hostname. */
NSArray * o_urlItems = [[o_stream_address stringValue] componentsSeparatedByString: @"/"];
- NSMutableString * o_finalStreamAddress;
- o_finalStreamAddress = [[NSMutableString alloc] init];
+ NSMutableString * o_finalStreamAddress = [[[NSMutableString alloc] init] autorelease];
if ([o_urlItems count] == 1)
[o_finalStreamAddress appendFormat: @"\"%@:%@\"", [o_stream_address stringValue],[o_stream_port stringValue]];
pointerValue];
}
+- (void)dealloc {
+ [o_outline_dict release];
+ [super dealloc];
+}
+
@end
@implementation VLCPlaylistCommon (NSOutlineViewDataSource)
NSUInteger count = [o_values count];
NSMutableArray *o_array = [NSMutableArray arrayWithCapacity:count];
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
- BOOL b_returned = NO;
if (count == 1 && p_input) {
- b_returned = input_AddSubtitleOSD(p_input, vlc_path2uri([[o_values objectAtIndex:0] UTF8String], NULL), true, true);
+ int i_result = input_AddSubtitleOSD(p_input, vlc_path2uri([[o_values objectAtIndex:0] UTF8String], NULL), true, true);
vlc_object_release(p_input);
- if (!b_returned)
+ if (i_result == VLC_SUCCESS)
return YES;
}
else if (p_input)