X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=OSX%2FXScreenSaverConfigSheet.m;h=576c8ab3e805f6efe71131c17a6b8dc88ab9a7e7;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=7220d2c214485bcad29d649166aceca9973b34d2;hpb=2762a7d7cf8d83e68b8f635941f6609119d630ae;p=xscreensaver diff --git a/OSX/XScreenSaverConfigSheet.m b/OSX/XScreenSaverConfigSheet.m index 7220d2c2..576c8ab3 100644 --- a/OSX/XScreenSaverConfigSheet.m +++ b/OSX/XScreenSaverConfigSheet.m @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 2006-2013 Jamie Zawinski +/* xscreensaver, Copyright (c) 2006-2016 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -24,6 +24,7 @@ */ #import "XScreenSaverConfigSheet.h" +#import "Updater.h" #import "jwxyz.h" #import "InvertedSlider.h" @@ -128,6 +129,7 @@ typedef enum { SimpleXMLCommentKind, [n setName:key]; [n setObjectValue:val]; [attributes addObject:n]; + [n release]; } } @@ -148,6 +150,48 @@ typedef enum { SimpleXMLCommentKind, @end +#pragma mark textMode value transformer + +// A value transformer for mapping "url" to "3" and vice versa in the +// "textMode" preference, since NSMatrix uses NSInteger selectedIndex. + +#ifndef USE_IPHONE +@interface TextModeTransformer: NSValueTransformer {} +@end +@implementation TextModeTransformer ++ (Class)transformedValueClass { return [NSString class]; } ++ (BOOL)allowsReverseTransformation { return YES; } + +- (id)transformedValue:(id)value { + if ([value isKindOfClass:[NSString class]]) { + int i = -1; + if ([value isEqualToString:@"date"]) { i = 0; } + else if ([value isEqualToString:@"literal"]) { i = 1; } + else if ([value isEqualToString:@"file"]) { i = 2; } + else if ([value isEqualToString:@"url"]) { i = 3; } + else if ([value isEqualToString:@"program"]) { i = 4; } + if (i != -1) + value = [NSNumber numberWithInt: i]; + } + return value; +} + +- (id)reverseTransformedValue:(id)value { + if ([value isKindOfClass:[NSNumber class]]) { + switch ((int) [value doubleValue]) { + case 0: value = @"date"; break; + case 1: value = @"literal"; break; + case 2: value = @"file"; break; + case 3: value = @"url"; break; + case 4: value = @"program"; break; + } + } + return value; +} +@end +#endif // USE_IPHONE + + #pragma mark Implementing radio buttons /* The UIPickerView is a hideous and uncustomizable piece of shit. @@ -227,10 +271,13 @@ typedef enum { SimpleXMLCommentKind, webView = [[UIWebView alloc] init]; webView.delegate = self; webView.dataDetectorTypes = UIDataDetectorTypeNone; - self. autoresizingMask = (UIViewAutoresizingFlexibleWidth | - UIViewAutoresizingFlexibleHeight); - webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | - UIViewAutoresizingFlexibleHeight); + self. autoresizingMask = UIViewAutoresizingNone; // we do it manually + webView.autoresizingMask = UIViewAutoresizingNone; + webView.scrollView.scrollEnabled = NO; + webView.scrollView.bounces = NO; + webView.opaque = NO; + [webView setBackgroundColor:[UIColor clearColor]]; + [self addSubview: webView]; [self setHTML: h]; return self; @@ -269,6 +316,7 @@ typedef enum { SimpleXMLCommentKind, " font-family: \"%@\";" " font-size: %.4fpx;" // Must be "px", not "pt"! " line-height: %.4fpx;" // And no spaces before it. + " -webkit-text-size-adjust: none;" "}" "\n//-->\n" "" @@ -281,6 +329,7 @@ typedef enum { SimpleXMLCommentKind, [font pointSize], [font lineHeight], h]; + [webView stopLoading]; [webView loadHTMLString:h2 baseURL:[NSURL URLWithString:@""]]; } @@ -289,6 +338,8 @@ static char *anchorize (const char *url); - (void) setText: (NSString *)t { + t = [t stringByTrimmingCharactersInSet:[NSCharacterSet + whitespaceCharacterSet]]; t = [t stringByReplacingOccurrencesOfString:@"&" withString:@"&"]; t = [t stringByReplacingOccurrencesOfString:@"<" withString:@"<"]; t = [t stringByReplacingOccurrencesOfString:@">" withString:@">"]; @@ -312,6 +363,12 @@ static char *anchorize (const char *url); } h = [NSString stringWithFormat: @"%@ %@", h, s]; } + + h = [h stringByReplacingOccurrencesOfString:@"

" withString:@"

"]; + h = [h stringByReplacingOccurrencesOfString:@"

" withString:@"

"]; + h = [h stringByTrimmingCharactersInSet:[NSCharacterSet + whitespaceAndNewlineCharacterSet]]; + [self setHTML: h]; } @@ -335,8 +392,6 @@ static char *anchorize (const char *url); r.origin.x = 0; r.origin.y = 0; [webView setFrame: r]; - [self setHTML: html]; - [webView reload]; } @@ -344,6 +399,7 @@ static char *anchorize (const char *url); { NSString *result = @""; + // Add newlines. str = [str stringByReplacingOccurrencesOfString:@"

" withString:@"

" options:NSCaseInsensitiveSearch @@ -353,12 +409,25 @@ static char *anchorize (const char *url); options:NSCaseInsensitiveSearch range:NSMakeRange(0, [str length])]; + // Remove HREFs. for (NSString *s in [str componentsSeparatedByString: @"<"]) { NSRange r = [s rangeOfString:@">"]; if (r.length > 0) s = [s substringFromIndex: r.location + r.length]; result = [result stringByAppendingString: s]; } + + // Compress internal horizontal whitespace. + str = result; + result = @""; + for (NSString *s in [str componentsSeparatedByCharactersInSet: + [NSCharacterSet whitespaceCharacterSet]]) { + if ([result length] == 0) + result = s; + else if ([s length] > 0) + result = [NSString stringWithFormat: @"%@ %@", result, s]; + } + return result; } @@ -369,8 +438,15 @@ static char *anchorize (const char *url); /* It would be sensible to just ask the UIWebView how tall the page is, instead of hoping that NSString and UIWebView measure fonts and do - wrapping in exactly the same way, but I can't make that work. - Maybe because it loads async? + wrapping in exactly the same way, but since UIWebView is asynchronous, + we'd have to wait for the document to load first, e.g.: + + - Start the document loading; + - return a default height to use for the UITableViewCell; + - wait for the webViewDidFinishLoad delegate method to fire; + - then force the UITableView to reload, to pick up the new height. + + But I couldn't make that work. */ # if 0 r.size.height = [[webView @@ -384,11 +460,6 @@ static char *anchorize (const char *url); s = [text sizeWithFont: font constrainedToSize: s lineBreakMode:NSLineBreakByWordWrapping]; - - // GAAAH. Add one more line, or the UIWebView is still scrollable! - // The text is sized right, but it lets you scroll it up anyway. - s.height += [font pointSize]; - r.size.height = s.height; # endif @@ -447,7 +518,7 @@ static void layout_group (NSView *group, BOOL horiz_p); instead, so transform keys to "SAVERNAME.KEY". NOTE: This is duplicated in PrefsReader.m, cause I suck. -*/ + */ - (NSString *) makeKey:(NSString *)key { # ifdef USE_IPHONE @@ -473,7 +544,7 @@ static void layout_group (NSView *group, BOOL horiz_p); opts:(const XrmOptionDescRec *)opts_array valRet:(NSString **)val_ret { - char buf[255]; + char buf[1280]; char *tail = 0; NSAssert(cmdline_switch, @"cmdline switch is null"); if (! [cmdline_switch getCString:buf maxLength:sizeof(buf) @@ -524,6 +595,22 @@ static void layout_group (NSView *group, BOOL horiz_p); } +- (NSUserDefaultsController *)controllerForKey:(NSString *)key +{ + static NSDictionary *a = 0; + if (! a) { + a = UPDATER_DEFAULTS; + [a retain]; + } + if ([a objectForKey:key]) + // These preferences are global to all xscreensavers. + return globalDefaultsController; + else + // All other preferences are per-saver. + return userDefaultsController; +} + + #ifdef USE_IPHONE // Called when a slider is bonked. @@ -539,10 +626,11 @@ static void layout_group (NSView *group, BOOL horiz_p); ? [(InvertedSlider *) sender transformedValue] : [sender value]); - if (v == (int) v) - [userDefaultsController setInteger:v forKey:pref_key]; - else - [userDefaultsController setDouble:v forKey:pref_key]; + [[self controllerForKey:pref_key] + setObject:((v == (int) v) + ? [NSNumber numberWithInt:(int) v] + : [NSNumber numberWithDouble: v]) + forKey:pref_key]; } // Called when a checkbox/switch is bonked. @@ -553,7 +641,7 @@ static void layout_group (NSView *group, BOOL horiz_p); [active_text_field resignFirstResponder]; NSString *pref_key = [pref_keys objectAtIndex: [sender tag]]; NSString *v = ([sender isOn] ? @"true" : @"false"); - [userDefaultsController setObject:v forKey:pref_key]; + [[self controllerForKey:pref_key] setObject:v forKey:pref_key]; } # ifdef USE_PICKER_VIEW @@ -575,7 +663,7 @@ static void layout_group (NSView *group, BOOL horiz_p); //NSString *label = [a objectAtIndex:0]; NSString *pref_key = [a objectAtIndex:1]; NSObject *pref_val = [a objectAtIndex:2]; - [userDefaultsController setObject:pref_val forKey:pref_key]; + [[self controllerForKey:pref_key] setObject:pref_val forKey:pref_key]; } # else // !USE_PICKER_VIEW @@ -589,7 +677,7 @@ static void layout_group (NSView *group, BOOL horiz_p); NSArray *item = [[sender items] objectAtIndex: [sender index]]; NSString *pref_key = [item objectAtIndex:1]; NSObject *pref_val = [item objectAtIndex:2]; - [userDefaultsController setObject:pref_val forKey:pref_key]; + [[self controllerForKey:pref_key] setObject:pref_val forKey:pref_key]; } - (BOOL)textFieldShouldBeginEditing:(UITextField *)tf @@ -602,7 +690,7 @@ static void layout_group (NSView *group, BOOL horiz_p); { NSString *pref_key = [pref_keys objectAtIndex: [tf tag]]; NSString *txt = [tf text]; - [userDefaultsController setObject:txt forKey:pref_key]; + [[self controllerForKey:pref_key] setObject:txt forKey:pref_key]; } - (BOOL)textFieldShouldReturn:(UITextField *)tf @@ -621,15 +709,23 @@ static void layout_group (NSView *group, BOOL horiz_p); - (void) okAction:(NSObject *)arg { - [userDefaultsController commitEditing]; - [userDefaultsController save:self]; + // Without the setAppliesImmediately:, when the saver restarts, it's still + // got the old settings. -[XScreenSaverConfigSheet traverseTree] sets this + // to NO; default is YES. + [userDefaultsController setAppliesImmediately:YES]; + [globalDefaultsController setAppliesImmediately:YES]; + [userDefaultsController commitEditing]; + [globalDefaultsController commitEditing]; + [userDefaultsController save:self]; + [globalDefaultsController save:self]; [NSApp endSheet:self returnCode:NSOKButton]; [self close]; } - (void) cancelAction:(NSObject *)arg { - [userDefaultsController revert:self]; + [userDefaultsController revert:self]; + [globalDefaultsController revert:self]; [NSApp endSheet:self returnCode:NSCancelButton]; [self close]; } @@ -639,12 +735,13 @@ static void layout_group (NSView *group, BOOL horiz_p); - (void) resetAction:(NSObject *)arg { # ifndef USE_IPHONE - [userDefaultsController revertToInitialValues:self]; + [userDefaultsController revertToInitialValues:self]; + [globalDefaultsController revertToInitialValues:self]; # else // USE_IPHONE for (NSString *key in defaultOptions) { NSObject *val = [defaultOptions objectForKey:key]; - [userDefaultsController setObject:val forKey:key]; + [[self controllerForKey:key] setObject:val forKey:key]; } for (UIControl *ctl in pref_ctls) { @@ -662,19 +759,28 @@ static void layout_group (NSView *group, BOOL horiz_p); - (void) bindResource:(NSObject *)control key:(NSString *)pref_key reload:(BOOL)reload_p { + NSUserDefaultsController *prefs = [self controllerForKey:pref_key]; # ifndef USE_IPHONE + NSDictionary *opts_dict = nil; NSString *bindto = ([control isKindOfClass:[NSPopUpButton class]] ? @"selectedObject" : ([control isKindOfClass:[NSMatrix class]] ? @"selectedIndex" : @"value")); + + if ([control isKindOfClass:[NSMatrix class]]) { + opts_dict = @{ NSValueTransformerNameBindingOption: + @"TextModeTransformer" }; + } + [control bind:bindto - toObject:userDefaultsController + toObject:prefs withKeyPath:[@"values." stringByAppendingString: pref_key] - options:nil]; + options:opts_dict]; + # else // USE_IPHONE SEL sel; - NSObject *val = [userDefaultsController objectForKey:pref_key]; + NSObject *val = [prefs objectForKey:pref_key]; NSString *sval = 0; double dval = 0; @@ -739,12 +845,20 @@ static void layout_group (NSView *group, BOOL horiz_p); # endif // USE_IPHONE # if 0 - NSObject *def = [[userDefaultsController defaults] objectForKey:pref_key]; + NSObject *def = [[prefs defaults] objectForKey:pref_key]; NSString *s = [NSString stringWithFormat:@"bind: \"%@\"", pref_key]; s = [s stringByPaddingToLength:18 withString:@" " startingAtIndex:0]; - s = [NSString stringWithFormat:@"%@ = \"%@\"", s, def]; - s = [s stringByPaddingToLength:28 withString:@" " startingAtIndex:0]; - NSLog (@"%@ %@/%@", s, [def class], [control class]); + s = [NSString stringWithFormat:@"%@ = %@", s, + ([def isKindOfClass:[NSString class]] + ? [NSString stringWithFormat:@"\"%@\"", def] + : def)]; + s = [s stringByPaddingToLength:30 withString:@" " startingAtIndex:0]; + s = [NSString stringWithFormat:@"%@ %@ / %@", s, + [def class], [control class]]; +# ifndef USE_IPHONE + s = [NSString stringWithFormat:@"%@ / %@", s, bindto]; +# endif + NSLog (@"%@", s); # endif } @@ -773,9 +887,8 @@ unwrap (NSString *text) // Unwrap lines: delete \n but do not delete \n\n. // NSArray *lines = [text componentsSeparatedByString:@"\n"]; - int nlines = [lines count]; + NSUInteger i, nlines = [lines count]; BOOL eolp = YES; - int i; text = @"\n"; // start with one blank line @@ -1011,7 +1124,7 @@ hreffify (NSText *nstext) - (void) parseAttrs:(NSMutableDictionary *)dict node:(NSXMLNode *)node { NSArray *attrs = [(NSXMLElement *) node attributes]; - int n = [attrs count]; + NSUInteger n = [attrs count]; int i; // For each key in the dictionary, fill in the dict with the corresponding @@ -1071,15 +1184,15 @@ hreffify (NSText *nstext) */ - (NSString *) parseXScreenSaverTag:(NSXMLNode *)node { - NSMutableDictionary *dict = - [NSMutableDictionary dictionaryWithObjectsAndKeys: - @"", @"name", - @"", @"_label", - @"", @"gl", - nil]; + NSMutableDictionary *dict = [@{ @"name": @"", + @"_label": @"", + @"gl": @"" } + mutableCopy]; [self parseAttrs:dict node:node]; NSString *name = [dict objectForKey:@"name"]; NSString *label = [dict objectForKey:@"_label"]; + [dict release]; + dict = 0; NSAssert1 (label, @"no _label in %@", [node name]); NSAssert1 (name, @"no name in \"%@\"", label); @@ -1113,6 +1226,7 @@ hreffify (NSText *nstext) [lab setAutoresizingMask: (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; # endif // USE_IPHONE + [lab autorelease]; return lab; } @@ -1121,17 +1235,17 @@ hreffify (NSText *nstext) */ - (void) makeCheckbox:(NSXMLNode *)node on:(NSView *)parent { - NSMutableDictionary *dict = - [NSMutableDictionary dictionaryWithObjectsAndKeys: - @"", @"id", - @"", @"_label", - @"", @"arg-set", - @"", @"arg-unset", - nil]; + NSMutableDictionary *dict = [@{ @"id": @"", + @"_label": @"", + @"arg-set": @"", + @"arg-unset": @"" } + mutableCopy]; [self parseAttrs:dict node:node]; NSString *label = [dict objectForKey:@"_label"]; NSString *arg_set = [dict objectForKey:@"arg-set"]; NSString *arg_unset = [dict objectForKey:@"arg-unset"]; + [dict release]; + dict = 0; if (!label) { NSAssert1 (0, @"no _label in %@", [node name]); @@ -1175,7 +1289,6 @@ hreffify (NSText *nstext) [self placeChild:lab on:parent]; UISwitch *button = [[UISwitch alloc] initWithFrame:rect]; [self placeChild:button on:parent right:YES]; - [lab release]; # endif // USE_IPHONE @@ -1187,22 +1300,20 @@ hreffify (NSText *nstext) /* Creates the number selection control described by the given XML node. If "type=slider", it's an NSSlider. If "type=spinbutton", it's a text field with up/down arrows next to it. -*/ + */ - (void) makeNumberSelector:(NSXMLNode *)node on:(NSView *)parent { - NSMutableDictionary *dict = - [NSMutableDictionary dictionaryWithObjectsAndKeys: - @"", @"id", - @"", @"_label", - @"", @"_low-label", - @"", @"_high-label", - @"", @"type", - @"", @"arg", - @"", @"low", - @"", @"high", - @"", @"default", - @"", @"convert", - nil]; + NSMutableDictionary *dict = [@{ @"id": @"", + @"_label": @"", + @"_low-label": @"", + @"_high-label": @"", + @"type": @"", + @"arg": @"", + @"low": @"", + @"high": @"", + @"default": @"", + @"convert": @"" } + mutableCopy]; [self parseAttrs:dict node:node]; NSString *label = [dict objectForKey:@"_label"]; NSString *low_label = [dict objectForKey:@"_low-label"]; @@ -1213,6 +1324,8 @@ hreffify (NSText *nstext) NSString *high = [dict objectForKey:@"high"]; NSString *def = [dict objectForKey:@"default"]; NSString *cvt = [dict objectForKey:@"convert"]; + [dict release]; + dict = 0; NSAssert1 (arg, @"no arg in %@", label); NSAssert1 (type, @"no type in %@", label); @@ -1266,6 +1379,7 @@ hreffify (NSText *nstext) while (range2 > max_ticks) range2 /= 10; +# ifndef USE_IPHONE // If we have elided ticks, leave it at the max number of ticks. if (range != range2 && range2 < max_ticks) range2 = max_ticks; @@ -1274,7 +1388,6 @@ hreffify (NSText *nstext) if (float_p && range2 < max_ticks) range2 = max_ticks; -# ifndef USE_IPHONE [slider setNumberOfTickMarks:range2]; [slider setAllowsTickMarkValuesOnly: @@ -1297,7 +1410,6 @@ hreffify (NSText *nstext) [lab setFont:[NSFont boldSystemFontOfSize:s]]; } # endif - [lab release]; } if (low_label) { @@ -1313,10 +1425,10 @@ hreffify (NSText *nstext) [self placeChild:lab on:parent]; # else // USE_IPHONE [lab setTextAlignment: NSTextAlignmentRight]; + // Sometimes rotation screws up truncation. + [lab setLineBreakMode:NSLineBreakByClipping]; [self placeChild:lab on:parent right:(label ? YES : NO)]; # endif // USE_IPHONE - - [lab release]; } # ifndef USE_IPHONE @@ -1347,8 +1459,11 @@ hreffify (NSText *nstext) // Make right label be same height as slider. rect.size.height = [slider frame].size.height; [lab setFrame:rect]; +# ifdef USE_IPHONE + // Sometimes rotation screws up truncation. + [lab setLineBreakMode:NSLineBreakByClipping]; +# endif [self placeChild:lab on:parent right:YES]; - [lab release]; } [self bindSwitch:slider cmdline:arg]; @@ -1388,7 +1503,6 @@ hreffify (NSText *nstext) rect.size.height = [txt frame].size.height; [lab setFrame:rect]; [self placeChild:lab on:parent]; - [lab release]; } [self placeChild:txt on:parent right:(label ? YES : NO)]; @@ -1474,11 +1588,11 @@ set_menu_item_object (NSMenuItem *item, NSObject *obj) /* Creates the popup menu described by the given XML node (and its children). -*/ + */ - (void) makeOptionMenu:(NSXMLNode *)node on:(NSView *)parent { NSArray *children = [node children]; - int i, count = [children count]; + NSUInteger i, count = [children count]; if (count <= 0) { NSAssert1 (0, @"no menu items in \"%@\"", [node name]); @@ -1487,11 +1601,10 @@ set_menu_item_object (NSMenuItem *item, NSObject *obj) // get the "id" attribute off the node2 = [[NSXMLElement alloc] initWithName:@"select"]; - [node2 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"textMode", @"id", - nil]]; + [node2 setAttributesAsDictionary:@{ @"id": @"textMode" }]; NSXMLNode *node3 = [[NSXMLElement alloc] initWithName:@"option"]; [node3 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"date", @"id", - @"-text-mode date", @"arg-set", - @"Display the date and time", @"_label", - nil]]; + @{ @"id": @"date", + @"arg-set": @"-text-mode date", + @"_label": @"Display the date and time" }]; [node3 setParent: node2]; - //[node3 release]; + [node3 autorelease]; node3 = [[NSXMLElement alloc] initWithName:@"option"]; [node3 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"text", @"id", - @"-text-mode literal", @"arg-set", - @"Display static text", @"_label", - nil]]; + @{ @"id": @"text", + @"arg-set": @"-text-mode literal", + @"_label": @"Display static text" }]; [node3 setParent: node2]; - //[node3 release]; + [node3 autorelease]; node3 = [[NSXMLElement alloc] initWithName:@"option"]; [node3 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"url", @"id", - @"Display the contents of a URL", @"_label", - nil]]; + @{ @"id": @"url", + @"_label": @"Display the contents of a URL" }]; [node3 setParent: node2]; - //[node3 release]; + [node3 autorelease]; [self makeOptionMenu:node2 on:rgroup]; + [node2 release]; # endif // USE_IPHONE @@ -2143,13 +2224,12 @@ find_text_field_of_button (NSButton *button) // node2 = [[NSXMLElement alloc] initWithName:@"string"]; [node2 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"textLiteral", @"id", - @"-text-literal %", @"arg", + @{ @"id": @"textLiteral", + @"arg": @"-text-literal %", # ifdef USE_IPHONE - @"Text to display", @"_label", + @"_label": @"Text to display" # endif - nil]]; + }]; [self makeTextField:node2 on:rgroup # ifndef USE_IPHONE withLabel:NO @@ -2157,6 +2237,7 @@ find_text_field_of_button (NSButton *button) withLabel:YES # endif horizontal:NO]; + [node2 release]; // rect = [last_child(rgroup) frame]; @@ -2166,19 +2247,18 @@ find_text_field_of_button (NSButton *button) toObject:[matrix cellAtRow:1 column:0] withKeyPath:@"value" options:nil]; -*/ + */ # ifndef USE_IPHONE // node2 = [[NSXMLElement alloc] initWithName:@"string"]; [node2 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"textFile", @"id", - @"-text-file %", @"arg", - nil]]; + @{ @"id": @"textFile", + @"arg": @"-text-file %" }]; [self makeFileSelector:node2 on:rgroup dirsOnly:NO withLabel:NO editable:NO]; + [node2 release]; # endif // !USE_IPHONE // rect = [last_child(rgroup) frame]; @@ -2186,13 +2266,12 @@ find_text_field_of_button (NSButton *button) // node2 = [[NSXMLElement alloc] initWithName:@"string"]; [node2 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"textURL", @"id", - @"-text-url %", @"arg", + @{ @"id": @"textURL", + @"arg": @"-text-url %", # ifdef USE_IPHONE - @"URL to display", @"_label", + @"_label": @"URL to display", # endif - nil]]; + }]; [self makeTextField:node2 on:rgroup # ifndef USE_IPHONE withLabel:NO @@ -2200,6 +2279,7 @@ find_text_field_of_button (NSButton *button) withLabel:YES # endif horizontal:NO]; + [node2 release]; // rect = [last_child(rgroup) frame]; @@ -2208,11 +2288,11 @@ find_text_field_of_button (NSButton *button) // node2 = [[NSXMLElement alloc] initWithName:@"string"]; [node2 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"textProgram", @"id", - @"-text-program %", @"arg", - nil]]; + @{ @"id": @"textProgram", + @"arg": @"-text-program %", + }]; [self makeTextField:node2 on:rgroup withLabel:NO horizontal:NO]; + [node2 release]; } // rect = [last_child(rgroup) frame]; @@ -2268,6 +2348,8 @@ find_text_field_of_button (NSButton *button) [box sizeToFit]; [self placeChild:box on:parent]; + [group release]; + [box release]; # endif // !USE_IPHONE } @@ -2299,31 +2381,31 @@ find_text_field_of_button (NSButton *button) node2 = [[NSXMLElement alloc] initWithName:@"boolean"]; [node2 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"grabDesktopImages", @"id", - @ SCREENS, @"_label", - @"-no-grab-desktop", @"arg-unset", - nil]]; + @{ @"id": @"grabDesktopImages", + @"_label": @ SCREENS, + @"arg-unset": @"-no-grab-desktop", + }]; [self makeCheckbox:node2 on:parent]; + [node2 release]; node2 = [[NSXMLElement alloc] initWithName:@"boolean"]; [node2 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"chooseRandomImages", @"id", - @ PHOTOS, @"_label", - @"-choose-random-images", @"arg-set", - nil]]; + @{ @"id": @"chooseRandomImages", + @"_label": @ PHOTOS, + @"arg-set": @"-choose-random-images", + }]; [self makeCheckbox:node2 on:parent]; + [node2 release]; node2 = [[NSXMLElement alloc] initWithName:@"string"]; [node2 setAttributesAsDictionary: - [NSDictionary dictionaryWithObjectsAndKeys: - @"imageDirectory", @"id", - @"Images from:", @"_label", - @"-image-directory %", @"arg", - nil]]; + @{ @"id": @"imageDirectory", + @"_label": @"Images from:", + @"arg": @"-image-directory %", + }]; [self makeFileSelector:node2 on:parent dirsOnly:YES withLabel:YES editable:YES]; + [node2 release]; # undef SCREENS # undef PHOTOS @@ -2340,11 +2422,115 @@ find_text_field_of_button (NSButton *button) r2.origin.x += 20; r2.origin.y += 14; [lab2 setFrameOrigin:r2.origin]; - [lab2 release]; # endif // USE_IPHONE } +- (void) makeUpdaterControlBox:(NSXMLNode *)node on:(NSView *)parent +{ +# ifndef USE_IPHONE + /* + [x] Check for Updates [ Monthly ] + +

+ + +
+ */ + + //
+ + NSRect rect; + rect.size.width = rect.size.height = 1; + rect.origin.x = rect.origin.y = 0; + NSView *group = [[NSView alloc] initWithFrame:rect]; + + NSXMLElement *node2; + + // + + node2 = [[NSXMLElement alloc] initWithName:@"boolean"]; + [node2 setAttributesAsDictionary: + @{ @"id": @SUSUEnableAutomaticChecksKey, + @"_label": @"Automatically check for updates", + @"arg-unset": @"-no-" SUSUEnableAutomaticChecksKey, + }]; + [self makeCheckbox:node2 on:group]; + [node2 release]; + + //