+ Updated Utils logging to deal gracefully with object properties you can't access (for permissions reasons, for instance)

+ Added storage.js… starting serialization
+ Disabled autoscroll on drag; the window should be locked down now
+ Fixed Aza's "cute little bug"; small tabs used to scoot up and left
This commit is contained in:
Ian Gilman 2010-04-22 14:26:57 -07:00
parent dc891cb0ec
commit c1fc86ad42
6 changed files with 48 additions and 11 deletions

View File

@ -436,6 +436,7 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
if(!this.locked) {
$(container).draggable({
scroll: false,
start: function(){
drag.info = new DragInfo(this);
},
@ -545,6 +546,7 @@ window.Groups = {
// ----------
dragOptions: {
scroll: false,
start: function(e, ui) {
drag.info = new DragInfo(this);
},

View File

@ -317,8 +317,9 @@ window.Item.prototype = {
}
});
if(!blocked)
if(!blocked) {
data.bounds = newBounds;
}
}
});

View File

@ -0,0 +1,14 @@
// ##########
Storage = {
init: function() {
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
get("ProfD", Components.interfaces.nsIFile);
/* var dir = Utils.getInstallDirectory('tabcandy@aza.raskin'); */
Utils.log(file);
}
};
Storage.init();

View File

@ -7,9 +7,27 @@ window.TabItem = function(container, tab) {
};
window.TabItem.prototype = $.extend(new Item(), {
// ----------
_getSizeExtra: function() {
var $container = $(this.container);
var widthExtra = parseInt($container.css('padding-left'))
+ parseInt($container.css('padding-right'));
var heightExtra = parseInt($container.css('padding-top'))
+ parseInt($container.css('padding-bottom'));
return new Point(widthExtra, heightExtra);
},
// ----------
reloadBounds: function() {
this.bounds = Utils.getBounds(this.container);
var extra = this._getSizeExtra();
this.bounds.width += extra.x;
this.bounds.height += extra.y;
this._updateDebugBounds();
},
@ -19,6 +37,7 @@ window.TabItem.prototype = $.extend(new Item(), {
var $title = $('.tab-title', $container);
var $thumb = $('.thumb', $container);
var $close = $('.close', $container);
var extra = this._getSizeExtra();
var css = {};
if(rect.left != this.bounds.left)
@ -28,19 +47,13 @@ window.TabItem.prototype = $.extend(new Item(), {
css.top = rect.top;
if(rect.width != this.bounds.width) {
var widthExtra = parseInt($container.css('padding-left'))
+ parseInt($container.css('padding-right'));
css.width = rect.width - widthExtra;
css.width = rect.width - extra.x;
var scale = css.width / TabItems.tabWidth;
css.fontSize = TabItems.fontSize * scale;
}
if(rect.height != this.bounds.height) {
var heightExtra = parseInt($container.css('padding-top'))
+ parseInt($container.css('padding-bottom'));
css.height = rect.height - heightExtra;
css.height = rect.height - extra.y;
}
if($.isEmptyObject(css))

View File

@ -226,7 +226,7 @@ var Utils = {
// ___ Files
getInstallDirectory: function(id) {
var file = extensionManager.getInstallLocation(id).getItemFile(id, "install.rdf");
var file = extensionManager.getInstallLocation(id).getItemFile(id, "install.rdf");
return file.parent;
},
@ -327,7 +327,13 @@ var Utils = {
expandObject: function(obj) {
var s = obj + ' = {';
for(prop in obj) {
var value = obj[prop];
var value;
try {
value = obj[prop];
} catch(e) {
value = '[!!error retrieving property]';
}
s += prop + ': ';
if(typeof(value) == 'string')
s += '\'' + value + '\'';

View File

@ -25,6 +25,7 @@
<script type="text/javascript;version=1.8" src="../../js/optional/jquery.lint.js"></script>
<script type="text/javascript;version=1.8" src="../../js/optional/jquery-ui.js"></script>
<script type="text/javascript;version=1.8" src="../../js/core/utils.js"></script>
<script type="text/javascript;version=1.8" src="js/storage.js"></script>
<script type="text/javascript;version=1.8" src="../../js/core/toolbar-button.js"></script>
<script type="text/javascript;version=1.8">
Utils.log('it begins');