Use background color for selected items with colored tags, like Thunderbird

This commit is contained in:
Dan Stillman 2011-04-21 16:11:28 +00:00
parent d479d4fb6c
commit 4a170fce6f
2 changed files with 95 additions and 6 deletions

View file

@ -2415,16 +2415,35 @@ Zotero.ItemTreeView.prototype.onDragExit = function (event) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Zotero.ItemTreeView.prototype.isSeparator = function(row) { return false; } Zotero.ItemTreeView.prototype.isSeparator = function(row) { return false; }
Zotero.ItemTreeView.prototype.getRowProperties = function(row, prop) { } Zotero.ItemTreeView.prototype.getRowProperties = function(row, prop) {
if (!this.selection.isSelected(row)) {
return;
}
var itemID = this._getItemAtRow(row).ref.id;
// Set background color for selected items with colored tags
if (color = Zotero.Tags.getItemColor(itemID)) {
var aServ = Components.classes["@mozilla.org/atom-service;1"].
getService(Components.interfaces.nsIAtomService);
prop.AppendElement(aServ.getAtom("color" + color.substr(1)));
}
}
Zotero.ItemTreeView.prototype.getColumnProperties = function(col, prop) { } Zotero.ItemTreeView.prototype.getColumnProperties = function(col, prop) { }
Zotero.ItemTreeView.prototype.getCellProperties = function(row, col, prop) { Zotero.ItemTreeView.prototype.getCellProperties = function(row, col, prop) {
var itemID = this._getItemAtRow(row).ref.id; var itemID = this._getItemAtRow(row).ref.id;
// Set tag colors // Set tag colors
if (color = Zotero.Tags.getItemColor(itemID)) { //
var aServ = Components.classes["@mozilla.org/atom-service;1"]. // Don't set the text color if the row is selected, in which case the background
getService(Components.interfaces.nsIAtomService); // color is set in getRowProperties() instead, unless the tree isn't focused,
prop.AppendElement(aServ.getAtom("color" + color.substr(1))); // in which case it's not
if (!this.selection.isSelected(row) || !this._treebox.focused) {
if (color = Zotero.Tags.getItemColor(itemID)) {
var aServ = Components.classes["@mozilla.org/atom-service;1"].
getService(Components.interfaces.nsIAtomService);
prop.AppendElement(aServ.getAtom("color" + color.substr(1)));
}
} }
// Mark items not matching search as context rows, displayed in gray // Mark items not matching search as context rows, displayed in gray

View file

@ -131,7 +131,6 @@
#zotero-items-tree treechildren::-moz-tree-cell-text(color000099) { color:#000099 } #zotero-items-tree treechildren::-moz-tree-cell-text(color000099) { color:#000099 }
#zotero-items-tree treechildren::-moz-tree-cell-text(color333399) { color:#333399 } #zotero-items-tree treechildren::-moz-tree-cell-text(color333399) { color:#333399 }
#zotero-items-tree treechildren::-moz-tree-cell-text(color663366) { color:#663366 } #zotero-items-tree treechildren::-moz-tree-cell-text(color663366) { color:#663366 }
/*#zotero-items-tree treechildren::-moz-tree-cell-text(color000000) { color:#000000 }*/
#zotero-items-tree treechildren::-moz-tree-cell-text(color330000) { color:#330000 } #zotero-items-tree treechildren::-moz-tree-cell-text(color330000) { color:#330000 }
#zotero-items-tree treechildren::-moz-tree-cell-text(color663300) { color:#663300 } #zotero-items-tree treechildren::-moz-tree-cell-text(color663300) { color:#663300 }
#zotero-items-tree treechildren::-moz-tree-cell-text(color663333) { color:#663333 } #zotero-items-tree treechildren::-moz-tree-cell-text(color663333) { color:#663333 }
@ -142,6 +141,77 @@
#zotero-items-tree treechildren::-moz-tree-cell-text(color330099) { color:#330099 } #zotero-items-tree treechildren::-moz-tree-cell-text(color330099) { color:#330099 }
#zotero-items-tree treechildren::-moz-tree-cell-text(color330033) { color:#330033 } #zotero-items-tree treechildren::-moz-tree-cell-text(color330033) { color:#330033 }
/* For selected item with colored tags, set the background color instead */
#zotero-items-tree treechildren::-moz-tree-row(colorFFFFFF,focus) { background:#FFFFFF }
#zotero-items-tree treechildren::-moz-tree-row(colorFFCCCC,focus) { background:#FFCCCC }
#zotero-items-tree treechildren::-moz-tree-row(colorFFCC99,focus) { background:#FFCC99 }
#zotero-items-tree treechildren::-moz-tree-row(colorFFFF99,focus) { background:#FFFF99 }
#zotero-items-tree treechildren::-moz-tree-row(colorFFFFCC,focus) { background:#FFFFCC }
#zotero-items-tree treechildren::-moz-tree-row(color99FF99,focus) { background:#99FF99 }
#zotero-items-tree treechildren::-moz-tree-row(color99FFFF,focus) { background:#99FFFF }
#zotero-items-tree treechildren::-moz-tree-row(colorCCFFFF,focus) { background:#CCFFFF }
#zotero-items-tree treechildren::-moz-tree-row(colorCCCCFF,focus) { background:#CCCCFF }
#zotero-items-tree treechildren::-moz-tree-row(colorFFCCFF,focus) { background:#FFCCFF }
#zotero-items-tree treechildren::-moz-tree-row(colorCCCCCC,focus) { background:#CCCCCC }
#zotero-items-tree treechildren::-moz-tree-row(colorFF6666,focus) { background:#FF6666 }
#zotero-items-tree treechildren::-moz-tree-row(colorFF9966,focus) { background:#FF9966 }
#zotero-items-tree treechildren::-moz-tree-row(colorFFFF66,focus) { background:#FFFF66 }
#zotero-items-tree treechildren::-moz-tree-row(colorFFFF33,focus) { background:#FFFF33 }
#zotero-items-tree treechildren::-moz-tree-row(color66FF99,focus) { background:#66FF99 }
#zotero-items-tree treechildren::-moz-tree-row(color33FFFF,focus) { background:#33FFFF }
#zotero-items-tree treechildren::-moz-tree-row(color66FFFF,focus) { background:#66FFFF }
#zotero-items-tree treechildren::-moz-tree-row(color9999FF,focus) { background:#9999FF }
#zotero-items-tree treechildren::-moz-tree-row(colorFF99FF,focus) { background:#FF99FF }
#zotero-items-tree treechildren::-moz-tree-row(colorC0C0C0,focus) { background:#C0C0C0 }
#zotero-items-tree treechildren::-moz-tree-row(colorFF0000,focus) { background:#FF0000 }
#zotero-items-tree treechildren::-moz-tree-row(colorFF9900,focus) { background:#FF9900 }
#zotero-items-tree treechildren::-moz-tree-row(colorFFCC66,focus) { background:#FFCC66 }
#zotero-items-tree treechildren::-moz-tree-row(colorFFFF00,focus) { background:#FFFF00 }
#zotero-items-tree treechildren::-moz-tree-row(color33FF33,focus) { background:#33FF33 }
#zotero-items-tree treechildren::-moz-tree-row(color66CCCC,focus) { background:#66CCCC }
#zotero-items-tree treechildren::-moz-tree-row(color33CCFF,focus) { background:#33CCFF }
#zotero-items-tree treechildren::-moz-tree-row(color6666CC,focus) { background:#6666CC }
#zotero-items-tree treechildren::-moz-tree-row(colorCC66CC,focus) { background:#CC66CC }
#zotero-items-tree treechildren::-moz-tree-row(color999999,focus) { background:#999999 }
#zotero-items-tree treechildren::-moz-tree-row(colorCC0000,focus) { background:#CC0000 }
#zotero-items-tree treechildren::-moz-tree-row(colorFF6600,focus) { background:#FF6600 }
#zotero-items-tree treechildren::-moz-tree-row(colorFFCC33,focus) { background:#FFCC33 }
#zotero-items-tree treechildren::-moz-tree-row(colorFFCC00,focus) { background:#FFCC00 }
#zotero-items-tree treechildren::-moz-tree-row(color33CC00,focus) { background:#33CC00 }
#zotero-items-tree treechildren::-moz-tree-row(color00CCCC,focus) { background:#00CCCC }
#zotero-items-tree treechildren::-moz-tree-row(color3366FF,focus) { background:#3366FF }
#zotero-items-tree treechildren::-moz-tree-row(color6633FF,focus) { background:#6633FF }
#zotero-items-tree treechildren::-moz-tree-row(colorCC33CC,focus) { background:#CC33CC }
#zotero-items-tree treechildren::-moz-tree-row(color666666,focus) { background:#666666 }
#zotero-items-tree treechildren::-moz-tree-row(color990000,focus) { background:#990000 }
#zotero-items-tree treechildren::-moz-tree-row(colorCC6600,focus) { background:#CC6600 }
#zotero-items-tree treechildren::-moz-tree-row(colorCC9933,focus) { background:#CC9933 }
#zotero-items-tree treechildren::-moz-tree-row(color999900,focus) { background:#999900 }
#zotero-items-tree treechildren::-moz-tree-row(color009900,focus) { background:#009900 }
#zotero-items-tree treechildren::-moz-tree-row(color339999,focus) { background:#339999 }
#zotero-items-tree treechildren::-moz-tree-row(color3333FF,focus) { background:#3333FF }
#zotero-items-tree treechildren::-moz-tree-row(color6600CC,focus) { background:#6600CC }
#zotero-items-tree treechildren::-moz-tree-row(color993399,focus) { background:#993399 }
#zotero-items-tree treechildren::-moz-tree-row(color333333,focus) { background:#333333 }
#zotero-items-tree treechildren::-moz-tree-row(color660000,focus) { background:#660000 }
#zotero-items-tree treechildren::-moz-tree-row(color993300,focus) { background:#993300 }
#zotero-items-tree treechildren::-moz-tree-row(color996633,focus) { background:#996633 }
#zotero-items-tree treechildren::-moz-tree-row(color666600,focus) { background:#666600 }
#zotero-items-tree treechildren::-moz-tree-row(color006600,focus) { background:#006600 }
#zotero-items-tree treechildren::-moz-tree-row(color336666,focus) { background:#336666 }
#zotero-items-tree treechildren::-moz-tree-row(color000099,focus) { background:#000099 }
#zotero-items-tree treechildren::-moz-tree-row(color333399,focus) { background:#333399 }
#zotero-items-tree treechildren::-moz-tree-row(color663366,focus) { background:#663366 }
#zotero-items-tree treechildren::-moz-tree-row(color330000,focus) { background:#330000 }
#zotero-items-tree treechildren::-moz-tree-row(color663300,focus) { background:#663300 }
#zotero-items-tree treechildren::-moz-tree-row(color663333,focus) { background:#663333 }
#zotero-items-tree treechildren::-moz-tree-row(color333300,focus) { background:#333300 }
#zotero-items-tree treechildren::-moz-tree-row(color003300,focus) { background:#003300 }
#zotero-items-tree treechildren::-moz-tree-row(color003333,focus) { background:#003333 }
#zotero-items-tree treechildren::-moz-tree-row(color000066,focus) { background:#000066 }
#zotero-items-tree treechildren::-moz-tree-row(color330099,focus) { background:#330099 }
#zotero-items-tree treechildren::-moz-tree-row(color330033,focus) { background:#330033 }
/* Style search results, display non-matches in gray */ /* Style search results, display non-matches in gray */
#zotero-items-tree treechildren::-moz-tree-cell-text(contextRow) { #zotero-items-tree treechildren::-moz-tree-cell-text(contextRow) {
color: gray; color: gray;