Skip to content

Commit

Permalink
statusbar plugin: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmandel committed Feb 21, 2020
1 parent 75f2e80 commit aad2ddf
Show file tree
Hide file tree
Showing 10 changed files with 1,212 additions and 548 deletions.
3 changes: 2 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ PLCSSFILES = plugins/core/blend.css plugins/core/blink.css \
plugins/core/imarith.css plugins/core/keyboard.css \
plugins/core/layers.css plugins/core/mef.css \
plugins/core/mousetouch.css plugins/core/panzoom.css \
plugins/core/scalelimits.css \
plugins/core/scalelimits.css plugins/core/statusbar.css \
plugins/core/separate.css plugins/core/toolbar.css

JSFILES = js/winmod.js js/jquery.min.js js/jquery-ui.min.js js/jquery.contextMenu.min.js js/jquery.flot.min.js js/jquery.flot.errorbars.min.js js/jquery.flot.navigate.min.js js/jquery.flot.resize.min.js js/jquery.flot.selection.min.js js/flot-zoom.min.js js/sprintf.min.js js/dhtmlwindow.min.js js/dhtmlwindow_blurb.js js/fabric.min.js js/pako_inflate.min.js js/FileSaver.min.js js/canvas-toBlob.js js/tabcontent.js js/arrive.min.js js/jquery.doubletap.min.js js/jquery.flot.axislabels.js js/spin.js js/ElementQueries.js js/ResizeSensor.js js/gaussblur.js js/imagefilters.js js/jquery.ui.touch-punch.js js/js9inline.js js/spectrum.min.js js/tinycolor.min.js
Expand Down Expand Up @@ -192,6 +192,7 @@ PLUGINFILES = plugins/archive/archive.js \
plugins/core/prefs.js \
plugins/core/scalelimits.js \
plugins/core/separate.js \
plugins/core/statusbar.js \
plugins/core/sync.js \
plugins/core/toolbar.js \
plugins/imexam/imexam.js \
Expand Down
28 changes: 28 additions & 0 deletions js9-allinone.css
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,34 @@ div.JS9MouseTouchHeader, div.JS9MouseTouchFooter {
.JS9ScalePlot {
border: 1px black solid;
}
.JS9StatusbarContainer {
background-color: #D5D5D5;
padding-left: 10px;
height: 100%;
font: normal 12px Arial;
}

.JS9StatusbarItemContainer {
display:inline-block;
vertical-align:middle;
text-align:center;
white-space:nowrap;
background-color: #D0D0D0;
color: black;
margin-top: 5px;
padding-top: 0px;
padding-bottom: 0px;
padding-right: 2px;
padding-left: 2px;
}

.JS9StatusbarItemNoHighlight {
border: 1px solid #D0D0D0;
}

.JS9StatusbarItemHighlight {
border: 1px solid #B5B5B5;
}
div.JS9SeparateContainer {
padding: 2px;
}
Expand Down
720 changes: 449 additions & 271 deletions js9-allinone.js

Large diffs are not rendered by default.

53 changes: 50 additions & 3 deletions js9.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,11 @@ JS9.globalOpts = {
}, // keyboard actions
mousetouchZoom: false, // use mouse wheel, pinch to zoom?
metaClickPan: true, // metaKey + click pans to mouse position?
// statusBar: ["zoom", "scale", "colormap", "wcssys"], // status display
statusBar: "zoom: $zoom; scale: $scale/$scaleclipping($scalemin,$scalemax); color: $colormap($contrast,$bias); wcs: $wcssys($wcsunits)", // status display
toolbarTooltips: false, // display tooltips on toolbar?
centerDivs: ["JS9Menubar"], // divs which take part in JS9.Display.center()
resizeDivs: ["JS9Menubar", "JS9Colorbar", "JS9Toolbar"], // divs which take part in JS9.Display.resize()
resizeDivs: ["JS9Menubar", "JS9Colorbar", "JS9Toolbar", "JS9Statusbar"], // divs which take part in JS9.Display.resize()
pinchWait: 8, // number of events to wait before testing pinch
pinchThresh: 6, // threshold for pinch test
xeqPlugins: true, // execute plugin callbacks?
Expand Down Expand Up @@ -259,13 +261,13 @@ JS9.globalOpts = {
menuBar: ["file", "edit", "view", "zoom", "scale", "color", "region", "wcs", "analysis", "help"],
menubarStyle: "classic", // mac or classic
menuPosition: "right-5 bottom-5", // where menus pop up
menuClickEvent: "mouseup", // "click" or "mouse"
menuClickEvent: "mouseup", // "click" or "mouseup"
menuSelected: "check", // selected option icon
userMenus: false, // add user menus?
userMenuDivider: "   ", // divide before user menu
imagesFileSubmenu: 5, // how many images trigger a submenu?
toolBar: ["annulus", "box", "circle", "ellipse", "line", "polygon", "text", "linear", "log", "zoom+", "zoom-", "zoom1"],
syncOps: ["colormap","contrastbias","flip","pan","regions","rot90","scale","wcs","zoom"], // which ops are sync'ed?
syncOps: ["colormap","contrastbias","flip","pan","regions","rot90","scale","wcs","zoom"], // which ops are sync'ed?
syncReciprocate: true, // default value for reciprocal sync'ing
syncWCS: true, // default value for using WCS to sync
hiddenPluginDivs: [], // which static plugin divs start hidden
Expand Down Expand Up @@ -5630,6 +5632,43 @@ JS9.Image.prototype.expandMacro = function(s, opts){
}
}
}
// look for params in the image object
if( r === undefined && this.params[t] !== undefined ){
// shorten some of the results
switch(t){
case "wcsunits":
switch(this.params[t]){
case "sexagesimal":
r = "hms";
break;
case "degrees":
r = "deg";
break;
default:
r = this.params[t];
break;
}
break;
case "scaleclipping":
switch(this.params[t]){
case "dataminmax":
r = "data";
break;
default:
r = this.params[t];
break;
}
break;
default:
if( typeof this.params[t] === "number" &&
this.params[t] !== Math.floor(this.params[t]) ){
r = this.params[t].toFixed(2);
} else {
r = this.params[t];
}
break;
}
}
// if all else fails, return original macro unexpanded
if( r === undefined ){
r = m;
Expand Down Expand Up @@ -10037,6 +10076,14 @@ JS9.Display.prototype.resize = function(width, height, opts){
JS9.Colorbar.init.call(pinst);
}
}
// change the statusbar width, unless explicitly told not to
if( $.inArray("JS9Statusbar", JS9.globalOpts.resizeDivs) >= 0 &&
(JS9.isNull(opts.resizeStatusbar) || opts.resizeStatusbar) ){
pinst = this.pluginInstances.JS9Statusbar;
if( pinst ){
$(`#${this.id}Statusbar`).css("width", nwidth);
}
}
// change size of shape canvases
for( key in this.layers ){
if( this.layers.hasOwnProperty(key) ){
Expand Down
Loading

0 comments on commit aad2ddf

Please sign in to comment.