<string>id</string>
<key>setBackgroundStyle</key>
<string>id</string>
+ <key>setBadgeImageWithAppIcon</key>
+ <string>id</string>
+ <key>setImageNoUpscale</key>
+ <string>id</string>
+ <key>setImageSize</key>
+ <string>id</string>
+ <key>setIndentWrap</key>
+ <string>id</string>
<key>setScreen</key>
<string>id</string>
<key>setVanishDelay</key>
<string>id</string>
<key>setWindowSize</key>
<string>id</string>
+ <key>setWrap</key>
+ <string>id</string>
+ <key>setWrapColumns</key>
+ <string>id</string>
</dict>
<key>CLASS</key>
<string>GrowlITTSWPrefs</string>
<string>NSColorWell</string>
<key>backgroundStyleButton</key>
<string>NSPopUpButton</string>
+ <key>badgeImageWithAppIconButton</key>
+ <string>NSButton</string>
+ <key>imageNoUpscaleButton</key>
+ <string>NSButton</string>
+ <key>imageSizeSlider</key>
+ <string>NSSlider</string>
+ <key>indentWrapButton</key>
+ <string>NSButton</string>
<key>screenButton</key>
<string>NSPopUpButton</string>
<key>slider_opacity</key>
<string>NSSlider</string>
<key>windowSizeButton</key>
<string>NSPopUpButton</string>
+ <key>wrapColumnsField</key>
+ <string>NSTextField</string>
+ <key>wrapNotificationsButton</key>
+ <string>NSButton</string>
</dict>
<key>SUPERCLASS</key>
<string>NSPreferencePane</string>
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
32DBCF630370AF2F00C91783 /* GrowlITTSW_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrowlITTSW_Prefix.pch; sourceTree = "<group>"; };
- 8D5B49B6048680CD000E48DA /* GrowlITTSW.growlView */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GrowlITTSW.growlView; sourceTree = BUILT_PRODUCTS_DIR; };
+ 8D5B49B6048680CD000E48DA /* ITTSW.growlView */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ITTSW.growlView; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
FA4A471D0F5A3C2A00F37A2B /* GrowlITTSWDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrowlITTSWDisplay.h; sourceTree = "<group>"; };
19C28FB8FE9D52D311CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
- 8D5B49B6048680CD000E48DA /* GrowlITTSW.growlView */,
+ 8D5B49B6048680CD000E48DA /* ITTSW.growlView */,
);
name = Products;
sourceTree = "<group>";
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
- 8D5B49AC048680CD000E48DA /* GrowlITTSW */ = {
+ 8D5B49AC048680CD000E48DA /* ITTSW */ = {
isa = PBXNativeTarget;
- buildConfigurationList = 1DEB913A08733D840010E9CD /* Build configuration list for PBXNativeTarget "GrowlITTSW" */;
+ buildConfigurationList = 1DEB913A08733D840010E9CD /* Build configuration list for PBXNativeTarget "ITTSW" */;
buildPhases = (
8D5B49AF048680CD000E48DA /* Resources */,
8D5B49B1048680CD000E48DA /* Sources */,
FA4A474A0F5A3CD300F37A2B /* PBXTargetDependency */,
FA4A474C0F5A3CD500F37A2B /* PBXTargetDependency */,
);
- name = GrowlITTSW;
+ name = ITTSW;
productInstallPath = "$(HOME)/Library/Bundles";
productName = GrowlITTSW;
- productReference = 8D5B49B6048680CD000E48DA /* GrowlITTSW.growlView */;
+ productReference = 8D5B49B6048680CD000E48DA /* ITTSW.growlView */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
);
projectRoot = "";
targets = (
- 8D5B49AC048680CD000E48DA /* GrowlITTSW */,
+ 8D5B49AC048680CD000E48DA /* ITTSW */,
);
};
/* End PBXProject section */
"-undefined",
dynamic_lookup,
);
- PRODUCT_NAME = GrowlITTSW;
+ PRODUCT_NAME = ITTSW;
REZ_RESOURCE_MAP_READ_ONLY = YES;
WRAPPER_EXTENSION = growlView;
};
"-undefined",
dynamic_lookup,
);
- PRODUCT_NAME = GrowlITTSW;
+ PRODUCT_NAME = ITTSW;
REZ_RESOURCE_MAP_READ_ONLY = YES;
WRAPPER_EXTENSION = growlView;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- 1DEB913A08733D840010E9CD /* Build configuration list for PBXNativeTarget "GrowlITTSW" */ = {
+ 1DEB913A08733D840010E9CD /* Build configuration list for PBXNativeTarget "ITTSW" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB913B08733D840010E9CD /* Debug */,
@interface GrowlITTSWController : ITSharedController {
GrowlITTSWWindow *_window;
+ float _imageSize;
+ BOOL _imageNoUpscale;
+ BOOL _wrapNotifications;
+ int _wrapColumns;
}
-- (void)showWindowWithText:(NSString *)text image:(NSImage *)image;
+- (void)showWindowWithTitle:(NSString *)title text:(NSString *)text image:(NSImage *)image;
@end
}
- (void)syncWithPrefs {
+ _imageSize = [GrowlITTSWPrefs imageSize];
+ _imageNoUpscale = [GrowlITTSWPrefs imageNoUpscale];
+ _wrapNotifications = [GrowlITTSWPrefs wrapNotifications];
+ _wrapColumns = [GrowlITTSWPrefs wrapColumns];
+
NSScreen *screen = [GrowlITTSWPrefs screen];
ITHorizontalWindowPosition horizontalPosition = [GrowlITTSWPrefs horizontalPosition];
ITVerticalWindowPosition verticalPosition = [GrowlITTSWPrefs verticalPosition];
}
}
-- (void)showWindowWithText:(NSString *)text image:(NSImage *)image {
+- (void)showWindowWithTitle:(NSString *)title text:(NSString *)text image:(NSImage *)image {
+ if (text && ![text isEqualToString:@""] && ![text isEqualToString:@"\n"]) {
+ text = [title stringByAppendingFormat:@"\n%@", text];
+ }
+
NSSize newSize;
NSSize oldSize = [image size];
+ BOOL wouldUpscale = ((oldSize.width <= _imageSize) && (oldSize.height <= _imageSize));
+
+ if (!(wouldUpscale && _imageNoUpscale)) {
+ if (oldSize.width > oldSize.height) {
+ newSize = NSMakeSize(_imageSize, (oldSize.height * (_imageSize / oldSize.width)));
+ } else {
+ newSize = NSMakeSize((oldSize.width * (_imageSize / oldSize.height)), _imageSize);
+ }
+
+ image = [[[[NSImage alloc] initWithData:[image TIFFRepresentation]] autorelease] imageScaledSmoothlyToSize:newSize];
+ }
- if (oldSize.width > oldSize.height) {
- newSize = NSMakeSize(110.0f, (oldSize.height * (110.0f / oldSize.width)));
- } else {
- newSize = NSMakeSize((oldSize.width * (110.0f / oldSize.height)), 110.0f);
+ if (_wrapNotifications) {
+ text = [text stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(.{1,%i})(?: +|$)\\n?|(.{%i})", _wrapColumns, _wrapColumns] withString:@"$1$2\n"];
}
- image = [[[[NSImage alloc] initWithData:[image TIFFRepresentation]] autorelease] imageScaledSmoothlyToSize:newSize];
+ //trim trailing whitespace
+ text = [text stringByReplacingOccurrencesOfRegex:@"[\\s\\r\\n]+$" withString:@""];
NSArray *gothicChars = [NSArray arrayWithObjects:[NSString stringWithUTF8String:"☆"], [NSString stringWithUTF8String:"★"], nil];
NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:text];
if (([gothicChars count] > 0) && ([text length] > 0)) {
NSMutableString *gothicRegex = [[NSMutableString alloc] init];
- [gothicRegex appendString:@"["];
+ [gothicRegex appendString:@"[\\n"];
for (NSString *gothicChar in gothicChars) {
[gothicRegex appendString:gothicChar];
}
NSString *title = [dict objectForKey:GROWL_NOTIFICATION_TITLE];
NSString *desc = [dict objectForKey:GROWL_NOTIFICATION_DESCRIPTION];
NSImage *image = [dict objectForKey:GROWL_NOTIFICATION_ICON];
- NSString *text;
- if (desc) {
- text = [title stringByAppendingFormat:@"\n%@", desc];
- } else {
- text = title;
- }
- [[GrowlITTSWController sharedController] showWindowWithText:text image:image];
+ [[GrowlITTSWController sharedController] showWindowWithTitle:title text:desc image:image];
}
@end
IBOutlet NSPopUpButton *windowSizeButton;
IBOutlet NSPopUpButton *screenButton;
+ IBOutlet NSSlider *imageSizeSlider;
+ IBOutlet NSButton *imageNoUpscaleButton;
+ IBOutlet NSButton *wrapNotificationsButton;
+ IBOutlet NSTextField *wrapColumnsField;
}
+ (Class)appearanceEffect;
+ (ITHorizontalWindowPosition)horizontalPosition;
+ (ITVerticalWindowPosition)verticalPosition;
++ (float)imageSize;
++ (BOOL)imageNoUpscale;
++ (BOOL)wrapNotifications;
++ (int)wrapColumns;
+
- (IBAction)setAppearanceEffect:(id)sender;
- (IBAction)setAppearanceSpeed:(id)sender;
- (IBAction)setVanishEffect:(id)sender;
- (IBAction)setWindowSize:(id)sender;
- (IBAction)setScreen:(id)sender;
+- (IBAction)setImageSize:(id)sender;
+- (IBAction)setImageNoUpscale:(id)sender;
+- (IBAction)setWrap:(id)sender;
+- (IBAction)setWrapColumns:(id)sender;
@end
}
}
++ (float)imageSize {
+ SYNCHRONIZE_GROWL_PREFS();
+ float imageSize = 110.0f;
+ READ_GROWL_PREF_FLOAT(@"imageSize", GrowlITTSWPrefsDomain, &imageSize);
+ return imageSize;
+}
+
++ (BOOL)imageNoUpscale {
+ SYNCHRONIZE_GROWL_PREFS();
+ BOOL imageNoUpscale = NO;
+ READ_GROWL_PREF_BOOL(@"imageNoUpscale", GrowlITTSWPrefsDomain, &imageNoUpscale);
+ return imageNoUpscale;
+}
+
++ (BOOL)wrapNotifications {
+ SYNCHRONIZE_GROWL_PREFS();
+ BOOL wrapNotifications = NO;
+ READ_GROWL_PREF_BOOL(@"wrapNotifications", GrowlITTSWPrefsDomain, &wrapNotifications);
+ return wrapNotifications;
+}
+
++ (int)wrapColumns {
+ SYNCHRONIZE_GROWL_PREFS();
+ int wrapColumns = 64;
+ READ_GROWL_PREF_INT(@"wrapColumns", GrowlITTSWPrefsDomain, &wrapColumns);
+ return wrapColumns;
+}
+
- (NSString *)mainNibName {
return @"GrowlITTSWPrefs";
}
[screenButton setEnabled:NO];
}
[screenButton selectItemAtIndex:[screenButton indexOfItemWithRepresentedObject:[GrowlITTSWPrefs screen]]];
+ [imageSizeSlider setFloatValue:[GrowlITTSWPrefs imageSize]];
+ [imageNoUpscaleButton setState:([GrowlITTSWPrefs imageNoUpscale] ? NSOnState : NSOffState)];
+
+ BOOL wrapNotifications = [GrowlITTSWPrefs wrapNotifications];
+ [wrapNotificationsButton setState:(wrapNotifications ? NSOnState : NSOffState)];
+ [wrapColumnsField setIntValue:[GrowlITTSWPrefs wrapColumns]];
+ [wrapColumnsField setEnabled:wrapNotifications];
}
- (void)awakeFromNib {
UPDATE_GROWL_PREFS();
}
+- (IBAction)setImageSize:(id)sender {
+ SYNCHRONIZE_GROWL_PREFS();
+ float imageSize = [imageSizeSlider floatValue];
+ WRITE_GROWL_PREF_FLOAT(@"imageSize", imageSize, GrowlITTSWPrefsDomain);
+ UPDATE_GROWL_PREFS();
+}
+
+- (IBAction)setImageNoUpscale:(id)sender {
+ SYNCHRONIZE_GROWL_PREFS();
+ BOOL imageNoUpscale = ([imageNoUpscaleButton state] == NSOnState) ? YES : NO;
+ WRITE_GROWL_PREF_BOOL(@"imageNoUpscale", imageNoUpscale, GrowlITTSWPrefsDomain);
+ UPDATE_GROWL_PREFS();
+}
+
+- (IBAction)setWrap:(id)sender {
+ SYNCHRONIZE_GROWL_PREFS();
+ BOOL wrapNotifications = ([wrapNotificationsButton state] == NSOnState) ? YES : NO;
+ [wrapColumnsField setEnabled:wrapNotifications];
+ WRITE_GROWL_PREF_BOOL(@"wrapNotifications", wrapNotifications, GrowlITTSWPrefsDomain);
+ UPDATE_GROWL_PREFS();
+}
+
+- (IBAction)setWrapColumns:(id)sender {
+ SYNCHRONIZE_GROWL_PREFS();
+ int wrapColumns = [wrapColumnsField intValue];
+ [wrapColumnsField setIntValue:wrapColumns];
+ WRITE_GROWL_PREF_INT(@"wrapColumns", wrapColumns, GrowlITTSWPrefsDomain);
+ UPDATE_GROWL_PREFS();
+}
+
@end
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
- <string>GrowlITTSW</string>
+ <string>ITTSW</string>
<key>CFBundleIdentifier</key>
<string>com.ithinksw.growl-ittsw</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
- <string>GrowlITTSW</string>
+ <string>ITTSW</string>
<key>CFBundlePackageType</key>
<string>DISP</string>
<key>CFBundleSignature</key>