Revision: 12963
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12963&view=rev
Author: hofman
Date: 2008-03-04 14:12:19 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
Disable tex preview segment when tex preview is disabled.
Modified Paths:
--------------
trunk/bibdesk/BDSKGradientSegmentedControl.m
trunk/bibdesk/BibDocument+Menus.m
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m
Modified: trunk/bibdesk/BDSKGradientSegmentedControl.m
===================================================================
--- trunk/bibdesk/BDSKGradientSegmentedControl.m 2008-03-04 21:23:41 UTC
(rev 12962)
+++ trunk/bibdesk/BDSKGradientSegmentedControl.m 2008-03-04 22:12:19 UTC
(rev 12963)
@@ -182,11 +182,12 @@
NSImage *image = [self imageForSegment:segment];
NSRect rect = BDSKCenterRect(frame, [image size], [controlView isFlipped]);
NSRect fromRect = NSZeroRect;
+ CGFloat f = [self isEnabledForSegment:segment] ? 1.0 : 0.5;
fromRect.size = [image size];
if ([controlView isFlipped])
- [image drawFlippedInRect:rect fromRect:fromRect
operation:NSCompositeSourceOver fraction:1.0];
+ [image drawFlippedInRect:rect fromRect:fromRect
operation:NSCompositeSourceOver fraction:f];
else
- [image drawInRect:rect fromRect:fromRect
operation:NSCompositeSourceOver fraction:1.0];
+ [image drawInRect:rect fromRect:fromRect
operation:NSCompositeSourceOver fraction:f];
if ([self menuForSegment:segment]) {
CGFloat x = NSMaxX(frame) - 2.0;
@@ -206,7 +207,7 @@
[arrowPath closePath];
[NSGraphicsContext saveGraphicsState];
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.8] setFill];
+ [[NSColor colorWithCalibratedWhite:0.0 alpha:0.8 * f] setFill];
[arrowPath fill];
[NSGraphicsContext restoreGraphicsState];
}
Modified: trunk/bibdesk/BibDocument+Menus.m
===================================================================
--- trunk/bibdesk/BibDocument+Menus.m 2008-03-04 21:23:41 UTC (rev 12962)
+++ trunk/bibdesk/BibDocument+Menus.m 2008-03-04 22:12:19 UTC (rev 12963)
@@ -539,7 +539,7 @@
state = NSOnState;
}
[menuItem setState:state];
- return YES;
+ return tag != BDSKPreviewDisplayTeX || [[OFPreferenceWrapper
sharedPreferenceWrapper] boolForKey:BDSKUsesTeXKey];
}
- (BOOL)validateChangeSidePreviewDisplayMenuItem:(NSMenuItem *)menuItem {
@@ -552,7 +552,7 @@
state = NSOnState;
}
[menuItem setState:state];
- return YES;
+ return tag != BDSKPreviewDisplayTeX || [[OFPreferenceWrapper
sharedPreferenceWrapper] boolForKey:BDSKUsesTeXKey];
}
- (BOOL)validateChangeIntersectGroupsMenuItem:(NSMenuItem *)menuItem {
Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2008-03-04 21:23:41 UTC (rev 12962)
+++ trunk/bibdesk/BibDocument.h 2008-03-04 22:12:19 UTC (rev 12963)
@@ -454,6 +454,7 @@
*/
- (void)handlePreviewDisplayChangedNotification:(NSNotification *)notification;
- (void)handleTeXPreviewNeedsUpdateNotification:(NSNotification *)notification;
+- (void)handleUsesTeXChangedNotification:(NSNotification *)notification;
- (void)handleIgnoredSortTermsChangedNotification:(NSNotification
*)notification;
- (void)handleNameDisplayChangedNotification:(NSNotification *)notification;
- (void)handleFlagsChangedNotification:(NSNotification *)notification;
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2008-03-04 21:23:41 UTC (rev 12962)
+++ trunk/bibdesk/BibDocument.m 2008-03-04 22:12:19 UTC (rev 12963)
@@ -434,6 +434,7 @@
templatePreviewMenu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init]
autorelease];
[templatePreviewMenu setDelegate:self];
[previewButton setMenu:templatePreviewMenu forSegment:0];
+ [previewButton setEnabled:[pw boolForKey:BDSKUsesTeXKey]
forSegment:BDSKPreviewDisplayTeX];
sideTemplatePreviewMenu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init]
autorelease];
[sideTemplatePreviewMenu setDelegate:self];
@@ -573,7 +574,7 @@
[self updateCategoryGroupsPreservingSelection:NO];
[saveTextEncodingPopupButton setEncoding:0];
-
+
}
- (BOOL)undoManagerShouldUndoChange:(id)sender{
@@ -2712,7 +2713,10 @@
[OFPreference addObserver:self
selector:@selector(handleTeXPreviewNeedsUpdateNotification:)
forPreference:[OFPreference
preferenceForKey:BDSKBTStyleKey]];
-}
+ [OFPreference addObserver:self
+ selector:@selector(handleUsesTeXChangedNotification:)
+ forPreference:[OFPreference
preferenceForKey:BDSKUsesTeXKey]];
+}
- (void)handlePreviewDisplayChangedNotification:(NSNotification *)notification{
return;
@@ -2740,6 +2744,10 @@
[self updatePreviewer:[BDSKPreviewer sharedPreviewer]];
}
+- (void)handleUsesTeXChangedNotification:(NSNotification *)notification{
+ [previewButton setEnabled:[[OFPreferenceWrapper sharedPreferenceWrapper]
boolForKey:BDSKUsesTeXKey] forSegment:BDSKPreviewDisplayTeX];
+}
+
- (void)handleBibItemAddDelNotification:(NSNotification *)notification{
// NB: this method gets called for setPublications: also, so checking for
AddItemNotification might not do what you expect
BOOL isDelete = [[notification name]
isEqualToString:BDSKDocDelItemNotification];
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