Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

improvements to the multiple note tagging

  • Loading branch information...
commit a92dbf4e7b47cd78faadd3f53a26907bcae874cc 1 parent 1c2d6dc
@elasticthreads elasticthreads authored
View
6 AppController.h
@@ -65,7 +65,7 @@
StatusItemView *cView;
NSStatusItem *statusItem;
IBOutlet NSMenu *statBarMenu;
- TagEditingManager *TagEditer;
+ TagEditingManager *tagEditor;
NSColor *backgrndColor;
NSColor *foregrndColor;
NSInteger userScheme;
@@ -109,7 +109,6 @@
BOOL isFilteringFromTyping, typedStringIsCached;
BOOL isCreatingANote;
NSString *typedString;
- NSArray *cTags;
BOOL isEditing;
NoteObject *currentNote;
@@ -186,8 +185,9 @@ void outletObjectAwoke(id sender);
- (NSMenu *)statBarMenu;
- (void)toggleAttachedWindow:(NSNotification *)aNotification;
- (void)toggleAttachedMenu:(NSNotification *)aNotification;
-- (NSArray *)commonLabels;
+- (NSArray *)commonLabelsForNotesAtIndexes:(NSIndexSet *)selDexes;
- (IBAction)multiTag:(id)sender;
+- (void)releaseTagEditor:(NSNotification *)note;
- (void)setDualFieldInToolbar;
- (void)setDualFieldInView;
- (void)setDualFieldIsVisible:(BOOL)isVis;
View
273 AppController.m
@@ -58,7 +58,7 @@
#define NSApplicationPresentationHideDock (1 << 1)
//#define NSApplicationActivationPolicyAccessory
-//#define NSTextViewChangedNotification @"TextView has changed contents"
+//#define NSTextViewChangedNotification @"TextViewHasChangedContents"
//#define kDefaultMarkupPreviewMode @"markupPreviewMode"
#define kDualFieldHeight 35.0
@@ -124,14 +124,14 @@ - (id)init {
}
NSNotificationCenter *nc=[NSNotificationCenter defaultCenter];
- [nc addObserver:previewController selector:@selector(requestPreviewUpdate:) name:@"TextView has changed contents" object:self];
+ [nc addObserver:previewController selector:@selector(requestPreviewUpdate:) name:@"TextViewHasChangedContents" object:self];
[nc addObserver:self selector:@selector(toggleAttachedWindow:) name:@"NVShouldActivate" object:nil];
[nc addObserver:self selector:@selector(toggleAttachedMenu:) name:@"StatusItemMenuShouldDrop" object:nil];
[nc addObserver:self selector:@selector(togDockIcon:) name:@"AppShouldToggleDockIcon" object:nil];
[nc addObserver:self selector:@selector(toggleStatusItem:) name:@"AppShouldToggleStatusItem" object:nil];
[nc addObserver:self selector:@selector(resetModTimers:) name:@"ModTimersShouldReset" object:nil];
-
+ [nc addObserver:self selector:@selector(releaseTagEditor:) name:@"TagEditorShouldRelease" object:nil];
// Setup URL Handling
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
[appleEventManager setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
@@ -940,25 +940,19 @@ - (IBAction)tagNote:(id)sender {
}
//if single note, add the tag column if necessary and then begin editing
- NSIndexSet *indexes = [notesTableView selectedRowIndexes];
+ NSIndexSet *selIndexes = [notesTableView selectedRowIndexes];
- if ([indexes count] > 1) {
+ if ([selIndexes count] > 1) {
+
+ NSRect linkingFrame=[textScrollView convertRect:[textScrollView frame] toView:nil];
+ linkingFrame=[window convertRectToScreen:linkingFrame];
+ NSPoint cPoint=NSMakePoint(NSMidX(linkingFrame), NSMaxY(linkingFrame));
+
+ //Multiple Notes selected, use ElasticThreads' multitagging implementation
+ tagEditor = [[[TagEditingManager alloc] initWithDelegate:self commonTags:[self commonLabelsForNotesAtIndexes:selIndexes] atPoint:cPoint] retain];
+
//Multiple Notes selected, use ElasticThreads' multitagging implementation
- TagEditer = [[[TagEditingManager alloc] init] retain];
- [TagEditer setDel:self];
- @try {
- cTags = [[[NSArray alloc] initWithArray:[self commonLabels]] retain];
- if ([cTags count]>0) {
- [TagEditer setTF:[cTags componentsJoinedByString:@","]];
- }else {
- [TagEditer setTF:@""];
- }
- [TagEditer popTP:self];
- }
- @catch (NSException * e) {
- NSLog(@"multitag excep this: %@",[e name]);
- }
- } else if ([indexes count] == 1) {
+ } else if ([selIndexes count] == 1) {
self.isEditing = YES;
[notesTableView editRowAtColumnWithIdentifier:NoteLabelsColumnString];
}
@@ -1187,9 +1181,6 @@ - (void)cancelOperation:(id)sender {
[field selectText:sender];
[[field cell] setShowsClearButton:NO];
- } else if ([[TagEditer tagPanel] isKeyWindow]) { //<--this is for ElasticThreads' multitagging window
- [TagEditer closeTP:self];
- [TagEditer release];
}
}
@@ -1296,28 +1287,18 @@ - (BOOL)control:(NSControl *)control textView:(NSTextView *)aTextView doCommandB
[window makeFirstResponder:textView];
return YES;
}
- } else if (control == [TagEditer tagField]) {
-
- if (command == @selector(insertNewline:)) {
+ } else if (control == [tagEditor tagField]) {
+ if ((command == @selector(insertNewline:))||(command == @selector(insertTab:))) {
if ([aTextView selectedRange].length>0) {
- NSString *theLabels = [[TagEditer newMultinoteLabels] autorelease];
- if (![theLabels hasSuffix:@" "]) {
- theLabels = [theLabels stringByAppendingString:@" "];
+ NSString *fieldStr=[aTextView string];
+ NSInteger len=fieldStr.length;
+ if ((![fieldStr hasSuffix:@","])&&![fieldStr hasSuffix:@" "]) {
+ [aTextView insertText:@"," replacementRange:NSMakeRange(len, 0)];
+ len++;
}
- [TagEditer setTF:theLabels];
- [aTextView setSelectedRange:NSMakeRange(theLabels.length, 0)];
+ [aTextView setSelectedRange:NSMakeRange(len, 0)];
return YES;
}
- }else if (command == @selector(insertTab:)) {
- if ([aTextView selectedRange].length>0) {
- NSString *theLabels = [[TagEditer newMultinoteLabels] autorelease];
- if (![theLabels hasSuffix:@" "]) {
- theLabels = [theLabels stringByAppendingString:@" "];
- }
- [TagEditer setTF:theLabels];
- [aTextView setSelectedRange:NSMakeRange(theLabels.length, 0)];
- }
- return YES;
}else {
if ((command == @selector(deleteBackward:))||(command == @selector(deleteForward:))) {
wasDeleting = YES;
@@ -1443,12 +1424,12 @@ - (void)controlTextDidChange:(NSNotification *)aNotification {
isFilteringFromTyping = NO;
- } else if ([TagEditer isMultitagging]) { //<--for elasticthreads multitagging
+ } else if ([tagEditor isMultitagging]) { //<--for elasticthreads multitagging
if (!isAutocompleting&&!wasDeleting) {
isAutocompleting = YES;
- NSTextView *editor = (NSTextView *)[[TagEditer tagPanel] fieldEditor:YES forObject:[TagEditer tagField]];
+ NSTextView *editor = [tagEditor tagFieldEditor];
NSRange selRange = [editor selectedRange];
- NSString *tagString = [[TagEditer newMultinoteLabels] autorelease];
+ NSString *tagString = [tagEditor newMultinoteLabels];
NSString *searchString = tagString;
if (selRange.length>0) {
searchString = [searchString substringWithRange:selRange];
@@ -1467,7 +1448,7 @@ - (void)controlTextDidChange:(NSNotification *)aNotification {
tagString = [tagString substringToIndex:selRange.location];
tagString = [tagString stringByAppendingString:useStr];
selRange = NSMakeRange(selRange.location + selRange.length, useStr.length - searchString.length );
- [TagEditer setTF:tagString];
+ [tagEditor setTF:tagString];
[editor setSelectedRange:selRange];
}
}
@@ -2178,19 +2159,7 @@ - (IBAction)fixFileEncoding:(id)sender {
- (void)windowDidResignKey:(NSNotification *)notification{
- [[NSNotificationCenter defaultCenter] postNotificationName:@"ModTimersShouldReset" object:nil];
- if ([notification object] == [TagEditer tagPanel]) { //<--this is for ElasticThreads' multitagging window
-
- if ([TagEditer isMultitagging]) {
- // BOOL tagExists = YES;
- [TagEditer closeTP:self];
- if (cTags) {
- cTags = nil;
- [cTags release];
- }
- }
- }
-
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"ModTimersShouldReset" object:nil];
}
- (void)windowWillClose:(NSNotification *)aNotification {
@@ -2391,110 +2360,121 @@ - (void)toggleAttachedMenu:(NSNotification *)aNotification
#pragma mark multitagging
-- (NSArray *)commonLabels{
- NSCharacterSet *tagSeparators = [NSCharacterSet characterSetWithCharactersInString:@", "];
- NSArray *retArray = [[[NSArray alloc]initWithObjects:@"",nil]retain];
- NSIndexSet *indexes = [notesTableView selectedRowIndexes];
- NSString *existTags;
- NSSet *tagsForNote;
- NSEnumerator *noteEnum = [[[notationController notesAtIndexes:indexes] objectEnumerator] retain];
+- (NSArray *)commonLabelsForNotesAtIndexes:(NSIndexSet *)selDexes{
+ NSArray *retArray =[NSArray array];
+
+ NSEnumerator *noteEnum = [[[notationController notesAtIndexes:selDexes] objectEnumerator] retain];
NoteObject *aNote;
- NSMutableSet *commonTags = [[[NSMutableSet alloc]initWithCapacity:1] retain];
- NSArray *tagArray;
aNote = [noteEnum nextObject];
- existTags = labelsOfNote(aNote);
- if (![existTags isEqualToString:@""]) {
- tagArray = [existTags componentsSeparatedByCharactersInSet:tagSeparators];
- [commonTags addObjectsFromArray:tagArray];
-
+ NSString *existTags = labelsOfNote(aNote);
+ if (existTags&&(existTags.length>0)) {
+ NSMutableSet *commonTags = [NSMutableSet new];
+
+ [commonTags addObjectsFromArray:[existTags labelCompatibleWords]];
while (((aNote = [noteEnum nextObject]))&&([commonTags count]>0)) {
existTags = labelsOfNote(aNote);
- if (![existTags isEqualToString:@""]) {
- tagArray = [existTags componentsSeparatedByCharactersInSet:tagSeparators];
- @try {
- if ([tagArray count]>0) {
- tagsForNote =[NSSet setWithArray:tagArray];
- if ([commonTags intersectsSet:tagsForNote]) {
- [commonTags intersectSet:tagsForNote];
- }else {
- [commonTags removeAllObjects];
- break;
- }
-
- }else {
- [commonTags removeAllObjects];
- break;
- }
- }
- @catch (NSException * e) {
- NSLog(@"intersect EXCEPT: %@",[e description]);
- [commonTags removeAllObjects];
- break;
- }
- }else {
+ if (!existTags||(existTags.length==0)) {
[commonTags removeAllObjects];
break;
+ }else{
+ NSArray *tagArray = [existTags labelCompatibleWords];
+ if (tagArray&&([tagArray count]>0)) {
+ NSSet *tagsForNote =[NSSet setWithArray:tagArray];
+ if ([commonTags intersectsSet:tagsForNote]) {
+ [commonTags intersectSet:tagsForNote];
+ }else {
+ [commonTags removeAllObjects];
+ break;
+ }
+ }else {
+ [commonTags removeAllObjects];
+ break;
+ }
}
}
- if ([commonTags count]>0) {
- retArray = [commonTags allObjects];
+ if (commonTags&&([commonTags count]>0)) {
+ retArray = [NSArray arrayWithArray:[commonTags allObjects]];
}
+ [commonTags release];
}
[noteEnum release];
- [commonTags release];
-
return retArray;
}
- (IBAction)multiTag:(id)sender {
- NSCharacterSet *tagSeparators = [NSCharacterSet characterSetWithCharactersInString:@", "];
- NSString *existTagString;
- NSMutableArray *theTags = [[[NSMutableArray alloc] init] autorelease];
- NSString *thisTag = [TagEditer newMultinoteLabels];
- NSArray *newTags = [NSArray arrayWithArray:[thisTag componentsSeparatedByCharactersInSet:tagSeparators]];
- [thisTag release];
- for (thisTag in newTags) {
- if (([thisTag hasPrefix:@" "])||([thisTag hasSuffix:@" "])) {
- thisTag = [thisTag stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
- }
- if (([thisTag hasPrefix:@","])||([thisTag hasSuffix:@","])) {
- thisTag = [thisTag stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]];
- }
- if (![thisTag isEqualToString:@""]) {
- [theTags addObject:thisTag];
- }
+ NSString *tagString = [[tagEditor newMultinoteLabels] stringByTrimmingCharactersInSet:[NSCharacterSet labelSeparatorCharacterSet]];
+ NSArray *newTags;
+ if (tagString&&(tagString.length>0)) {
+ newTags=[tagString labelCompatibleWords];
+ }else{
+ newTags=[NSArray array];
}
- if ([theTags count]<1) {
- [theTags addObject:@""];
- }
-
- NoteObject *aNote;
- NSArray *selNotes = [notationController notesAtIndexes:[notesTableView selectedRowIndexes]];
- for (aNote in selNotes) {
- existTagString = labelsOfNote(aNote);
-
- NSMutableArray *finalTags = [[[NSMutableArray alloc] init] autorelease];
- [finalTags addObjectsFromArray:theTags];
- NSArray *existingTags = [existTagString componentsSeparatedByCharactersInSet:tagSeparators];
- thisTag = nil;
- for (thisTag in existingTags) {
- if (([thisTag hasPrefix:@" "])||([thisTag hasSuffix:@" "])) {
- thisTag = [thisTag stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
- }
-
- if ((![theTags containsObject:thisTag])&&(![cTags containsObject:thisTag])&&(![thisTag isEqualToString:@""])) {
- [finalTags addObject:thisTag];
- }
+ NSArray *commonLabs=tagEditor.commonTags;
+ if (![newTags isEqualToArray:commonLabs]) {
+
+ NSArray *selNotes = [notationController notesAtIndexes:[notesTableView selectedRowIndexes]];
+ if (!selNotes||([selNotes count]==0)) {
+ return;
}
- NSString *newTagsString = [finalTags componentsJoinedByString:@" "];
- if (([newTagsString hasPrefix:@","])||([newTagsString hasSuffix:@","])) {
- newTagsString = [newTagsString stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]];
- }
- [aNote setLabelString:newTagsString];
+ tagString=nil;
+
+ BOOL gotNewLabels=(newTags&&([newTags count]>0));
+ BOOL gotCommonLabels=(commonLabs&&([commonLabs count]>0));
+ NSPredicate *pred;
+ if (gotCommonLabels&&gotNewLabels) {
+ pred=[NSPredicate predicateWithFormat:@"NOT %@ CONTAINS[cd] SELF",newTags];
+ commonLabs=[commonLabs filteredArrayUsingPredicate:pred];
+ }
+ NSMutableArray *finalTags = [NSMutableArray new];
+ for (NoteObject *aNote in selNotes) {
+ NSString *separator=@" ";
+ tagString=labelsOfNote(aNote);
+ NSArray *filteredTags;
+
+ if (tagString&&(tagString.length>0)) {
+ if (([tagString rangeOfString:@","].location!=NSNotFound)) {
+ separator=@",";
+ }
+ filteredTags=[tagString labelCompatibleWords];
+ if (gotCommonLabels) {
+ pred=[NSPredicate predicateWithFormat:@"NOT %@ CONTAINS[cd] SELF",commonLabs];
+ filteredTags=[filteredTags filteredArrayUsingPredicate:pred];
+ }
+ if (filteredTags&&([filteredTags count]>0)) {
+ [finalTags addObjectsFromArray:filteredTags];
+ }
+ }
+ if (gotNewLabels) {
+ if (finalTags&&([finalTags count]>0)) {
+ pred=[NSPredicate predicateWithFormat:@"NOT %@ CONTAINS[cd] SELF",finalTags];
+ filteredTags=[newTags filteredArrayUsingPredicate:pred];
+ if (filteredTags&&([filteredTags count]>0)) {
+ [finalTags addObjectsFromArray:filteredTags];
+ }
+ }else{
+ [finalTags addObjectsFromArray:newTags];
+ }
+ }
+ if (finalTags&&([finalTags count]>0)) {
+ tagString = [finalTags componentsJoinedByString:separator];
+ }else{
+ tagString=@"";
+ }
+
+ [aNote setLabelString:tagString];
+ [finalTags removeAllObjects];
+ }
+
+ [notesTableView scrollRowToVisible:[[notesTableView selectedRowIndexes] firstIndex]];
+ [finalTags release];
+ }
+ [tagEditor closeTP:self];
+}
+
+- (void)releaseTagEditor:(NSNotification *)note{
+ if (tagEditor) {
+ [tagEditor release];
}
- [TagEditer closeTP:self];
- [cTags release];
- [TagEditer release];
}
#pragma mark splitview/toolbar management
@@ -3181,10 +3161,9 @@ - (IBAction)printPreview:(id)sender
[previewController printPreview:self];
}
- - (void)postTextUpdate
- {
+ - (void)postTextUpdate{
- [[NSNotificationCenter defaultCenter] postNotificationName:@"TextView has changed contents" object:self];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"TextViewHasChangedContents" object:self];
}
- (IBAction)selectPreviewMode:(id)sender
View
133 English.lproj/TagEditingManager.xib
@@ -2,25 +2,28 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10J869</string>
- <string key="IBDocument.InterfaceBuilderVersion">1306</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">461.00</string>
+ <string key="IBDocument.SystemVersion">12D78</string>
+ <string key="IBDocument.InterfaceBuilderVersion">3084</string>
+ <string key="IBDocument.AppKitVersion">1187.37</string>
+ <string key="IBDocument.HIToolboxVersion">626.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">1306</string>
+ <string key="NS.object.0">3084</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
+ <string>NSCustomObject</string>
<string>NSTextField</string>
<string>NSTextFieldCell</string>
- <string>NSWindowTemplate</string>
<string>NSView</string>
- <string>NSCustomObject</string>
+ <string>NSWindowTemplate</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
- <dictionary class="NSMutableDictionary" key="IBDocument.Metadata"/>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="384264609">
<object class="NSCustomObject" id="515108334">
<string key="NSClassName">TagEditingManager</string>
@@ -35,10 +38,11 @@
<int key="NSWindowStyleMask">8219</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{122, 324}, {322, 55}}</string>
- <int key="NSWTFlags">-461896704</int>
+ <int key="NSWTFlags">-1535638528</int>
<string key="NSWindowTitle">Modify or Add Tags to Selected Notes:</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
+ <nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMaxSize">{2000, 55}</string>
<string key="NSWindowContentMinSize">{150, 55}</string>
<object class="NSView" key="NSWindowView" id="716340357">
@@ -54,7 +58,7 @@
<reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="746859396">
- <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags">-1804599231</int>
<int key="NSCellFlags2">268436480</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport">
@@ -83,9 +87,10 @@
</object>
</object>
</object>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
</array>
- <string key="NSFrame">{{7, 11}, {322, 55}}</string>
+ <string key="NSFrameSize">{322, 55}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="914473982"/>
@@ -93,6 +98,7 @@
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{150, 74}</string>
<string key="NSMaxSize">{2000, 74}</string>
+ <bool key="NSWindowIsRestorable">NO</bool>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
@@ -188,8 +194,9 @@
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="370.IBEditorWindowLastContentRect">{{625, 720}, {322, 55}}</string>
<string key="370.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="370.IBWindowTemplateEditedContentRect">{{625, 720}, {322, 55}}</string>
<boolean value="NO" key="370.NSWindowTemplate.visibleAtLaunch"/>
@@ -212,12 +219,16 @@
<string key="bringFocusToControlField:">id</string>
<string key="copyNoteLink:">id</string>
<string key="deleteNote:">id</string>
+ <string key="editNoteExternally:">id</string>
<string key="exportNote:">id</string>
<string key="fieldAction:">id</string>
+ <string key="fixFileEncoding:">id</string>
<string key="importNotes:">id</string>
+ <string key="lockPreview:">id</string>
<string key="multiTag:">id</string>
- <string key="openFileInEditor:">id</string>
+ <string key="previewNoteWithMarked:">id</string>
<string key="printNote:">id</string>
+ <string key="printPreview:">id</string>
<string key="renameNote:">id</string>
<string key="revealNote:">id</string>
<string key="savePreview:">id</string>
@@ -228,11 +239,11 @@
<string key="sharePreview:">id</string>
<string key="showHelpDocument:">id</string>
<string key="showPreferencesWindow:">id</string>
+ <string key="switchFullScreen:">id</string>
<string key="switchViewLayout:">id</string>
<string key="syncWaitQuit:">id</string>
<string key="tagNote:">id</string>
<string key="toggleCollapse:">id</string>
- <string key="toggleFullscreen:">id</string>
<string key="toggleNVActivation:">id</string>
<string key="togglePreview:">id</string>
<string key="toggleSourceView:">id</string>
@@ -251,6 +262,10 @@
<string key="name">deleteNote:</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBActionInfo" key="editNoteExternally:">
+ <string key="name">editNoteExternally:</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBActionInfo" key="exportNote:">
<string key="name">exportNote:</string>
<string key="candidateClassName">id</string>
@@ -259,22 +274,34 @@
<string key="name">fieldAction:</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBActionInfo" key="fixFileEncoding:">
+ <string key="name">fixFileEncoding:</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBActionInfo" key="importNotes:">
<string key="name">importNotes:</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBActionInfo" key="lockPreview:">
+ <string key="name">lockPreview:</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBActionInfo" key="multiTag:">
<string key="name">multiTag:</string>
<string key="candidateClassName">id</string>
</object>
- <object class="IBActionInfo" key="openFileInEditor:">
- <string key="name">openFileInEditor:</string>
+ <object class="IBActionInfo" key="previewNoteWithMarked:">
+ <string key="name">previewNoteWithMarked:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="printNote:">
<string key="name">printNote:</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBActionInfo" key="printPreview:">
+ <string key="name">printPreview:</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBActionInfo" key="renameNote:">
<string key="name">renameNote:</string>
<string key="candidateClassName">id</string>
@@ -315,6 +342,10 @@
<string key="name">showPreferencesWindow:</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBActionInfo" key="switchFullScreen:">
+ <string key="name">switchFullScreen:</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBActionInfo" key="switchViewLayout:">
<string key="name">switchViewLayout:</string>
<string key="candidateClassName">id</string>
@@ -331,10 +362,6 @@
<string key="name">toggleCollapse:</string>
<string key="candidateClassName">id</string>
</object>
- <object class="IBActionInfo" key="toggleFullscreen:">
- <string key="name">toggleFullscreen:</string>
- <string key="candidateClassName">id</string>
- </object>
<object class="IBActionInfo" key="toggleNVActivation:">
<string key="name">toggleNVActivation:</string>
<string key="candidateClassName">id</string>
@@ -355,16 +382,20 @@
<dictionary class="NSMutableDictionary" key="outlets">
<string key="editorStatusView">EmptyView</string>
<string key="field">DualField</string>
+ <string key="fsMenuItem">NSMenuItem</string>
+ <string key="lockNoteItem">NSMenuItem</string>
<string key="mainView">ETContentView</string>
<string key="multiMarkdownPreview">NSMenuItem</string>
- <string key="notesScrollView">AugmentedScrollView</string>
+ <string key="notesScrollView">ETScrollView</string>
<string key="notesTableView">NotesTableView</string>
<string key="previewToggler">NSMenuItem</string>
+ <string key="printPreviewItem">NSMenuItem</string>
+ <string key="savePreviewItem">NSMenuItem</string>
<string key="sparkleUpdateItem">NSMenuItem</string>
<string key="statBarMenu">NSMenu</string>
<string key="syncWaitPanel">NSPanel</string>
<string key="syncWaitSpinner">NSProgressIndicator</string>
- <string key="textScrollView">NSScrollView</string>
+ <string key="textScrollView">ETScrollView</string>
<string key="textView">LinkingEditor</string>
<string key="textilePreview">NSMenuItem</string>
<string key="window">NSWindow</string>
@@ -379,6 +410,14 @@
<string key="name">field</string>
<string key="candidateClassName">DualField</string>
</object>
+ <object class="IBToOneOutletInfo" key="fsMenuItem">
+ <string key="name">fsMenuItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="lockNoteItem">
+ <string key="name">lockNoteItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
<object class="IBToOneOutletInfo" key="mainView">
<string key="name">mainView</string>
<string key="candidateClassName">ETContentView</string>
@@ -389,7 +428,7 @@
</object>
<object class="IBToOneOutletInfo" key="notesScrollView">
<string key="name">notesScrollView</string>
- <string key="candidateClassName">AugmentedScrollView</string>
+ <string key="candidateClassName">ETScrollView</string>
</object>
<object class="IBToOneOutletInfo" key="notesTableView">
<string key="name">notesTableView</string>
@@ -399,6 +438,14 @@
<string key="name">previewToggler</string>
<string key="candidateClassName">NSMenuItem</string>
</object>
+ <object class="IBToOneOutletInfo" key="printPreviewItem">
+ <string key="name">printPreviewItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="savePreviewItem">
+ <string key="name">savePreviewItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
<object class="IBToOneOutletInfo" key="sparkleUpdateItem">
<string key="name">sparkleUpdateItem</string>
<string key="candidateClassName">NSMenuItem</string>
@@ -417,7 +464,7 @@
</object>
<object class="IBToOneOutletInfo" key="textScrollView">
<string key="name">textScrollView</string>
- <string key="candidateClassName">NSScrollView</string>
+ <string key="candidateClassName">ETScrollView</string>
</object>
<object class="IBToOneOutletInfo" key="textView">
<string key="name">textView</string>
@@ -442,14 +489,6 @@
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">AugmentedScrollView</string>
- <string key="superclassName">NSScrollView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/AugmentedScrollView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
<string key="className">DualField</string>
<string key="superclassName">NSTextField</string>
<object class="NSMutableDictionary" key="outlets">
@@ -477,6 +516,14 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">ETScrollView</string>
+ <string key="superclassName">NSScrollView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/ETScrollView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">EmptyView</string>
<string key="superclassName">NSView</string>
<object class="NSMutableDictionary" key="outlets">
@@ -517,10 +564,26 @@
<string key="className">LinkingEditor</string>
<string key="superclassName">NSTextView</string>
<dictionary class="NSMutableDictionary" key="actions">
+ <string key="insertLink:">id</string>
+ <string key="pasteMarkdownLink:">id</string>
+ <string key="performFindPanelAction:">id</string>
<string key="shiftLeftAction:">id</string>
<string key="shiftRightAction:">id</string>
+ <string key="toggleLayoutOrientation:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
+ <object class="IBActionInfo" key="insertLink:">
+ <string key="name">insertLink:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="pasteMarkdownLink:">
+ <string key="name">pasteMarkdownLink:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="performFindPanelAction:">
+ <string key="name">performFindPanelAction:</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBActionInfo" key="shiftLeftAction:">
<string key="name">shiftLeftAction:</string>
<string key="candidateClassName">id</string>
@@ -529,6 +592,10 @@
<string key="name">shiftRightAction:</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBActionInfo" key="toggleLayoutOrientation:">
+ <string key="name">toggleLayoutOrientation:</string>
+ <string key="candidateClassName">id</string>
+ </object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="controlField">NSTextField</string>
@@ -622,7 +689,7 @@
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <integer value="1050" key="NS.object.0"/>
+ <real value="1070" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
View
25 NSString_NV.m
@@ -190,16 +190,21 @@ - (NSArray*)labelCompatibleWords {
BOOL lacksSpace = [self rangeOfString:@" " options:NSLiteralSearch].location == NSNotFound;
array = [self componentsSeparatedByString: lacksSpace ? @"," : @" "];
}
- NSMutableArray *titles = [NSMutableArray arrayWithCapacity:[array count]];
-
- NSUInteger i;
- for (i=0; i<[array count]; i++) {
- NSString *aWord = [array objectAtIndex:i];
- if ([aWord length] > 0) {
- [titles addObject:aWord];
- }
- }
- return titles;
+ if (array&&([array count]>0)) {
+ NSMutableArray *titles = [[NSMutableArray alloc]initWithCapacity:[array count]];
+ for (NSString *aWord in array) {
+ if (aWord&&(aWord.length>0)&&(![titles containsObject:aWord])) {
+ [titles addObject:aWord];
+ }
+ }
+ if (titles&&([titles count]>0)) {
+ NSArray *retArray=[NSArray arrayWithArray:titles];
+ [titles release];
+ return retArray;
+ }
+ [titles release];
+ }
+ return [NSArray array];
}
- (CFArrayRef)copyRangesOfWordsInString:(NSString*)findString inRange:(NSRange)limitRange {
View
9 TagEditingManager.h
@@ -13,15 +13,16 @@
IBOutlet NSPanel *tagPanel;
IBOutlet NSTextField *tagField;
BOOL isHappening;
+ NSArray *commonTags;
}
-- (void)awakeFromNib;
+@property(retain,nonatomic)NSArray *commonTags;
+
+- (id)initWithDelegate:(id)del commonTags:(NSArray *)cTags atPoint:(NSPoint)centerpoint;
- (NSString *)newMultinoteLabels;
- (void)setTF:(NSString *)inString;
-- (void)popTP:(id)sender;
- (void)closeTP:(id)sender;
-- (void)setDel:(id)sender;
-- (NSPanel *)tagPanel;
+- (NSTextView *)tagFieldEditor;
- (NSTextField *)tagField;
- (BOOL)isMultitagging;
View
93 TagEditingManager.m
@@ -8,69 +8,94 @@
#import "TagEditingManager.h"
#import "AppController.h"
+
@implementation TagEditingManager
+@synthesize commonTags;
-- (id)init
-{
+- (id)initWithDelegate:(id)del commonTags:(NSArray *)cTags atPoint:(NSPoint)centerpoint{
if ((self=[super init])) {
if (![NSBundle loadNibNamed:@"TagEditingManager" owner:self]) {
NSLog(@"Failed to load TagEditer.nib");
- }
+ }else{
+ isHappening = YES;
+ NSRect zRect=[tagPanel frame];
+ centerpoint.x-=(zRect.size.width/2.0);
+ centerpoint.y-=(zRect.size.height+70.0);
+ [tagPanel setDelegate:self];
+ [tagField setDelegate:del];
+ self.commonTags=cTags;
+ [tagPanel setFrameOrigin:centerpoint];
+ [tagPanel makeKeyAndOrderFront:del];
+
+ }
}
return self;
}
- (void)dealloc{
+ [commonTags release];
[tagPanel release];
[tagField release];
[super dealloc];
}
-- (void)awakeFromNib {
- [tagField setStringValue:@""];
-// [tagField setDelegate:self];
+- (void)setCommonTags:(NSArray *)newTags{
+ if (commonTags) {
+ [commonTags release];
+ commonTags=nil;
+ }
+
+ commonTags=[newTags retain];
+ if (isHappening) {
+ NSString *newTagString=@"";
+ if (commonTags&&([commonTags count]>0)) {
+ newTagString=[commonTags componentsJoinedByString:@","];
+ }
+ [tagField setStringValue:newTagString];
+ }
}
-- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command{
- if (command == @selector(cancelOperation:)) {
- [tagPanel orderOut:self];
- //[self closeTP:self];
- }
- return NO;
+//- (void)awakeFromNib {
+// [tagField setStringValue:@""];
+//// [tagField setDelegate:self];
+//}
+
+//- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command{
+// if (command == @selector(cancelOperation:)) {
+// [tagPanel orderOut:self];
+// //[self closeTP:self];
+// }
+// return NO;
+//}
+
+- (void)cancelOperation:(id)sender {
+ [tagPanel orderOut:nil];
+}
+
+- (void)windowDidResignKey:(NSNotification *)notification{
+ if ([tagPanel isVisible]) {
+ [tagPanel orderOut:nil];
+ }
+ isHappening = NO;
+ self.commonTags=[NSArray array];
+ [[NSNotificationCenter defaultCenter]postNotificationName:@"TagEditorShouldRelease" object:nil];
}
- (NSString *)newMultinoteLabels{
- return [[NSString stringWithString:[tagField stringValue]]retain];
+ return [NSString stringWithString:[tagField stringValue]];
}
- (void)setTF:(NSString *)inString{
[tagField setStringValue:inString];
}
-- (void)popTP:(id)sender{
- [tagPanel center];
- [tagPanel makeKeyAndOrderFront:sender];
- isHappening = YES;
-
-}
-
-- (void)setDel:(id)sender{
- [tagPanel setDelegate:sender];
- [tagField setDelegate:sender];
- // [[tagPanel fieldEditor:YES forObject:tagField]setDelegate:sender];
-}
-
-- (void)closeTP:(id)sender{
- if (isHappening &&([tagPanel isVisible])) {
- [tagPanel orderOut:sender];
- }
- isHappening = NO;
- [tagField setStringValue:@""];
+- (void)closeTP:(id)sender{
+ [tagPanel orderOut:nil];
}
-- (NSPanel *)tagPanel {
- return tagPanel;
+- (NSTextView *)tagFieldEditor{
+ return (NSTextView *)[tagPanel fieldEditor:YES forObject:tagField];
}
- (NSTextField *)tagField{
Please sign in to comment.
Something went wrong with that request. Please try again.