Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>i386</key>
<string>10.4</string>
<key>ppc</key>
<string>10.4</string>
<key>ppc64</key>
<string>10.5</string>
<string>10.9</string>
<key>x86_64</key>
<string>10.6</string>
<string>10.9</string>
</dict>
<key>LSUIElement</key>
<integer>1</integer>
Expand Down
5 changes: 2 additions & 3 deletions Source/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ - (void) awakeFromNib
[CDOptions printOpts:[allKeys allKeys] forRunMode:runMode];
}
// Add any extras chooseControl came up with
NSEnumerator *en = [extraOptions keyEnumerator];
NSString *key;
while ((key = [en nextObject])) {
for (NSString *key in extraOptions)
{
[options setOption:extraOptions[key] forKey:key];
}

Expand Down
2 changes: 1 addition & 1 deletion Source/CDControl/CDControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ + (void) printHelpTo:(NSFileHandle *)fh {
}
currKey++;
}

[fh writeData:[@"\n\tGlobal Options:\n\t\t--help, --debug, --title, --width, --height,\n\t\t--string-output, --no-newline\n\nSee http://mstratman.github.com/cocoadialog/#documentation\nfor detailed documentation.\n" dataUsingEncoding:NSUTF8StringEncoding]];
}
}
Expand Down
11 changes: 6 additions & 5 deletions Source/CDControl/CDFileDialogControl/CDFileDialogControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,16 @@ - (void) setMisc {
NSArray *optionExtensions = [options optValues:@"with-extensions"];
if (optionExtensions && [optionExtensions count]) {
NSString *extension;
NSEnumerator *en = [optionExtensions objectEnumerator];
while ((extension = [en nextObject])) {
if ([extension isEqualToString:@"."]) {
for (extension in optionExtensions)
{
if ([extension isEqualToString:@"."])
{
extension = @"";
}
// Strip leading '.' from each extension
else if ([extension length] > 1 && [[extension substringWithRange:NSMakeRange(0,1)] isEqualToString:@"."]) {
extension = [extension substringFromIndex:1];
}
extension = [extension substringFromIndex:1];
}
[extensions addObject:extension];
}
}
Expand Down
8 changes: 4 additions & 4 deletions Source/CDControl/CDFileDialogControl/CDFileSelectControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ - (void) createControl {

if (result == NSFileHandlingPanelOKButton) {
controlExitStatus = -1;
NSEnumerator *en = [[openPanel URLs] objectEnumerator];
id key;
while ((key = [en nextObject])) {
for (id key in [openPanel URLs])
{
[controlReturnValues addObject:[key path]];
}
}
else {
else
{
controlExitStatus = -2;
controlReturnValues = [NSMutableArray array];
}
Expand Down
16 changes: 8 additions & 8 deletions Source/CDControl/CDIcon.m
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,16 @@ - (void) setIconWithImage:(NSImage *)anImage withSize:(NSSize)aSize withControls
[self setIconWithImage:anImage withSize:aSize];

float iconWidthDiff = [control frame].size.width - iconFrame.size.width;
NSEnumerator *en = [anArray objectEnumerator];
id _control;
while ((_control = [en nextObject])) {
// Make sure the control exists

for (id _control in anArray)
{
if (_control) {
NSRect controlFrame = [_control frame];
NSRect newControlFrame = NSMakeRect(controlFrame.origin.x + iconWidthDiff, controlFrame.origin.y, controlFrame.size.width - iconWidthDiff, controlFrame.size.height);
[_control setFrame:newControlFrame];
}
}

}
// Icon does not have image
else {
Expand All @@ -450,10 +449,11 @@ - (void) setIconWithImage:(NSImage *)anImage withSize:(NSSize)aSize withControls
[control removeFromSuperview];
control = nil;
// Move the controls to the left and increase their width
NSEnumerator *en = [anArray objectEnumerator];

id _control;
while ((_control = [en nextObject])) {
// Make sure the control exists

for (_control in anArray)
{
if (_control) {
NSRect controlFrame = [_control frame];
float newControlWidth = controlFrame.size.width + (controlFrame.origin.x - iconFrame.origin.x);
Expand Down
24 changes: 12 additions & 12 deletions Source/CDControl/CDNotifyControl/CDBubbleControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,30 +153,30 @@ - (void) createControl {
clickArg:clickArg
];
}

NSEnumerator *en = [notifications objectEnumerator];
id obj;
int i = 0;
while ((obj = [en nextObject])) {
NSDictionary * notification = [NSDictionary dictionaryWithDictionary:obj];
NSUInteger index = 0;
for (id object in notifications)
{
NSDictionary * notification = [NSDictionary dictionaryWithDictionary:object];
KABubbleWindowController *bubble = [KABubbleWindowController
bubbleWithTitle:notification[@"title"] text:notification[@"description"]
icon:notification[@"icon"]
timeout:_timeout
lightColor:[self _colorForBubble:i fromKey:@"background-tops" alpha:alpha]
darkColor:[self _colorForBubble:i fromKey:@"background-bottoms" alpha:alpha]
textColor:[self _colorForBubble:i fromKey:@"text-colors" alpha:alpha]
borderColor:[self _colorForBubble:i fromKey:@"border-colors" alpha:alpha]
lightColor:[self _colorForBubble:index fromKey:@"background-tops" alpha:alpha]
darkColor:[self _colorForBubble:index fromKey:@"background-bottoms" alpha:alpha]
textColor:[self _colorForBubble:index fromKey:@"text-colors" alpha:alpha]
borderColor:[self _colorForBubble:index fromKey:@"border-colors" alpha:alpha]
numExpectedBubbles:(unsigned)[notifications count]
bubblePosition:position];

[bubble setAutomaticallyFadesOut:![notification[@"sticky"] boolValue]];
[bubble setDelegate:self];
[bubble setClickContext:[NSString stringWithFormat:@"%d", activeNotifications]];
[bubble startFadeIn];
activeNotifications++;
i++;
index++;
}


}

- (void) debug:(NSString *)message
Expand Down
8 changes: 3 additions & 5 deletions Source/CDControl/CDNotifyControl/CDGrowlControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,9 @@ - (void) createControl {
clickArg:clickArg
];
}

NSEnumerator *en = [notifications objectEnumerator];
id obj;
while ((obj = [en nextObject])) {
NSDictionary * notification = [NSDictionary dictionaryWithDictionary:obj];
for (id object in notifications)
{
NSDictionary * notification = [NSDictionary dictionaryWithDictionary:object];
[GrowlApplicationBridge
notifyWithTitle:notification[@"title"]
description:notification[@"description"]
Expand Down
17 changes: 11 additions & 6 deletions Source/CDControl/CDNotifyControl/CDNotifyControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ - (NSArray *) notificationIcons {
[icons addObject:_icon];
}

} else if ([options hasOpt:@"icon-files"]
&& [[options optValues:@"icon-files"] count])
}
else if ([options hasOpt:@"icon-files"] && [[options optValues:@"icon-files"] count])
{
iconArgs = [options optValues:@"icon-files"];
en = [iconArgs objectEnumerator];
Expand Down Expand Up @@ -184,10 +184,14 @@ - (NSArray *) parseTextForArguments:(NSString *)string
string = [string stringByReplacingOccurrencesOfString:@"\"" withString:[NSString stringWithFormat: @"\n\"\n"]];
NSArray * quotedArray = [string componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
BOOL inQuote = NO;
NSEnumerator *en = [quotedArray objectEnumerator];
id arg;
while ((arg = [en nextObject])) {
NSMutableArray* spacedArray = [NSMutableArray arrayWithArray:nil];


__strong id arg;

NSMutableArray* spacedArray = [NSMutableArray arrayWithArray:nil];

for (arg in quotedArray)
{
// Determine which quote state we're in
if ([[arg substringToIndex:1] isEqualToString:@"\""]) {
inQuote = !inQuote;
Expand All @@ -205,6 +209,7 @@ - (NSArray *) parseTextForArguments:(NSString *)string
[masterArray addObjectsFromArray:spacedArray];
}
}

return masterArray;
}

Expand Down
50 changes: 26 additions & 24 deletions Source/CDControl/CDThreeButtonControl/CDCheckboxControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,22 @@ - (void) createControl {
// set return values
NSArray * cells = [controlMatrix cells];
NSMutableArray *tmpValues = [[NSMutableArray alloc] init];
NSEnumerator *en = [cells objectEnumerator];
id obj;
while ((obj = [en nextObject])) {
if ([[obj className] isEqualToString:@"NSButtonCell"]) {
[tmpValues addObject:obj];
id object;
for (object in cells)
{
if ([[object className] isEqualToString:@"NSButtonCell"]) {
[tmpValues addObject:object];
}
}

checkboxes = [NSMutableArray arrayWithArray:tmpValues];
en = [tmpValues objectEnumerator];
while (obj == [en nextObject]) {
checkboxes[[obj tag]] = obj;
for (object in tmpValues)
{
if (object)
{
checkboxes[[object tag]] = object;
}

}
}

Expand Down Expand Up @@ -185,51 +190,48 @@ - (void) setControl:(id)sender {
NSMutableArray * controls = [[NSMutableArray alloc] init];

// Create the control for each item
unsigned long currItem = 0;
NSEnumerator *en = [items objectEnumerator];
float cellWidth = 0.0;
id obj;
while ((obj = [en nextObject])) {

NSUInteger index = 0;
for (id object in items)
{
NSButton * button = [[NSButton alloc] init];
[button setButtonType:NSSwitchButton];
[button setTitle:items[currItem]];
[button setTitle:items[index]];
if (checked && [checked count]) {
if ([checked containsObject:[NSString stringWithFormat:@"%lu", currItem]]) {
if ([checked containsObject:[NSString stringWithFormat:@"%lu", index]])
{
[[button cell] setState:NSOnState];
}
}
if (mixed && [mixed count]) {
if ([mixed containsObject:[NSString stringWithFormat:@"%lu", currItem]]) {
if ([mixed containsObject:[NSString stringWithFormat:@"%lu", index]])
{
[[button cell] setAllowsMixedState:YES];
[[button cell] setState:NSMixedState];
}
}
if (disabled && [disabled count]) {
if ([disabled containsObject:[NSString stringWithFormat:@"%lu", currItem]]) {
if ([disabled containsObject:[NSString stringWithFormat:@"%lu", index]])
{
[[button cell] setEnabled: NO];
}
}
[[button cell] setTag:currItem];
[[button cell] setTag:index];
[button sizeToFit];
if ([button frame].size.width > cellWidth) {
cellWidth = [button frame].size.width;
}
[controls addObject:[button cell]];
currItem++;
}






// Set other attributes of matrix
[controlMatrix setAutosizesCells:NO];
[controlMatrix setCellSize:NSMakeSize(cellWidth, 18.0f)];
[controlMatrix setMode:NSHighlightModeMatrix];

// Populate the matrix
currItem = 0;
int currItem = 0;
for (unsigned long currColumn = 0; currColumn <= columns - 1; currColumn++) {
for (unsigned long currRow = 0; currRow <= rows - 1; currRow++) {
if (currItem <= [items count] - 1) {
Expand Down
13 changes: 7 additions & 6 deletions Source/CDControl/CDThreeButtonControl/CDPopUpButtonControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@ - (void) createControl {
[popupControl setPullsDown:[options hasOpt:@"pulldown"] ? YES : NO];
// Populate menu
NSArray *items = [NSArray arrayWithArray:[options optValues:@"items"]];
if (items && [items count]) {
NSEnumerator *en = [items objectEnumerator];
id obj;
while ((obj = [en nextObject])) {
[popupControl addItemWithTitle:(NSString *)obj];
}
if (items && [items count])
{
for (id object in items)
{
[popupControl addItemWithTitle:(NSString *)object];
}

NSInteger selected = [options hasOpt:@"selected"] ? [[options optValue:@"selected"] integerValue] : 0;
[popupControl selectItemAtIndex:selected];
}
Expand Down
26 changes: 13 additions & 13 deletions Source/CDControl/CDThreeButtonControl/CDRadioControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -176,27 +176,27 @@ - (void) setControl:(id)sender {
NSMutableArray * controls = [[NSMutableArray alloc] init];

// Create the control for each item
unsigned long currItem = 0;
NSEnumerator *en = [items objectEnumerator];
float cellWidth = 0.0;
id obj;
while ((obj = [en nextObject])) {

NSUInteger index = 0;
for (id object in items)
{
NSButton * button = [[NSButton alloc] init];
[button setButtonType:NSRadioButton];
[button setTitle:items[currItem]];
[button setTitle:items[index]];
if (disabled && [disabled count]) {
if ([disabled containsObject:[NSString stringWithFormat:@"%lu", currItem]]) {
if ([disabled containsObject:[NSString stringWithFormat:@"%lu", index]]) {
[[button cell] setEnabled: NO];
}
}
[[button cell] setTag:currItem];
[[button cell] setTag:index];
[button sizeToFit];
if ([button frame].size.width > cellWidth) {
cellWidth = [button frame].size.width;
}
[controls addObject:[button cell]];
currItem++;
}


// Set other attributes of matrix
[controlMatrix setAutosizesCells:NO];
Expand All @@ -206,16 +206,16 @@ - (void) setControl:(id)sender {
[controlMatrix setMode:NSRadioModeMatrix];

// Populate the matrix
currItem = 0;
int x = 0;
for (unsigned long currColumn = 0; currColumn <= columns - 1; currColumn++) {
for (unsigned long currRow = 0; currRow <= rows - 1; currRow++) {
if (currItem <= [items count] - 1) {
NSButtonCell * cell = controls[currItem];
if (x <= [items count] - 1) {
NSButtonCell * cell = controls[x];
[controlMatrix putCell:cell atRow:currRow column:currColumn];
if (selected == currItem) {
if (selected == x) {
[controlMatrix selectCellAtRow:currRow column:currColumn];
}
currItem++;
x++;
}
else {
NSCell * blankCell = [[NSCell alloc] init];
Expand Down
3 changes: 2 additions & 1 deletion Source/CDOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ + (void) printOpts:(NSArray *)availableOptions forRunMode:(NSString *)runMode

- (BOOL) hasOpt:(NSString *)key
{
return _options[key];
return (BOOL)_options[key];
}

- (NSString *) optValue:(NSString *)key
{
id value = _options[key];
Expand Down
Loading