|
197 | 197 | */ |
198 | 198 | IB.Properties.Colour = function(name, value) { |
199 | 199 | Property.call(this, name, this._makeColours(value)); |
200 | | - this._labelClass = 'ib-colour-label'; |
| 200 | + if (IB.ColourEnabled) { |
| 201 | + this._labelClass = 'ib-colour-label'; |
| 202 | + } |
201 | 203 | }; |
202 | 204 | IB.Properties.Colour.prototype = Object.create(_super); |
203 | 205 | IB.Properties.Colour.prototype.constructor = IB.Properties.Colour; |
|
207 | 209 | value = IB.ColourMap[value]; |
208 | 210 | } |
209 | 211 | if (_.isArray(value)) { |
210 | | - if (value[0] == "COLOR_FALLBACK") { |
| 212 | + if (value[0] == "PBL_IF_COLOR_ELSE") { |
211 | 213 | value = _.map(value.slice(1), function(c) { |
212 | 214 | return IB.ColourMap[c]; |
213 | 215 | }); |
|
247 | 249 | if (_.uniq(this._value).length == 1) { |
248 | 250 | return this._value[0].name; |
249 | 251 | } else { |
250 | | - return interpolate("COLOR_FALLBACK(%s, %s)", [this._value[0].name, this._value[1].name]); |
| 252 | + return interpolate("PBL_IF_COLOR_ELSE(%s, %s)", [this._value[0].name, this._value[1].name]); |
251 | 253 | } |
252 | 254 | }, |
253 | 255 | /** |
|
263 | 265 | } |
264 | 266 | }, |
265 | 267 | _generateNode: function() { |
| 268 | + var element; |
266 | 269 | var mono_options = _.map(IB.MonochromeMap, this._createColour); |
267 | | - var table = $(interpolate('<table class="ib-colours">' + |
268 | | - '<thead><tr><th>%s</th><th>%s</th></tr></thead>' + |
269 | | - '<tbody><tr></tr></tbody>' + |
270 | | - '</table>', [gettext("Colour Watches"), gettext("B/W Watches")])); |
271 | | - var tr = table.find('tbody tr'); |
272 | | - var td = $("<td></td>").appendTo(tr); |
273 | | - var div = $('<div></div>').appendTo(td); |
274 | | - this._colourNode = $('<input type="text" class="item-color item-color-normal" name="color-1">') |
275 | | - .change(_.bind(this._handleChange, this)) |
276 | | - .val(this._value[IB.ColourModes.Colour].name) |
277 | | - .appendTo(div); |
278 | | - |
279 | 270 | this._bwNode = $('<select class="ib-property ib-colour">') |
280 | 271 | .append(mono_options) |
281 | 272 | .val(this._value[IB.ColourModes.Monochrome].name) |
282 | 273 | .change(_.bind(this._handleChange, this)); |
283 | | - this._bwNode.appendTo("<td>").parent().appendTo(tr); |
284 | | - var self = this; |
285 | | - setTimeout(function() { |
286 | | - self._colourNode.pebbleColourPicker({ |
287 | | - value_mapping: function(value) { |
288 | | - if (value == "transparent") { |
289 | | - return "GColorClear"; |
290 | | - } |
291 | | - else { |
292 | | - return _.findWhere(IB.ColourMap, {css: value}); |
| 274 | + |
| 275 | + if (IB.ColourEnabled) { |
| 276 | + element = $(interpolate('<table class="ib-colours">' + |
| 277 | + '<thead><tr><th>%s</th><th>%s</th></tr></thead>' + |
| 278 | + '<tbody><tr></tr></tbody>' + |
| 279 | + '</table>', [gettext("Colour Watches"), gettext("B/W Watches")])); |
| 280 | + var tr = element.find('tbody tr'); |
| 281 | + var td = $("<td></td>").appendTo(tr); |
| 282 | + var div = $('<div></div>').appendTo(td); |
| 283 | + this._colourNode = $('<input type="text" class="item-color item-color-normal" name="color-1">') |
| 284 | + .change(_.bind(this._handleChange, this)) |
| 285 | + .val(this._value[IB.ColourModes.Colour].name) |
| 286 | + .appendTo(div); |
| 287 | + this._bwNode.appendTo("<td>").parent().appendTo(tr); |
| 288 | + |
| 289 | + var self = this; |
| 290 | + setTimeout(function() { |
| 291 | + self._colourNode.pebbleColourPicker({ |
| 292 | + value_mapping: function(value) { |
| 293 | + if (value == "transparent") { |
| 294 | + return "GColorClear"; |
| 295 | + } |
| 296 | + else { |
| 297 | + return _.findWhere(IB.ColourMap, {css: value}); |
| 298 | + } |
293 | 299 | } |
294 | | - } |
295 | | - }); |
296 | | - self._setColourCSS(); |
297 | | - }, 1); |
298 | | - return table; |
| 300 | + }); |
| 301 | + self._setColourCSS(); |
| 302 | + }, 0); |
| 303 | + } |
| 304 | + else { |
| 305 | + this._colourNode = this._bwNode; |
| 306 | + element = this._bwNode; |
| 307 | + } |
| 308 | + return element; |
299 | 309 | }, |
300 | 310 | _createColour: function(colour) { |
301 | 311 | return $('<option>') |
|
0 commit comments