Fix customize dialog with location bar NSTextView. Adds support for NSCoder

to support it and fixes some odd bugs we think might be in the OS. (bug 159781)
This commit is contained in:
pinkerton%netscape.com 2002-08-06 00:13:04 +00:00
Родитель f1af4bfbc0
Коммит 3f2b280aed
12 изменённых файлов: 388 добавлений и 80 удалений

Просмотреть файл

@ -437,6 +437,24 @@ static NSArray* sToolbarDefaults = nil;
NSToolbarItem* item = [[notification userInfo] objectForKey:@"item"];
if ( [[item itemIdentifier] isEqual:SidebarToolbarItemIdentifier] )
mSidebarToolbarItem = item;
else if ([[item itemIdentifier] isEqual:LocationToolbarItemIdentifier]) {
// For our custom location bar view, the custom toolbar dialog thinks it's ok
// to allow more than one of these. When we add it, scan the list and if it's
// already there, remove it. When creating a window, this code runs into problems
// (looks like a bug in OS X 10.1.5). Cocoa tries to add the buttons before the window
// is created and if it isn't, asking for an array of toolbar items leads
// to a crash (basically, it cycles through this method endlessly until it dies).
// Just ensure the window is visible before we ask for the array.
if ([[self window] isVisible]) {
NSArray *toolbarItemArray = [[notification object] items];
for (unsigned int i = 0;i < [toolbarItemArray count];i++) {
if ([[[toolbarItemArray objectAtIndex:i] itemIdentifier] isEqual:LocationToolbarItemIdentifier]) {
[[notification object] removeItemAtIndex:i];
return;
}
}
}
}
}
//

Просмотреть файл

@ -154,6 +154,27 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
}
//
// we need -initWithCoder & -encodeWithCoder for the toolbar customization palette.
// in OS X 10.1.5, cocoa doesn't help us out very much in encoding/decoding NSTextViews.
// Max Horn says 10.2 does more than 10.1.5, so this may not be necessay in the future.
//
-(id) initWithCoder:(NSCoder *)coder
{
if ((self = [super initWithFrame:NSMakeRect(0,0,0,0)]))
[self replaceCharactersInRange:NSMakeRange(0,[[self string] length]) withRTFD:[coder decodeObject]];
return self;
}
-(void) encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:[self RTFDFromRange:NSMakeRange(0,[[self string] length])]];
return;
}
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
@ -167,6 +188,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
NS_IF_RELEASE(mSession);
NS_IF_RELEASE(mResults);
NS_IF_RELEASE(mListener);
[super dealloc];
}
- (void) setSession:(NSString *)aSession

Просмотреть файл

@ -1,36 +1,72 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2002 Netscape Communications Corporation. All
* Rights Reserved.
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* David Hyatt <hyatt@netscape.com> (Original Author)
*/
* David Hyatt <hyatt@apple.com> (Original Author)
* David Haas <haasd@cae.wisc.edu>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import "CHLocationBar.h"
@implementation CHLocationBar
- (id)initWithFrame:(NSRect)frame {
if ( (self = [super initWithFrame:frame]) ) {
// Initialization code here.
//
// awakeAfterUsingCoder:
//
// We need this method for the toolbar customization palette.
// In OS X 10.1.5, cocoa doesn't automatically encode/decode
// NSTextViews, so we have to help it out. This may change
// in future releases. Max Horn says 10.2 already does more than 10.1.5 . . .
//
// Get the scrollview, pull out its document view (our text area) and set
// everything (ie, the internal clip view) to use that document. Since
// unarchiving never went through the proper channels to set the document
// of the scrollview, we have to help it along just a tad.
//
-(id) awakeAfterUsingCoder:(NSCoder *)coder
{
NSEnumerator *theSubviews = [[self subviews] objectEnumerator];
id aView;
while ((aView = [theSubviews nextObject])) {
if ([aView isMemberOfClass:[NSScrollView class]]) {
NSTextView* aTextView = [aView documentView]; // actually, it's a CHAutoCompleteTextView, but so what.
[aView setDocumentView:aTextView];
[aTextView setFrame:[[aView contentView] frame]];
}
}
return self;
}
}
- (void)drawRect:(NSRect)aRect {
// Frame the border.

Просмотреть файл

@ -154,6 +154,27 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
}
//
// we need -initWithCoder & -encodeWithCoder for the toolbar customization palette.
// in OS X 10.1.5, cocoa doesn't help us out very much in encoding/decoding NSTextViews.
// Max Horn says 10.2 does more than 10.1.5, so this may not be necessay in the future.
//
-(id) initWithCoder:(NSCoder *)coder
{
if ((self = [super initWithFrame:NSMakeRect(0,0,0,0)]))
[self replaceCharactersInRange:NSMakeRange(0,[[self string] length]) withRTFD:[coder decodeObject]];
return self;
}
-(void) encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:[self RTFDFromRange:NSMakeRange(0,[[self string] length])]];
return;
}
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
@ -167,6 +188,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
NS_IF_RELEASE(mSession);
NS_IF_RELEASE(mResults);
NS_IF_RELEASE(mListener);
[super dealloc];
}
- (void) setSession:(NSString *)aSession

Просмотреть файл

@ -437,6 +437,24 @@ static NSArray* sToolbarDefaults = nil;
NSToolbarItem* item = [[notification userInfo] objectForKey:@"item"];
if ( [[item itemIdentifier] isEqual:SidebarToolbarItemIdentifier] )
mSidebarToolbarItem = item;
else if ([[item itemIdentifier] isEqual:LocationToolbarItemIdentifier]) {
// For our custom location bar view, the custom toolbar dialog thinks it's ok
// to allow more than one of these. When we add it, scan the list and if it's
// already there, remove it. When creating a window, this code runs into problems
// (looks like a bug in OS X 10.1.5). Cocoa tries to add the buttons before the window
// is created and if it isn't, asking for an array of toolbar items leads
// to a crash (basically, it cycles through this method endlessly until it dies).
// Just ensure the window is visible before we ask for the array.
if ([[self window] isVisible]) {
NSArray *toolbarItemArray = [[notification object] items];
for (unsigned int i = 0;i < [toolbarItemArray count];i++) {
if ([[[toolbarItemArray objectAtIndex:i] itemIdentifier] isEqual:LocationToolbarItemIdentifier]) {
[[notification object] removeItemAtIndex:i];
return;
}
}
}
}
}
//

Просмотреть файл

@ -1,36 +1,72 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2002 Netscape Communications Corporation. All
* Rights Reserved.
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* David Hyatt <hyatt@netscape.com> (Original Author)
*/
* David Hyatt <hyatt@apple.com> (Original Author)
* David Haas <haasd@cae.wisc.edu>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import "CHLocationBar.h"
@implementation CHLocationBar
- (id)initWithFrame:(NSRect)frame {
if ( (self = [super initWithFrame:frame]) ) {
// Initialization code here.
//
// awakeAfterUsingCoder:
//
// We need this method for the toolbar customization palette.
// In OS X 10.1.5, cocoa doesn't automatically encode/decode
// NSTextViews, so we have to help it out. This may change
// in future releases. Max Horn says 10.2 already does more than 10.1.5 . . .
//
// Get the scrollview, pull out its document view (our text area) and set
// everything (ie, the internal clip view) to use that document. Since
// unarchiving never went through the proper channels to set the document
// of the scrollview, we have to help it along just a tad.
//
-(id) awakeAfterUsingCoder:(NSCoder *)coder
{
NSEnumerator *theSubviews = [[self subviews] objectEnumerator];
id aView;
while ((aView = [theSubviews nextObject])) {
if ([aView isMemberOfClass:[NSScrollView class]]) {
NSTextView* aTextView = [aView documentView]; // actually, it's a CHAutoCompleteTextView, but so what.
[aView setDocumentView:aTextView];
[aTextView setFrame:[[aView contentView] frame]];
}
}
return self;
}
}
- (void)drawRect:(NSRect)aRect {
// Frame the border.

Просмотреть файл

@ -437,6 +437,24 @@ static NSArray* sToolbarDefaults = nil;
NSToolbarItem* item = [[notification userInfo] objectForKey:@"item"];
if ( [[item itemIdentifier] isEqual:SidebarToolbarItemIdentifier] )
mSidebarToolbarItem = item;
else if ([[item itemIdentifier] isEqual:LocationToolbarItemIdentifier]) {
// For our custom location bar view, the custom toolbar dialog thinks it's ok
// to allow more than one of these. When we add it, scan the list and if it's
// already there, remove it. When creating a window, this code runs into problems
// (looks like a bug in OS X 10.1.5). Cocoa tries to add the buttons before the window
// is created and if it isn't, asking for an array of toolbar items leads
// to a crash (basically, it cycles through this method endlessly until it dies).
// Just ensure the window is visible before we ask for the array.
if ([[self window] isVisible]) {
NSArray *toolbarItemArray = [[notification object] items];
for (unsigned int i = 0;i < [toolbarItemArray count];i++) {
if ([[[toolbarItemArray objectAtIndex:i] itemIdentifier] isEqual:LocationToolbarItemIdentifier]) {
[[notification object] removeItemAtIndex:i];
return;
}
}
}
}
}
//

Просмотреть файл

@ -154,6 +154,27 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
}
//
// we need -initWithCoder & -encodeWithCoder for the toolbar customization palette.
// in OS X 10.1.5, cocoa doesn't help us out very much in encoding/decoding NSTextViews.
// Max Horn says 10.2 does more than 10.1.5, so this may not be necessay in the future.
//
-(id) initWithCoder:(NSCoder *)coder
{
if ((self = [super initWithFrame:NSMakeRect(0,0,0,0)]))
[self replaceCharactersInRange:NSMakeRange(0,[[self string] length]) withRTFD:[coder decodeObject]];
return self;
}
-(void) encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:[self RTFDFromRange:NSMakeRange(0,[[self string] length])]];
return;
}
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
@ -167,6 +188,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
NS_IF_RELEASE(mSession);
NS_IF_RELEASE(mResults);
NS_IF_RELEASE(mListener);
[super dealloc];
}
- (void) setSession:(NSString *)aSession

Просмотреть файл

@ -1,36 +1,72 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2002 Netscape Communications Corporation. All
* Rights Reserved.
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* David Hyatt <hyatt@netscape.com> (Original Author)
*/
* David Hyatt <hyatt@apple.com> (Original Author)
* David Haas <haasd@cae.wisc.edu>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import "CHLocationBar.h"
@implementation CHLocationBar
- (id)initWithFrame:(NSRect)frame {
if ( (self = [super initWithFrame:frame]) ) {
// Initialization code here.
//
// awakeAfterUsingCoder:
//
// We need this method for the toolbar customization palette.
// In OS X 10.1.5, cocoa doesn't automatically encode/decode
// NSTextViews, so we have to help it out. This may change
// in future releases. Max Horn says 10.2 already does more than 10.1.5 . . .
//
// Get the scrollview, pull out its document view (our text area) and set
// everything (ie, the internal clip view) to use that document. Since
// unarchiving never went through the proper channels to set the document
// of the scrollview, we have to help it along just a tad.
//
-(id) awakeAfterUsingCoder:(NSCoder *)coder
{
NSEnumerator *theSubviews = [[self subviews] objectEnumerator];
id aView;
while ((aView = [theSubviews nextObject])) {
if ([aView isMemberOfClass:[NSScrollView class]]) {
NSTextView* aTextView = [aView documentView]; // actually, it's a CHAutoCompleteTextView, but so what.
[aView setDocumentView:aTextView];
[aTextView setFrame:[[aView contentView] frame]];
}
}
return self;
}
}
- (void)drawRect:(NSRect)aRect {
// Frame the border.

Просмотреть файл

@ -154,6 +154,27 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
}
//
// we need -initWithCoder & -encodeWithCoder for the toolbar customization palette.
// in OS X 10.1.5, cocoa doesn't help us out very much in encoding/decoding NSTextViews.
// Max Horn says 10.2 does more than 10.1.5, so this may not be necessay in the future.
//
-(id) initWithCoder:(NSCoder *)coder
{
if ((self = [super initWithFrame:NSMakeRect(0,0,0,0)]))
[self replaceCharactersInRange:NSMakeRange(0,[[self string] length]) withRTFD:[coder decodeObject]];
return self;
}
-(void) encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:[self RTFDFromRange:NSMakeRange(0,[[self string] length])]];
return;
}
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
@ -167,6 +188,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
NS_IF_RELEASE(mSession);
NS_IF_RELEASE(mResults);
NS_IF_RELEASE(mListener);
[super dealloc];
}
- (void) setSession:(NSString *)aSession

Просмотреть файл

@ -437,6 +437,24 @@ static NSArray* sToolbarDefaults = nil;
NSToolbarItem* item = [[notification userInfo] objectForKey:@"item"];
if ( [[item itemIdentifier] isEqual:SidebarToolbarItemIdentifier] )
mSidebarToolbarItem = item;
else if ([[item itemIdentifier] isEqual:LocationToolbarItemIdentifier]) {
// For our custom location bar view, the custom toolbar dialog thinks it's ok
// to allow more than one of these. When we add it, scan the list and if it's
// already there, remove it. When creating a window, this code runs into problems
// (looks like a bug in OS X 10.1.5). Cocoa tries to add the buttons before the window
// is created and if it isn't, asking for an array of toolbar items leads
// to a crash (basically, it cycles through this method endlessly until it dies).
// Just ensure the window is visible before we ask for the array.
if ([[self window] isVisible]) {
NSArray *toolbarItemArray = [[notification object] items];
for (unsigned int i = 0;i < [toolbarItemArray count];i++) {
if ([[[toolbarItemArray objectAtIndex:i] itemIdentifier] isEqual:LocationToolbarItemIdentifier]) {
[[notification object] removeItemAtIndex:i];
return;
}
}
}
}
}
//

Просмотреть файл

@ -1,36 +1,72 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2002 Netscape Communications Corporation. All
* Rights Reserved.
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* David Hyatt <hyatt@netscape.com> (Original Author)
*/
* David Hyatt <hyatt@apple.com> (Original Author)
* David Haas <haasd@cae.wisc.edu>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import "CHLocationBar.h"
@implementation CHLocationBar
- (id)initWithFrame:(NSRect)frame {
if ( (self = [super initWithFrame:frame]) ) {
// Initialization code here.
//
// awakeAfterUsingCoder:
//
// We need this method for the toolbar customization palette.
// In OS X 10.1.5, cocoa doesn't automatically encode/decode
// NSTextViews, so we have to help it out. This may change
// in future releases. Max Horn says 10.2 already does more than 10.1.5 . . .
//
// Get the scrollview, pull out its document view (our text area) and set
// everything (ie, the internal clip view) to use that document. Since
// unarchiving never went through the proper channels to set the document
// of the scrollview, we have to help it along just a tad.
//
-(id) awakeAfterUsingCoder:(NSCoder *)coder
{
NSEnumerator *theSubviews = [[self subviews] objectEnumerator];
id aView;
while ((aView = [theSubviews nextObject])) {
if ([aView isMemberOfClass:[NSScrollView class]]) {
NSTextView* aTextView = [aView documentView]; // actually, it's a CHAutoCompleteTextView, but so what.
[aView setDocumentView:aTextView];
[aTextView setFrame:[[aView contentView] frame]];
}
}
return self;
}
}
- (void)drawRect:(NSRect)aRect {
// Frame the border.