Revision: 27474
http://sourceforge.net/p/bibdesk/svn/27474
Author: hofman
Date: 2022-05-24 15:05:18 +0000 (Tue, 24 May 2022)
Log Message:
-----------
use new class for textview editing in editor that forwards undo to the
document's undomanager when no actions are on the stack
Modified Paths:
--------------
trunk/bibdesk/BDSKEditor.m
trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
Added Paths:
-----------
trunk/bibdesk/BDSKTextUndoManager.h
trunk/bibdesk/BDSKTextUndoManager.m
Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m 2022-05-24 14:34:04 UTC (rev 27473)
+++ trunk/bibdesk/BDSKEditor.m 2022-05-24 15:05:18 UTC (rev 27474)
@@ -92,6 +92,7 @@
#import "NSBezierPath_BDSKExtensions.h"
#import "NSLayoutConstraint_BDSKExtensions.h"
#import "NSFont_BDSKExtensions.h"
+#import "BDSKTextUndoManager.h"
#define WEAK_NULL NULL
@@ -3037,15 +3038,15 @@
- (NSUndoManager *)undoManagerForTextView:(NSTextView *)aTextView {
if(aTextView == notesView){
if(notesViewUndoManager == nil)
- notesViewUndoManager = [[NSUndoManager alloc] init];
+ notesViewUndoManager = [[BDSKTextUndoManager alloc]
initWithNextUndoManager:[self undoManager]];
return notesViewUndoManager;
}else if(aTextView == abstractView){
if(abstractViewUndoManager == nil)
- abstractViewUndoManager = [[NSUndoManager alloc] init];
+ abstractViewUndoManager = [[BDSKTextUndoManager alloc]
initWithNextUndoManager:[self undoManager]];
return abstractViewUndoManager;
}else if(aTextView == rssDescriptionView){
if(rssDescriptionViewUndoManager == nil)
- rssDescriptionViewUndoManager = [[NSUndoManager alloc] init];
+ rssDescriptionViewUndoManager = [[BDSKTextUndoManager alloc]
initWithNextUndoManager:[self undoManager]];
return rssDescriptionViewUndoManager;
}else return [self undoManager];
}
Added: trunk/bibdesk/BDSKTextUndoManager.h
===================================================================
--- trunk/bibdesk/BDSKTextUndoManager.h (rev 0)
+++ trunk/bibdesk/BDSKTextUndoManager.h 2022-05-24 15:05:18 UTC (rev 27474)
@@ -0,0 +1,46 @@
+//
+// BDSKTextUndoManager.h
+// BibDesk
+//
+// Created by Christiaan Hofman on 24/05/2022.
+/*
+ This software is Copyright (c) 2022
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface BDSKTextUndoManager : NSUndoManager {
+ NSUndoManager *nextUndoManager;
+}
+- (id)initWithNextUndoManager:(NSUndoManager *)undoManager;
+@end
Added: trunk/bibdesk/BDSKTextUndoManager.m
===================================================================
--- trunk/bibdesk/BDSKTextUndoManager.m (rev 0)
+++ trunk/bibdesk/BDSKTextUndoManager.m 2022-05-24 15:05:18 UTC (rev 27474)
@@ -0,0 +1,86 @@
+//
+// BDSKTextUndoManager.m
+// BibDesk
+//
+// Created by Christiaan Hofman on 24/05/2022.
+/*
+ This software is Copyright (c) 2022
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "BDSKTextUndoManager.h"
+
+@implementation BDSKTextUndoManager
+
+- (id)initWithNextUndoManager:(NSUndoManager *)undoManager {
+ self = [super init];
+ if (self) {
+ nextUndoManager = [undoManager retain];
+ }
+ return self;
+}
+
+- (void)dealloc {
+ BDSKDESTROY(nextUndoManager);
+ [super dealloc];
+}
+
+- (NSString *)redoMenuItemTitle {
+ return [super canRedo] || nextUndoManager == nil ? [super
redoMenuItemTitle] : [nextUndoManager redoMenuItemTitle];
+}
+
+- (NSString *)undoMenuItemTitle {
+ return [super canUndo] || nextUndoManager == nil ? [super
undoMenuItemTitle] : [nextUndoManager undoMenuItemTitle];
+}
+
+- (BOOL)canRedo {
+ return [super canRedo] || [nextUndoManager canRedo];
+}
+
+- (BOOL)canUndo {
+ return [super canUndo] || [nextUndoManager canUndo];
+}
+
+- (void)redo {
+ if ([super canRedo])
+ [super redo];
+ else
+ [nextUndoManager redo];
+}
+
+- (void)undo {
+ if ([super canUndo])
+ [super undo];
+ else
+ [nextUndoManager undo];
+}
+
+@end
Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===================================================================
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2022-05-24 14:34:04 UTC
(rev 27473)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2022-05-24 15:05:18 UTC
(rev 27474)
@@ -567,6 +567,8 @@
CE94C0DA10A8F2A2002634D2 /* SkimNotesBase.framework in
Frameworks */ = {isa = PBXBuildFile; fileRef = CE52E69D0E2D2B87007B6C62 /*
SkimNotesBase.framework */; };
CE95A57C0A88883300334DFA /* BDSKReadMeController.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE95A57A0A88883300334DFA /*
BDSKReadMeController.m */; };
CE95AF180ADBE7C000CB20E7 /* BDSKTemplateObjectProxy.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE95AF160ADBE7C000CB20E7 /*
BDSKTemplateObjectProxy.m */; };
+ CE963637283D292F00D8A983 /* BDSKTextUndoManager.h in Headers */
= {isa = PBXBuildFile; fileRef = CE963635283D292F00D8A983 /*
BDSKTextUndoManager.h */; };
+ CE963638283D292F00D8A983 /* BDSKTextUndoManager.m in Sources */
= {isa = PBXBuildFile; fileRef = CE963636283D292F00D8A983 /*
BDSKTextUndoManager.m */; };
CE9666460B46B70C003BAB9A /* BDSKServerInfo.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE9666440B46B70C003BAB9A /* BDSKServerInfo.m */;
};
CE966C710B47CF25003BAB9A /* BDSKDublinCoreXMLParser.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE966C6F0B47CF25003BAB9A /*
BDSKDublinCoreXMLParser.m */; };
CE969E340931E4F500EE3DFD /* NSTableHeaderView_BDSKExtensions.m
in Sources */ = {isa = PBXBuildFile; fileRef = CE969E320931E4F500EE3DFD /*
NSTableHeaderView_BDSKExtensions.m */; };
@@ -1698,6 +1700,8 @@
CE95A57A0A88883300334DFA /* BDSKReadMeController.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= BDSKReadMeController.m; sourceTree = "<group>"; };
CE95AF150ADBE7C000CB20E7 /* BDSKTemplateObjectProxy.h */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path
= BDSKTemplateObjectProxy.h; sourceTree = "<group>"; };
CE95AF160ADBE7C000CB20E7 /* BDSKTemplateObjectProxy.m */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc;
path = BDSKTemplateObjectProxy.m; sourceTree = "<group>"; };
+ CE963635283D292F00D8A983 /* BDSKTextUndoManager.h */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.h; path =
BDSKTextUndoManager.h; sourceTree = "<group>"; };
+ CE963636283D292F00D8A983 /* BDSKTextUndoManager.m */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
BDSKTextUndoManager.m; sourceTree = "<group>"; };
CE9666430B46B70C003BAB9A /* BDSKServerInfo.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
BDSKServerInfo.h; sourceTree = "<group>"; };
CE9666440B46B70C003BAB9A /* BDSKServerInfo.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= BDSKServerInfo.m; sourceTree = "<group>"; };
CE966C6E0B47CF25003BAB9A /* BDSKDublinCoreXMLParser.h */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path
= BDSKDublinCoreXMLParser.h; sourceTree = "<group>"; };
@@ -2850,6 +2854,7 @@
CE82B2D00D57AE0B00A2E8C5 /* BDSKSharingClient.m
*/,
F92ED7CB09E0A93400A244D0 /* BDSKSharingServer.m
*/,
F9F78CD307D5320D004B68AF /*
BDSKStringEncodingManager.m */,
+ CE963636283D292F00D8A983 /*
BDSKTextUndoManager.m */,
F9022C980758038000C3F701 /* BDSKTypeManager.m
*/,
F9022CA30758038000C3F701 /*
BDSKTypeSelectHelper.m */,
3DAEA2EC07703F6000AF111A /* BDSKUndoManager.m
*/,
@@ -3281,8 +3286,8 @@
F9706DE309102DF500526FC8 /* BDSKGradientView.h
*/,
CE21D10809208B9D0075E607 /* BDSKGroup.h */,
CE82B4710D57EECF00A2E8C5 /*
BDSKGroup+Scripting.h */,
+ CE675A0B26A359EC003B1FFA /*
BDSKGroupBubbleView.h */,
CE6759F226A356F0003B1FFA /* BDSKGroupCellView.h
*/,
- CE675A0B26A359EC003B1FFA /*
BDSKGroupBubbleView.h */,
CE6E5CE826AC15B10010D7BB /*
BDSKGroupImageView.h */,
F97BE8EF0907321F0063504B /*
BDSKGroupOutlineView.h */,
CE2AF1A926BAD4E100B4279A /*
BDSKGroupParentCell.h */,
@@ -3416,6 +3421,7 @@
F9DB895A08A54BBA00CB3D53 /* BDSKTeXTask.h */,
27AFAF9A080D1E1B0096F5D2 /*
BDSKTextImportController.h */,
CE33D604136AB73600ACE924 /*
BDSKTextImportItemTableView.h */,
+ CE963635283D292F00D8A983 /*
BDSKTextUndoManager.h */,
F98AA67F0971E3F400184BD8 /*
BDSKTextViewCompletionController.h */,
F9DCEA4D094B7D1100AEE662 /*
BDSKTextWithIconCell.h */,
CE8961850CBEB59800EA2D98 /* BDSKToken.h */,
@@ -3636,6 +3642,7 @@
CE2A0A45224599F600A8F31C /*
BDSKPreferenceRecord.h in Headers */,
CE2A0A5D22459A0A00A8F31C /* BDSKScriptHook.h in
Headers */,
CE2A0AC222459A4B00A8F31C /* html2tex.h in
Headers */,
+ CE963637283D292F00D8A983 /*
BDSKTextUndoManager.h in Headers */,
CE2A09D8224599B300A8F31C /*
BDSKCondition+Scripting.h in Headers */,
CE2A0A1D224599EF00A8F31C /*
BDSKISIGroupServer.h in Headers */,
CE5417CA22D4DA7700867189 /*
BDSKAuthenticationHandler.h in Headers */,
@@ -4626,6 +4633,7 @@
3D44F5630812A91D003C67F0 /* BDSKFormatParser.m
in Sources */,
CE0D24C9215A84F3001A3F47 /*
NSScriptCommand_BDSKExtensions.m in Sources */,
3D0D76B3084898C100A495A5 /* BibPref_Crossref.m
in Sources */,
+ CE963638283D292F00D8A983 /*
BDSKTextUndoManager.m in Sources */,
3D7406940849F5430081EC6F /*
BDSKTypeNameFormatter.m in Sources */,
F97965F2086909EA00050427 /*
BDSKFindController.m in Sources */,
CEA22F3F26B86A3900DFE422 /*
NSLayoutConstraint_BDSKExtensions.m in Sources */,
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit