Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adjusted things

  • Loading branch information...
commit f1097128ad815c1f2d3d98fc67af008a36cea4bd 1 parent 8457248
Alex Gordon authored
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
2  Anthill Cocoa/AnthillBugReporter.h
View
@@ -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>
2  Anthill Cocoa/AnthillBugReporter.m
View
@@ -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"
2  CHLeftSplitVIew.h
View
@@ -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>
2  CHLeftSplitView.m
View
@@ -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"
2  CHSymbolButtonImage.h
View
@@ -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>
2  CHSymbolButtonImage.m
View
@@ -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"
3  English.lproj/MainMenu.xib
View
@@ -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>
6 HTML_Example/main.css
View
@@ -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
{
2  IGKAnnotation.h
View
@@ -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>
2  IGKAnnotation.m
View
@@ -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"
2  IGKAnnotationManager.h
View
@@ -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>
2  IGKAnnotationManager.m
View
@@ -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"
2  IGKApplicationDelegate.h
View
@@ -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>
2  IGKApplicationDelegate.m
View
@@ -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"
2  IGKArrayController.h
View
@@ -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>
2  IGKArrayController.m
View
@@ -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"
2  IGKBackForwardManager.h
View
@@ -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>
2  IGKBackForwardManager.m
View
@@ -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"
2  IGKBackgroundProgressBar.h
View
@@ -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>
2  IGKBackgroundProgressBar.m
View
@@ -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"
25 IGKCircularBuffer.h
View
@@ -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);
70 IGKCircularBuffer.m
View
@@ -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)
{
2  IGKDocRecordManagedObject.h
View
@@ -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>
6 IGKDocRecordManagedObject.m
View
@@ -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
2  IGKDocSetManagedObject.h
View
@@ -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>
2  IGKDocSetManagedObject.m
View
@@ -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"
2  IGKEaseInOutAnimatedView.h
View
@@ -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>
2  IGKEaseInOutAnimatedView.m
View
@@ -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"
2  IGKFilterBarTableView.h
View
@@ -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>
2  IGKFilterBarTableView.m
View
@@ -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"
2  IGKFindBackgroundView.h
View
@@ -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>
2  IGKFindBackgroundView.m
View
@@ -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"
2  IGKFindWindow.h
View
@@ -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>
2  IGKFindWindow.m
View
@@ -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"
2  IGKForwardView.h
View
@@ -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>
2  IGKForwardView.m
View
@@ -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"
24 IGKFrecencyStore.h
View
@@ -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
197 IGKFrecencyStore.m
View
@@ -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
2  IGKHTMLGenerator.h
View
@@ -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>
2  IGKHTMLGenerator.m
View
@@ -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"
2  IGKLaunchController.h
View
@@ -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>
2  IGKLaunchController.m
View
@@ -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"
2  IGKManagedObject.h
View
@@ -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>
2  IGKManagedObject.m
View
@@ -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"
2  IGKMatteButton.h
View
@@ -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>
2  IGKMatteButton.m
View
@@ -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"
2  IGKMatteFocusedGradientBox.h
View
@@ -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>
2  IGKMatteFocusedGradientBox.m
View
@@ -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"
2  IGKMattePopUpButton.h
View
@@ -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>
2  IGKMattePopUpButton.m
View
@@ -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"
2  IGKMattePopUpButtonView.h
View
@@ -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>
2  IGKMattePopUpButtonView.m
View
@@ -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"
2  IGKMatteSegmentedControl.h
View
@@ -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>
2  IGKMatteSegmentedControl.m
View
@@ -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"
2  IGKMultiSelector.h
View
@@ -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>
2  IGKMultiSelector.m
View
@@ -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"
2  IGKNoSelectionInnerView.h
View
@@ -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>
2  IGKNoSelectionInnerView.m
View
@@ -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"
2  IGKNoSelectionOuterView.h
View
@@ -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>
2  IGKNoSelectionOuterView.m
View
@@ -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"
2  IGKOutputStream.h
View
@@ -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>
2  IGKOutputStream.m
View
@@ -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"
2  IGKPredicateEditor.h
View
@@ -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>
2  IGKPredicateEditor.m
View
@@ -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"
2  IGKPreferencesController.h
View
@@ -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>
2  IGKPreferencesController.m
View
@@ -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"
2  IGKResizeDelegatedView.h
View
@@ -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>
2  IGKResizeDelegatedView.m
View
@@ -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"
2  IGKScraper.h
View
@@ -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>
4 IGKScraper.m
View
@@ -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"];
2  IGKShyTableView.h
View
@@ -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>
2  IGKShyTableView.m
View
@@ -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"
2  IGKSometimesCenteredTextCell.h
View
@@ -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>
2  IGKSometimesCenteredTextCell.m
View
@@ -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"
2  IGKSourceListWallpaperView.h
View
@@ -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>
2  IGKSourceListWallpaperView.m
View
@@ -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"
2  IGKTableOfContentsView.h
View
@@ -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>
2  IGKTableOfContentsView.m
View
@@ -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"
2  IGKWindow.h
View
@@ -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>
2  IGKWindow.m
View
@@ -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"
6 IGKWindowController.h
View
@@ -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;
79 IGKWindowController.m
View
@@ -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;
}
2  IGKWordMembership.h
View
@@ -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>
2  IGKWordMembership.m
View
@@ -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"
4 Ingredients-Info.plist
View
@@ -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>
8 Ingredients.xcodeproj/project.pbxproj
View
@@ -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;
};
2  IngredientsKit.h
View
@@ -3,7 +3,7 @@
* Ingredients
*
* Created by Alex Gordon on 23/01/2010.
- * Copyright 2010 Fileability. All rights reserved.
+ * Written in 2010 by Fileability.
*
*/
2  Ingredients_AppDelegate.h
View
@@ -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>
3  Ingredients_AppDelegate.m
View
@@ -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];
BIN  Ingredients_DataModel.xcdatamodel/elements
View
Binary file not shown
BIN  Ingredients_DataModel.xcdatamodel/layout
View
Binary file not shown
2  NSArray+IGKAdditions.h
View
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 18/06/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
30 NSArray+IGKAdditions.m
View
@@ -3,12 +3,21 @@
// Ingredients
//
// Created by Alex Gordon on 18/06/2010.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "NSArray+IGKAdditions.h"
#import "smartcmp.h"
+NSComparisonResult IGKInverseComparisonResult(NSComparisonResult result)
+{
+ if (result == NSOrderedAscending)
+ return NSOrderedDescending;
+ if (result == NSOrderedDescending)
+ return NSOrderedAscending;
+ return NSOrderedSame;
+}
+
@implementation NSArray (IGKAdditions)
- (NSArray *)igk_map:(id (^)(id obj))rule
@@ -96,12 +105,19 @@ - (NSArray *)smartSort:(NSString *)query
//Sort the scores
NSArray *sortedScores = [scores sortedArrayUsingComparator:^ NSComparisonResult (id a, id b) {
- NSComparisonResult comparisonResult = [[a objectAtIndex:0] compare:[b objectAtIndex:0]];
- if (comparisonResult == NSOrderedAscending)
- return NSOrderedDescending;
- else if (comparisonResult == NSOrderedDescending)
- return NSOrderedAscending;
- return NSOrderedSame;
+ NSComparisonResult comparisonResult = IGKInverseComparisonResult([[a objectAtIndex:0] compare:[b objectAtIndex:0]]);
+ if (comparisonResult == NSOrderedSame)
+ {
+ //If we're really desperate we can compare the lengths of the contents
+ if ([[a objectAtIndex:1] respondsToSelector:@selector(lengthOfContent)])
+ {
+ return IGKInverseComparisonResult([[[a objectAtIndex:1] lengthOfContent] compare:[[b objectAtIndex:1] lengthOfContent]]);
+ }
+
+ return [[[a objectAtIndex:1] valueForKey:@"name"] compare:[[b objectAtIndex:1] valueForKey:@"name"]];
+ }
+
+ return comparisonResult;
}];
2  NSBezierPath+MCAdditions.h
View
@@ -2,7 +2,7 @@
// NSBezierPath+MCAdditions.h
//
// Created by Sean Patrick O'Brien on 4/1/08.
-// Copyright 2008 MolokoCacao. All rights reserved.
+// Copyright 2008 MolokoCacao. Written in 2010 by Fileability..
//
#import <Cocoa/Cocoa.h>
4 NSBezierPath+MCAdditions.m
View
@@ -2,7 +2,7 @@
// NSBezierPath+MCAdditions.m
//
// Created by Sean Patrick O'Brien on 4/1/08.
-// Copyright 2008 MolokoCacao. All rights reserved.
+// Copyright 2008 MolokoCacao. Written in 2010 by Fileability..
//
#import "NSBezierPath+MCAdditions.h"
@@ -97,7 +97,7 @@ - (CGPathRef)cgPath
break;
};
}
- return thePath;
+ return NSMakeCollectable(thePath);
}
- (NSBezierPath *)pathWithStrokeWidth:(CGFloat)strokeWidth
2  NSShadow+MCAdditions.h
View
@@ -2,7 +2,7 @@
// NSShadow+MCAdditions.h
//
// Created by Sean Patrick O'Brien on 4/3/08.
-// Copyright 2008 MolokoCacao. All rights reserved.
+// Copyright 2008 MolokoCacao. Written in 2010 by Fileability..
//
#import <Cocoa/Cocoa.h>
2  NSShadow+MCAdditions.m
View
@@ -2,7 +2,7 @@
// NSShadow+MCAdditions.m
//
// Created by Sean Patrick O'Brien on 4/3/08.
-// Copyright 2008 MolokoCacao. All rights reserved.
+// Copyright 2008 MolokoCacao. Written in 2010 by Fileability..
//
#import "NSShadow+MCAdditions.h"
2  NSString+Utilities.h
View
@@ -3,7 +3,7 @@
// Chocolat
//
// Created by Alex Gordon on 13/07/2009.
-// Copyright 2009 Fileability. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import <Cocoa/Cocoa.h>
2  NSString+Utilities.m
View
@@ -3,7 +3,7 @@
// Chocolat
//
// Created by Alex Gordon on 13/07/2009.
-// Copyright 2009 Fileability. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import "NSString+Utilities.h"
2  NSXMLNode+IGKAdditions.h
View
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 05/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import <Cocoa/Cocoa.h>
2  NSXMLNode+IGKAdditions.m
View
@@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 05/03/2010.
-// Copyright 2010 Fileability. All rights reserved.
+// Written in 2010 by Fileability.
//
#import "NSXMLNode+IGKAdditions.h"
2  RegexKitLite.h
View
@@ -7,7 +7,7 @@
/*
Copyright (c) 2008-2009, John Engelhart
- All rights reserved.
+ Written in 2010 by Fileability..
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
2  RegexKitLite.m
View
@@ -7,7 +7,7 @@
/*
Copyright (c) 2008-2009, John Engelhart
- All rights reserved.
+ Written in 2010 by Fileability..
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
2  Remaining bugs.txt
View
@@ -1,5 +1,5 @@
-When typing in the right filter search field, the best match (selected by smartcmp) should be selected and the webview should scroll to its anchor
The webview shouldn't scroll when resizing: Let x be the number of pixels to the nearest anchor, then x should be invariant when resizing.
+Fullscreen then Find doesn't work
Needs key combos for selecting the next and previous method in the webview
Switch to smartcmp algorithm
Implement frecency
2  SQPreferencesBackgroundComponent.h
View
@@ -3,7 +3,7 @@
// Squish
//
// Created by Alex Gordon on 09/04/2009.
-// Copyright 2009 Fileability. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import <Cocoa/Cocoa.h>
2  SQPreferencesBackgroundComponent.m
View
@@ -3,7 +3,7 @@
// Squish
//
// Created by Alex Gordon on 09/04/2009.
-// Copyright 2009 Fileability. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import "SQPreferencesBackgroundComponent.h"
2  XBNewSourceListCell.h
View
@@ -3,7 +3,7 @@
// SourceList3
//
// Created by Alex Gordon on 16/01/2009.
-// Copyright 2009 Fileability. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import <Cocoa/Cocoa.h>
2  XBNewSourceListCell.m
View
@@ -3,7 +3,7 @@
// SourceList3
//
// Created by Alex Gordon on 16/01/2009.
-// Copyright 2009 Fileability. All rights reserved.
+// Copyright 2009 Fileability. Written in 2010 by Fileability..
//
#import "XBNewSourceListCell.h"
2  main.m
View
@@ -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>
2  smartcmp.h
View
@@ -3,7 +3,7 @@
* Ingredients
*
* Created by Alex Gordon on 30/06/2010.
- * Copyright 2010 __MyCompanyName__. All rights reserved.
+ * Written in 2010 by Fileability.
*
*/
20 smartcmp.m
View
@@ -147,8 +147,22 @@ SmartCmpScore categoryScore(id resultObject)
if ([resultObject respondsToSelector:@selector(priorityval)])
{