Revision: 12961
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12961&view=rev
Author: hofman
Date: 2008-03-04 13:06:54 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
Add segmented controls to status bar to choose preview styles. Also allow
templates in the side pane and a fileview in the bottom pane.
Drop the custom details/notes/abstract previews, that should be done through
templates.
Use a custom segmented control to fit in the status bar.
Change preview style menu accordingly, and duplicate it for the side pane.
Use per-document settings for the preview. For now not saved to xattrs or
prefs, as we may still change the enum.
Modified Paths:
--------------
trunk/bibdesk/BDSKAppController.h
trunk/bibdesk/BDSKAppController.m
trunk/bibdesk/BibDocument+Menus.m
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibDocument_Actions.h
trunk/bibdesk/BibDocument_Actions.m
trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
trunk/bibdesk/NSImage_BDSKExtensions.h
trunk/bibdesk/NSImage_BDSKExtensions.m
Added Paths:
-----------
trunk/bibdesk/BDSKGradientSegmentedControl.h
trunk/bibdesk/BDSKGradientSegmentedControl.m
Modified: trunk/bibdesk/BDSKAppController.h
===================================================================
--- trunk/bibdesk/BDSKAppController.h 2008-03-04 06:45:30 UTC (rev 12960)
+++ trunk/bibdesk/BDSKAppController.h 2008-03-04 21:06:54 UTC (rev 12961)
@@ -61,6 +61,7 @@
IBOutlet NSMenu *groupSortMenu;
IBOutlet NSMenu *copyAsTemplateMenu;
IBOutlet NSMenu *previewDisplayMenu;
+ IBOutlet NSMenu *sidePreviewDisplayMenu;
IBOutlet NSMenu *searchBookmarksMenu;
IBOutlet NSMenu *bookmarksMenu;
Modified: trunk/bibdesk/BDSKAppController.m
===================================================================
--- trunk/bibdesk/BDSKAppController.m 2008-03-04 06:45:30 UTC (rev 12960)
+++ trunk/bibdesk/BDSKAppController.m 2008-03-04 21:06:54 UTC (rev 12961)
@@ -629,7 +629,7 @@
[item setTag:BDSKTemplateDragCopyType + i];
}
- } else if ([menu isEqual:previewDisplayMenu]) {
+ } else if ([menu isEqual:previewDisplayMenu] || [menu
isEqual:sidePreviewDisplayMenu]) {
NSMutableArray *styles = [NSMutableArray arrayWithArray:[BDSKTemplate
allStyleNamesForFileType:@"rtf"]];
[styles addObjectsFromArray:[BDSKTemplate
allStyleNamesForFileType:@"rtfd"]];
@@ -637,15 +637,16 @@
[styles addObjectsFromArray:[BDSKTemplate
allStyleNamesForFileType:@"html"]];
int i = [menu numberOfItems];
- while (i-- && [[menu itemAtIndex:i] tag] == 3)
+ while (i-- && [[menu itemAtIndex:i] isSeparatorItem] == NO)
[menu removeItemAtIndex:i];
NSMenuItem *item;
NSEnumerator *styleEnum = [styles objectEnumerator];
NSString *style;
+ SEL action = [menu isEqual:previewDisplayMenu] ?
@selector(changePreviewDisplay:) : @selector(changeSidePreviewDisplay:);
while (style = [styleEnum nextObject]) {
- item = [menu addItemWithTitle:style
action:@selector(changePreviewDisplay:) keyEquivalent:@""];
- [item setTag:BDSKTemplatePreviewDisplay];
+ item = [menu addItemWithTitle:style action:action
keyEquivalent:@""];
+ [item setTag:BDSKPreviewDisplayTemplate];
[item setRepresentedObject:style];
}
Added: trunk/bibdesk/BDSKGradientSegmentedControl.h
===================================================================
--- trunk/bibdesk/BDSKGradientSegmentedControl.h
(rev 0)
+++ trunk/bibdesk/BDSKGradientSegmentedControl.h 2008-03-04 21:06:54 UTC
(rev 12961)
@@ -0,0 +1,49 @@
+//
+// BDSKGradientSegmentedControl.h
+// Bibdesk
+//
+// Created by Christiaan Hofman on 3/4/08.
+/*
+ This software is Copyright (c) 2008
+ 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>
+
+
[EMAIL PROTECTED] BDSKGradientSegmentedControl : NSSegmentedControl
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] BDSKGradientSegmentedCell : NSSegmentedCell {
+ CGLayerRef layer;
+ CGLayerRef selectedLayer;
+}
[EMAIL PROTECTED]
Added: trunk/bibdesk/BDSKGradientSegmentedControl.m
===================================================================
--- trunk/bibdesk/BDSKGradientSegmentedControl.m
(rev 0)
+++ trunk/bibdesk/BDSKGradientSegmentedControl.m 2008-03-04 21:06:54 UTC
(rev 12961)
@@ -0,0 +1,215 @@
+//
+// BDSKGradientSegmentedControl.m
+// Bibdesk
+//
+// Created by Christiaan Hofman on 3/4/08.
+/*
+ This software is Copyright (c) 2008
+ 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 "BDSKGradientSegmentedControl.h"
+#import "NSGeometry_BDSKExtensions.h"
+#import "NSBezierPath_CoreImageExtensions.h"
+#import "CIImage_BDSKExtensions.h"
+#import "NSImage_BDSKExtensions.h"
+
+
+#define SEGMENTED_CONTROL_HEIGHT 20.0
+#define SEGMENTED_CONTROL_MARGIN 2.0
+
+
[EMAIL PROTECTED] BDSKGradientSegmentedControl
+
++ (Class)cellClass {
+ return [BDSKGradientSegmentedCell class];
+}
+
+- (id)initWithCoder:(NSCoder *)decoder {
+ if ([super initWithCoder:decoder]) {
+ if ([[self cell] isKindOfClass:[[self class] cellClass]] == NO) {
+ id cell = [[[[[self class] cellClass] alloc] init] autorelease];
+ id oldCell = [self cell];
+ unsigned int i, count = [self segmentCount];
+
+ [cell setSegmentCount:count];
+ [cell setTrackingMode:[oldCell trackingMode]];
+ [cell setAction:[oldCell action]];
+ [cell setTarget:[oldCell target]];
+ [cell setTag:[oldCell tag]];
+ [cell setEnabled:[oldCell isEnabled]];
+ [cell setBezeled:NO];
+ [cell setBordered:NO];
+
+ for (i = 0; i < count; i++) {
+ [cell setWidth:[oldCell widthForSegment:i] forSegment:i];
+ [cell setImage:[oldCell imageForSegment:i] forSegment:i];
+ [cell setLabel:[oldCell labelForSegment:i] forSegment:i];
+ [cell setToolTip:[oldCell toolTipForSegment:i] forSegment:i];
+ [cell setEnabled:[oldCell isEnabledForSegment:i] forSegment:i];
+ [cell setSelected:[oldCell isSelectedForSegment:i]
forSegment:i];
+ [cell setMenu:[oldCell menuForSegment:i] forSegment:i];
+ [cell setTag:[oldCell tagForSegment:i] forSegment:i];
+ }
+
+ [self setCell:cell];
+ }
+ NSRect frame = [self frame];
+ frame.size.height = SEGMENTED_CONTROL_HEIGHT;
+ [self setFrame:frame];
+ }
+ return self;
+}
+
+- (void)setFrame:(NSRect)newFrame {
+ newFrame.size.height = SEGMENTED_CONTROL_HEIGHT;
+ [super setFrame:newFrame];
+}
+
+- (void)setFrameSize:(NSSize)newFrameSize {
+ newFrameSize.height = SEGMENTED_CONTROL_HEIGHT;
+ [super setFrameSize:newFrameSize];
+}
+
[EMAIL PROTECTED]
+
+
[EMAIL PROTECTED] BDSKGradientSegmentedCell
+
+- (void)dealloc {
+ if (layer != NULL)
+ CGLayerRelease(layer);
+ if (selectedLayer != NULL)
+ CGLayerRelease(selectedLayer);
+ [super dealloc];
+}
+
+- (void)drawWithFrame:(NSRect)frame inView:(NSView *)controlView {
+ NSRect rect = NSInsetRect(frame, SEGMENTED_CONTROL_MARGIN, 0.0);
+ NSUInteger i, count = [self segmentCount];
+
+ [NSGraphicsContext saveGraphicsState];
+ [[NSColor colorWithCalibratedWhite:0.6 alpha:1.0] setFill];
+ NSRectFill(rect);
+ [NSGraphicsContext restoreGraphicsState];
+
+ rect = NSInsetRect(rect, 1.0, 0.0);
+ for (i = 0; i < count; i++) {
+ rect.size.width = [self widthForSegment:i];
+ [self drawSegment:i inFrame:rect withView:controlView];
+ rect.origin.x = NSMaxX(rect) + 1.0;
+ }
+}
+
+
+- (void)drawSegment:(NSInteger)segment inFrame:(NSRect)frame withView:(NSView
*)controlView {
+ CGContextRef viewContext = [[NSGraphicsContext currentContext]
graphicsPort];
+
+ // see bug #1834337; drawing the status bar gradient is apparently really
expensive on some hardware
+ // suggestion from Scott Thompson on quartz-dev was to use a CGLayer;
based on docs, this should be a good win
+ if (NULL == layer || NULL == selectedLayer) {
+ NSSize layerSize = NSMakeSize(1.0, SEGMENTED_CONTROL_HEIGHT);
+ NSRect layerRect = {NSZeroPoint, layerSize};
+ CGContextRef layerContext;
+ CIColor *startColor;
+ CIColor *endColor;
+
+ layer = CGLayerCreateWithContext(viewContext, *(CGSize *)&layerSize,
NULL);
+ selectedLayer = CGLayerCreateWithContext(viewContext, *(CGSize
*)&layerSize, NULL);
+
+ if ([controlView isFlipped]) {
+ startColor = [CIColor colorWithWhite:0.9];
+ endColor = [CIColor colorWithWhite:0.75];
+ } else {
+ startColor = [CIColor colorWithWhite:0.75];
+ endColor = [CIColor colorWithWhite:0.9];
+ }
+
+ layerContext = CGLayerGetContext(layer);
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:[NSGraphicsContext
graphicsContextWithGraphicsPort:layerContext flipped:NO]];
+ [[NSBezierPath bezierPathWithRect:layerRect]
fillPathVerticallyWithStartColor:startColor endColor:endColor];
+ [NSGraphicsContext restoreGraphicsState];
+
+ if ([controlView isFlipped]) {
+ startColor = [CIColor colorWithWhite:0.7];
+ endColor = [CIColor colorWithWhite:0.55];
+ } else {
+ startColor = [CIColor colorWithWhite:0.55];
+ endColor = [CIColor colorWithWhite:0.7];
+ }
+
+ layerContext = CGLayerGetContext(selectedLayer);
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:[NSGraphicsContext
graphicsContextWithGraphicsPort:layerContext flipped:NO]];
+ [[NSBezierPath bezierPathWithRect:layerRect]
fillPathVerticallyWithStartColor:startColor endColor:endColor];
+ [NSGraphicsContext restoreGraphicsState];
+ }
+
+ [NSGraphicsContext saveGraphicsState];
+ CGContextSetBlendMode(viewContext, kCGBlendModeNormal);
+ CGContextDrawLayerInRect(viewContext, *(CGRect *)&frame, [self
isSelectedForSegment:segment] ? selectedLayer : layer);
+ [NSGraphicsContext restoreGraphicsState];
+
+ NSImage *image = [self imageForSegment:segment];
+ NSRect rect = BDSKCenterRect(frame, [image size], [controlView isFlipped]);
+ NSRect fromRect = NSZeroRect;
+ fromRect.size = [image size];
+ if ([controlView isFlipped])
+ [image drawFlippedInRect:rect fromRect:fromRect
operation:NSCompositeSourceOver fraction:1.0];
+ else
+ [image drawInRect:rect fromRect:fromRect
operation:NSCompositeSourceOver fraction:1.0];
+
+ if ([self menuForSegment:segment]) {
+ CGFloat x = NSMaxX(frame) - 2.0;
+ CGFloat z = -3.0, y = NSMidY(frame);
+
+ if ([controlView isFlipped]) {
+ y = ceil(y) + 1.0;
+ z = 3.0;
+ } else {
+ y = floor(y) - 1.0;
+ }
+
+ NSBezierPath *arrowPath = [NSBezierPath bezierPath];
+ [arrowPath moveToPoint:NSMakePoint(x, y)];
+ [arrowPath relativeLineToPoint:NSMakePoint(-5.0, 0.0)];
+ [arrowPath relativeLineToPoint:NSMakePoint(2.5, z)];
+ [arrowPath closePath];
+
+ [NSGraphicsContext saveGraphicsState];
+ [[NSColor colorWithCalibratedWhite:0.0 alpha:0.8] setFill];
+ [arrowPath fill];
+ [NSGraphicsContext restoreGraphicsState];
+ }
+}
+
[EMAIL PROTECTED]
Modified: trunk/bibdesk/BibDocument+Menus.m
===================================================================
--- trunk/bibdesk/BibDocument+Menus.m 2008-03-04 06:45:30 UTC (rev 12960)
+++ trunk/bibdesk/BibDocument+Menus.m 2008-03-04 21:06:54 UTC (rev 12961)
@@ -530,16 +530,31 @@
}
- (BOOL)validateChangePreviewDisplayMenuItem:(NSMenuItem *)menuItem {
- OFPreferenceWrapper *pw = [OFPreferenceWrapper sharedPreferenceWrapper];
int tag = [menuItem tag], state = NSOffState;
NSString *style = [menuItem representedObject];
- if (tag == [pw integerForKey:BDSKPreviewDisplayKey] &&
- (tag != BDSKTemplatePreviewDisplay || [style isEqualToString:[pw
stringForKey:BDSKPreviewTemplateStyleKey]]))
+ if (tag == previewDisplay && tag != BDSKPreviewDisplayTemplate) {
state = NSOnState;
+ } else if (tag == BDSKPreviewDisplayTemplate && [style
isEqualToString:previewDisplayTemplate]) {
+ if (tag == previewDisplay || [menuItem menu] == templatePreviewMenu)
+ state = NSOnState;
+ }
[menuItem setState:state];
return YES;
}
+- (BOOL)validateChangeSidePreviewDisplayMenuItem:(NSMenuItem *)menuItem {
+ int tag = [menuItem tag], state = NSOffState;
+ NSString *style = [menuItem representedObject];
+ if (tag == sidePreviewDisplay && tag != BDSKPreviewDisplayTemplate) {
+ state = NSOnState;
+ } else if (tag == BDSKPreviewDisplayTemplate && [style
isEqualToString:sidePreviewDisplayTemplate]) {
+ if (tag == sidePreviewDisplay || [menuItem menu] ==
sideTemplatePreviewMenu)
+ state = NSOnState;
+ }
+ [menuItem setState:state];
+ return YES;
+}
+
- (BOOL)validateChangeIntersectGroupsMenuItem:(NSMenuItem *)menuItem {
[menuItem setState: ((BOOL)[menuItem tag] == [[OFPreferenceWrapper
sharedPreferenceWrapper] integerForKey:BDSKIntersectGroupsKey]) ? NSOnState :
NSOffState];
return YES;
@@ -817,6 +832,9 @@
else if (act == @selector(changePreviewDisplay:)){
return [self validateChangePreviewDisplayMenuItem:menuItem];
}
+ else if (act == @selector(changeSidePreviewDisplay:)){
+ return [self validateChangeSidePreviewDisplayMenuItem:menuItem];
+ }
else if (act == @selector(changeIntersectGroupsAction:)){
return [self validateChangeIntersectGroupsMenuItem:menuItem];
}
Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2008-03-04 06:45:30 UTC (rev 12960)
+++ trunk/bibdesk/BibDocument.h 2008-03-04 21:06:54 UTC (rev 12961)
@@ -82,6 +82,12 @@
BDSKLinkedFilePreviewDisplay = 6
};
+enum {
+ BDSKPreviewDisplayTemplate = 0,
+ BDSKPreviewDisplayFiles = 1,
+ BDSKPreviewDisplayTeX = 2
+};
+
// our main document types
extern NSString *BDSKBibTeXDocumentType;
extern NSString *BDSKRISDocumentType;
@@ -136,12 +142,19 @@
#pragma mark File pane variables
IBOutlet FileView *fileView;
- IBOutlet NSSlider *fileViewSlider;
+ NSTextView *sidePreviewTextView;
+ NSView *currentSidePreviewView;
IBOutlet BDSKCollapsibleView *fileCollapsibleView;
IBOutlet BDSKGradientView *fileGradientView;
BDSKFileMigrationController *migrationController;
+ int sidePreviewDisplay;
+ NSString *sidePreviewDisplayTemplate;
+
+ IBOutlet NSSegmentedControl *sidePreviewButton;
+ NSMenu *sideTemplatePreviewMenu;
+
#pragma mark Preview variables
IBOutlet NSTextView *previewTextView;
@@ -150,7 +163,14 @@
BDSKEdgeView *previewerBox;
BDSKZoomablePDFView *previewPdfView;
BDSKEdgeView *previewBox;
+ FileView *bottomFileView;
+
+ int previewDisplay;
+ NSString *previewDisplayTemplate;
+ IBOutlet NSSegmentedControl *previewButton;
+ NSMenu *templatePreviewMenu;
+
#pragma mark Toolbar variables
NSMutableDictionary *toolbarItems;
@@ -310,6 +330,7 @@
*/
- (void)updatePreviewPane;
+- (void)updateSidePreviewPane;
/*!
@method bibTeXStringForPublications
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2008-03-04 06:45:30 UTC (rev 12960)
+++ trunk/bibdesk/BibDocument.m 2008-03-04 21:06:54 UTC (rev 12961)
@@ -124,6 +124,8 @@
#import "BDSKFileMigrationController.h"
#import "NSViewAnimation_BDSKExtensions.h"
#import "BDSKDocumentSearch.h"
+#import "NSImage_BDSKExtensions.h"
+#import "BDSKPreviewTextView.h"
// these are the same as in Info.plist
NSString *BDSKBibTeXDocumentType = @"BibTeX Database";
@@ -199,6 +201,12 @@
@implementation BibDocument
++ (void)initialize {
+ OBINITIALIZE;
+
+ [NSImage makePreviewDisplayImages];
+}
+
- (id)init{
if(self = [super init]){
publications = [[BDSKPublicationsArray alloc] initWithCapacity:1];
@@ -217,6 +225,11 @@
pboardHelper = [[BDSKItemPasteboardHelper alloc] init];
[pboardHelper setDelegate:self];
+ previewDisplay = BDSKPreviewDisplayTemplate;
+ previewDisplayTemplate = [[[OFPreferenceWrapper
sharedPreferenceWrapper] stringForKey:BDSKPreviewTemplateStyleKey] retain];
+ sidePreviewDisplay = BDSKPreviewDisplayFiles;
+ sidePreviewDisplayTemplate = [[[OFPreferenceWrapper
sharedPreferenceWrapper] stringForKey:BDSKPreviewTemplateStyleKey] retain];
+
docState.isDocumentClosed = NO;
// need to set this for new documents
@@ -293,9 +306,14 @@
[statusBar release];
[[tableView enclosingScrollView] release];
[[previewTextView enclosingScrollView] release];
+ [[bottomFileView enclosingScrollView] release];
+ [[fileView enclosingScrollView] release];
+ [[sidePreviewTextView enclosingScrollView] release];
[previewer release];
[previewerBox release];
[previewBox release];
+ [previewDisplayTemplate release];
+ [sidePreviewDisplayTemplate release];
[macroWC release];
[infoWC release];
[promiseDragColumnIdentifier release];
@@ -411,7 +429,16 @@
[[mainBox superview] addSubview:statusBar
positioned:NSWindowBelow relativeTo:nil];
}
[statusBar
setProgressIndicatorStyle:BDSKProgressIndicatorSpinningStyle];
+ [statusBar setTextOffset:NSMaxX([previewButton frame]) - 2.0];
+ templatePreviewMenu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init]
autorelease];
+ [templatePreviewMenu setDelegate:self];
+ [previewButton setMenu:templatePreviewMenu forSegment:0];
+
+ sideTemplatePreviewMenu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init]
autorelease];
+ [sideTemplatePreviewMenu setDelegate:self];
+ [sidePreviewButton setMenu:sideTemplatePreviewMenu forSegment:0];
+
// This must also be done before we resize the window and the splitViews
[groupCollapsibleView setCollapseEdges:BDSKMinXEdgeMask];
[groupCollapsibleView setMinSize:NSMakeSize(56.0, 20.0)];
@@ -483,17 +510,18 @@
[fileView setBackgroundColor:[[fileView enclosingScrollView]
backgroundColor]];
- [fileCollapsibleView setCollapseEdges:BDSKMinXEdgeMask];
- [fileCollapsibleView setMinSize:NSMakeSize(100.0, 20.0)];
+ [fileCollapsibleView setCollapseEdges:BDSKMaxXEdgeMask];
+ [fileCollapsibleView setMinSize:NSMakeSize(65.0, 20.0)];
[fileGradientView setUpperColor:[NSColor colorWithCalibratedWhite:0.9
alpha:1.0]];
[fileGradientView setLowerColor:[NSColor colorWithCalibratedWhite:0.75
alpha:1.0]];
[fileView setIconScale:[[OFPreferenceWrapper sharedPreferenceWrapper]
floatForKey:BDSKMainFileViewIconScaleKey]];
[fileView setAutoScales:YES];
- [fileViewSlider bind:@"value" toObject:fileView withKeyPath:@"iconScale"
options:nil];
- [fileViewSlider bind:@"hidden" toObject:fileView withKeyPath:@"autoScales"
options:nil];
[fileView addObserver:self forKeyPath:@"iconScale" options:0 context:NULL];
+ currentSidePreviewView = [fileView enclosingScrollView];
+ [currentSidePreviewView retain];
+
// ImagePopUpButtons setup
[actionMenuButton setShowsMenuWhenIconClicked:YES];
[[actionMenuButton cell] setAltersStateOfSelectedItem:NO];
@@ -602,8 +630,6 @@
pboardHelper = nil;
[fileView removeObserver:self forKeyPath:@"iconScale"];
- [fileViewSlider unbind:@"value"];
- [fileViewSlider unbind:@"hidden"];
[fileView setDataSource:nil];
[fileView setDelegate:nil];
@@ -2689,10 +2715,20 @@
}
- (void)handlePreviewDisplayChangedNotification:(NSNotification *)notification{
+ return;
// note: this is only supposed to handle the pretty-printed preview, /not/
the TeX preview
// don't update if the note was posted by editors that don't belong to us
- if ([notification object] == self || [notification object] == nil)
+ if ([notification object] == self || [notification object] == nil) {
[self updatePreviewPane];
+ [self updateSidePreviewPane];
+
+ int tag = [[OFPreferenceWrapper sharedPreferenceWrapper]
integerForKey:BDSKPreviewDisplayKey];
+ if (tag == BDSKNotesPreviewDisplay || tag ==
BDSKAbstractPreviewDisplay)
+ tag = BDSKDetailsPreviewDisplay;
+ else if (tag == BDSKRTFPreviewDisplay)
+ tag = BDSKPDFPreviewDisplay;
+ [previewButton selectSegmentWithTag:tag];
+ }
}
- (void)handleTeXPreviewNeedsUpdateNotification:(NSNotification *)notification{
@@ -2971,6 +3007,7 @@
//take care of the preview field (NSTextView below the pub table); if the
enumerator is nil, the view will get cleared out
[self updatePreviewPane];
+ [self updateSidePreviewPane];
if([[OFPreferenceWrapper sharedPreferenceWrapper]
boolForKey:BDSKUsesTeXKey] &&
[[BDSKPreviewer sharedPreviewer] isWindowVisible] &&
@@ -3008,8 +3045,7 @@
}
// may be the pdflatex or latex2rtf generated preview
- int displayType = [[OFPreferenceWrapper sharedPreferenceWrapper]
integerForKey:BDSKPreviewDisplayKey];
- NSView *view = displayType == BDSKRTFPreviewDisplay ? (NSView
*)[[previewer textView] enclosingScrollView] : (NSView *)previewerBox;
+ NSView *view = (NSView *)previewerBox;
if(currentPreviewView != view){
[view setFrame:[currentPreviewView frame]];
[[currentPreviewView superview] replaceSubview:currentPreviewView
with:view];
@@ -3143,9 +3179,42 @@
}
}
+- (void)displayFileViewInPreviewPane{
+ // set up the view hierarchy
+ if (bottomFileView == nil) {
+ bottomFileView = [[FileView alloc] init];
+ [bottomFileView setBackgroundColor:[NSColor controlBackgroundColor]];
+ [bottomFileView setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
+
+ NSScrollView *scrollView = [[NSScrollView alloc] init];
+ [scrollView setHasHorizontalScroller:YES];
+ [scrollView setHasVerticalScroller:YES];
+ [scrollView setAutohidesScrollers:YES];
+ [scrollView setBorderType:NSBezelBorder];
+ [scrollView setDrawsBackground:YES];
+ [scrollView setBackgroundColor:[NSColor controlBackgroundColor]];
+ [scrollView setDocumentView:bottomFileView];
+ [scrollView setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
+ [bottomFileView release];
+
+ [bottomFileView setDataSource:self];
+ [bottomFileView setDelegate:self];
+ }
+
+ NSView *view = [bottomFileView enclosingScrollView];
+ if(currentPreviewView != view){
+ [[previewer progressOverlay] remove];
+ [previewer updateWithBibTeXString:nil];
+ [view setFrame:[currentPreviewView frame]];
+ [[currentPreviewView superview] replaceSubview:currentPreviewView
with:view];
+ currentPreviewView = view;
+ }
+
+}
+
- (void)displayAttributedTextPreviewInPreviewPane{
- int displayType = [[OFPreferenceWrapper sharedPreferenceWrapper]
integerForKey:BDSKPreviewDisplayKey];
+ //int displayType = [[OFPreferenceWrapper sharedPreferenceWrapper]
integerForKey:BDSKPreviewDisplayKey];
NSView *view = [previewTextView enclosingScrollView];
@@ -3160,11 +3229,11 @@
if(NSIsEmptyRect([previewTextView visibleRect]))
return;
+ /*
static NSAttributedString *noAttrDoubleLineFeed = nil;
if(noAttrDoubleLineFeed == nil)
noAttrDoubleLineFeed = [[NSAttributedString alloc]
initWithString:@"\n\n" attributes:nil];
- NSArray *items = [self selectedPublications];
NSDictionary *bodyAttributes = nil;
NSDictionary *titleAttributes = nil;
if (displayType == BDSKNotesPreviewDisplay || displayType ==
BDSKAbstractPreviewDisplay) {
@@ -3172,7 +3241,9 @@
bodyAttributes = [[NSDictionary alloc]
initWithObjectsAndKeys:[cachedFonts objectForKey:@"Body"], NSFontAttributeName,
nil];
titleAttributes = [[NSDictionary alloc]
initWithObjectsAndKeys:[cachedFonts objectForKey:@"Body"], NSFontAttributeName,
[NSNumber numberWithBool:YES], NSUnderlineStyleAttributeName, nil];
}
+ */
+ NSArray *items = [self selectedPublications];
unsigned int maxItems = [[OFPreferenceWrapper sharedPreferenceWrapper]
integerForKey:BDSKPreviewMaxNumberKey];
if (maxItems > 0 && [items count] > maxItems)
@@ -3192,7 +3263,7 @@
[textStorage beginEditing];
[[textStorage mutableString] setString:@""];
-
+ /*
unsigned int numberOfSelectedPubs = [items count];
NSEnumerator *enumerator = [items objectEnumerator];
BibItem *pub = nil;
@@ -3240,9 +3311,9 @@
}
break;
case BDSKTemplatePreviewDisplay:
+*/
{
- NSString *style = [[OFPreferenceWrapper
sharedPreferenceWrapper] stringForKey:BDSKPreviewTemplateStyleKey];
- BDSKTemplate *template = [BDSKTemplate templateForStyle:style];
+ BDSKTemplate *template = [BDSKTemplate
templateForStyle:previewDisplayTemplate];
if (template == nil)
template = [BDSKTemplate templateForStyle:[BDSKTemplate
defaultStyleNameForFileType:@"rtf"]];
NSAttributedString *templateString;
@@ -3260,8 +3331,10 @@
[templateString release];
}
}
+ /*
break;
}
+ */
[textStorage endEditing];
[textStorage addLayoutManager:layoutManager];
@@ -3272,17 +3345,115 @@
}
- (void)updatePreviewPane{
- int displayType = [[OFPreferenceWrapper sharedPreferenceWrapper]
integerForKey:BDSKPreviewDisplayKey];
-
- if(displayType == BDSKPDFPreviewDisplay || displayType ==
BDSKRTFPreviewDisplay){
+ if(previewDisplay == BDSKPreviewDisplayTeX){
[self displayTeXPreviewInPreviewPane];
- }else if(displayType == BDSKLinkedFilePreviewDisplay){
- [self displayLinkedFileInPreviewPane];
+ }else if(previewDisplay == BDSKPreviewDisplayFiles){
+ [self displayFileViewInPreviewPane];
}else{
[self displayAttributedTextPreviewInPreviewPane];
}
}
+- (void)displayFileViewInSidePreviewPane{
+ NSView *view = [fileView enclosingScrollView];
+ if(currentSidePreviewView != view){
+ [view setFrame:[currentSidePreviewView frame]];
+ [[currentSidePreviewView superview]
replaceSubview:currentSidePreviewView with:view];
+ currentSidePreviewView = view;
+ }
+}
+
+- (void)displayAttributedTextPreviewInSidePreviewPane{
+
+ if (sidePreviewTextView == nil) {
+ sidePreviewTextView = [[BDSKPreviewTextView alloc] init];
+ [sidePreviewTextView setBackgroundColor:[NSColor
controlBackgroundColor]];
+ [sidePreviewTextView setEditable:NO];
+ [sidePreviewTextView setSelectable:YES];
+ [sidePreviewTextView setRichText:YES];
+ [sidePreviewTextView setUsesFontPanel:YES];
+ [sidePreviewTextView setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
+
+ NSScrollView *scrollView = [[NSScrollView alloc] init];
+ [scrollView setHasHorizontalScroller:YES];
+ [scrollView setHasVerticalScroller:YES];
+ [scrollView setAutohidesScrollers:YES];
+ [scrollView setBorderType:NSBezelBorder];
+ [scrollView setDrawsBackground:YES];
+ [scrollView setBackgroundColor:[NSColor controlBackgroundColor]];
+ [scrollView setDocumentView:sidePreviewTextView];
+ [scrollView setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
+ [sidePreviewTextView release];
+
+ [sidePreviewTextView setDelegate:self];
+ }
+
+ NSView *view = [sidePreviewTextView enclosingScrollView];
+
+ if(currentSidePreviewView != view){
+ [view setFrame:[currentSidePreviewView frame]];
+ [[currentSidePreviewView superview]
replaceSubview:currentSidePreviewView with:view];
+ currentSidePreviewView = view;
+ }
+
+ if(NSIsEmptyRect([sidePreviewTextView visibleRect]))
+ return;
+
+ NSArray *items = [self selectedPublications];
+ unsigned int maxItems = [[OFPreferenceWrapper sharedPreferenceWrapper]
integerForKey:BDSKPreviewMaxNumberKey];
+
+ if (maxItems > 0 && [items count] > maxItems)
+ items = [items subarrayWithRange:NSMakeRange(0, maxItems)];
+
+ NSTextStorage *textStorage = [sidePreviewTextView textStorage];
+
+ // do this _before_ messing with the text storage; otherwise you can have
a leftover selection that ends up being out of range
+ NSRange zeroRange = NSMakeRange(0, 0);
+ static NSArray *zeroRanges = nil;
+ if(!zeroRanges) zeroRanges = [[NSArray alloc] initWithObjects:[NSValue
valueWithRange:zeroRange], nil];
+ [sidePreviewTextView setSelectedRanges:zeroRanges];
+
+ NSLayoutManager *layoutManager = [[textStorage layoutManagers] lastObject];
+ [layoutManager retain];
+ [textStorage removeLayoutManager:layoutManager]; // optimization: make
sure the layout manager doesn't do any work while we're loading
+
+ [textStorage beginEditing];
+ [[textStorage mutableString] setString:@""];
+
+ BDSKTemplate *template = [BDSKTemplate
templateForStyle:sidePreviewDisplayTemplate];
+ if (template == nil)
+ template = [BDSKTemplate templateForStyle:[BDSKTemplate
defaultStyleNameForFileType:@"rtf"]];
+ NSAttributedString *templateString;
+
+ // make sure this is really one of the attributed string types...
+ if([template templateFormat] & BDSKRichTextTemplateFormat){
+ templateString = [BDSKTemplateObjectProxy
attributedStringByParsingTemplate:template withObject:self publications:items
documentAttributes:NULL];
+ [textStorage appendAttributedString:templateString];
+ } else if([template templateFormat] & BDSKTextTemplateFormat){
+ // parse as plain text, so the HTML is interpreted properly by
NSAttributedString
+ NSString *str = [BDSKTemplateObjectProxy
stringByParsingTemplate:template withObject:self publications:items];
+ // we generally assume UTF-8 encoding for all template-related files
+ templateString = [[NSAttributedString alloc] initWithHTML:[str
dataUsingEncoding:NSUTF8StringEncoding] documentAttributes:NULL];
+ [textStorage appendAttributedString:templateString];
+ [templateString release];
+ }
+
+ [textStorage endEditing];
+ [textStorage addLayoutManager:layoutManager];
+ [layoutManager release];
+
+ if([NSString isEmptyString:[searchField stringValue]] == NO)
+ [sidePreviewTextView highlightComponentsOfSearchString:[searchField
stringValue]];
+}
+
+- (void)updateSidePreviewPane{
+ if(sidePreviewDisplay == BDSKPreviewDisplayFiles){
+ [self displayFileViewInSidePreviewPane];
+ }else{
+ [self displayAttributedTextPreviewInSidePreviewPane];
+ }
+}
+
#pragma mark FileView
typedef struct _fileViewObjectContext {
@@ -3330,6 +3501,7 @@
shownFiles = nil;
[fileView reloadIcons];
+ [bottomFileView reloadIcons];
}
- (NSString *)fileView:(FileView *)aFileView
subtitleAtIndex:(NSUInteger)anIndex;
@@ -3600,6 +3772,32 @@
return menu;
}
+#pragma mark Template Menu
+
+- (void)menuNeedsUpdate:(NSMenu *)menu {
+ if (menu == templatePreviewMenu || menu == sideTemplatePreviewMenu) {
+ NSMutableArray *styles = [NSMutableArray arrayWithArray:[BDSKTemplate
allStyleNamesForFileType:@"rtf"]];
+ [styles addObjectsFromArray:[BDSKTemplate
allStyleNamesForFileType:@"rtfd"]];
+ [styles addObjectsFromArray:[BDSKTemplate
allStyleNamesForFileType:@"doc"]];
+ [styles addObjectsFromArray:[BDSKTemplate
allStyleNamesForFileType:@"html"]];
+
+ while ([menu numberOfItems])
+ [menu removeItemAtIndex:0];
+
+ NSEnumerator *styleEnum = [styles objectEnumerator];
+ NSString *style;
+ NSMenuItem *item;
+ SEL action = menu == templatePreviewMenu ?
@selector(changePreviewDisplay:) : @selector(changeSidePreviewDisplay:);
+
+ while (style = [styleEnum nextObject]) {
+ item = [menu addItemWithTitle:style action:action
keyEquivalent:@""];
+ [item setTarget:self];
+ [item setTag:BDSKPreviewDisplayTemplate];
+ [item setRepresentedObject:style];
+ }
+ }
+}
+
#pragma mark -
#pragma mark Printing support
Modified: trunk/bibdesk/BibDocument_Actions.h
===================================================================
--- trunk/bibdesk/BibDocument_Actions.h 2008-03-04 06:45:30 UTC (rev 12960)
+++ trunk/bibdesk/BibDocument_Actions.h 2008-03-04 21:06:54 UTC (rev 12961)
@@ -242,6 +242,7 @@
- (IBAction)changeGroupTableFont:(id)sender;
- (IBAction)changePreviewDisplay:(id)sender;
+- (IBAction)changeSidePreviewDisplay:(id)sender;
/*!
@method pageDownInPreview:
Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2008-03-04 06:45:30 UTC (rev 12960)
+++ trunk/bibdesk/BibDocument_Actions.m 2008-03-04 21:06:54 UTC (rev 12961)
@@ -1081,7 +1081,7 @@
if (firstResponder != groupTableView)
[documentWindow makeFirstResponder:groupTableView];
}
-
+/*
- (IBAction)changePreviewDisplay:(id)sender{
int tag = [sender tag];
NSString *style = [sender representedObject];
@@ -1099,7 +1099,49 @@
if (didChange)
[[NSNotificationCenter defaultCenter]
postNotificationName:BDSKPreviewDisplayChangedNotification object:nil];
}
+*/
+- (IBAction)changePreviewDisplay:(id)sender{
+ int tag = [sender respondsToSelector:@selector(selectedSegment)] ?
[[sender cell] tagForSegment:[sender selectedSegment]] : [sender tag];
+ NSString *style = [sender respondsToSelector:@selector(representedObject)]
? [sender representedObject] : nil;
+ BOOL changed = NO;
+
+ if (previewDisplay != tag) {
+ previewDisplay = tag;
+ changed = YES;
+ }
+ if (tag == BDSKPreviewDisplayTemplate && style && NO == [style
isEqualToString:previewDisplayTemplate]) {
+ [previewDisplayTemplate release];
+ previewDisplayTemplate = [style retain];
+ changed = YES;
+ }
+ if (changed) {
+ [self updatePreviewPane];
+ if ([sender isEqual:previewButton] == NO)
+ [previewButton selectSegmentWithTag:previewDisplay];
+ }
+}
+- (IBAction)changeSidePreviewDisplay:(id)sender{
+ int tag = [sender respondsToSelector:@selector(selectedSegment)] ?
[[sender cell] tagForSegment:[sender selectedSegment]] : [sender tag];
+ NSString *style = [sender respondsToSelector:@selector(representedObject)]
? [sender representedObject] : nil;
+ BOOL changed = NO;
+
+ if (sidePreviewDisplay != tag) {
+ sidePreviewDisplay = tag;
+ changed = YES;
+ }
+ if (tag == BDSKPreviewDisplayTemplate && style && NO == [style
isEqualToString:sidePreviewDisplayTemplate]) {
+ [sidePreviewDisplayTemplate release];
+ sidePreviewDisplayTemplate = [style retain];
+ changed = YES;
+ }
+ if (changed) {
+ [self updateSidePreviewPane];
+ if ([sender isEqual:sidePreviewButton] == NO)
+ [sidePreviewButton selectSegmentWithTag:sidePreviewDisplay];
+ }
+}
+
- (void)pageDownInPreview:(id)sender{
NSScrollView *scrollView = nil;
Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===================================================================
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2008-03-04 06:45:30 UTC
(rev 12960)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2008-03-04 21:06:54 UTC
(rev 12961)
@@ -257,6 +257,8 @@
CE8962CB0CBEC10700EA2D98 /* TemplateOptions.plist in Resources
*/ = {isa = PBXBuildFile; fileRef = CE8962CA0CBEC10700EA2D98 /*
TemplateOptions.plist */; };
CE8C731F0B0CA6C500E31E5A /* NSObject_BDSKExtensions.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE8C731D0B0CA6C500E31E5A /*
NSObject_BDSKExtensions.m */; };
CE8F83490AFB989C009EE6F9 /* BDSKThreadSafeMutableArray.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE8F83470AFB989B009EE6F9 /*
BDSKThreadSafeMutableArray.m */; };
+ CE92CE5D0D7D860E0031CA86 /* BDSKGradientSegmentedControl.h in
Headers */ = {isa = PBXBuildFile; fileRef = CE92CE5B0D7D860E0031CA86 /*
BDSKGradientSegmentedControl.h */; };
+ CE92CE5E0D7D860E0031CA86 /* BDSKGradientSegmentedControl.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE92CE5C0D7D860E0031CA86 /*
BDSKGradientSegmentedControl.m */; };
CE95A57C0A88883300334DFA /* BDSKReadMeController.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE95A57A0A88883300334DFA /*
BDSKReadMeController.m */; };
CE95AF180ADBE7C000CB20E7 /* BDSKTemplateObjectProxy.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE95AF160ADBE7C000CB20E7 /*
BDSKTemplateObjectProxy.m */; };
CE9666460B46B70C003BAB9A /* BDSKServerInfo.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE9666440B46B70C003BAB9A /* BDSKServerInfo.m */;
};
@@ -1167,6 +1169,8 @@
CE8C731D0B0CA6C500E31E5A /* NSObject_BDSKExtensions.m */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc;
path = NSObject_BDSKExtensions.m; sourceTree = "<group>"; };
CE8F83460AFB989B009EE6F9 /* BDSKThreadSafeMutableArray.h */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h;
path = BDSKThreadSafeMutableArray.h; sourceTree = "<group>"; };
CE8F83470AFB989B009EE6F9 /* BDSKThreadSafeMutableArray.m */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.objc; path = BDSKThreadSafeMutableArray.m; sourceTree = "<group>";
};
+ CE92CE5B0D7D860E0031CA86 /* BDSKGradientSegmentedControl.h */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h;
path = BDSKGradientSegmentedControl.h; sourceTree = "<group>"; };
+ CE92CE5C0D7D860E0031CA86 /* BDSKGradientSegmentedControl.m */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.objc; path = BDSKGradientSegmentedControl.m; sourceTree =
"<group>"; };
CE95A5790A88883300334DFA /* BDSKReadMeController.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
BDSKReadMeController.h; sourceTree = "<group>"; };
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>"; };
@@ -2058,6 +2062,8 @@
F9022C9A0758038000C3F701 /*
BDSKZoomableScrollView.m */,
CE27D95A0AF92BFD00419879 /*
BDSKZoomableTextView.m */,
F9A6772C07D2D57F00782ACD /* MultiplePageView.m
*/,
+ CE92CE5B0D7D860E0031CA86 /*
BDSKGradientSegmentedControl.h */,
+ CE92CE5C0D7D860E0031CA86 /*
BDSKGradientSegmentedControl.m */,
);
name = Views;
sourceTree = "<group>";
@@ -2902,6 +2908,7 @@
CE6DCA220D6A0237003A072F /*
BDSKCondition+Scripting.h in Headers */,
CE117D230D7047A5005BFCEB /*
NSScriptClassDescription_BDSKExtensions.h in Headers */,
CE05CF5D0D7743940034C2A8 /* WebURLsWithTitles.h
in Headers */,
+ CE92CE5D0D7D860E0031CA86 /*
BDSKGradientSegmentedControl.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3864,6 +3871,7 @@
CE3011BA0D5CC4D100C0B7FA /*
NSAppleEventDescriptor_BDSKExtensions.m in Sources */,
CE6DCA230D6A0237003A072F /*
BDSKCondition+Scripting.m in Sources */,
CE117D240D7047A5005BFCEB /*
NSScriptClassDescription_BDSKExtensions.m in Sources */,
+ CE92CE5E0D7D860E0031CA86 /*
BDSKGradientSegmentedControl.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/bibdesk/NSImage_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSImage_BDSKExtensions.h 2008-03-04 06:45:30 UTC (rev
12960)
+++ trunk/bibdesk/NSImage_BDSKExtensions.h 2008-03-04 21:06:54 UTC (rev
12961)
@@ -42,6 +42,8 @@
@interface NSImage (BDSKExtensions)
++ (void)makePreviewDisplayImages;
+
+ (NSImage *)iconWithSize:(NSSize)iconSize forToolboxCode:(OSType) code;
+ (NSImage *)imageWithLargeIconForToolboxCode:(OSType) code;
+ (NSImage *)missingFileImage;
Modified: trunk/bibdesk/NSImage_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSImage_BDSKExtensions.m 2008-03-04 06:45:30 UTC (rev
12960)
+++ trunk/bibdesk/NSImage_BDSKExtensions.m 2008-03-04 21:06:54 UTC (rev
12961)
@@ -43,6 +43,59 @@
@implementation NSImage (BDSKExtensions)
++ (void)makePreviewDisplayImages {
+ static NSImage *previewTemplateDisplayImage = nil;
+ static NSImage *previewIconDisplayImage = nil;
+ static NSImage *previewTeXDisplayImage = nil;
+
+ if (previewTemplateDisplayImage == nil) {
+ NSBezierPath *path;
+
+ previewTemplateDisplayImage = [[NSImage alloc]
initWithSize:NSMakeSize(11.0, 10.0)];
+ [previewTemplateDisplayImage lockFocus];
+ path = [NSBezierPath bezierPath];
+ [path moveToPoint:NSMakePoint(0.0, 0.5)];
+ [path lineToPoint:NSMakePoint(11.0, 0.5)];
+ [path moveToPoint:NSMakePoint(0.0, 3.5)];
+ [path lineToPoint:NSMakePoint(11.0, 3.5)];
+ [path moveToPoint:NSMakePoint(0.0, 6.5)];
+ [path lineToPoint:NSMakePoint(11.0, 6.5)];
+ [path moveToPoint:NSMakePoint(0.0, 9.5)];
+ [path lineToPoint:NSMakePoint(11.0, 9.5)];
+ [path stroke];
+ [previewTemplateDisplayImage unlockFocus];
+ [previewTemplateDisplayImage setName:@"BDSKPreviewTemplateDisplay"];
+
+ previewIconDisplayImage = [[NSImage alloc]
initWithSize:NSMakeSize(11.0, 10.0)];
+ [previewIconDisplayImage lockFocus];
+ path = [NSBezierPath bezierPath];
+ [path appendBezierPathWithRect:NSMakeRect(0.5, 0.5, 3.0, 3.0)];
+ [path appendBezierPathWithRect:NSMakeRect(7.5, 0.5, 3.0, 3.0)];
+ [path appendBezierPathWithRect:NSMakeRect(0.5, 6.5, 3.0, 3.0)];
+ [path appendBezierPathWithRect:NSMakeRect(7.5, 6.5, 3.0, 3.0)];
+ [path stroke];
+ [previewIconDisplayImage unlockFocus];
+ [previewIconDisplayImage setName:@"BDSKPreviewIconDisplay"];
+
+ previewTeXDisplayImage = [[NSImage alloc]
initWithSize:NSMakeSize(11.0, 10.0)];
+ [previewTeXDisplayImage lockFocus];
+ path = [NSBezierPath bezierPath];
+ [path appendBezierPathWithOvalInRect:NSMakeRect(1.5, 1.5, 3.0, 3.0)];
+ [path appendBezierPathWithOvalInRect:NSMakeRect(6.5, 1.5, 3.0, 3.0)];
+ [path moveToPoint:NSMakePoint(6.5, 3.0)];
+ [path appendBezierPathWithArcWithCenter:NSMakePoint(5.5, 3.0)
radius:1.0 startAngle:0.0 endAngle:180.0];
+ [path moveToPoint:NSMakePoint(1.5, 3.0)];
+ [path lineToPoint:NSMakePoint(0.5, 3.0)];
+ [path appendBezierPathWithArcFromPoint:NSMakePoint(2.5, 10.0)
toPoint:NSMakePoint(4.5, 8.0) radius:1.0];
+ [path moveToPoint:NSMakePoint(9.5, 3.0)];
+ [path lineToPoint:NSMakePoint(10.5, 3.0)];
+ [path appendBezierPathWithArcFromPoint:NSMakePoint(8.5, 10.0)
toPoint:NSMakePoint(6.5, 8.0) radius:1.0];
+ [path stroke];
+ [previewTeXDisplayImage unlockFocus];
+ [previewTeXDisplayImage setName:@"BDSKPreviewTeXDisplay"];
+ }
+}
+
+ (NSImage *)iconWithSize:(NSSize)iconSize forToolboxCode:(OSType) code {
int width = iconSize.width;
int height = iconSize.height;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit