Revision: 12270
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12270&view=rev
Author: hofman
Date: 2008-01-05 03:23:07 -0800 (Sat, 05 Jan 2008)
Log Message:
-----------
Use more appropriate windowController behavior. Load windows lazily when sheets
are shown instead of in init, and use windowDidLoad.
Modified Paths:
--------------
trunk/bibdesk/BDSKTextImportController.m
Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m 2008-01-05 06:46:09 UTC (rev
12269)
+++ trunk/bibdesk/BDSKTextImportController.m 2008-01-05 11:23:07 UTC (rev
12270)
@@ -126,18 +126,6 @@
crossrefFormatter = [[BDSKCrossrefFormatter alloc] init];
citationFormatter = [[BDSKCitationFormatter alloc]
initWithDelegate:self];
macroEditor = nil;
-
- [[NSNotificationCenter defaultCenter] addObserver:self
-
selector:@selector(handleFlagsChangedNotification:)
-
name:OAFlagsChangedNotification
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
-
selector:@selector(handleBibItemChangedNotification:)
-
name:BDSKBibItemChangedNotification
- object:nil];
- // make sure the window is loaded immediately
- [self window];
- OBPOSTCONDITION([self window]);
}
return self;
}
@@ -165,21 +153,30 @@
- (NSString *)windowNibName { return @"TextImport"; }
-- (void)awakeFromNib{
- [itemTableView registerForDraggedTypes:[NSArray
arrayWithObject:NSStringPboardType]];
+- (void)windowDidLoad{
[citeKeyField setFormatter:[[[BDSKCiteKeyFormatter alloc] init]
autorelease]];
[citeKeyField setStringValue:[item citeKey]];
+
[statusLine setStringValue:@""];
- [webViewBox setEdges:BDSKEveryEdgeMask];
+
+ [webViewBox setEdges:BDSKEveryEdgeMask];
[webViewBox setColor:[NSColor lightGrayColor] forEdge:NSMaxYEdge];
[webViewBox setContentView:webView];
+
[self setupTypeUI];
+
+ // these can be swapped in/out
[sourceBox retain];
[webViewView retain];
- [webView setEditingDelegate:self];
+
+ [webView setEditingDelegate:self];
+
+ [itemTableView registerForDraggedTypes:[NSArray
arrayWithObject:NSStringPboardType]];
[itemTableView setDoubleAction:@selector(addTextToCurrentFieldAction:)];
+
[self setWindowFrameAutosaveName:@"BDSKTextImportController Frame Autosave
Name"];
- // Set the properties of actionMenuButton that cannot be set in IB
+
+ // Set the properties of actionMenuButton that cannot be set in IB
[actionMenuButton setAlternateImage:[NSImage
imageNamed:@"Action_Pressed"]];
[actionMenuButton setArrowImage:nil];
[actionMenuButton setShowsMenuWhenIconClicked:YES];
@@ -187,6 +184,15 @@
[[actionMenuButton cell] setAlwaysUsesFirstItemAsSelected:NO];
[[actionMenuButton cell] setUsesItemFromMenu:NO];
[[actionMenuButton cell] setRefreshesMenu:NO];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+
selector:@selector(handleFlagsChangedNotification:)
+
name:OAFlagsChangedNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+
selector:@selector(handleBibItemChangedNotification:)
+
name:BDSKBibItemChangedNotification
+ object:nil];
}
#pragma mark Calling the main sheet
@@ -194,7 +200,7 @@
- (void)beginSheetForPasteboardModalForWindow:(NSWindow *)docWindow
modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector
contextInfo:(void *)contextInfo{
// we start with the pasteboard data, so we can directly show the main
sheet
// make sure we loaded the nib
- NSParameterAssert(nil != [self window]);
+ [self window];
[self loadPasteboardData];
[super beginSheetModalForWindow:docWindow modalDelegate:modalDelegate
didEndSelector:didEndSelector contextInfo:contextInfo];
@@ -203,7 +209,7 @@
- (void)beginSheetForWebModalForWindow:(NSWindow *)docWindow
modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector
contextInfo:(void *)contextInfo{
// we start with a webview, so we first ask for the URL to load
// make sure we loaded the nib;
- NSParameterAssert(nil != [self window]);
+ [self window];
[self setShowingWebView:YES];
// remember the arguments to pass in the callback later
@@ -224,7 +230,7 @@
- (void)beginSheetForFileModalForWindow:(NSWindow *)docWindow
modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector
contextInfo:(void *)contextInfo{
// we start with a file, so we first ask for the file to load
// make sure we loaded the nib
- NSParameterAssert(nil != [self window]);
+ [self window];
// remember the arguments to pass in the callback later
theModalDelegate = modalDelegate;
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 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit