Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merge dbFixes branch

with the "kUseCachesFolderForInterimNoteChanges" compile flag set to 1
nvALT will now store its "Interim Note-Changes" file in
'~/Library/Caches/net.elasticthreads.nv/'

there's also a fix in here about how nvALT's window activates on launch
when the Dock icon is hiding. Though innocous, it's kind of the straw
that broke the full 10.6 support. From now on we'll have to release a
separate 10.6 build. It requires two small changes to info.plist (see
below)

info.plist is set for 10.7+ only
to build for 10.6 make the following changes to info.plist:
- change "Minimum System Version" to 10.6.8
- change "Application is agent (UIElement)"   (aka LSUIElement) to true
  • Loading branch information...
commit feddcf37b2767a015a0ee74d263e7618995aad0d 1 parent f97a92d
@elasticthreads elasticthreads authored
View
8 AppController.h
@@ -229,11 +229,11 @@ void outletObjectAwoke(id sender);
- (void)focusControlField:(id)sender activate:(BOOL)shouldActivate;
#pragma mark toggling dock icon
- (void)togDockIcon:(NSNotification *)notification;
-- (void)toggleStatusItem:(NSNotification *)notification;
-- (void)relaunchAfterDelay;
-- (void)relaunchNV:(id)sender;
-- (void)reactivateAfterDelay;
+- (void)hideDockIconAfterDelay;
+- (void)hideDockIcon;
+- (void)showDockIcon;
- (void)reActivate:(id)sender;
+- (void)toggleStatusItem:(NSNotification *)notification;
//- (IBAction)testThing:(id)sender;
- (void)setUpStatusBarItem;
- (NSArray *)referenceLinksInString:(NSString *)contentString;
View
149 AppController.m
@@ -87,14 +87,22 @@ - (id)init {
hasLaunched=NO;
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"ShowDockIcon"]){
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToUIElementApplication);
- if( returnCode != 0) {
- NSLog(@"Could not bring the application to front. Error %d", returnCode);
+ if (IsLionOrLater) {
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToUIElementApplication);
+ if( returnCode != 0) {
+ NSLog(@"Could not bring the application to front. Error %d", returnCode);
+ }
}
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"StatusBarItem"]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"StatusBarItem"];
}
+ }else{
+ if (!IsLionOrLater) {
+ enum {NSApplicationActivationPolicyRegular};
+ [[NSApplication sharedApplication] setActivationPolicy:NSApplicationActivationPolicyRegular];
+ }
+
}
splitViewAwoke = NO;
@@ -1109,7 +1117,10 @@ - (void)applicationWillBecomeActive:(NSNotification *)aNotification {
if (IsLeopardOrLater) {
SpaceSwitchingContext thisSpaceSwitchCtx;
- CurrentContextForWindowNumber([window windowNumber], &thisSpaceSwitchCtx);
+ if ([window windowNumber]!=-1) {
+ CurrentContextForWindowNumber([window windowNumber], &thisSpaceSwitchCtx);
+
+ }
//what if the app is switched-to in another way? then the last-stored spaceSwitchCtx will cause us to return to the wrong app
//unfortunately this notification occurs only after NV has become the front process, but we can still verify the space number
@@ -2270,13 +2281,14 @@ - (IBAction)showPreferencesWindow:(id)sender {
}
- (IBAction)toggleNVActivation:(id)sender {
-
- if ([NSApp isActive] && [window isMainWindow]) {
-
+
+ if ([NSApp isActive] && [window isMainWindow]&&[window isVisible]) {
+
SpaceSwitchingContext laterSpaceSwitchCtx;
- if (IsLeopardOrLater)
+ if (IsLeopardOrLater){
CurrentContextForWindowNumber([window windowNumber], &laterSpaceSwitchCtx);
-
+
+ }
if (!IsLeopardOrLater || !CompareContextsAndSwitch(&spaceSwitchCtx, &laterSpaceSwitchCtx)) {
//hide only if we didn't need to or weren't able to switch spaces
[NSApp hide:sender];
@@ -2301,12 +2313,21 @@ - (void)focusControlField:(id)sender activate:(BOOL)shouldActivate{
[field selectText:sender];
- if (shouldActivate&&(![NSApp isActive])) {
- CurrentContextForWindowNumber([window windowNumber], &spaceSwitchCtx);
- [NSApp activateIgnoringOtherApps:YES];
+ if (!shouldActivate) {
+ [window makeKeyAndOrderFront:sender];
+ [window makeMainWindow];
+ if (![NSApp isActive]) {
+ CurrentContextForWindowNumber([window windowNumber], &spaceSwitchCtx);
+ }
+ }else{
+ if (![NSApp isActive]) {
+ CurrentContextForWindowNumber([window windowNumber], &spaceSwitchCtx);
+ [NSApp activateIgnoringOtherApps:YES];
+ }
+ if (![window isMainWindow]||![window isVisible]){
+ [window makeKeyAndOrderFront:sender];
+ }
}
- if (![window isMainWindow]) [window makeKeyAndOrderFront:sender];
-
[self setEmptyViewState:currentNote == nil];
self.isEditing = NO;
@@ -2349,18 +2370,7 @@ - (NSMenu *)statBarMenu{
- (void)toggleAttachedWindow:(NSNotification *)aNotification
{
- if (![window isKeyWindow]) {
- // [self focusOnCtrlFld:self];
- if (![window isMainWindow]) [window makeKeyAndOrderFront:self];
-
- if (![NSApp isActive]) {
- [NSApp activateIgnoringOtherApps:YES];
- }
- }else {
- [NSApp hide:[aNotification object]];
- // [statusItem popUpStatusItemMenu:statBarMenu];
- // return YES;
- }
+ [self toggleNVActivation:[aNotification object]];
}
- (void)toggleAttachedMenu:(NSNotification *)aNotification
@@ -3316,16 +3326,61 @@ - (void)togDockIcon:(NSNotification *)notification{
[NSApp hide:self];
BOOL showIt=[[notification object]boolValue];
if (showIt) {
- [self performSelectorOnMainThread:@selector(reactivateAfterDelay) withObject:nil waitUntilDone:NO];
+ [self performSelectorOnMainThread:@selector(showDockIcon) withObject:nil waitUntilDone:NO];
}else {
- [self performSelectorOnMainThread:@selector(relaunchAfterDelay) withObject:nil waitUntilDone:NO];
+ [self performSelectorOnMainThread:@selector(hideDockIconAfterDelay) withObject:nil waitUntilDone:NO];
+
+ }
+ }
+
+ - (void)showDockIcon{
+ if (IsLionOrLater) {
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
+ if( returnCode != 0) {
+ NSLog(@"Could not bring the application to front. Error %d", returnCode);
+ }
+
+ }else{
+ enum {NSApplicationActivationPolicyRegular};
+ [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+ }
+ [self performSelector:@selector(reActivate:) withObject:self afterDelay:0.16];
+ }
+
+ - (void)hideDockIcon{
+ // id fullPath = [[NSBundle mainBundle] executablePath];
+ // NSArray *arg = [NSArray arrayWithObjects:nil];
+ // [NSTask launchedTaskWithLaunchPath:fullPath arguments:arg];
+ // [NSApp terminate:sender];
+ if (IsLionOrLater) {
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToUIElementApplication);
+ if( returnCode != 0) {
+ NSLog(@"Could not bring the application to front. Error %d", returnCode);
+ }
+ if (!statusItem) {
+ [self setUpStatusBarItem];
+ }
+ [self performSelector:@selector(reActivate:) withObject:self afterDelay:0.36];
+ }else{
+ NSLog(@"hiding dock incon in snow leopard");
+ id fullPath = [[NSBundle mainBundle] executablePath];
+ NSArray *arg = [NSArray arrayWithObjects:nil];
+ [NSTask launchedTaskWithLaunchPath:fullPath arguments:arg];
+ [NSApp terminate:self];
}
+
}
- - (void)relaunchAfterDelay{
+ - (void)reActivate:(id)sender{
+ [NSApp activateIgnoringOtherApps:YES];
+ }
+
+ - (void)hideDockIconAfterDelay{
- [self performSelector:@selector(relaunchNV:) withObject:self afterDelay:0.22];
+ [self performSelector:@selector(hideDockIcon) withObject:nil afterDelay:0.22];
}
- (void)setUpStatusBarItem{
@@ -3347,38 +3402,10 @@ - (void)toggleStatusItem:(NSNotification *)notification{
}
}
- - (void)relaunchNV:(id)sender{
- // id fullPath = [[NSBundle mainBundle] executablePath];
- // NSArray *arg = [NSArray arrayWithObjects:nil];
- // [NSTask launchedTaskWithLaunchPath:fullPath arguments:arg];
- // [NSApp terminate:sender];
-
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToUIElementApplication);
- if( returnCode != 0) {
- NSLog(@"Could not bring the application to front. Error %d", returnCode);
- }
- if (!statusItem) {
- [self setUpStatusBarItem];
- }
-
-
- [self performSelector:@selector(reActivate:) withObject:self afterDelay:0.36];
- }
+
- - (void)reactivateAfterDelay{
-
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
- if( returnCode != 0) {
- NSLog(@"Could not bring the application to front. Error %d", returnCode);
- }
- [self performSelector:@selector(reActivate:) withObject:self afterDelay:0.16];
- }
+
- - (void)reActivate:(id)sender{
- [NSApp activateIgnoringOtherApps:YES];
- }
#pragma mark NSPREDICATE TO FIND MARKDOWN REFERENCE LINKS
// - (IBAction)testThing:(id)sender{
View
23 English.lproj/MainMenu.xib
@@ -5193,6 +5193,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<string key="switchViewLayout:">id</string>
<string key="syncWaitQuit:">id</string>
<string key="tagNote:">id</string>
+ <string key="testThing:">id</string>
<string key="toggleCollapse:">id</string>
<string key="toggleNVActivation:">id</string>
<string key="togglePreview:">id</string>
@@ -5304,6 +5305,10 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<string key="name">tagNote:</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBActionInfo" key="testThing:">
+ <string key="name">testThing:</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBActionInfo" key="toggleCollapse:">
<string key="name">toggleCollapse:</string>
<string key="candidateClassName">id</string>
@@ -5645,6 +5650,24 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">WebView</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">reloadFromOrigin:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <string key="NS.key.0">reloadFromOrigin:</string>
+ <object class="IBActionInfo" key="NS.object.0">
+ <string key="name">reloadFromOrigin:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/WebView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">WordCountToken</string>
<string key="superclassName">NSTokenField</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
View
13 Info.plist
@@ -160,7 +160,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
- <string>106</string>
+ <string>107</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSArchitecturePriority</key>
@@ -169,16 +169,9 @@
<string>i386</string>
</array>
<key>LSMinimumSystemVersion</key>
- <string>10.6</string>
+ <string>10.7</string>
<key>CFBundleName</key>
<string></string>
- <key>LSMinimumSystemVersionByArchitecture</key>
- <dict>
- <key>i386</key>
- <string>10.5.8</string>
- <key>x86_64</key>
- <string>10.6.0</string>
- </dict>
<key>NSAppleScriptEnabled</key>
<true/>
<key>NSMainNibFile</key>
@@ -229,6 +222,8 @@
<real>345600</real>
<key>SmartCrashReports_CompanyName</key>
<string>Notational.net</string>
+ <key>LSUIElement</key>
+ <false/>
<key>SmartCrashReports_EmailTicket</key>
<string>SCR-51ED0F7B2A</string>
</dict>
View
2  Notation.xcodeproj/project.pbxproj
@@ -591,6 +591,7 @@
5C2CD036132ED47900CA0D7C /* ETScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ETScrollView.m; sourceTree = "<group>"; };
5C38E2C214223D6900131682 /* ETOverlayScroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ETOverlayScroller.h; sourceTree = "<group>"; };
5C38E2C314223D6900131682 /* ETOverlayScroller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ETOverlayScroller.m; sourceTree = "<group>"; };
+ 5C4479DF17020153000AA45A /* nvaDevConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nvaDevConfig.h; sourceTree = "<group>"; };
5C48A28113A54FBD006B73DD /* zh */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh; path = zh.lproj/PassphrasePicker.nib; sourceTree = "<group>"; };
5C48A28413A54FCA006B73DD /* zh */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh; path = zh.lproj/PassphraseChanger.nib; sourceTree = "<group>"; };
5C48A28813A54FE1006B73DD /* zh */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh; path = zh.lproj/KeyDerivationManager.nib; sourceTree = "<group>"; };
@@ -1295,6 +1296,7 @@
214495040ADC7F4F00E2A2B6 /* SFPasswordAssistantInspectorController.h */,
213FAD510B3C6B52004C74BD /* FSExchangeObjectsCompat.h */,
213FAD520B3C6B52004C74BD /* FSExchangeObjectsCompat.c */,
+ 5C4479DF17020153000AA45A /* nvaDevConfig.h */,
);
name = "Other Sources";
sourceTree = "<group>";
View
3  NotationController.h
@@ -193,6 +193,9 @@ typedef struct _NoteCatalogEntry {
- (void)dealloc;
+#pragma mark nvALT stuff
+- (NSString *)createCachesFolderString;
+
@end
View
33 NotationController.m
@@ -41,6 +41,7 @@
#import "SyncSessionController.h"
#import "BookmarksController.h"
#import "DeletionManager.h"
+#import "nvaDevConfig.h"
@implementation NotationController
@@ -347,8 +348,15 @@ - (BOOL)initializeJournaling {
UInt8 *convertedPath = (UInt8*)malloc(maxPathSize * sizeof(UInt8));
OSStatus err = noErr;
NSData *walSessionKey = [notationPrefs WALSessionKey];
-
+
+ //nvALT change to store Interim Note-Changes in ~/Library/Caches/
+#if kUseCachesFolderForInterimNoteChanges
+ NSString *cPath=[self createCachesFolder];
+ if (cPath) {
+ convertedPath=[cPath UTF8String];
+#else
if ((err = FSRefMakePath(&noteDirectoryRef, convertedPath, maxPathSize)) == noErr) {
+#endif
//initialize the journal if necessary
if (!(walWriter = [[WALStorageController alloc] initWithParentFSRep:(char*)convertedPath encryptionKey:walSessionKey])) {
//journal file probably already exists, so try to recover it
@@ -1574,6 +1582,29 @@ - (void)dealloc {
[super dealloc];
}
+#pragma mark nvALT stuff
+- (NSString *)createCachesFolder{
+ NSString *path = nil;
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+ if ([paths count])
+ {
+ NSString *bundleName =
+ [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
+ path = [[paths objectAtIndex:0] stringByAppendingPathComponent:bundleName];
+ NSError *theError;
+ if ((path)&&([[NSFileManager defaultManager]createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&theError])) {
+// NSLog(@"cache folder :>%@<",path);
+ return path;
+
+ }else{
+ NSLog(@"error creating cache folder :>%@<",[theError description]);
+ }
+ }else{
+ NSLog(@"Unable to find or create cache folder:\n%@", path);
+ }
+ return nil;
+}
+
@end
View
10 nvaDevConfig.h
@@ -0,0 +1,10 @@
+//
+// nvaDevConfig.h
+// Notation
+//
+// Created by David Halter on 3/26/13.
+//
+// you can put compiler flags here to let devs play with
+// experimental features.
+
+#define kUseCachesFolderForInterimNoteChanges 1
Please sign in to comment.
Something went wrong with that request. Please try again.