зеркало из https://github.com/mozilla/pjs.git
Fixes crash when selecting text during URL load, adds undo/redo to url bar,
reduces the number of times we load about:blank to 1 per window, fixes unicode characters in bookmarks. (bug 149198, 153263, 155710)
This commit is contained in:
Родитель
f95e458789
Коммит
3e601834c0
|
@ -206,8 +206,8 @@
|
||||||
isGroup = YES;
|
isGroup = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* titleC = [[[mBrowserWindowController getAddBookmarkTitle] stringValue] cString];
|
nsAutoString title;
|
||||||
nsAutoString title; title.AssignWithConversion(titleC);
|
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
|
||||||
|
|
||||||
nsAutoString tagName;
|
nsAutoString tagName;
|
||||||
if (mCachedHref)
|
if (mCachedHref)
|
||||||
|
@ -224,7 +224,8 @@
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
|
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
|
||||||
|
|
||||||
if (mCachedHref) {
|
if (mCachedHref) {
|
||||||
nsAutoString href; href.AssignWithConversion([mCachedHref cString]);
|
nsAutoString href;
|
||||||
|
NSStringTo_nsString(mCachedHref, href);
|
||||||
[mCachedHref release];
|
[mCachedHref release];
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1214,8 +1214,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
|
||||||
nsCOMPtr<nsIDOMElement> beforeElt;
|
nsCOMPtr<nsIDOMElement> beforeElt;
|
||||||
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
||||||
|
|
||||||
nsAutoString url; url.AssignWithConversion([[data objectForKey:@"url"] cString]);
|
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
|
||||||
nsAutoString title; title.AssignWithConversion([[data objectForKey:@"title"] cString]);
|
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
|
||||||
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
@interface BrowserWindow : NSWindow
|
@interface BrowserWindow : NSWindow
|
||||||
{
|
{
|
||||||
IBOutlet id mAutoCompleteTextField;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL) makeFirstResponder:(NSResponder*) responder;
|
-(BOOL) makeFirstResponder:(NSResponder*) responder;
|
||||||
|
|
|
@ -1,25 +1,8 @@
|
||||||
#import "BrowserWindow.h"
|
#import "BrowserWindow.h"
|
||||||
#import "CHAutoCompleteTextField.h"
|
|
||||||
#import "BrowserWindowController.h"
|
#import "BrowserWindowController.h"
|
||||||
|
|
||||||
static const int kEscapeKeyCode = 53;
|
|
||||||
|
|
||||||
@implementation BrowserWindow
|
@implementation BrowserWindow
|
||||||
|
|
||||||
- (void)sendEvent:(NSEvent *)theEvent
|
|
||||||
{
|
|
||||||
// We need this hack because NSWindow::sendEvent will eat the escape key
|
|
||||||
// and won't pass it down to the key handler of responders in the window.
|
|
||||||
// We have to override sendEvent for all of our escape key needs.
|
|
||||||
if ([theEvent keyCode] == kEscapeKeyCode && [theEvent type] == NSKeyDown) {
|
|
||||||
NSText *fieldEditor = [self fieldEditor:NO forObject:mAutoCompleteTextField];
|
|
||||||
if (fieldEditor && [self firstResponder] == fieldEditor) {
|
|
||||||
[mAutoCompleteTextField revertText];
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
[super sendEvent:theEvent];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)makeFirstResponder:(NSResponder*)responder
|
- (BOOL)makeFirstResponder:(NSResponder*)responder
|
||||||
{
|
{
|
||||||
NSResponder* oldResponder = [self firstResponder];
|
NSResponder* oldResponder = [self firstResponder];
|
||||||
|
|
|
@ -50,34 +50,34 @@
|
||||||
CLASS = BrowserWindowController;
|
CLASS = BrowserWindowController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
mAddBookmarkCheckbox = id;
|
mAddBookmarkCheckbox = NSButton;
|
||||||
mAddBookmarkFolderField = id;
|
mAddBookmarkFolderField = NSPopUpButton;
|
||||||
mAddBookmarkSheetWindow = id;
|
mAddBookmarkSheetWindow = NSWindow;
|
||||||
mAddBookmarkTitleField = id;
|
mAddBookmarkTitleField = NSTextField;
|
||||||
mBackItem = id;
|
mBackItem = NSMenuItem;
|
||||||
mCachedBMDS = id;
|
mCachedBMDS = id;
|
||||||
mForwardItem = id;
|
mForwardItem = NSMenuItem;
|
||||||
mHistoryDataSource = id;
|
mHistoryDataSource = CHHistoryDataSource;
|
||||||
mImageLinkMenu = id;
|
mImageLinkMenu = NSMenu;
|
||||||
mImageMenu = id;
|
mImageMenu = NSMenu;
|
||||||
mInputMenu = id;
|
mInputMenu = NSMenu;
|
||||||
mLinkMenu = id;
|
mLinkMenu = NSMenu;
|
||||||
mLocationSheetURLField = id;
|
mLocationSheetURLField = NSTextField;
|
||||||
mLocationSheetWindow = id;
|
mLocationSheetWindow = NSWindow;
|
||||||
mLocationToolbarView = id;
|
mLocationToolbarView = NSView;
|
||||||
mLock = NSImageView;
|
mLock = NSImageView;
|
||||||
mPageMenu = id;
|
mPageMenu = NSMenu;
|
||||||
mPersonalToolbar = CHBookmarksToolbar;
|
mPersonalToolbar = CHBookmarksToolbar;
|
||||||
mProgress = NSProgressIndicator;
|
mProgress = NSProgressIndicator;
|
||||||
mSidebarBookmarksDataSource = id;
|
mSidebarBookmarksDataSource = BookmarksDataSource;
|
||||||
mSidebarBrowserView = id;
|
mSidebarBrowserView = id;
|
||||||
mSidebarDrawer = NSDrawer;
|
mSidebarDrawer = NSDrawer;
|
||||||
mSidebarSourceTabView = id;
|
mSidebarSourceTabView = NSTabView;
|
||||||
mSidebarTabView = id;
|
mSidebarTabView = NSTabView;
|
||||||
mStatus = NSTextField;
|
mStatus = NSTextField;
|
||||||
mStatusBar = NSView;
|
mStatusBar = NSView;
|
||||||
mTabBrowser = id;
|
mTabBrowser = CHExtendedTabView;
|
||||||
mURLBar = NSTextField;
|
mURLBar = NSTextView;
|
||||||
};
|
};
|
||||||
SUPERCLASS = NSWindowController;
|
SUPERCLASS = NSWindowController;
|
||||||
},
|
},
|
||||||
|
@ -89,6 +89,13 @@
|
||||||
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
SUPERCLASS = NSTextField;
|
SUPERCLASS = NSTextField;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
|
||||||
|
CLASS = CHAutoCompleteTextView;
|
||||||
|
LANGUAGE = ObjC;
|
||||||
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
|
SUPERCLASS = NSTextView;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
CLASS = CHBookmarksOutlineView;
|
CLASS = CHBookmarksOutlineView;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>56 77 632 495 0 0 1152 746 </string>
|
<string>174 64 632 495 0 0 1152 848 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>124</key>
|
<key>124</key>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
<key>463</key>
|
<key>463</key>
|
||||||
<string>22 619 200 180 0 0 1152 848 </string>
|
<string>22 619 200 180 0 0 1152 848 </string>
|
||||||
<key>56</key>
|
<key>56</key>
|
||||||
<string>442 634 343 68 0 0 1280 1002 </string>
|
<string>403 587 360 76 0 0 1152 848 </string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBFramework Version</key>
|
<key>IBFramework Version</key>
|
||||||
<string>248.0</string>
|
<string>248.0</string>
|
||||||
|
@ -43,10 +43,7 @@
|
||||||
</array>
|
</array>
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>297</integer>
|
<integer>56</integer>
|
||||||
<integer>463</integer>
|
|
||||||
<integer>336</integer>
|
|
||||||
<integer>314</integer>
|
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S60</string>
|
<string>5S60</string>
|
||||||
|
|
Двоичный файл не отображается.
|
@ -86,7 +86,7 @@ class nsIDOMNode;
|
||||||
IBOutlet NSTabView* mSidebarTabView;
|
IBOutlet NSTabView* mSidebarTabView;
|
||||||
IBOutlet NSTabView* mSidebarSourceTabView;
|
IBOutlet NSTabView* mSidebarSourceTabView;
|
||||||
IBOutlet NSView* mLocationToolbarView;
|
IBOutlet NSView* mLocationToolbarView;
|
||||||
IBOutlet NSTextField* mURLBar;
|
IBOutlet NSTextView* mURLBar;
|
||||||
IBOutlet NSTextField* mStatus;
|
IBOutlet NSTextField* mStatus;
|
||||||
IBOutlet NSProgressIndicator* mProgress;
|
IBOutlet NSProgressIndicator* mProgress;
|
||||||
IBOutlet NSImageView* mLock;
|
IBOutlet NSImageView* mLock;
|
||||||
|
@ -166,7 +166,6 @@ class nsIDOMNode;
|
||||||
|
|
||||||
- (void)performAppropriateLocationAction;
|
- (void)performAppropriateLocationAction;
|
||||||
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
|
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
|
||||||
- (void)focusURLBar;
|
|
||||||
- (void)beginLocationSheet;
|
- (void)beginLocationSheet;
|
||||||
- (IBAction)endLocationSheet:(id)sender;
|
- (IBAction)endLocationSheet:(id)sender;
|
||||||
- (IBAction)cancelLocationSheet:(id)sender;
|
- (IBAction)cancelLocationSheet:(id)sender;
|
||||||
|
@ -175,6 +174,8 @@ class nsIDOMNode;
|
||||||
- (IBAction)endAddBookmarkSheet:(id)sender;
|
- (IBAction)endAddBookmarkSheet:(id)sender;
|
||||||
- (void)cacheBookmarkDS: (id)aDS;
|
- (void)cacheBookmarkDS: (id)aDS;
|
||||||
|
|
||||||
|
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize;
|
||||||
|
|
||||||
- (IBAction)viewSource:(id)aSender;
|
- (IBAction)viewSource:(id)aSender;
|
||||||
|
|
||||||
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;
|
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;
|
||||||
|
|
|
@ -272,8 +272,6 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
[mProgress retain];
|
[mProgress retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
[[mURLBar cell] setImage: [NSImage imageNamed:@"smallbookmark"]];
|
|
||||||
|
|
||||||
// Get our saved dimensions.
|
// Get our saved dimensions.
|
||||||
[[self window] setFrameUsingName: @"NavigatorWindow"];
|
[[self window] setFrameUsingName: @"NavigatorWindow"];
|
||||||
|
|
||||||
|
@ -328,6 +326,13 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
|
||||||
|
{
|
||||||
|
//if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
|
||||||
|
// return [[self window] frame].size;
|
||||||
|
return proposedFrameSize;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)drawerWillOpen: (NSNotification*)aNotification
|
- (void)drawerWillOpen: (NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
[mSidebarBookmarksDataSource ensureBookmarks];
|
[mSidebarBookmarksDataSource ensureBookmarks];
|
||||||
|
@ -631,7 +636,8 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
|
|
||||||
- (void)focusURLBar
|
- (void)focusURLBar
|
||||||
{
|
{
|
||||||
[mURLBar selectText: self];
|
[[self window] makeFirstResponder:mURLBar];
|
||||||
|
[mURLBar selectAll: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)beginLocationSheet
|
- (void)beginLocationSheet
|
||||||
|
@ -702,7 +708,7 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
- (IBAction)goToLocationFromToolbarURLField:(id)sender
|
- (IBAction)goToLocationFromToolbarURLField:(id)sender
|
||||||
{
|
{
|
||||||
// trim off any whitespace around url
|
// trim off any whitespace around url
|
||||||
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender stringValue]];
|
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender string]];
|
||||||
CFStringTrimWhitespace((CFMutableStringRef)theURL);
|
CFStringTrimWhitespace((CFMutableStringRef)theURL);
|
||||||
[self loadURL:theURL referrer:nil];
|
[self loadURL:theURL referrer:nil];
|
||||||
[theURL release];
|
[theURL release];
|
||||||
|
@ -753,7 +759,7 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
// Get the users preferred search engine from IC
|
// Get the users preferred search engine from IC
|
||||||
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
|
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
|
||||||
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
|
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
|
||||||
if (!searchEngine || ([searchEngine cStringLength] == 0))
|
if (!searchEngine || ([searchEngine length] == 0))
|
||||||
searchEngine = @"http://dmoz.org/";
|
searchEngine = @"http://dmoz.org/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,11 +938,13 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[mURLBar setStringValue:locationString];
|
[mURLBar setString:locationString];
|
||||||
[mLocationSheetURLField setStringValue:locationString];
|
[mLocationSheetURLField setStringValue:locationString];
|
||||||
|
|
||||||
[[self window] update];
|
// don't call [window display] here, no matter how much you might want
|
||||||
[[self window] display];
|
// to, because it forces a redraw of every view in the window and with a lot
|
||||||
|
// of tabs, it's dog slow.
|
||||||
|
// [[self window] display];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)newTab:(BOOL)allowHomepage
|
-(void)newTab:(BOOL)allowHomepage
|
||||||
|
|
|
@ -25,11 +25,10 @@
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
#include "nsIAutoCompleteResults.h"
|
#include "nsIAutoCompleteResults.h"
|
||||||
|
|
||||||
@class CHAutoCompleteTextField;
|
@class CHAutoCompleteTextView;
|
||||||
|
|
||||||
@interface CHAutoCompleteDataSource : NSObject
|
@interface CHAutoCompleteDataSource : NSObject
|
||||||
{
|
{
|
||||||
CHAutoCompleteTextField *mTextField;
|
|
||||||
NSImage *mIconImage;
|
NSImage *mIconImage;
|
||||||
|
|
||||||
NSString* mErrorMessage;
|
NSString* mErrorMessage;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
@class CHAutoCompleteDataSource, CHPageProxyIcon;
|
@class CHAutoCompleteDataSource, CHPageProxyIcon;
|
||||||
|
|
||||||
@interface CHAutoCompleteTextField : NSTextField
|
@interface CHAutoCompleteTextView : NSTextView
|
||||||
{
|
{
|
||||||
IBOutlet CHPageProxyIcon *mProxyIcon;
|
IBOutlet CHPageProxyIcon *mProxyIcon;
|
||||||
NSWindow *mPopupWin;
|
NSWindow *mPopupWin;
|
||||||
|
@ -56,6 +56,7 @@
|
||||||
|
|
||||||
- (void) setSession:(NSString *)aSession;
|
- (void) setSession:(NSString *)aSession;
|
||||||
- (NSString *) session;
|
- (NSString *) session;
|
||||||
|
- (void) setPageProxyIcon:(NSImage *)aImage;
|
||||||
|
|
||||||
- (NSTableView *) tableView;
|
- (NSTableView *) tableView;
|
||||||
- (int) visibleRows;
|
- (int) visibleRows;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
||||||
|
* David Haas <haas@cae.wisc.edu>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
|
@ -31,14 +32,15 @@
|
||||||
|
|
||||||
static const int kMaxRows = 6;
|
static const int kMaxRows = 6;
|
||||||
static const int kFrameMargin = 1;
|
static const int kFrameMargin = 1;
|
||||||
|
static const int kEscapeKeyCode = 53;
|
||||||
|
|
||||||
class AutoCompleteListener : public nsIAutoCompleteListener
|
class AutoCompleteListener : public nsIAutoCompleteListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutoCompleteListener(CHAutoCompleteTextField* aTextField)
|
AutoCompleteListener(CHAutoCompleteTextView* aTextView)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mTextField = aTextField;
|
mTextView = aTextView;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
@ -49,22 +51,30 @@ public:
|
||||||
|
|
||||||
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
|
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
|
||||||
{
|
{
|
||||||
[mTextField dataReady:aResults status:aStatus];
|
[mTextView dataReady:aResults status:aStatus];
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CHAutoCompleteTextField *mTextField;
|
CHAutoCompleteTextView *mTextView;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@implementation CHAutoCompleteTextField
|
@implementation CHAutoCompleteTextView
|
||||||
|
|
||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
{
|
{
|
||||||
|
[self setAllowsUndo:YES];
|
||||||
|
[self setFieldEditor:YES];
|
||||||
|
[self setFont:[NSFont controlContentFontOfSize:0]];
|
||||||
|
[self setUsesFontPanel:NO];
|
||||||
|
[self setRichText:NO];
|
||||||
|
[self setVerticallyResizable:NO];
|
||||||
|
[self setBackgroundColor:[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0]];
|
||||||
|
|
||||||
NSTableColumn *column;
|
NSTableColumn *column;
|
||||||
NSScrollView *scrollView;
|
NSScrollView *scrollView;
|
||||||
NSCell *dataCell;
|
NSCell *dataCell;
|
||||||
|
@ -292,9 +302,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the origin of the location bar in coordinates of the root view
|
// get the origin of the location bar in coordinates of the root view
|
||||||
locationFrame = [[self superview] frame];
|
locationFrame = [[[[self superview] superview] superview] frame];
|
||||||
locationOrigin = [[[self superview] superview] convertPoint:locationFrame.origin
|
locationOrigin = [[[[[self superview] superview] superview] superview] convertPoint:locationFrame.origin toView:[[[self window] contentView] superview]];
|
||||||
toView:[[[self window] contentView] superview]];
|
|
||||||
|
|
||||||
// get the height of the table view
|
// get the height of the table view
|
||||||
winFrame = [[self window] frame];
|
winFrame = [[self window] frame];
|
||||||
|
@ -343,11 +352,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) completeResult:(int)aRow
|
- (void) completeResult:(int)aRow
|
||||||
{
|
{
|
||||||
NSRange matchRange;
|
NSRange matchRange;
|
||||||
NSText *text;
|
|
||||||
NSString *result1;
|
NSString *result1;
|
||||||
|
|
||||||
if (aRow < 0 && mSearchString) {
|
if (aRow < 0 && mSearchString) {
|
||||||
[self setStringValue:mSearchString];
|
[self setString:mSearchString];
|
||||||
} else {
|
} else {
|
||||||
if ([mDataSource rowCount] <= 0)
|
if ([mDataSource rowCount] <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -360,11 +368,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// fill in the textfield with the matching string
|
// fill in the textfield with the matching string
|
||||||
[self setStringValue:result1];
|
[self setString:result1];
|
||||||
|
|
||||||
// select the text after the search string
|
// select the text after the search string
|
||||||
text = [[self window] fieldEditor:NO forObject:self];
|
[self setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
|
||||||
[text setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,8 +380,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) enterResult:(int)aRow
|
- (void) enterResult:(int)aRow
|
||||||
{
|
{
|
||||||
if (aRow >= 0 && [mDataSource rowCount] > 0) {
|
if (aRow >= 0 && [mDataSource rowCount] > 0) {
|
||||||
[self setStringValue: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
|
[self setString: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
|
||||||
[self selectText:self];
|
[self selectAll:self];
|
||||||
[self closePopup];
|
[self closePopup];
|
||||||
} else if (mOpenTimer) {
|
} else if (mOpenTimer) {
|
||||||
// if there was a search timer going when we hit enter, cancel it
|
// if there was a search timer going when we hit enter, cancel it
|
||||||
|
@ -390,9 +397,9 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
|
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
|
||||||
if (url) {
|
if (url) {
|
||||||
[self clearResults];
|
[self clearResults];
|
||||||
|
[[self undoManager] removeAllActions];
|
||||||
[self setStringValue:url];
|
[self setString:url];
|
||||||
[self selectText:self];
|
[self selectAll:self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +452,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) onRowClicked:(id)sender
|
- (void) onRowClicked:(id)sender
|
||||||
{
|
{
|
||||||
[self enterResult:[mTableView clickedRow]];
|
[self enterResult:[mTableView clickedRow]];
|
||||||
[self sendAction:[self action] to:[self target]];
|
[[[self window] windowController] goToLocationFromToolbarURLField:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) onBlur:(id)sender
|
- (void) onBlur:(id)sender
|
||||||
|
@ -460,26 +467,29 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
// NSTextField delegate //////////////////////////////////
|
// NSTextField delegate //////////////////////////////////
|
||||||
|
|
||||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
- (void)textDidChange:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
NSText *text = [[self window] fieldEditor:NO forObject:self];
|
NSRange range = [self selectedRange];
|
||||||
NSRange range = [text selectedRange];
|
|
||||||
|
|
||||||
// make sure we're typing at the end of the string
|
// make sure we're typing at the end of the string
|
||||||
if (range.location == [[self stringValue] length])
|
if (range.location == [[self string] length])
|
||||||
[self startSearch:[self stringValue] complete:!mBackspaced];
|
[self startSearch:[self string] complete:!mBackspaced];
|
||||||
else
|
else
|
||||||
[self clearResults];
|
[self clearResults];
|
||||||
|
|
||||||
mBackspaced = NO;
|
mBackspaced = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
|
- (void)textDidEndEditing:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
[self closePopup];
|
[self closePopup];
|
||||||
|
[self setSelectedRange:NSMakeRange(0,0)];
|
||||||
|
[[self undoManager] removeAllActions];
|
||||||
|
if ([[[aNotification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
|
||||||
|
[[[self window] windowController] goToLocationFromToolbarURLField:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
|
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)command
|
||||||
{
|
{
|
||||||
if (command == @selector(insertNewline:)) {
|
if (command == @selector(insertNewline:)) {
|
||||||
[self enterResult:[mTableView selectedRow]];
|
[self enterResult:[mTableView selectedRow]];
|
||||||
|
@ -513,11 +523,24 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
command == @selector(deleteForward:)) {
|
command == @selector(deleteForward:)) {
|
||||||
// if the user deletes characters, we need to know so that
|
// if the user deletes characters, we need to know so that
|
||||||
// we can prevent autocompletion later when search results come in
|
// we can prevent autocompletion later when search results come in
|
||||||
if ([[self stringValue] length] > 1)
|
if ([[self string] length] > 1)
|
||||||
mBackspaced = YES;
|
mBackspaced = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)keyDown:(NSEvent *)theEvent
|
||||||
|
{
|
||||||
|
if ([theEvent keyCode] == kEscapeKeyCode)
|
||||||
|
[self revertText];
|
||||||
|
else
|
||||||
|
[super keyDown:theEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setPageProxyIcon:(NSImage *)aImage
|
||||||
|
{
|
||||||
|
[mProxyIcon setImage:aImage];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -56,11 +56,9 @@
|
||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
nsCAutoString cref; cref.AssignWithConversion(href);
|
if (href.IsEmpty())
|
||||||
if (cref.IsEmpty())
|
|
||||||
return;
|
return;
|
||||||
|
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
||||||
NSString* url = [NSString stringWithCString: cref.get()];
|
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[[[self window] windowController] loadURL: url referrer:nil];
|
[[[self window] windowController] loadURL: url referrer:nil];
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
||||||
|
|
||||||
[self saveInternal: url.get()
|
[self saveInternal: url.get()
|
||||||
withDocument: nsnull
|
withDocument: nsnull
|
||||||
suggestedFilename: [aFilename cString]
|
suggestedFilename: [aFilename fileSystemRepresentation]
|
||||||
bypassCache: YES
|
bypassCache: YES
|
||||||
filterView: aFilterView
|
filterView: aFilterView
|
||||||
filterList: aFilterList];
|
filterList: aFilterList];
|
||||||
|
@ -1272,7 +1272,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
||||||
|
|
||||||
return [NSString stringWithCString: urlCStr.get()];
|
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setActive: (BOOL)aIsActive
|
- (void)setActive: (BOOL)aIsActive
|
||||||
|
|
|
@ -85,7 +85,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
- (IBAction)load:(id)sender
|
- (IBAction)load:(id)sender
|
||||||
{
|
{
|
||||||
[mBrowserView loadURI:[urlbar stringValue] referrer:nil flags:NSLoadFlagsNone];
|
[mBrowserView loadURI:[urlbar string] referrer:nil flags:NSLoadFlagsNone];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)disconnectView
|
-(void)disconnectView
|
||||||
|
@ -462,6 +462,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// sizeBrowserTo
|
||||||
|
//
|
||||||
|
// Sizes window so that browser has dimensions given by |dimensions|
|
||||||
|
//
|
||||||
- (void)sizeBrowserTo:(NSSize)dimensions
|
- (void)sizeBrowserTo:(NSSize)dimensions
|
||||||
{
|
{
|
||||||
NSRect bounds = [self bounds];
|
NSRect bounds = [self bounds];
|
||||||
|
|
|
@ -50,34 +50,34 @@
|
||||||
CLASS = BrowserWindowController;
|
CLASS = BrowserWindowController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
mAddBookmarkCheckbox = id;
|
mAddBookmarkCheckbox = NSButton;
|
||||||
mAddBookmarkFolderField = id;
|
mAddBookmarkFolderField = NSPopUpButton;
|
||||||
mAddBookmarkSheetWindow = id;
|
mAddBookmarkSheetWindow = NSWindow;
|
||||||
mAddBookmarkTitleField = id;
|
mAddBookmarkTitleField = NSTextField;
|
||||||
mBackItem = id;
|
mBackItem = NSMenuItem;
|
||||||
mCachedBMDS = id;
|
mCachedBMDS = id;
|
||||||
mForwardItem = id;
|
mForwardItem = NSMenuItem;
|
||||||
mHistoryDataSource = id;
|
mHistoryDataSource = CHHistoryDataSource;
|
||||||
mImageLinkMenu = id;
|
mImageLinkMenu = NSMenu;
|
||||||
mImageMenu = id;
|
mImageMenu = NSMenu;
|
||||||
mInputMenu = id;
|
mInputMenu = NSMenu;
|
||||||
mLinkMenu = id;
|
mLinkMenu = NSMenu;
|
||||||
mLocationSheetURLField = id;
|
mLocationSheetURLField = NSTextField;
|
||||||
mLocationSheetWindow = id;
|
mLocationSheetWindow = NSWindow;
|
||||||
mLocationToolbarView = id;
|
mLocationToolbarView = NSView;
|
||||||
mLock = NSImageView;
|
mLock = NSImageView;
|
||||||
mPageMenu = id;
|
mPageMenu = NSMenu;
|
||||||
mPersonalToolbar = CHBookmarksToolbar;
|
mPersonalToolbar = CHBookmarksToolbar;
|
||||||
mProgress = NSProgressIndicator;
|
mProgress = NSProgressIndicator;
|
||||||
mSidebarBookmarksDataSource = id;
|
mSidebarBookmarksDataSource = BookmarksDataSource;
|
||||||
mSidebarBrowserView = id;
|
mSidebarBrowserView = id;
|
||||||
mSidebarDrawer = NSDrawer;
|
mSidebarDrawer = NSDrawer;
|
||||||
mSidebarSourceTabView = id;
|
mSidebarSourceTabView = NSTabView;
|
||||||
mSidebarTabView = id;
|
mSidebarTabView = NSTabView;
|
||||||
mStatus = NSTextField;
|
mStatus = NSTextField;
|
||||||
mStatusBar = NSView;
|
mStatusBar = NSView;
|
||||||
mTabBrowser = id;
|
mTabBrowser = CHExtendedTabView;
|
||||||
mURLBar = NSTextField;
|
mURLBar = NSTextView;
|
||||||
};
|
};
|
||||||
SUPERCLASS = NSWindowController;
|
SUPERCLASS = NSWindowController;
|
||||||
},
|
},
|
||||||
|
@ -89,6 +89,13 @@
|
||||||
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
SUPERCLASS = NSTextField;
|
SUPERCLASS = NSTextField;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
|
||||||
|
CLASS = CHAutoCompleteTextView;
|
||||||
|
LANGUAGE = ObjC;
|
||||||
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
|
SUPERCLASS = NSTextView;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
CLASS = CHBookmarksOutlineView;
|
CLASS = CHBookmarksOutlineView;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>56 77 632 495 0 0 1152 746 </string>
|
<string>174 64 632 495 0 0 1152 848 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>124</key>
|
<key>124</key>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
<key>463</key>
|
<key>463</key>
|
||||||
<string>22 619 200 180 0 0 1152 848 </string>
|
<string>22 619 200 180 0 0 1152 848 </string>
|
||||||
<key>56</key>
|
<key>56</key>
|
||||||
<string>442 634 343 68 0 0 1280 1002 </string>
|
<string>403 587 360 76 0 0 1152 848 </string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBFramework Version</key>
|
<key>IBFramework Version</key>
|
||||||
<string>248.0</string>
|
<string>248.0</string>
|
||||||
|
@ -43,10 +43,7 @@
|
||||||
</array>
|
</array>
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>297</integer>
|
<integer>56</integer>
|
||||||
<integer>463</integer>
|
|
||||||
<integer>336</integer>
|
|
||||||
<integer>314</integer>
|
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S60</string>
|
<string>5S60</string>
|
||||||
|
|
Двоичный файл не отображается.
|
@ -360,6 +360,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
|
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
|
||||||
{
|
{
|
||||||
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
||||||
|
|
||||||
|
// The process of creating a new tab in this brand new window loads about:blank for us as a
|
||||||
|
// side effect of calling GetDocument(). We don't need to do it again.
|
||||||
|
if ( [aURL isEqualToString:@"about:blank"] )
|
||||||
|
[browser disableLoadPage];
|
||||||
|
|
||||||
[browser loadURL: aURL referrer:aReferrer];
|
[browser loadURL: aURL referrer:aReferrer];
|
||||||
[browser showWindow: self];
|
[browser showWindow: self];
|
||||||
return browser;
|
return browser;
|
||||||
|
@ -675,20 +681,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
||||||
{
|
{
|
||||||
NSWindow* mainWindow = [mApplication mainWindow];
|
// do nothing if there is no window. we shouldn't get here in that case anyway, but
|
||||||
if (!mainWindow) {
|
// just to be safe. If there is a browser window, toggle it's personal toolbar.
|
||||||
[self openBrowserWindowWithURL: @"about:blank" andReferrer:nil];
|
if ( [self isMainWindowABrowserWindow] ) {
|
||||||
mainWindow = [mApplication mainWindow];
|
NSWindow* mainWindow = [mApplication mainWindow];
|
||||||
|
|
||||||
|
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
|
||||||
|
BOOL showToolbar = (BOOL)(!(height > 0));
|
||||||
|
|
||||||
|
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
|
||||||
|
|
||||||
|
// save prefs here
|
||||||
|
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
|
||||||
}
|
}
|
||||||
|
|
||||||
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
|
|
||||||
BOOL showToolbar = (BOOL)(!(height > 0));
|
|
||||||
|
|
||||||
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
|
|
||||||
|
|
||||||
// save prefs here
|
|
||||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
|
||||||
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) infoLink:(id)aSender
|
-(IBAction) infoLink:(id)aSender
|
||||||
|
|
|
@ -50,34 +50,34 @@
|
||||||
CLASS = BrowserWindowController;
|
CLASS = BrowserWindowController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
mAddBookmarkCheckbox = id;
|
mAddBookmarkCheckbox = NSButton;
|
||||||
mAddBookmarkFolderField = id;
|
mAddBookmarkFolderField = NSPopUpButton;
|
||||||
mAddBookmarkSheetWindow = id;
|
mAddBookmarkSheetWindow = NSWindow;
|
||||||
mAddBookmarkTitleField = id;
|
mAddBookmarkTitleField = NSTextField;
|
||||||
mBackItem = id;
|
mBackItem = NSMenuItem;
|
||||||
mCachedBMDS = id;
|
mCachedBMDS = id;
|
||||||
mForwardItem = id;
|
mForwardItem = NSMenuItem;
|
||||||
mHistoryDataSource = id;
|
mHistoryDataSource = CHHistoryDataSource;
|
||||||
mImageLinkMenu = id;
|
mImageLinkMenu = NSMenu;
|
||||||
mImageMenu = id;
|
mImageMenu = NSMenu;
|
||||||
mInputMenu = id;
|
mInputMenu = NSMenu;
|
||||||
mLinkMenu = id;
|
mLinkMenu = NSMenu;
|
||||||
mLocationSheetURLField = id;
|
mLocationSheetURLField = NSTextField;
|
||||||
mLocationSheetWindow = id;
|
mLocationSheetWindow = NSWindow;
|
||||||
mLocationToolbarView = id;
|
mLocationToolbarView = NSView;
|
||||||
mLock = NSImageView;
|
mLock = NSImageView;
|
||||||
mPageMenu = id;
|
mPageMenu = NSMenu;
|
||||||
mPersonalToolbar = CHBookmarksToolbar;
|
mPersonalToolbar = CHBookmarksToolbar;
|
||||||
mProgress = NSProgressIndicator;
|
mProgress = NSProgressIndicator;
|
||||||
mSidebarBookmarksDataSource = id;
|
mSidebarBookmarksDataSource = BookmarksDataSource;
|
||||||
mSidebarBrowserView = id;
|
mSidebarBrowserView = id;
|
||||||
mSidebarDrawer = NSDrawer;
|
mSidebarDrawer = NSDrawer;
|
||||||
mSidebarSourceTabView = id;
|
mSidebarSourceTabView = NSTabView;
|
||||||
mSidebarTabView = id;
|
mSidebarTabView = NSTabView;
|
||||||
mStatus = NSTextField;
|
mStatus = NSTextField;
|
||||||
mStatusBar = NSView;
|
mStatusBar = NSView;
|
||||||
mTabBrowser = id;
|
mTabBrowser = CHExtendedTabView;
|
||||||
mURLBar = NSTextField;
|
mURLBar = NSTextView;
|
||||||
};
|
};
|
||||||
SUPERCLASS = NSWindowController;
|
SUPERCLASS = NSWindowController;
|
||||||
},
|
},
|
||||||
|
@ -89,6 +89,13 @@
|
||||||
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
SUPERCLASS = NSTextField;
|
SUPERCLASS = NSTextField;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
|
||||||
|
CLASS = CHAutoCompleteTextView;
|
||||||
|
LANGUAGE = ObjC;
|
||||||
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
|
SUPERCLASS = NSTextView;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
CLASS = CHBookmarksOutlineView;
|
CLASS = CHBookmarksOutlineView;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>56 77 632 495 0 0 1152 746 </string>
|
<string>174 64 632 495 0 0 1152 848 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>124</key>
|
<key>124</key>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
<key>463</key>
|
<key>463</key>
|
||||||
<string>22 619 200 180 0 0 1152 848 </string>
|
<string>22 619 200 180 0 0 1152 848 </string>
|
||||||
<key>56</key>
|
<key>56</key>
|
||||||
<string>442 634 343 68 0 0 1280 1002 </string>
|
<string>403 587 360 76 0 0 1152 848 </string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBFramework Version</key>
|
<key>IBFramework Version</key>
|
||||||
<string>248.0</string>
|
<string>248.0</string>
|
||||||
|
@ -43,10 +43,7 @@
|
||||||
</array>
|
</array>
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>297</integer>
|
<integer>56</integer>
|
||||||
<integer>463</integer>
|
|
||||||
<integer>336</integer>
|
|
||||||
<integer>314</integer>
|
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S60</string>
|
<string>5S60</string>
|
||||||
|
|
Двоичные данные
camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib
сгенерированный
Двоичные данные
camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib
сгенерированный
Двоичный файл не отображается.
|
@ -360,6 +360,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
|
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
|
||||||
{
|
{
|
||||||
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
||||||
|
|
||||||
|
// The process of creating a new tab in this brand new window loads about:blank for us as a
|
||||||
|
// side effect of calling GetDocument(). We don't need to do it again.
|
||||||
|
if ( [aURL isEqualToString:@"about:blank"] )
|
||||||
|
[browser disableLoadPage];
|
||||||
|
|
||||||
[browser loadURL: aURL referrer:aReferrer];
|
[browser loadURL: aURL referrer:aReferrer];
|
||||||
[browser showWindow: self];
|
[browser showWindow: self];
|
||||||
return browser;
|
return browser;
|
||||||
|
@ -675,20 +681,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
||||||
{
|
{
|
||||||
NSWindow* mainWindow = [mApplication mainWindow];
|
// do nothing if there is no window. we shouldn't get here in that case anyway, but
|
||||||
if (!mainWindow) {
|
// just to be safe. If there is a browser window, toggle it's personal toolbar.
|
||||||
[self openBrowserWindowWithURL: @"about:blank" andReferrer:nil];
|
if ( [self isMainWindowABrowserWindow] ) {
|
||||||
mainWindow = [mApplication mainWindow];
|
NSWindow* mainWindow = [mApplication mainWindow];
|
||||||
|
|
||||||
|
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
|
||||||
|
BOOL showToolbar = (BOOL)(!(height > 0));
|
||||||
|
|
||||||
|
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
|
||||||
|
|
||||||
|
// save prefs here
|
||||||
|
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
|
||||||
}
|
}
|
||||||
|
|
||||||
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
|
|
||||||
BOOL showToolbar = (BOOL)(!(height > 0));
|
|
||||||
|
|
||||||
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
|
|
||||||
|
|
||||||
// save prefs here
|
|
||||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
|
||||||
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) infoLink:(id)aSender
|
-(IBAction) infoLink:(id)aSender
|
||||||
|
|
|
@ -56,11 +56,9 @@
|
||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
nsCAutoString cref; cref.AssignWithConversion(href);
|
if (href.IsEmpty())
|
||||||
if (cref.IsEmpty())
|
|
||||||
return;
|
return;
|
||||||
|
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
||||||
NSString* url = [NSString stringWithCString: cref.get()];
|
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[[[self window] windowController] loadURL: url referrer:nil];
|
[[[self window] windowController] loadURL: url referrer:nil];
|
||||||
|
|
|
@ -206,8 +206,8 @@
|
||||||
isGroup = YES;
|
isGroup = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* titleC = [[[mBrowserWindowController getAddBookmarkTitle] stringValue] cString];
|
nsAutoString title;
|
||||||
nsAutoString title; title.AssignWithConversion(titleC);
|
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
|
||||||
|
|
||||||
nsAutoString tagName;
|
nsAutoString tagName;
|
||||||
if (mCachedHref)
|
if (mCachedHref)
|
||||||
|
@ -224,7 +224,8 @@
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
|
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
|
||||||
|
|
||||||
if (mCachedHref) {
|
if (mCachedHref) {
|
||||||
nsAutoString href; href.AssignWithConversion([mCachedHref cString]);
|
nsAutoString href;
|
||||||
|
NSStringTo_nsString(mCachedHref, href);
|
||||||
[mCachedHref release];
|
[mCachedHref release];
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1214,8 +1214,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
|
||||||
nsCOMPtr<nsIDOMElement> beforeElt;
|
nsCOMPtr<nsIDOMElement> beforeElt;
|
||||||
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
||||||
|
|
||||||
nsAutoString url; url.AssignWithConversion([[data objectForKey:@"url"] cString]);
|
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
|
||||||
nsAutoString title; title.AssignWithConversion([[data objectForKey:@"title"] cString]);
|
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
|
||||||
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,10 @@
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
#include "nsIAutoCompleteResults.h"
|
#include "nsIAutoCompleteResults.h"
|
||||||
|
|
||||||
@class CHAutoCompleteTextField;
|
@class CHAutoCompleteTextView;
|
||||||
|
|
||||||
@interface CHAutoCompleteDataSource : NSObject
|
@interface CHAutoCompleteDataSource : NSObject
|
||||||
{
|
{
|
||||||
CHAutoCompleteTextField *mTextField;
|
|
||||||
NSImage *mIconImage;
|
NSImage *mIconImage;
|
||||||
|
|
||||||
NSString* mErrorMessage;
|
NSString* mErrorMessage;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
@class CHAutoCompleteDataSource, CHPageProxyIcon;
|
@class CHAutoCompleteDataSource, CHPageProxyIcon;
|
||||||
|
|
||||||
@interface CHAutoCompleteTextField : NSTextField
|
@interface CHAutoCompleteTextView : NSTextView
|
||||||
{
|
{
|
||||||
IBOutlet CHPageProxyIcon *mProxyIcon;
|
IBOutlet CHPageProxyIcon *mProxyIcon;
|
||||||
NSWindow *mPopupWin;
|
NSWindow *mPopupWin;
|
||||||
|
@ -56,6 +56,7 @@
|
||||||
|
|
||||||
- (void) setSession:(NSString *)aSession;
|
- (void) setSession:(NSString *)aSession;
|
||||||
- (NSString *) session;
|
- (NSString *) session;
|
||||||
|
- (void) setPageProxyIcon:(NSImage *)aImage;
|
||||||
|
|
||||||
- (NSTableView *) tableView;
|
- (NSTableView *) tableView;
|
||||||
- (int) visibleRows;
|
- (int) visibleRows;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
||||||
|
* David Haas <haas@cae.wisc.edu>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
|
@ -31,14 +32,15 @@
|
||||||
|
|
||||||
static const int kMaxRows = 6;
|
static const int kMaxRows = 6;
|
||||||
static const int kFrameMargin = 1;
|
static const int kFrameMargin = 1;
|
||||||
|
static const int kEscapeKeyCode = 53;
|
||||||
|
|
||||||
class AutoCompleteListener : public nsIAutoCompleteListener
|
class AutoCompleteListener : public nsIAutoCompleteListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutoCompleteListener(CHAutoCompleteTextField* aTextField)
|
AutoCompleteListener(CHAutoCompleteTextView* aTextView)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mTextField = aTextField;
|
mTextView = aTextView;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
@ -49,22 +51,30 @@ public:
|
||||||
|
|
||||||
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
|
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
|
||||||
{
|
{
|
||||||
[mTextField dataReady:aResults status:aStatus];
|
[mTextView dataReady:aResults status:aStatus];
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CHAutoCompleteTextField *mTextField;
|
CHAutoCompleteTextView *mTextView;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@implementation CHAutoCompleteTextField
|
@implementation CHAutoCompleteTextView
|
||||||
|
|
||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
{
|
{
|
||||||
|
[self setAllowsUndo:YES];
|
||||||
|
[self setFieldEditor:YES];
|
||||||
|
[self setFont:[NSFont controlContentFontOfSize:0]];
|
||||||
|
[self setUsesFontPanel:NO];
|
||||||
|
[self setRichText:NO];
|
||||||
|
[self setVerticallyResizable:NO];
|
||||||
|
[self setBackgroundColor:[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0]];
|
||||||
|
|
||||||
NSTableColumn *column;
|
NSTableColumn *column;
|
||||||
NSScrollView *scrollView;
|
NSScrollView *scrollView;
|
||||||
NSCell *dataCell;
|
NSCell *dataCell;
|
||||||
|
@ -292,9 +302,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the origin of the location bar in coordinates of the root view
|
// get the origin of the location bar in coordinates of the root view
|
||||||
locationFrame = [[self superview] frame];
|
locationFrame = [[[[self superview] superview] superview] frame];
|
||||||
locationOrigin = [[[self superview] superview] convertPoint:locationFrame.origin
|
locationOrigin = [[[[[self superview] superview] superview] superview] convertPoint:locationFrame.origin toView:[[[self window] contentView] superview]];
|
||||||
toView:[[[self window] contentView] superview]];
|
|
||||||
|
|
||||||
// get the height of the table view
|
// get the height of the table view
|
||||||
winFrame = [[self window] frame];
|
winFrame = [[self window] frame];
|
||||||
|
@ -343,11 +352,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) completeResult:(int)aRow
|
- (void) completeResult:(int)aRow
|
||||||
{
|
{
|
||||||
NSRange matchRange;
|
NSRange matchRange;
|
||||||
NSText *text;
|
|
||||||
NSString *result1;
|
NSString *result1;
|
||||||
|
|
||||||
if (aRow < 0 && mSearchString) {
|
if (aRow < 0 && mSearchString) {
|
||||||
[self setStringValue:mSearchString];
|
[self setString:mSearchString];
|
||||||
} else {
|
} else {
|
||||||
if ([mDataSource rowCount] <= 0)
|
if ([mDataSource rowCount] <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -360,11 +368,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// fill in the textfield with the matching string
|
// fill in the textfield with the matching string
|
||||||
[self setStringValue:result1];
|
[self setString:result1];
|
||||||
|
|
||||||
// select the text after the search string
|
// select the text after the search string
|
||||||
text = [[self window] fieldEditor:NO forObject:self];
|
[self setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
|
||||||
[text setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,8 +380,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) enterResult:(int)aRow
|
- (void) enterResult:(int)aRow
|
||||||
{
|
{
|
||||||
if (aRow >= 0 && [mDataSource rowCount] > 0) {
|
if (aRow >= 0 && [mDataSource rowCount] > 0) {
|
||||||
[self setStringValue: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
|
[self setString: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
|
||||||
[self selectText:self];
|
[self selectAll:self];
|
||||||
[self closePopup];
|
[self closePopup];
|
||||||
} else if (mOpenTimer) {
|
} else if (mOpenTimer) {
|
||||||
// if there was a search timer going when we hit enter, cancel it
|
// if there was a search timer going when we hit enter, cancel it
|
||||||
|
@ -390,9 +397,9 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
|
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
|
||||||
if (url) {
|
if (url) {
|
||||||
[self clearResults];
|
[self clearResults];
|
||||||
|
[[self undoManager] removeAllActions];
|
||||||
[self setStringValue:url];
|
[self setString:url];
|
||||||
[self selectText:self];
|
[self selectAll:self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +452,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) onRowClicked:(id)sender
|
- (void) onRowClicked:(id)sender
|
||||||
{
|
{
|
||||||
[self enterResult:[mTableView clickedRow]];
|
[self enterResult:[mTableView clickedRow]];
|
||||||
[self sendAction:[self action] to:[self target]];
|
[[[self window] windowController] goToLocationFromToolbarURLField:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) onBlur:(id)sender
|
- (void) onBlur:(id)sender
|
||||||
|
@ -460,26 +467,29 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
// NSTextField delegate //////////////////////////////////
|
// NSTextField delegate //////////////////////////////////
|
||||||
|
|
||||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
- (void)textDidChange:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
NSText *text = [[self window] fieldEditor:NO forObject:self];
|
NSRange range = [self selectedRange];
|
||||||
NSRange range = [text selectedRange];
|
|
||||||
|
|
||||||
// make sure we're typing at the end of the string
|
// make sure we're typing at the end of the string
|
||||||
if (range.location == [[self stringValue] length])
|
if (range.location == [[self string] length])
|
||||||
[self startSearch:[self stringValue] complete:!mBackspaced];
|
[self startSearch:[self string] complete:!mBackspaced];
|
||||||
else
|
else
|
||||||
[self clearResults];
|
[self clearResults];
|
||||||
|
|
||||||
mBackspaced = NO;
|
mBackspaced = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
|
- (void)textDidEndEditing:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
[self closePopup];
|
[self closePopup];
|
||||||
|
[self setSelectedRange:NSMakeRange(0,0)];
|
||||||
|
[[self undoManager] removeAllActions];
|
||||||
|
if ([[[aNotification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
|
||||||
|
[[[self window] windowController] goToLocationFromToolbarURLField:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
|
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)command
|
||||||
{
|
{
|
||||||
if (command == @selector(insertNewline:)) {
|
if (command == @selector(insertNewline:)) {
|
||||||
[self enterResult:[mTableView selectedRow]];
|
[self enterResult:[mTableView selectedRow]];
|
||||||
|
@ -513,11 +523,24 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
command == @selector(deleteForward:)) {
|
command == @selector(deleteForward:)) {
|
||||||
// if the user deletes characters, we need to know so that
|
// if the user deletes characters, we need to know so that
|
||||||
// we can prevent autocompletion later when search results come in
|
// we can prevent autocompletion later when search results come in
|
||||||
if ([[self stringValue] length] > 1)
|
if ([[self string] length] > 1)
|
||||||
mBackspaced = YES;
|
mBackspaced = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)keyDown:(NSEvent *)theEvent
|
||||||
|
{
|
||||||
|
if ([theEvent keyCode] == kEscapeKeyCode)
|
||||||
|
[self revertText];
|
||||||
|
else
|
||||||
|
[super keyDown:theEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setPageProxyIcon:(NSImage *)aImage
|
||||||
|
{
|
||||||
|
[mProxyIcon setImage:aImage];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
@interface BrowserWindow : NSWindow
|
@interface BrowserWindow : NSWindow
|
||||||
{
|
{
|
||||||
IBOutlet id mAutoCompleteTextField;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL) makeFirstResponder:(NSResponder*) responder;
|
-(BOOL) makeFirstResponder:(NSResponder*) responder;
|
||||||
|
|
|
@ -1,25 +1,8 @@
|
||||||
#import "BrowserWindow.h"
|
#import "BrowserWindow.h"
|
||||||
#import "CHAutoCompleteTextField.h"
|
|
||||||
#import "BrowserWindowController.h"
|
#import "BrowserWindowController.h"
|
||||||
|
|
||||||
static const int kEscapeKeyCode = 53;
|
|
||||||
|
|
||||||
@implementation BrowserWindow
|
@implementation BrowserWindow
|
||||||
|
|
||||||
- (void)sendEvent:(NSEvent *)theEvent
|
|
||||||
{
|
|
||||||
// We need this hack because NSWindow::sendEvent will eat the escape key
|
|
||||||
// and won't pass it down to the key handler of responders in the window.
|
|
||||||
// We have to override sendEvent for all of our escape key needs.
|
|
||||||
if ([theEvent keyCode] == kEscapeKeyCode && [theEvent type] == NSKeyDown) {
|
|
||||||
NSText *fieldEditor = [self fieldEditor:NO forObject:mAutoCompleteTextField];
|
|
||||||
if (fieldEditor && [self firstResponder] == fieldEditor) {
|
|
||||||
[mAutoCompleteTextField revertText];
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
[super sendEvent:theEvent];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)makeFirstResponder:(NSResponder*)responder
|
- (BOOL)makeFirstResponder:(NSResponder*)responder
|
||||||
{
|
{
|
||||||
NSResponder* oldResponder = [self firstResponder];
|
NSResponder* oldResponder = [self firstResponder];
|
||||||
|
|
|
@ -86,7 +86,7 @@ class nsIDOMNode;
|
||||||
IBOutlet NSTabView* mSidebarTabView;
|
IBOutlet NSTabView* mSidebarTabView;
|
||||||
IBOutlet NSTabView* mSidebarSourceTabView;
|
IBOutlet NSTabView* mSidebarSourceTabView;
|
||||||
IBOutlet NSView* mLocationToolbarView;
|
IBOutlet NSView* mLocationToolbarView;
|
||||||
IBOutlet NSTextField* mURLBar;
|
IBOutlet NSTextView* mURLBar;
|
||||||
IBOutlet NSTextField* mStatus;
|
IBOutlet NSTextField* mStatus;
|
||||||
IBOutlet NSProgressIndicator* mProgress;
|
IBOutlet NSProgressIndicator* mProgress;
|
||||||
IBOutlet NSImageView* mLock;
|
IBOutlet NSImageView* mLock;
|
||||||
|
@ -166,7 +166,6 @@ class nsIDOMNode;
|
||||||
|
|
||||||
- (void)performAppropriateLocationAction;
|
- (void)performAppropriateLocationAction;
|
||||||
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
|
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
|
||||||
- (void)focusURLBar;
|
|
||||||
- (void)beginLocationSheet;
|
- (void)beginLocationSheet;
|
||||||
- (IBAction)endLocationSheet:(id)sender;
|
- (IBAction)endLocationSheet:(id)sender;
|
||||||
- (IBAction)cancelLocationSheet:(id)sender;
|
- (IBAction)cancelLocationSheet:(id)sender;
|
||||||
|
@ -175,6 +174,8 @@ class nsIDOMNode;
|
||||||
- (IBAction)endAddBookmarkSheet:(id)sender;
|
- (IBAction)endAddBookmarkSheet:(id)sender;
|
||||||
- (void)cacheBookmarkDS: (id)aDS;
|
- (void)cacheBookmarkDS: (id)aDS;
|
||||||
|
|
||||||
|
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize;
|
||||||
|
|
||||||
- (IBAction)viewSource:(id)aSender;
|
- (IBAction)viewSource:(id)aSender;
|
||||||
|
|
||||||
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;
|
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;
|
||||||
|
|
|
@ -272,8 +272,6 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
[mProgress retain];
|
[mProgress retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
[[mURLBar cell] setImage: [NSImage imageNamed:@"smallbookmark"]];
|
|
||||||
|
|
||||||
// Get our saved dimensions.
|
// Get our saved dimensions.
|
||||||
[[self window] setFrameUsingName: @"NavigatorWindow"];
|
[[self window] setFrameUsingName: @"NavigatorWindow"];
|
||||||
|
|
||||||
|
@ -328,6 +326,13 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
|
||||||
|
{
|
||||||
|
//if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
|
||||||
|
// return [[self window] frame].size;
|
||||||
|
return proposedFrameSize;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)drawerWillOpen: (NSNotification*)aNotification
|
- (void)drawerWillOpen: (NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
[mSidebarBookmarksDataSource ensureBookmarks];
|
[mSidebarBookmarksDataSource ensureBookmarks];
|
||||||
|
@ -631,7 +636,8 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
|
|
||||||
- (void)focusURLBar
|
- (void)focusURLBar
|
||||||
{
|
{
|
||||||
[mURLBar selectText: self];
|
[[self window] makeFirstResponder:mURLBar];
|
||||||
|
[mURLBar selectAll: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)beginLocationSheet
|
- (void)beginLocationSheet
|
||||||
|
@ -702,7 +708,7 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
- (IBAction)goToLocationFromToolbarURLField:(id)sender
|
- (IBAction)goToLocationFromToolbarURLField:(id)sender
|
||||||
{
|
{
|
||||||
// trim off any whitespace around url
|
// trim off any whitespace around url
|
||||||
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender stringValue]];
|
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender string]];
|
||||||
CFStringTrimWhitespace((CFMutableStringRef)theURL);
|
CFStringTrimWhitespace((CFMutableStringRef)theURL);
|
||||||
[self loadURL:theURL referrer:nil];
|
[self loadURL:theURL referrer:nil];
|
||||||
[theURL release];
|
[theURL release];
|
||||||
|
@ -753,7 +759,7 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
// Get the users preferred search engine from IC
|
// Get the users preferred search engine from IC
|
||||||
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
|
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
|
||||||
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
|
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
|
||||||
if (!searchEngine || ([searchEngine cStringLength] == 0))
|
if (!searchEngine || ([searchEngine length] == 0))
|
||||||
searchEngine = @"http://dmoz.org/";
|
searchEngine = @"http://dmoz.org/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,11 +938,13 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[mURLBar setStringValue:locationString];
|
[mURLBar setString:locationString];
|
||||||
[mLocationSheetURLField setStringValue:locationString];
|
[mLocationSheetURLField setStringValue:locationString];
|
||||||
|
|
||||||
[[self window] update];
|
// don't call [window display] here, no matter how much you might want
|
||||||
[[self window] display];
|
// to, because it forces a redraw of every view in the window and with a lot
|
||||||
|
// of tabs, it's dog slow.
|
||||||
|
// [[self window] display];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)newTab:(BOOL)allowHomepage
|
-(void)newTab:(BOOL)allowHomepage
|
||||||
|
|
|
@ -85,7 +85,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
- (IBAction)load:(id)sender
|
- (IBAction)load:(id)sender
|
||||||
{
|
{
|
||||||
[mBrowserView loadURI:[urlbar stringValue] referrer:nil flags:NSLoadFlagsNone];
|
[mBrowserView loadURI:[urlbar string] referrer:nil flags:NSLoadFlagsNone];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)disconnectView
|
-(void)disconnectView
|
||||||
|
@ -462,6 +462,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// sizeBrowserTo
|
||||||
|
//
|
||||||
|
// Sizes window so that browser has dimensions given by |dimensions|
|
||||||
|
//
|
||||||
- (void)sizeBrowserTo:(NSSize)dimensions
|
- (void)sizeBrowserTo:(NSSize)dimensions
|
||||||
{
|
{
|
||||||
NSRect bounds = [self bounds];
|
NSRect bounds = [self bounds];
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
||||||
|
|
||||||
[self saveInternal: url.get()
|
[self saveInternal: url.get()
|
||||||
withDocument: nsnull
|
withDocument: nsnull
|
||||||
suggestedFilename: [aFilename cString]
|
suggestedFilename: [aFilename fileSystemRepresentation]
|
||||||
bypassCache: YES
|
bypassCache: YES
|
||||||
filterView: aFilterView
|
filterView: aFilterView
|
||||||
filterList: aFilterList];
|
filterList: aFilterList];
|
||||||
|
@ -1272,7 +1272,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
||||||
|
|
||||||
return [NSString stringWithCString: urlCStr.get()];
|
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setActive: (BOOL)aIsActive
|
- (void)setActive: (BOOL)aIsActive
|
||||||
|
|
|
@ -206,8 +206,8 @@
|
||||||
isGroup = YES;
|
isGroup = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* titleC = [[[mBrowserWindowController getAddBookmarkTitle] stringValue] cString];
|
nsAutoString title;
|
||||||
nsAutoString title; title.AssignWithConversion(titleC);
|
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
|
||||||
|
|
||||||
nsAutoString tagName;
|
nsAutoString tagName;
|
||||||
if (mCachedHref)
|
if (mCachedHref)
|
||||||
|
@ -224,7 +224,8 @@
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
|
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
|
||||||
|
|
||||||
if (mCachedHref) {
|
if (mCachedHref) {
|
||||||
nsAutoString href; href.AssignWithConversion([mCachedHref cString]);
|
nsAutoString href;
|
||||||
|
NSStringTo_nsString(mCachedHref, href);
|
||||||
[mCachedHref release];
|
[mCachedHref release];
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1214,8 +1214,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
|
||||||
nsCOMPtr<nsIDOMElement> beforeElt;
|
nsCOMPtr<nsIDOMElement> beforeElt;
|
||||||
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
||||||
|
|
||||||
nsAutoString url; url.AssignWithConversion([[data objectForKey:@"url"] cString]);
|
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
|
||||||
nsAutoString title; title.AssignWithConversion([[data objectForKey:@"title"] cString]);
|
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
|
||||||
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
@interface BrowserWindow : NSWindow
|
@interface BrowserWindow : NSWindow
|
||||||
{
|
{
|
||||||
IBOutlet id mAutoCompleteTextField;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL) makeFirstResponder:(NSResponder*) responder;
|
-(BOOL) makeFirstResponder:(NSResponder*) responder;
|
||||||
|
|
|
@ -1,25 +1,8 @@
|
||||||
#import "BrowserWindow.h"
|
#import "BrowserWindow.h"
|
||||||
#import "CHAutoCompleteTextField.h"
|
|
||||||
#import "BrowserWindowController.h"
|
#import "BrowserWindowController.h"
|
||||||
|
|
||||||
static const int kEscapeKeyCode = 53;
|
|
||||||
|
|
||||||
@implementation BrowserWindow
|
@implementation BrowserWindow
|
||||||
|
|
||||||
- (void)sendEvent:(NSEvent *)theEvent
|
|
||||||
{
|
|
||||||
// We need this hack because NSWindow::sendEvent will eat the escape key
|
|
||||||
// and won't pass it down to the key handler of responders in the window.
|
|
||||||
// We have to override sendEvent for all of our escape key needs.
|
|
||||||
if ([theEvent keyCode] == kEscapeKeyCode && [theEvent type] == NSKeyDown) {
|
|
||||||
NSText *fieldEditor = [self fieldEditor:NO forObject:mAutoCompleteTextField];
|
|
||||||
if (fieldEditor && [self firstResponder] == fieldEditor) {
|
|
||||||
[mAutoCompleteTextField revertText];
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
[super sendEvent:theEvent];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)makeFirstResponder:(NSResponder*)responder
|
- (BOOL)makeFirstResponder:(NSResponder*)responder
|
||||||
{
|
{
|
||||||
NSResponder* oldResponder = [self firstResponder];
|
NSResponder* oldResponder = [self firstResponder];
|
||||||
|
|
|
@ -50,34 +50,34 @@
|
||||||
CLASS = BrowserWindowController;
|
CLASS = BrowserWindowController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
mAddBookmarkCheckbox = id;
|
mAddBookmarkCheckbox = NSButton;
|
||||||
mAddBookmarkFolderField = id;
|
mAddBookmarkFolderField = NSPopUpButton;
|
||||||
mAddBookmarkSheetWindow = id;
|
mAddBookmarkSheetWindow = NSWindow;
|
||||||
mAddBookmarkTitleField = id;
|
mAddBookmarkTitleField = NSTextField;
|
||||||
mBackItem = id;
|
mBackItem = NSMenuItem;
|
||||||
mCachedBMDS = id;
|
mCachedBMDS = id;
|
||||||
mForwardItem = id;
|
mForwardItem = NSMenuItem;
|
||||||
mHistoryDataSource = id;
|
mHistoryDataSource = CHHistoryDataSource;
|
||||||
mImageLinkMenu = id;
|
mImageLinkMenu = NSMenu;
|
||||||
mImageMenu = id;
|
mImageMenu = NSMenu;
|
||||||
mInputMenu = id;
|
mInputMenu = NSMenu;
|
||||||
mLinkMenu = id;
|
mLinkMenu = NSMenu;
|
||||||
mLocationSheetURLField = id;
|
mLocationSheetURLField = NSTextField;
|
||||||
mLocationSheetWindow = id;
|
mLocationSheetWindow = NSWindow;
|
||||||
mLocationToolbarView = id;
|
mLocationToolbarView = NSView;
|
||||||
mLock = NSImageView;
|
mLock = NSImageView;
|
||||||
mPageMenu = id;
|
mPageMenu = NSMenu;
|
||||||
mPersonalToolbar = CHBookmarksToolbar;
|
mPersonalToolbar = CHBookmarksToolbar;
|
||||||
mProgress = NSProgressIndicator;
|
mProgress = NSProgressIndicator;
|
||||||
mSidebarBookmarksDataSource = id;
|
mSidebarBookmarksDataSource = BookmarksDataSource;
|
||||||
mSidebarBrowserView = id;
|
mSidebarBrowserView = id;
|
||||||
mSidebarDrawer = NSDrawer;
|
mSidebarDrawer = NSDrawer;
|
||||||
mSidebarSourceTabView = id;
|
mSidebarSourceTabView = NSTabView;
|
||||||
mSidebarTabView = id;
|
mSidebarTabView = NSTabView;
|
||||||
mStatus = NSTextField;
|
mStatus = NSTextField;
|
||||||
mStatusBar = NSView;
|
mStatusBar = NSView;
|
||||||
mTabBrowser = id;
|
mTabBrowser = CHExtendedTabView;
|
||||||
mURLBar = NSTextField;
|
mURLBar = NSTextView;
|
||||||
};
|
};
|
||||||
SUPERCLASS = NSWindowController;
|
SUPERCLASS = NSWindowController;
|
||||||
},
|
},
|
||||||
|
@ -89,6 +89,13 @@
|
||||||
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
SUPERCLASS = NSTextField;
|
SUPERCLASS = NSTextField;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
|
||||||
|
CLASS = CHAutoCompleteTextView;
|
||||||
|
LANGUAGE = ObjC;
|
||||||
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
|
SUPERCLASS = NSTextView;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
CLASS = CHBookmarksOutlineView;
|
CLASS = CHBookmarksOutlineView;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>56 77 632 495 0 0 1152 746 </string>
|
<string>174 64 632 495 0 0 1152 848 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>124</key>
|
<key>124</key>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
<key>463</key>
|
<key>463</key>
|
||||||
<string>22 619 200 180 0 0 1152 848 </string>
|
<string>22 619 200 180 0 0 1152 848 </string>
|
||||||
<key>56</key>
|
<key>56</key>
|
||||||
<string>442 634 343 68 0 0 1280 1002 </string>
|
<string>403 587 360 76 0 0 1152 848 </string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBFramework Version</key>
|
<key>IBFramework Version</key>
|
||||||
<string>248.0</string>
|
<string>248.0</string>
|
||||||
|
@ -43,10 +43,7 @@
|
||||||
</array>
|
</array>
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>297</integer>
|
<integer>56</integer>
|
||||||
<integer>463</integer>
|
|
||||||
<integer>336</integer>
|
|
||||||
<integer>314</integer>
|
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S60</string>
|
<string>5S60</string>
|
||||||
|
|
Двоичный файл не отображается.
|
@ -86,7 +86,7 @@ class nsIDOMNode;
|
||||||
IBOutlet NSTabView* mSidebarTabView;
|
IBOutlet NSTabView* mSidebarTabView;
|
||||||
IBOutlet NSTabView* mSidebarSourceTabView;
|
IBOutlet NSTabView* mSidebarSourceTabView;
|
||||||
IBOutlet NSView* mLocationToolbarView;
|
IBOutlet NSView* mLocationToolbarView;
|
||||||
IBOutlet NSTextField* mURLBar;
|
IBOutlet NSTextView* mURLBar;
|
||||||
IBOutlet NSTextField* mStatus;
|
IBOutlet NSTextField* mStatus;
|
||||||
IBOutlet NSProgressIndicator* mProgress;
|
IBOutlet NSProgressIndicator* mProgress;
|
||||||
IBOutlet NSImageView* mLock;
|
IBOutlet NSImageView* mLock;
|
||||||
|
@ -166,7 +166,6 @@ class nsIDOMNode;
|
||||||
|
|
||||||
- (void)performAppropriateLocationAction;
|
- (void)performAppropriateLocationAction;
|
||||||
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
|
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
|
||||||
- (void)focusURLBar;
|
|
||||||
- (void)beginLocationSheet;
|
- (void)beginLocationSheet;
|
||||||
- (IBAction)endLocationSheet:(id)sender;
|
- (IBAction)endLocationSheet:(id)sender;
|
||||||
- (IBAction)cancelLocationSheet:(id)sender;
|
- (IBAction)cancelLocationSheet:(id)sender;
|
||||||
|
@ -175,6 +174,8 @@ class nsIDOMNode;
|
||||||
- (IBAction)endAddBookmarkSheet:(id)sender;
|
- (IBAction)endAddBookmarkSheet:(id)sender;
|
||||||
- (void)cacheBookmarkDS: (id)aDS;
|
- (void)cacheBookmarkDS: (id)aDS;
|
||||||
|
|
||||||
|
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize;
|
||||||
|
|
||||||
- (IBAction)viewSource:(id)aSender;
|
- (IBAction)viewSource:(id)aSender;
|
||||||
|
|
||||||
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;
|
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;
|
||||||
|
|
|
@ -272,8 +272,6 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
[mProgress retain];
|
[mProgress retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
[[mURLBar cell] setImage: [NSImage imageNamed:@"smallbookmark"]];
|
|
||||||
|
|
||||||
// Get our saved dimensions.
|
// Get our saved dimensions.
|
||||||
[[self window] setFrameUsingName: @"NavigatorWindow"];
|
[[self window] setFrameUsingName: @"NavigatorWindow"];
|
||||||
|
|
||||||
|
@ -328,6 +326,13 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
|
||||||
|
{
|
||||||
|
//if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
|
||||||
|
// return [[self window] frame].size;
|
||||||
|
return proposedFrameSize;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)drawerWillOpen: (NSNotification*)aNotification
|
- (void)drawerWillOpen: (NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
[mSidebarBookmarksDataSource ensureBookmarks];
|
[mSidebarBookmarksDataSource ensureBookmarks];
|
||||||
|
@ -631,7 +636,8 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
|
|
||||||
- (void)focusURLBar
|
- (void)focusURLBar
|
||||||
{
|
{
|
||||||
[mURLBar selectText: self];
|
[[self window] makeFirstResponder:mURLBar];
|
||||||
|
[mURLBar selectAll: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)beginLocationSheet
|
- (void)beginLocationSheet
|
||||||
|
@ -702,7 +708,7 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
- (IBAction)goToLocationFromToolbarURLField:(id)sender
|
- (IBAction)goToLocationFromToolbarURLField:(id)sender
|
||||||
{
|
{
|
||||||
// trim off any whitespace around url
|
// trim off any whitespace around url
|
||||||
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender stringValue]];
|
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender string]];
|
||||||
CFStringTrimWhitespace((CFMutableStringRef)theURL);
|
CFStringTrimWhitespace((CFMutableStringRef)theURL);
|
||||||
[self loadURL:theURL referrer:nil];
|
[self loadURL:theURL referrer:nil];
|
||||||
[theURL release];
|
[theURL release];
|
||||||
|
@ -753,7 +759,7 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
// Get the users preferred search engine from IC
|
// Get the users preferred search engine from IC
|
||||||
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
|
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
|
||||||
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
|
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
|
||||||
if (!searchEngine || ([searchEngine cStringLength] == 0))
|
if (!searchEngine || ([searchEngine length] == 0))
|
||||||
searchEngine = @"http://dmoz.org/";
|
searchEngine = @"http://dmoz.org/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,11 +938,13 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[mURLBar setStringValue:locationString];
|
[mURLBar setString:locationString];
|
||||||
[mLocationSheetURLField setStringValue:locationString];
|
[mLocationSheetURLField setStringValue:locationString];
|
||||||
|
|
||||||
[[self window] update];
|
// don't call [window display] here, no matter how much you might want
|
||||||
[[self window] display];
|
// to, because it forces a redraw of every view in the window and with a lot
|
||||||
|
// of tabs, it's dog slow.
|
||||||
|
// [[self window] display];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)newTab:(BOOL)allowHomepage
|
-(void)newTab:(BOOL)allowHomepage
|
||||||
|
|
|
@ -25,11 +25,10 @@
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
#include "nsIAutoCompleteResults.h"
|
#include "nsIAutoCompleteResults.h"
|
||||||
|
|
||||||
@class CHAutoCompleteTextField;
|
@class CHAutoCompleteTextView;
|
||||||
|
|
||||||
@interface CHAutoCompleteDataSource : NSObject
|
@interface CHAutoCompleteDataSource : NSObject
|
||||||
{
|
{
|
||||||
CHAutoCompleteTextField *mTextField;
|
|
||||||
NSImage *mIconImage;
|
NSImage *mIconImage;
|
||||||
|
|
||||||
NSString* mErrorMessage;
|
NSString* mErrorMessage;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
@class CHAutoCompleteDataSource, CHPageProxyIcon;
|
@class CHAutoCompleteDataSource, CHPageProxyIcon;
|
||||||
|
|
||||||
@interface CHAutoCompleteTextField : NSTextField
|
@interface CHAutoCompleteTextView : NSTextView
|
||||||
{
|
{
|
||||||
IBOutlet CHPageProxyIcon *mProxyIcon;
|
IBOutlet CHPageProxyIcon *mProxyIcon;
|
||||||
NSWindow *mPopupWin;
|
NSWindow *mPopupWin;
|
||||||
|
@ -56,6 +56,7 @@
|
||||||
|
|
||||||
- (void) setSession:(NSString *)aSession;
|
- (void) setSession:(NSString *)aSession;
|
||||||
- (NSString *) session;
|
- (NSString *) session;
|
||||||
|
- (void) setPageProxyIcon:(NSImage *)aImage;
|
||||||
|
|
||||||
- (NSTableView *) tableView;
|
- (NSTableView *) tableView;
|
||||||
- (int) visibleRows;
|
- (int) visibleRows;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
||||||
|
* David Haas <haas@cae.wisc.edu>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
|
@ -31,14 +32,15 @@
|
||||||
|
|
||||||
static const int kMaxRows = 6;
|
static const int kMaxRows = 6;
|
||||||
static const int kFrameMargin = 1;
|
static const int kFrameMargin = 1;
|
||||||
|
static const int kEscapeKeyCode = 53;
|
||||||
|
|
||||||
class AutoCompleteListener : public nsIAutoCompleteListener
|
class AutoCompleteListener : public nsIAutoCompleteListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutoCompleteListener(CHAutoCompleteTextField* aTextField)
|
AutoCompleteListener(CHAutoCompleteTextView* aTextView)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mTextField = aTextField;
|
mTextView = aTextView;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
@ -49,22 +51,30 @@ public:
|
||||||
|
|
||||||
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
|
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
|
||||||
{
|
{
|
||||||
[mTextField dataReady:aResults status:aStatus];
|
[mTextView dataReady:aResults status:aStatus];
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CHAutoCompleteTextField *mTextField;
|
CHAutoCompleteTextView *mTextView;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@implementation CHAutoCompleteTextField
|
@implementation CHAutoCompleteTextView
|
||||||
|
|
||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
{
|
{
|
||||||
|
[self setAllowsUndo:YES];
|
||||||
|
[self setFieldEditor:YES];
|
||||||
|
[self setFont:[NSFont controlContentFontOfSize:0]];
|
||||||
|
[self setUsesFontPanel:NO];
|
||||||
|
[self setRichText:NO];
|
||||||
|
[self setVerticallyResizable:NO];
|
||||||
|
[self setBackgroundColor:[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0]];
|
||||||
|
|
||||||
NSTableColumn *column;
|
NSTableColumn *column;
|
||||||
NSScrollView *scrollView;
|
NSScrollView *scrollView;
|
||||||
NSCell *dataCell;
|
NSCell *dataCell;
|
||||||
|
@ -292,9 +302,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the origin of the location bar in coordinates of the root view
|
// get the origin of the location bar in coordinates of the root view
|
||||||
locationFrame = [[self superview] frame];
|
locationFrame = [[[[self superview] superview] superview] frame];
|
||||||
locationOrigin = [[[self superview] superview] convertPoint:locationFrame.origin
|
locationOrigin = [[[[[self superview] superview] superview] superview] convertPoint:locationFrame.origin toView:[[[self window] contentView] superview]];
|
||||||
toView:[[[self window] contentView] superview]];
|
|
||||||
|
|
||||||
// get the height of the table view
|
// get the height of the table view
|
||||||
winFrame = [[self window] frame];
|
winFrame = [[self window] frame];
|
||||||
|
@ -343,11 +352,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) completeResult:(int)aRow
|
- (void) completeResult:(int)aRow
|
||||||
{
|
{
|
||||||
NSRange matchRange;
|
NSRange matchRange;
|
||||||
NSText *text;
|
|
||||||
NSString *result1;
|
NSString *result1;
|
||||||
|
|
||||||
if (aRow < 0 && mSearchString) {
|
if (aRow < 0 && mSearchString) {
|
||||||
[self setStringValue:mSearchString];
|
[self setString:mSearchString];
|
||||||
} else {
|
} else {
|
||||||
if ([mDataSource rowCount] <= 0)
|
if ([mDataSource rowCount] <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -360,11 +368,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// fill in the textfield with the matching string
|
// fill in the textfield with the matching string
|
||||||
[self setStringValue:result1];
|
[self setString:result1];
|
||||||
|
|
||||||
// select the text after the search string
|
// select the text after the search string
|
||||||
text = [[self window] fieldEditor:NO forObject:self];
|
[self setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
|
||||||
[text setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,8 +380,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) enterResult:(int)aRow
|
- (void) enterResult:(int)aRow
|
||||||
{
|
{
|
||||||
if (aRow >= 0 && [mDataSource rowCount] > 0) {
|
if (aRow >= 0 && [mDataSource rowCount] > 0) {
|
||||||
[self setStringValue: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
|
[self setString: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
|
||||||
[self selectText:self];
|
[self selectAll:self];
|
||||||
[self closePopup];
|
[self closePopup];
|
||||||
} else if (mOpenTimer) {
|
} else if (mOpenTimer) {
|
||||||
// if there was a search timer going when we hit enter, cancel it
|
// if there was a search timer going when we hit enter, cancel it
|
||||||
|
@ -390,9 +397,9 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
|
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
|
||||||
if (url) {
|
if (url) {
|
||||||
[self clearResults];
|
[self clearResults];
|
||||||
|
[[self undoManager] removeAllActions];
|
||||||
[self setStringValue:url];
|
[self setString:url];
|
||||||
[self selectText:self];
|
[self selectAll:self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +452,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) onRowClicked:(id)sender
|
- (void) onRowClicked:(id)sender
|
||||||
{
|
{
|
||||||
[self enterResult:[mTableView clickedRow]];
|
[self enterResult:[mTableView clickedRow]];
|
||||||
[self sendAction:[self action] to:[self target]];
|
[[[self window] windowController] goToLocationFromToolbarURLField:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) onBlur:(id)sender
|
- (void) onBlur:(id)sender
|
||||||
|
@ -460,26 +467,29 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
// NSTextField delegate //////////////////////////////////
|
// NSTextField delegate //////////////////////////////////
|
||||||
|
|
||||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
- (void)textDidChange:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
NSText *text = [[self window] fieldEditor:NO forObject:self];
|
NSRange range = [self selectedRange];
|
||||||
NSRange range = [text selectedRange];
|
|
||||||
|
|
||||||
// make sure we're typing at the end of the string
|
// make sure we're typing at the end of the string
|
||||||
if (range.location == [[self stringValue] length])
|
if (range.location == [[self string] length])
|
||||||
[self startSearch:[self stringValue] complete:!mBackspaced];
|
[self startSearch:[self string] complete:!mBackspaced];
|
||||||
else
|
else
|
||||||
[self clearResults];
|
[self clearResults];
|
||||||
|
|
||||||
mBackspaced = NO;
|
mBackspaced = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
|
- (void)textDidEndEditing:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
[self closePopup];
|
[self closePopup];
|
||||||
|
[self setSelectedRange:NSMakeRange(0,0)];
|
||||||
|
[[self undoManager] removeAllActions];
|
||||||
|
if ([[[aNotification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
|
||||||
|
[[[self window] windowController] goToLocationFromToolbarURLField:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
|
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)command
|
||||||
{
|
{
|
||||||
if (command == @selector(insertNewline:)) {
|
if (command == @selector(insertNewline:)) {
|
||||||
[self enterResult:[mTableView selectedRow]];
|
[self enterResult:[mTableView selectedRow]];
|
||||||
|
@ -513,11 +523,24 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
command == @selector(deleteForward:)) {
|
command == @selector(deleteForward:)) {
|
||||||
// if the user deletes characters, we need to know so that
|
// if the user deletes characters, we need to know so that
|
||||||
// we can prevent autocompletion later when search results come in
|
// we can prevent autocompletion later when search results come in
|
||||||
if ([[self stringValue] length] > 1)
|
if ([[self string] length] > 1)
|
||||||
mBackspaced = YES;
|
mBackspaced = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)keyDown:(NSEvent *)theEvent
|
||||||
|
{
|
||||||
|
if ([theEvent keyCode] == kEscapeKeyCode)
|
||||||
|
[self revertText];
|
||||||
|
else
|
||||||
|
[super keyDown:theEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setPageProxyIcon:(NSImage *)aImage
|
||||||
|
{
|
||||||
|
[mProxyIcon setImage:aImage];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -56,11 +56,9 @@
|
||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
nsCAutoString cref; cref.AssignWithConversion(href);
|
if (href.IsEmpty())
|
||||||
if (cref.IsEmpty())
|
|
||||||
return;
|
return;
|
||||||
|
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
||||||
NSString* url = [NSString stringWithCString: cref.get()];
|
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[[[self window] windowController] loadURL: url referrer:nil];
|
[[[self window] windowController] loadURL: url referrer:nil];
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
||||||
|
|
||||||
[self saveInternal: url.get()
|
[self saveInternal: url.get()
|
||||||
withDocument: nsnull
|
withDocument: nsnull
|
||||||
suggestedFilename: [aFilename cString]
|
suggestedFilename: [aFilename fileSystemRepresentation]
|
||||||
bypassCache: YES
|
bypassCache: YES
|
||||||
filterView: aFilterView
|
filterView: aFilterView
|
||||||
filterList: aFilterList];
|
filterList: aFilterList];
|
||||||
|
@ -1272,7 +1272,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
||||||
|
|
||||||
return [NSString stringWithCString: urlCStr.get()];
|
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setActive: (BOOL)aIsActive
|
- (void)setActive: (BOOL)aIsActive
|
||||||
|
|
|
@ -85,7 +85,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
- (IBAction)load:(id)sender
|
- (IBAction)load:(id)sender
|
||||||
{
|
{
|
||||||
[mBrowserView loadURI:[urlbar stringValue] referrer:nil flags:NSLoadFlagsNone];
|
[mBrowserView loadURI:[urlbar string] referrer:nil flags:NSLoadFlagsNone];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)disconnectView
|
-(void)disconnectView
|
||||||
|
@ -462,6 +462,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// sizeBrowserTo
|
||||||
|
//
|
||||||
|
// Sizes window so that browser has dimensions given by |dimensions|
|
||||||
|
//
|
||||||
- (void)sizeBrowserTo:(NSSize)dimensions
|
- (void)sizeBrowserTo:(NSSize)dimensions
|
||||||
{
|
{
|
||||||
NSRect bounds = [self bounds];
|
NSRect bounds = [self bounds];
|
||||||
|
|
|
@ -50,34 +50,34 @@
|
||||||
CLASS = BrowserWindowController;
|
CLASS = BrowserWindowController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
mAddBookmarkCheckbox = id;
|
mAddBookmarkCheckbox = NSButton;
|
||||||
mAddBookmarkFolderField = id;
|
mAddBookmarkFolderField = NSPopUpButton;
|
||||||
mAddBookmarkSheetWindow = id;
|
mAddBookmarkSheetWindow = NSWindow;
|
||||||
mAddBookmarkTitleField = id;
|
mAddBookmarkTitleField = NSTextField;
|
||||||
mBackItem = id;
|
mBackItem = NSMenuItem;
|
||||||
mCachedBMDS = id;
|
mCachedBMDS = id;
|
||||||
mForwardItem = id;
|
mForwardItem = NSMenuItem;
|
||||||
mHistoryDataSource = id;
|
mHistoryDataSource = CHHistoryDataSource;
|
||||||
mImageLinkMenu = id;
|
mImageLinkMenu = NSMenu;
|
||||||
mImageMenu = id;
|
mImageMenu = NSMenu;
|
||||||
mInputMenu = id;
|
mInputMenu = NSMenu;
|
||||||
mLinkMenu = id;
|
mLinkMenu = NSMenu;
|
||||||
mLocationSheetURLField = id;
|
mLocationSheetURLField = NSTextField;
|
||||||
mLocationSheetWindow = id;
|
mLocationSheetWindow = NSWindow;
|
||||||
mLocationToolbarView = id;
|
mLocationToolbarView = NSView;
|
||||||
mLock = NSImageView;
|
mLock = NSImageView;
|
||||||
mPageMenu = id;
|
mPageMenu = NSMenu;
|
||||||
mPersonalToolbar = CHBookmarksToolbar;
|
mPersonalToolbar = CHBookmarksToolbar;
|
||||||
mProgress = NSProgressIndicator;
|
mProgress = NSProgressIndicator;
|
||||||
mSidebarBookmarksDataSource = id;
|
mSidebarBookmarksDataSource = BookmarksDataSource;
|
||||||
mSidebarBrowserView = id;
|
mSidebarBrowserView = id;
|
||||||
mSidebarDrawer = NSDrawer;
|
mSidebarDrawer = NSDrawer;
|
||||||
mSidebarSourceTabView = id;
|
mSidebarSourceTabView = NSTabView;
|
||||||
mSidebarTabView = id;
|
mSidebarTabView = NSTabView;
|
||||||
mStatus = NSTextField;
|
mStatus = NSTextField;
|
||||||
mStatusBar = NSView;
|
mStatusBar = NSView;
|
||||||
mTabBrowser = id;
|
mTabBrowser = CHExtendedTabView;
|
||||||
mURLBar = NSTextField;
|
mURLBar = NSTextView;
|
||||||
};
|
};
|
||||||
SUPERCLASS = NSWindowController;
|
SUPERCLASS = NSWindowController;
|
||||||
},
|
},
|
||||||
|
@ -89,6 +89,13 @@
|
||||||
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
SUPERCLASS = NSTextField;
|
SUPERCLASS = NSTextField;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
|
||||||
|
CLASS = CHAutoCompleteTextView;
|
||||||
|
LANGUAGE = ObjC;
|
||||||
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
|
SUPERCLASS = NSTextView;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
CLASS = CHBookmarksOutlineView;
|
CLASS = CHBookmarksOutlineView;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>56 77 632 495 0 0 1152 746 </string>
|
<string>174 64 632 495 0 0 1152 848 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>124</key>
|
<key>124</key>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
<key>463</key>
|
<key>463</key>
|
||||||
<string>22 619 200 180 0 0 1152 848 </string>
|
<string>22 619 200 180 0 0 1152 848 </string>
|
||||||
<key>56</key>
|
<key>56</key>
|
||||||
<string>442 634 343 68 0 0 1280 1002 </string>
|
<string>403 587 360 76 0 0 1152 848 </string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBFramework Version</key>
|
<key>IBFramework Version</key>
|
||||||
<string>248.0</string>
|
<string>248.0</string>
|
||||||
|
@ -43,10 +43,7 @@
|
||||||
</array>
|
</array>
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>297</integer>
|
<integer>56</integer>
|
||||||
<integer>463</integer>
|
|
||||||
<integer>336</integer>
|
|
||||||
<integer>314</integer>
|
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S60</string>
|
<string>5S60</string>
|
||||||
|
|
Двоичный файл не отображается.
|
@ -360,6 +360,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
|
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
|
||||||
{
|
{
|
||||||
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
||||||
|
|
||||||
|
// The process of creating a new tab in this brand new window loads about:blank for us as a
|
||||||
|
// side effect of calling GetDocument(). We don't need to do it again.
|
||||||
|
if ( [aURL isEqualToString:@"about:blank"] )
|
||||||
|
[browser disableLoadPage];
|
||||||
|
|
||||||
[browser loadURL: aURL referrer:aReferrer];
|
[browser loadURL: aURL referrer:aReferrer];
|
||||||
[browser showWindow: self];
|
[browser showWindow: self];
|
||||||
return browser;
|
return browser;
|
||||||
|
@ -675,20 +681,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
||||||
{
|
{
|
||||||
NSWindow* mainWindow = [mApplication mainWindow];
|
// do nothing if there is no window. we shouldn't get here in that case anyway, but
|
||||||
if (!mainWindow) {
|
// just to be safe. If there is a browser window, toggle it's personal toolbar.
|
||||||
[self openBrowserWindowWithURL: @"about:blank" andReferrer:nil];
|
if ( [self isMainWindowABrowserWindow] ) {
|
||||||
mainWindow = [mApplication mainWindow];
|
NSWindow* mainWindow = [mApplication mainWindow];
|
||||||
|
|
||||||
|
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
|
||||||
|
BOOL showToolbar = (BOOL)(!(height > 0));
|
||||||
|
|
||||||
|
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
|
||||||
|
|
||||||
|
// save prefs here
|
||||||
|
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
|
||||||
}
|
}
|
||||||
|
|
||||||
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
|
|
||||||
BOOL showToolbar = (BOOL)(!(height > 0));
|
|
||||||
|
|
||||||
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
|
|
||||||
|
|
||||||
// save prefs here
|
|
||||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
|
||||||
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) infoLink:(id)aSender
|
-(IBAction) infoLink:(id)aSender
|
||||||
|
|
|
@ -50,34 +50,34 @@
|
||||||
CLASS = BrowserWindowController;
|
CLASS = BrowserWindowController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
mAddBookmarkCheckbox = id;
|
mAddBookmarkCheckbox = NSButton;
|
||||||
mAddBookmarkFolderField = id;
|
mAddBookmarkFolderField = NSPopUpButton;
|
||||||
mAddBookmarkSheetWindow = id;
|
mAddBookmarkSheetWindow = NSWindow;
|
||||||
mAddBookmarkTitleField = id;
|
mAddBookmarkTitleField = NSTextField;
|
||||||
mBackItem = id;
|
mBackItem = NSMenuItem;
|
||||||
mCachedBMDS = id;
|
mCachedBMDS = id;
|
||||||
mForwardItem = id;
|
mForwardItem = NSMenuItem;
|
||||||
mHistoryDataSource = id;
|
mHistoryDataSource = CHHistoryDataSource;
|
||||||
mImageLinkMenu = id;
|
mImageLinkMenu = NSMenu;
|
||||||
mImageMenu = id;
|
mImageMenu = NSMenu;
|
||||||
mInputMenu = id;
|
mInputMenu = NSMenu;
|
||||||
mLinkMenu = id;
|
mLinkMenu = NSMenu;
|
||||||
mLocationSheetURLField = id;
|
mLocationSheetURLField = NSTextField;
|
||||||
mLocationSheetWindow = id;
|
mLocationSheetWindow = NSWindow;
|
||||||
mLocationToolbarView = id;
|
mLocationToolbarView = NSView;
|
||||||
mLock = NSImageView;
|
mLock = NSImageView;
|
||||||
mPageMenu = id;
|
mPageMenu = NSMenu;
|
||||||
mPersonalToolbar = CHBookmarksToolbar;
|
mPersonalToolbar = CHBookmarksToolbar;
|
||||||
mProgress = NSProgressIndicator;
|
mProgress = NSProgressIndicator;
|
||||||
mSidebarBookmarksDataSource = id;
|
mSidebarBookmarksDataSource = BookmarksDataSource;
|
||||||
mSidebarBrowserView = id;
|
mSidebarBrowserView = id;
|
||||||
mSidebarDrawer = NSDrawer;
|
mSidebarDrawer = NSDrawer;
|
||||||
mSidebarSourceTabView = id;
|
mSidebarSourceTabView = NSTabView;
|
||||||
mSidebarTabView = id;
|
mSidebarTabView = NSTabView;
|
||||||
mStatus = NSTextField;
|
mStatus = NSTextField;
|
||||||
mStatusBar = NSView;
|
mStatusBar = NSView;
|
||||||
mTabBrowser = id;
|
mTabBrowser = CHExtendedTabView;
|
||||||
mURLBar = NSTextField;
|
mURLBar = NSTextView;
|
||||||
};
|
};
|
||||||
SUPERCLASS = NSWindowController;
|
SUPERCLASS = NSWindowController;
|
||||||
},
|
},
|
||||||
|
@ -89,6 +89,13 @@
|
||||||
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
SUPERCLASS = NSTextField;
|
SUPERCLASS = NSTextField;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ACTIONS = {onBlur = id; onResize = id; onRowClicked = id; };
|
||||||
|
CLASS = CHAutoCompleteTextView;
|
||||||
|
LANGUAGE = ObjC;
|
||||||
|
OUTLETS = {mProxyIcon = CHPageProxyIcon; };
|
||||||
|
SUPERCLASS = NSTextView;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
CLASS = CHBookmarksOutlineView;
|
CLASS = CHBookmarksOutlineView;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>56 77 632 495 0 0 1152 746 </string>
|
<string>174 64 632 495 0 0 1152 848 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>124</key>
|
<key>124</key>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
<key>463</key>
|
<key>463</key>
|
||||||
<string>22 619 200 180 0 0 1152 848 </string>
|
<string>22 619 200 180 0 0 1152 848 </string>
|
||||||
<key>56</key>
|
<key>56</key>
|
||||||
<string>442 634 343 68 0 0 1280 1002 </string>
|
<string>403 587 360 76 0 0 1152 848 </string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBFramework Version</key>
|
<key>IBFramework Version</key>
|
||||||
<string>248.0</string>
|
<string>248.0</string>
|
||||||
|
@ -43,10 +43,7 @@
|
||||||
</array>
|
</array>
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>297</integer>
|
<integer>56</integer>
|
||||||
<integer>463</integer>
|
|
||||||
<integer>336</integer>
|
|
||||||
<integer>314</integer>
|
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S60</string>
|
<string>5S60</string>
|
||||||
|
|
Двоичные данные
chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib
сгенерированный
Двоичные данные
chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib
сгенерированный
Двоичный файл не отображается.
|
@ -360,6 +360,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
|
-(BrowserWindowController*)openBrowserWindowWithURL: (NSString*)aURL andReferrer: (NSString*)aReferrer
|
||||||
{
|
{
|
||||||
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
||||||
|
|
||||||
|
// The process of creating a new tab in this brand new window loads about:blank for us as a
|
||||||
|
// side effect of calling GetDocument(). We don't need to do it again.
|
||||||
|
if ( [aURL isEqualToString:@"about:blank"] )
|
||||||
|
[browser disableLoadPage];
|
||||||
|
|
||||||
[browser loadURL: aURL referrer:aReferrer];
|
[browser loadURL: aURL referrer:aReferrer];
|
||||||
[browser showWindow: self];
|
[browser showWindow: self];
|
||||||
return browser;
|
return browser;
|
||||||
|
@ -675,20 +681,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
||||||
{
|
{
|
||||||
NSWindow* mainWindow = [mApplication mainWindow];
|
// do nothing if there is no window. we shouldn't get here in that case anyway, but
|
||||||
if (!mainWindow) {
|
// just to be safe. If there is a browser window, toggle it's personal toolbar.
|
||||||
[self openBrowserWindowWithURL: @"about:blank" andReferrer:nil];
|
if ( [self isMainWindowABrowserWindow] ) {
|
||||||
mainWindow = [mApplication mainWindow];
|
NSWindow* mainWindow = [mApplication mainWindow];
|
||||||
|
|
||||||
|
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
|
||||||
|
BOOL showToolbar = (BOOL)(!(height > 0));
|
||||||
|
|
||||||
|
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
|
||||||
|
|
||||||
|
// save prefs here
|
||||||
|
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
|
||||||
}
|
}
|
||||||
|
|
||||||
float height = [[[mainWindow windowController] bookmarksToolbar] frame].size.height;
|
|
||||||
BOOL showToolbar = (BOOL)(!(height > 0));
|
|
||||||
|
|
||||||
[[[mainWindow windowController] bookmarksToolbar] showBookmarksToolbar: showToolbar];
|
|
||||||
|
|
||||||
// save prefs here
|
|
||||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
|
||||||
[defaults setInteger: ((showToolbar) ? 0 : 1) forKey: USER_DEFAULTS_HIDE_PERS_TOOLBAR_KEY];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) infoLink:(id)aSender
|
-(IBAction) infoLink:(id)aSender
|
||||||
|
|
|
@ -56,11 +56,9 @@
|
||||||
// Get the href attribute. This is the URL we want to load.
|
// Get the href attribute. This is the URL we want to load.
|
||||||
nsAutoString href;
|
nsAutoString href;
|
||||||
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
mElement->GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
nsCAutoString cref; cref.AssignWithConversion(href);
|
if (href.IsEmpty())
|
||||||
if (cref.IsEmpty())
|
|
||||||
return;
|
return;
|
||||||
|
NSString* url = [NSString stringWithCharacters: href.get() length: href.Length()];
|
||||||
NSString* url = [NSString stringWithCString: cref.get()];
|
|
||||||
|
|
||||||
// Now load the URL in the window.
|
// Now load the URL in the window.
|
||||||
[[[self window] windowController] loadURL: url referrer:nil];
|
[[[self window] windowController] loadURL: url referrer:nil];
|
||||||
|
|
|
@ -206,8 +206,8 @@
|
||||||
isGroup = YES;
|
isGroup = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* titleC = [[[mBrowserWindowController getAddBookmarkTitle] stringValue] cString];
|
nsAutoString title;
|
||||||
nsAutoString title; title.AssignWithConversion(titleC);
|
NSStringTo_nsString([[mBrowserWindowController getAddBookmarkTitle] stringValue], title);
|
||||||
|
|
||||||
nsAutoString tagName;
|
nsAutoString tagName;
|
||||||
if (mCachedHref)
|
if (mCachedHref)
|
||||||
|
@ -224,7 +224,8 @@
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
|
elt->SetAttribute(NS_LITERAL_STRING("name"), title);
|
||||||
|
|
||||||
if (mCachedHref) {
|
if (mCachedHref) {
|
||||||
nsAutoString href; href.AssignWithConversion([mCachedHref cString]);
|
nsAutoString href;
|
||||||
|
NSStringTo_nsString(mCachedHref, href);
|
||||||
[mCachedHref release];
|
[mCachedHref release];
|
||||||
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
elt->SetAttribute(NS_LITERAL_STRING("href"), href);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1214,8 +1214,8 @@ BookmarksService::PerformProxyDrop(BookmarkItem* parentItem, BookmarkItem* befor
|
||||||
nsCOMPtr<nsIDOMElement> beforeElt;
|
nsCOMPtr<nsIDOMElement> beforeElt;
|
||||||
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
beforeElt = do_QueryInterface([beforeItem contentNode]);
|
||||||
|
|
||||||
nsAutoString url; url.AssignWithConversion([[data objectForKey:@"url"] cString]);
|
nsAutoString url; NSStringTo_nsString([data objectForKey:@"url"], url);
|
||||||
nsAutoString title; title.AssignWithConversion([[data objectForKey:@"title"] cString]);
|
nsAutoString title; NSStringTo_nsString([data objectForKey:@"title"], title);
|
||||||
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
BookmarksService::AddBookmarkToFolder(url, title, parentElt, beforeElt);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,10 @@
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
#include "nsIAutoCompleteResults.h"
|
#include "nsIAutoCompleteResults.h"
|
||||||
|
|
||||||
@class CHAutoCompleteTextField;
|
@class CHAutoCompleteTextView;
|
||||||
|
|
||||||
@interface CHAutoCompleteDataSource : NSObject
|
@interface CHAutoCompleteDataSource : NSObject
|
||||||
{
|
{
|
||||||
CHAutoCompleteTextField *mTextField;
|
|
||||||
NSImage *mIconImage;
|
NSImage *mIconImage;
|
||||||
|
|
||||||
NSString* mErrorMessage;
|
NSString* mErrorMessage;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
@class CHAutoCompleteDataSource, CHPageProxyIcon;
|
@class CHAutoCompleteDataSource, CHPageProxyIcon;
|
||||||
|
|
||||||
@interface CHAutoCompleteTextField : NSTextField
|
@interface CHAutoCompleteTextView : NSTextView
|
||||||
{
|
{
|
||||||
IBOutlet CHPageProxyIcon *mProxyIcon;
|
IBOutlet CHPageProxyIcon *mProxyIcon;
|
||||||
NSWindow *mPopupWin;
|
NSWindow *mPopupWin;
|
||||||
|
@ -56,6 +56,7 @@
|
||||||
|
|
||||||
- (void) setSession:(NSString *)aSession;
|
- (void) setSession:(NSString *)aSession;
|
||||||
- (NSString *) session;
|
- (NSString *) session;
|
||||||
|
- (void) setPageProxyIcon:(NSImage *)aImage;
|
||||||
|
|
||||||
- (NSTableView *) tableView;
|
- (NSTableView *) tableView;
|
||||||
- (int) visibleRows;
|
- (int) visibleRows;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
||||||
|
* David Haas <haas@cae.wisc.edu>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
|
@ -31,14 +32,15 @@
|
||||||
|
|
||||||
static const int kMaxRows = 6;
|
static const int kMaxRows = 6;
|
||||||
static const int kFrameMargin = 1;
|
static const int kFrameMargin = 1;
|
||||||
|
static const int kEscapeKeyCode = 53;
|
||||||
|
|
||||||
class AutoCompleteListener : public nsIAutoCompleteListener
|
class AutoCompleteListener : public nsIAutoCompleteListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutoCompleteListener(CHAutoCompleteTextField* aTextField)
|
AutoCompleteListener(CHAutoCompleteTextView* aTextView)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mTextField = aTextField;
|
mTextView = aTextView;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
@ -49,22 +51,30 @@ public:
|
||||||
|
|
||||||
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
|
NS_IMETHODIMP OnAutoComplete(nsIAutoCompleteResults *aResults, AutoCompleteStatus aStatus)
|
||||||
{
|
{
|
||||||
[mTextField dataReady:aResults status:aStatus];
|
[mTextView dataReady:aResults status:aStatus];
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CHAutoCompleteTextField *mTextField;
|
CHAutoCompleteTextView *mTextView;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@implementation CHAutoCompleteTextField
|
@implementation CHAutoCompleteTextView
|
||||||
|
|
||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
{
|
{
|
||||||
|
[self setAllowsUndo:YES];
|
||||||
|
[self setFieldEditor:YES];
|
||||||
|
[self setFont:[NSFont controlContentFontOfSize:0]];
|
||||||
|
[self setUsesFontPanel:NO];
|
||||||
|
[self setRichText:NO];
|
||||||
|
[self setVerticallyResizable:NO];
|
||||||
|
[self setBackgroundColor:[NSColor colorWithCalibratedWhite: 0.98 alpha: 1.0]];
|
||||||
|
|
||||||
NSTableColumn *column;
|
NSTableColumn *column;
|
||||||
NSScrollView *scrollView;
|
NSScrollView *scrollView;
|
||||||
NSCell *dataCell;
|
NSCell *dataCell;
|
||||||
|
@ -292,9 +302,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the origin of the location bar in coordinates of the root view
|
// get the origin of the location bar in coordinates of the root view
|
||||||
locationFrame = [[self superview] frame];
|
locationFrame = [[[[self superview] superview] superview] frame];
|
||||||
locationOrigin = [[[self superview] superview] convertPoint:locationFrame.origin
|
locationOrigin = [[[[[self superview] superview] superview] superview] convertPoint:locationFrame.origin toView:[[[self window] contentView] superview]];
|
||||||
toView:[[[self window] contentView] superview]];
|
|
||||||
|
|
||||||
// get the height of the table view
|
// get the height of the table view
|
||||||
winFrame = [[self window] frame];
|
winFrame = [[self window] frame];
|
||||||
|
@ -343,11 +352,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) completeResult:(int)aRow
|
- (void) completeResult:(int)aRow
|
||||||
{
|
{
|
||||||
NSRange matchRange;
|
NSRange matchRange;
|
||||||
NSText *text;
|
|
||||||
NSString *result1;
|
NSString *result1;
|
||||||
|
|
||||||
if (aRow < 0 && mSearchString) {
|
if (aRow < 0 && mSearchString) {
|
||||||
[self setStringValue:mSearchString];
|
[self setString:mSearchString];
|
||||||
} else {
|
} else {
|
||||||
if ([mDataSource rowCount] <= 0)
|
if ([mDataSource rowCount] <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -360,11 +368,10 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// fill in the textfield with the matching string
|
// fill in the textfield with the matching string
|
||||||
[self setStringValue:result1];
|
[self setString:result1];
|
||||||
|
|
||||||
// select the text after the search string
|
// select the text after the search string
|
||||||
text = [[self window] fieldEditor:NO forObject:self];
|
[self setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
|
||||||
[text setSelectedRange:NSMakeRange([mSearchString length], [result1 length]-[mSearchString length])];
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,8 +380,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) enterResult:(int)aRow
|
- (void) enterResult:(int)aRow
|
||||||
{
|
{
|
||||||
if (aRow >= 0 && [mDataSource rowCount] > 0) {
|
if (aRow >= 0 && [mDataSource rowCount] > 0) {
|
||||||
[self setStringValue: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
|
[self setString: [mDataSource resultString:[mTableView selectedRow] column:@"col1"]];
|
||||||
[self selectText:self];
|
[self selectAll:self];
|
||||||
[self closePopup];
|
[self closePopup];
|
||||||
} else if (mOpenTimer) {
|
} else if (mOpenTimer) {
|
||||||
// if there was a search timer going when we hit enter, cancel it
|
// if there was a search timer going when we hit enter, cancel it
|
||||||
|
@ -390,9 +397,9 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
|
NSString *url = [[controller getBrowserWrapper] getCurrentURLSpec];
|
||||||
if (url) {
|
if (url) {
|
||||||
[self clearResults];
|
[self clearResults];
|
||||||
|
[[self undoManager] removeAllActions];
|
||||||
[self setStringValue:url];
|
[self setString:url];
|
||||||
[self selectText:self];
|
[self selectAll:self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +452,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
- (void) onRowClicked:(id)sender
|
- (void) onRowClicked:(id)sender
|
||||||
{
|
{
|
||||||
[self enterResult:[mTableView clickedRow]];
|
[self enterResult:[mTableView clickedRow]];
|
||||||
[self sendAction:[self action] to:[self target]];
|
[[[self window] windowController] goToLocationFromToolbarURLField:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) onBlur:(id)sender
|
- (void) onBlur:(id)sender
|
||||||
|
@ -460,26 +467,29 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
|
|
||||||
// NSTextField delegate //////////////////////////////////
|
// NSTextField delegate //////////////////////////////////
|
||||||
|
|
||||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
- (void)textDidChange:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
NSText *text = [[self window] fieldEditor:NO forObject:self];
|
NSRange range = [self selectedRange];
|
||||||
NSRange range = [text selectedRange];
|
|
||||||
|
|
||||||
// make sure we're typing at the end of the string
|
// make sure we're typing at the end of the string
|
||||||
if (range.location == [[self stringValue] length])
|
if (range.location == [[self string] length])
|
||||||
[self startSearch:[self stringValue] complete:!mBackspaced];
|
[self startSearch:[self string] complete:!mBackspaced];
|
||||||
else
|
else
|
||||||
[self clearResults];
|
[self clearResults];
|
||||||
|
|
||||||
mBackspaced = NO;
|
mBackspaced = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
|
- (void)textDidEndEditing:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
[self closePopup];
|
[self closePopup];
|
||||||
|
[self setSelectedRange:NSMakeRange(0,0)];
|
||||||
|
[[self undoManager] removeAllActions];
|
||||||
|
if ([[[aNotification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
|
||||||
|
[[[self window] windowController] goToLocationFromToolbarURLField:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
|
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)command
|
||||||
{
|
{
|
||||||
if (command == @selector(insertNewline:)) {
|
if (command == @selector(insertNewline:)) {
|
||||||
[self enterResult:[mTableView selectedRow]];
|
[self enterResult:[mTableView selectedRow]];
|
||||||
|
@ -513,11 +523,24 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
command == @selector(deleteForward:)) {
|
command == @selector(deleteForward:)) {
|
||||||
// if the user deletes characters, we need to know so that
|
// if the user deletes characters, we need to know so that
|
||||||
// we can prevent autocompletion later when search results come in
|
// we can prevent autocompletion later when search results come in
|
||||||
if ([[self stringValue] length] > 1)
|
if ([[self string] length] > 1)
|
||||||
mBackspaced = YES;
|
mBackspaced = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)keyDown:(NSEvent *)theEvent
|
||||||
|
{
|
||||||
|
if ([theEvent keyCode] == kEscapeKeyCode)
|
||||||
|
[self revertText];
|
||||||
|
else
|
||||||
|
[super keyDown:theEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setPageProxyIcon:(NSImage *)aImage
|
||||||
|
{
|
||||||
|
[mProxyIcon setImage:aImage];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
@interface BrowserWindow : NSWindow
|
@interface BrowserWindow : NSWindow
|
||||||
{
|
{
|
||||||
IBOutlet id mAutoCompleteTextField;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL) makeFirstResponder:(NSResponder*) responder;
|
-(BOOL) makeFirstResponder:(NSResponder*) responder;
|
||||||
|
|
|
@ -1,25 +1,8 @@
|
||||||
#import "BrowserWindow.h"
|
#import "BrowserWindow.h"
|
||||||
#import "CHAutoCompleteTextField.h"
|
|
||||||
#import "BrowserWindowController.h"
|
#import "BrowserWindowController.h"
|
||||||
|
|
||||||
static const int kEscapeKeyCode = 53;
|
|
||||||
|
|
||||||
@implementation BrowserWindow
|
@implementation BrowserWindow
|
||||||
|
|
||||||
- (void)sendEvent:(NSEvent *)theEvent
|
|
||||||
{
|
|
||||||
// We need this hack because NSWindow::sendEvent will eat the escape key
|
|
||||||
// and won't pass it down to the key handler of responders in the window.
|
|
||||||
// We have to override sendEvent for all of our escape key needs.
|
|
||||||
if ([theEvent keyCode] == kEscapeKeyCode && [theEvent type] == NSKeyDown) {
|
|
||||||
NSText *fieldEditor = [self fieldEditor:NO forObject:mAutoCompleteTextField];
|
|
||||||
if (fieldEditor && [self firstResponder] == fieldEditor) {
|
|
||||||
[mAutoCompleteTextField revertText];
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
[super sendEvent:theEvent];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)makeFirstResponder:(NSResponder*)responder
|
- (BOOL)makeFirstResponder:(NSResponder*)responder
|
||||||
{
|
{
|
||||||
NSResponder* oldResponder = [self firstResponder];
|
NSResponder* oldResponder = [self firstResponder];
|
||||||
|
|
|
@ -86,7 +86,7 @@ class nsIDOMNode;
|
||||||
IBOutlet NSTabView* mSidebarTabView;
|
IBOutlet NSTabView* mSidebarTabView;
|
||||||
IBOutlet NSTabView* mSidebarSourceTabView;
|
IBOutlet NSTabView* mSidebarSourceTabView;
|
||||||
IBOutlet NSView* mLocationToolbarView;
|
IBOutlet NSView* mLocationToolbarView;
|
||||||
IBOutlet NSTextField* mURLBar;
|
IBOutlet NSTextView* mURLBar;
|
||||||
IBOutlet NSTextField* mStatus;
|
IBOutlet NSTextField* mStatus;
|
||||||
IBOutlet NSProgressIndicator* mProgress;
|
IBOutlet NSProgressIndicator* mProgress;
|
||||||
IBOutlet NSImageView* mLock;
|
IBOutlet NSImageView* mLock;
|
||||||
|
@ -166,7 +166,6 @@ class nsIDOMNode;
|
||||||
|
|
||||||
- (void)performAppropriateLocationAction;
|
- (void)performAppropriateLocationAction;
|
||||||
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
|
- (IBAction)goToLocationFromToolbarURLField:(id)sender;
|
||||||
- (void)focusURLBar;
|
|
||||||
- (void)beginLocationSheet;
|
- (void)beginLocationSheet;
|
||||||
- (IBAction)endLocationSheet:(id)sender;
|
- (IBAction)endLocationSheet:(id)sender;
|
||||||
- (IBAction)cancelLocationSheet:(id)sender;
|
- (IBAction)cancelLocationSheet:(id)sender;
|
||||||
|
@ -175,6 +174,8 @@ class nsIDOMNode;
|
||||||
- (IBAction)endAddBookmarkSheet:(id)sender;
|
- (IBAction)endAddBookmarkSheet:(id)sender;
|
||||||
- (void)cacheBookmarkDS: (id)aDS;
|
- (void)cacheBookmarkDS: (id)aDS;
|
||||||
|
|
||||||
|
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize;
|
||||||
|
|
||||||
- (IBAction)viewSource:(id)aSender;
|
- (IBAction)viewSource:(id)aSender;
|
||||||
|
|
||||||
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;
|
- (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;
|
||||||
|
|
|
@ -272,8 +272,6 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
[mProgress retain];
|
[mProgress retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
[[mURLBar cell] setImage: [NSImage imageNamed:@"smallbookmark"]];
|
|
||||||
|
|
||||||
// Get our saved dimensions.
|
// Get our saved dimensions.
|
||||||
[[self window] setFrameUsingName: @"NavigatorWindow"];
|
[[self window] setFrameUsingName: @"NavigatorWindow"];
|
||||||
|
|
||||||
|
@ -328,6 +326,13 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
|
||||||
|
{
|
||||||
|
//if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) )
|
||||||
|
// return [[self window] frame].size;
|
||||||
|
return proposedFrameSize;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)drawerWillOpen: (NSNotification*)aNotification
|
- (void)drawerWillOpen: (NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
[mSidebarBookmarksDataSource ensureBookmarks];
|
[mSidebarBookmarksDataSource ensureBookmarks];
|
||||||
|
@ -631,7 +636,8 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
|
|
||||||
- (void)focusURLBar
|
- (void)focusURLBar
|
||||||
{
|
{
|
||||||
[mURLBar selectText: self];
|
[[self window] makeFirstResponder:mURLBar];
|
||||||
|
[mURLBar selectAll: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)beginLocationSheet
|
- (void)beginLocationSheet
|
||||||
|
@ -702,7 +708,7 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
- (IBAction)goToLocationFromToolbarURLField:(id)sender
|
- (IBAction)goToLocationFromToolbarURLField:(id)sender
|
||||||
{
|
{
|
||||||
// trim off any whitespace around url
|
// trim off any whitespace around url
|
||||||
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender stringValue]];
|
NSMutableString *theURL = [[NSMutableString alloc] initWithString:[sender string]];
|
||||||
CFStringTrimWhitespace((CFMutableStringRef)theURL);
|
CFStringTrimWhitespace((CFMutableStringRef)theURL);
|
||||||
[self loadURL:theURL referrer:nil];
|
[self loadURL:theURL referrer:nil];
|
||||||
[theURL release];
|
[theURL release];
|
||||||
|
@ -753,7 +759,7 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
// Get the users preferred search engine from IC
|
// Get the users preferred search engine from IC
|
||||||
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
|
if (!searchEngine || [searchEngine isEqualToString:@"SearchPageDefault"]) {
|
||||||
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
|
searchEngine = [[CHPreferenceManager sharedInstance] getICStringPref:kICWebSearchPagePrefs];
|
||||||
if (!searchEngine || ([searchEngine cStringLength] == 0))
|
if (!searchEngine || ([searchEngine length] == 0))
|
||||||
searchEngine = @"http://dmoz.org/";
|
searchEngine = @"http://dmoz.org/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,11 +938,13 @@ static NSArray* sToolbarDefaults = nil;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[mURLBar setStringValue:locationString];
|
[mURLBar setString:locationString];
|
||||||
[mLocationSheetURLField setStringValue:locationString];
|
[mLocationSheetURLField setStringValue:locationString];
|
||||||
|
|
||||||
[[self window] update];
|
// don't call [window display] here, no matter how much you might want
|
||||||
[[self window] display];
|
// to, because it forces a redraw of every view in the window and with a lot
|
||||||
|
// of tabs, it's dog slow.
|
||||||
|
// [[self window] display];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)newTab:(BOOL)allowHomepage
|
-(void)newTab:(BOOL)allowHomepage
|
||||||
|
|
|
@ -85,7 +85,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
- (IBAction)load:(id)sender
|
- (IBAction)load:(id)sender
|
||||||
{
|
{
|
||||||
[mBrowserView loadURI:[urlbar stringValue] referrer:nil flags:NSLoadFlagsNone];
|
[mBrowserView loadURI:[urlbar string] referrer:nil flags:NSLoadFlagsNone];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)disconnectView
|
-(void)disconnectView
|
||||||
|
@ -462,6 +462,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// sizeBrowserTo
|
||||||
|
//
|
||||||
|
// Sizes window so that browser has dimensions given by |dimensions|
|
||||||
|
//
|
||||||
- (void)sizeBrowserTo:(NSSize)dimensions
|
- (void)sizeBrowserTo:(NSSize)dimensions
|
||||||
{
|
{
|
||||||
NSRect bounds = [self bounds];
|
NSRect bounds = [self bounds];
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
||||||
|
|
||||||
[self saveInternal: url.get()
|
[self saveInternal: url.get()
|
||||||
withDocument: nsnull
|
withDocument: nsnull
|
||||||
suggestedFilename: [aFilename cString]
|
suggestedFilename: [aFilename fileSystemRepresentation]
|
||||||
bypassCache: YES
|
bypassCache: YES
|
||||||
filterView: aFilterView
|
filterView: aFilterView
|
||||||
filterList: aFilterList];
|
filterList: aFilterList];
|
||||||
|
@ -1272,7 +1272,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
|
||||||
location->GetHref(urlStr);
|
location->GetHref(urlStr);
|
||||||
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
|
||||||
|
|
||||||
return [NSString stringWithCString: urlCStr.get()];
|
return [NSString stringWithCharacters: urlStr.get() length: urlStr.Length()];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setActive: (BOOL)aIsActive
|
- (void)setActive: (BOOL)aIsActive
|
||||||
|
|
Загрузка…
Ссылка в новой задаче