зеркало из https://github.com/mozilla/pjs.git
pref to have tab bar always visible (bug 162241)
This commit is contained in:
Родитель
0cbc19cb7f
Коммит
a7786fce2b
|
@ -14,12 +14,13 @@
|
|||
},
|
||||
{
|
||||
ACTIONS = {checkboxClicked = id; };
|
||||
CLASS = OrgMozillaChimeraPreferenceTabbedBrowsing;
|
||||
CLASS = OrgMozillaChimeraPreferenceTabs;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
checkboxLoadTabsInBackground = NSButton;
|
||||
radioOpenForAE = id;
|
||||
radioOpenTabsForCommand = id;
|
||||
mTabBarVisiblity = NSButton;
|
||||
radioOpenForAE = NSMatrix;
|
||||
radioOpenTabsForCommand = NSMatrix;
|
||||
};
|
||||
SUPERCLASS = PreferencePaneBase;
|
||||
},
|
||||
|
|
|
@ -6,7 +6,11 @@
|
|||
<string>22 17 522 320 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>364.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>7S215</string>
|
||||
<string>7U16</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Двоичный файл не отображается.
|
@ -43,9 +43,10 @@
|
|||
|
||||
@interface OrgMozillaChimeraPreferenceTabs : PreferencePaneBase
|
||||
{
|
||||
IBOutlet id radioOpenTabsForCommand;
|
||||
IBOutlet id radioOpenForAE;
|
||||
IBOutlet NSMatrix* radioOpenTabsForCommand;
|
||||
IBOutlet NSMatrix* radioOpenForAE;
|
||||
IBOutlet NSButton *checkboxLoadTabsInBackground;
|
||||
IBOutlet NSButton* mTabBarVisiblity;
|
||||
}
|
||||
|
||||
- (IBAction)checkboxClicked:(id)sender;
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
[radioOpenTabsForCommand selectCellWithTag:[self getBooleanPref:"browser.tabs.opentabfor.middleclick" withSuccess:&gotPref]];
|
||||
[radioOpenForAE selectCellWithTag:[self getIntPref:"browser.reuse_window" withSuccess:&gotPref]];
|
||||
[checkboxLoadTabsInBackground setState:[self getBooleanPref:"browser.tabs.loadInBackground" withSuccess:&gotPref]];
|
||||
[mTabBarVisiblity setState:[self getBooleanPref:"camino.tab_bar_always_visible" withSuccess:&gotPref]];
|
||||
}
|
||||
|
||||
- (IBAction)checkboxClicked:(id)sender
|
||||
|
@ -79,6 +80,9 @@
|
|||
else if (sender == checkboxLoadTabsInBackground) {
|
||||
[self setPref:"browser.tabs.loadInBackground" toBoolean:[sender state]];
|
||||
}
|
||||
else if (sender == mTabBarVisiblity) {
|
||||
[self setPref:"camino.tab_bar_always_visible" toBoolean:[sender state]];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
@interface BrowserTabView : NSTabView
|
||||
{
|
||||
BOOL autoHides;
|
||||
BOOL mBarAlwaysVisible;
|
||||
BOOL mIsDropTarget;
|
||||
BOOL mLastClickIsPotentialDrag;
|
||||
BOOL mVisible; // YES if the view is in the hierarchy
|
||||
|
@ -52,11 +52,10 @@
|
|||
|
||||
+ (BrowserTabViewItem*)makeNewTabItem;
|
||||
|
||||
// Behavior: Autohiding overrides the default tab visibility state.
|
||||
// To switch back to usual tabView behavior, setAutoHides:NO.
|
||||
// Initial value is read from defaults.
|
||||
- (BOOL)autoHides;
|
||||
- (void)setAutoHides:(BOOL)newSetting;
|
||||
// get and set whether the tab bar is always visible, even when it gets down to a single tab. The
|
||||
// default is hide when displaying only one tab.
|
||||
- (BOOL)barAlwaysVisible;
|
||||
- (void)setBarAlwaysVisible:(BOOL)newSetting;
|
||||
|
||||
- (void)addTabForURL:(NSString*)aURL referrer:(NSString*)aReferrer;
|
||||
|
||||
|
|
|
@ -42,12 +42,11 @@
|
|||
|
||||
#import "BrowserTabView.h"
|
||||
#import "BrowserWrapper.h"
|
||||
#import "BrowserWindowController.h"
|
||||
#import "BookmarkFolder.h"
|
||||
#import "Bookmark.h"
|
||||
#import "BookmarkToolbar.h"
|
||||
#import "BookmarkManager.h"
|
||||
#import "BrowserTabBarView.h"
|
||||
#import "BrowserWindowController.h"
|
||||
#import "MainController.h"
|
||||
|
||||
|
||||
|
@ -80,7 +79,7 @@
|
|||
- (id)initWithFrame:(NSRect)frameRect
|
||||
{
|
||||
if ( (self = [super initWithFrame:frameRect]) ) {
|
||||
autoHides = YES;
|
||||
mBarAlwaysVisible = NO;
|
||||
//mVisible = YES;
|
||||
}
|
||||
return self;
|
||||
|
@ -88,6 +87,7 @@
|
|||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
mBarAlwaysVisible = NO;
|
||||
mVisible = YES;
|
||||
[self showOrHideTabsAsAppropriate];
|
||||
[self registerForDraggedTypes:[NSArray arrayWithObjects:
|
||||
|
@ -166,14 +166,19 @@
|
|||
/*** Accessor Methods ***/
|
||||
/******************************************/
|
||||
|
||||
- (BOOL)autoHides
|
||||
- (BOOL)barAlwaysVisible
|
||||
{
|
||||
return autoHides;
|
||||
return mBarAlwaysVisible;
|
||||
}
|
||||
|
||||
- (void)setAutoHides:(BOOL)newSetting
|
||||
- (void)setBarAlwaysVisible:(BOOL)newSetting
|
||||
{
|
||||
autoHides = newSetting;
|
||||
BOOL oldSetting = mBarAlwaysVisible;
|
||||
mBarAlwaysVisible = newSetting;
|
||||
|
||||
// if there was a change, make sure we update immediately
|
||||
if (newSetting != oldSetting)
|
||||
[self showOrHideTabsAsAppropriate];
|
||||
}
|
||||
|
||||
/******************************************/
|
||||
|
@ -203,11 +208,16 @@
|
|||
BOOL tabsVisible = [mTabBar isVisible];
|
||||
int numItems = [[self tabViewItems] count];
|
||||
|
||||
if (numItems < 2 && tabsVisible) {
|
||||
// if the number of tabs gets below a minimum threshold, we want to
|
||||
// close the bar. That threshold is two if the user has auto-hide on,
|
||||
// otherwise it is one (meaning don't hide it at all).
|
||||
const short minTabThreshold = [self barAlwaysVisible] ? 1 : 2;
|
||||
|
||||
if (numItems < minTabThreshold && tabsVisible) {
|
||||
tabVisibilityChanged = YES;
|
||||
// hide the tabs and give the view a chance to kill its tracking rects
|
||||
[mTabBar setVisible:NO];
|
||||
} else if (numItems >= 2 && !tabsVisible) {
|
||||
} else if (numItems >= minTabThreshold && !tabsVisible) {
|
||||
// show the tabs allow the view to set up tracking rects
|
||||
[mTabBar setVisible:YES];
|
||||
tabVisibilityChanged = YES;
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
#include "nsIClipboardCommands.h"
|
||||
#include "nsICommandManager.h"
|
||||
|
@ -125,6 +126,9 @@ static NSString* const CloseTabToolbarItemIdentifier = @"Close Tab Toolbar It
|
|||
static NSString* const SendURLToolbarItemIdentifier = @"Send URL Toolbar Item";
|
||||
static NSString* const DLManagerToolbarItemIdentifier = @"Download Manager Toolbar Item";
|
||||
|
||||
int TabBarVisiblePrefChangedCallback(const char* pref, void* data);
|
||||
static const char* const gTabBarVisiblePref = "camino.tab_bar_always_visible";
|
||||
|
||||
|
||||
static NSString* const NavigatorWindowFrameSaveName = @"NavigatorWindow";
|
||||
|
||||
|
@ -498,6 +502,10 @@ enum BWCOpenDest {
|
|||
NS_IF_RELEASE(mGlobalHistory);
|
||||
NS_IF_RELEASE(mURIFixer);
|
||||
} // matters
|
||||
|
||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID));
|
||||
if ( pref )
|
||||
pref->UnregisterCallback(gTabBarVisiblePref, TabBarVisiblePrefChangedCallback, self);
|
||||
|
||||
// Tell the BrowserTabView the window is closed
|
||||
[mTabBrowser windowClosed];
|
||||
|
@ -660,7 +668,15 @@ enum BWCOpenDest {
|
|||
|
||||
[self setupToolbar];
|
||||
|
||||
|
||||
// set up autohide behavior on tab browser and register for changes on that pref. The
|
||||
// default is for it to hide when only 1 tab is visible, so if no pref is found, it will
|
||||
// be NO, and that works.
|
||||
BOOL tabBarAlwaysVisible = [[PreferenceManager sharedInstance] getBooleanPref:gTabBarVisiblePref withSuccess:nil];
|
||||
[mTabBrowser setBarAlwaysVisible:tabBarAlwaysVisible];
|
||||
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID));
|
||||
if (pref)
|
||||
pref->RegisterCallback(gTabBarVisiblePref, TabBarVisiblePrefChangedCallback, self);
|
||||
|
||||
// 03/03/2002 mlj Changing strategy a bit here. The addTab: method was
|
||||
// duplicating a lot of the code found here. I have moved it to that method.
|
||||
// We now remove the IB tab, then add one of our own.
|
||||
|
@ -3432,3 +3448,22 @@ static Boolean movieControllerFilter(MovieController mc, short action, void *par
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
//
|
||||
// TabBarVisiblePrefChangedCallback
|
||||
//
|
||||
// Pref callback to tell us when the pref values for the visibility of the tab
|
||||
// view with just one tab open.
|
||||
//
|
||||
int TabBarVisiblePrefChangedCallback(const char* inPref, void* inBWC)
|
||||
{
|
||||
if (strcmp(inPref, gTabBarVisiblePref) == 0) {
|
||||
BOOL newValue = [[PreferenceManager sharedInstance] getBooleanPref:gTabBarVisiblePref withSuccess:nil];
|
||||
BrowserWindowController* bwc = (BrowserWindowController*)inBWC;
|
||||
[bwc->mTabBrowser setBarAlwaysVisible:newValue];
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче