「プロジェクト終了」 BathyScapheのプレビューアプラグインを複数使用出来るようにするプラグイン
Revision | 07e10c90e7177afb794924c91acf087d975c8554 (tree) |
---|---|
Time | 2012-07-12 23:16:07 |
Author | masakih <masakih@user...> |
Commiter | masakih |
[Mod] KVOを教本通りに
@@ -61,12 +61,17 @@ static PSPreference *sSharedInstance = nil; | ||
61 | 61 | |
62 | 62 | [pluginsView registerForDraggedTypes:[NSArray arrayWithObject:PSPItemPastboardType]]; |
63 | 63 | |
64 | - [itemsController addObserver:self forKeyPath:@"selection.tryCheck" options:0 context:NULL]; | |
65 | - [itemsController addObserver:self forKeyPath:@"selection.displayInMenu" options:0 context:NULL]; | |
64 | + [itemsController addObserver:self forKeyPath:@"selection.tryCheck" options:0 context:itemsController]; | |
65 | + [itemsController addObserver:self forKeyPath:@"selection.displayInMenu" options:0 context:itemsController]; | |
66 | 66 | } |
67 | 67 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context |
68 | 68 | { |
69 | - [[PreviewerSelector sharedInstance] savePlugInsInfo]; | |
69 | + if(context == itemsController) { | |
70 | + [[PreviewerSelector sharedInstance] savePlugInsInfo]; | |
71 | + return; | |
72 | + } | |
73 | + | |
74 | + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; | |
70 | 75 | } |
71 | 76 | |
72 | 77 | - (void)setPlugInList:(id)list |
@@ -162,12 +167,12 @@ enum _PreferenceMenuTags { | ||
162 | 167 | { |
163 | 168 | if([rowIndexes count] != 1) return NO; |
164 | 169 | |
165 | - unsigned int index = [rowIndexes firstIndex]; | |
170 | + NSUInteger index = [rowIndexes firstIndex]; | |
166 | 171 | |
167 | 172 | [pboard declareTypes:[NSArray arrayWithObjects:PSPItemPastboardType, PSPRowIndexType, nil] owner:nil]; |
168 | 173 | [pboard setData:[NSKeyedArchiver archivedDataWithRootObject:[plugInList objectAtIndex:index]] |
169 | 174 | forType:PSPItemPastboardType]; |
170 | - [pboard setPropertyList:[NSNumber numberWithUnsignedInt:index] forType:PSPRowIndexType]; | |
175 | + [pboard setPropertyList:[NSNumber numberWithUnsignedInteger:index] forType:PSPRowIndexType]; | |
171 | 176 | |
172 | 177 | return YES; |
173 | 178 | } |
@@ -186,7 +191,7 @@ enum _PreferenceMenuTags { | ||
186 | 191 | [targetTableView setDropRow:row dropOperation:NSTableViewDropAbove]; |
187 | 192 | } |
188 | 193 | |
189 | - unsigned int originalRow = [[pboard propertyListForType:PSPRowIndexType] unsignedIntValue]; | |
194 | + NSUInteger originalRow = [[pboard propertyListForType:PSPRowIndexType] unsignedIntegerValue]; | |
190 | 195 | if(row == originalRow || row == originalRow + 1) { |
191 | 196 | return NSDragOperationNone; |
192 | 197 | } |
@@ -206,7 +211,7 @@ enum _PreferenceMenuTags { | ||
206 | 211 | |
207 | 212 | if(row < 0) row = 0; |
208 | 213 | |
209 | - unsigned int originalRow = [[pboard propertyListForType:PSPRowIndexType] unsignedIntValue]; | |
214 | + NSUInteger originalRow = [[pboard propertyListForType:PSPRowIndexType] unsignedIntegerValue]; | |
210 | 215 | |
211 | 216 | NSData *itemData = [pboard dataForType:PSPItemPastboardType]; |
212 | 217 | PSPreviewerItem *item = [NSKeyedUnarchiver unarchiveObjectWithData:itemData]; |