Changeset bf680e8fb64910e8d968addce71139d135a9b33f
- Timestamp:
- 05/07/04 03:27:35 (4 years ago)
- git-parent:
- Files:
-
- Makefile.am (modified) (1 diff)
- TODO (modified) (1 diff)
- configure.ac (modified) (2 diffs)
- extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib (modified) (1 diff)
- extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib (modified) (previous)
- modules/gui/macosx/applescript.m (modified) (2 diffs)
- modules/gui/macosx/controls.m (modified) (22 diffs)
- modules/gui/macosx/intf.h (modified) (3 diffs)
- modules/gui/macosx/intf.m (modified) (18 diffs)
- modules/gui/macosx/misc.m (modified) (3 diffs)
- modules/gui/macosx/open.m (modified) (2 diffs)
- modules/gui/macosx/output.m (modified) (1 diff)
- modules/gui/macosx/playlist.m (modified) (19 diffs)
- modules/gui/macosx/playlistinfo.m (modified) (16 diffs)
- modules/gui/macosx/prefs.m (modified) (25 diffs)
- modules/gui/macosx/vout.m (modified) (3 diffs)
- src/interface/interface.c (modified) (4 diffs)
- src/vlc.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Makefile.am
r6b46f68 rbf680e8 493 493 $(INSTALL) $(top_builddir)/vlc \ 494 494 $(top_builddir)/VLC.app/Contents/MacOS/VLC 495 ln -sf ./VLC $(top_builddir)/VLC.app/Contents/MacOS/clivlc 495 496 $(INSTALL) -d $(top_builddir)/VLC.app/Contents/MacOS/modules 496 497 for i in "" `$(VLC_CONFIG) --target plugin` ; do \ TODO
r264724a rbf680e8 184 184 Status: Todo 185 185 186 Task 187 Difficulty: Medium 188 Urgency: Wishlist 189 Platform: any 190 Description: IceCast/ShoutCast serving 191 This would be a nice thing for the sake of completeness of VLC's streaming capabilities. 192 Status: Todo 186 193 187 194 Task configure.ac
r7b55e81 rbf680e8 121 121 VLC_ADD_LDFLAGS([vlc ffmpeg],[-all_load]) 122 122 VLC_ADD_LDFLAGS([mp4], [-framework IOKit -framework CoreFoundation]) 123 VLC_ADD_CFLAGS([vlc],[-x objective-c]) 123 124 VLC_ADD_LDFLAGS([vlc],[-Wl,-multiply_defined,suppress]) 124 125 ;; … … 1238 1239 if test -n "${enable_dvdread}" 1239 1240 then 1240 AC_MSG_WARN([Please get libdvdread from http://www.dtek.chalmers.se/groups/dvd/downloads.shtml])1241 1241 AC_MSG_ERROR([cannot find libdvdread headers]) 1242 1242 fi extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
r458cd04 rbf680e8 22 22 <key>IBOpenObjects</key> 23 23 <array> 24 <integer>21</integer> 25 <integer>1617</integer> 26 <integer>1647</integer> 24 27 <integer>29</integer> 25 <integer>1617</integer>26 <integer>21</integer>27 <integer>1647</integer>28 28 </array> 29 29 <key>IBSystem Version</key> 30 <string>7 F44</string>30 <string>7H63</string> 31 31 </dict> 32 32 </plist> modules/gui/macosx/applescript.m
r8b501c4 rbf680e8 42 42 if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] ) 43 43 { 44 intf_thread_t * p_intf = [NSApp getIntf];44 intf_thread_t * p_intf = VLCIntf; 45 45 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 46 46 FIND_ANYWHERE ); … … 85 85 NSString *o_command = [[self commandDescription] commandName]; 86 86 87 intf_thread_t * p_intf = [NSApp getIntf];87 intf_thread_t * p_intf = VLCIntf; 88 88 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 89 89 FIND_ANYWHERE ); modules/gui/macosx/controls.m
r103019a rbf680e8 46 46 vlc_value_t val; 47 47 playlist_t * p_playlist; 48 intf_thread_t * p_intf = [NSApp getIntf];48 intf_thread_t * p_intf = VLCIntf; 49 49 input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, 50 50 FIND_ANYWHERE ); … … 88 88 - (IBAction)stop:(id)sender 89 89 { 90 intf_thread_t * p_intf = [NSApp getIntf];90 intf_thread_t * p_intf = VLCIntf; 91 91 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 92 92 FIND_ANYWHERE ); … … 101 101 - (IBAction)faster:(id)sender 102 102 { 103 intf_thread_t * p_intf = [NSApp getIntf];103 intf_thread_t * p_intf = VLCIntf; 104 104 input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, 105 105 FIND_ANYWHERE ); … … 116 116 - (IBAction)slower:(id)sender 117 117 { 118 intf_thread_t * p_intf = [NSApp getIntf];118 intf_thread_t * p_intf = VLCIntf; 119 119 input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, 120 120 FIND_ANYWHERE ); … … 131 131 - (IBAction)prev:(id)sender 132 132 { 133 intf_thread_t * p_intf = [NSApp getIntf];133 intf_thread_t * p_intf = VLCIntf; 134 134 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 135 135 FIND_ANYWHERE ); … … 144 144 - (IBAction)next:(id)sender 145 145 { 146 intf_thread_t * p_intf = [NSApp getIntf];146 intf_thread_t * p_intf = VLCIntf; 147 147 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 148 148 FIND_ANYWHERE ); … … 157 157 - (IBAction)random:(id)sender 158 158 { 159 intf_thread_t * p_intf = [NSApp getIntf];159 intf_thread_t * p_intf = VLCIntf; 160 160 vlc_value_t val; 161 161 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, … … 185 185 - (IBAction)repeat:(id)sender 186 186 { 187 intf_thread_t * p_intf = [NSApp getIntf];187 intf_thread_t * p_intf = VLCIntf; 188 188 vlc_value_t val; 189 189 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, … … 217 217 - (IBAction)loop:(id)sender 218 218 { 219 intf_thread_t * p_intf = [NSApp getIntf];219 intf_thread_t * p_intf = VLCIntf; 220 220 vlc_value_t val; 221 221 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, … … 249 249 - (IBAction)forward:(id)sender 250 250 { 251 intf_thread_t * p_intf = [NSApp getIntf];251 intf_thread_t * p_intf = VLCIntf; 252 252 input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, 253 253 FIND_ANYWHERE ); … … 264 264 - (IBAction)backward:(id)sender 265 265 { 266 intf_thread_t * p_intf = [NSApp getIntf];266 intf_thread_t * p_intf = VLCIntf; 267 267 input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, 268 268 FIND_ANYWHERE ); … … 280 280 - (IBAction)volumeUp:(id)sender 281 281 { 282 intf_thread_t * p_intf = [NSApp getIntf];282 intf_thread_t * p_intf = VLCIntf; 283 283 284 284 if( p_intf->p_sys->b_mute ) … … 294 294 - (IBAction)volumeDown:(id)sender 295 295 { 296 intf_thread_t * p_intf = [NSApp getIntf];296 intf_thread_t * p_intf = VLCIntf; 297 297 298 298 if( p_intf->p_sys->b_mute ) … … 308 308 - (IBAction)mute:(id)sender 309 309 { 310 intf_thread_t * p_intf = [NSApp getIntf];310 intf_thread_t * p_intf = VLCIntf; 311 311 audio_volume_t i_volume; 312 312 … … 319 319 - (IBAction)volumeSliderUpdated:(id)sender 320 320 { 321 intf_thread_t * p_intf = [NSApp getIntf];321 intf_thread_t * p_intf = VLCIntf; 322 322 audio_volume_t i_volume = (audio_volume_t)[sender intValue]; 323 323 … … 327 327 - (void)updateVolumeSlider 328 328 { 329 intf_thread_t * p_intf = [NSApp getIntf];329 intf_thread_t * p_intf = VLCIntf; 330 330 audio_volume_t i_volume; 331 331 … … 344 344 NSArray *o_windows = [NSApp orderedWindows]; 345 345 NSEnumerator *o_enumerator = [o_windows objectEnumerator]; 346 vout_thread_t *p_vout = vlc_object_find( [NSApp getIntf], VLC_OBJECT_VOUT,346 vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, 347 347 FIND_ANYWHERE ); 348 348 … … 409 409 /* Get the descriptive name of the variable */ 410 410 var_Change( p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL ); 411 [o_mi setTitle: [ NSApplocalizedString: text.psz_string ?411 [o_mi setTitle: [[VLCMain sharedInstance] localizedString: text.psz_string ? 412 412 text.psz_string : strdup( psz_variable ) ]]; 413 413 … … 524 524 strdup(val_list.p_list->p_values[i].psz_string); 525 525 526 o_title = [ NSApplocalizedString: text_list.p_list->p_values[i].psz_string ?526 o_title = [[VLCMain sharedInstance] localizedString: text_list.p_list->p_values[i].psz_string ? 527 527 text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string ]; 528 528 … … 541 541 542 542 o_title = text_list.p_list->p_values[i].psz_string ? 543 [ NSApplocalizedString: strdup( text_list.p_list->p_values[i].psz_string )] :543 [[VLCMain sharedInstance] localizedString: strdup( text_list.p_list->p_values[i].psz_string )] : 544 544 [NSString stringWithFormat: @"%d", 545 545 val_list.p_list->p_values[i].i_int]; … … 581 581 VLCMenuExt *o_data = (VLCMenuExt *)_o_data; 582 582 583 vlc_thread_set_priority( [NSApp getIntf], VLC_THREAD_PRIORITY_LOW );584 585 p_object = (vlc_object_t *)vlc_object_get( [NSApp getIntf],583 vlc_thread_set_priority( VLCIntf , VLC_THREAD_PRIORITY_LOW ); 584 585 p_object = (vlc_object_t *)vlc_object_get( VLCIntf, 586 586 [o_data objectID] ); 587 587 … … 605 605 BOOL bEnabled = TRUE; 606 606 vlc_value_t val; 607 intf_thread_t * p_intf = [NSApp getIntf];607 intf_thread_t * p_intf = VLCIntf; 608 608 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 609 609 FIND_ANYWHERE ); modules/gui/macosx/intf.h
r5f6c3bf rbf680e8 32 32 33 33 /***************************************************************************** 34 * VLCApplication interface 35 *****************************************************************************/ 36 @interface VLCApplication : NSApplication 37 { 38 intf_thread_t *p_intf; 39 } 40 41 - (NSString *)localizedString:(char *)psz; 42 - (char *)delocalizeString:(NSString *)psz; 43 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width; 44 45 - (void)setIntf:(intf_thread_t *)p_intf; 46 - (intf_thread_t *)getIntf; 47 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event; 48 49 @end 50 51 #define _NS(s) [NSApp localizedString: _(s)] 34 * Local prototypes. 35 *****************************************************************************/ 36 int ExecuteOnMainThread( id target, SEL sel, void * p_arg ); 37 unsigned int CocoaKeyToVLC( unichar i_key ); 38 39 #define VLCIntf [[VLCMain sharedInstance] getIntf] 40 41 #define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)] 52 42 /* Get an alternate version of the string. 53 43 * This string is stored as '1:string' but when displayed it only displays 54 44 * the translated string. the translation should be '1:translatedstring' though */ 55 #define _ANS(s) [[NSApp localizedString: _(s)] substringFromIndex:2] 56 57 int ExecuteOnMainThread( id target, SEL sel, void * p_arg ); 58 int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable, 59 vlc_value_t old_val, vlc_value_t new_val, void *param ); 60 unsigned int CocoaKeyToVLC( unichar i_key ); 45 #define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2] 61 46 62 47 /***************************************************************************** … … 93 78 @interface VLCMain : NSObject 94 79 { 80 intf_thread_t *p_intf; /* The main intf object */ 95 81 id o_prefs; /* VLCPrefs */ 96 82 … … 239 225 } 240 226 227 + (VLCMain *)sharedInstance; 228 229 - (intf_thread_t *)getIntf; 230 - (void)setIntf:(intf_thread_t *)p_mainintf; 231 241 232 - (id)getControls; 242 233 - (id)getPlaylist; 243 234 - (id)getInfo; 244 235 - (void)terminate; 236 - (NSString *)localizedString:(char *)psz; 237 - (char *)delocalizeString:(NSString *)psz; 238 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width; 239 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event; 245 240 246 241 - (void)initStrings; modules/gui/macosx/intf.m
r103019a rbf680e8 71 71 p_intf->pf_run = Run; 72 72 73 [VLCApplication sharedApplication]; 74 [NSApp setIntf: p_intf]; 75 76 [NSBundle loadNibNamed: @"MainMenu" owner: NSApp]; 73 [[VLCMain sharedInstance] setIntf: p_intf]; 77 74 78 75 return( 0 ); … … 103 100 * (???) --Meuuh */ 104 101 vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW ); 105 106 [NSApp run]; 107 } 108 109 /***************************************************************************** 110 * VLCApplication implementation 111 *****************************************************************************/ 112 @implementation VLCApplication 113 114 - (NSString *)localizedString:(char *)psz 115 { 116 NSString * o_str = nil; 117 118 if( psz != NULL ) 119 { 120 o_str = [[[NSString alloc] initWithUTF8String: psz] autorelease]; 121 } 122 if ( o_str == NULL ) 123 { 124 msg_Err( p_intf, "could not translate: %s", psz ); 125 } 126 127 return( o_str ); 128 } 129 130 - (char *)delocalizeString:(NSString *)id 131 { 132 NSData * o_data = [id dataUsingEncoding: NSUTF8StringEncoding 133 allowLossyConversion: NO]; 134 char * psz_string; 135 136 if ( o_data == nil ) 137 { 138 o_data = [id dataUsingEncoding: NSUTF8StringEncoding 139 allowLossyConversion: YES]; 140 psz_string = malloc( [o_data length] + 1 ); 141 [o_data getBytes: psz_string]; 142 psz_string[ [o_data length] ] = '\0'; 143 msg_Err( p_intf, "cannot convert to wanted encoding: %s", 144 psz_string ); 145 } 146 else 147 { 148 psz_string = malloc( [o_data length] + 1 ); 149 [o_data getBytes: psz_string]; 150 psz_string[ [o_data length] ] = '\0'; 151 } 152 153 return psz_string; 154 } 155 156 /* i_width is in pixels */ 157 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int) i_width 158 { 159 NSMutableString *o_wrapped; 160 NSString *o_out_string; 161 NSRange glyphRange, effectiveRange, charRange; 162 NSRect lineFragmentRect; 163 unsigned glyphIndex, breaksInserted = 0; 164 165 NSTextStorage *o_storage = [[NSTextStorage alloc] initWithString: o_in_string 166 attributes: [NSDictionary dictionaryWithObjectsAndKeys: 167 [NSFont labelFontOfSize: 0.0], NSFontAttributeName, nil]]; 168 NSLayoutManager *o_layout_manager = [[NSLayoutManager alloc] init]; 169 NSTextContainer *o_container = [[NSTextContainer alloc] 170 initWithContainerSize: NSMakeSize(i_width, 2000)]; 171 172 [o_layout_manager addTextContainer: o_container]; 173 [o_container release]; 174 [o_storage addLayoutManager: o_layout_manager]; 175 [o_layout_manager release]; 176 177 o_wrapped = [o_in_string mutableCopy]; 178 glyphRange = [o_layout_manager glyphRangeForTextContainer: o_container]; 179 180 for( glyphIndex = glyphRange.location ; glyphIndex < NSMaxRange(glyphRange) ; 181 glyphIndex += effectiveRange.length) { 182 lineFragmentRect = [o_layout_manager lineFragmentRectForGlyphAtIndex: glyphIndex 183 effectiveRange: &effectiveRange]; 184 charRange = [o_layout_manager characterRangeForGlyphRange: effectiveRange 185 actualGlyphRange: &effectiveRange]; 186 if ([o_wrapped lineRangeForRange: 187 NSMakeRange(charRange.location + breaksInserted, charRange.length)].length > charRange.length) { 188 [o_wrapped insertString: @"\n" atIndex: NSMaxRange(charRange) + breaksInserted]; 189 breaksInserted++; 190 } 191 } 192 o_out_string = [NSString stringWithString: o_wrapped]; 193 [o_wrapped release]; 194 [o_storage release]; 195 196 return o_out_string; 197 } 198 199 - (void)setIntf:(intf_thread_t *)_p_intf 200 { 201 p_intf = _p_intf; 202 } 203 204 - (intf_thread_t *)getIntf 205 { 206 return( p_intf ); 207 } 208 209 - (void)terminate:(id)sender 210 { 211 p_intf->p_vlc->b_die = VLC_TRUE; 212 [super terminate:sender]; 213 } 214 215 216 /***************************************************************************** 217 * hasDefinedShortcutKey: Check to see if the key press is a defined VLC 218 * shortcut key. If it is, pass it off to VLC for handling and return YES, 219 * otherwise ignore it and return NO (where it will get handled by Cocoa). 220 *****************************************************************************/ 221 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event 222 { 223 unichar key = 0; 224 vlc_value_t val; 225 unsigned int i_pressed_modifiers = 0; 226 struct hotkey *p_hotkeys; 227 int i; 228 229 val.i_int = 0; 230 p_hotkeys = p_intf->p_vlc->p_hotkeys; 231 232 i_pressed_modifiers = [o_event modifierFlags]; 233 234 if( i_pressed_modifiers & NSShiftKeyMask ) 235 val.i_int |= KEY_MODIFIER_SHIFT; 236 if( i_pressed_modifiers & NSControlKeyMask ) 237 val.i_int |= KEY_MODIFIER_CTRL; 238 if( i_pressed_modifiers & NSAlternateKeyMask ) 239 val.i_int |= KEY_MODIFIER_ALT; 240 if( i_pressed_modifiers & NSCommandKeyMask ) 241 val.i_int |= KEY_MODIFIER_COMMAND; 242 243 key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0]; 244 245 val.i_int |= CocoaKeyToVLC( key ); 246 247 for( i = 0; p_hotkeys[i].psz_action != NULL; i++ ) 248 { 249 if( p_hotkeys[i].i_key == val.i_int ) 250 { 251 var_Set( p_intf->p_vlc, "key-pressed", val ); 252 return YES; 253 } 254 } 255 256 return NO; 257 } 258 259 @end 102 [NSBundle loadNibNamed: @"MainMenu" owner: NSApp]; 103 } 260 104 261 105 int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) … … 272 116 waitUntilDone: YES]; 273 117 } 274 else if( NSApp != nil && [ NSApprespondsToSelector: @selector(getIntf)] )118 else if( NSApp != nil && [[VLCMain sharedInstance] respondsToSelector: @selector(getIntf)] ) 275 119 { 276 120 NSValue * o_v1; … … 286 130 id * val[] = { &o_lock, &o_v2 }; 287 131 288 p_intf = (intf_thread_t *) [NSApp getIntf];132 p_intf = (intf_thread_t *)VLCIntf; 289 133 290 134 o_recv_port = [[NSPort port] retain]; … … 330 174 vlc_value_t old_val, vlc_value_t new_val, void *param ) 331 175 { 332 intf_thread_t * p_intf = [NSApp getIntf];176 intf_thread_t * p_intf = VLCIntf; 333 177 p_intf->p_sys->b_playlist_update = TRUE; 334 178 p_intf->p_sys->b_intf_update = TRUE; … … 418 262 @implementation VLCMain 419 263 264 static VLCMain *_o_sharedMainInstance = nil; 265 266 + (VLCMain *)sharedInstance 267 { 268 return _o_sharedMainInstance ? _o_sharedMainInstance : [[self alloc] init]; 269 } 270 271 - (id)init 272 { 273 if (_o_sharedMainInstance) { 274 [self dealloc]; 275 } else { 276 _o_sharedMainInstance = [super init]; 277 } 278 279 return _o_sharedMainInstance; 280 } 281 282 - (void)setIntf: (intf_thread_t *)p_mainintf { 283 p_intf = p_mainintf; 284 } 285 286 - (intf_thread_t *)getIntf { 287 return p_intf; 288 } 289 420 290 - (void)awakeFromNib 421 291 { 422 292 unsigned int i_key = 0; 423 intf_thread_t * p_intf = [NSApp getIntf];293 intf_thread_t * p_intf = VLCIntf; 424 294 playlist_t *p_playlist; 425 295 vlc_value_t val; … … 633 503 - (void)applicationWillFinishLaunching:(NSNotification *)o_notification 634 504 { 635 intf_thread_t * p_intf = [NSApp getIntf];636 637 505 o_msg_lock = [[NSLock alloc] init]; 638 506 o_msg_arr = [[NSMutableArray arrayWithCapacity: 200] retain]; … … 660 528 vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW ); 661 529 } 662 530 /* 663 531 - (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename 664 532 { … … 669 537 return( TRUE ); 670 538 } 539 */ 540 - (NSString *)localizedString:(char *)psz 541 { 542 NSString * o_str = nil; 543 544 if( psz != NULL ) 545 { 546 o_str = [[[NSString alloc] initWithUTF8String: psz] autorelease]; 547 } 548 if ( o_str == NULL ) 549 { 550 msg_Err( VLCIntf, "could not translate: %s", psz ); 551 } 552 553 return( o_str ); 554 } 555 556 - (char *)delocalizeString:(NSString *)id 557 { 558 NSData * o_data = [id dataUsingEncoding: NSUTF8StringEncoding 559 allowLossyConversion: NO]; 560 char * psz_string; 561 562 if ( o_data == nil ) 563 { 564 o_data = [id dataUsingEncoding: NSUTF8StringEncoding 565 allowLossyConversion: YES]; 566 psz_string = malloc( [o_data length] + 1 ); 567 [o_data getBytes: psz_string]; 568 psz_string[ [o_data length] ] = '\0'; 569 msg_Err( VLCIntf, "cannot convert to wanted encoding: %s", 570 psz_string ); 571 } 572 else 573 { 574 psz_string = malloc( [o_data length] + 1 ); 575 [o_data getBytes: psz_string]; 576 psz_string[ [o_data length] ] = '\0'; 577 } 578 579 return psz_string; 580 } 581 582 /* i_width is in pixels */ 583 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int) i_width 584 { 585 NSMutableString *o_wrapped; 586 NSString *o_out_string; 587 NSRange glyphRange, effectiveRange, charRange; 588 NSRect lineFragmentRect; 589 unsigned glyphIndex, breaksInserted = 0; 590 591 NSTextStorage *o_storage = [[NSTextStorage alloc] initWithString: o_in_string 592 attributes: [NSDictionary dictionaryWithObjectsAndKeys: 593 [NSFont labelFontOfSize: 0.0], NSFontAttributeName, nil]]; 594 NSLayoutManager *o_layout_manager = [[NSLayoutManager alloc] init]; 595 NSTextContainer *o_container = [[NSTextContainer alloc] 596 initWithContainerSize: NSMakeSize(i_width, 2000)]; 597 598 [o_layout_manager addTextContainer: o_container]; 599 [o_container release]; 600 [o_storage addLayoutManager: o_layout_manager]; 601 [o_layout_manager release]; 602 603 o_wrapped = [o_in_string mutableCopy]; 604 glyphRange = [o_layout_manager glyphRangeForTextContainer: o_container]; 605 606 for( glyphIndex = glyphRange.location ; glyphIndex < NSMaxRange(glyphRange) ; 607 glyphIndex += effectiveRange.length) { 608 lineFragmentRect = [o_layout_manager lineFragmentRectForGlyphAtIndex: glyphIndex 609 effectiveRange: &effectiveRange]; 610 charRange = [o_layout_manager characterRangeForGlyphRange: effectiveRange 611 actualGlyphRange: &effectiveRange]; 612 if ([o_wrapped lineRangeForRange: 613 NSMakeRange(charRange.location + breaksInserted, charRange.length)].length > charRange.length) { 614 [o_wrapped insertString: @"\n" atIndex: NSMaxRange(charRange) + breaksInserted]; 615 breaksInserted++; 616 } 617 } 618 o_out_string = [NSString stringWithString: o_wrapped]; 619 [o_wrapped release]; 620 [o_storage release]; 621 622 return o_out_string; 623 } 624 625 626 /***************************************************************************** 627 * hasDefinedShortcutKey: Check to see if the key press is a defined VLC 628 * shortcut key. If it is, pass it off to VLC for handling and return YES, 629 * otherwise ignore it and return NO (where it will get handled by Cocoa). 630 *****************************************************************************/ 631 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event 632 { 633 unichar key = 0; 634 vlc_value_t val; 635 unsigned int i_pressed_modifiers = 0; 636 struct hotkey *p_hotkeys; 637 int i; 638 639 val.i_int = 0; 640 p_hotkeys = VLCIntf->p_vlc->p_hotkeys; 641 642 i_pressed_modifiers = [o_event modifierFlags]; 643 644 if( i_pressed_modifiers & NSShiftKeyMask ) 645 val.i_int |= KEY_MODIFIER_SHIFT; 646 if( i_pressed_modifiers & NSControlKeyMask ) 647 val.i_int |= KEY_MODIFIER_CTRL; 648 if( i_pressed_modifiers & NSAlternateKeyMask ) 649 val.i_int |= KEY_MODIFIER_ALT; 650 if( i_pressed_modifiers & NSCommandKeyMask ) 651 val.i_int |= KEY_MODIFIER_COMMAND; 652 653 key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0]; 654 655 val.i_int |= CocoaKeyToVLC( key ); 656 657 for( i = 0; p_hotkeys[i].psz_action != NULL; i++ ) 658 { 659 if( p_hotkeys[i].i_key == val.i_int ) 660 { 661 var_Set( VLCIntf->p_vlc, "key-pressed", val ); 662 return YES; 663 } 664 } 665 666 return NO; 667 } 671 668 672 669 - (id)getControls … … 700 697 { 701 698 NSDate * o_sleep_date; 702 intf_thread_t * p_intf = [NSApp getIntf];703 699 NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; 704 700 … … 770 766 - (void)manageIntf:(NSTimer *)o_timer 771 767 { 772 intf_thread_t * p_intf = [NSApp getIntf];773 774 768 if( p_intf->p_vlc->b_die == VLC_TRUE ) 775 769 { … … 951 945 - (void)setupMenus 952 946 { 953 intf_thread_t * p_intf = [NSApp getIntf];954 947 playlist_t *p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 955 948 FIND_ANYWHERE ); … … 1014 1007 { 1015 1008 int i_start, i_stop; 1016 intf_thread_t * p_intf = [NSApp getIntf];1017 1009 vlc_value_t quiet; 1018 1010 … … 1132 1124 { 1133 1125 audio_volume_t i_volume; 1134 intf_thread_t * p_intf = [NSApp getIntf];1135 1126 1136 1127 aout_VolumeGet( p_intf, &i_volume ); … … 1160 1151 } 1161 1152 1162 p_intf = [NSApp getIntf];1163 1153 p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, 1164 1154 FIND_ANYWHERE ); … … 1195 1185 - (void)terminate 1196 1186 { 1197 NSEvent * o_event;1198 1187 playlist_t * p_playlist; 1199 1188 vout_thread_t * p_vout; 1200 intf_thread_t * p_intf = [NSApp getIntf];1201 1189 1202 1190 /* Stop playback */ … … 1258 1246 } 1259 1247 1260 [NSApp stop: nil];1261 [NSApp terminate: nil];1262 1263 1248 /* write cached user defaults to disk */ 1264 1249 [[NSUserDefaults standardUserDefaults] synchronize]; 1265 1266 /* send a dummy event to break out of the event loop */ 1267 o_event = [NSEvent mouseEventWithType: NSLeftMouseDown 1268 location: NSMakePoint( 1, 1 ) modifierFlags: 0 1269 timestamp: 1 windowNumber: [[NSApp mainWindow] windowNumber] 1270 context: [NSGraphicsContext currentContext] eventNumber: 1 1271 clickCount: 1 pressure: 0.0]; 1272 [NSApp postEvent: o_event atStart: YES]; 1250 1251 p_intf->b_die = VLC_TRUE; 1252 [NSApp stop:NULL]; 1273 1253 } 1274 1254 … … 1292 1272 { 1293 1273 vlc_value_t val; 1294 intf_thread_t * p_intf = [NSApp getIntf]; 1295 1274 1296 1275 if( [o_err_ckbk_surpress state] == NSOnState ) 1297 1276 { modules/gui/macosx/misc.m
rae157fb rbf680e8 45 45 - (BOOL)performKeyEquivalent:(NSEvent *)o_event 46 46 { 47 return [( (VLCApplication *) [VLCApplication sharedApplication] ) 48 hasDefinedShortcutKey:o_event]; 47 return [[VLCMain sharedInstance] hasDefinedShortcutKey:o_event]; 49 48 } 50 49 … … 111 110 o_array = [o_array arrayByAddingObject: o_dic]; 112 111 } 113 [(VLCPlaylist *)[[ NSApp delegate] getPlaylist] appendArray: o_array atPos: -1 enqueue:NO];112 [(VLCPlaylist *)[[VLCMain sharedInstance] getPlaylist] appendArray: o_array atPos: -1 enqueue:NO]; 114 113 return YES; 115 114 } … … 189 188 o_array = [o_array arrayByAddingObject: o_dic]; 190 189 } 191 [ (VLCPlaylist *)[[NSApp delegate] getPlaylist] appendArray: o_array atPos: -1 enqueue:NO];190 [[[VLCMain sharedInstance] getPlaylist] appendArray: o_array atPos: -1 enqueue:NO]; 192 191 return YES; 193 192 } modules/gui/macosx/open.m
r136957e rbf680e8 131 131 - (void)awakeFromNib 132 132 { 133 intf_thread_t * p_intf = [NSApp getIntf];133 intf_thread_t * p_intf = VLCIntf; 134 134 135 135 [o_panel setTitle: _NS("Open Source")]; … … 574 574 NSString *o_mode; 575 575 NSString *o_mrl_string = [NSString string]; 576 intf_thread_t * p_intf = [NSApp getIntf];576 intf_thread_t * p_intf = VLCIntf; 577 577 578 578 o_mode = [[o_net_mode selectedCell] title]; modules/gui/macosx/output.m
rd6d2450 rbf680e8 398 398 - (void)TTLChanged:(NSNotification *)o_notification 399 399 { 400 intf_thread_t * p_intf = [NSApp getIntf];400 intf_thread_t * p_intf = VLCIntf; 401 401 config_PutInt( p_intf, "ttl", [o_stream_ttl intValue] ); 402 402 } modules/gui/macosx/playlist.m
r11e8ae9 rbf680e8 57 57 58 58 playlist_t * p_playlist; 59 intf_thread_t * p_intf = [NSApp getIntf];59 intf_thread_t * p_intf = VLCIntf; 60 60 61 61 if( [[o_event characters] length] ) … … 192 192 didClickTableColumn:(NSTableColumn *)o_tc 193 193 { 194 intf_thread_t * p_intf = [NSApp getIntf];194 intf_thread_t * p_intf = VLCIntf; 195 195 playlist_t *p_playlist = 196 196 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, … … 265 265 - (NSMenu *)menuForEvent:(NSEvent *)o_event 266 266 { 267 intf_thread_t * p_intf = [NSApp getIntf];267 intf_thread_t * p_intf = VLCIntf; 268 268 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 269 269 FIND_ANYWHERE ); … … 317 317 - (IBAction)savePlaylist:(id)sender 318 318 { 319 intf_thread_t * p_intf = [NSApp getIntf];319 intf_thread_t * p_intf = VLCIntf; 320 320 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 321 321 FIND_ANYWHERE ); … … 336 336 - (IBAction)playItem:(id)sender 337 337 { 338 intf_thread_t * p_intf = [NSApp getIntf];338 intf_thread_t * p_intf = VLCIntf; 339 339 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 340 340 FIND_ANYWHERE ); … … 353 353 NSNumber *o_number; 354 354 355 intf_thread_t * p_intf = [NSApp getIntf];355 intf_thread_t * p_intf = VLCIntf; 356 356 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 357 357 FIND_ANYWHERE ); … … 393 393 NSNumber *o_number; 394 394 395 intf_thread_t * p_intf = [NSApp getIntf];395 intf_thread_t * p_intf = VLCIntf; 396 396 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 397 397 FIND_ANYWHERE ); … … 435 435 - (IBAction)enableGroup:(id)sender 436 436 { 437 intf_thread_t * p_intf = [NSApp getIntf];437 intf_thread_t * p_intf = VLCIntf; 438 438 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 439 439 FIND_ANYWHERE ); … … 449 449 - (IBAction)disableGroup:(id)sender 450 450 { 451 intf_thread_t * p_intf = [NSApp getIntf];451 intf_thread_t * p_intf = VLCIntf; 452 452 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 453 453 FIND_ANYWHERE ); … … 473 473 NSString *o_current_author; 474 474 475 intf_thread_t * p_intf = [NSApp getIntf];475 intf_thread_t * p_intf = VLCIntf; 476 476 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 477 477 FIND_ANYWHERE ); … … 529 529 530 530 { 531 intf_thread_t * p_intf = [NSApp getIntf];531 intf_thread_t * p_intf = VLCIntf; 532 532 vlc_value_t val1,val2; 533 533 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, … … 577 577 { 578
