
15 changed files with 432 additions and 111 deletions
@ -1,6 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager"> |
||||
<settings> |
||||
<option name="PROJECT_PROFILE" /> |
||||
<version value="1.0" /> |
||||
</settings> |
||||
</component> |
@ -0,0 +1,154 @@
|
||||
/* These colours from Cynthia Brewer's excellent page at |
||||
* http://colorbrewer2.org/ |
||||
*/ |
||||
/* rainbow is 12 Set3 */ |
||||
.rainbow-0 { |
||||
background: rgba(141, 211, 199, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-1 { |
||||
background: rgba(255, 255, 179, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-2 { |
||||
background: rgba(190, 186, 218, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-3 { |
||||
background: rgba(251, 128, 114, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-4 { |
||||
background: rgba(128, 177, 211, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-5 { |
||||
background: rgba(253, 180, 98, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-6 { |
||||
background: rgba(179, 222, 105, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-7 { |
||||
background: rgba(252, 205, 229, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-8 { |
||||
background: rgba(217, 217, 217, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-9 { |
||||
background: rgba(188, 128, 189, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-10 { |
||||
background: rgba(204, 234, 197, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow-11 { |
||||
background: rgba(255, 237, 111, 0.35) !important; |
||||
} |
||||
|
||||
/* rainbow2 is 12 Paired */ |
||||
.rainbow2-0 { |
||||
background: rgba(166, 206, 227, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-1 { |
||||
background: rgba(31, 120, 180, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-2 { |
||||
background: rgba(178, 223, 138, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-3 { |
||||
background: rgba(51, 160, 44, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-4 { |
||||
background: rgba(251, 154, 153, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-5 { |
||||
background: rgba(227, 26, 28, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-6 { |
||||
background: rgba(253, 191, 111, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-7 { |
||||
background: rgba(255, 127, 0, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-8 { |
||||
background: rgba(202, 178, 214, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-9 { |
||||
background: rgba(106, 61, 154, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-10 { |
||||
background: rgba(255, 255, 153, 0.35) !important; |
||||
} |
||||
|
||||
.rainbow2-11 { |
||||
background: rgba(177, 89, 40, 0.35) !important; |
||||
} |
||||
|
||||
/* earth is 'BrBG' */ |
||||
.earth-0 { |
||||
background: rgba(140, 81, 10, 0.35) !important; |
||||
} |
||||
|
||||
.earth-1 { |
||||
background: rgba(191, 129, 45, 0.35) !important; |
||||
} |
||||
|
||||
.earth-2 { |
||||
background: rgba(223, 194, 125, 0.35) !important; |
||||
} |
||||
|
||||
.earth-3 { |
||||
background: rgba(246, 232, 195, 0.35) !important; |
||||
} |
||||
|
||||
.earth-4 { |
||||
background: rgba(245, 245, 245, 0.35) !important; |
||||
} |
||||
|
||||
.earth-5 { |
||||
background: rgba(199, 234, 229, 0.35) !important; |
||||
} |
||||
|
||||
.earth-6 { |
||||
background: rgba(128, 205, 193, 0.35) !important; |
||||
} |
||||
|
||||
.earth-7 { |
||||
background: rgba(53, 151, 143, 0.35) !important; |
||||
} |
||||
|
||||
.earth-8 { |
||||
background: rgba(1, 102, 94, 0.35) !important; |
||||
} |
||||
|
||||
/* Greens and blues is Paired */ |
||||
.green-blue-0 { |
||||
background: rgba(166, 206, 227, 0.35) !important; |
||||
} |
||||
|
||||
.green-blue-1 { |
||||
background: rgba(31, 120, 180, 0.35) !important; |
||||
} |
||||
|
||||
.green-blue-2 { |
||||
background: rgba(178, 223, 138, 0.35) !important; |
||||
} |
||||
|
||||
.green-blue-3 { |
||||
background: rgba(51, 160, 44, 0.35) !important; |
||||
} |
@ -0,0 +1,132 @@
|
||||
// Copyright (c) 2012-2017, Matt Godbolt
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
define(function (require) { |
||||
var _ = require('underscore'); |
||||
var colour = require('./colour'); |
||||
|
||||
function Setting(elem, name, Control, param) { |
||||
this.elem = elem; |
||||
this.name = name; |
||||
this.control = new Control(elem, param); |
||||
} |
||||
|
||||
Setting.prototype.getUi = function () { |
||||
return this.control.getUi(this.elem); |
||||
}; |
||||
Setting.prototype.putUi = function (value) { |
||||
this.control.putUi(this.elem, value); |
||||
}; |
||||
|
||||
function Checkbox() { |
||||
} |
||||
|
||||
Checkbox.prototype.getUi = function (elem) { |
||||
return !!elem.prop('checked'); |
||||
}; |
||||
Checkbox.prototype.putUi = function (elem, value) { |
||||
elem.prop('checked', !!value); |
||||
}; |
||||
|
||||
function Select(elem, populate) { |
||||
elem.empty(); |
||||
_.each(populate, function (e) { |
||||
elem.append($('<option value="' + e.label + '">' + e.desc + "</option>")); |
||||
}); |
||||
} |
||||
|
||||
Select.prototype.getUi = function (elem) { |
||||
return elem.val(); |
||||
}; |
||||
Select.prototype.putUi = function (elem, value) { |
||||
elem.val(value); |
||||
}; |
||||
|
||||
function Slider(elem, sliderSettings) { |
||||
elem.slider(sliderSettings); |
||||
} |
||||
|
||||
Slider.prototype.getUi = function (elem) { |
||||
return elem.slider('getValue'); |
||||
}; |
||||
|
||||
Slider.prototype.putUi = function (elem, value) { |
||||
elem.slider('setValue', value); |
||||
}; |
||||
|
||||
// TODO: editor options like auto paren
|
||||
// TODO: color choices for colourisation
|
||||
function setupSettings(root, settings, onChange) { |
||||
settings = settings || {}; |
||||
if (settings.delayAfterChange === undefined) |
||||
settings.delayAfterChange = 750; |
||||
if (settings.colouriseAsm === undefined) |
||||
settings.colouriseAsm = true; |
||||
|
||||
var settingsObjs = []; |
||||
|
||||
function onUiChange() { |
||||
var settings = {}; |
||||
_.each(settingsObjs, function (s) { |
||||
settings[s.name] = s.getUi(); |
||||
}); |
||||
onChange(settings); |
||||
} |
||||
|
||||
function onSettingsChange(settings) { |
||||
_.each(settingsObjs, function (s) { |
||||
s.putUi(settings[s.name]); |
||||
}); |
||||
} |
||||
|
||||
function add(elem, key, defaultValue, Type, param) { |
||||
if (settings[key] === undefined) |
||||
settings[key] = defaultValue; |
||||
settingsObjs.push(new Setting(elem, key, Type, param)); |
||||
elem.change(onUiChange); |
||||
} |
||||
|
||||
add(root.find('.colourise'), 'colouriseAsm', true, Checkbox); |
||||
add(root.find('.autoCloseBrackets'), 'autoCloseBrackets', true, Checkbox); |
||||
add(root.find('.colourScheme'), 'colourScheme', colour.schemes[0].name, Select, |
||||
_.map(colour.schemes, function (scheme) { |
||||
return {label: scheme.name, desc: scheme.desc}; |
||||
})); |
||||
add(root.find('.slider'), 'delayAfterChange', 750, Slider, { |
||||
max: 3000, |
||||
step: 250, |
||||
formatter: function (x) { |
||||
if (x === 0) return "Disabled"; |
||||
return (x / 1000.0).toFixed(2) + "s"; |
||||
} |
||||
}); |
||||
|
||||
onSettingsChange(settings); |
||||
onChange(settings); |
||||
} |
||||
|
||||
return setupSettings; |
||||
}) |
||||
; |
Loading…
Reference in new issue