Added ability to show/hide personal toolbar and persist (bug 149725)
git-svn-id: svn://10.0.0.236/trunk@124024 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
fac1614754
commit
2a4abd365d
@ -182,6 +182,8 @@ class nsIDOMNode;
|
||||
-(void) biggerTextSize;
|
||||
-(void) smallerTextSize;
|
||||
|
||||
- (BOOL)shouldShowBookmarkToolbar;
|
||||
|
||||
- (void)addBookmarkExtended: (BOOL)aIsFromMenu isFolder:(BOOL)aIsFolder;
|
||||
- (IBAction)manageBookmarks: (id)aSender;
|
||||
- (void)importBookmarks: (NSString*)aURLSpec;
|
||||
|
||||
@ -247,6 +247,9 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
|
||||
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
|
||||
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
|
||||
}
|
||||
else if (![self shouldShowBookmarkToolbar]) {
|
||||
[mPersonalToolbar showBookmarksToolbar:NO];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1034,6 +1037,15 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
|
||||
markupViewer->SetTextZoom(zoom);
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowBookmarkToolbar
|
||||
{
|
||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||
if ([defaults integerForKey:@"Personal TB Is Shown"] == 0)
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(id)getAddBookmarkSheetWindow
|
||||
{
|
||||
return mAddBookmarkSheetWindow;
|
||||
|
||||
@ -33,6 +33,7 @@ class CHBookmarksButton;
|
||||
NSMutableArray* mButtons;
|
||||
CHBookmarksButton* mDragInsertionButton;
|
||||
int mDragInsertionPosition;
|
||||
BOOL mIsShowing;
|
||||
}
|
||||
|
||||
-(void)initializeToolbar;
|
||||
@ -46,6 +47,7 @@ class CHBookmarksButton;
|
||||
-(void)reflowButtons;
|
||||
-(void)reflowButtonsStartingAtIndex: (int)aIndex;
|
||||
|
||||
-(BOOL)isShown;
|
||||
-(void)showBookmarksToolbar: (BOOL)aShow;
|
||||
|
||||
- (void) setButtonInsertionPoint:(NSPoint)aPoint;
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Hyatt <hyatt@netscape.com> (Original Author)
|
||||
* Kathy Brade <brade@netscape.com>
|
||||
*/
|
||||
|
||||
#import "CHBookmarksButton.h"
|
||||
@ -36,6 +37,7 @@
|
||||
mDragInsertionButton = nil;
|
||||
mDragInsertionPosition = BookmarksService::CHInsertNone;
|
||||
[self registerForDraggedTypes:[NSArray arrayWithObjects:@"MozURLType", @"MozBookmarkType", nil]];
|
||||
mIsShowing = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -100,6 +102,7 @@
|
||||
temp->GetNextSibling(getter_AddRefs(child));
|
||||
}
|
||||
|
||||
if ([self isShown])
|
||||
[self reflowButtons];
|
||||
}
|
||||
|
||||
@ -109,7 +112,8 @@
|
||||
[button setElement: aElt];
|
||||
[self addSubview: button];
|
||||
[mButtons insertObject: button atIndex: aIndex];
|
||||
[self reflowButtonsStartingAtIndex: aIndex];
|
||||
if ([self isShown])
|
||||
[self reflowButtonsStartingAtIndex: aIndex];
|
||||
}
|
||||
|
||||
-(void)removeButton: (nsIDOMElement*)aElt
|
||||
@ -120,13 +124,13 @@
|
||||
if ([button element] == aElt) {
|
||||
[mButtons removeObjectAtIndex: i];
|
||||
[button removeFromSuperview];
|
||||
if (count > i)
|
||||
if (count > i && [self isShown])
|
||||
[self reflowButtonsStartingAtIndex: i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[self setNeedsDisplay: YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
}
|
||||
|
||||
-(void)reflowButtons
|
||||
@ -177,7 +181,7 @@
|
||||
if (computedHeight != oldHeight) {
|
||||
[self setFrame: NSMakeRect([self frame].origin.x, [self frame].origin.y + (oldHeight - computedHeight),
|
||||
[self frame].size.width, computedHeight)];
|
||||
[self setNeedsDisplay: YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
|
||||
// adjust the content area.
|
||||
float sizeChange = computedHeight - oldHeight;
|
||||
@ -228,6 +232,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)isShown
|
||||
{
|
||||
return mIsShowing;
|
||||
}
|
||||
|
||||
-(void)showBookmarksToolbar: (BOOL)aShow
|
||||
{
|
||||
if (!aShow) {
|
||||
@ -239,9 +248,11 @@
|
||||
[view setFrame: NSMakeRect([view frame].origin.x, [view frame].origin.y,
|
||||
[view frame].size.width, [view frame].size.height + height)];
|
||||
}
|
||||
//else
|
||||
else
|
||||
// Reflowing the buttons will do the right thing.
|
||||
// [self reflowButtons];
|
||||
[self reflowButtons];
|
||||
|
||||
mIsShowing = aShow;
|
||||
}
|
||||
|
||||
- (void)setButtonInsertionPoint:(NSPoint)aPoint
|
||||
@ -385,7 +396,7 @@
|
||||
|
||||
mDragInsertionButton = nil;
|
||||
mDragInsertionPosition = BookmarksService::CHInsertNone;
|
||||
[self setNeedsDisplay:YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@ -714,7 +714,7 @@ private:
|
||||
NS_IMPL_ISUPPORTS1(nsHeaderSniffer, nsIWebProgressListener)
|
||||
|
||||
// Implementation of nsIWebProgressListener
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in unsigned long aStatus); */
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */
|
||||
NS_IMETHODIMP
|
||||
nsHeaderSniffer::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags,
|
||||
PRUint32 aStatus)
|
||||
|
||||
Binary file not shown.
@ -46,6 +46,7 @@
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>78 108 356 240 0 0 1152 848 </string>
|
||||
<string>262 78 356 240 0 0 1152 848 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>0 804 446 44 0 0 1152 848 </string>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
||||
BIN
mozilla/camino/English.lproj/MainMenu.nib/objects.nib
generated
BIN
mozilla/camino/English.lproj/MainMenu.nib/objects.nib
generated
Binary file not shown.
@ -56,6 +56,8 @@ class BookmarksService;
|
||||
|
||||
// The bookmarks menu.
|
||||
IBOutlet id mBookmarksMenu;
|
||||
|
||||
IBOutlet id mBookmarksToolbarMenuItem;
|
||||
|
||||
BOOL mOffline;
|
||||
|
||||
|
||||
@ -310,7 +310,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
{
|
||||
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
||||
[browser loadURL: aURL];
|
||||
[browser showWindow: self];
|
||||
[browser showWindow: self];
|
||||
return browser;
|
||||
}
|
||||
|
||||
@ -459,7 +459,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
action == @selector(printPage:) ||
|
||||
action == @selector(findInPage:) ||
|
||||
action == @selector(findAgain:) ||
|
||||
action == @selector(toggleBookmarksToolbar:) ||
|
||||
action == @selector(doStop:) ||
|
||||
action == @selector(doReload:) ||
|
||||
action == @selector(biggerTextSize:) ||
|
||||
@ -472,7 +471,23 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
// check what the state of the toolbar should be, but only if there is a browser
|
||||
// window open
|
||||
if (action == @selector(toggleBookmarksToolbar:)) {
|
||||
if ([[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]]) {
|
||||
float height = [[[[mApplication mainWindow] windowController] bookmarksToolbar] frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
// only activate if we've got multiple tabs open.
|
||||
if ((action == @selector(closeTab:) ||
|
||||
action == @selector (nextTab:) ||
|
||||
@ -483,12 +498,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
}
|
||||
|
||||
if ( action == @selector(goBack:) || action == @selector(goForward:) ) {
|
||||
NSWindow* mainWindow = [mApplication mainWindow];
|
||||
if (mainWindow) {
|
||||
if ([[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]]) {
|
||||
if (action == @selector(goBack:))
|
||||
return [[[[mainWindow windowController] getBrowserWrapper] getBrowserView] canGoBack];
|
||||
return [[[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView] canGoBack];
|
||||
if (action == @selector(goForward:))
|
||||
return [[[[mainWindow windowController] getBrowserWrapper] getBrowserView] canGoForward];
|
||||
return [[[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView] canGoForward];
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
@ -500,7 +514,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
|
||||
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
||||
{
|
||||
//XXX do nothing for now
|
||||
NSWindow* mainWindow = [mApplication mainWindow];
|
||||
if (!mainWindow) {
|
||||
[self openBrowserWindowWithURL: @"about:blank"];
|
||||
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 setObject: [NSNumber numberWithInt: ((showToolbar) ? 1 : 0)] forKey: @"Personal TB Is Shown"];
|
||||
}
|
||||
|
||||
+ (NSImage*)createImageForDragging:(NSImage*)aIcon title:(NSString*)aTitle
|
||||
|
||||
1
mozilla/camino/MainMenu.nib/classes.nib
generated
1
mozilla/camino/MainMenu.nib/classes.nib
generated
@ -46,6 +46,7 @@
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
|
||||
4
mozilla/camino/MainMenu.nib/info.nib
generated
4
mozilla/camino/MainMenu.nib/info.nib
generated
@ -3,13 +3,13 @@
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>78 108 356 240 0 0 1152 848 </string>
|
||||
<string>262 78 356 240 0 0 1152 848 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>0 804 446 44 0 0 1152 848 </string>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
||||
BIN
mozilla/camino/MainMenu.nib/objects.nib
generated
BIN
mozilla/camino/MainMenu.nib/objects.nib
generated
Binary file not shown.
Binary file not shown.
@ -46,6 +46,7 @@
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>78 108 356 240 0 0 1152 848 </string>
|
||||
<string>262 78 356 240 0 0 1152 848 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>0 804 446 44 0 0 1152 848 </string>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
||||
Binary file not shown.
@ -56,6 +56,8 @@ class BookmarksService;
|
||||
|
||||
// The bookmarks menu.
|
||||
IBOutlet id mBookmarksMenu;
|
||||
|
||||
IBOutlet id mBookmarksToolbarMenuItem;
|
||||
|
||||
BOOL mOffline;
|
||||
|
||||
|
||||
@ -310,7 +310,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
{
|
||||
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
||||
[browser loadURL: aURL];
|
||||
[browser showWindow: self];
|
||||
[browser showWindow: self];
|
||||
return browser;
|
||||
}
|
||||
|
||||
@ -459,7 +459,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
action == @selector(printPage:) ||
|
||||
action == @selector(findInPage:) ||
|
||||
action == @selector(findAgain:) ||
|
||||
action == @selector(toggleBookmarksToolbar:) ||
|
||||
action == @selector(doStop:) ||
|
||||
action == @selector(doReload:) ||
|
||||
action == @selector(biggerTextSize:) ||
|
||||
@ -472,7 +471,23 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
// check what the state of the toolbar should be, but only if there is a browser
|
||||
// window open
|
||||
if (action == @selector(toggleBookmarksToolbar:)) {
|
||||
if ([[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]]) {
|
||||
float height = [[[[mApplication mainWindow] windowController] bookmarksToolbar] frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
// only activate if we've got multiple tabs open.
|
||||
if ((action == @selector(closeTab:) ||
|
||||
action == @selector (nextTab:) ||
|
||||
@ -483,12 +498,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
}
|
||||
|
||||
if ( action == @selector(goBack:) || action == @selector(goForward:) ) {
|
||||
NSWindow* mainWindow = [mApplication mainWindow];
|
||||
if (mainWindow) {
|
||||
if ([[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]]) {
|
||||
if (action == @selector(goBack:))
|
||||
return [[[[mainWindow windowController] getBrowserWrapper] getBrowserView] canGoBack];
|
||||
return [[[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView] canGoBack];
|
||||
if (action == @selector(goForward:))
|
||||
return [[[[mainWindow windowController] getBrowserWrapper] getBrowserView] canGoForward];
|
||||
return [[[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView] canGoForward];
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
@ -500,7 +514,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
|
||||
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
||||
{
|
||||
//XXX do nothing for now
|
||||
NSWindow* mainWindow = [mApplication mainWindow];
|
||||
if (!mainWindow) {
|
||||
[self openBrowserWindowWithURL: @"about:blank"];
|
||||
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 setObject: [NSNumber numberWithInt: ((showToolbar) ? 1 : 0)] forKey: @"Personal TB Is Shown"];
|
||||
}
|
||||
|
||||
+ (NSImage*)createImageForDragging:(NSImage*)aIcon title:(NSString*)aTitle
|
||||
|
||||
@ -33,6 +33,7 @@ class CHBookmarksButton;
|
||||
NSMutableArray* mButtons;
|
||||
CHBookmarksButton* mDragInsertionButton;
|
||||
int mDragInsertionPosition;
|
||||
BOOL mIsShowing;
|
||||
}
|
||||
|
||||
-(void)initializeToolbar;
|
||||
@ -46,6 +47,7 @@ class CHBookmarksButton;
|
||||
-(void)reflowButtons;
|
||||
-(void)reflowButtonsStartingAtIndex: (int)aIndex;
|
||||
|
||||
-(BOOL)isShown;
|
||||
-(void)showBookmarksToolbar: (BOOL)aShow;
|
||||
|
||||
- (void) setButtonInsertionPoint:(NSPoint)aPoint;
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Hyatt <hyatt@netscape.com> (Original Author)
|
||||
* Kathy Brade <brade@netscape.com>
|
||||
*/
|
||||
|
||||
#import "CHBookmarksButton.h"
|
||||
@ -36,6 +37,7 @@
|
||||
mDragInsertionButton = nil;
|
||||
mDragInsertionPosition = BookmarksService::CHInsertNone;
|
||||
[self registerForDraggedTypes:[NSArray arrayWithObjects:@"MozURLType", @"MozBookmarkType", nil]];
|
||||
mIsShowing = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -100,6 +102,7 @@
|
||||
temp->GetNextSibling(getter_AddRefs(child));
|
||||
}
|
||||
|
||||
if ([self isShown])
|
||||
[self reflowButtons];
|
||||
}
|
||||
|
||||
@ -109,7 +112,8 @@
|
||||
[button setElement: aElt];
|
||||
[self addSubview: button];
|
||||
[mButtons insertObject: button atIndex: aIndex];
|
||||
[self reflowButtonsStartingAtIndex: aIndex];
|
||||
if ([self isShown])
|
||||
[self reflowButtonsStartingAtIndex: aIndex];
|
||||
}
|
||||
|
||||
-(void)removeButton: (nsIDOMElement*)aElt
|
||||
@ -120,13 +124,13 @@
|
||||
if ([button element] == aElt) {
|
||||
[mButtons removeObjectAtIndex: i];
|
||||
[button removeFromSuperview];
|
||||
if (count > i)
|
||||
if (count > i && [self isShown])
|
||||
[self reflowButtonsStartingAtIndex: i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[self setNeedsDisplay: YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
}
|
||||
|
||||
-(void)reflowButtons
|
||||
@ -177,7 +181,7 @@
|
||||
if (computedHeight != oldHeight) {
|
||||
[self setFrame: NSMakeRect([self frame].origin.x, [self frame].origin.y + (oldHeight - computedHeight),
|
||||
[self frame].size.width, computedHeight)];
|
||||
[self setNeedsDisplay: YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
|
||||
// adjust the content area.
|
||||
float sizeChange = computedHeight - oldHeight;
|
||||
@ -228,6 +232,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)isShown
|
||||
{
|
||||
return mIsShowing;
|
||||
}
|
||||
|
||||
-(void)showBookmarksToolbar: (BOOL)aShow
|
||||
{
|
||||
if (!aShow) {
|
||||
@ -239,9 +248,11 @@
|
||||
[view setFrame: NSMakeRect([view frame].origin.x, [view frame].origin.y,
|
||||
[view frame].size.width, [view frame].size.height + height)];
|
||||
}
|
||||
//else
|
||||
else
|
||||
// Reflowing the buttons will do the right thing.
|
||||
// [self reflowButtons];
|
||||
[self reflowButtons];
|
||||
|
||||
mIsShowing = aShow;
|
||||
}
|
||||
|
||||
- (void)setButtonInsertionPoint:(NSPoint)aPoint
|
||||
@ -385,7 +396,7 @@
|
||||
|
||||
mDragInsertionButton = nil;
|
||||
mDragInsertionPosition = BookmarksService::CHInsertNone;
|
||||
[self setNeedsDisplay:YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@ -182,6 +182,8 @@ class nsIDOMNode;
|
||||
-(void) biggerTextSize;
|
||||
-(void) smallerTextSize;
|
||||
|
||||
- (BOOL)shouldShowBookmarkToolbar;
|
||||
|
||||
- (void)addBookmarkExtended: (BOOL)aIsFromMenu isFolder:(BOOL)aIsFolder;
|
||||
- (IBAction)manageBookmarks: (id)aSender;
|
||||
- (void)importBookmarks: (NSString*)aURLSpec;
|
||||
|
||||
@ -247,6 +247,9 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
|
||||
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
|
||||
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
|
||||
}
|
||||
else if (![self shouldShowBookmarkToolbar]) {
|
||||
[mPersonalToolbar showBookmarksToolbar:NO];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1034,6 +1037,15 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
|
||||
markupViewer->SetTextZoom(zoom);
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowBookmarkToolbar
|
||||
{
|
||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||
if ([defaults integerForKey:@"Personal TB Is Shown"] == 0)
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(id)getAddBookmarkSheetWindow
|
||||
{
|
||||
return mAddBookmarkSheetWindow;
|
||||
|
||||
@ -714,7 +714,7 @@ private:
|
||||
NS_IMPL_ISUPPORTS1(nsHeaderSniffer, nsIWebProgressListener)
|
||||
|
||||
// Implementation of nsIWebProgressListener
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in unsigned long aStatus); */
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */
|
||||
NS_IMETHODIMP
|
||||
nsHeaderSniffer::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags,
|
||||
PRUint32 aStatus)
|
||||
|
||||
@ -182,6 +182,8 @@ class nsIDOMNode;
|
||||
-(void) biggerTextSize;
|
||||
-(void) smallerTextSize;
|
||||
|
||||
- (BOOL)shouldShowBookmarkToolbar;
|
||||
|
||||
- (void)addBookmarkExtended: (BOOL)aIsFromMenu isFolder:(BOOL)aIsFolder;
|
||||
- (IBAction)manageBookmarks: (id)aSender;
|
||||
- (void)importBookmarks: (NSString*)aURLSpec;
|
||||
|
||||
@ -247,6 +247,9 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
|
||||
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
|
||||
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
|
||||
}
|
||||
else if (![self shouldShowBookmarkToolbar]) {
|
||||
[mPersonalToolbar showBookmarksToolbar:NO];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1034,6 +1037,15 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
|
||||
markupViewer->SetTextZoom(zoom);
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowBookmarkToolbar
|
||||
{
|
||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||
if ([defaults integerForKey:@"Personal TB Is Shown"] == 0)
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(id)getAddBookmarkSheetWindow
|
||||
{
|
||||
return mAddBookmarkSheetWindow;
|
||||
|
||||
@ -33,6 +33,7 @@ class CHBookmarksButton;
|
||||
NSMutableArray* mButtons;
|
||||
CHBookmarksButton* mDragInsertionButton;
|
||||
int mDragInsertionPosition;
|
||||
BOOL mIsShowing;
|
||||
}
|
||||
|
||||
-(void)initializeToolbar;
|
||||
@ -46,6 +47,7 @@ class CHBookmarksButton;
|
||||
-(void)reflowButtons;
|
||||
-(void)reflowButtonsStartingAtIndex: (int)aIndex;
|
||||
|
||||
-(BOOL)isShown;
|
||||
-(void)showBookmarksToolbar: (BOOL)aShow;
|
||||
|
||||
- (void) setButtonInsertionPoint:(NSPoint)aPoint;
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Hyatt <hyatt@netscape.com> (Original Author)
|
||||
* Kathy Brade <brade@netscape.com>
|
||||
*/
|
||||
|
||||
#import "CHBookmarksButton.h"
|
||||
@ -36,6 +37,7 @@
|
||||
mDragInsertionButton = nil;
|
||||
mDragInsertionPosition = BookmarksService::CHInsertNone;
|
||||
[self registerForDraggedTypes:[NSArray arrayWithObjects:@"MozURLType", @"MozBookmarkType", nil]];
|
||||
mIsShowing = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -100,6 +102,7 @@
|
||||
temp->GetNextSibling(getter_AddRefs(child));
|
||||
}
|
||||
|
||||
if ([self isShown])
|
||||
[self reflowButtons];
|
||||
}
|
||||
|
||||
@ -109,7 +112,8 @@
|
||||
[button setElement: aElt];
|
||||
[self addSubview: button];
|
||||
[mButtons insertObject: button atIndex: aIndex];
|
||||
[self reflowButtonsStartingAtIndex: aIndex];
|
||||
if ([self isShown])
|
||||
[self reflowButtonsStartingAtIndex: aIndex];
|
||||
}
|
||||
|
||||
-(void)removeButton: (nsIDOMElement*)aElt
|
||||
@ -120,13 +124,13 @@
|
||||
if ([button element] == aElt) {
|
||||
[mButtons removeObjectAtIndex: i];
|
||||
[button removeFromSuperview];
|
||||
if (count > i)
|
||||
if (count > i && [self isShown])
|
||||
[self reflowButtonsStartingAtIndex: i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[self setNeedsDisplay: YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
}
|
||||
|
||||
-(void)reflowButtons
|
||||
@ -177,7 +181,7 @@
|
||||
if (computedHeight != oldHeight) {
|
||||
[self setFrame: NSMakeRect([self frame].origin.x, [self frame].origin.y + (oldHeight - computedHeight),
|
||||
[self frame].size.width, computedHeight)];
|
||||
[self setNeedsDisplay: YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
|
||||
// adjust the content area.
|
||||
float sizeChange = computedHeight - oldHeight;
|
||||
@ -228,6 +232,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)isShown
|
||||
{
|
||||
return mIsShowing;
|
||||
}
|
||||
|
||||
-(void)showBookmarksToolbar: (BOOL)aShow
|
||||
{
|
||||
if (!aShow) {
|
||||
@ -239,9 +248,11 @@
|
||||
[view setFrame: NSMakeRect([view frame].origin.x, [view frame].origin.y,
|
||||
[view frame].size.width, [view frame].size.height + height)];
|
||||
}
|
||||
//else
|
||||
else
|
||||
// Reflowing the buttons will do the right thing.
|
||||
// [self reflowButtons];
|
||||
[self reflowButtons];
|
||||
|
||||
mIsShowing = aShow;
|
||||
}
|
||||
|
||||
- (void)setButtonInsertionPoint:(NSPoint)aPoint
|
||||
@ -385,7 +396,7 @@
|
||||
|
||||
mDragInsertionButton = nil;
|
||||
mDragInsertionPosition = BookmarksService::CHInsertNone;
|
||||
[self setNeedsDisplay:YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@ -714,7 +714,7 @@ private:
|
||||
NS_IMPL_ISUPPORTS1(nsHeaderSniffer, nsIWebProgressListener)
|
||||
|
||||
// Implementation of nsIWebProgressListener
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in unsigned long aStatus); */
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */
|
||||
NS_IMETHODIMP
|
||||
nsHeaderSniffer::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags,
|
||||
PRUint32 aStatus)
|
||||
|
||||
Binary file not shown.
@ -46,6 +46,7 @@
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>78 108 356 240 0 0 1152 848 </string>
|
||||
<string>262 78 356 240 0 0 1152 848 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>0 804 446 44 0 0 1152 848 </string>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
||||
BIN
mozilla/chimera/English.lproj/MainMenu.nib/objects.nib
generated
BIN
mozilla/chimera/English.lproj/MainMenu.nib/objects.nib
generated
Binary file not shown.
@ -56,6 +56,8 @@ class BookmarksService;
|
||||
|
||||
// The bookmarks menu.
|
||||
IBOutlet id mBookmarksMenu;
|
||||
|
||||
IBOutlet id mBookmarksToolbarMenuItem;
|
||||
|
||||
BOOL mOffline;
|
||||
|
||||
|
||||
@ -310,7 +310,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
{
|
||||
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
||||
[browser loadURL: aURL];
|
||||
[browser showWindow: self];
|
||||
[browser showWindow: self];
|
||||
return browser;
|
||||
}
|
||||
|
||||
@ -459,7 +459,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
action == @selector(printPage:) ||
|
||||
action == @selector(findInPage:) ||
|
||||
action == @selector(findAgain:) ||
|
||||
action == @selector(toggleBookmarksToolbar:) ||
|
||||
action == @selector(doStop:) ||
|
||||
action == @selector(doReload:) ||
|
||||
action == @selector(biggerTextSize:) ||
|
||||
@ -472,7 +471,23 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
// check what the state of the toolbar should be, but only if there is a browser
|
||||
// window open
|
||||
if (action == @selector(toggleBookmarksToolbar:)) {
|
||||
if ([[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]]) {
|
||||
float height = [[[[mApplication mainWindow] windowController] bookmarksToolbar] frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
// only activate if we've got multiple tabs open.
|
||||
if ((action == @selector(closeTab:) ||
|
||||
action == @selector (nextTab:) ||
|
||||
@ -483,12 +498,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
}
|
||||
|
||||
if ( action == @selector(goBack:) || action == @selector(goForward:) ) {
|
||||
NSWindow* mainWindow = [mApplication mainWindow];
|
||||
if (mainWindow) {
|
||||
if ([[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]]) {
|
||||
if (action == @selector(goBack:))
|
||||
return [[[[mainWindow windowController] getBrowserWrapper] getBrowserView] canGoBack];
|
||||
return [[[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView] canGoBack];
|
||||
if (action == @selector(goForward:))
|
||||
return [[[[mainWindow windowController] getBrowserWrapper] getBrowserView] canGoForward];
|
||||
return [[[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView] canGoForward];
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
@ -500,7 +514,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
|
||||
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
||||
{
|
||||
//XXX do nothing for now
|
||||
NSWindow* mainWindow = [mApplication mainWindow];
|
||||
if (!mainWindow) {
|
||||
[self openBrowserWindowWithURL: @"about:blank"];
|
||||
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 setObject: [NSNumber numberWithInt: ((showToolbar) ? 1 : 0)] forKey: @"Personal TB Is Shown"];
|
||||
}
|
||||
|
||||
+ (NSImage*)createImageForDragging:(NSImage*)aIcon title:(NSString*)aTitle
|
||||
|
||||
1
mozilla/chimera/MainMenu.nib/classes.nib
generated
1
mozilla/chimera/MainMenu.nib/classes.nib
generated
@ -46,6 +46,7 @@
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
|
||||
4
mozilla/chimera/MainMenu.nib/info.nib
generated
4
mozilla/chimera/MainMenu.nib/info.nib
generated
@ -3,13 +3,13 @@
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>78 108 356 240 0 0 1152 848 </string>
|
||||
<string>262 78 356 240 0 0 1152 848 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>0 804 446 44 0 0 1152 848 </string>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
||||
BIN
mozilla/chimera/MainMenu.nib/objects.nib
generated
BIN
mozilla/chimera/MainMenu.nib/objects.nib
generated
Binary file not shown.
Binary file not shown.
@ -46,6 +46,7 @@
|
||||
OUTLETS = {
|
||||
mApplication = id;
|
||||
mBookmarksMenu = id;
|
||||
mBookmarksToolbarMenuItem = id;
|
||||
mFilterList = id;
|
||||
mFilterView = id;
|
||||
mOfflineMenuItem = id;
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>78 108 356 240 0 0 1152 848 </string>
|
||||
<string>262 78 356 240 0 0 1152 848 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>266</key>
|
||||
<string>418 452 277 90 0 0 1152 746 </string>
|
||||
<key>29</key>
|
||||
<string>0 804 446 44 0 0 1152 848 </string>
|
||||
<string>9 803 446 44 0 0 1152 848 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
|
||||
Binary file not shown.
@ -56,6 +56,8 @@ class BookmarksService;
|
||||
|
||||
// The bookmarks menu.
|
||||
IBOutlet id mBookmarksMenu;
|
||||
|
||||
IBOutlet id mBookmarksToolbarMenuItem;
|
||||
|
||||
BOOL mOffline;
|
||||
|
||||
|
||||
@ -310,7 +310,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
{
|
||||
BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
|
||||
[browser loadURL: aURL];
|
||||
[browser showWindow: self];
|
||||
[browser showWindow: self];
|
||||
return browser;
|
||||
}
|
||||
|
||||
@ -459,7 +459,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
action == @selector(printPage:) ||
|
||||
action == @selector(findInPage:) ||
|
||||
action == @selector(findAgain:) ||
|
||||
action == @selector(toggleBookmarksToolbar:) ||
|
||||
action == @selector(doStop:) ||
|
||||
action == @selector(doReload:) ||
|
||||
action == @selector(biggerTextSize:) ||
|
||||
@ -472,7 +471,23 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
// check what the state of the toolbar should be, but only if there is a browser
|
||||
// window open
|
||||
if (action == @selector(toggleBookmarksToolbar:)) {
|
||||
if ([[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]]) {
|
||||
float height = [[[[mApplication mainWindow] windowController] bookmarksToolbar] frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
// only activate if we've got multiple tabs open.
|
||||
if ((action == @selector(closeTab:) ||
|
||||
action == @selector (nextTab:) ||
|
||||
@ -483,12 +498,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
}
|
||||
|
||||
if ( action == @selector(goBack:) || action == @selector(goForward:) ) {
|
||||
NSWindow* mainWindow = [mApplication mainWindow];
|
||||
if (mainWindow) {
|
||||
if ([[[mApplication mainWindow] windowController] isMemberOfClass:[BrowserWindowController class]]) {
|
||||
if (action == @selector(goBack:))
|
||||
return [[[[mainWindow windowController] getBrowserWrapper] getBrowserView] canGoBack];
|
||||
return [[[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView] canGoBack];
|
||||
if (action == @selector(goForward:))
|
||||
return [[[[mainWindow windowController] getBrowserWrapper] getBrowserView] canGoForward];
|
||||
return [[[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView] canGoForward];
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
@ -500,7 +514,20 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
|
||||
-(IBAction) toggleBookmarksToolbar:(id)aSender
|
||||
{
|
||||
//XXX do nothing for now
|
||||
NSWindow* mainWindow = [mApplication mainWindow];
|
||||
if (!mainWindow) {
|
||||
[self openBrowserWindowWithURL: @"about:blank"];
|
||||
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 setObject: [NSNumber numberWithInt: ((showToolbar) ? 1 : 0)] forKey: @"Personal TB Is Shown"];
|
||||
}
|
||||
|
||||
+ (NSImage*)createImageForDragging:(NSImage*)aIcon title:(NSString*)aTitle
|
||||
|
||||
@ -33,6 +33,7 @@ class CHBookmarksButton;
|
||||
NSMutableArray* mButtons;
|
||||
CHBookmarksButton* mDragInsertionButton;
|
||||
int mDragInsertionPosition;
|
||||
BOOL mIsShowing;
|
||||
}
|
||||
|
||||
-(void)initializeToolbar;
|
||||
@ -46,6 +47,7 @@ class CHBookmarksButton;
|
||||
-(void)reflowButtons;
|
||||
-(void)reflowButtonsStartingAtIndex: (int)aIndex;
|
||||
|
||||
-(BOOL)isShown;
|
||||
-(void)showBookmarksToolbar: (BOOL)aShow;
|
||||
|
||||
- (void) setButtonInsertionPoint:(NSPoint)aPoint;
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Hyatt <hyatt@netscape.com> (Original Author)
|
||||
* Kathy Brade <brade@netscape.com>
|
||||
*/
|
||||
|
||||
#import "CHBookmarksButton.h"
|
||||
@ -36,6 +37,7 @@
|
||||
mDragInsertionButton = nil;
|
||||
mDragInsertionPosition = BookmarksService::CHInsertNone;
|
||||
[self registerForDraggedTypes:[NSArray arrayWithObjects:@"MozURLType", @"MozBookmarkType", nil]];
|
||||
mIsShowing = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -100,6 +102,7 @@
|
||||
temp->GetNextSibling(getter_AddRefs(child));
|
||||
}
|
||||
|
||||
if ([self isShown])
|
||||
[self reflowButtons];
|
||||
}
|
||||
|
||||
@ -109,7 +112,8 @@
|
||||
[button setElement: aElt];
|
||||
[self addSubview: button];
|
||||
[mButtons insertObject: button atIndex: aIndex];
|
||||
[self reflowButtonsStartingAtIndex: aIndex];
|
||||
if ([self isShown])
|
||||
[self reflowButtonsStartingAtIndex: aIndex];
|
||||
}
|
||||
|
||||
-(void)removeButton: (nsIDOMElement*)aElt
|
||||
@ -120,13 +124,13 @@
|
||||
if ([button element] == aElt) {
|
||||
[mButtons removeObjectAtIndex: i];
|
||||
[button removeFromSuperview];
|
||||
if (count > i)
|
||||
if (count > i && [self isShown])
|
||||
[self reflowButtonsStartingAtIndex: i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[self setNeedsDisplay: YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
}
|
||||
|
||||
-(void)reflowButtons
|
||||
@ -177,7 +181,7 @@
|
||||
if (computedHeight != oldHeight) {
|
||||
[self setFrame: NSMakeRect([self frame].origin.x, [self frame].origin.y + (oldHeight - computedHeight),
|
||||
[self frame].size.width, computedHeight)];
|
||||
[self setNeedsDisplay: YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
|
||||
// adjust the content area.
|
||||
float sizeChange = computedHeight - oldHeight;
|
||||
@ -228,6 +232,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)isShown
|
||||
{
|
||||
return mIsShowing;
|
||||
}
|
||||
|
||||
-(void)showBookmarksToolbar: (BOOL)aShow
|
||||
{
|
||||
if (!aShow) {
|
||||
@ -239,9 +248,11 @@
|
||||
[view setFrame: NSMakeRect([view frame].origin.x, [view frame].origin.y,
|
||||
[view frame].size.width, [view frame].size.height + height)];
|
||||
}
|
||||
//else
|
||||
else
|
||||
// Reflowing the buttons will do the right thing.
|
||||
// [self reflowButtons];
|
||||
[self reflowButtons];
|
||||
|
||||
mIsShowing = aShow;
|
||||
}
|
||||
|
||||
- (void)setButtonInsertionPoint:(NSPoint)aPoint
|
||||
@ -385,7 +396,7 @@
|
||||
|
||||
mDragInsertionButton = nil;
|
||||
mDragInsertionPosition = BookmarksService::CHInsertNone;
|
||||
[self setNeedsDisplay:YES];
|
||||
[self setNeedsDisplay: [self isShown]];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@ -182,6 +182,8 @@ class nsIDOMNode;
|
||||
-(void) biggerTextSize;
|
||||
-(void) smallerTextSize;
|
||||
|
||||
- (BOOL)shouldShowBookmarkToolbar;
|
||||
|
||||
- (void)addBookmarkExtended: (BOOL)aIsFromMenu isFolder:(BOOL)aIsFolder;
|
||||
- (IBAction)manageBookmarks: (id)aSender;
|
||||
- (void)importBookmarks: (NSString*)aURLSpec;
|
||||
|
||||
@ -247,6 +247,9 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
|
||||
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
|
||||
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
|
||||
}
|
||||
else if (![self shouldShowBookmarkToolbar]) {
|
||||
[mPersonalToolbar showBookmarksToolbar:NO];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1034,6 +1037,15 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
|
||||
markupViewer->SetTextZoom(zoom);
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowBookmarkToolbar
|
||||
{
|
||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||
if ([defaults integerForKey:@"Personal TB Is Shown"] == 0)
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(id)getAddBookmarkSheetWindow
|
||||
{
|
||||
return mAddBookmarkSheetWindow;
|
||||
|
||||
@ -714,7 +714,7 @@ private:
|
||||
NS_IMPL_ISUPPORTS1(nsHeaderSniffer, nsIWebProgressListener)
|
||||
|
||||
// Implementation of nsIWebProgressListener
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in unsigned long aStatus); */
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */
|
||||
NS_IMETHODIMP
|
||||
nsHeaderSniffer::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags,
|
||||
PRUint32 aStatus)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user