• R/O
  • SSH
  • HTTPS

bathyscaphe: Commit


Commit MetaInfo

Revision1809 (tree)
Time2015-02-26 01:49:50
Authortsawada2

Log Message

Previewer Preview n links Fix

Change Summary

Incremental Difference

--- bathyscaphe/trunk/application/source/preferences/AppDefaults-BoardWarrior.m (revision 1808)
+++ bathyscaphe/trunk/application/source/preferences/AppDefaults-BoardWarrior.m (revision 1809)
@@ -43,7 +43,7 @@
4343 {
4444 NSString *urlString = [anURL absoluteString];
4545 if (!urlString) {
46- ;
46+ return;
4747 }
4848 [[self boardWarriorSettingsDictionary] setObject:urlString forKey:kBWBBSMenuURLKey];
4949 }
--- bathyscaphe/trunk/application/source/manager/BSSSSPIconManager.m (revision 1808)
+++ bathyscaphe/trunk/application/source/manager/BSSSSPIconManager.m (revision 1809)
@@ -257,6 +257,6 @@
257257 [attachment_ observeIconToFinishDownload:self];
258258 }
259259 }
260- return attachment_;
260+ return [attachment_ autorelease];
261261 }
262262 @end
--- bathyscaphe/trunk/application/subproj/previewer/BSImagePreviewInspector.h (revision 1808)
+++ bathyscaphe/trunk/application/subproj/previewer/BSImagePreviewInspector.h (revision 1809)
@@ -40,6 +40,10 @@
4040 NSMutableDictionary *m_toolbarItems;
4141 NSTimer *m_fadeOutTimer;
4242 id m_recoveringURLs; // NSURL or NSArray (of NSURLs)
43+
44+ // 遅延複数プレビュー用
45+ BOOL m_mp_isFirstFoundCache;
46+ NSUInteger m_mp_newSelectedIndex;
4347 }
4448
4549 // Content object for BSIPIArrayController.
--- bathyscaphe/trunk/application/subproj/previewer/BSImagePreviewInspector.m (revision 1808)
+++ bathyscaphe/trunk/application/subproj/previewer/BSImagePreviewInspector.m (revision 1809)
@@ -59,6 +59,9 @@
5959 [defaults addObserver:self forKeyPath:@"alphaValue" options:NSKeyValueObservingOptionNew context:kBSIPIDefaultsContext];
6060 [defaults addObserver:self forKeyPath:@"imageViewBgColorData" options:NSKeyValueObservingOptionNew context:kBSIPIDefaultsContext];
6161 [defaults addObserver:self forKeyPath:@"autoCollectImages" options:NSKeyValueObservingOptionNew context:kBSIPIDefaultsContext];
62+
63+ m_mp_isFirstFoundCache = YES;
64+ m_mp_newSelectedIndex = NSNotFound;
6265 }
6366 return self;
6467 }
@@ -319,17 +322,26 @@
319322 return YES;
320323 }
321324
322-- (BOOL)previewLinksImpl:(NSArray *)urls
325+- (BOOL)previewLinksImpl:(NSDictionary *)contextInfo
323326 {
324- [self showWindow:self];
327+ NSArray *urls = [contextInfo objectForKey:@"URLs"];
328+ NSUInteger contextNum = [[contextInfo objectForKey:@"ContextNumber"] unsignedIntegerValue];
325329
330+ if (contextNum == 0) {
331+ [self showWindow:self];
332+ }
333+
326334 BSIPIArrayController *controller = [self tripleGreenCubes];
327335
328336 NSUInteger index = NSNotFound;
329- NSUInteger tmpIndex = [controller countOfArrangedObjects];
330- BOOL isFirst = YES;
331-
332- [controller setSelectsInsertedObjects:NO];
337+// NSUInteger tmpIndex = [controller countOfArrangedObjects];
338+// BOOL isFirst = YES;
339+
340+ if (contextNum == 0) {
341+ m_mp_isFirstFoundCache = YES;
342+ m_mp_newSelectedIndex = [controller countOfArrangedObjects];
343+ [controller setSelectsInsertedObjects:NO];
344+ }
333345 for (NSURL *url in urls) {
334346 index = [[self historyManager] cachedTokenIndexForURL:url];
335347 if (index == NSNotFound) {
@@ -336,8 +348,10 @@
336348 NSError *error;
337349 NSString *destinationPath = [[BSIPIDefaults sharedIPIDefaults] autoCollectImages] ? [[self historyManager] dlDateFolderPath:&error] : [[self historyManager] dlFolderPath:&error];
338350 if (!destinationPath && error) {
339- [self setRecoveringURLs:urls];
340- [self presentError:error modalForWindow:[self window] delegate:self didPresentSelector:@selector(didPresentPreviewErrorWithRecovery:contextInfo:) contextInfo:nil];
351+// [self setRecoveringURLs:urls];
352+// [self presentError:error modalForWindow:[self window] delegate:self didPresentSelector:@selector(didPresentPreviewErrorWithRecovery:contextInfo:) contextInfo:nil];
353+ // 後続の遅延プレビューもすべてキャンセル
354+ [NSObject cancelPreviousPerformRequestsWithTarget:self];
341355 return YES;
342356 }
343357 BSIPIToken *token = [[BSIPIToken alloc] initWithURL:url destination:destinationPath];
@@ -344,19 +358,48 @@
344358 [controller addObject:token];
345359 [token release];
346360 } else {
347- if (isFirst) {
361+/* if (isFirst) {
348362 tmpIndex = index;
349363 isFirst = NO;
364+ }*/
365+ if (m_mp_isFirstFoundCache) {
366+ m_mp_newSelectedIndex = index;
367+ m_mp_isFirstFoundCache = NO;
350368 }
351369 }
352370 }
353- [controller setSelectionIndex:tmpIndex];
354- [controller setSelectsInsertedObjects:YES];
371+ if (contextNum == 2) {
372+// [controller setSelectionIndex:tmpIndex];
373+ [controller setSelectionIndex:m_mp_newSelectedIndex];
374+ [controller setSelectsInsertedObjects:YES];
375+ }
355376 return YES;
356377 }
357378
379+- (BOOL)previewLinksBeforeCheck:(NSArray *)allURLs error:(NSError **)errorPtr
380+{
381+ NSUInteger index = NSNotFound;
382+ for (NSURL *url in allURLs) {
383+ index = [[self historyManager] cachedTokenIndexForURL:url];
384+ if (index == NSNotFound) {
385+ NSString *destinationPath = [[BSIPIDefaults sharedIPIDefaults] autoCollectImages] ? [[self historyManager] dlDateFolderPath:errorPtr] : [[self historyManager] dlFolderPath:errorPtr];
386+ if (!destinationPath) {
387+ return NO;
388+ }
389+ }
390+ }
391+ return YES;
392+}
393+
358394 - (BOOL)previewLinks:(NSArray *)urls
359395 {
396+ NSError *error;
397+ if (![self previewLinksBeforeCheck:urls error:&error] && error) {
398+ [self setRecoveringURLs:urls];
399+ [self presentError:error modalForWindow:[self window] delegate:self didPresentSelector:@selector(didPresentPreviewErrorWithRecovery:contextInfo:) contextInfo:nil];
400+ return YES;
401+ }
402+
360403 int division;
361404 NSTimeInterval interval;
362405
@@ -377,11 +420,24 @@
377420 }
378421
379422 int times = [urls count] / division;
423+ int moduro = [urls count] % division;
424+ NSUInteger tmp = 0;
380425 for (int i = 0; i < times; i++) {
381- [self performSelector:@selector(previewLinksImpl:) withObject:[urls subarrayWithRange:NSMakeRange(i * division, division)] afterDelay:(i * interval)];
426+ if (i == 0) {
427+ tmp = 0;
428+ } else if (i == (times - 1)) {
429+ if (moduro == 0) {
430+ tmp = 2;
431+ } else {
432+ tmp = 1;
433+ }
434+ } else {
435+ tmp = 1;
436+ }
437+ [self performSelector:@selector(previewLinksImpl:) withObject:@{@"URLs": [urls subarrayWithRange:NSMakeRange(i * division, division)], @"ContextNumber": [NSNumber numberWithUnsignedInteger:tmp]} afterDelay:(i * interval)];
382438 }
383- if ([urls count] % division != 0) {
384- [self performSelector:@selector(previewLinksImpl:) withObject:[urls subarrayWithRange:NSMakeRange(times * division, ([urls count] % division))] afterDelay:(times * interval)];
439+ if (moduro != 0) {
440+ [self performSelector:@selector(previewLinksImpl:) withObject:@{@"URLs": [urls subarrayWithRange:NSMakeRange(times * division, ([urls count] % division))], @"ContextNumber" : @2} afterDelay:(times * interval)];
385441 }
386442 return YES;
387443 }
--- bathyscaphe/trunk/application/Info-previewer.plist (revision 1808)
+++ bathyscaphe/trunk/application/Info-previewer.plist (revision 1809)
@@ -23,7 +23,7 @@
2323 <key>CFBundleSignature</key>
2424 <string>????</string>
2525 <key>CFBundleVersion</key>
26- <string>160</string>
26+ <string>162</string>
2727 <key>NSHumanReadableCopyright</key>
2828 <string>© 2005-2015 tsawada2 &amp; BathyScaphe Project</string>
2929 <key>NSMainNibFile</key>
--- bathyscaphe/trunk/application/Info-bathyscaphe.plist (revision 1808)
+++ bathyscaphe/trunk/application/Info-bathyscaphe.plist (revision 1809)
@@ -87,7 +87,7 @@
8787 </dict>
8888 </array>
8989 <key>CFBundleVersion</key>
90- <string>771</string>
90+ <string>772</string>
9191 <key>LSMinimumSystemVersion</key>
9292 <string>10.7.5</string>
9393 <key>NSAppleScriptEnabled</key>
--- bathyscaphe/trunk/changelog.txt (revision 1808)
+++ bathyscaphe/trunk/changelog.txt (revision 1809)
@@ -1,3 +1,12 @@
1+2015-02-26 tsawada2 <tsawada2@users.sourceforge.jp>
2+ * application/source/manager/BSSSSPIconManager.m
3+ * application/source/preferences/AppDefaults-BoardWarrior.m
4+ * frameworks/SGAppKit/framework/src/extensions/image/NSImage-SGExtensions.m
5+ メモリリークが発生する恐れがあった記述を修正。
6+ * application/subproj/BSLinkPreviewSelector/ja.lproj/BSPSPlugInPaneViewController.xib
7+ nib の Deployment Target が 10.6 に指定されていたせいで不要なワーニングが出ていたのを修正。
8+ * application/subproj/previewer/BSImagePreviewInspector.m
9+ 「n 個のリンクをプレビュー」の挙動を改善。
110 2015-02-22 tsawada2 <tsawada2@users.sourceforge.jp>
211 * application/source/composer/CMXTextParser.m
312 open2ch のように、レスの投稿日時が半角スペースなしで表記されている場合のパースがうまくいかない問題を修正。
--- bathyscaphe/trunk/frameworks/SGAppKit/framework/src/extensions/image/NSImage-SGExtensions.m (revision 1808)
+++ bathyscaphe/trunk/frameworks/SGAppKit/framework/src/extensions/image/NSImage-SGExtensions.m (revision 1809)
@@ -84,13 +84,12 @@
8484 }*/
8585 image_ = [[NSBundle applicationSpecificBundle] imageForResource:aName];
8686 if (search && !image_) {
87- image_ = [[self imageNamed:aName] retain];
87+ image_ = [self imageNamed:aName];
8888 }
8989 if (!image_) {
9090 return nil;
9191 }
9292 [userImageCache setObject:image_ forKey:aName];
93- [image_ release];
9493
9594 return image_;
9695 }
--- bathyscaphe/trunk/frameworks/SGAppKit/Info-SGAppKit.plist (revision 1808)
+++ bathyscaphe/trunk/frameworks/SGAppKit/Info-SGAppKit.plist (revision 1809)
@@ -21,7 +21,7 @@
2121 <key>CFBundleSignature</key>
2222 <string>????</string>
2323 <key>CFBundleVersion</key>
24- <string>101</string>
24+ <string>102</string>
2525 <key>NSHumanReadableCopyright</key>
2626 <string>© 2005-2015 tsawada2 &amp; BathyScaphe Project</string>
2727 </dict>
Show on old repository browser