genericDevice = "Generic Device";
iPod = "iPod";
cd = "CD";
-sharedLibrary = "Shared Library";
\ No newline at end of file
+sharedLibrary = "Shared Library";
+debugmodeenabled = "Debug Mode Enabled\nAll actions MenuTunes performs will be logged\nto the console. To disable debug mode, quit\nand relaunch MenuTunes.\n\n(debug mode is enabled by holding down\nthe control key while MenuTunes opens)";
\ No newline at end of file
float iTunesVersion;
//Turn on debug mode if needed
- if ([df boolForKey:@"ITDebugMode"]) {
+ /*if ((GetCurrentKeyModifiers() & (controlKey | rightControlKey)) != 0)
+ if ((GetCurrentKeyModifiers() & (optionKey | rightOptionKey)) != 0)
+ if ((GetCurrentKeyModifiers() & (shiftKey | rightShiftKey)) != 0)*/
+ if ([df boolForKey:@"ITDebugMode"] || ((GetCurrentKeyModifiers() & (controlKey | rightControlKey)) != 0)) {
SetITDebugMode(YES);
+ [[StatusWindowController sharedController] showDebugModeEnabledWindow];
}
//Check if iTunes 4.7 or later is installed
#import <Cocoa/Cocoa.h>
#import <ITKit/ITKit.h>
+#define SMALL_DIVISOR 1.33333
+#define MINI_DIVISOR 1.66667
+
@interface StatusWindow : ITTransientStatusWindow {
NSImage *_image;
BOOL _locked;
- (void)setImage:(NSImage *)newImage;
- (void)setLocked:(BOOL)flag;
-- (void)buildTextWindowWithString:(NSString *)text;
+- (void)buildTextWindowWithString:(id)text;
- (void)buildMeterWindowWithCharacter:(NSString *)character
size:(float)size
count:(int)count
#define SW_BUTTON_DIV 12.00
#define SW_BUTTON_EXTRA_W 8.00
#define SW_SHADOW_SAT 1.25
-#define SMALL_DIVISOR 1.33333
-#define MINI_DIVISOR 1.66667
@interface StatusWindow (Private)
- (NSRect)setupWindowWithDataSize:(NSSize)dataSize;
dataHeight);
}
-- (void)buildTextWindowWithString:(NSString *)text
+- (void)buildTextWindowWithString:(id)text
{
if ( ! _locked ) {
float dataWidth = 0.0;
float dataHeight = 0.0;
NSRect dataRect;
- NSArray *lines = [text componentsSeparatedByString:@"\n"];
+ NSArray *lines = [(([text isKindOfClass:[NSString class]]) ? text : [text mutableString]) componentsSeparatedByString:@"\n"];
id oneLine = nil;
- NSEnumerator *lineEnum = [lines objectEnumerator];
+ NSEnumerator *lineEnum = [lines objectEnumerator];
float baseFontSize = 18.0;
ITTextField *textField;
NSFont *font;
} else if ( _sizing == ITTransientStatusWindowMini ) {
divisor = MINI_DIVISOR;
}
-
- font = [NSFont fontWithName:@"LucidaGrande-Bold" size:(baseFontSize / divisor)];
- attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
-
+
+ font = [NSFont fontWithName:@"LucidaGrande-Bold" size:(baseFontSize / divisor)];
+ attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
+
// Iterate over each line to get text width and height
while ( (oneLine = [lineEnum nextObject]) ) {
// Get the width of one line, adding 8.0 because Apple sucks donkey rectum.
[textField setTextColor:[NSColor whiteColor]];
[textField setCastsShadow:YES];
[[textField cell] setWraps:NO];
- [textField setStringValue:text];
+
+ if ([text isKindOfClass:[NSString class]]) {
+ [textField setStringValue:text];
+ } else {
+ [textField setAttributedStringValue:text];
+ }
+
[textField setShadowSaturation:SW_SHADOW_SAT];
[[self contentView] addSubview:textField];
divisor = MINI_DIVISOR;
}
- font = [NSFont fontWithName:@"LucidaGrande-Bold" size:( size / divisor )];
+ font = [NSFont fontWithName:@"AppleGothic" size:( size / divisor )];
attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
charSize = [character sizeWithAttributes:attr];
cellHeight = ( charSize.height + 4.0 ); // Add 4.0 for shadow
- (void)showReconnectQueryWindow;
- (void)showNetworkErrorQueryWindow;
- (void)showPreferencesUpdateWindow;
+- (void)showDebugModeEnabledWindow;
- (void)showSongInfoWindowWithSource:(ITMTRemotePlayerSource)source
title: (NSString *)title
image: (NSImage *)art
{
NSImage *image = nil;
- NSString *text = title;
+ NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:title];
if ( art != nil ) {
image = art;
}
[_window setImage:image];
+ [_window setSizing:(ITTransientStatusWindowSizing)[df integerForKey:@"statusWindowSizing"]];
if ( album ) {
- text = [text stringByAppendingString:[@"\n" stringByAppendingString:album]];
+ [[text mutableString] appendFormat:@"\n%@", album];
+ //text = [text stringByAppendingString:[@"\n" stringByAppendingString:album]];
}
if ( artist ) {
- text = [text stringByAppendingString:[@"\n" stringByAppendingString:artist]];
+ [[text mutableString] appendFormat:@"\n%@", artist];
+ //text = [text stringByAppendingString:[@"\n" stringByAppendingString:artist]];
}
if ( composer ) {
- text = [text stringByAppendingString:[@"\n" stringByAppendingString:composer]];
+ [[text mutableString] appendFormat:@"\n%@", composer];
+ //text = [text stringByAppendingString:[@"\n" stringByAppendingString:composer]];
}
if ( time ) {
- text = [text stringByAppendingString:[@"\n" stringByAppendingString:time]];
+ [[text mutableString] appendFormat:@"\n%@", time];
+ //text = [text stringByAppendingString:[@"\n" stringByAppendingString:time]];
}
if ( track ) {
- text = [text stringByAppendingString:[@"\n" stringByAppendingString:track]];
+ [[text mutableString] appendFormat:@"\n%@", track];
+ //text = [text stringByAppendingString:[@"\n" stringByAppendingString:track]];
}
if (playCount > -1) {
- text = [text stringByAppendingString:[NSString stringWithFormat:@"\n%@: %i", NSLocalizedString(@"playCount", @"Play Count"), playCount]];
+ [[text mutableString] appendFormat:@"\n%@: %i", NSLocalizedString(@"playCount", @"Play Count"), playCount];
+ //text = [text stringByAppendingString:[NSString stringWithFormat:@"\n%@: %i", NSLocalizedString(@"playCount", @"Play Count"), playCount]];
}
if ( rating > -1 ) {
NSString *ratingString = [NSString string];
NSString *emptyChar = [NSString stringWithUTF8String:"☆"];
NSString *fullChar = [NSString stringWithUTF8String:"★"];
- int i;
+ int i, start = [[text mutableString] length], size = 18;
for ( i = 1; i < 6; i++ ) {
ratingString = [ratingString stringByAppendingString:emptyChar];
}
}
-
- text = [text stringByAppendingString:[@"\n" stringByAppendingString:ratingString]];
+
+ [[text mutableString] appendFormat:@"\n%@", ratingString];
+ if ([_window sizing] == ITTransientStatusWindowSmall) {
+ size /= SMALL_DIVISOR;
+ } else if ([_window sizing] == ITTransientStatusWindowMini) {
+ size /= MINI_DIVISOR;
+ }
+ [text setAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSFont fontWithName:@"AppleGothic" size:size], NSFontAttributeName, nil, nil] range:NSMakeRange(start + 1, 5)];
+ //text = [text stringByAppendingString:[@"\n" stringByAppendingString:ratingString]];
}
- [_window setSizing:(ITTransientStatusWindowSizing)[df integerForKey:@"statusWindowSizing"]];
[_window buildTextWindowWithString:text];
[_window appear:self];
}
[_window setLocked:YES];
}
+- (void)showDebugModeEnabledWindow
+{
+ [_window setImage:[NSImage imageNamed:@"Setup"]];
+ [_window setSizing:(ITTransientStatusWindowSizing)[df integerForKey:@"statusWindowSizing"]];
+ [_window buildDialogWindowWithMessage:NSLocalizedString(@"debugmodeenabled", @"Debug Mode Enabled")
+ defaultButton:@"OK"
+ alternateButton:nil
+ target:[MainController sharedController]
+ defaultAction:@selector(cancelReconnect)
+ alternateAction:nil];
+ [_window appear:self];
+ [_window setLocked:YES];
+}
+
@end
\ No newline at end of file