Permalink
Browse files

Adjusted things

  • Loading branch information...
1 parent 8457248 commit f1097128ad815c1f2d3d98fc67af008a36cea4bd @atg committed Jul 3, 2010
Showing with 505 additions and 170 deletions.
  1. +1 −1 Anthill Cocoa/AnthillBugReporter.h
  2. +1 −1 Anthill Cocoa/AnthillBugReporter.m
  3. +1 −1 CHLeftSplitVIew.h
  4. +1 −1 CHLeftSplitView.m
  5. +1 −1 CHSymbolButtonImage.h
  6. +1 −1 CHSymbolButtonImage.m
  7. +3 −0 English.lproj/MainMenu.xib
  8. +6 −0 HTML_Example/main.css
  9. +1 −1 IGKAnnotation.h
  10. +1 −1 IGKAnnotation.m
  11. +1 −1 IGKAnnotationManager.h
  12. +1 −1 IGKAnnotationManager.m
  13. +1 −1 IGKApplicationDelegate.h
  14. +1 −1 IGKApplicationDelegate.m
  15. +1 −1 IGKArrayController.h
  16. +1 −1 IGKArrayController.m
  17. +1 −1 IGKBackForwardManager.h
  18. +1 −1 IGKBackForwardManager.m
  19. +1 −1 IGKBackgroundProgressBar.h
  20. +1 −1 IGKBackgroundProgressBar.m
  21. +16 −9 IGKCircularBuffer.h
  22. +46 −24 IGKCircularBuffer.m
  23. +1 −1 IGKDocRecordManagedObject.h
  24. +5 −1 IGKDocRecordManagedObject.m
  25. +1 −1 IGKDocSetManagedObject.h
  26. +1 −1 IGKDocSetManagedObject.m
  27. +1 −1 IGKEaseInOutAnimatedView.h
  28. +1 −1 IGKEaseInOutAnimatedView.m
  29. +1 −1 IGKFilterBarTableView.h
  30. +1 −1 IGKFilterBarTableView.m
  31. +1 −1 IGKFindBackgroundView.h
  32. +1 −1 IGKFindBackgroundView.m
  33. +1 −1 IGKFindWindow.h
  34. +1 −1 IGKFindWindow.m
  35. +1 −1 IGKForwardView.h
  36. +1 −1 IGKForwardView.m
  37. +24 −0 IGKFrecencyStore.h
  38. +197 −0 IGKFrecencyStore.m
  39. +1 −1 IGKHTMLGenerator.h
  40. +1 −1 IGKHTMLGenerator.m
  41. +1 −1 IGKLaunchController.h
  42. +1 −1 IGKLaunchController.m
  43. +1 −1 IGKManagedObject.h
  44. +1 −1 IGKManagedObject.m
  45. +1 −1 IGKMatteButton.h
  46. +1 −1 IGKMatteButton.m
  47. +1 −1 IGKMatteFocusedGradientBox.h
  48. +1 −1 IGKMatteFocusedGradientBox.m
  49. +1 −1 IGKMattePopUpButton.h
  50. +1 −1 IGKMattePopUpButton.m
  51. +1 −1 IGKMattePopUpButtonView.h
  52. +1 −1 IGKMattePopUpButtonView.m
  53. +1 −1 IGKMatteSegmentedControl.h
  54. +1 −1 IGKMatteSegmentedControl.m
  55. +1 −1 IGKMultiSelector.h
  56. +1 −1 IGKMultiSelector.m
  57. +1 −1 IGKNoSelectionInnerView.h
  58. +1 −1 IGKNoSelectionInnerView.m
  59. +1 −1 IGKNoSelectionOuterView.h
  60. +1 −1 IGKNoSelectionOuterView.m
  61. +1 −1 IGKOutputStream.h
  62. +1 −1 IGKOutputStream.m
  63. +1 −1 IGKPredicateEditor.h
  64. +1 −1 IGKPredicateEditor.m
  65. +1 −1 IGKPreferencesController.h
  66. +1 −1 IGKPreferencesController.m
  67. +1 −1 IGKResizeDelegatedView.h
  68. +1 −1 IGKResizeDelegatedView.m
  69. +1 −1 IGKScraper.h
  70. +3 −1 IGKScraper.m
  71. +1 −1 IGKShyTableView.h
  72. +1 −1 IGKShyTableView.m
  73. +1 −1 IGKSometimesCenteredTextCell.h
  74. +1 −1 IGKSometimesCenteredTextCell.m
  75. +1 −1 IGKSourceListWallpaperView.h
  76. +1 −1 IGKSourceListWallpaperView.m
  77. +1 −1 IGKTableOfContentsView.h
  78. +1 −1 IGKTableOfContentsView.m
  79. +1 −1 IGKWindow.h
  80. +1 −1 IGKWindow.m
  81. +4 −2 IGKWindowController.h
  82. +54 −25 IGKWindowController.m
  83. +1 −1 IGKWordMembership.h
  84. +1 −1 IGKWordMembership.m
  85. +2 −2 Ingredients-Info.plist
  86. +8 −0 Ingredients.xcodeproj/project.pbxproj
  87. +1 −1 IngredientsKit.h
  88. +1 −1 Ingredients_AppDelegate.h
  89. +2 −1 Ingredients_AppDelegate.m
  90. BIN Ingredients_DataModel.xcdatamodel/elements
  91. BIN Ingredients_DataModel.xcdatamodel/layout
  92. +1 −1 NSArray+IGKAdditions.h
  93. +23 −7 NSArray+IGKAdditions.m
  94. +1 −1 NSBezierPath+MCAdditions.h
  95. +2 −2 NSBezierPath+MCAdditions.m
  96. +1 −1 NSShadow+MCAdditions.h
  97. +1 −1 NSShadow+MCAdditions.m
  98. +1 −1 NSString+Utilities.h
  99. +1 −1 NSString+Utilities.m
  100. +1 −1 NSXMLNode+IGKAdditions.h
  101. +1 −1 NSXMLNode+IGKAdditions.m
  102. +1 −1 RegexKitLite.h
  103. +1 −1 RegexKitLite.m
  104. +1 −1 Remaining bugs.txt
  105. +1 −1 SQPreferencesBackgroundComponent.h
  106. +1 −1 SQPreferencesBackgroundComponent.m
  107. +1 −1 XBNewSourceListCell.h
  108. +1 −1 XBNewSourceListCell.m
  109. +1 −1 main.m
  110. +1 −1 smartcmp.h
  111. +17 −3 smartcmp.m
View
2 Anthill Cocoa/AnthillBugReporter.h
@@ -3,7 +3,7 @@
// AnthillReporter
//
// Created by Alex Gordon on 14/02/2009.
-// Copyright 2009 Fileability. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import <Cocoa/Cocoa.h>
View
2 Anthill Cocoa/AnthillBugReporter.m
@@ -3,7 +3,7 @@
// AnthillReporter
//
// Created by Alex Gordon on 14/02/2009.
-// Copyright 2009 Fileability. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import "AnthillBugReporter.h"
View
2 CHLeftSplitVIew.h
@@ -3,7 +3,7 @@
// Chocolat
//
// Created by Alex Gordon on 29/10/2009.
-// Copyright 2009 __MyCompanyName__. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import <Cocoa/Cocoa.h>
View
2 CHLeftSplitView.m
@@ -3,7 +3,7 @@
// Chocolat
//
// Created by Alex Gordon on 29/10/2009.
-// Copyright 2009 __MyCompanyName__. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import "CHLeftSplitView.h"
View
2 CHSymbolButtonImage.h
@@ -3,7 +3,7 @@
// Chocolat
//
// Created by Alex Gordon on 11/09/2009.
-// Copyright 2009 Fileability. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import <Cocoa/Cocoa.h>
View
2 CHSymbolButtonImage.m
@@ -3,7 +3,7 @@
// Chocolat
//
// Created by Alex Gordon on 11/09/2009.
-// Copyright 2009 Fileability. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import "CHSymbolButtonImage.h"
View
3 English.lproj/MainMenu.xib
@@ -796,6 +796,7 @@
<reference key="NSMenu" ref="531461334"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
+ <bool key="NSIsHidden">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
@@ -804,6 +805,7 @@
</object>
<object class="NSMenuItem" id="739539978">
<reference key="NSMenu" ref="531461334"/>
+ <bool key="NSIsHidden">YES</bool>
<string key="NSTitle">Previous Symbol</string>
<string key="NSKeyEquiv"></string>
<int key="NSKeyEquivModMask">1572864</int>
@@ -813,6 +815,7 @@
</object>
<object class="NSMenuItem" id="1070219007">
<reference key="NSMenu" ref="531461334"/>
+ <bool key="NSIsHidden">YES</bool>
<string key="NSTitle">Next Symbol</string>
<string key="NSKeyEquiv"></string>
<int key="NSKeyEquivModMask">1572864</int>
View
6 HTML_Example/main.css
@@ -17,6 +17,8 @@ code
.category
{
margin-top: -4px;
+ margin-bottom: 0;
+ padding-bottom: 8px;
text-indent: 20px;
font-style: italic;
font-size: 13px;
@@ -134,6 +136,10 @@ code
border-top-style: none;
}
+.methods div.description
+{
+ margin-top: -12px;
+}
.methods .info h3
{
View
2 IGKAnnotation.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-04-30.
-// Copyright 2010 SilverCocoa. All rights reserved.
+// Written in 2010 by SilverCocoa.
//
#import <Cocoa/Cocoa.h>
View
2 IGKAnnotation.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-04-30.
-// Copyright 2010 SilverCocoa. All rights reserved.
+// Written in 2010 by SilverCocoa.
//
#import "IGKAnnotation.h"
View
2 IGKAnnotationManager.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-04-30.
-// Copyright 2010 SilverCocoa. All rights reserved.
+// Written in 2010 by SilverCocoa.
//
#import <Cocoa/Cocoa.h>
View
2 IGKAnnotationManager.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-04-30.
-// Copyright 2010 SilverCocoa. All rights reserved.
+// Written in 2010 by SilverCocoa.
//
#import "IGKAnnotationManager.h"
View
2 IGKApplicationDelegate.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 23/01/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKApplicationDelegate.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 23/01/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKApplicationDelegate.h"
View
2 IGKArrayController.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 13/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKArrayController.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 13/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKArrayController.h"
View
2 IGKBackForwardManager.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 07/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKBackForwardManager.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 07/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKBackForwardManager.h"
View
2 IGKBackgroundProgressBar.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 17/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKBackgroundProgressBar.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 17/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKBackgroundProgressBar.h"
View
25 IGKCircularBuffer.h
@@ -2,37 +2,44 @@ typedef struct {
// 0 <= elementCount <= actualSize <= targetSize
//The number of elements in the buffer
- size_t elementCount;
+ CFIndex elementCount;
//The amount of elements that we have allocated enough memory to hold. Must not be 0
- size_t allocatedCount;
+ CFIndex allocatedCount;
//The maximum number of elements that the buffer will grow to hold before it starts discarding things
- size_t maximumCount;
+ CFIndex maximumCount;
//The size in bytes of each element in the buffer
- size_t elementSize;
+ CFIndex elementSize;
//A pointer to all the elements
void* items;
//The offset of the element that was added the longest time ago
- size_t oldestElement;
+ CFIndex oldestElement;
//The offset of the element that was added most recently
- size_t youngestElement;
+ CFIndex youngestElement;
} IGKCircularBuffer;
+//Create a buffer and fill it with data
+IGKCircularBuffer IGKCircularBufferCreateFromData(const void *data, CFIndex dataLength, CFIndex maximumCount, CFIndex elementSize);
+
//Create an empty buffer with a specified size
-IGKCircularBuffer IGKCircularBufferCreate(size_t maximumCount, size_t elementSize, size_t initialSize);
+IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementSize, CFIndex initialSize);
//Add elementSize bytes of *pointerToData to the buffer.
void IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData);
//Get a pointer to the raw data and the length of the data, eg to pass to NSData
-IGKCircularBuffer IGKCircularBufferRawData(IGKCircularBuffer buffer);
-size_t IGKCircularBufferRawDataLength(IGKCircularBuffer buffer);
+void* IGKCircularBufferRawData(IGKCircularBuffer buffer);
+CFIndex IGKCircularBufferRawDataLength(IGKCircularBuffer buffer);
+
+//Get data in a format suitable for writing out to disk
+NSData* IGKCircularBufferOrderedData(IGKCircularBuffer buffer);
+CFIndex IGKCircularBufferOrderedDataLength(IGKCircularBuffer buffer);
//Delete the buffer
void IGKCircularBufferFree(IGKCircularBuffer buffer);
View
70 IGKCircularBuffer.m
@@ -1,28 +1,22 @@
-typedef struct {
- // 0 <= elementCount <= actualSize <= targetSize
-
- //The number of elements in the buffer
- CFIndex elementCount;
-
- //The amount of elements that we have allocated enough memory to hold. Must not be 0
- CFIndex allocatedCount;
-
- //The maximum number of elements that the buffer will grow to hold before it starts discarding things
- CFIndex maximumCount;
-
- //The size in bytes of each element in the buffer
- CFIndex elementSize;
+#import "IGKCircularBuffer.h"
+
+IGKCircularBuffer IGKCircularBufferCreateFromData(const void *data, CFIndex dataLength, CFIndex maximumCount, CFIndex elementSize)
+{
+ IGKCircularBuffer buffer;
- //A pointer to all the elements
- void* items;
+ buffer.elementCount = 0;
+ buffer.allocatedCount = dataLength / elementSize;
+ buffer.maximumCount = maximumCount;
+ buffer.elementSize = elementSize;
- //The offset of the element that was added the longest time ago
- int64_t oldestElement;
+ buffer.items = malloc(dataLength * elementSize);
+ memcpy(buffer.items, data, dataLength);
- //The offset of the element that was added most recently
- CFIndex youngestElement;
+ buffer.oldestElement = -1;
+ buffer.youngestElement = -1;
-} IGKCircularBuffer;
+ return buffer;
+}
//Create an empty buffer with a specified size
IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementSize, CFIndex initialSize)
@@ -47,7 +41,7 @@ IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementS
}
//Add elementSize bytes of *pointerToData to the buffer.
-void* IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData)
+void IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData)
{
//If the buffer needs to grow
if (buffer.elementCount + 1 > buffer.allocatedCount && buffer.allocatedCount < buffer.maximumCount)
@@ -65,7 +59,7 @@ IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementS
if (!newItems)
{
//Do something if reallocf fails
- return NULL;
+ return;
}
//Set our variables
@@ -114,7 +108,7 @@ IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementS
}
//Get a pointer to the raw data and the length of the data, eg to pass to NSData
-IGKCircularBuffer* IGKCircularBufferRawData(IGKCircularBuffer buffer)
+void* IGKCircularBufferRawData(IGKCircularBuffer buffer)
{
return buffer.items;
}
@@ -125,6 +119,34 @@ CFIndex IGKCircularBufferRawDataLength(IGKCircularBuffer buffer)
return 0;
}
+//Get data in a format suitable for writing out to disk
+NSData* IGKCircularBufferOrderedData(IGKCircularBuffer buffer)
+{
+ NSMutableData *data = [[NSMutableData alloc] initWithCapacity:IGKCircularBufferOrderedDataLength(buffer)];
+
+ if (buffer.elementCount == 0)
+ return data;
+
+ for (CFIndex i = buffer.oldestElement; ; i = (i + 1) % buffer.elementCount)
+ {
+ if (buffer.items + i == NULL)
+ continue;
+
+ [data appendBytes:buffer.items + i * buffer.elementSize length:buffer.elementSize];
+
+ if (i == buffer.youngestElement)
+ break;
+ }
+
+ return data;
+}
+CFIndex IGKCircularBufferOrderedDataLength(IGKCircularBuffer buffer)
+{
+ if (buffer.items)
+ return buffer.elementCount * buffer.elementSize;
+ return 0;
+}
+
//Delete the buffer
void IGKCircularBufferFree(IGKCircularBuffer buffer)
{
View
2 IGKDocRecordManagedObject.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 25/01/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
6 IGKDocRecordManagedObject.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 25/01/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKDocRecordManagedObject.h"
@@ -552,5 +552,9 @@ - (NSImage *)iconForSelectedState:(BOOL)isSelected
return [[CHSymbolButtonImage symbolImageWithMask:mask] objectAtIndex:index];
}
+- (NSNumber *)lengthOfContent
+{
+ return [self valueForKey:@"contentsLength"];
+}
@end
View
2 IGKDocSetManagedObject.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 04/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKDocSetManagedObject.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 04/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKDocSetManagedObject.h"
View
2 IGKEaseInOutAnimatedView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 11/03/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKEaseInOutAnimatedView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 11/03/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKEaseInOutAnimatedView.h"
View
2 IGKFilterBarTableView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 17/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKFilterBarTableView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 17/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKFilterBarTableView.h"
View
2 IGKFindBackgroundView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 17/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKFindBackgroundView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 17/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKFindBackgroundView.h"
View
2 IGKFindWindow.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 18/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKFindWindow.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 18/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKFindWindow.h"
View
2 IGKForwardView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-05-06.
-// Copyright 2010 SilverCocoa. All rights reserved.
+// Written in 2010 by SilverCocoa.
//
#import <Cocoa/Cocoa.h>
View
2 IGKForwardView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-05-06.
-// Copyright 2010 SilverCocoa. All rights reserved.
+// Written in 2010 by SilverCocoa.
//
#import "IGKForwardView.h"
View
24 IGKFrecencyStore.h
@@ -0,0 +1,24 @@
+//
+// IGKFrecencyStore.h
+// Ingredients
+//
+// Created by Alex Gordon on 01/07/2010.
+// Written in 2010 by Fileability.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "IGKCircularBuffer.h"
+
+@interface IGKFrecencyStore : NSObject {
+ NSString *identifier;
+ IGKCircularBuffer buffer;
+
+ BOOL hasChanges;
+}
+
++ (id)storeWithIdentifier:(NSString *)identifier;
+
+- (void)recordItem:(NSString *)item;
+- (NSArray *)timestampsForItem:(NSString *)item count:(uint64_t *)count;
+
+@end
View
197 IGKFrecencyStore.m
@@ -0,0 +1,197 @@
+//
+// IGKFrecencyStore.m
+// Ingredients
+//
+// Created by Alex Gordon on 01/07/2010.
+// Written in 2010 by Fileability.
+//
+
+#import "IGKFrecencyStore.h"
+
+
+typedef struct {
+ int64_t timestamp;
+ NSString *item;
+
+ // IF YOU MODIFY THIS STRUCT YOU ******MUST****** INCREMENT IGKFrecencyStoreBufferRecordVersion !!!!!!1!1!!!!1!ONE!1!!ELEVENTY1
+
+} IGKFrecencyStoreBufferRecord;
+
+// vvvvv THAT'S THIS THING vvvvv
+const int IGKFrecencyStoreBufferRecordVersion = 1;
+// ^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^
+
+
+@interface IGKFrecencyStore ()
+
+- (NSString *)storeDirectory;
+- (NSString *)storeExtension;
+- (NSString *)path;
+- (void)readFromDisk;
+- (void)writeToDisk;
+- (void)heartbeat;
+
+@end
+
+
+@implementation IGKFrecencyStore
+
+#pragma mark Life Cycle
+
+static NSMutableDictionary *stores = nil;
+
++ (id)storeWithIdentifier:(NSString *)ident
+{
+ return nil;
+
+ if ([stores objectForKey:ident])
+ return [stores objectForKey:ident];
+
+ if (!stores)
+ stores = [[NSMutableDictionary alloc] initWithCapacity:5];
+
+ IGKFrecencyStore *store = [[[self alloc] initWithIdentifier:ident] autorelease];
+ [stores setValue:store forKey:ident];
+
+ return store;
+}
+- (id)initWithIdentifier:(NSString *)ident
+{
+ if (self = [super init])
+ {
+ identifier = [ident copy];
+
+ [self readFromDisk];
+
+ [self heartbeat];
+ }
+
+ return self;
+}
+- (void)finalize
+{
+ IGKCircularBufferFree(buffer);
+
+ [super finalize];
+}
+
+
+#pragma mark Recording and Reading
+
+- (void)recordItem:(NSString *)item
+{
+ int64_t timestamp = (int64_t)[NSDate timeIntervalSinceReferenceDate];
+
+ IGKFrecencyStoreBufferRecord record;
+ record.timestamp = timestamp;
+ record.item = item;
+
+ IGKCircularBufferAdd(buffer, &record);
+
+ hasChanges = YES;
+}
+- (NSArray *)timestampsForItem:(NSString *)item count:(uint64_t *)count
+{
+ //If no variable to put count in is specified, they can't do anything but crash, so return NULL
+ if (!count)
+ return NULL;
+
+ CFIndex length = IGKCircularBufferRawDataLength(buffer);
+ IGKFrecencyStoreBufferRecord* data = (IGKFrecencyStoreBufferRecord*)IGKCircularBufferRawData(buffer);
+
+ NSMutableArray *timestamps = [[NSMutableArray alloc] initWithCapacity:100];
+
+ if (buffer.elementCount > 0)
+ {
+ for (CFIndex i = buffer.oldestElement; ; i = (i + 1) % buffer.elementCount)
+ {
+ if (data + i == NULL)
+ continue;
+
+ IGKFrecencyStoreBufferRecord record = data[i];
+ if ([record.item isEqual:item])
+ {
+ [timestamps addObject:[NSNumber numberWithLongLong:record.timestamp]];
+ }
+
+ if (i == buffer.youngestElement)
+ break;
+ }
+ }
+
+ return timestamps;
+}
+
+#pragma mark File IO
+
+const CFIndex IGKFrecencyStoreMaximumCount = 1000;
+const CFIndex IGKFrecencyStoreInitialCount = 100;
+
+- (NSString *)storeDirectory
+{
+ // <appsupport>/Frecency/<identifier>
+
+ NSString *appSupport = [[[NSApp delegate] kitController] applicationSupportDirectory];
+
+ return [appSupport stringByAppendingPathComponent:@"Frecency"];
+}
+- (NSString *)storeExtension
+{
+ return [NSString stringWithFormat:@"igkfrecencystore%d", IGKFrecencyStoreBufferRecordVersion];
+}
+- (NSString *)path
+{
+ return [[[self storeDirectory] stringByAppendingPathComponent:identifier] stringByAppendingPathExtension:[self storeExtension]];
+}
+- (void)readFromDisk
+{
+ NSString *path = [self path];
+
+ NSError *err = nil;
+ NSData *data = [[NSData alloc] initWithContentsOfFile:path options:NSDataReadingUncached error:&err];
+
+ if (!data || err)
+ {
+ buffer = IGKCircularBufferCreate(IGKFrecencyStoreMaximumCount, sizeof(IGKFrecencyStoreBufferRecord), IGKFrecencyStoreInitialCount);
+ return;
+ }
+
+ //Read from data
+ buffer = IGKCircularBufferCreateFromData([data bytes], [data length], IGKFrecencyStoreMaximumCount, sizeof(IGKFrecencyStoreBufferRecord));
+}
+- (void)writeToDisk
+{
+ NSLog(@"Writing IGKFrecencyStore %@ to disk. It has%@ changes", identifier, hasChanges ? @"" : @" no");
+
+ if (!hasChanges)
+ return;
+ hasChanges = NO;
+
+ NSString *path = [self path];
+ NSLog(@"\t path = '%@'", path);
+
+ //Create the directory
+ [[NSFileManager defaultManager] createDirectoryAtPath:[self storeDirectory] withIntermediateDirectories:YES attributes:nil error:nil];
+
+ //Get data from buffer
+ if (buffer.elementCount == 0)
+ return;
+ NSData *data = IGKCircularBufferOrderedData(buffer);
+ NSLog(@"\t data [%ud] %@", [data length], data);
+
+ //Write to disk
+ NSError *err = nil;
+ [data writeToFile:path options:NSDataWritingAtomic error:&err];
+ NSLog(@"\t err = %@", err);
+}
+- (void)heartbeat
+{
+ NSLog(@"Heartbeat on IGKFrecencyStore %@", identifier);
+
+ [self writeToDisk];
+
+ //We want to do a write every 20 seconds
+ [self performSelector:@selector(heartbeat) withObject:nil afterDelay:5.0];
+}
+
+@end
View
2 IGKHTMLGenerator.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 26/01/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKHTMLGenerator.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 26/01/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKHTMLGenerator.h"
View
2 IGKLaunchController.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 10/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKLaunchController.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 10/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKLaunchController.h"
View
2 IGKManagedObject.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 08/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKManagedObject.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 08/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKManagedObject.h"
View
2 IGKMatteButton.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 19/06/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKMatteButton.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 19/06/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKMatteButton.h"
View
2 IGKMatteFocusedGradientBox.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 20/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKMatteFocusedGradientBox.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 20/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKMatteFocusedGradientBox.h"
View
2 IGKMattePopUpButton.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 09/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKMattePopUpButton.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 09/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKMattePopUpButton.h"
View
2 IGKMattePopUpButtonView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 20/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKMattePopUpButtonView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 20/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKMattePopUpButtonView.h"
View
2 IGKMatteSegmentedControl.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 27/02/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKMatteSegmentedControl.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 27/02/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKMatteSegmentedControl.h"
View
2 IGKMultiSelector.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 22/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKMultiSelector.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 22/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKMultiSelector.h"
View
2 IGKNoSelectionInnerView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 13/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKNoSelectionInnerView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 13/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKNoSelectionInnerView.h"
View
2 IGKNoSelectionOuterView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 13/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKNoSelectionOuterView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 13/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKNoSelectionOuterView.h"
View
2 IGKOutputStream.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 09/06/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKOutputStream.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 09/06/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKOutputStream.h"
View
2 IGKPredicateEditor.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 23/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKPredicateEditor.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 23/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKPredicateEditor.h"
View
2 IGKPreferencesController.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 07/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKPreferencesController.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 07/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKPreferencesController.h"
View
2 IGKResizeDelegatedView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 18/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKResizeDelegatedView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 18/04/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKResizeDelegatedView.h"
View
2 IGKScraper.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 24/01/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
4 IGKScraper.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 24/01/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKScraper.h"
@@ -277,6 +277,7 @@ - (NSManagedObject *)extractPath:(NSString *)extractPath relativeExtractPath:(NS
//Let's try to extract the class's name (assuming it is a class of course)
NSError *error = nil;
NSString *contents = [NSString stringWithContentsOfFile:extractPath encoding:NSUTF8StringEncoding error:&error];
+ NSUInteger contentsLength = [contents length];
if (error || !contents)
{
return nil;
@@ -430,6 +431,7 @@ - (NSManagedObject *)extractPath:(NSString *)extractPath relativeExtractPath:(NS
{
obj = [self addRecordNamed:name entityName:entityName desc:@"" sourcePath:relativeExtractPath];
[obj setValue:docset forKey:@"docset"];
+ [obj setValue:[NSNumber numberWithUnsignedInteger:contentsLength] forKey:@"contentsLength"];
if ([superclass length])
[obj setValue:superclass forKey:@"superclassName"];
View
2 IGKShyTableView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 22/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKShyTableView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 22/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKShyTableView.h"
View
2 IGKSometimesCenteredTextCell.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 04/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKSometimesCenteredTextCell.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 04/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKSometimesCenteredTextCell.h"
View
2 IGKSourceListWallpaperView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 10/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKSourceListWallpaperView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 10/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKSourceListWallpaperView.h"
View
2 IGKTableOfContentsView.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 06/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKTableOfContentsView.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 06/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKTableOfContentsView.h"
View
2 IGKWindow.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 22/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKWindow.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 22/02/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKWindow.h"
View
6 IGKWindowController.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 23/01/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
@@ -150,7 +150,9 @@ typedef enum {
BOOL shouldIndex;
BOOL isIndexing;
BOOL isInFullscreen;
-
+
+ long frecencyToken;
+
NSManagedObjectID *currentObjectIDInBrowser;
NSArray *selectedFilterDocset;
View
79 IGKWindowController.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 23/01/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKWindowController.h"
@@ -16,6 +16,7 @@
#import "IGKDocRecordManagedObject.h"
#import "CHSymbolButtonImage.h"
#import "IGKSometimesCenteredTextCell.h"
+#import "IGKFrecencyStore.h"
@interface IGKWindowController ()
@@ -32,7 +33,7 @@ - (void)sideSearchTableChangedSelection;
- (void)tableOfContentsChangedSelection;
- (void)registerDisplayTypeInTableView:(IGKHTMLDisplayType)type title:(NSString *)title;
-- (void)loadManagedObject:(IGKDocRecordManagedObject *)mo tableOfContentsMask:(IGKHTMLDisplayTypeMask)tm;
+- (void)loadManagedObject:(IGKDocRecordManagedObject *)mo tableOfContentsMask:(IGKHTMLDisplayTypeMask)tm URL:(NSURL *)url;
- (void)setMode:(int)modeIndex;
- (IGKArrayController *)currentArrayController;
@@ -620,6 +621,7 @@ - (void)loadURLRequest:(NSURLRequest *)urlRequest recordHistory:(BOOL)recordHist
NSURL *url = [urlRequest URL];
isNonFilterBarType = YES;
+ frecencyToken = 0;
// set default title
[[self window] setTitle:@"Documentation"];
@@ -643,22 +645,24 @@ - (void)loadURLRequest:(NSURLRequest *)urlRequest recordHistory:(BOOL)recordHist
[[browserWebView mainFrame] loadHTMLString:html
baseURL:[[NSBundle mainBundle] resourceURL]];
}
-
- NSLog(@"Load URL = %@, record history = %d", url, recordHistory);
- NSManagedObjectContext *ctx = [[[NSApp delegate] valueForKey:@"kitController"] managedObjectContext];
-
- tableOfContentsMask = IGKHTMLDisplayType_None;
- IGKDocRecordManagedObject *result = [IGKDocRecordManagedObject resolveURL:url inContext:ctx tableOfContentsMask:&tableOfContentsMask];
-
- if (result)
- {
- [self setBrowserActive:YES];
- [self loadManagedObject:result tableOfContentsMask:tableOfContentsMask];
- if (recordHistory)
- [self recordHistoryForURL:url title:[result valueForKey:@"name"]];
+ else
+ {
+ NSLog(@"Load URL = %@, record history = %d", url, recordHistory);
+ NSManagedObjectContext *ctx = [[[NSApp delegate] valueForKey:@"kitController"] managedObjectContext];
+
+ tableOfContentsMask = IGKHTMLDisplayType_None;
+ IGKDocRecordManagedObject *result = [IGKDocRecordManagedObject resolveURL:url inContext:ctx tableOfContentsMask:&tableOfContentsMask];
+
+ if (result)
+ {
+ [self setBrowserActive:YES];
+ [self loadManagedObject:result tableOfContentsMask:tableOfContentsMask URL:url];
+ if (recordHistory)
+ [self recordHistoryForURL:url title:[result valueForKey:@"name"]];
+ }
+
+ [self reloadTableOfContents];
}
-
- [self reloadTableOfContents];
}
else
{
@@ -668,8 +672,9 @@ - (void)loadURLRequest:(NSURLRequest *)urlRequest recordHistory:(BOOL)recordHist
[[browserWebView mainFrame] loadRequest:urlRequest];
}
}
-- (void)loadManagedObject:(IGKDocRecordManagedObject *)mo tableOfContentsMask:(IGKHTMLDisplayTypeMask)tm
+- (void)loadManagedObject:(IGKDocRecordManagedObject *)mo tableOfContentsMask:(IGKHTMLDisplayTypeMask)tm URL:(NSURL *)url
{
+ frecencyToken = 0;
currentObjectIDInBrowser = [mo objectID];
IGKHTMLGenerator *generator = [[IGKHTMLGenerator alloc] init];
@@ -705,7 +710,30 @@ - (void)loadManagedObject:(IGKDocRecordManagedObject *)mo tableOfContentsMask:(I
[self reloadRightFilterBarTable:mo transient:[generator transientObject]];
[generator finish];
+
+
+ //Find out if we're still here in 5 seconds
+
+ if (url)
+ {
+ frecencyToken = random();
+
+ NSArray *frecencyData = [NSArray arrayWithObjects:[NSNumber numberWithLong:frecencyToken], url, nil];
+ [self performSelector:@selector(checkIfStillAlive:) withObject:frecencyData afterDelay:5.0];
+ }
}
+- (void)checkIfStillAlive:(NSArray *)frecencyData
+{
+ if ([[frecencyData objectAtIndex:0] longValue] == frecencyToken)
+ {
+ //This was a triumph
+ IGKFrecencyStore *frecencyStore = [IGKFrecencyStore storeWithIdentifier:@"net.fileability.ingredients.DocumentationArticleURLFrecency"];
+
+ //I'm making a note here
+ [frecencyStore recordItem:[[frecencyData objectAtIndex:1] absoluteString]];
+ }
+}
+
- (void)recordHistoryForURL:(NSURL *)url title:(NSString *)title
{
WebHistoryItem *item = [[WebHistoryItem alloc] initWithURLString:[url absoluteString] title:title lastVisitedTimeInterval:[NSDate timeIntervalSinceReferenceDate]];
@@ -835,6 +863,7 @@ - (void)startIndexing
[twoPaneSplitView setColorIsEnabled:YES];
[twoPaneSplitView setColor:[NSColor colorWithCalibratedRed:0.166 green:0.166 blue:0.166 alpha:1.000]];
+ frecencyToken = 0;
[[browserWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:
[NSURL fileURLWithPath:
[[NSBundle mainBundle] pathForResource:@"tictactoe" ofType:@"html"]
@@ -1736,7 +1765,7 @@ - (void)sideSearchTableChangedSelection
[self restoreAdvancedSearchStateIntoTwoUp:YES];
//Open in two up
- //TODO: Make which view this switched to a preference. It could switch to either Two Up or Browser Only
+ //TODO: Record a preference for whichever view this switched to. It could switch to either Two Up or Browser Only
[self setMode:CHDocumentationBrowserUIMode_TwoUp];
}
@@ -1816,6 +1845,8 @@ - (IGKArrayController *)currentArrayController
}
- (void)loadDocIntoBrowser
{
+ frecencyToken = 0;
+
//Generate the HTML
if (![[self currentArrayController] selection])
return;
@@ -1834,9 +1865,10 @@ - (void)loadDocIntoBrowser
tableOfContentsMask = dtmask;
- [self loadManagedObject:(IGKDocRecordManagedObject *)currentSelectionObject tableOfContentsMask:[self tableOfContentsSelectedDisplayTypeMask]];
+ NSURL *url = [(IGKDocRecordManagedObject *)currentSelectionObject docURL:[self tableOfContentsSelectedDisplayTypeMask]];
+ [self loadManagedObject:(IGKDocRecordManagedObject *)currentSelectionObject tableOfContentsMask:[self tableOfContentsSelectedDisplayTypeMask] URL:url];
- [self recordHistoryForURL:[(IGKDocRecordManagedObject *)currentSelectionObject docURL:[self tableOfContentsSelectedDisplayTypeMask]] title:[currentSelectionObject pageTitle:[self tableOfContentsSelectedDisplayTypeMask]]];
+ [self recordHistoryForURL:url title:[currentSelectionObject pageTitle:[self tableOfContentsSelectedDisplayTypeMask]]];
}
- (IBAction)openInSafari:(id)sender
@@ -1914,7 +1946,6 @@ - (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequ
if ([[[[request URL] host] lowercaseString] isEqual:@"ingr-doc"])
{
- NSLog(@"ingr-doc: %@", url);
if ([[url path] containsString:@"headerfile"])
{
NSLog(@"FOUND HEADER");
@@ -1925,9 +1956,7 @@ - (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequ
{
NSArray *newcomps = [[NSArray arrayWithObject:@"/"] arrayByAddingObjectsFromArray:[comps subarrayWithRange:NSMakeRange(2, [comps count] - 2)]];
NSURL *newURL = [[NSURL alloc] initWithScheme:@"ingr-doc" host:[comps objectAtIndex:1] path:[NSString pathWithComponents:newcomps]];
-
- NSLog(@"\t Now loading: %@", newURL);
-
+
[self performSelector:@selector(loadURLRecordHistory:) withObject:newURL afterDelay:0.0];
return nil;
}
View
2 IGKWordMembership.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 02/05/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
View
2 IGKWordMembership.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 02/05/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "IGKWordMembership.h"
View
4 Ingredients-Info.plist
@@ -19,9 +19,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.6</string>
+ <string>0.7</string>
<key>CFBundleShortVersionString</key>
- <string>0.6</string>
+ <string>0.7</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSMainNibFile</key>
View
8 Ingredients.xcodeproj/project.pbxproj
@@ -35,6 +35,8 @@
751E45D61125E6CE00CD544A /* tictactoe_style.css in Resources */ = {isa = PBXBuildFile; fileRef = 751E45D51125E6CE00CD544A /* tictactoe_style.css */; };
752321CA1179DE5400BAEA90 /* IGKBackgroundProgressBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 752321C81179DE5400BAEA90 /* IGKBackgroundProgressBar.h */; };
752321CB1179DE5400BAEA90 /* IGKBackgroundProgressBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 752321C91179DE5400BAEA90 /* IGKBackgroundProgressBar.m */; };
+ 7529260511DDA65C0003CE54 /* IGKFrecencyStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7529260311DDA65C0003CE54 /* IGKFrecencyStore.h */; };
+ 7529260611DDA65C0003CE54 /* IGKFrecencyStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 7529260411DDA65C0003CE54 /* IGKFrecencyStore.m */; };
75301F6D11B2F04A006DA0E3 /* annotations.js in Sources */ = {isa = PBXBuildFile; fileRef = 75301F6C11B2F04A006DA0E3 /* annotations.js */; };
75301FA911B2F55D006DA0E3 /* annotations.js in Resources */ = {isa = PBXBuildFile; fileRef = 75301F6C11B2F04A006DA0E3 /* annotations.js */; };
754AA3FA1140267300321EAF /* AnthillBugReporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 754AA3F91140267300321EAF /* AnthillBugReporter.m */; };
@@ -247,6 +249,8 @@
751E45D51125E6CE00CD544A /* tictactoe_style.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = tictactoe_style.css; sourceTree = "<group>"; };
752321C81179DE5400BAEA90 /* IGKBackgroundProgressBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IGKBackgroundProgressBar.h; sourceTree = "<group>"; };
752321C91179DE5400BAEA90 /* IGKBackgroundProgressBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IGKBackgroundProgressBar.m; sourceTree = "<group>"; };
+ 7529260311DDA65C0003CE54 /* IGKFrecencyStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IGKFrecencyStore.h; sourceTree = "<group>"; };
+ 7529260411DDA65C0003CE54 /* IGKFrecencyStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IGKFrecencyStore.m; sourceTree = "<group>"; };
75301F6C11B2F04A006DA0E3 /* annotations.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = annotations.js; path = HTML_Example/annotations.js; sourceTree = "<group>"; };
754AA3F81140267300321EAF /* AnthillBugReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnthillBugReporter.h; path = "Anthill Cocoa/AnthillBugReporter.h"; sourceTree = "<group>"; };
754AA3F91140267300321EAF /* AnthillBugReporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AnthillBugReporter.m; path = "Anthill Cocoa/AnthillBugReporter.m"; sourceTree = "<group>"; };
@@ -445,6 +449,8 @@
0C35D86D118B65920013DDFD /* IGKAnnotation.m */,
75ADECE8118E0B9500C57C77 /* IGKWordMembership.h */,
75ADECE9118E0B9500C57C77 /* IGKWordMembership.m */,
+ 7529260311DDA65C0003CE54 /* IGKFrecencyStore.h */,
+ 7529260411DDA65C0003CE54 /* IGKFrecencyStore.m */,
75BD17791143E92700E67594 /* Preferences */,
756F9FF6110C803D00E6F291 /* Scraping */,
0C7C02E3110DFFF300412666 /* Views & Cells */,
@@ -815,6 +821,7 @@
75BC565611CDD5900012800F /* IGKMatteButton.h in Headers */,
756EFCFE11DA5CB800BC978A /* IGKCircularBuffer.h in Headers */,
75E747D211DC2CF3009B89CB /* smartcmp.h in Headers */,
+ 7529260511DDA65C0003CE54 /* IGKFrecencyStore.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1006,6 +1013,7 @@
75BC565711CDD5900012800F /* IGKMatteButton.m in Sources */,
756EFCFF11DA5CB800BC978A /* IGKCircularBuffer.m in Sources */,
75E747D511DC2DEB009B89CB /* smartcmp.m in Sources */,
+ 7529260611DDA65C0003CE54 /* IGKFrecencyStore.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
2 IngredientsKit.h
@@ -3,7 +3,7 @@
* Ingredients
*
* Created by Alex Gordon on 23/01/2010.
- * Copyright 2010 Fileability. All rights reserved.
+ * Written in 2010 by Fileability.
*
*/
View
2 Ingredients_AppDelegate.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 23/01/2010.
-// Copyright Fileability 2010 . All rights reserved.
+// Copyright Fileability 2010 . Written in 2010 by Fileability..
//
#import <Cocoa/Cocoa.h>
View
3 Ingredients_AppDelegate.m
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 23/01/2010.
-// Copyright Fileability 2010 . All rights reserved.
+// Copyright Fileability 2010 . Written in 2010 by Fileability..
//
#import "Ingredients_AppDelegate.h"
@@ -13,6 +13,7 @@ @implementation Ingredients_AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
+ srandom((unsigned long)[NSDate timeIntervalSinceReferenceDate]);
PFMoveToApplicationsFolderIfNecessary();
[kitController showWindow:nil];
View
BIN Ingredients_DataModel.xcdatamodel/elements
Binary file not shown.
View
BIN Ingredients_DataModel.xcdatamodel/layout
Binary file not shown.
View
2 NSArray+IGKAdditions.h
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 18/06/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//