+ misc documentation fixes

+ Fixed: Quit Firefox and relaunch. You'll reopen with that tab, but the tab bar doesn't have its tab limited to the containing group. It should limit them.
This commit is contained in:
Ian Gilman 2010-05-13 17:24:37 -07:00
parent 9ec5215e9c
commit e3cb0ac12e
4 changed files with 53 additions and 28 deletions

View File

@ -934,7 +934,7 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
// Function: getChild
// Returns the nth child tab or null if index is out of range.
//
// Parameters
// Parameters:
// index - the index of the child tab to return, use negative
// numbers to index from the end (-1 is the last child)
getChild: function(index){
@ -948,7 +948,7 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
// Sets up a one-time handler that gets called the next time a
// tab is added to the group.
//
// Parameters
// Parameters:
// callback - the one-time callback that is fired when the next
// time a tab is added to a group; it gets passed the
// new tab
@ -1332,9 +1332,19 @@ window.Groups = {
// (which means we have an orphaned tab selected)
setActiveGroup: function(group) {
this._activeGroup = group;
if(group)
UI.tabBar.showOnlyTheseTabs( group._children );
else if( group == null)
this.updateTabBarForActiveGroup();
},
// ----------
// Function: updateTabBarForActiveGroup
// Hides and shows tabs in the tab bar based on the active group.
updateTabBarForActiveGroup: function() {
if(!window.UI)
return; // called too soon
if(this._activeGroup)
UI.tabBar.showOnlyTheseTabs( this._activeGroup._children );
else if( this._activeGroup == null)
UI.tabBar.showOnlyTheseTabs( this.getOrphanedTabs() );
},

View File

@ -2,18 +2,20 @@
// ##########
// Class: Item
// Superclass for all visible objects (<TabItems> and <Group>s).
// If you subclass, in addition to the things Item provides, you need to also
// provide these methods:
// reloadBounds: function()
// setBounds: function(rect, immediately)
// setZ: function(value)
// close: function()
// addOnClose: function(referenceObject, callback)
// removeOnClose: function(referenceObject)
// Superclass for all visible objects (<TabItem>s and <Group>s).
//
// If you subclass, in addition to the things Item provides, you need to also provide these methods:
// reloadBounds - function()
// setBounds - function(rect, immediately)
// setZ - function(value)
// close - function()
// addOnClose - function(referenceObject, callback)
// removeOnClose - function(referenceObject)
//
// ... and this property:
// defaultSize, a Point
// <locked>, an object
// defaultSize - a Point
// locked - an object (see below)
//
// Make sure to call _init() from your subclass's constructor.
window.Item = function() {
// Variable: isAnItem
@ -39,10 +41,11 @@ window.Item = function() {
// Variable: locked
// Affects whether an item can be pushed, closed, renamed, etc
//
// The object may have properties to specify what can't be changed:
// .bounds is true if it can't be pushed, dragged, resized, etc
// .close is true if it can't be closed
// .title is true if it can't be renamed
// .bounds - true if it can't be pushed, dragged, resized, etc
// .close - true if it can't be closed
// .title - true if it can't be renamed
this.locked = null;
// Variable: parent
@ -406,14 +409,17 @@ window.Items = {
// Parameters:
// items - an array of <Item>s. Can be null if the pretend and count options are set.
// bounds - a <Rect> defining the space to arrange within
// options - an object with options:
// animate - whether to animate; default: true.
// z - the z index to set all the items; default: don't change z.
// pretend - whether to collect and return the rectangle rather than moving the items; default: false
// count - overrides the item count for layout purposes; default: the actual item count
// padding - pixels between each item
// options - an object with various properites (see below)
//
// Possible "options" properties:
// animate - whether to animate; default: true.
// z - the z index to set all the items; default: don't change z.
// pretend - whether to collect and return the rectangle rather than moving the items; default: false
// count - overrides the item count for layout purposes; default: the actual item count
// padding - pixels between each item
//
// Returns: the list of rectangles if the pretend option is set; otherwise null
// Returns:
// the list of rectangles if the pretend option is set; otherwise null
arrange: function(items, bounds, options) {
var animate;
if(!options || typeof(options.animate) == 'undefined')

View File

@ -1,6 +1,8 @@
// Title: tabitems.js (revision-a)
// ##########
// Class: TabItem
// An <Item> that represents a tab.
window.TabItem = function(container, tab) {
this.defaultSize = new Point(TabItems.tabWidth, TabItems.tabHeight);
this.locked = {};
@ -225,6 +227,8 @@ window.TabItem.prototype = $.extend(new Item(), {
});
// ##########
// Class: TabItems
// Singleton for managing <TabItem>s
window.TabItems = {
minTabWidth: 40,
tabWidth: 160,
@ -471,7 +475,12 @@ window.TabItems = {
if(tab.groupID) {
var group = Groups.group(tab.groupID);
group.add(item);
}
if(item.tab == Utils.activeTab)
Groups.setActiveGroup(item.parent);
}
Groups.updateTabBarForActiveGroup();
self.storageData.tabs.splice(index, 1);
item.reconnected = true;

View File

@ -373,7 +373,7 @@ window.Page = {
// Hiting return/esc brings you to the focused tab, and using the
// arrow keys lets you navigate between open tabs.
//
// Parameters
// Parameters:
// - Takes a <TabItem>
//
setActiveTab: function(tab){