+ finished locking down the "new tabs" group… can no longer be renamed or auto deleted
authorIan Gilman <iangilman@gmail.com>
Wed, 21 Apr 2010 17:27:28 -0700
changeset 49817 a83608eec44ec607aa116a87636dbca8a0bbf7f1
parent 49816 e1e44cd152c8899893196900f961b4b3d0d139f0
child 49818 eb6b763b1261cd170412c18aadadf9f1dbb75efa
child 49819 0d4bc6572f24c9dba08f31e99eaaf7e0b5dab2fe
push idunknown
push userunknown
push dateunknown
+ finished locking down the "new tabs" group… can no longer be renamed or auto deleted + Removed potential slowdown for dragging tabs… should be the same now as it was before my "keeping groups and children in sync" fix
browser/base/content/tabcandy/app/groups.js
browser/themes/pinstripe/browser/tabcandy/tabcandy.css
--- a/browser/base/content/tabcandy/app/groups.js
+++ b/browser/base/content/tabcandy/app/groups.js
@@ -32,16 +32,17 @@ function isEventOverElement(event, el){
 // Note that it implements the <Subscribable> interface.
 window.Group = function(listOfEls, options) {
   if(typeof(options) == 'undefined')
     options = {};
 
   this._children = []; // an array of Items
   this.defaultSize = new Point(TabItems.tabWidth * 1.5, TabItems.tabHeight * 1.5);
   this.locked = options.locked || false;
+  this.isAGroup = true;
 
   var self = this;
 
   var rectToBe = options.bounds;
   if(!rectToBe) {
     var boundingBox = this._getBoundingBox(listOfEls);
     var padding = 30;
     rectToBe = new Rect(
@@ -111,26 +112,33 @@ window.Group = function(listOfEls, optio
         });
     }
   }
   
   this.$title = $('.name', this.$titlebar)
     .css({backgroundRepeat: 'no-repeat'})
     .blur(titleUnfocus)
     .focus(function() {
+      if(self.locked) {
+        self.$title.blur();
+        return;
+      }  
       self.$title.select();
       if(!self.getTitle()) {
         self.$title
           .removeClass("defaultName")
           .val('');
       }
     })
     .keydown(handleKeyPress);
   
   titleUnfocus();
+  
+  if(this.locked)
+    this.$title.addClass('name-locked');
 
   // ___ Content
   this.$content = $('<div class="group-content"/>')
     .css({
       left: 0,
       top: this.$titlebar.height(),
       position: 'absolute'
     })
@@ -365,17 +373,17 @@ window.Group.prototype = $.extend(new It
       this.arrange();
   },
   
   // ----------  
   // The argument a can be an Item, a DOM element, or a jQuery object
   remove: function(a, options) {
     var $el;  
     var item;
-
+     
     if(a.isAnItem) {
       item = a;
       $el = $(item.container);
     } else {
       $el = $(a);  
       item = Items.item($el);
     }
     
@@ -389,17 +397,17 @@ window.Group.prototype = $.extend(new It
     $el.data("group", null).removeClass("tabInGroup");
     item.setSize(item.defaultSize.x, item.defaultSize.y);
     $el.droppable("enable");    
     item.removeOnClose(this);
     
     if(typeof(item.setResizable) == 'function')
       item.setResizable(true);
 
-    if(this._children.length == 0 ){  
+    if(this._children.length == 0 && !this.locked){  
       this._sendOnClose();
       Groups.unregister(this);
       $(this.container).fadeOut(function() {
         $(this).remove();
       });
     } else if(!options.dontArrange) {
       this.arrange();
     }
@@ -494,27 +502,31 @@ var DragInfo = function(element) {
   
   this.$el.data('isDragging', true);
   this.item.setZ(9999);
 };
 
 DragInfo.prototype = {
   // ----------  
   drag: function(e, ui) {
-    var bb = this.item.getBounds();
-    bb.left = ui.position.left;
-    bb.top = ui.position.top;
-    this.item.setBounds(bb, true);
+    if(this.item.isAGroup) {
+      var bb = this.item.getBounds();
+      bb.left = ui.position.left;
+      bb.top = ui.position.top;
+      this.item.setBounds(bb, true);
+    } else
+      this.item.reloadBounds();
   },
 
   // ----------  
   stop: function() {
     this.$el.data('isDragging', false);    
     
-    if(this.parent && this.parent != this.$el.data('group') && this.parent._children.length <= 1) 
+    if(this.parent && !this.parent.locked && this.parent != this.$el.data('group') 
+        && this.parent._children.length <= 1) 
       this.parent.remove(this.parent._children[0]);
       
     if(this.item && !this.$el.hasClass('willGroup') && !this.$el.data('group')) {
       this.item.setZ(drag.zIndex);
       drag.zIndex++;
       
       this.item.reloadBounds();
       this.item.pushAway();
--- a/browser/themes/pinstripe/browser/tabcandy/tabcandy.css
+++ b/browser/themes/pinstripe/browser/tabcandy/tabcandy.css
@@ -168,16 +168,21 @@ input.name{
   background-image: url(../img/edit-light.png);  
   padding-left: 20px;
 }
 
 input.name:hover{
   border: 1px solid #ddd;
 }
 
+input.name-locked:hover{
+  border: 1px solid transparent !important;
+  cursor: default;
+}
+
 input.name:focus{
   color: #555;
 }
 
 input.defaultName{
   font-style: italic !important;
   background-image-opacity: .1;
   color: transparent;