-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNotationController.h
executable file
·194 lines (157 loc) · 6.59 KB
/
NotationController.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
//
// NotationController.h
// Notation
//
// Created by Zachary Schneirov on 12/19/05.
// Copyright 2005 Zachary Schneirov. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "FastListDataSource.h"
#import "LabelsListController.h"
#import "WALController.h"
#define kMaxFileIteratorCount 100
//enum { kUISearch, kUINewNote, kUIDeleteNote, kUIRenameNote, kUILabelOperation };
typedef struct _NoteCatalogEntry {
UTCDateTime lastModified;
UInt32 logicalSize;
OSType fileType;
UInt32 nodeID;
CFMutableStringRef filename;
UniChar *filenameChars;
UniCharCount filenameCharCount;
} NoteCatalogEntry;
@class NoteObject;
@class DeletedNoteObject;
@class SyncSessionController;
@class NotationPrefs;
@class NoteAttributeColumn;
@class NoteBookmark;
@class GlobalPrefs;
@interface NotationController : NSObject {
NSMutableArray *allNotes;
FastListDataSource *notesListDataSource;
LabelsListController *labelsListController;
GlobalPrefs *prefsController;
SyncSessionController *syncSessionController;
id delegate;
float titleColumnWidth;
NoteAttributeColumn* sortColumn;
NoteObject **allNotesBuffer;
unsigned int allNotesBufferSize;
NSUInteger selectedNoteIndex;
char *currentFilterStr, *manglingString;
int lastWordInFilterStr;
BOOL directoryChangesFound;
NotationPrefs *notationPrefs;
NSMutableSet *deletedNotes;
int volumeSupportsExchangeObjects;
FNSubscriptionUPP subscriptionCallback;
FNSubscriptionRef noteDirSubscription;
FSCatalogInfo *fsCatInfoArray;
HFSUniStr255 *HFSUniNameArray;
size_t catEntriesCount, totalCatEntriesCount;
NoteCatalogEntry *catalogEntries, **sortedCatalogEntries;
unsigned int lastCheckedDateInHours;
long blockSize;
FSRef noteDirectoryRef, noteDatabaseRef;
AliasHandle aliasHandle;
BOOL aliasNeedsUpdating;
OSStatus lastWriteError;
WALStorageController *walWriter;
NSMutableSet *unwrittenNotes;
BOOL notesChanged;
NSTimer *changeWritingTimer;
NSUndoManager *undoManager;
}
NSInteger compareCatalogEntryName(const void *one, const void *two);
NSInteger compareCatalogValueNodeID(id *a, id *b);
NSInteger compareCatalogValueFileSize(id *a, id *b);
void NotesDirFNSubscriptionProc(FNMessage message, OptionBits flags, void * refcon, FNSubscriptionRef subscription);
- (id)init;
- (id)initWithAliasData:(NSData*)data error:(OSStatus*)err;
- (id)initWithDefaultDirectoryReturningError:(OSStatus*)err;
- (id)initWithDirectoryRef:(FSRef*)directoryRef error:(OSStatus*)err;
- (void)setAliasNeedsUpdating:(BOOL)needsUpdate;
- (BOOL)aliasNeedsUpdating;
- (NSData*)aliasDataForNoteDirectory;
- (OSStatus)_readAndInitializeSerializedNotes;
- (void)processRecoveredNotes:(NSDictionary*)dict;
- (BOOL)initializeJournaling;
- (void)handleJournalError;
- (void)checkJournalExistence;
- (void)closeJournal;
- (void)stopFileNotifications;
- (BOOL)flushAllNoteChanges;
- (void)flushEverything;
- (void)upgradeDatabaseIfNecessary;
- (id)delegate;
- (void)setDelegate:(id)theDelegate;
- (void)databaseEncryptionSettingsChanged;
- (void)databaseSettingsChangedFromOldFormat:(int)oldFormat;
- (int)currentNoteStorageFormat;
- (BOOL)synchronizeNotesFromDirectory;
- (void)synchronizeNoteChanges:(NSTimer*)timer;
- (BOOL)_readFilesInDirectory;
- (BOOL)modifyNoteIfNecessary:(NoteObject*)aNoteObject usingCatalogEntry:(NoteCatalogEntry*)catEntry;
- (void)makeNotesMatchCatalogEntries:(NoteCatalogEntry**)catEntriesPtrs ofSize:(size_t)catCount;
- (void)processNotesAdded:(NSMutableArray*)addedEntries removed:(NSMutableArray*)removedEntries;
- (void)updateDateStringsIfNecessary;
- (void)restyleAllNotes;
- (void)setUndoManager:(NSUndoManager*)anUndoManager;
- (NSUndoManager*)undoManager;
- (void)noteDidNotWrite:(NoteObject*)note errorCode:(OSStatus)error;
- (void)scheduleWriteForNote:(NoteObject*)note;
- (void)trashRemainingNoteFilesInDirectory;
- (void)checkIfNotationIsTrashed;
- (void)updateLinksToNote:(NoteObject*)aNoteObject fromOldName:(NSString*)oldname;
- (void)addNotes:(NSArray*)noteArray;
- (void)addNotesFromSync:(NSArray*)noteArray;
- (void)addNewNote:(NoteObject*)aNoteObject;
- (void)_addNote:(NoteObject*)aNoteObject;
- (void)removeNote:(NoteObject*)aNoteObject;
- (void)removeNotes:(NSArray*)noteArray;
- (void)_purgeAlreadyDistributedDeletedNotes;
- (void)removeSyncMDFromDeletedNotesInSet:(NSSet*)notesToOrphan forService:(NSString*)serviceName;
- (DeletedNoteObject*)_addDeletedNote:(id<SynchronizedNote>)aNote;
- (void)_registerDeletionUndoForNote:(NoteObject*)aNote;
- (NoteObject*)addNote:(NSAttributedString*)attributedContents withTitle:(NSString*)title;
- (NoteObject*)addNoteFromCatalogEntry:(NoteCatalogEntry*)catEntry;
- (void)note:(NoteObject*)note didAddLabelSet:(NSSet*)labelSet;
- (void)note:(NoteObject*)note didRemoveLabelSet:(NSSet*)labelSet;
- (void)filterNotesFromLabelAtIndex:(int)labelIndex;
- (void)filterNotesFromLabelIndexSet:(NSIndexSet*)indexSet;
- (void)refilterNotes;
- (BOOL)filterNotesFromString:(NSString*)string;
- (BOOL)filterNotesFromUTF8String:(const char*)searchString forceUncached:(BOOL)forceUncached;
- (NSUInteger)preferredSelectedNoteIndex;
- (BOOL)preferredSelectedNoteMatchesSearchString;
- (NoteObject*)noteObjectAtFilteredIndex:(int)noteIndex;
- (NSArray*)notesAtIndexes:(NSIndexSet*)indexSet;
- (NSIndexSet*)indexesOfNotes:(NSArray*)noteSet;
- (NSUInteger)indexInFilteredListForNoteIdenticalTo:(NoteObject*)note;
- (NSUInteger)totalNoteCount;
- (void)scheduleUpdateListForAttribute:(NSString*)attribute;
- (NoteAttributeColumn*)sortColumn;
- (void)setSortColumn:(NoteAttributeColumn*)col;
- (void)resortAllNotes;
- (void)sortAndRedisplayNotes;
- (float)titleColumnWidth;
- (void)regeneratePreviewsForColumn:(NSTableColumn*)col visibleFilteredRows:(NSRange)rows forceUpdate:(BOOL)force;
- (void)regenerateAllPreviews;
//for setting up the nstableviews
- (id)labelsListDataSource;
- (id)notesListDataSource;
- (SyncSessionController*)syncSessionController;
- (void)dealloc;
@end
enum { NVDefaultReveal = 0, NVDoNotChangeScrollPosition = 1, NVOrderFrontWindow = 2, NVEditNoteToReveal = 4 };
@interface NSObject (NotationControllerDelegate)
- (BOOL)notationListShouldChange:(NotationController*)someNotation;
- (void)notationListMightChange:(NotationController*)someNotation;
- (void)notationListDidChange:(NotationController*)someNotation;
- (void)notation:(NotationController*)notation revealNote:(NoteObject*)note options:(NSUInteger)opts;
- (void)notation:(NotationController*)notation revealNotes:(NSArray*)notes;
- (void)contentsUpdatedForNote:(NoteObject*)aNoteObject;
- (void)titleUpdatedForNote:(NoteObject*)aNoteObject;
- (void)rowShouldUpdate:(NSInteger)affectedRow;
@end