Revision: 17921
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=17921&view=rev
Author: hofman
Date: 2011-06-02 11:45:55 +0000 (Thu, 02 Jun 2011)
Log Message:
-----------
combine some statements in single if block
Modified Paths:
--------------
trunk/bibdesk/BibDocument.m
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2011-06-02 11:36:53 UTC (rev 17920)
+++ trunk/bibdesk/BibDocument.m 2011-06-02 11:45:55 UTC (rev 17921)
@@ -2499,23 +2499,28 @@
}
NSString *userInfo = [[self fileURL] path];
- NSMutableArray *sortDescriptors = [NSMutableArray array];
- if (tmpSortKey)
- [sortDescriptors addObject:[BDSKTableSortDescriptor
tableSortDescriptorForIdentifier:tmpSortKey
ascending:!docFlags.tmpSortDescending userInfo:userInfo]];
- [sortDescriptors addObject:[BDSKTableSortDescriptor
tableSortDescriptorForIdentifier:sortKey ascending:!docFlags.sortDescending
userInfo:userInfo]];
- [sortDescriptors addObject:[BDSKTableSortDescriptor
tableSortDescriptorForIdentifier:previousSortKey
ascending:!docFlags.previousSortDescending userInfo:userInfo]];
- [tableView setSortDescriptors:sortDescriptors]; // just using this to
store them; it's really a no-op
+ NSMutableArray *sortDescriptors = [NSMutableArray arrayWithObjects:
+ [BDSKTableSortDescriptor tableSortDescriptorForIdentifier:sortKey
ascending:!docFlags.sortDescending userInfo:userInfo],
+ [BDSKTableSortDescriptor
tableSortDescriptorForIdentifier:previousSortKey
ascending:!docFlags.previousSortDescending userInfo:userInfo], nil];
// Set the graphic for the new column header
NSTableColumn *oldTC = [tableView highlightedTableColumn];
- NSTableColumn *newTC = [tableView tableColumnWithIdentifier:(tmpSortKey ?:
sortKey)];
- BOOL sortDescending = tmpSortKey == nil ? docFlags.sortDescending :
docFlags.tmpSortDescending;
+ NSTableColumn *newTC;
+ BOOL ascending;
+ if (tmpSortKey) {
+ newTC = [tableView tableColumnWithIdentifier:tmpSortKey];
+ ascending = !docFlags.tmpSortDescending;
+ [sortDescriptors insertObject:[BDSKTableSortDescriptor
tableSortDescriptorForIdentifier:tmpSortKey
ascending:!docFlags.tmpSortDescending userInfo:userInfo] atIndex:0];
+ } else {
+ newTC = [tableView tableColumnWithIdentifier:sortKey];
+ ascending = !docFlags.sortDescending;
+ }
if ([oldTC isEqual:newTC] == NO) {
[tableView setHighlightedTableColumn:newTC];
if (oldTC)
[tableView setIndicatorImage:nil inTableColumn:oldTC];
}
- [tableView setIndicatorImageForAscending:!sortDescending
inTableColumn:newTC];
+ [tableView setIndicatorImageForAscending:ascending inTableColumn:newTC];
// @@ DON'T RETURN WITHOUT RESETTING THIS!
// this is a hack to keep us from getting selection change notifications
while sorting (which updates the TeX and attributed text previews)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit