• R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

「プロジェクト終了」 BathyScapheのプレビューアプラグインを複数使用出来るようにするプラグイン


Commit MetaInfo

修订版07e10c90e7177afb794924c91acf087d975c8554 (tree)
时间2012-07-12 23:16:07
作者masakih <masakih@user...>
Commitermasakih

Log Message

[Mod] KVOを教本通りに

更改概述

差异

--- a/PSPreference.m
+++ b/PSPreference.m
@@ -61,12 +61,17 @@ static PSPreference *sSharedInstance = nil;
6161
6262 [pluginsView registerForDraggedTypes:[NSArray arrayWithObject:PSPItemPastboardType]];
6363
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];
6666 }
6767 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
6868 {
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];
7075 }
7176
7277 - (void)setPlugInList:(id)list
@@ -162,12 +167,12 @@ enum _PreferenceMenuTags {
162167 {
163168 if([rowIndexes count] != 1) return NO;
164169
165- unsigned int index = [rowIndexes firstIndex];
170+ NSUInteger index = [rowIndexes firstIndex];
166171
167172 [pboard declareTypes:[NSArray arrayWithObjects:PSPItemPastboardType, PSPRowIndexType, nil] owner:nil];
168173 [pboard setData:[NSKeyedArchiver archivedDataWithRootObject:[plugInList objectAtIndex:index]]
169174 forType:PSPItemPastboardType];
170- [pboard setPropertyList:[NSNumber numberWithUnsignedInt:index] forType:PSPRowIndexType];
175+ [pboard setPropertyList:[NSNumber numberWithUnsignedInteger:index] forType:PSPRowIndexType];
171176
172177 return YES;
173178 }
@@ -186,7 +191,7 @@ enum _PreferenceMenuTags {
186191 [targetTableView setDropRow:row dropOperation:NSTableViewDropAbove];
187192 }
188193
189- unsigned int originalRow = [[pboard propertyListForType:PSPRowIndexType] unsignedIntValue];
194+ NSUInteger originalRow = [[pboard propertyListForType:PSPRowIndexType] unsignedIntegerValue];
190195 if(row == originalRow || row == originalRow + 1) {
191196 return NSDragOperationNone;
192197 }
@@ -206,7 +211,7 @@ enum _PreferenceMenuTags {
206211
207212 if(row < 0) row = 0;
208213
209- unsigned int originalRow = [[pboard propertyListForType:PSPRowIndexType] unsignedIntValue];
214+ NSUInteger originalRow = [[pboard propertyListForType:PSPRowIndexType] unsignedIntegerValue];
210215
211216 NSData *itemData = [pboard dataForType:PSPItemPastboardType];
212217 PSPreviewerItem *item = [NSKeyedUnarchiver unarchiveObjectWithData:itemData];