Skip to content

Commit

Permalink
generalize icon for menu selection and make default a checkmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmandel committed Feb 11, 2020
1 parent 381a6ae commit d194fb7
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 188 deletions.
24 changes: 6 additions & 18 deletions js9-allinone.css
Original file line number Diff line number Diff line change
Expand Up @@ -2147,8 +2147,14 @@ input:focus.JS9CmdIn {
content: url(images/sun.png);
}

/* jqueryContextMenu v2.2 */
.context-menu-icon-check:before {
content: url(images/checkmark.svg);
}

.context-menu-item {
background-color: #E9E9E9;
padding: .2em 2em;
}

.context-menu-item.context-menu-disabled {
Expand All @@ -2175,24 +2181,6 @@ input:focus.JS9CmdIn {
height: 3em;
}

/* jqueryContextMenu pre-v2.2 */
.pre-v2.2-context-menu-item.icon-sun {
background-image: url(images/sun.png);
}

/* jqueryContextMenu pre-v2.2 */
.pre-v2.2-context-menu-input > label > span {
margin-left: 0px;
}

/* jqueryContextMenu pre-v2.2 */
.pre-v2.2-context-menu-submenu:after {
content: "\2192";
color: black;
position: absolute;
right: 5px;
}

/* dhtml window overrides */
.dhtmlwindow {
border: 1px solid grey;
Expand Down
120 changes: 60 additions & 60 deletions js9-allinone.js

Large diffs are not rendered by default.

24 changes: 6 additions & 18 deletions js9.css
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,14 @@ input:focus.JS9CmdIn {
content: url(images/sun.png);
}

/* jqueryContextMenu v2.2 */
.context-menu-icon-check:before {
content: url(images/checkmark.svg);
}

.context-menu-item {
background-color: #E9E9E9;
padding: .2em 2em;
}

.context-menu-item.context-menu-disabled {
Expand All @@ -402,24 +408,6 @@ input:focus.JS9CmdIn {
height: 3em;
}

/* jqueryContextMenu pre-v2.2 */
.pre-v2.2-context-menu-item.icon-sun {
background-image: url(images/sun.png);
}

/* jqueryContextMenu pre-v2.2 */
.pre-v2.2-context-menu-input > label > span {
margin-left: 0px;
}

/* jqueryContextMenu pre-v2.2 */
.pre-v2.2-context-menu-submenu:after {
content: "\2192";
color: black;
position: absolute;
right: 5px;
}

/* dhtml window overrides */
.dhtmlwindow {
border: 1px solid grey;
Expand Down
1 change: 1 addition & 0 deletions js9.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ JS9.globalOpts = {
menuBar: ["file", "edit", "view", "zoom", "scale", "color", "region", "wcs", "analysis", "help"],
menubarStyle: "classic", // mac or classic
menuPosition: "left bottom", // where menus pop up
menuSelected: "check", // selected option icon
userMenus: false, // add user menus?
userMenuDivider: "   ", // divide before user menu
imagesFileSubmenu: 5, // how many images trigger a submenu?
Expand Down
56 changes: 28 additions & 28 deletions js9.min.js

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions js9plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -6437,7 +6437,7 @@ JS9.Menubar.createMenus = function(){
}
iobj[name] = xname(name);
if( tdisp.image && (tdisp.image.id === im.id) ){
iobj[name].icon = "sun";
iobj[name].icon = JS9.globalOpts.menuSelected;
}
}
}
Expand Down Expand Up @@ -6725,14 +6725,14 @@ JS9.Menubar.createMenus = function(){
name = cdisp.id;
items.supermenu.items[`super_${name}`] = xname(name);
if( this.selectedDisplay === cdisp ){
items.supermenu.items[`super_${name}`].icon = "sun";
items.supermenu.items[`super_${name}`].icon = JS9.globalOpts.menuSelected;
m++;
}
}
name = "all displays";
items.supermenu.items.super_all = xname(name);
if( !m ){
items.supermenu.items.super_all.icon = "sun";
items.supermenu.items.super_all.icon = JS9.globalOpts.menuSelected;
}
}
items[`sep${n++}`] = "------";
Expand Down Expand Up @@ -7261,7 +7261,7 @@ JS9.Menubar.createMenus = function(){
lastxclass = plugin.xclass;
items[pname] = xname(plugin.opts.menuItem);
if( pinst && (pinst.status === "active") ){
items[pname].icon = "sun";
items[pname].icon = JS9.globalOpts.menuSelected;
}
}
}
Expand All @@ -7285,42 +7285,42 @@ JS9.Menubar.createMenus = function(){
if( !JS9.hasOwnProperty("Info") ){
items.vdisps.items.valpos.disabled = true;
} else if( tdisp.image && tdisp.image.params.valpos ){
items.vdisps.items.valpos.icon = "sun";
items.vdisps.items.valpos.icon = JS9.globalOpts.menuSelected;
}
items.vdisps.items.toggleLayers = xname("active shape layers");
if( tim && !tim.toggleLayers ){
items.vdisps.items.toggleLayers.icon = "sun";
items.vdisps.items.toggleLayers.icon = JS9.globalOpts.menuSelected;
}
items.vdisps.items.xhair = xname("crosshair for this image");
// disable if we don't have info plugin
if( !JS9.hasOwnProperty("Crosshair") || !tim ){
items.vdisps.items.xhair.disabled = true;
} else if( tim && tim.params.crosshair ){
items.vdisps.items.xhair.icon = "sun";
items.vdisps.items.xhair.icon = JS9.globalOpts.menuSelected;
}
items.vdisps.items.xhairwcs = xname("match wcs crosshairs");
// disable if we don't have info plugin
if( !JS9.hasOwnProperty("Crosshair") ){
items.vdisps.items.xhairwcs.disabled = true;
} else if( JS9.globalOpts.wcsCrosshair ){
items.vdisps.items.xhairwcs.icon = "sun";
items.vdisps.items.xhairwcs.icon = JS9.globalOpts.menuSelected;
}
items.vdisps.items.toolbar = xname("toolbar tooltips");
// disable if we don't have toolbar plugin
if( !JS9.hasOwnProperty("Toolbar") ){
items.vdisps.items.toolbar.disabled = true;
} else if( JS9.GetToolbar("showTooltips") ){
items.vdisps.items.toolbar.icon = "sun";
items.vdisps.items.toolbar.icon = JS9.globalOpts.menuSelected;
}
if( !JS9.allinone ){
items.vdisps.items.logo = xname("js9 logo");
if( JS9.globalOpts.logoDisplay ){
items.vdisps.items.logo.icon = "sun";
items.vdisps.items.logo.icon = JS9.globalOpts.menuSelected;
}
}
items.vdisps.items.inherit = xname("new images inherit current params");
if( tdisp.image && tdisp.image.params.inherit ){
items.vdisps.items.inherit.icon = "sun";
items.vdisps.items.inherit.icon = JS9.globalOpts.menuSelected;
}
items.vdisps.items.rawlayer = {
name: "raw data sources ...",
Expand All @@ -7336,7 +7336,7 @@ JS9.Menubar.createMenus = function(){
name: tim.raws[i].id
};
if( tim.raw === tim.raws[i] ){
items.vdisps.items.rawlayer.items[key].icon = "sun";
items.vdisps.items.rawlayer.items[key].icon = JS9.globalOpts.menuSelected;
}
}
items.vdisps.items.rawlayer.items[`sep${n++}`] = "------";
Expand Down Expand Up @@ -7541,7 +7541,7 @@ JS9.Menubar.createMenus = function(){
name2 = `zoom 1/${zoomp}`;
items[name] = xname(name2);
if( tim && (tim.rgb.sect.zoom === zoom) ){
items[name].icon = "sun";
items[name].icon = JS9.globalOpts.menuSelected;
}
}
for(i=0; i<=JS9.imageOpts.topZooms; i++){
Expand All @@ -7550,7 +7550,7 @@ JS9.Menubar.createMenus = function(){
name2 = `zoom ${zoom}`;
items[name] = xname(name2);
if( tim && (tim.rgb.sect.zoom === zoom) ){
items[name].icon = "sun";
items[name].icon = JS9.globalOpts.menuSelected;
}
}
items.morezooms = {
Expand All @@ -7569,7 +7569,7 @@ JS9.Menubar.createMenus = function(){
name2 = `zoom 1/${zoomp}`;
items.morezooms.items[name] = xname(name2);
if( tim && (tim.rgb.sect.zoom === zoom) ){
items.morezooms.items[name].icon = "sun";
items.morezooms.items[name].icon = JS9.globalOpts.menuSelected;
}
}
for(i=JS9.imageOpts.topZooms+1; i<=JS9.imageOpts.zooms; i++){
Expand All @@ -7578,7 +7578,7 @@ JS9.Menubar.createMenus = function(){
name2 = `zoom ${zoom}`;
items.morezooms.items[name] = xname(name2);
if( tim && (tim.rgb.sect.zoom === zoom) ){
items.morezooms.items[name].icon = "sun";
items.morezooms.items[name].icon = JS9.globalOpts.menuSelected;
}
}
items.zoom = {
Expand Down Expand Up @@ -7677,7 +7677,7 @@ JS9.Menubar.createMenus = function(){
lastxclass = plugin.xclass;
items[pname] = xname(plugin.opts.menuItem);
if( pinst && (pinst.status === "active") ){
items[pname].icon = "sun";
items[pname].icon = JS9.globalOpts.menuSelected;
}
}
}
Expand Down Expand Up @@ -7832,7 +7832,7 @@ JS9.Menubar.createMenus = function(){
s2 = s1;
items[s1] = xname(s2);
if( tdisp.image && (tdisp.image.params.scale === s1) ){
items[s1].icon = "sun";
items[s1].icon = JS9.globalOpts.menuSelected;
}
}
items[`sep${n++}`] = "------";
Expand Down Expand Up @@ -7865,7 +7865,7 @@ JS9.Menubar.createMenus = function(){
lastxclass = plugin.xclass;
items[pname] = xname(plugin.opts.menuItem);
if( pinst && (pinst.status === "active") ){
items[pname].icon = "sun";
items[pname].icon = JS9.globalOpts.menuSelected;
}
}
}
Expand Down Expand Up @@ -8010,7 +8010,7 @@ JS9.Menubar.createMenus = function(){
s2 = s1;
items[s1] = xname(s2);
if( tdisp.image && (tdisp.image.cmapObj.name === s1) ){
items[s1].icon = "sun";
items[s1].icon = JS9.globalOpts.menuSelected;
}
}
items.morecmaps = {
Expand All @@ -8028,7 +8028,7 @@ JS9.Menubar.createMenus = function(){
s2 = s1;
items.morecmaps.items[s1] = xname(s2);
if( tdisp.image && (tdisp.image.cmapObj.name === s1) ){
items.morecmaps.items[s1].icon = "sun";
items.morecmaps.items[s1].icon = JS9.globalOpts.menuSelected;
}
}
}
Expand Down Expand Up @@ -8064,11 +8064,11 @@ JS9.Menubar.createMenus = function(){
items[`sep${n++}`] = "------";
items.invert = xname("invert");
if( tdisp.image && tdisp.image.params.invert ){
items.invert.icon = "sun";
items.invert.icon = JS9.globalOpts.menuSelected;
}
items.rgb = xname("rgb mode");
if( JS9.globalOpts.rgb.active ){
items.rgb.icon = "sun";
items.rgb.icon = JS9.globalOpts.menuSelected;
}
return {
callback: (key) => {
Expand Down Expand Up @@ -8347,10 +8347,10 @@ JS9.Menubar.createMenus = function(){
}
};
if( tim && tim.params.listonchange ){
items.onchange.items.listonchange.icon = "sun";
items.onchange.items.listonchange.icon = JS9.globalOpts.menuSelected;
}
if( tim && tim.params.xeqonchange ){
items.onchange.items.xeqonchange.icon = "sun";
items.onchange.items.xeqonchange.icon = JS9.globalOpts.menuSelected;
}
if( tim && (JS9.images.length > 1) ){
for(i=0; i<JS9.images.length; i++){
Expand Down Expand Up @@ -8560,7 +8560,7 @@ JS9.Menubar.createMenus = function(){
s2 = s1;
items[s1] = xname(s2);
if( tim && (tim.params.wcssys === s1) ){
items[s1].icon = "sun";
items[s1].icon = JS9.globalOpts.menuSelected;
got++;
}
}
Expand All @@ -8571,7 +8571,7 @@ JS9.Menubar.createMenus = function(){
} else {
s1 = "image";
}
items[s1].icon = "sun";
items[s1].icon = JS9.globalOpts.menuSelected;
}
items[`sep${n++}`] = "------";
items.wcsutitle = {
Expand All @@ -8588,7 +8588,7 @@ JS9.Menubar.createMenus = function(){
s2 = s1;
items[s1] = xname(s2);
if( tim && (tim.params.wcsunits === s1) ){
items[s1].icon = "sun";
items[s1].icon = JS9.globalOpts.menuSelected;
}
}
items[`sep${n++}`] = "------";
Expand Down Expand Up @@ -8616,7 +8616,7 @@ JS9.Menubar.createMenus = function(){
}
items.altwcs.items[s1] = xname(s2);
if( tim.raw.wcs === altwcs[key].wcs ){
items.altwcs.items[s1].icon = "sun";
items.altwcs.items[s1].icon = JS9.globalOpts.menuSelected;
}
nwcs++;
}
Expand Down Expand Up @@ -8672,7 +8672,7 @@ JS9.Menubar.createMenus = function(){
name: "display wcs-aligned"
};
if( tim && (tim.params.wcsalign) ){
items.reproject.items.reproject_wcsalign.icon = "sun";
items.reproject.items.reproject_wcsalign.icon = JS9.globalOpts.menuSelected;
}
}
items.reproject.items[`sep${n++}`] = "------";
Expand Down Expand Up @@ -8849,7 +8849,7 @@ JS9.Menubar.createMenus = function(){
name: plugin.opts.menuItem
};
if( pinst && (pinst.status === "active") ){
items[pname].icon = "sun";
items[pname].icon = JS9.globalOpts.menuSelected;
}
n++;
}
Expand All @@ -8868,7 +8868,7 @@ JS9.Menubar.createMenus = function(){
if( !im || !im.raw.wcs || im.raw.wcs <=0 ){
items.grid.disabled = true;
} else {
if( im.displayCoordGrid() ){ items.grid.icon = "sun"; }
if( im.displayCoordGrid() ){ items.grid.icon = JS9.globalOpts.menuSelected; }
}
items.regcnts = xname("Counts in Regions");
items.radprof = xname("Radial Profile");
Expand Down
Loading

0 comments on commit d194fb7

Please sign in to comment.