Revision: 23803
          http://sourceforge.net/p/bibdesk/svn/23803
Author:   hofman
Date:     2019-05-10 09:30:35 +0000 (Fri, 10 May 2019)
Log Message:
-----------
add quick look touch bar item for editor

Modified Paths:
--------------
    trunk/bibdesk/BDSKEditor.h
    trunk/bibdesk/BDSKEditor.m

Modified: trunk/bibdesk/BDSKEditor.h
===================================================================
--- trunk/bibdesk/BDSKEditor.h  2019-05-10 06:31:09 UTC (rev 23802)
+++ trunk/bibdesk/BDSKEditor.h  2019-05-10 09:30:35 UTC (rev 23803)
@@ -45,6 +45,7 @@
 #import "BDSKCitationFormatter.h"
 #import <FileView/FileView.h>
 #import <Quartz/Quartz.h>
+#import "NSTouchBar_BDSKForwardDeclarations.h"
 
 @class BDSKRatingButton, BDSKRatingButtonCell, BDSKStatusBar, 
BDSKZoomablePDFView, BDSKEditorTableView, BDSKEditorTextView;
 @class BDSKComplexStringEditor, BDSKCiteKeyFormatter;
@@ -55,7 +56,7 @@
     @abstract WindowController for the edit window
     @discussion Subclass of the NSWindowController class, This handles making, 
reversing and keeping track of changes to the BibItem, and displaying a nice 
GUI.
 */
-@interface BDSKEditor : NSWindowController <NSWindowDelegate, 
NSTableViewDelegate, NSTableViewDataSource, NSSplitViewDelegate, 
NSControlTextEditingDelegate, BDSKStatusBarDelegate, 
BDSKComplexStringFormatterDelegate, BDSKCitationFormatterDelegate, 
FVFileViewDelegate, FVFileViewDataSource, QLPreviewPanelDelegate, 
QLPreviewPanelDataSource> {
+@interface BDSKEditor : NSWindowController <NSWindowDelegate, 
NSTableViewDelegate, NSTableViewDataSource, NSSplitViewDelegate, 
NSControlTextEditingDelegate, BDSKStatusBarDelegate, 
BDSKComplexStringFormatterDelegate, BDSKCitationFormatterDelegate, 
FVFileViewDelegate, FVFileViewDataSource, QLPreviewPanelDelegate, 
QLPreviewPanelDataSource, NSTouchBarDelegate> {
        IBOutlet NSSplitView *mainSplitView;
        IBOutlet NSSplitView *fileSplitView;
     IBOutlet NSPopUpButton *bibTypeButton;

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2019-05-10 06:31:09 UTC (rev 23802)
+++ trunk/bibdesk/BDSKEditor.m  2019-05-10 09:30:35 UTC (rev 23803)
@@ -95,6 +95,8 @@
 #define BDSKEditorMainSplitViewAutosaveName @"BDSKEditorMainSplitView"
 #define BDSKEditorFileSplitViewAutosaveName @"BDSKEditorFileSplitView"
 
+#define BDSKEditorQuickLookTouchBarItemIdentifier 
@"BDSKEditorQuickLookTouchBarItemIdentifier"
+
 static char BDSKEditorObservationContext;
 
 // offset of the table from the left window edge
@@ -3297,6 +3299,25 @@
     [sender adjustSubviews];
 }
 
+#pragma mark Touch Bar
+
+- (NSTouchBar *)makeTouchBar {
+    NSTouchBar *touchBar = [[[NSClassFromString(@"NSTouchBar") alloc] init] 
autorelease];
+    [touchBar setDelegate:self];
+    [touchBar setDefaultItemIdentifiers:[NSArray 
arrayWithObjects:BDSKEditorQuickLookTouchBarItemIdentifier, nil]];
+    return touchBar;
+}
+
+- (NSTouchBarItem *)touchBar:(NSTouchBar *)aTouchBar 
makeItemForIdentifier:(NSString *)identifier {
+    NSCustomTouchBarItem *item = nil;
+    if ([identifier 
isEqualToString:BDSKEditorQuickLookTouchBarItemIdentifier]) {
+        NSButton *button = [NSButton buttonWithImage:[NSImage 
imageNamed:NSImageNameTouchBarQuickLookTemplate] target:self 
action:@selector(previewAction:)];
+        item = [[[NSClassFromString(@"NSCustomTouchBarItem") alloc] 
initWithIdentifier:identifier] autorelease];
+        [(NSCustomTouchBarItem *)item setView:button];
+    }
+    return item;
+}
+
 @end
 
 @implementation BDSKEditor (Private)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to