Skip to content
This repository
Browse code

Adjusted things

  • Loading branch information...
commit f1097128ad815c1f2d3d98fc67af008a36cea4bd 1 parent 8457248
Alex Gordon authored

Showing 111 changed files with 505 additions and 170 deletions. Show diff stats Hide diff stats

  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
@@ -3,7 +3,7 @@
3 3 // AnthillReporter
4 4 //
5 5 // Created by Alex Gordon on 14/02/2009.
6   -// Copyright 2009 Fileability. All rights reserved.
  6 +// Copyright 2009 Fileability. Written in 2010 by Fileability..
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  Anthill Cocoa/AnthillBugReporter.m
@@ -3,7 +3,7 @@
3 3 // AnthillReporter
4 4 //
5 5 // Created by Alex Gordon on 14/02/2009.
6   -// Copyright 2009 Fileability. All rights reserved.
  6 +// Copyright 2009 Fileability. Written in 2010 by Fileability..
7 7 //
8 8
9 9 #import "AnthillBugReporter.h"
2  CHLeftSplitVIew.h
@@ -3,7 +3,7 @@
3 3 // Chocolat
4 4 //
5 5 // Created by Alex Gordon on 29/10/2009.
6   -// Copyright 2009 __MyCompanyName__. All rights reserved.
  6 +// Copyright 2009 Fileability. Written in 2010 by Fileability..
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  CHLeftSplitView.m
@@ -3,7 +3,7 @@
3 3 // Chocolat
4 4 //
5 5 // Created by Alex Gordon on 29/10/2009.
6   -// Copyright 2009 __MyCompanyName__. All rights reserved.
  6 +// Copyright 2009 Fileability. Written in 2010 by Fileability..
7 7 //
8 8
9 9 #import "CHLeftSplitView.h"
2  CHSymbolButtonImage.h
@@ -3,7 +3,7 @@
3 3 // Chocolat
4 4 //
5 5 // Created by Alex Gordon on 11/09/2009.
6   -// Copyright 2009 Fileability. All rights reserved.
  6 +// Copyright 2009 Fileability. Written in 2010 by Fileability..
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  CHSymbolButtonImage.m
@@ -3,7 +3,7 @@
3 3 // Chocolat
4 4 //
5 5 // Created by Alex Gordon on 11/09/2009.
6   -// Copyright 2009 Fileability. All rights reserved.
  6 +// Copyright 2009 Fileability. Written in 2010 by Fileability..
7 7 //
8 8
9 9 #import "CHSymbolButtonImage.h"
3  English.lproj/MainMenu.xib
@@ -796,6 +796,7 @@
796 796 <reference key="NSMenu" ref="531461334"/>
797 797 <bool key="NSIsDisabled">YES</bool>
798 798 <bool key="NSIsSeparator">YES</bool>
  799 + <bool key="NSIsHidden">YES</bool>
799 800 <string key="NSTitle"/>
800 801 <string key="NSKeyEquiv"/>
801 802 <int key="NSMnemonicLoc">2147483647</int>
@@ -804,6 +805,7 @@
804 805 </object>
805 806 <object class="NSMenuItem" id="739539978">
806 807 <reference key="NSMenu" ref="531461334"/>
  808 + <bool key="NSIsHidden">YES</bool>
807 809 <string key="NSTitle">Previous Symbol</string>
808 810 <string key="NSKeyEquiv"></string>
809 811 <int key="NSKeyEquivModMask">1572864</int>
@@ -813,6 +815,7 @@
813 815 </object>
814 816 <object class="NSMenuItem" id="1070219007">
815 817 <reference key="NSMenu" ref="531461334"/>
  818 + <bool key="NSIsHidden">YES</bool>
816 819 <string key="NSTitle">Next Symbol</string>
817 820 <string key="NSKeyEquiv"></string>
818 821 <int key="NSKeyEquivModMask">1572864</int>
6 HTML_Example/main.css
@@ -17,6 +17,8 @@ code
17 17 .category
18 18 {
19 19 margin-top: -4px;
  20 + margin-bottom: 0;
  21 + padding-bottom: 8px;
20 22 text-indent: 20px;
21 23 font-style: italic;
22 24 font-size: 13px;
@@ -134,6 +136,10 @@ code
134 136
135 137 border-top-style: none;
136 138 }
  139 +.methods div.description
  140 +{
  141 + margin-top: -12px;
  142 +}
137 143
138 144 .methods .info h3
139 145 {
2  IGKAnnotation.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Jean-Nicolas Jolivet on 10-04-30.
6   -// Copyright 2010 SilverCocoa. All rights reserved.
  6 +// Written in 2010 by SilverCocoa.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKAnnotation.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Jean-Nicolas Jolivet on 10-04-30.
6   -// Copyright 2010 SilverCocoa. All rights reserved.
  6 +// Written in 2010 by SilverCocoa.
7 7 //
8 8
9 9 #import "IGKAnnotation.h"
2  IGKAnnotationManager.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Jean-Nicolas Jolivet on 10-04-30.
6   -// Copyright 2010 SilverCocoa. All rights reserved.
  6 +// Written in 2010 by SilverCocoa.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKAnnotationManager.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Jean-Nicolas Jolivet on 10-04-30.
6   -// Copyright 2010 SilverCocoa. All rights reserved.
  6 +// Written in 2010 by SilverCocoa.
7 7 //
8 8
9 9 #import "IGKAnnotationManager.h"
2  IGKApplicationDelegate.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 23/01/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKApplicationDelegate.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 23/01/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKApplicationDelegate.h"
2  IGKArrayController.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 13/02/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKArrayController.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 13/02/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKArrayController.h"
2  IGKBackForwardManager.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 07/03/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKBackForwardManager.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 07/03/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKBackForwardManager.h"
2  IGKBackgroundProgressBar.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 17/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKBackgroundProgressBar.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 17/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKBackgroundProgressBar.h"
25 IGKCircularBuffer.h
@@ -2,37 +2,44 @@ typedef struct {
2 2 // 0 <= elementCount <= actualSize <= targetSize
3 3
4 4 //The number of elements in the buffer
5   - size_t elementCount;
  5 + CFIndex elementCount;
6 6
7 7 //The amount of elements that we have allocated enough memory to hold. Must not be 0
8   - size_t allocatedCount;
  8 + CFIndex allocatedCount;
9 9
10 10 //The maximum number of elements that the buffer will grow to hold before it starts discarding things
11   - size_t maximumCount;
  11 + CFIndex maximumCount;
12 12
13 13 //The size in bytes of each element in the buffer
14   - size_t elementSize;
  14 + CFIndex elementSize;
15 15
16 16 //A pointer to all the elements
17 17 void* items;
18 18
19 19 //The offset of the element that was added the longest time ago
20   - size_t oldestElement;
  20 + CFIndex oldestElement;
21 21
22 22 //The offset of the element that was added most recently
23   - size_t youngestElement;
  23 + CFIndex youngestElement;
24 24
25 25 } IGKCircularBuffer;
26 26
  27 +//Create a buffer and fill it with data
  28 +IGKCircularBuffer IGKCircularBufferCreateFromData(const void *data, CFIndex dataLength, CFIndex maximumCount, CFIndex elementSize);
  29 +
27 30 //Create an empty buffer with a specified size
28   -IGKCircularBuffer IGKCircularBufferCreate(size_t maximumCount, size_t elementSize, size_t initialSize);
  31 +IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementSize, CFIndex initialSize);
29 32
30 33 //Add elementSize bytes of *pointerToData to the buffer.
31 34 void IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData);
32 35
33 36 //Get a pointer to the raw data and the length of the data, eg to pass to NSData
34   -IGKCircularBuffer IGKCircularBufferRawData(IGKCircularBuffer buffer);
35   -size_t IGKCircularBufferRawDataLength(IGKCircularBuffer buffer);
  37 +void* IGKCircularBufferRawData(IGKCircularBuffer buffer);
  38 +CFIndex IGKCircularBufferRawDataLength(IGKCircularBuffer buffer);
  39 +
  40 +//Get data in a format suitable for writing out to disk
  41 +NSData* IGKCircularBufferOrderedData(IGKCircularBuffer buffer);
  42 +CFIndex IGKCircularBufferOrderedDataLength(IGKCircularBuffer buffer);
36 43
37 44 //Delete the buffer
38 45 void IGKCircularBufferFree(IGKCircularBuffer buffer);
70 IGKCircularBuffer.m
... ... @@ -1,28 +1,22 @@
1   -typedef struct {
2   - // 0 <= elementCount <= actualSize <= targetSize
3   -
4   - //The number of elements in the buffer
5   - CFIndex elementCount;
6   -
7   - //The amount of elements that we have allocated enough memory to hold. Must not be 0
8   - CFIndex allocatedCount;
9   -
10   - //The maximum number of elements that the buffer will grow to hold before it starts discarding things
11   - CFIndex maximumCount;
12   -
13   - //The size in bytes of each element in the buffer
14   - CFIndex elementSize;
  1 +#import "IGKCircularBuffer.h"
  2 +
  3 +IGKCircularBuffer IGKCircularBufferCreateFromData(const void *data, CFIndex dataLength, CFIndex maximumCount, CFIndex elementSize)
  4 +{
  5 + IGKCircularBuffer buffer;
15 6
16   - //A pointer to all the elements
17   - void* items;
  7 + buffer.elementCount = 0;
  8 + buffer.allocatedCount = dataLength / elementSize;
  9 + buffer.maximumCount = maximumCount;
  10 + buffer.elementSize = elementSize;
18 11
19   - //The offset of the element that was added the longest time ago
20   - int64_t oldestElement;
  12 + buffer.items = malloc(dataLength * elementSize);
  13 + memcpy(buffer.items, data, dataLength);
21 14
22   - //The offset of the element that was added most recently
23   - CFIndex youngestElement;
  15 + buffer.oldestElement = -1;
  16 + buffer.youngestElement = -1;
24 17
25   -} IGKCircularBuffer;
  18 + return buffer;
  19 +}
26 20
27 21 //Create an empty buffer with a specified size
28 22 IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementSize, CFIndex initialSize)
@@ -47,7 +41,7 @@ IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementS
47 41 }
48 42
49 43 //Add elementSize bytes of *pointerToData to the buffer.
50   -void* IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData)
  44 +void IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData)
51 45 {
52 46 //If the buffer needs to grow
53 47 if (buffer.elementCount + 1 > buffer.allocatedCount && buffer.allocatedCount < buffer.maximumCount)
@@ -65,7 +59,7 @@ IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementS
65 59 if (!newItems)
66 60 {
67 61 //Do something if reallocf fails
68   - return NULL;
  62 + return;
69 63 }
70 64
71 65 //Set our variables
@@ -114,7 +108,7 @@ IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementS
114 108 }
115 109
116 110 //Get a pointer to the raw data and the length of the data, eg to pass to NSData
117   -IGKCircularBuffer* IGKCircularBufferRawData(IGKCircularBuffer buffer)
  111 +void* IGKCircularBufferRawData(IGKCircularBuffer buffer)
118 112 {
119 113 return buffer.items;
120 114 }
@@ -125,6 +119,34 @@ CFIndex IGKCircularBufferRawDataLength(IGKCircularBuffer buffer)
125 119 return 0;
126 120 }
127 121
  122 +//Get data in a format suitable for writing out to disk
  123 +NSData* IGKCircularBufferOrderedData(IGKCircularBuffer buffer)
  124 +{
  125 + NSMutableData *data = [[NSMutableData alloc] initWithCapacity:IGKCircularBufferOrderedDataLength(buffer)];
  126 +
  127 + if (buffer.elementCount == 0)
  128 + return data;
  129 +
  130 + for (CFIndex i = buffer.oldestElement; ; i = (i + 1) % buffer.elementCount)
  131 + {
  132 + if (buffer.items + i == NULL)
  133 + continue;
  134 +
  135 + [data appendBytes:buffer.items + i * buffer.elementSize length:buffer.elementSize];
  136 +
  137 + if (i == buffer.youngestElement)
  138 + break;
  139 + }
  140 +
  141 + return data;
  142 +}
  143 +CFIndex IGKCircularBufferOrderedDataLength(IGKCircularBuffer buffer)
  144 +{
  145 + if (buffer.items)
  146 + return buffer.elementCount * buffer.elementSize;
  147 + return 0;
  148 +}
  149 +
128 150 //Delete the buffer
129 151 void IGKCircularBufferFree(IGKCircularBuffer buffer)
130 152 {
2  IGKDocRecordManagedObject.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 25/01/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
6 IGKDocRecordManagedObject.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 25/01/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKDocRecordManagedObject.h"
@@ -552,5 +552,9 @@ - (NSImage *)iconForSelectedState:(BOOL)isSelected
552 552
553 553 return [[CHSymbolButtonImage symbolImageWithMask:mask] objectAtIndex:index];
554 554 }
  555 +- (NSNumber *)lengthOfContent
  556 +{
  557 + return [self valueForKey:@"contentsLength"];
  558 +}
555 559
556 560 @end
2  IGKDocSetManagedObject.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 04/03/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKDocSetManagedObject.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 04/03/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKDocSetManagedObject.h"
2  IGKEaseInOutAnimatedView.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 11/03/2010.
6   -// Copyright 2010 __MyCompanyName__. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKEaseInOutAnimatedView.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 11/03/2010.
6   -// Copyright 2010 __MyCompanyName__. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKEaseInOutAnimatedView.h"
2  IGKFilterBarTableView.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 17/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKFilterBarTableView.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 17/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKFilterBarTableView.h"
2  IGKFindBackgroundView.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 17/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKFindBackgroundView.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 17/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKFindBackgroundView.h"
2  IGKFindWindow.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 18/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKFindWindow.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 18/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKFindWindow.h"
2  IGKForwardView.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Jean-Nicolas Jolivet on 10-05-06.
6   -// Copyright 2010 SilverCocoa. All rights reserved.
  6 +// Written in 2010 by SilverCocoa.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKForwardView.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Jean-Nicolas Jolivet on 10-05-06.
6   -// Copyright 2010 SilverCocoa. All rights reserved.
  6 +// Written in 2010 by SilverCocoa.
7 7 //
8 8
9 9 #import "IGKForwardView.h"
24 IGKFrecencyStore.h
... ... @@ -0,0 +1,24 @@
  1 +//
  2 +// IGKFrecencyStore.h
  3 +// Ingredients
  4 +//
  5 +// Created by Alex Gordon on 01/07/2010.
  6 +// Written in 2010 by Fileability.
  7 +//
  8 +
  9 +#import <Cocoa/Cocoa.h>
  10 +#import "IGKCircularBuffer.h"
  11 +
  12 +@interface IGKFrecencyStore : NSObject {
  13 + NSString *identifier;
  14 + IGKCircularBuffer buffer;
  15 +
  16 + BOOL hasChanges;
  17 +}
  18 +
  19 ++ (id)storeWithIdentifier:(NSString *)identifier;
  20 +
  21 +- (void)recordItem:(NSString *)item;
  22 +- (NSArray *)timestampsForItem:(NSString *)item count:(uint64_t *)count;
  23 +
  24 +@end
197 IGKFrecencyStore.m
... ... @@ -0,0 +1,197 @@
  1 +//
  2 +// IGKFrecencyStore.m
  3 +// Ingredients
  4 +//
  5 +// Created by Alex Gordon on 01/07/2010.
  6 +// Written in 2010 by Fileability.
  7 +//
  8 +
  9 +#import "IGKFrecencyStore.h"
  10 +
  11 +
  12 +typedef struct {
  13 + int64_t timestamp;
  14 + NSString *item;
  15 +
  16 + // IF YOU MODIFY THIS STRUCT YOU ******MUST****** INCREMENT IGKFrecencyStoreBufferRecordVersion !!!!!!1!1!!!!1!ONE!1!!ELEVENTY1
  17 +
  18 +} IGKFrecencyStoreBufferRecord;
  19 +
  20 +// vvvvv THAT'S THIS THING vvvvv
  21 +const int IGKFrecencyStoreBufferRecordVersion = 1;
  22 +// ^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^
  23 +
  24 +
  25 +@interface IGKFrecencyStore ()
  26 +
  27 +- (NSString *)storeDirectory;
  28 +- (NSString *)storeExtension;
  29 +- (NSString *)path;
  30 +- (void)readFromDisk;
  31 +- (void)writeToDisk;
  32 +- (void)heartbeat;
  33 +
  34 +@end
  35 +
  36 +
  37 +@implementation IGKFrecencyStore
  38 +
  39 +#pragma mark Life Cycle
  40 +
  41 +static NSMutableDictionary *stores = nil;
  42 +
  43 ++ (id)storeWithIdentifier:(NSString *)ident
  44 +{
  45 + return nil;
  46 +
  47 + if ([stores objectForKey:ident])
  48 + return [stores objectForKey:ident];
  49 +
  50 + if (!stores)
  51 + stores = [[NSMutableDictionary alloc] initWithCapacity:5];
  52 +
  53 + IGKFrecencyStore *store = [[[self alloc] initWithIdentifier:ident] autorelease];
  54 + [stores setValue:store forKey:ident];
  55 +
  56 + return store;
  57 +}
  58 +- (id)initWithIdentifier:(NSString *)ident
  59 +{
  60 + if (self = [super init])
  61 + {
  62 + identifier = [ident copy];
  63 +
  64 + [self readFromDisk];
  65 +
  66 + [self heartbeat];
  67 + }
  68 +
  69 + return self;
  70 +}
  71 +- (void)finalize
  72 +{
  73 + IGKCircularBufferFree(buffer);
  74 +
  75 + [super finalize];
  76 +}
  77 +
  78 +
  79 +#pragma mark Recording and Reading
  80 +
  81 +- (void)recordItem:(NSString *)item
  82 +{
  83 + int64_t timestamp = (int64_t)[NSDate timeIntervalSinceReferenceDate];
  84 +
  85 + IGKFrecencyStoreBufferRecord record;
  86 + record.timestamp = timestamp;
  87 + record.item = item;
  88 +
  89 + IGKCircularBufferAdd(buffer, &record);
  90 +
  91 + hasChanges = YES;
  92 +}
  93 +- (NSArray *)timestampsForItem:(NSString *)item count:(uint64_t *)count
  94 +{
  95 + //If no variable to put count in is specified, they can't do anything but crash, so return NULL
  96 + if (!count)
  97 + return NULL;
  98 +
  99 + CFIndex length = IGKCircularBufferRawDataLength(buffer);
  100 + IGKFrecencyStoreBufferRecord* data = (IGKFrecencyStoreBufferRecord*)IGKCircularBufferRawData(buffer);
  101 +
  102 + NSMutableArray *timestamps = [[NSMutableArray alloc] initWithCapacity:100];
  103 +
  104 + if (buffer.elementCount > 0)
  105 + {
  106 + for (CFIndex i = buffer.oldestElement; ; i = (i + 1) % buffer.elementCount)
  107 + {
  108 + if (data + i == NULL)
  109 + continue;
  110 +
  111 + IGKFrecencyStoreBufferRecord record = data[i];
  112 + if ([record.item isEqual:item])
  113 + {
  114 + [timestamps addObject:[NSNumber numberWithLongLong:record.timestamp]];
  115 + }
  116 +
  117 + if (i == buffer.youngestElement)
  118 + break;
  119 + }
  120 + }
  121 +
  122 + return timestamps;
  123 +}
  124 +
  125 +#pragma mark File IO
  126 +
  127 +const CFIndex IGKFrecencyStoreMaximumCount = 1000;
  128 +const CFIndex IGKFrecencyStoreInitialCount = 100;
  129 +
  130 +- (NSString *)storeDirectory
  131 +{
  132 + // <appsupport>/Frecency/<identifier>
  133 +
  134 + NSString *appSupport = [[[NSApp delegate] kitController] applicationSupportDirectory];
  135 +
  136 + return [appSupport stringByAppendingPathComponent:@"Frecency"];
  137 +}
  138 +- (NSString *)storeExtension
  139 +{
  140 + return [NSString stringWithFormat:@"igkfrecencystore%d", IGKFrecencyStoreBufferRecordVersion];
  141 +}
  142 +- (NSString *)path
  143 +{
  144 + return [[[self storeDirectory] stringByAppendingPathComponent:identifier] stringByAppendingPathExtension:[self storeExtension]];
  145 +}
  146 +- (void)readFromDisk
  147 +{
  148 + NSString *path = [self path];
  149 +
  150 + NSError *err = nil;
  151 + NSData *data = [[NSData alloc] initWithContentsOfFile:path options:NSDataReadingUncached error:&err];
  152 +
  153 + if (!data || err)
  154 + {
  155 + buffer = IGKCircularBufferCreate(IGKFrecencyStoreMaximumCount, sizeof(IGKFrecencyStoreBufferRecord), IGKFrecencyStoreInitialCount);
  156 + return;
  157 + }
  158 +
  159 + //Read from data
  160 + buffer = IGKCircularBufferCreateFromData([data bytes], [data length], IGKFrecencyStoreMaximumCount, sizeof(IGKFrecencyStoreBufferRecord));
  161 +}
  162 +- (void)writeToDisk
  163 +{
  164 + NSLog(@"Writing IGKFrecencyStore %@ to disk. It has%@ changes", identifier, hasChanges ? @"" : @" no");
  165 +
  166 + if (!hasChanges)
  167 + return;
  168 + hasChanges = NO;
  169 +
  170 + NSString *path = [self path];
  171 + NSLog(@"\t path = '%@'", path);
  172 +
  173 + //Create the directory
  174 + [[NSFileManager defaultManager] createDirectoryAtPath:[self storeDirectory] withIntermediateDirectories:YES attributes:nil error:nil];
  175 +
  176 + //Get data from buffer
  177 + if (buffer.elementCount == 0)
  178 + return;
  179 + NSData *data = IGKCircularBufferOrderedData(buffer);
  180 + NSLog(@"\t data [%ud] %@", [data length], data);
  181 +
  182 + //Write to disk
  183 + NSError *err = nil;
  184 + [data writeToFile:path options:NSDataWritingAtomic error:&err];
  185 + NSLog(@"\t err = %@", err);
  186 +}
  187 +- (void)heartbeat
  188 +{
  189 + NSLog(@"Heartbeat on IGKFrecencyStore %@", identifier);
  190 +
  191 + [self writeToDisk];
  192 +
  193 + //We want to do a write every 20 seconds
  194 + [self performSelector:@selector(heartbeat) withObject:nil afterDelay:5.0];
  195 +}
  196 +
  197 +@end
2  IGKHTMLGenerator.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 26/01/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKHTMLGenerator.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 26/01/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKHTMLGenerator.h"
2  IGKLaunchController.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 10/02/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKLaunchController.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 10/02/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKLaunchController.h"
2  IGKManagedObject.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 08/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKManagedObject.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 08/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKManagedObject.h"
2  IGKMatteButton.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 19/06/2010.
6   -// Copyright 2010 __MyCompanyName__. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKMatteButton.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 19/06/2010.
6   -// Copyright 2010 __MyCompanyName__. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKMatteButton.h"
2  IGKMatteFocusedGradientBox.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 20/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKMatteFocusedGradientBox.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 20/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKMatteFocusedGradientBox.h"
2  IGKMattePopUpButton.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 09/03/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKMattePopUpButton.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 09/03/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKMattePopUpButton.h"
2  IGKMattePopUpButtonView.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 20/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKMattePopUpButtonView.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 20/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKMattePopUpButtonView.h"
2  IGKMatteSegmentedControl.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 27/02/2010.
6   -// Copyright 2010 __MyCompanyName__. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKMatteSegmentedControl.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 27/02/2010.
6   -// Copyright 2010 __MyCompanyName__. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKMatteSegmentedControl.h"
2  IGKMultiSelector.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 22/02/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKMultiSelector.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 22/02/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKMultiSelector.h"
2  IGKNoSelectionInnerView.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 13/02/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKNoSelectionInnerView.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 13/02/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKNoSelectionInnerView.h"
2  IGKNoSelectionOuterView.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 13/02/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKNoSelectionOuterView.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 13/02/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKNoSelectionOuterView.h"
2  IGKOutputStream.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 09/06/2010.
6   -// Copyright 2010 __MyCompanyName__. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKOutputStream.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 09/06/2010.
6   -// Copyright 2010 __MyCompanyName__. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKOutputStream.h"
2  IGKPredicateEditor.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 23/03/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKPredicateEditor.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 23/03/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKPredicateEditor.h"
2  IGKPreferencesController.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 07/03/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKPreferencesController.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 07/03/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import "IGKPreferencesController.h"
2  IGKResizeDelegatedView.h
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 18/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //
8 8
9 9 #import <Cocoa/Cocoa.h>
2  IGKResizeDelegatedView.m
@@ -3,7 +3,7 @@
3 3 // Ingredients
4 4 //
5 5 // Created by Alex Gordon on 18/04/2010.
6   -// Copyright 2010 Fileability. All rights reserved.
  6 +// Written in 2010 by Fileability.
7 7 //