mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-06 17:12:50 +00:00
Merge remote-tracking branch 'upstream/master' into CPRulePredicateEditor
This commit is contained in:
commit
6fe3d53a13
12 files changed
+46
-23
No files matched your search
@@ -242,13 +242,15 @@
|
||||
Sets the content of the collection view to the content in \c anArray.
|
||||
This array can be of any type, and each element will be passed to the \c -setRepresentedObject: method.
|
||||
It's the responsibility of your custom collection view item to interpret the object.
|
||||
@param anArray the content array
|
||||
|
||||
If the new content array is smaller than the previous one, note that [receiver selectionIndexes] may
|
||||
refer to out of range indices. \c selectionIndexes is not changed as a result of calling the
|
||||
\c setContent: method.
|
||||
|
||||
@param anArray a content array
|
||||
*/
|
||||
- (void)setContent:(CPArray)anArray
|
||||
{
|
||||
// reset the _selectionIndexes
|
||||
[self setSelectionIndexes:[CPIndexSet indexSet]];
|
||||
|
||||
_content = anArray;
|
||||
|
||||
[self reloadContent];
|
||||
@@ -284,9 +286,11 @@
|
||||
|
||||
if (!_isSelectable)
|
||||
{
|
||||
var index = CPNotFound;
|
||||
var index = CPNotFound,
|
||||
itemCount = [_items count];
|
||||
|
||||
while ((index = [_selectionIndexes indexGreaterThanIndex:index]) != CPNotFound)
|
||||
// Be wary of invalid selection ranges since setContent: does not clear selection indexes.
|
||||
while ((index = [_selectionIndexes indexGreaterThanIndex:index]) != CPNotFound && index < itemCount)
|
||||
[_items[index] setSelected:NO];
|
||||
}
|
||||
}
|
||||
@@ -345,9 +349,11 @@
|
||||
if (!_isSelectable || [_selectionIndexes isEqual:anIndexSet])
|
||||
return;
|
||||
|
||||
var index = CPNotFound;
|
||||
var index = CPNotFound,
|
||||
itemCount = [_items count];
|
||||
|
||||
while ((index = [_selectionIndexes indexGreaterThanIndex:index]) !== CPNotFound)
|
||||
// Be wary of invalid selection ranges since setContent: does not clear selection indexes.
|
||||
while ((index = [_selectionIndexes indexGreaterThanIndex:index]) !== CPNotFound && index < itemCount)
|
||||
[_items[index] setSelected:NO];
|
||||
|
||||
_selectionIndexes = anIndexSet;
|
||||
@@ -403,7 +409,8 @@
|
||||
}
|
||||
|
||||
index = CPNotFound;
|
||||
while ((index = [_selectionIndexes indexGreaterThanIndex:index]) != CPNotFound)
|
||||
// Be wary of invalid selection ranges since setContent: does not clear selection indexes.
|
||||
while ((index = [_selectionIndexes indexGreaterThanIndex:index]) != CPNotFound && index < count)
|
||||
[_items[index] setSelected:YES];
|
||||
|
||||
[self tile];
|
||||
|
||||
@@ -70,11 +70,14 @@
|
||||
[self assert:"selection changed: 1" equals:_globalResults];
|
||||
_globalResults = nil;
|
||||
|
||||
// setting the same content again should still trigger the delegate but with no selection
|
||||
// setContent: by itself should not affect the selection.
|
||||
[_collectionView setContent:content1];
|
||||
[self assert:"selection changed: 0" equals:_globalResults];
|
||||
[self assert:nil equals:_globalResults];
|
||||
// Manually clear the selection.
|
||||
[_collectionView setSelectionIndexes:[CPIndexSet indexSet]];
|
||||
_globalResults = nil;
|
||||
|
||||
|
||||
// now lets change the contents
|
||||
[_collectionView setContent:content2];
|
||||
// we set the selection to 0 again, but on the NEW content
|
||||
@@ -94,6 +97,19 @@
|
||||
[self assert:[CPIndexSet indexSet] equals:[_collectionView selectionIndexes]];
|
||||
}
|
||||
|
||||
- (void)testSetContentAndSelectionIndexes
|
||||
{
|
||||
// Changing the content does not automatically clear the selection indexes. The previous
|
||||
// selection indexes are preserved, even if now invalid or out of range. This is what
|
||||
// Cocoa does and necessary to prevent a new empty selection from overwriting
|
||||
// CPArrayController's selectsInsertedObjects selections.
|
||||
|
||||
[_collectionView setContent:[1, 2, 3]];
|
||||
[_collectionView setSelectionIndexes:[CPIndexSet indexSetWithIndex:1]];
|
||||
[_collectionView setContent:[3, 1, 2]];
|
||||
[self assert:[CPIndexSet indexSetWithIndex:1] equals:[_collectionView selectionIndexes]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPCollectionViewWithHooks : CPCollectionView
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# NOTE: The working directory should be the main capp directory when this script is run
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# NOTE: The working directory should be the main capp directory when this script is run
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Remove the generated README.html once the build has finished.
|
||||
#
|
||||
@@ -7,4 +7,4 @@
|
||||
# $1 Cappuccino documentation directory
|
||||
#
|
||||
|
||||
rm "$1"/README.html
|
||||
rm "$1"/README.html
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# NOTE: The working directory should be the main capp directory when this script is run
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# NOTE: The working directory should be the main capp directory when this script is run
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function processor_msg ()
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
project_home="$(dirname "$PWD")"
|
||||
extras="$project_home/ci-extra.sh"
|
||||
|
||||
@@ -280,7 +280,7 @@ class LintChecker(object):
|
||||
if option:
|
||||
default = check.get('optionDefault', False)
|
||||
|
||||
if not self.view.settings().get(option, default):
|
||||
if self.view and not self.view.settings().get(option, default):
|
||||
continue
|
||||
|
||||
line = self.line
|
||||
@@ -982,7 +982,7 @@ if __name__ == '__main__':
|
||||
print usage.replace('%prog', os.path.basename(sys.argv[0]))
|
||||
sys.exit(0)
|
||||
|
||||
checker = LintChecker(basedir=basedir, var_declarations=LintChecker.VAR_DECLARATIONS.index(options.var_declarations), verbose=options.verbose)
|
||||
checker = LintChecker(basedir=basedir, view=None, var_declarations=LintChecker.VAR_DECLARATIONS.index(options.var_declarations), verbose=options.verbose)
|
||||
pathsToCheck = []
|
||||
|
||||
for filename in filenames:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
chmod +x capp_lint
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# An example hook script to verify what is about to be committed.
|
||||
# Called by "git commit" with no arguments. The hook should
|
||||
|
||||
Reference in new issue
Block a user