diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index 688400f94..8699a7a52 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -292,11 +292,21 @@ CPRunContinuesResponse = -1002; } } +/*! + Sets the applications icon image. This image is used in the default "About" window. + By default this value is pulled from the CPApplicationIcon key in your info.plist file. + + @param anImage - The image to set. +*/ - (void)setApplicationIconImage:(CPImage)anImage { _applicationIconImage = anImage; } +/*! + Returns the application icon image. By default this is pulled from the CPApplicationIcon key of info.plist. + @return CPImage - Your application icon image. +*/ - (CPImage)applicationIconImage { if (_applicationIconImage) @@ -309,11 +319,38 @@ CPRunContinuesResponse = -1002; return _applicationIconImage; } +/*! + Opens the standard about panel with no options. +*/ - (void)orderFrontStandardAboutPanel:(id)sender { [self orderFrontStandardAboutPanelWithOptions:nil]; } +/*! + Opens the standard about panel. This method takes a single argument \c options. + Options is a dictionary that can contain any of the following keys: +
+ ApplicationName - The name of your application. + ApplicationIcon - Application icon image. + Version - The full version of your application + ApplicationVersion - The shorter version number of your application. + Copyright - Human readable copyright information. ++ + If you choose not the include any of the above keys, they will default + to the following respective keys in your info.plist file. + +
+ CPBundleName + CPApplicationIcon (through a call to -applicationIconImage, see documentation for that method for more details) + CPBundleVersion + CPBundleShortVersionString + CPHumanReadableCopyright ++ + @param options - A dictionary with the aboe listed keys. You can pass nil to default to your plist values. +*/ - (void)orderFrontStandardAboutPanelWithOptions:(CPDictionary)options { if (!_aboutPanel) @@ -573,6 +610,10 @@ CPRunContinuesResponse = -1002; [[anEvent window] sendEvent:anEvent]; } +/*! + If the delegate responds to the given selector it will call the method on the delegate, + otherwise the method will be passed to CPResponder. +*/ - (void)doCommandBySelector:(SEL)aSelector { if ([_delegate respondsToSelector:aSelector]) @@ -664,6 +705,10 @@ CPRunContinuesResponse = -1002; [aMenu _setMenuName:@"CPMainMenu"]; } +/*! + Opens the shared color panel. + @param aSender +*/ - (void)orderFrontColorPanel:(id)aSender { [[CPColorPanel sharedColorPanel] orderFront:self]; @@ -832,16 +877,38 @@ CPRunContinuesResponse = -1002; return nil; } +/*! + Fires a callback function when an event matching a given mask occurs. + @param aCallback - A js function to be fired. + @prarm aMask - An event mask for the next event. + @param anExpiration - The date for which this callback expires (not implemented). + @param inMode (not implemented). + @param shouldDequeue (not implemented). +*/ - (void)setCallback:(Function)aCallback forNextEventMatchingMask:(unsigned int)aMask untilDate:(CPDate)anExpiration inMode:(CPString)aMode dequeue:(BOOL)shouldDequeue { _eventListeners.push(_CPEventListenerMake(aMask, aCallback)); } -- (CPEvent)setTarget:(id)aTarget selector:(SEL)aSelector forNextEventMatchingMask:(unsigned int)aMask untilDate:(CPDate)anExpiration inMode:(CPString)aMode dequeue:(BOOL)shouldDequeue +/*! + Assigns a target and action for the next event matching a given event mask. + The callback method called will be passed the CPEvent when it fires. + + @param aTarget - The target object for the callback. + @param aSelector - The selector which should be called on the target object. + @param aMask - The mask for a given event which should trigger the callback. + @param anExpiration - The date for which the callback expires (not implemented). + @param aMode (not implemented). + @param shouldDequeue (not implemented). +*/ +- (void)setTarget:(id)aTarget selector:(SEL)aSelector forNextEventMatchingMask:(unsigned int)aMask untilDate:(CPDate)anExpiration inMode:(CPString)aMode dequeue:(BOOL)shouldDequeue { _eventListeners.push(_CPEventListenerMake(aMask, function (anEvent) { objj_msgSend(aTarget, aSelector, anEvent); })); } +/*! + Returns the last event recieved by your application. +*/ - (CPEvent)currentEvent { return _currentEvent; @@ -871,6 +938,19 @@ CPRunContinuesResponse = -1002; [aWindow _attachSheet:aSheet modalDelegate:aModalDelegate didEndSelector:aDidEndSelector contextInfo:aContextInfo]; } +/*! + Ends a sheet modal. + The following are predefined return codes: + +
+ CPRunStoppedResponse + CPRunAbortedResponse + CPRunContinuesResponse ++ + @param sheet - The window object (sheet) to dismiss. + @param returnCode - The return code to send to the delegate. You can use one of the return codes above or a custom value that you define. +*/ - (void)endSheet:(CPWindow)sheet returnCode:(int)returnCode { var count = [_windows count]; @@ -889,11 +969,31 @@ CPRunContinuesResponse = -1002; } } +/*! + Ends a sheet and sends the return code "0". + @param sheet - The CPWindow object (sheet) that should be dismissed. +*/ - (void)endSheet:(CPWindow)sheet { + // FIX ME: this is wrong: by Cocoa this should be: CPRunStoppedResponse. [self endSheet:sheet returnCode:0]; } +/*! + Returns and array of slash seperated arugments to your application. + These values are pulled from your window location hash. + + For exampled if your application loaded: +
+ index.html#280north/cappuccino/issues ++ The follow array would be returned: +
+ ["280north", "cappuccino", "issues"] ++ + @return CPArray - The array of arguments. +*/ - (CPArray)arguments { if (_fullArgsString !== window.location.hash) @@ -902,6 +1002,22 @@ CPRunContinuesResponse = -1002; return _args; } +/*! + Sets the arguments of your application. + That is, set the slash seperated values of an array as the window location hash. + + For example if you pass an array: +
+ ["280north", "cappuccino", "issues"] ++ + The new window location would be +
+ index.html#280north/cappuccino/issues ++ + @param args - An array of arguments. +*/ - (void)setArguments:(CPArray)args { if (!args || args.length == 0) @@ -943,6 +1059,23 @@ CPRunContinuesResponse = -1002; _args = []; } +/*! + Returns a dictionary of the window location named arguments. + For example if your location was: +
+ index.html?owner=280north&repo=cappuccino&type=issues ++ + a CPDictionary with the keys: +
+ owner, repo, type ++ and respective values: +
+ 280north, cappuccino, issues ++ Will be returned. +*/ - (CPDictionary)namedArguments { return _namedArgs; diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index e3665afc5..744284bdc 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -2344,6 +2344,11 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; - (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aColumn row:(int)aRow Called when the user right clicks on the tableview. -1 is passed for the row or column if the user doesn't right click on a real row or column Return a CPMenu that should be displayed if the user right clicks. If you do not implement this the tableview will just call super on menuForEvent + + Delete Key + - (void)tableViewDeleteKeyPressed:(CPTableView)aTableView; + Called when the user presses the delete key. Many times you will want to delete data (or prompt for deletion) when the user hids the delete key. + Your delegate can implement this method to avoid subclassing the tableview to add this behaviour. @param aDelegate the delegate object for the tableview. @@ -3274,6 +3279,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; */ - (void)_commitDataViewObjectValue:(id)sender { + _editingCellIndex = nil; + [_dataSource tableView:self setObjectValue:[sender objectValue] forTableColumn:sender.tableViewEditedColumnObj row:sender.tableViewEditedRowIndex]; if ([sender respondsToSelector:@selector(setEditable:)]) @@ -3290,7 +3297,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; [[self window] makeFirstResponder:self]; - _editingCellIndex = nil; } /*! diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 2adfdbe70..61d396e46 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -585,7 +585,9 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); [self _setStringValue:element.value]; CPTextFieldInputResigning = YES; - element.blur(); + + if (CPTextFieldInputIsActive) + element.blur(); if (!CPTextFieldInputDidBlur) CPTextFieldBlurFunction(); @@ -1106,7 +1108,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); selectedRange.location += 1; selectedRange.length -= 1; - + var stringValue = [self stringValue], newValue = [stringValue stringByReplacingCharactersInRange:selectedRange withString:""]; diff --git a/Tools/nib2cib/NSMenuItem.j b/Tools/nib2cib/NSMenuItem.j index 7715e9b9d..a90a62d97 100644 --- a/Tools/nib2cib/NSMenuItem.j +++ b/Tools/nib2cib/NSMenuItem.j @@ -49,8 +49,8 @@ _tag = [aCoder decodeIntForKey:"NSTag"]; _state = [aCoder decodeIntForKey:"NSState"]; -// _image = [aCoder decodeObjectForKey:"NSImage"]; -// _alternateImage = [aCoder decodeObjectForKey:""]; + _image = [aCoder decodeObjectForKey:"NSImage"]; + // _alternateImage = [aCoder decodeObjectForKey:""]; // _onStateImage = [aCoder decodeObjectForKey:"NSOnImage"]; // _offStateImage = [aCoder decodeObjectForKey:"NSOffImage"]; // _mixedStateImage = [aCoder decodeObjectForKey:"NSMixedImage"]; diff --git a/bootstrap.sh b/bootstrap.sh index 170a76e40..901fb8df0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -133,6 +133,7 @@ while [ $# -gt 0 ]; do --noprompt) noprompt="yes";; --directory) install_directory="$2"; shift;; --clone) tusk_install_command="clone";; + --clone-http) tusk_install_command="clone --http";; --github-user) github_user="$2"; shift;; --github-ref) github_ref="$2"; shift;; --install-capp) install_capp="yes";; @@ -141,7 +142,8 @@ usage: ./bootstrap.sh [OPTIONS] --noprompt: Don't prompt, use relatively safe defaults. --directory [DIR]: Use a directory other than /usr/local/narwhal. - --clone: Do "git clone" instead of downloading zips. + --clone: Do "git clone git://" instead of downloading zips. + --clone-http: Do "git clone http://" instead of downloading zips. --github-user [USER]: Use another github user (default: 280north). --github-ref [REF]: Use another git ref (default: master). --install-capp: Install "objective-j" and "cappuccino" packages. @@ -206,7 +208,7 @@ if [ "$install_narwhal" ]; then else read input fi - if [ "$input" ]; then + if [ "$input" ] && [ ! "$input" = "yes" ]; then install_directory="`cd \`dirname "$input"\`; pwd`/`basename "$input"`" else install_directory="$default_directory" @@ -231,8 +233,13 @@ if [ "$install_narwhal" ]; then fi fi - if [ "$tusk_install_command" = "clone" ]; then - git_repo="git://github.com/$github_path.git" + if [ "$(echo $tusk_install_command | cut -c-5)" = "clone" ]; then + if [ "$(echo $tusk_install_command | cut -c7-)" = "--http" ]; then + git_protocol="http" + else + git_protocol="git" + fi + git_repo="$git_protocol://github.com/$github_path.git" echo "Cloning Narwhal from \"$git_repo\"..." git clone "$git_repo" "$install_directory" (cd "$install_directory" && git checkout "origin/$github_ref")