# HG changeset patch # User dwinter # Date 1294042285 -3600 # Node ID 83c58ea33792f40545569bee6d50c626b6531049 # Parent 6829553d2378de7068bc263bff895b63b7d43e61 first release (continued) diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/digiImage/DigiImage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/digiImage/DigiImage.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,176 @@ +package de.mpg.mpiwg.itgroup.digilib.digiImage; + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.axiom.om.OMOutputFormat; +import org.apache.axis2.databinding.types.soapencoding.Array; +import org.apache.commons.lang.StringUtils; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.RectangleListener; + + + + +public class DigiImage implements IDigiImage { + + private static String[] omitIfNegativeArray = {"dw","dh","ddpi","ddpix","ddpiy"}; + private static List omitIfNegative = Arrays.asList(omitIfNegativeArray); + + private Label label; + public Label getLabel() { + return label; + } + + public void setLabel(Label label) { + this.label = label; + } + + private URL url; + private Composite parent; + private String baseUrl="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler"; + private DigiImageParameter dp; + + + public DigiImage(Composite parent, int style, DigiImageParameter dp) { + //super(parent,style); + label = new Label(parent, style); + this.parent = parent; + this.dp=dp; + try { + setNewURL(createUrlFromParameter(dp)); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + private void setNewURL(URL url) { + this.url = url; + // TODO Auto-generated constructor stub + + InputStream is; + try { + is = url.openStream(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } + Image img = new Image(parent.getDisplay(),is); + //Label label = new Label(parent, SWT.None); + label.setImage(img); + + label.setVisible(true); + } + + + public Composite getParent() { + return parent; + } + + + private URL createUrlFromParameter(DigiImageParameter dp) throws MalformedURLException{ + URL url; + Map qa= new HashMap(); + + setPm(qa,"fn",dp.getFn()); + setPm(qa,"pn",dp.getPn()); + + setPm(qa,"dw",dp.getDw()); + setPm(qa,"dh",dp.getDh()); + + setPm(qa,"wx",dp.getWx()); + setPm(qa,"wy",dp.getWy()); + setPm(qa,"ws",dp.getWs()); + setPm(qa,"ww",dp.getWw()); + setPm(qa,"wh",dp.getWh()); + + + setPm(qa,"mo",dp.getMo()); + + setPm(qa,"cont",dp.getCont()); + setPm(qa,"brgt",dp.getBrgt()); + + setPm(qa,"rot",dp.getRot()); + + setPm(qa,"rgba",dp.getRgba()); + setPm(qa,"rgbm",dp.getRgbm()); + + setPm(qa,"ddpi",dp.getDdpi()); + setPm(qa,"ddpix",dp.getDdpix()); + setPm(qa,"ddpiy",dp.getDdpiy()); + + List queryArray = new ArrayList(); + for(String key:qa.keySet()){ + queryArray.add(key+"="+qa.get(key)); + } + String queryString = StringUtils.join(queryArray,"&"); + + String stringUrl=baseUrl+"?"+queryString; + return new URL(stringUrl); + } + + private void setPm(Map qa, String key, Object value){ + String v; + if (String.class.isInstance(value)){ + v=(String)value; + qa.put(key, v); + } else if (Integer.class.isInstance(value)){ + if (!((Integer)value==-1 & omitIfNegative.indexOf(key)>-1)) { // nicht vernachlaessigen + v=String.valueOf(value); + qa.put(key, v); + } + } else { + v=String.valueOf(value); + qa.put(key, v); + } + + } + + public DigiImageParameter getParameter() { + + return dp; + } + + public void setParameter(DigiImageParameter dp) { + this.dp=dp; + + } + + public void redraw(){ + try { + setNewURL(createUrlFromParameter(dp)); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private RectangleListener rectangleListener=null; + + public RectangleListener getRectangleListener() { + // TODO Auto-generated method stub + return rectangleListener; + } + + public void setRectangleListener(RectangleListener rectangleListener) { + this.rectangleListener = rectangleListener; + } + +} + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/digiImage/DigiImageController.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/digiImage/DigiImageController.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,175 @@ +package de.mpg.mpiwg.itgroup.digilib.digiImage; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.eclipse.swt.graphics.Point; + +import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.RectangleListener; + +public class DigiImageController { + + + + public DigiImage digiImage; + private DigiImageParameter parameter; + + protected DigiImageController(){} + + public DigiImageController(DigiImage di){ + this.digiImage=di; + } + + + + public void mir(String mode) { + + DigiImageParameter dp = digiImage.getParameter(); + + String parameter = dp.getMo(); + + + // mo kann mehrere durch komma getrennte parameter haben + String[] splittmo= parameter.split(","); + Boolean hasHMir = false; + List newmo = new ArrayList(); + for(String m: splittmo){ + if (m.equals(mode)){ + hasHMir=true; + } else { + newmo.add(m); + } + } + if(!hasHMir){ // kein hmir dann dazufuegen + newmo.add(mode); + } + String newmoString = StringUtils.join(newmo,","); + + dp.setMo(newmoString); + + + digiImage.setParameter(dp); + digiImage.redraw(); + } + + public void vmir() { + mir("vmir"); + + } + + public void hmir() { + mir("hmir"); + + } + + public void rotate(float rotateValue) { + digiImage.getParameter().setRot(rotateValue); + digiImage.redraw(); + } + + + + +public void zoomArea(int x, int y, int x2, int y2) { + + Point size = digiImage.getLabel().getSize(); + + float relx = new Float(x)/new Float(size.x); + float rely = new Float(y)/new Float(size.y); + + float relx2 = new Float(x2)/new Float(size.x); + float rely2 = new Float(y2)/new Float(size.y); + + DigiImageParameter dp = digiImage.getParameter(); + + float Ww = dp.getWw(); + float Wh = dp.getWh(); + + float Wx = dp.getWx(); + float Wy = dp.getWy(); + + + float nWx = relx*Ww+Wx; + float nWy = rely*Wh+Wy; + + float nWw = (relx2-relx)*Ww; + float nWh = (rely2-rely)*Wh; + + + + dp.setWx(nWx); + dp.setWy(nWy); + dp.setWw(nWw); + dp.setWh(nWh); + digiImage.setParameter(dp); + digiImage.redraw(); + + + // setRot(rotateValue); +} + + public void zoomFull(){ + DigiImageParameter dp = digiImage.getParameter(); + dp.setWw(1); + dp.setWh(1); + + dp.setWx(0); + dp.setWy(0); + + digiImage.setParameter(dp); + digiImage.redraw(); + } + + public void scaleDown() { + DigiImageParameter dp = digiImage.getParameter(); + float ws = dp.getWs(); + if (ws>1){ + dp.setWs(ws-1); + digiImage.setParameter(dp); + digiImage.redraw(); + + } + + } + + public void scaleUp() { + DigiImageParameter dp = digiImage.getParameter(); + float ws = dp.getWs(); + + dp.setWs(ws+1); + digiImage.setParameter(dp); + digiImage.redraw(); + + + + + } + + public void prevPage() { + DigiImageParameter dp = digiImage.getParameter(); + int pn = dp.getPn(); + if (pn>1) + pn=pn-1; + dp.setPn(pn); + digiImage.setParameter(dp); + digiImage.redraw(); + + } + + public void nextPage() { + DigiImageParameter dp = digiImage.getParameter(); + int pn = dp.getPn(); + + pn=pn+1; + dp.setPn(pn); + digiImage.setParameter(dp); + digiImage.redraw(); + + + } + + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/digiImage/DigiImageParameter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/digiImage/DigiImageParameter.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,150 @@ +package de.mpg.mpiwg.itgroup.digilib.digiImage; + +public class DigiImageParameter { + + private String fn; + + private int pn=1; + + private int dw=-1; + private int dh=-1; + + private float wx=0; + private float wy=0; + + private float ww=1; + private float wh=1; + private float ws=1; + + private String mo="fit"; + + private float cont=0; + private float brgt=0; + + private float rot=0; + + private String rgbm="0/0/0"; + private String rgba="0/0/0"; + + private int ddpi=-1; + private int ddpix=-1; + private int ddpiy=-1; + + public DigiImageParameter(String fn){ + this.fn = fn; + } + public String getFn() { + return fn; + } + public void setFn(String fn) { + this.fn = fn; + } + public int getPn() { + return pn; + } + public void setPn(int pn) { + this.pn = pn; + } + public int getDw() { + return dw; + } + public void setDw(int dw) { + this.dw = dw; + } + public int getDh() { + return dh; + } + public void setDh(int dh) { + this.dh = dh; + } + public float getWx() { + return wx; + } + public void setWx(float wx) { + this.wx = wx; + } + public float getWy() { + return wy; + } + public void setWy(float wy) { + this.wy = wy; + } + public float getWw() { + return ww; + } + public void setWw(float ww) { + this.ww = ww; + } + public float getWh() { + return wh; + } + public void setWh(float wh) { + this.wh = wh; + } + public float getWs() { + return ws; + } + public void setWs(float ws) { + this.ws = ws; + } + public String getMo() { + return mo; + } + public void setMo(String mo) { + this.mo = mo; + } + public float getCont() { + return cont; + } + public void setCont(float cont) { + this.cont = cont; + } + public float getBrgt() { + return brgt; + } + public void setBrgt(float brgt) { + this.brgt = brgt; + } + public float getRot() { + return rot; + } + public void setRot(float rot) { + this.rot = rot; + } + public String getRgbm() { + return rgbm; + } + public void setRgbm(String rgbm) { + this.rgbm = rgbm; + } + public String getRgba() { + return rgba; + } + public void setRgba(String rgba) { + this.rgba = rgba; + } + public int getDdpi() { + return ddpi; + } + public void setDdpi(int ddpi) { + this.ddpi = ddpi; + } + public int getDdpix() { + return ddpix; + } + public void setDdpix(int ddpix) { + this.ddpix = ddpix; + } + public int getDdpiy() { + return ddpiy; + } + public void setDdpiy(int ddpiy) { + this.ddpiy = ddpiy; + } + + + + + + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/digiImage/DigiNav.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/digiImage/DigiNav.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,45 @@ +package de.mpg.mpiwg.itgroup.digilib.digiImage; + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; + +import de.mpg.mpiwg.itgroup.digilib.listener.SelectNavigationListener; +import de.mpg.mpiwg.itgroup.digilib.manipulator.IDigilibImageManipulator; +import de.mpg.mpiwg.itgroup.digilib.manipulator.DigilibImageManipulatorProvider; + +public class DigiNav { + + + + private Composite navigationComposite; + + public DigiNav(Composite parent, int style, DigiImageController dc) { + + navigationComposite = new Composite(parent, SWT.None); + navigationComposite.setLayout(new GridLayout(1, true)); + + // TODO Auto-generated constructor stub + + List mps = DigilibImageManipulatorProvider.INSTANCE.getAllManipulators(); + + for (IDigilibImageManipulator mp:mps){ + Image img = mp.createImage(parent); + Label label = new Label(navigationComposite, SWT.None); + label.setImage(img); + + label.setToolTipText(mp.getKeyword()); + label.addMouseListener(new SelectNavigationListener(mp.getKeyword(),dc,label)); + } + + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/digiImage/IDigiImage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/digiImage/IDigiImage.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,25 @@ +package de.mpg.mpiwg.itgroup.digilib.digiImage; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.RectangleListener; + + +public interface IDigiImage { + + public DigiImageParameter getParameter(); + public void setParameter(DigiImageParameter dp); + public void redraw(); + + public Label getLabel(); + + public void setLabel(Label label); + + + public RectangleListener getRectangleListener(); + public void setRectangleListener(RectangleListener rectangleListener); + + public Composite getParent(); + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/digiImage/exceptions/DigilibInputTypeException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/digiImage/exceptions/DigilibInputTypeException.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,10 @@ +package de.mpg.mpiwg.itgroup.digilib.digiImage.exceptions; + +public class DigilibInputTypeException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 4342441319100794309L; + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/back.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/back.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/back.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/back.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/baselib.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/baselib.js Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,981 @@ +/* Copyright (C) 2003-2006 IT-Group MPIWG, WTWG Uni Bern and others + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Authors: + Christian Luginbuehl, 01.05.2003 (first version) + DW 24.03.2004 (Changed for digiLib in Zope) + Robert Casties, 2.11.2004 (almost complete rewrite) + Martin Raspe, 12.12.2005 (changes for Digilib NG) + Robert Casties, 3.9.2009 +*/ + +// was: function base_init() { +baseLibVersion = "2.011"; +browserType = getBrowserType(); + +sliders = {}; +activeSlider = null; + +function getInt(n) { + // returns always an integer + n = parseInt(n); + return (isNaN(n)) ? 0 : n; +} + +function defined(x) { + // returns if x is defined + return (typeof arguments[0] != "undefined"); +} + +function cropFloat(x) { + // auxiliary function to crop senseless precision + return parseInt(10000 * x) / 10000; +} + +function getBrowserType() { + // browser sniffer + var bt = Object(); + bt.doDHTML = false; + bt.versIE = 0; + + if ((! document.cssonly && document.layers) || document.all || document.getElementById) { + var vers = navigator.appVersion.split('MSIE '); + vers = vers[vers.length - 1]; + bt.versIE = getInt(vers); + bt.isIE = navigator.userAgent.indexOf('MSIE') >= 0; + bt.isMac = navigator.platform.indexOf('Mac') >= 0; + bt.isWin = navigator.platform.indexOf('Win') >= 0; + bt.isN4 = (navigator.userAgent.indexOf('Mozilla/4.') >= 0) && ! bt.isIE; + bt.isIEWin = bt.versIE > 0 && bt.isWin; + if (navigator.appVersion.indexOf('MSIE') < 0 || ! bt.isMac || bt.versIE >= 5) { + bt.doDHTML = true; + bt.isOpera = navigator.userAgent.indexOf(' Opera ') >= 0; + bt.isKonq = navigator.userAgent.indexOf(' Konqueror') >= 0; + } + } + return bt; +} + +// fixes for javascript < 1.2 +if (! Array.prototype.push) { + Array.prototype.push = function(val) { + this[this.length] = val; + return this.length; + } + Array.prototype.pop = function() { + var val = this[this.length-1]; + this.length -= 1; + return val; + } +} + + +/* ********************************************** + * geometry classes + * ******************************************** */ + +/* + * Size class + */ +function Size(w, h) { + this.width = parseFloat(w); + this.height = parseFloat(h); + return this; +} +Size.prototype.toString = function() { + return this.width + "x" + this.height; +} +Size.prototype.equals = function(other) { + return (this.width == other.width + && this.height == other.height) + } + +/* + * Position class + */ +function Position(x, y) { + this.x = parseFloat(x); + this.y = parseFloat(y); + return this; +} +Position.prototype.toString = function() { + return this.x + "," + this.y; +} +Position.prototype.equals = function(other) { + return (this.x == other.x + && this.y == other.y) +} +/* + * Rectangle class + */ +function Rectangle(x, y, w, h) { + if (typeof x == "object") { + // assume x and y are Position + this.x = x.x; + this.y = x.y; + this.width = y.x - x.x; + this.height = y.y - x.y; + return this; + } + this.x = parseFloat(x); + this.y = parseFloat(y); + this.width = parseFloat(w); + this.height = parseFloat(h); + return this; +} +Rectangle.prototype.toString = function() { + return this.width+"x"+this.height+"@"+this.x+","+this.y; +} +Rectangle.prototype.copy = function() { + // returns a copy of this Rectangle + return new Rectangle(this.x, this.y, this.width, this.height); +} +Rectangle.prototype.getPosition = function() { + // returns the position of this Rectangle + return new Position(this.x, this.y); +} +Rectangle.prototype.getPt1 = Rectangle.prototype.getPosition; +// returns the upper left corner position + +Rectangle.prototype.getPt2 = function() { + // returns the lower right corner position of this Rectangle + return new Position(this.x + this.width, this.y + this.height); +} +Rectangle.prototype.setPt1 = function(pos) { + // sets the upper left corner to position pos + this.x = pos.x; + this.y = pos.y; + return this; +} +Rectangle.prototype.setPt2 = function(pos) { + // sets the lower right corner to position pos + this.width = pos.x - this.x; + this.height = pos.y - this.y; + return this; +} +Rectangle.prototype.getCenter = function() { + // returns the center position of this Rectangle + return new Position(this.x + this.width / 2, this.y + this.height / 2); +} +Rectangle.prototype.setCenter = function(pos) { + // moves this Rectangle's center to position pos + this.x = pos.x - this.width / 2; + this.y = pos.y - this.height / 2; + return this; +} +Rectangle.prototype.getSize = function() { + // returns the size of this Rectangle + return new Size(this.width, this.height); +} +Rectangle.prototype.equals = function(other) { + // equal props + return (this.getPosition().equals(other.getPosition()) + && this.getSize().equals(other.getSize()) + ); +} +Rectangle.prototype.getArea = function() { + // returns the area of this Rectangle + return (this.width * this.height); +} +Rectangle.prototype.normalize = function() { + // eliminates negative width and height + var p = this.getPt2(); + this.x = Math.min(this.x, p.x); + this.y = Math.min(this.y, p.y); + this.width = Math.abs(this.width); + this.height = Math.abs(this.height); + return this; +} +Rectangle.prototype.containsPosition = function(pos) { + // returns if Position "pos" lies inside of this rectangle + return ((pos.x >= this.x) + && (pos.y >= this.y) + && (pos.x <= this.x + this.width) + && (pos.y <= this.y + this.width) + ); +} +Rectangle.prototype.containsRect = function(rect) { + // returns if rectangle "rect" is contained in this rectangle + return (this.containsPosition(rect.getPt1()) + && this.containsPosition(rect.getPt2())); +} +Rectangle.prototype.stayInside = function(rect) { + // changes this rectangle's x/y values so it stays inside of rectangle rect + // keeping the proportions + if (this.x < rect.x) this.x = rect.x; + if (this.y < rect.y) this.y = rect.y; + if (this.x + this.width > rect.x + rect.width) + this.x = rect.x + rect.width - this.width; + if (this.y + this.height > rect.y + rect.height) + this.y = rect.y + rect.height - this.height; + return this; +} +Rectangle.prototype.clipTo = function(rect) { + // clips this rectangle so it stays inside of rectangle rect + var p1 = rect.getPt1(); + var p2 = rect.getPt2(); + var this2 = this.getPt2(); + this.setPt1(new Position(Math.max(this.x, p1.x), Math.max(this.y, p1.y))); + this.setPt2(new Position(Math.min(this2.x, p2.x), Math.min(this2.y, p2.y))); + return this; +} +Rectangle.prototype.intersect = function(rect) { + // returns the intersection of the given Rectangle and this one + // FIX ME: not really, it should return null if there is no overlap + var sec = rect.copy(); + if (sec.x < this.x) { + sec.width = sec.width - (this.x - sec.x); + sec.x = this.x; + } + if (sec.y < this.y) { + sec.height = sec.height - (this.y - sec.y); + sec.y = this.y; + } + if (sec.x + sec.width > this.x + this.width) { + sec.width = (this.x + this.width) - sec.x; + } + if (sec.y + sec.height > this.y + this.height) { + sec.height = (this.y + this.height) - sec.y; + } + return sec; +} +Rectangle.prototype.fit = function(rect) { + // returns a Rectangle that fits into this one (by moving first) + var sec = rect.copy(); + sec.x = Math.max(sec.x, this.x); + sec.y = Math.max(sec.y, this.x); + if (sec.x + sec.width > this.x + this.width) { + sec.x = this.x + this.width - sec.width; + } + if (sec.y + sec.height > this.y + this.height) { + sec.y = this.y + this.height - sec.height; + } + return sec.intersect(this); +} + +/* + * Transform class + * + * defines a class of affine transformations + */ +function Transform() { + this.m00 = 1.0; + this.m01 = 0.0; + this.m02 = 0.0; + this.m10 = 0.0; + this.m11 = 1.0; + this.m12 = 0.0; + this.m20 = 0.0; + this.m21 = 0.0; + this.m22 = 1.0; + return this; +} +Transform.prototype.concat = function(traf) { + // add Transform traf to this Transform + for (var i = 0; i < 3; i++) { + for (var j = 0; j < 3; j++) { + var c = 0.0; + for (var k = 0; k < 3; k++) { + c += traf["m"+i+k] * this["m"+k+j]; + } + this["m"+i+j] = c; + } + } + return this; +} +Transform.prototype.transform = function(rect) { + // returns transformed Rectangle or Position with this Transform applied + var x = this.m00 * rect.x + this.m01 * rect.y + this.m02; + var y = this.m10 * rect.x + this.m11 * rect.y + this.m12; + if (rect.width) { + // transform the other corner points + var pt2 = rect.getPt2(); + var x2 = this.m00 * pt2.x + this.m01 * pt2.y + this.m02; + var y2 = this.m10 * pt2.x + this.m11 * pt2.y + this.m12; + var width = x2 - x; + var height = y2 - y; + return new Rectangle(x, y, width, height); + } + return new Position(x, y); +} +Transform.prototype.invtransform = function(rect) { + // returns transformed Rectangle or Position with the inverse of this Transform applied + var det = this.m00 * this.m11 - this.m01 * this.m10; + var x = (this.m11 * rect.x - this.m01 * rect.y - this.m11 * this.m02 + this.m01 * this.m12) / det; + var y = (- this.m10 * rect.x + this.m00 * rect.y + this.m10 * this.m02 - this.m00 * this.m12) / det; + if (rect.width) { + /* transforming width and height like points seems to be wrong + var width = (this.m11 * rect.width - this.m01 * rect.height - this.m11 * this.m02 + this.m01 * this.m12) / det; + var height = (- this.m10 * rect.width + this.m00 * rect.height + this.m10 * this.m02 - this.m00 * this.m12) / det; + */ + // transform the other corner points + var pt2 = rect.getPt2(); + var x2 = (this.m11 * pt2.x - this.m01 * pt2.y - this.m11 * this.m02 + this.m01 * this.m12) / det; + var y2 = (- this.m10 * pt2.x + this.m00 * pt2.y + this.m10 * this.m02 - this.m00 * this.m12) / det; + var width = x2 - x; + var height = y2 - y; + return new Rectangle(x, y, width, height); + } + return new Position(x, y); +} +function getRotation(angle, pos) { + // returns a Transform that is a rotation by angle degrees around [pos.x, pos.y] + var traf = new Transform(); + if (angle != 0) { + var t = 2.0 * Math.PI * parseFloat(angle) / 360.0; + traf.m00 = Math.cos(t); + traf.m01 = - Math.sin(t); + traf.m10 = Math.sin(t); + traf.m11 = Math.cos(t); + traf.m02 = pos.x - pos.x * Math.cos(t) + pos.y * Math.sin(t); + traf.m12 = pos.y - pos.x * Math.sin(t) - pos.y * Math.cos(t); + } + return traf; +} +Transform.prototype.getRotation = getRotation; +function getTranslation(pos) { + // returns a Transform that is a translation by [pos.x, pos,y] + var traf = new Transform(); + traf.m02 = pos.x; + traf.m12 = pos.y; + return traf; +} +Transform.prototype.getTranslation = getTranslation; +function getScale(size) { + // returns a Transform that is a scale by [size.width, size.height] + var traf = new Transform(); + traf.m00 = size.width; + traf.m11 = size.height; + return traf; +} +Transform.prototype.getScale = getScale; + + +/* + * parameters class + */ + +function Parameters() { + this.params = new Object(); + this.PARAM_ALL = 65535; + return this; +} +Parameters.prototype.define = function(name, defaultValue, detail) { + // create a new parameter with a name and a default value + if (!this.params[name]) this.params[name] = new Object(); + this.params[name].defaultValue = defaultValue; + this.params[name].hasValue = false; + this.params[name].value = defaultValue; + this.params[name].detail = detail; + return this.params[name]; +} +Parameters.prototype.reset = function(name) { + // resets the given parameter to its default value + if (!this.params[name]) { + alert("Could not reset non-existing parameter '" + name + "'"); + return false; + } + this.params[name].hasValue = false; + this.params[name].value = this.params[name].defaultValue; + return this.params[name]; +} +Parameters.prototype.resetAll = function() { + // resets all parameters to their default values + for (var p in this.params) { + this.reset(p); + } + return true; +} +Parameters.prototype.remove = function(name) { + if (!defined(this.params[name])) return false; + delete this.params[name]; + return true; +} +Parameters.prototype.get = function(name) { + // returns the named parameter value or its default value + if (!defined(this.params[name])) return null; + return this.params[name].hasValue ? this.params[name].value : this.params[name].defaultValue; +} +Parameters.prototype.set = function(name, value, relative) { + // sets parameter value (relative values with +/- if relative=true) + if (!defined(this.params[name])) return null; + var p = this.params[name]; + if (relative && value.slice) { + // value is a string -- check if it starts with +/- + var sign = value.slice(0, 1); + if (sign == '+') { + p.value = parseFloat(p.value) + parseFloat(value.slice(1)); + } else if (sign == '-') { + p.value = parseFloat(p.value) - parseFloat(value.slice(1)); + } else { + p.value = value; + } + } else { + p.value = value; + } + p.hasValue = true; + return p.value; +} +Parameters.prototype.isSet = function(name) { + // returns if the parameter's value has been set + if (!defined(this.params[name])) return null; + return this.params[name].hasValue; +} +Parameters.prototype.getAll = function(detail) { + // returns a string of all parameters in query format + if (!detail) detail = this.PARAM_ALL; + var pa = new Array(); + for (p in this.params) { + if (((this.params[p].detail & detail) > 0) + && (this.params[p].hasValue)) { + var val = this.params[p].value; + if (val != "") { + pa.push(p + "=" + val); + } + } + } + return pa.join("&"); +} +Parameters.prototype.parse = function(query) { + // gets parameter values from query format string + var pa = query.split("&"); + for (var i = 0; i < pa.length; i++) { + var keyval = pa[i].split("="); + if (keyval.length == 2) { + this.set(keyval[0], keyval[1]); + } + } +} + +/* + * Flags class + * + * Flags are (hash-) collections of unique strings. + */ +function Flags() { + this.flags = new Object(); + return this; +} +Flags.prototype.define = function(name, detail) { + // create a new flag with a name and detail level + this.flags[name] = new Object(); + this.flags[name].set = false; + this.flags[name].detail = detail; + return this.flags[name]; +} +Flags.prototype.get = function(name) { + return (this.flags[name]) ? this.flags[name].set : false; +} +Flags.prototype.set = function(name, value) { + if (!defined(value)) value = true; + if (!this.flags[name]) this.flags[name] = new Object; + this.flags[name].set = value; +} +Flags.prototype.reset = function(name) { + if (!this.flags[name]) this.flags[name] = new Object; + this.flags[name].set = false; +} +Flags.prototype.toggle = function(name) { + if (!this.flags[name]) this.flags[name] = new Object; + this.flags[name].set = !this.flags[name].set; +} +Flags.prototype.resetAll = function() { + for (var f in this.flags) { + this.flags[f].set = false; + } +} +Flags.prototype.parse = function(query, sep) { + // sets the flags from the string query + if (!sep) sep = ","; + var fa = query.split(sep); + for (var i = 0; i < fa.length ; i++) { + var f = fa[i]; + if (f != "") { + this.set(f); + } + } +} +Flags.prototype.getAll = function(detail, sep) { + // returns a string of all flags in query format + if (!detail) detail = 255; + if (!sep) sep = ","; + var fa = new Array(); + for (f in this.flags) { + if (this.flags[f].set) { + // if the flag has a detail level it must match + // otherwise we assume detail=128 + if (this.flags[f].detail) { + if ((this.flags[f].detail & detail) > 0) { + fa.push(f); + } + } else { + if ((detail & 128) > 0) { + fa.push(f); + } + } + } + } + return fa.join(sep); +} + + +/* ********************************************** + * HTML/DOM routines + * ******************************************** */ + +function getElement(tagid, quiet) { + // returns the element object with the id tagid + var e; + if (document.getElementById) { + e = document.getElementById(tagid); + } else if (document.all) { + alert("document.all!"); + e = document.all[tagid]; + } else if (document.layers) { + e = document.layers[tagid]; + } + if (e) { + return e; + } else { + if (! quiet) { + alert("unable to find element: "+tagid); + } + return null; + } +} + +function getElementPosition(elem) { + // returns a Position with the position of the element + var x = 0; + var y = 0; + if (defined(elem.offsetLeft)) { + var e = elem; + while (e) { + if (browserType.isIE) { + if (browserType.isMac) { + if (e.offsetParent.tagName == "BODY") { + // IE for Mac extraspecial + x += e.clientLeft; + y += e.clientTop; + break; + } + } else { + if ((e.tagName != "TABLE") && (e.tagName != "BODY")) { + x += e.clientLeft; + y += e.clientTop; + } + } + } + x += e.offsetLeft; + y += e.offsetTop; + e = e.offsetParent; + } + } else if (defined(elem.x)) { + // use .x for other (which?) + x = elem.x; + y = elem.y; + } else if (defined(elem.pageX)) { + // use pageX for N4 + x = elem.pageX; + y = elem.pageY; + } else { + alert("unable to get position of " + elem + " (id:" + elem.id + ")"); + } + return new Position(getInt(x), getInt(y)); +} + +function getElementSize(elem) { + // returns a Rectangle with the size of the element + var width = 0; + var height = 0; + if (defined(elem.offsetWidth)) { + width = elem.offsetWidth; + height = elem.offsetHeight; + } else if (defined(elem.width)) { + width = elem.width; + height = elem.height; + } else if (defined(elem.clip.width)) { + width = elem.clip.width; + height = elem.clip.height; + } else { + alert("unable to get size of " + elem + " (id:" + elem.id + ")"); + } + return new Size(getInt(width), getInt(height)); +} + +function getElementRect(elem) { + // returns a Rectangle with the size and position of the element + // FIX ME: what about borders? + var pos = getElementPosition(elem); + var size = getElementSize(elem); + return new Rectangle(pos.x, pos.y, size.width, size.height); +} + +function moveElement(elem, rect) { + // moves and sizes the element + if (elem.style) { + if (defined(rect.x)) { + elem.style.left = Math.round(rect.x) + "px"; + elem.style.top = Math.round(rect.y) + "px"; + } + if (defined(rect.width)) { + elem.style.width = Math.round(rect.width) + "px"; + elem.style.height = Math.round(rect.height) + "px"; + } + } else if (document.layers) { + if (defined(rect.x)) { + elem.pageX = getInt(rect.x); + elem.pageY = getInt(rect.y); + } + if (defined(rect.width)) { + elem.clip.width = getInt(rect.width); + elem.clip.height = getInt(rect.height); + } + } else { + alert("moveElement(): element has no style or layer property!"); + return false; + } + return true; +} + +function showElement(elem, show) { + // shows or hides the element + if (elem.style) + elem.style.visibility = show ? "visible" : "hidden"; + else if (defined(elem.visibility)) + elem.visibility = show ? "show" : "hide"; + else + alert("showElement(): element has no style or layer property!"); + return true; +} + +function evtPosition(evt) { + // returns the on-screen Position of the Event + var x; + var y; + evt = (evt) ? evt : window.event; + if (!evt) { + alert("no event found! " + evt); + return; + } + if (defined(evt.pageX)) { + x = parseInt(evt.pageX); + y = parseInt(evt.pageY); + } else if (defined(evt.clientX)) { + x = parseInt(document.body.scrollLeft + evt.clientX); + y = parseInt(document.body.scrollTop + evt.clientY); + } else { + alert("evtPosition(): don't know how to deal with " + evt); + } + return new Position(x, y); +} + +function registerEvent(type, elem, handler) { + // register the given event handler on the indicated element + if (elem.addEventListener) { + elem.addEventListener(type, handler, false); // bubble + } + else if (elem.attachEvent) { + elem.attachEvent("on" + type, handler); + } + else if (elem.captureEvents) { + if (Event) { + t = type.toUpperCase(); + elem.captureEvents(Event[t]); + elem[ "on" + type ] = handler; + } + } + else { + alert("Could not register event of type " + type); + return false; + } + return true; + } + +function unregisterEvent(type, elem, handler) { + // unregister the given event handler from the indicated element + if (elem.removeEventListener) { + elem.removeEventListener(type, handler, false); + } + else if (elem.detachEvent) { + elem.detachEvent("on" + type, handler); + } + else if (elem.releaseEvents) { + if (Event) { + t = type.toUpperCase(); + elem.releaseEvents(Event[t]); + elem[ "on" + type ] = null; + } + } + else { + alert("Could not register event of type " + type); + return false; + } + return true; +} + +function registerEventById(type, id, handler) { + registerEvent(type, getElement(id), handler); + } + +function unregisterEventById(type, id, handler) { + unregisterEvent(type, getElement(id), handler); + } + +function stopEvent(e) { + if (!e) var e = window.event; + e.cancelBubble = true; + if (e.stopPropagation) e.stopPropagation(); + return false; +} + +function getEventSrc(e) { + if (e.target) return e.target; + if (e.srcElement) return e.srcElement; +} + +// old registerXXYY API for compatibility +function registerMouseDown(elem, handler) { + return registerEvent("mousedown", elem, handler); +} +function unregisterMouseDown(elem, handler) { + return unregisterEvent("mousedown", elem, handler); +} +function registerMouseMove(elem, handler) { + return registerEvent("mousemove", elem, handler); +} +function unregisterMouseMove(elem, handler) { + return unregisterEvent("mousemove", elem, handler); +} +function registerKeyDown(handler) { + return registerEvent("keypress", elem, handler); +} + + +function getWinSize() { + // returns a Size with the current window size (mostly from www.quirksmode.org) + var wsize = new Size(100, 100); + if (defined(self.innerHeight)) { + // all except Explorer + if ((self.innerWidth == 0)||(self.innerHeight == 0)) { + // Safari 1.2 (and other) bug + if (parent) { + wsize.height = parent.innerHeight; + wsize.width = parent.innerWidth; + } + } else { + wsize.width = self.innerWidth; + wsize.height = self.innerHeight; + } + } else if (document.documentElement && document.documentElement.clientHeight) { + // Explorer 6 Strict Mode + wsize.width = document.documentElement.clientWidth; + wsize.height = document.documentElement.clientHeight; + } else if (document.body) { + // other Explorers + wsize.width = document.body.clientWidth; + wsize.height = document.body.clientHeight; + } + return wsize; +} + +function getWinRect() { + var size = getWinSize(); + return new Rectangle(0, 0, size.width, size.height); +} + +function openWin(url, name, params) { + // open browser window + var ow = window.open(url, name, params); + ow.focus(); +} + +/* ********************************************** + * cookie class + * ******************************************** */ + +function Cookie() { + return this.read(); +} + +Cookie.prototype.read = function() { + var s = document.cookie; + var lines = s.split("; "); // semicolon and space for all browsers? + for (var i in lines) { + var line = lines[i]; + var sep = line.indexOf("="); + if (sep != -1) this.add( + line.substr(0, sep), + line.substr(sep + 1) + ); + } + return this; +} + +Cookie.prototype.store = function() { + var lines = new Array(); + for (var i in this) { + var item = this[i]; + if (typeof(item) == typeof(lines)) // Array + lines.push(i + "=" + item.join(",")); + else if (typeof(item) != "function") // single item + lines.push(i + "=" + item); + } + // var s = lines.join(";") + for (line in lines) document.cookie = lines[line]; + return this; + } + +Cookie.prototype.add = function(key, value) { + value = value.toString(); + if (value.indexOf(",") == -1) + this[key] = value; // single value + else + this[key] = value.split(","); // list of values + return this[key]; + } + +Cookie.prototype.get = function(key) { + return this[key]; + } + +Cookie.prototype.addbool = function(key, value) { + this[key] = Boolean(value).toString(); + return this[key]; + } + +Cookie.prototype.getbool = function(key) { + var val = this[key]; + return (val > "") && (val != "0") && (val != "false"); + } + +Cookie.prototype.remove = function(key) { + delete this[key]; + } + +function Slider(id, valMin, valMax, valStart, stepSize, onChange) { + // a (horizontal) slider widget + this.id = id; + this.elem = getElement(id); + this.slider = getElement(id + "-slider"); // the slider handle + this.input = getElement(id + "-input", 1); // optional input field + this.bar = getElement(id + "-bar"); // the slider bar + this.barRect = getElementRect(this.bar); + this.sliderRect = getElementRect(this.slider); + this.xMin = this.barRect.x; + this.xMax = this.xMin + this.barRect.width; + this.xDiff = this.xMax - this.xMin; + this.Y = this.barRect.getCenter().y; // middle axis of bar + this.valMin = valMin; + this.valMax = valMax; + this.valDiff = Math.abs(valMax - valMin); + this.valStart = valStart; + this.value = valStart; + this.stepSize = stepSize; + this.valueLabel = getElement(id + "-value", 1); + this.valMinLabel = getElement(id + "-valmin", 1); + this.valMaxLabel = getElement(id + "-valmax", 1); + this.onChange = onChange ? onChange : function() {}; + this.update(); + this.activate(); + sliders[id + '-slider'] = this; // make a handle to the object + return this; + } + +Slider.prototype.show = function(show) { + showElement(this.elem, show); + this.activate(); + } + +Slider.prototype.activate = function() { + this.setupEvents(); + } + +Slider.prototype.deactivate = function() { + unregisterEvent("mousedown", this.slider, this.onDragStart); + } + +Slider.prototype.reset = function() { + this.setValue(this.startVal); + } + +Slider.prototype.setValue = function(newVal) { + // sets slider to new value and updates + this.value = newVal; + this.update(); + } + +Slider.prototype.calcValue = function() { + // calculates value from slider position + var xSlider = this.sliderRect.getCenter().x - this.xMin; + this.value = xSlider * this.valDiff / this.xDiff; + return this.value; + } + +Slider.prototype.update = function() { + // updates slider position to new value + var xSlider = this.value * this.xDiff / this.valDiff; + moveElement(this.slider, this.sliderRect.setCenter( + new Position(xSlider + this.xMin, this.Y))); + var strVal = this.value.toString(); + if (this.valueLabel) this.valueLabel.innerHTML = strVal; + if (this.input) this.input.value = strVal; + } + +Slider.prototype.setupEvents = function() { + // installs all event callbacks + registerEvent("mousedown", this.slider, this.onDragStart); + } + +Slider.prototype.onDragStart = function(evt) { + var slider = sliders[this.id]; + activeSlider = slider; + unregisterEvent("mousedown", slider.slider, slider.onDragStart); + registerEvent("mousemove", document, slider.onDrag); + registerEvent("mouseup", document, slider.onDragEnd); + slider.startPos = evtPosition(evt); + slider.startX = slider.sliderRect.getCenter().x; + return stopEvent(evt); + } + +Slider.prototype.onDrag = function(evt) { + var slider = activeSlider; + var pos = evtPosition(evt); + var currX = slider.slider + var newX = pos.x - slider.startPos + slider.startX; + if (newX < slider.xMin) newX = slider.xMin; + if (newX > slider.xMax) newX = slider.xMax; + moveElement(slider.slider, slider.sliderRect.setCenter( + new Position(newX, slider.Y))); + return stopEvent(evt); + } + +Slider.prototype.onDragEnd = function(evt) { + var slider = activeSlider; + unregisterEvent("mousemove", document, slider.onDrag); + unregisterEvent("mouseup", document, slider.onDragEnd); + slider.onChange(slider.calcValue()); + activeSlider = null; + return stopEvent(evt); + } + +Slider.prototype.onInputChange = function() { + var slider = activeSlider; + slider.onChange(s.value); + } + +// :tabSize=4:indentSize=4:noTabs=true: + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/bg.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/bg.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/bg.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/bg.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,63 @@ + + + + + + + + + image/svg+xml + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/birds-eye.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/birds-eye.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/birds-eye.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/birds-eye.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/blue.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/blue.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/brightness-on.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/brightness-on.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/brightness-on.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/brightness-on.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/brightness.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/brightness.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/brightness.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/brightness.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/calibration-x.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/calibration-x.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/calibration-x.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/calibration-x.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/calibration-y.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/calibration-y.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/calibration-y.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/calibration-y.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/cat.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/cat.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/cat.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/cat.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/contrast-on.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/contrast-on.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/contrast-on.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/contrast-on.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/contrast.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/contrast.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/contrast.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/contrast.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/corona.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/corona.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/corona.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/corona.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,214 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/debug.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/debug.js Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,111 @@ +var Debug = null; +var _now = {}; + +function element(name, content) { + var E = document.createElement(name); + if (content) { + if (content.nodeType) // it's a node + E.appendChild(content) + else // it's text + E.appendChild(document.createTextNode(content)) + }; + return E; + } + +function appendElement(node, name, content) { + if (node == null || ! node.appendChild) + return node; + return node.appendChild(element(name,content)); + } + +function getDebug() { + if (Debug == null) { + Debug = document.getElementById('debug'); + if (Debug == null) { + Debug = appendElement(document.body, 'div'); + Debug.setAttribute('class', 'debug'); + Debug.setAttribute('id', 'debug'); + Debug.innerhtml = '

Debug

'; + }; + }; + return Debug; + } + +function debug() { + var D = getDebug(); + // return alertObject(D); + var msg = ""; + for (var i = 0; i -1; + var A = new Array(); + for (var prop in obj) A.push(prop); + A.sort(); + var D = getDebug(); + var T = appendElement(D, "table"); + for (var i = 0; i < A.length; i++) { + var key = A[i]; + var value = obj[key]; + var type = typeof(value); + // exclude specified types + if (exclude.indexOf(type) > -1) + continue; + // exclude uppercase-only properties (= constants) + if (noConst && key.search(/^[A-Z0-9_]+$/) > -1) + continue; + var TR = appendElement(T, "tr"); + appendElement(TR, "td", element("b", key)); + appendElement(TR, "td", type); + appendElement(TR, "td", value + ""); + if (type == "function") + appendElement(TR, "td", value.toSource()); + }; + } + +function strObject(obj) { + var res = ""; + var A = new Array(); + try { + for (var i in obj) A[i] = typeof(obj[i]); + } + catch(e) { typ = "unknown" }; + var count = 0; + for (var item in A) { + count++; + typ = A[item]; + res += item + " (" + typ + "): "; + if (typ != "function") res += obj[item]; + res += "\t"; + if (count % 4 == 0) + res += "\n"; + } + return res; + } + +function alertObject(obj) { + return alert(strObject(obj)); + } + +function alertHTML(obj) { + if (obj) + return alert(obj.tagName + ".innerHTML:\n" + obj.innerHTML); + } + +function serialize(xmlobject) { + return (new XMLSerializer()).serializeToString(xmlobject); + } + +function startTime(s) { + _now[s] = new Date(); + } + +function elapsedTime(s) { + var diff = new Date(new Date - _now[s]); + debug(s + ": " + diff.getSeconds() + "." + diff.getMilliseconds() + " sec."); + } + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/delmark.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/delmark.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/delmark.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/delmark.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + 1 + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/digimage-neu.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/digimage-neu.jsp Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,443 @@ +<%@ page language="java" %><%! +// -- JSP init ------------- + +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +// -- end of JSP init ------------- +%><% +// -- JSP request ------------- + +// parsing the query +// ----------------- +digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request); +docBean.setRequest(dlRequest); +// check if authentication is needed and redirect if necessary +docBean.doAuthentication(response); +// add number of pages +dlRequest.setValue("pt", docBean.getNumPages()); +// store objects for jsp:include +pageContext.setAttribute("docBean", docBean, pageContext.REQUEST_SCOPE); +%> + + Digital Document Library NG + + + + + + + + + + + + + + +
+ <% if (dlRequest.hasOption("clop", "noarrows")) { + %><% + } else { + %><% + } + %> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/digimage.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/digimage.jsp Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,459 @@ +<%@ page language="java" %><%! + // -- JSP init ------------- + + // create DocumentBean instance for all JSP requests + digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + + // initialize DocumentBean instance in JSP init + public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } + } + // -- end of JSP init ------------- +%> + +<% + // -- JSP request ------------- + + // parsing the query + // ----------------- + digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request); + docBean.setRequest(dlRequest); + // check if authentication is needed and redirect if necessary + docBean.doAuthentication(response); + // add number of pages + dlRequest.setValue("pt", docBean.getNumPages()); + // store objects for jsp:include + pageContext.setAttribute("docBean", docBean, pageContext.REQUEST_SCOPE); +%> + + + + + Digital Document Library NG + + + + + + + + + + + + +
+
+ +
+
+ + +
+
+
+
+
+
+
+
+ + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/digimage_img_inc.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/digimage_img_inc.jsp Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,25 @@ +<%@ page language="java" %><% +// retrieve objects from context +digilib.servlet.DocumentBean docBean = (digilib.servlet.DocumentBean) pageContext.getAttribute("docBean", pageContext.REQUEST_SCOPE); +digilib.servlet.DigilibRequest dlRequest = docBean.getRequest(); +String ua = request.getHeader("User-Agent"); +boolean isN4 = ((ua.indexOf("Mozilla/4.") > -1)&&(ua.indexOf("MSIE") == -1)); +%> +<% + if (isN4) { +%><% + } else { +%>
<% + } +%> + +<% + if (isN4) { +%><% + } else { +%>
<% + } +%> diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/digimage_tbl_inc.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/digimage_tbl_inc.jsp Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,61 @@ +<%@ page language="java" %><% +// retrieve objects from context +digilib.servlet.DocumentBean docBean = (digilib.servlet.DocumentBean) pageContext.getAttribute("docBean", pageContext.REQUEST_SCOPE); +digilib.servlet.DigilibRequest dlRequest = docBean.getRequest(); +String ua = request.getHeader("User-Agent"); +boolean isN4 = ((ua.indexOf("Mozilla/4.") > -1)&&(ua.indexOf("MSIE") == -1)); +%> + + + + + + + + + + + + + + + + +
<% + if (docBean.canMoveUp()) { + %><% + } + %>
<% + if (docBean.canMoveLeft()) { + %><% + } + %> +<% + if(isN4) { + %><% + } else { + %>
<% + } +%> + +<% + if(isN4) { + %><% + } else { + %>
<% + } +%> +
<% + if (docBean.canMoveRight()) { + %><% + } + %>
<% + if (docBean.canMoveDown()) { + %><% + } + %>
diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/diginew.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/diginew.css Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,276 @@ +/* Styles for Digilib NG */ +/* (c) 2005 by Martin Raspe */ +/* Bibliotheca Hertziana (Max-Planck-Institute for Art History), Rome */ + +body { + background-color: #E0E0E0; + color: black; + font-size: 8pt; + margin-left: 8px; + margin-top: 8px; + padding: 0px; + } + +code { + font-family: monospace; + color: blue; + } + +pre { color: #006060; } + + +a.icon { + margin: 0px; + padding: 0px; + } + +a.arrow { + display: block; + position: absolute; + border: none; + z-index: 50; + background-repeat: no-repeat; + background-position: center; + } + +a#up:hover { + background-image: url('up.png'); + } + +a#down:hover { + background-image: url('down.png'); + } + +a#left:hover { + background-image: url('left.png'); + } + +a#right:hover { + background-image: url('right.png'); + } + +/* Images */ + +img.logo { + border: none; + } + +img.png { + border: none; + } + +img.png:hover { + background-image: url('corona.png'); + } + +img#bird-image { + border: none; + position: fixed; + bottom: 8px; + right: 48px; + visibility: hidden; + z-index: 1; + } + +/* DIVs */ + +div.button { + padding: 0px; + } + +div.separator { + margin-bottom: 4px; + border-top: 2px solid lightgrey; + } + +div.mark { + position: absolute; + color: white; + background: url('mark-bg-16.png'); + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: bold; + font-size:11px; + height: 15px; + width: 16px; + padding-top: 1px; + text-align: center; + z-index: 10; + visibility: hidden; + /* filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='mark-bg-16.png') */ + } + +div#bg { + position: absolute; + background-color: grey; + background-repeat:no-repeat; + cursor: move; + visibility: hidden; +} + +div#scaler { + margin-right: 50px; + /* position: absolute; + left: 8px; + top: 8px; + bottom: 8px; + right: 44px; +*/ /* overflow: auto; */ + } + +div#scaler img { + cursor: default; +} + +div#overlay, div#bird-overlay { + position: fixed; + background-color: transparent; + border: none; + z-index: 100; + visibility: hidden; + /* box-sizing: border-box; + -moz-box-sizing: border-box; */ + } + +div#buttons { + position: fixed; + right: 5px; + top: 5px; + padding: 3px; +/* background-color: #E0E0E0; */ + background-color: lightgrey; + } + +div#dloptions { + position: fixed; + right: 5px; + top: 5px; + padding: 3px; +/* background-color: #E0E0E0; */ + background-color: lightgrey; + visibility: hidden; + } + +div#zoom { + position: absolute; + /* border: 2px solid #ffa060; */ + border: 2px solid #ff0000; + z-index: 200; + visibility: hidden; + /* box-sizing: border-box; + -moz-box-sizing: border-box; */ + } + +div#bird-area { + position: fixed; + /* border: 2px solid #ffa060; */ + border: 2px solid #ff0000; + background-color: transparent; + /* box-sizing: border-box; + -moz-box-sizing: border-box; */ + z-index: 10; + visibility: hidden; + } + +div#calibration { + background: url('blue.png'); + position: absolute; + top: 0px; + width: 400px; + padding: 0px; + visibility: hidden; + z-index: 1000; + } + +div#calibration div { + width: 100%; + height: 100%; + margin: 0px; + padding: 0px; + font-family: Verdana, Arial, Helvetica, sans-serif; + text-align: center; + color: lightcyan; + border: 1px solid lightcyan; + background: url('ruler-top.gif') 0px -1px repeat-x; + z-index: 1001; + } + +p.cm { + font-weight: bold; + } + +div.popup-menu { + position: absolute; + top: 0px; + padding: 0px 2px; + font-family: Verdana, Arial, Helvetica, sans-serif; + border: 2px solid lightcyan; + background-color: lightgrey; + text-align: center; + visibility: hidden; + z-index: 1005; + } + +div.popup-menu p { + margin: 2px 0px; + padding: 0px; + } + +div.popup-menu p:hover { + background-color: #ffa060; + } + +div.popup-menu a { + text-decoration: none; + color: black; + } + +div#about { + position: absolute; + width: 200px; + top: 100px; + left: 350px; + height: 200px; + padding: 0px 2px; + font-family: Verdana, Arial, Helvetica, sans-serif; + border: 2px solid lightcyan; + background-color: lightgrey; + text-align: center; + visibility: hidden; + z-index: 1000; + } + +div#about p { + margin: 6px; + } + + +/* DEBUG elements */ + +div#debug { + position: absolute; + width: 150px; + top: 50px; + right: 36px; + bottom: 50px; + overflow: auto; + padding: 0px 2px; + font-family: Verdana, Arial, Helvetica, sans-serif; + color: lightgreen; + border: 1px dotted black; + background-color: transparent; + visibility: hidden; + } + +div#debug p.debug, h1 { + font-weight: bold; + color: lightcyan; + } + +div#debug p, h1 { + margin: 0px; + padding: 2px 0px; + font-size: 9px; + background-color: black; + } + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/diginew.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/diginew.jsp Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,618 @@ + +<%@ page language="java" pageEncoding="UTF-8"%><%! + // -- JSP init ------------- + + // create DocumentBean instance for all JSP requests + digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + + // initialize DocumentBean instance in JSP init + public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } + } + // -- end of JSP init ------------- +%><% + // -- JSP request ------------- + + // parsing the query + // ----------------- + digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request); + docBean.setRequest(dlRequest); + // check if authentication is needed and redirect if necessary + docBean.doAuthentication(response); + // add number of pages + dlRequest.setValue("pt", docBean.getNumPages()); + // store objects for jsp:include + pageContext.setAttribute("docBean", docBean, pageContext.REQUEST_SCOPE); + +%> + + + Digital Document Library NG + + + + + + + + + + + + + + + +
+ +
+ +
+ + +
+
+ + +
+ + + + + +
+ + + + + + + + +
+

Digilib Graphic Viewer

+ + + +

+

+

+

+
+ + +
+
+

measure the length of this scale on your screen

+
+
+ + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
+
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+
+ +
+ +

Debug

+ + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/dlMenu.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/dlMenu.html Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,175 @@ + + + + + + + + + + +
+
+
+

+
+

+
+
+
+

+

+

+ + + + + + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/dllib.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/dllib.js Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,1045 @@ +/* Copyright (C) 2003,2004 IT-Group MPIWG, WTWG Uni Bern and others + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Authors: + Christian Luginbuehl, 01.05.2003 (first version) + DW 24.03.2004 (Changed for digiLib in Zope) + Robert Casties, 8.11.2005 + Martin Raspe , 12.12.2005 + Robert Casties, 4.9.2009 + + ! Requires baselib.js ! +*/ +digilibVersion = "Digilib NG"; +dllibVersion = "2.042"; + +function identify() { + // used for identifying a digilib instance + // Relato uses that function - lugi + return digilibVersion; +} + +function createMarkDiv(index) { + var div = document.createElement("div"); + div.className = "mark"; + div.id = "mark" + index; + div.innerHTML = index + 1; + document.body.appendChild(div); + return div; +} + +function bestPicSize(elem, inset) { + // returns a Size with the best image size for the given element + if (! defined(inset)) { + inset = 0; + // original value was 25 + // digilib seems to use the available space better without inset + } + var ws = getWinSize(); + var es = getElementPosition(elem); + if (es) { + ws.width = ws.width - es.x - inset; + ws.height = ws.height - es.y - inset; + } + return ws; +} + + +/**************************************************** + * digilib specific classes (must be defined first) + ****************************************************/ + +/* + * Marks class + */ +function Marks() { + return this; +} +// Marks inherits from Array +Marks.prototype = new Array(); +Marks.prototype.parse = function(query) { + this.length = 0; + if (query.indexOf(";") >= 0) { + var pa = query.split(";"); // old format with ";" + } else { + var pa = query.split(","); // new format + } + for (var i = 0; i < pa.length ; i++) { + var pos = pa[i].split("/"); + if (pos.length > 1) this.push(new Position(pos[0], pos[1])); + } +} +Marks.prototype.getAll = function() { + var ma = new Array(); + for (var i = 0; i < this.length; i++) { + ma.push(cropFloat(this[i].x) + "/" + cropFloat(this[i].y)); + } + return ma.join(","); +} +Marks.prototype.addEvent = function(evt, digilib) { + // add a mark from a screen event + if (!digilib) digilib = dl; + var pos = digilib.trafo.invtransform(evtPosition(evt)); + this.push(pos); +} + +/* + * DLParameters -- digilib parameter class + */ +function DLParameters() { + // flags for parameter sets + this.PARAM_FILE = 1; + this.PARAM_MODE = 2; + this.PARAM_DIM = 4; + this.PARAM_IMAGE = 8; + this.PARAM_DPI = 16; + this.PARAM_SIZE = 32; + this.PARAM_MARK = 64; + this.PARAM_PAGES = 128; + this.PARAM_CLIENT = 256; + /* request parameters */ + with (this) { + // file + define('fn', '', PARAM_FILE); + define('pn', '1', PARAM_FILE); + // mode + define('mo', '', PARAM_MODE); + // relative dimensions of zoomed image + define('wx', '0.0', PARAM_DIM); + define('wy', '0.0', PARAM_DIM); + define('ww', '1.0', PARAM_DIM); + define('wh', '1.0', PARAM_DIM); + // image manipulation + define('brgt', '0.0', PARAM_IMAGE); + define('cont', '0.0', PARAM_IMAGE); + define('rot', '0.0', PARAM_IMAGE); + define('rgba', '', PARAM_IMAGE); + define('rgbm', '', PARAM_IMAGE); + // resolution + define('ddpi', '', PARAM_DPI); + define('ddpix', '', PARAM_DPI); + define('ddpiy', '', PARAM_DPI); + // marks + define('mk', '', PARAM_MARK); + // pages total + define('pt', '0', PARAM_PAGES); + // size + define('ws', '1.0', PARAM_SIZE); + // client side options + define('clop', '', PARAM_CLIENT); + } + return this; +} +DLParameters.prototype = new Parameters(); +// move the inherited getAll because we need it later +DLParameters.prototype._getAll = Parameters.prototype.getAll; +DLParameters.prototype.getAll = function(paDetail, moDetail, digilib) { + if (!digilib) digilib = dl; + // get Flags and Marks first + var mo = digilib.flags.getAll(moDetail); + this.set("mo", mo); + var clop = digilib.opts.getAll(); + this.set("clop", clop); + var mk = digilib.marks.getAll(); + this.set("mk", mk); + var ret = this._getAll(paDetail); + return ret; +} + +/* + * DLModes -- digilib flags class + */ +function DLFlags() { + // flags for mode sets + this.MODE_QUAL = 1; + this.MODE_SIZE = 2; + this.MODE_MIR = 4; + this.MODE_OTHER = 128; + this.MODE_ALL = 255; + /* mode flags */ + with (this) { + define('q0', MODE_QUAL); + define('q1', MODE_QUAL); + define('q2', MODE_QUAL); + define('fit', MODE_SIZE); + define('clip', MODE_SIZE); + define('osize', MODE_SIZE); + define('vmir', MODE_MIR); + define('hmir', MODE_MIR); + } + return this; +} +// inherits from Flags +DLFlags.prototype = new Flags(); + + +/* + * Digilib -- digilib base class + */ +function Digilib() { + if (!baseLibVersion) alert("ERROR: baselib.js not loaded!"); + /* constants */ + this.MAX_AREA = new Rectangle(0.0, 0.0, 1.0, 1.0); + // default inset (for scalerImg relativ to scalerDiv + this.INSET = 40; // because of scrollbars of main window and scaler [Firefox bug?] + // mouse drag area that counts as one click + this.MIN_AREA_SIZE = 3 * 3 + 1; + // standard zoom factor + this.ZOOMFACTOR = Math.sqrt(2); + // bird's eye view dimensions + this.BIRD_MAXX = 200; + this.BIRD_MAXY = 200; + // witdh of arrow bars + this.ARROW_WIDTH = 32; + // width of calibration bar + this.CALIBRATION_WIDTH = 64; + /* variables */ + this.fitOnlyWidth = false; + this.fitOnlyHeight = false; + this.trafo = null; + // page elements + this.scalerDiv = null; + this.scalerImg = null; + this.buttons1Div = null; + this.buttons2Div = null; + /* parse parameters */ + this.params = new DLParameters(); + // put the query parameters (sans "?") in the parameters array + this.params.parse(location.search.slice(1)); + // treat special parameters + this.area = this.parseArea(); + this.marks = new Marks(); + this.marks.parse(this.params.get("mk")); + this.flags = new DLFlags(); + this.flags.parse(this.params.get("mo")); + this.opts = new Flags(); + this.opts.parse(this.params.get("clop")); + return this; +} +Digilib.prototype.setDLParam = function(e, s, relative) { + // sets parameter based on HTML event + var nam; + var val; + if (s.type && (s.type == "select-one")) { + nam = s.name; + val = s.options[s.selectedIndex].value; + } else if (s.name && s.value) { + nam = s.name; + val = s.value; + } + if (nam && val) { + dl.params.set(nam, val, relative); + display(); + } else { + alert("ERROR: unable to process event!"); + } + return true; +} +Digilib.prototype.parseArea = function() { + // returns area Rectangle from current parameters + return new Rectangle( + this.params.get("wx"), + this.params.get("wy"), + this.params.get("ww"), + this.params.get("wh")); +} +Digilib.prototype.setParamFromArea = function(rect) { + // sets digilib wx etc. from rect + this.params.set("wx", cropFloat(rect.x)); + this.params.set("wy", cropFloat(rect.y)); + this.params.set("ww", cropFloat(rect.width)); + this.params.set("wh", cropFloat(rect.height)); + return true; +} + +Digilib.prototype.parseTrafo = function(elem) { + // returns Transform from current dlArea and picsize + var picsize = getElementRect(elem); + var trafo = new Transform(); + // subtract area offset and size + trafo.concat(trafo.getTranslation(new Position(-this.area.x, -this.area.y))); + trafo.concat(trafo.getScale(new Size(1/this.area.width, 1/this.area.height))); + // scale to screen size + trafo.concat(trafo.getScale(picsize)); + trafo.concat(trafo.getTranslation(picsize)); + // FIX ME: Robert, kannst Du mal nachsehen, ob das folgende tut, was es soll? + // oder gibt es dafuer neuen Code? -- ROC: Bisher funktioniert es nicht! + // rotate + //var rot = getRotation(- dl.params.get("rot"), new Position(0.5*picsize.width, 0.5*picsize.height)); + //trafo.concat(rot); + // mirror + //if (hasFlag("hmir")) trafo.m00 = - trafo.m00; // ?? + //if (hasFlag("vmir")) trafo.m11 = - trafo.m11; // ?? + return trafo; +} + +Digilib.prototype.onLoad = function() { + // initialize digilib; called by body.onload + this.scalerDiv = getElement("scaler", true); + this.scalerImg = getElement("pic", true); + this.buttons1Div = getElement("buttons", true); + this.buttons2Div = getElement("options", true); + /* + * if (this.scalerImg == null && this.scalerDiv) { // in N4 pic is in the + * scaler layer this.scalerImg = this.scalerDiv.document.images[0]; } + */ + if ((!this.scalerImg)||(!this.scalerDiv)) { + alert("Sorry, digilib doesn't work here!"); + return false; + } + // fix fixed menus + var ms1 = getElementSize(this.buttons1Div); + var ms2 = getElementSize(this.buttons2Div); + var maxh = (ms1.height > ms2.height) ? ms1.height : ms2.height; + var wins = getWinSize(); + if ((wins.height <= maxh) || (browserType.isIE && (browserType.versIE < 7))) { + // unlock fixed menus to absolute if window is too small or IE + this.buttons1Div.style.position = "absolute"; + this.buttons2Div.style.position = "absolute"; + } + this.setScalerImage(); // setzt auch onImgLoad + this.setBirdImage(); // laedt das Bird's Eye Bild +} + +Digilib.prototype.setScalerImage = function() { + // set the scaler image source (needs the browser size) + var picsize = bestPicSize(this.scalerDiv); + var menusize = getElementSize(this.buttons1Div); + // subtract menu width + picsize.width -= menusize.width; + picsize.height -= this.INSET; + // compose Scaler URL + var src = "../servlet/Scaler?" + + this.params.getAll(this.params.PARAM_ALL & ~(this.params.PARAM_MARK | this.params.PARAM_PAGES)); + if (this.opts.get('fitwidth')) { + src += "&dw=" + picsize.width; + } else if (this.opts.get('fitheight')) { + src += "&dh=" + picsize.height; + } else { + src += "&dw=" + picsize.width + "&dh=" + picsize.height; + } + // debug(src); + this.scalerImg.onload = onImgLoad; + this.scalerImg.src = src; + + var digilib = this; + // this is a local callback function that can use the current scope + + function onImgLoad() { + if (! digilib) + return; + // make sure the image is loaded so we know its size + /* this test seems to have problems sometimes :-( + if (defined(digilib.scalerImg.complete) && !digilib.scalerImg.complete) { + alert("ERROR: the image seems not to be complete in onImgLoad!?"); + } */ + digilib.trafo = digilib.parseTrafo(digilib.scalerImg); + // display marks + digilib.renderMarks(); + digilib.showBirdDiv(isBirdDivVisible); + digilib.showArrows(); // show arrow overlays for zoom navigation + //digilib.moveCenter(true); // click to move point to center + // new Slider("sizes", 1, 5, 2); + + //Drag Image (8.9.2009) + if (!digilib.isFullArea()) + registerEvent("mousedown", digilib.scalerDiv, dragImage); + + focus(); + } +} + +Digilib.prototype.renderMarks = function() { + // make sure the image is loaded so we know its size + if (!this.trafo) { + alert("ERROR: trafo missing, cannot render marks!"); + return; + } + // debugProps(dlArea, "dlArea"); + for (var i = 0; i < this.marks.length; i++) { + var div = getElement("mark" + i, true) || createMarkDiv(i); + var mark = this.marks[i]; + // debugProps(mark, "mark"); + if (this.area.containsPosition(mark)) { + var mpos = this.trafo.transform(mark); + // debugProps(mark, "mpos"); + // better not hide the marked spot (MR) + // suboptimal to place -5 pixels and not half size of mark-image + // mpos.x = mpos.x -5; + // mpos.y = mpos.y -5; + moveElement(div, mpos); + showElement(div, true); + } else { + // hide the other marks + showElement(div, false); + } + } +} + +Digilib.prototype.display = function(detail, moDetail) { + // redisplay the page + var queryString = this.params.getAll(detail, moDetail); + location.href + = location.protocol + "//" + + location.host + + location.pathname + + "?" + queryString; +} + +/* ********************************************** + * interactive digilib functions + * ******************************************** */ + +Digilib.prototype.setMark = function() { + // add a mark where clicked + window.focus(); + this.moveCenter(false); + + // start event capturing + registerEvent("mousedown", this.scalerDiv, markEvent); + + // our own reference to this for the local function + var digilib = this; + + function markEvent(evt) { + // event handler adding a new mark + unregisterEvent("mousedown", digilib.scalerDiv, markEvent); + digilib.marks.addEvent(evt); + digilib.display(); + return stopEvent(evt); + } + +} + +Digilib.prototype.removeMark = function() { + // remove the last mark + this.marks.pop(); + this.display(); +} + +Digilib.prototype.resetImage = function() { + // reset the image to its original state + this.display(this.params.PARAM_FILE); // keep only fn/pn +} + +Digilib.prototype.dragImage = function(evt) { + // drag the image and load a new detail on mouse up + // makes sense only when zoomed + if (this.isFullArea()) + return; + if(evt.preventDefault) evt.preventDefault(); // no Firefox drag and drop + var digilib = this; // our own reference to this for the local function + var startPos = evtPosition(evt); + var pic = this.scalerImg; + var picRect = getElementRect(pic); + // fit the grey div to the scaler image + var div = getElement("bg"); + var dx = 0; + var dy = 0; + moveElement(div, picRect); + // hide the scaler image, show it as background of div instead + showElement(pic, false); + showElement(div, true); + div.style.backgroundImage = "url(" + pic.src + ")"; + div.style.cursor = "move"; + // start event capturing + registerEvent("mousemove", document, moveDragEvent); + registerEvent("mouseup", document, moveEndEvent); + window.focus(); + + function moveDragEvent(evt) { + // mousemove handler: drag + var pos = evtPosition(evt); + // don't use Firefox Drag and Drop feature + if(evt.preventDefault) evt.preventDefault(); + dx = pos.x - startPos.x; + dy = pos.y - startPos.y; + // move the background image to the new position + div.style.backgroundPosition = dx + "px " + dy + "px"; + return stopEvent(evt); + } + + function moveEndEvent(evt) { + // mouseup handler: reload digilib + div.style.cursor = "default"; + unregisterEvent("mousemove", document, moveDragEvent); + unregisterEvent("mouseup", document, moveEndEvent); + // calculate relative offset + var x = -dx / pic.width; + var y = -dy / pic.height; + stopEvent(evt); + if (dx == 0 && dy == 0) + return // no movement + // reload with scaler image showing the new ausschnitt + return digilib.moveBy(x, y); + } +} + +Digilib.prototype.zoomArea = function() { + var pt1, pt2; + var zoomdiv = getElement("zoom"); + var overlay = getElement("overlay"); + // use overlay div to avoid mousemove problems + var picRect = getElementRect(this.scalerImg); + // FIX ME: is there a way to query the border width from CSS info? + // rect.x -= 2; // account for overlay borders + // rect.y -= 2; + moveElement(overlay, picRect); + showElement(overlay, true); + // start event capturing + registerEvent("mousedown", overlay, zoomStart); + registerEvent("mousedown", this.scalerImg, zoomStart); + window.focus(); + + // our own reference to "this" for the local functions + var digilib = this; + + // mousedown handler: start moving + function zoomStart(evt) { + pt1 = evtPosition(evt); + unregisterEvent("mousedown", overlay, zoomStart); + unregisterEvent("mousedown", digilib.scalerImg, zoomStart); + // setup and show zoom div + moveElement(zoomdiv, Rectangle(pt1.x, pt1.y, 0, 0)); + showElement(zoomdiv, true); + // register events + registerEvent("mousemove", document, zoomMove); + registerEvent("mouseup", document, zoomEnd); + return stopEvent(evt); + } + + // mouseup handler: end moving + function zoomEnd(evt) { + pt2 = evtPosition(evt); + // assume a click if the area is too small (up to 3 x 3 pixel) + var clickRect = new Rectangle(pt1, pt2); + clickRect.normalize(); + if (clickRect.getArea() <= digilib.MIN_AREA_SIZE) { + return stopEvent(evt); + } + // hide zoom div + showElement(zoomdiv, false); + showElement(overlay, false); + // unregister events + unregisterEvent("mousemove", document, zoomMove); + unregisterEvent("mouseup", document, zoomEnd); + // clip and transform + clickRect.clipTo(picRect); + var area = digilib.trafo.invtransform(clickRect); + digilib.setParamFromArea(area); + // zoomed is always fit + digilib.params.set("ws", 1); + digilib.display(); + return stopEvent(evt); + } + + // mouse move handler + function zoomMove(evt) { + pt2 = evtPosition(evt); + var rect = new Rectangle(pt1, pt2); + rect.normalize(); + rect.clipTo(picRect); + // update zoom div + moveElement(zoomdiv, rect); + return stopEvent(evt); + } +} + +Digilib.prototype.zoomBy = function(factor) { + // zooms by the given factor + var newarea = this.area.copy(); + newarea.width /= factor; + newarea.height /= factor; + newarea.x -= 0.5 * (newarea.width - this.area.width); + newarea.y -= 0.5 * (newarea.height - this.area.height); + newarea = this.MAX_AREA.fit(newarea); + this.setParamFromArea(newarea); + this.display(); +} + + +Digilib.prototype.zoomFullpage = function(fit) { + // zooms out to show the whole image + this.params.set("wx", 0.0); + this.params.set("wy", 0.0); + this.params.set("ww", 1.0); + this.params.set("wh", 1.0); + if (fit == "width") { + this.opts.set('fitwidth'); + } else if (fit == "height") { + this.opts.set('fitheight'); + } else { + this.opts.reset('fitwidth'); + this.opts.reset('fitheight'); + } + this.display(); +} + + +Digilib.prototype.moveCenter = function(on) { + // move visible area so that it's centered around the clicked point + if (this.isFullArea()) return; // nothing to do + // starting event capture + if (on) registerEvent("mousedown", this.scalerImg, moveCenterEvent); + else unregisterEvent("mousedown", this.scalerImg, moveCenterEvent); + window.focus(); + + // our own reference to this for the local function + var digilib = this; + + function moveCenterEvent(evt) { + // move to handler + var pt = digilib.trafo.invtransform(evtPosition(evt)); + var newarea = digilib.area.copy(); + newarea.setCenter(pt); + newarea.stayInside(this.MAX_AREA); + // newarea = dlMaxArea.fit(newarea); + // debugProps(newarea, "newarea"); + // debugProps(dlArea, "dlArea"); + if (newarea.equals(digilib.area)) return; // keep event handler + unregisterEvent("mousedown", digilib.scalerImg, moveCenterEvent); + // set parameters + digilib.setParamFromArea(newarea); + digilib.display(); + } +} + +Digilib.prototype.isFullArea = function(area) { + if (!area) area = this.area; + return (area.width == 1.0) && (area.height == 1.0); +} + +Digilib.prototype.canMove = function(movx, movy) { + if (this.isFullArea()) return false; + var x2 = this.area.x + this.area.width; + var y2 = this.area.y + this.area.height; + // debugProps(dlArea); + return ((movx < 0) && (this.area.x > 0)) + || ((movx > 0) && (x2 < 1.0)) + || ((movy < 0) && (this.area.y > 0)) + || ((movy > 0) && (y2 < 1.0)) +} + +Digilib.prototype.moveBy = function(movx, movy) { + // move visible area by movx and movy (in units of ww, wh) + if (!this.canMove(movx, movy)) return; // nothing to do + var newarea = this.area.copy(); + newarea.x += parseFloat(movx)*this.area.width; + newarea.y += parseFloat(movy)*this.area.height; + newarea = this.MAX_AREA.fit(newarea); + // set parameters + this.setParamFromArea(newarea); + this.display(); +} + +Digilib.prototype.getRef = function(baseUrl) { + // returns a reference to the current digilib set + if (!baseUrl) baseUrl + = location.protocol + + "//" + + location.host + + location.pathname; + var hyperlinkRef = baseUrl; + with (this.params) { + // all without ddpi, pt + var ps = getAll(PARAM_ALL & ~(PARAM_DPI | PARAM_PAGES | PARAM_CLIENT)); + } + if (ps.length > 0) hyperlinkRef += "?" + ps; + return hyperlinkRef; +} + +Digilib.prototype.getRefWin = function(type, msg) { + // shows an alert with a reference to the current digilib set + if (! msg) msg = "URL reference to the current view"; + prompt(msg, this.getRef()); +} + +Digilib.prototype.getQuality = function() { + // returns the current q setting + for (var i = 0; i < 3; i++) { + if (this.flags.get("q"+i)) return i; + } + return 1 +} + +Digilib.prototype.setQuality = function(qual) { + // set the image quality + if ((qual < 0)||(qual > 2)) return alert("Quality setting not supported"); + for (var i = 0; i < 3; i++) this.flags.reset("q" + i); + this.flags.set("q" + qual); + this.display(); +} + +Digilib.prototype.setQualityWin = function(msg) { + // dialog for setting quality + if (! msg) msg = "Quality (0..2)"; + var q = this.getQuality(); + var newq = window.prompt(msg, q); + if (newq) this.setQuality(newq); +} + +Digilib.prototype.mirror = function(dir) { + // mirror the image horizontally or vertically + if (dir == "h") { + this.flags.toggle("hmir"); + } else { + this.flags.toggle("vmir"); + } + this.display(); +} + +Digilib.prototype.gotoPage = function(gopage, keep) { + // goto given page nr (+/-: relative) + var oldpn = parseInt(this.params.get("pn")); + // set with relative=true uses the sign + this.params.set("pn", gopage, true); + // now check the outcome + var pn = parseInt(this.params.get("pn")); + if (pn < 1) { + alert("No such page! (Page number too low)"); + this.params.set("pn", oldpn); + return; + } + if (this.params.isSet("pt")) { + pt = parseInt(this.params.get("pt")) + if (pn > pt) { + alert("No such page! (Page number too high)"); + this.params.set("pn", oldpn); + return; + } + } + if (keep) { + this.display(this.params.PARAM_ALL & ~this.params.PARAM_MARK); // all, no mark + } else { + this.display(this.params.PARAM_FILE | this.params.PARAM_MODE | this.params.PARAM_PAGES, this.params.MODE_QUAL | this.params.MODE_OTHER); // fn, pn, ws, mo + pt + } +} + +Digilib.prototype.gotoPageWin = function() { + // dialog to ask for new page nr + var pn = this.params.get("pn"); + var gopage = window.prompt("Go to page", pn); + if (gopage) this.gotoPage(gopage); +} + +Digilib.prototype.setParamWin = function(param, text, relative) { + // dialog to ask for new parameter value + var val = this.params.get(param); + var newval = window.prompt(text, val); + if (newval) { + this.params.set(param, newval, relative); + this.display(); + } +} + +Digilib.prototype.showOptions = function(show) { + // show or hide option div + var elem = getElement("dloptions"); + showElement(elem, show); + // FIX ME: get rid of the dotted line around the buttons when focused + } + +Digilib.prototype.showAboutDiv = function(show) { + // show or hide "about" div + var elem = getElement("about"); + if (elem == null) { + if (show) alert("About Digilib - dialog missing in HTML code!" + + "\nDigilib Version: " + digilibVersion + + "\JSP Version: " + jspVersion + + "\ndlLib Version: " + dllibVersion + + "\nbaseLib Version: " + baseLibVersion); + return; + } + if (show) { + getElement("digilib-version").innerHTML = "Digilib Version: " + digilibVersion; + getElement("jsp-version").innerHTML = "JSP Version: " + jspVersion; + getElement("baselib-version").innerHTML = "baseLib Version: " + baseLibVersion; + getElement("dllib-version").innerHTML = "dlLib Version: " + dllibVersion; + var aboutRect = getElementRect(elem); + aboutRect.setCenter(getWinRect().getCenter()); + moveElement(elem, aboutRect); + } + showElement(elem, show); + } + +Digilib.prototype.setBirdImage = function() { + var img = getElement("bird-image"); + var src = "../servlet/Scaler?" + + this.params.getAll(this.params.PARAM_FILE) + + "&dw=" + this.BIRD_MAXX + + "&dh=" + this.BIRD_MAXY; + img.src = src; +} + +Digilib.prototype.showBirdDiv = function(show) { + // show or hide "bird's eye" div + var startPos; // anchor for dragging + var newRect; // position after drag + var birdImg = getElement("bird-image"); + var birdArea = getElement("bird-area"); + var overlay = getElement("bird-overlay"); + showElement(birdImg, show); + // dont show selector if area has full size + if (!show || this.isFullArea()) { + // hide area + showElement(birdArea, false); + showElement(overlay, false); + return; + }; + var birdImgRect = getElementRect(birdImg); + var area = this.area; + if (this.flags.get("osize") || this.flags.get("clip")) { + // in original-size and pixel-by-pixel mode the area size is not valid + var birdAreaRect = new Rectangle( + birdImgRect.x + birdImgRect.width * area.x, + birdImgRect.y + birdImgRect.height * area.y, + 5, + 5); + } else { + // scale area down to img size + var birdAreaRect = new Rectangle( + // what about borders ?? + birdImgRect.x + birdImgRect.width * area.x, + birdImgRect.y + birdImgRect.height * area.y, + birdImgRect.width * area.width, + birdImgRect.height * area.height); + } + moveElement(birdArea, birdAreaRect); + showElement(birdArea, true); + moveElement(overlay, birdImgRect); + showElement(overlay, true); + registerEvent("mousedown", overlay, birdAreaStartDrag); + registerEvent("mousedown", birdImg, birdAreaStartDrag); + + // our own reference to this for local functions + var digilib = this; + + function birdAreaStartDrag(evt) { + // mousedown handler: start drag + startPos = evtPosition(evt); + unregisterEvent("mousedown", overlay, birdAreaStartDrag); + unregisterEvent("mousedown", birdImg, birdAreaStartDrag); + registerEvent("mousemove", document, birdAreaMove); + registerEvent("mouseup", document, birdAreaEndDrag); + // debugProps(getElementRect(bird)) + return stopEvent(evt); + } + + function birdAreaMove(evt) { + // mousemove handler: drag + var pos = evtPosition(evt); + var dx = pos.x - startPos.x; + var dy = pos.y - startPos.y; + // move birdArea div, keeping size + newRect = new Rectangle( + birdAreaRect.x + dx, + birdAreaRect.y + dy, + birdAreaRect.width, + birdAreaRect.height); + // stay within image + newRect.stayInside(birdImgRect); + moveElement(birdArea, newRect); + showElement(birdArea, true); + return stopEvent(evt); + } + + function birdAreaEndDrag(evt) { + // mouseup handler: reload page + unregisterEvent("mousemove", document, birdAreaMove); + unregisterEvent("mouseup", document, birdAreaEndDrag); + showElement(overlay, false); + if (newRect == null) { // no movement happened + startPos = birdAreaRect.getCenter(); + birdAreaMove(evt); // set center to click position + } + digilib.params.set("wx", cropFloat((newRect.x - birdImgRect.x) / birdImgRect.width)); + digilib.params.set("wy", cropFloat((newRect.y - birdImgRect.y) / birdImgRect.height)); + // zoomed is always fit + digilib.params.set("ws", 1); + digilib.display(); + return stopEvent(evt); + } +} + +Digilib.prototype.showArrow = function(name, rect, show) { + var arrow = getElement(name); + moveElement(arrow, rect); + showElement(arrow, show); +} + +Digilib.prototype.showArrows = function() { + // show the 4 arrow bars on top of scaler img according to current dlArea + var r = getElementRect(this.scalerImg); + this.showArrow('up', + new Rectangle(r.x, r.y, r.width, this.ARROW_WIDTH), + this.canMove(0, -1) + ); + this.showArrow('down', + new Rectangle(r.x, r.y + r.height - this.ARROW_WIDTH, r.width, this.ARROW_WIDTH), + this.canMove(0, 1) + ); + this.showArrow('left', + new Rectangle(r.x, r.y, this.ARROW_WIDTH, r.height), + this.canMove(-1, 0) + ); + this.showArrow('right', + new Rectangle(r.x + r.width - this.ARROW_WIDTH, r.y, this.ARROW_WIDTH, r.height), + this.canMove(1, 0) + ); + } + +Digilib.prototype.calibrate = function() { + // calibrate screen resolution + var calDiv = getElement("calibration"); + var calRect = getElementRect(calDiv); + moveCenter(false); + var wins = getWinSize(); + calRect.setCenter(new Position(wins.width / 2, wins.height / 2)); + moveElement(calDiv, calRect); + showElement(calDiv, true); + var cm = window.prompt("The length of the scale on your screen in centimeter:"); + if (cm) { + var dpi = calRect.width / parseFloat(cm) * 2.54; + this.params.set("ddpi", cropFloat(dpi)); + } + showElement(calDiv, false); +} + + +Digilib.prototype.setScale = function(scale) { + // sets original-size, pixel-by-pixel or fit-to-screen scale type + if (scale == "pixel") { + // pixel by pixel + this.flags.set("clip"); + this.flags.reset("osize"); + this.flags.reset("fit"); + } else if (scale == "original") { + // original size -- needs calibrated screen + if (!this.params.isSet("ddpi")) { + var dpi = cookie.get("ddpi"); + if (dpi == null) { + alert("Your screen has not yet been calibrated - using default value of 72 dpi"); + dpi = 72; + } + this.params.set("ddpi", dpi); + } + this.flags.set("osize"); + this.flags.reset("clip"); + this.flags.reset("fit"); + } else { + // scale to screen size (default) + this.flags.reset("clip"); + this.flags.reset("osize"); + } + this.display(); +} + +Digilib.prototype.getScale = function() { + // returns scale type + if (this.flags.get("clip")) { + return "pixel"; + } else if (this.flags.get("osize")) { + return "original"; + } else { + return "fit"; + } +} + +Digilib.prototype.pageWidth = function() { + this.zoomFullpage('width'); +} + +Digilib.prototype.setSize = function(factor) { + this.params.set("ws", factor); + this.display(); +} + +Digilib.prototype.showMenu = function(menuId, buttonId, show) { + var menu = getElement(menuId); + if (show) { + // align right side of menu with button + var buttonPos = getElementPosition(getElement(buttonId)); + var menusize = getElementSize(menu); + moveElement(menu, new Position(buttonPos.x - menusize.width - 3, buttonPos.y)); + } + showElement(menu, show); +} + + +/******************************** + * global variables + ********************************/ + +var dl = new Digilib(); + +/* old parameter function compatibility stuff */ +function newParameter(a,b,c) {return dl.params.define(a,b,c)}; +function resetParameter(a) {return dl.params.reset(a)}; +function deleteParameter(a) {return dl.params.remove(a)}; +function getParameter(a) {return dl.params.get(a)}; +function setParameter(a,b,c) {return dl.params.set(a,b,c)}; +function hasParameter(a) {return dl.params.isSet(a)}; +function getAllParameters(a) {return dl.params.getAll(a)}; +getQueryString = getAllParameters; +function parseParameters(a) {return dl.params.parse(a)}; +function getAllMarks() {return dl.marks.getAll()}; +getMarksQueryString = getAllMarks; +function addMark(evt) {return dl.marks.addEvent(evt)}; +function deleteMark() {return dl.marks.pop()}; +function deleteAllMarks() {return dl.marks = new Marks()}; +function hasFlag(mode) {return dl.flags.get(mode)}; +function addFlag(mode) {return dl.flags.set(mode)}; +function removeFlag(mode) {return dl.flags.reset(mode)}; +function toggleFlag(mode) {return dl.flags.toggle(mode)}; +function getAllFlags() {return dl.flags.getAll()}; +/* old digilib function compatibility */ +function setDLParam(e, s, relative) {dl.setDLParam(e, s, relative)}; +function display(detail, moDetail) {dl.display(detail, moDetail)}; +function setMark(reload) {dl.setMark(reload)}; +function removeMark(reload) {dl.removeMark(reload)}; +function resetImage() {dl.resetImage()}; +function dragImage(evt) {dl.dragImage(evt)}; +function zoomArea() {dl.zoomArea()}; +function zoomBy(factor) {dl.zoomBy(factor)}; +function zoomFullpage(a) {dl.zoomFullpage(a)}; +function moveCenter(on) {dl.moveCenter(on)}; +function isFullArea(area) {dl.isFullArea(area)}; +function canMove(movx, movy) {dl.canMove(movx, movy)}; +function moveBy(movx, movy) {dl.moveBy(movx, movy)}; +function getRef(baseURL) {dl.getRef(baseURL)}; +function getRefWin(type, msg) {dl.getRefWin(type, msg)}; +function getQuality() {dl.getQuality()}; +function setQuality(qual) {dl.setQuality(qual)}; +function setQualityWin(msg) {dl.setQualityWin(msg)}; +function mirror(dir) {dl.mirror(dir)}; +function gotoPage(gopage, keep) {dl.gotoPage(gopage, keep)}; +function gotoPageWin() {dl.gotoPageWin()}; +function setParamWin(param, text, relative) {dl.setParamWin(param, text, relative)}; +function showOptions(show) {dl.showOptions(show)}; +function showBirdDiv(show) {dl.showBirdDiv(show)}; +function showAboutDiv(show) {dl.showAboutDiv(show)}; +function calibrate(direction) {dl.calibrate(direction)}; +function setScale(a) {dl.setScale(a)}; +function getScale(a) {dl.getScale(a)}; +function originalSize(on) {dl.originalSize(on)}; +function pixelByPixel(on) {dl.pixelByPixel(on)}; +function pageWidth() {dl.pageWidth()}; +function setSize(factor) {dl.setSize(factor)}; +function showMenu(a,b,c) {dl.showMenu(a,b,c)}; + + +// :tabSize=4:indentSize=4:noTabs=true: + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/down.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/down.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/down.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/down.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/first.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/first.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/first.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/first.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/firstlast.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/firstlast.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/fixed.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/fixed.js Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,354 @@ +// fixed.js: fix fixed positioning and fixed backgrounds in IE/Win +// version 1.8, 08-Aug-2003 +// written by Andrew Clover , use freely + +/*@cc_on +@if (@_win32 && @_jscript_version>4) + +var fixed_positions= new Array(); +var fixed_backgrounds= new Array(); +var fixed_viewport; + +// Initialisation. Called when the tag arrives. Set up viewport so the +// rest of the script knows we're going, and add a measurer div, used to detect +// font size changes and measure image sizes for backgrounds later + +function fixed_init() { + fixed_viewport= (document.compatMode=='CSS1Compat') ? + document.documentElement : document.body; + var el= document.createElement('div'); + el.setAttribute('id', 'fixed-measure'); + el.style.position= 'absolute'; + el.style.top= '0'; el.style.left= '0'; + el.style.overflow= 'hidden'; el.style.visibility= 'hidden'; + el.style.fontSize= 'xx-large'; el.style.height= '5em'; + el.style.setExpression('width', 'fixed_measureFont()'); + document.body.insertBefore(el, document.body.firstChild); +} + +// Binding. Called every time an element is added to the document, check it +// for fixed features, if found add to our lists and set initial props + +function fixed_bind(el) { + var needLayout= false; + var tag= el.tagName.toLowerCase(); + var st= el.style; + var cst= el.currentStyle; + var anc; + + // find fixed-position elements + if (cst.position=='fixed') { + needLayout= true; + fixed_positions[fixed_positions.length]= el; + // store original positioning as we'll overwrite it + st.position= 'absolute'; + st.fixedPLeft= cst.left; + st.fixedPTop= cst.top; + st.fixedPRight= cst.right; + st.fixedPBottom= cst.bottom; + st.fixedPWidth= fixed_parseLength(cst.width); + st.fixedPHeight= fixed_parseLength(cst.height); + // find element that will act as containing box, for convenience later + st.fixedCB= null; + for (anc= el; (anc= anc.parentElement).parentElement;) { + if (anc.currentStyle.position!='static') { + st.fixedCB= anc; + break; + } } + // detect nested fixed positioning (only ancestor need move) + st.fixedNest= false; + for (anc= el; anc= anc.parentElement;) { + if (anc.style.fixedNest!=null) + st.fixedNest= true; + break; + } + } + + // find fixed-background elements (not body/html which IE already gets right) + if (cst.backgroundAttachment=='fixed' && tag!='body' && tag!='html') { + needLayout= true; + fixed_backgrounds[fixed_backgrounds.length]= el; + // get background offset, converting from keyword if necessary + st.fixedBLeft= fixed_parseLength(cst.backgroundPositionX); + st.fixedBTop= fixed_parseLength(cst.backgroundPositionY); + // if it's a non-zero %age, need to know size of image for layout + if (st.fixedBLeft[1]=='%' || st.fixedBTop[1]=='%') { + st.fixedBWidth= 0; st.fixedBHeight= 0; + fixed_measureBack(el); + } + } + if (needLayout) fixed_layout(); +} + +// Layout. On every window or font size change, recalculate positioning + +// Request re-layout at next free moment +var fixed_delaying= false; +function fixed_delayout() { + if (fixed_delaying) return; + fixed_delaying= true; + window.setTimeout(fixed_layout, 0); +} + +var fixed_ARBITRARY= 200; + +function fixed_layout() { + fixed_delaying= false; + if (!fixed_viewport) return; + var i, el, st, j, pr, tmp, A= 'auto'; + var cb, cbLeft, cbTop, cbRight, cbBottom, oLeft, oTop, oRight, oBottom; + var vpWidth=fixed_viewport.clientWidth, vpHeight=fixed_viewport.clientHeight; + + // calculate initial position for fixed-position elements [black magic] + for (i= fixed_positions.length; i-->0;) { + el= fixed_positions[i]; st= el.style; + // find positioning of containing block + cb= st.fixedCB; if (!cb) cb= fixed_viewport; + cbLeft= fixed_pageLeft(cb); cbTop= fixed_pageTop(cb); + if (cb!=fixed_viewport) { cbLeft+= cb.clientLeft; cbTop+= cb.clientTop; } + cbRight= fixed_viewport.clientWidth-cbLeft-cb.clientWidth; + cbBottom= fixed_viewport.clientHeight-cbTop-cb.clientHeight; + // if size is in %, must recalculate relative to viewport + if (st.fixedPWidth[1]=='%') + st.width= Math.round(vpWidth*st.fixedPWidth[0]/100)+'px'; + if (st.fixedPHeight[1]=='%') + st.height= Math.round(vpHeight*st.fixedPHeight[0]/100)+'px'; + // find out offset values at max size, to account for margins + st.left= A; st.right= '0'; st.top= A; st.bottom= '0'; + oRight= el.offsetLeft+el.offsetWidth; oBottom= el.offsetTop+el.offsetHeight; + st.left= '0'; st.right= A; st.top= '0'; st.bottom= A; + oLeft= el.offsetLeft; oTop= el.offsetTop; + // use this to convert all edges to pixels + st.left= A; st.right= st.fixedPRight; + st.top= A; st.bottom= st.fixedPBottom; + oRight-= el.offsetLeft+el.offsetWidth; + oBottom-= el.offsetTop+el.offsetHeight; + st.left= st.fixedPLeft; st.top= st.fixedPTop; + oLeft= el.offsetLeft-oLeft; oTop= el.offsetTop-oTop; + // edge positioning fix + if (st.fixedPWidth[1]==A && st.fixedPLeft!=A && st.fixedPRight!=A) { + tmp= el.offsetLeft; st.left= A; st.width= fixed_ARBITRARY+'px'; + tmp= fixed_ARBITRARY+el.offsetLeft-tmp+cbLeft+cbRight; + st.left= st.fixedPLeft; st.width= ((tmp<1)?1:tmp)+'px'; + } + if (st.fixedPHeight[1]==A && st.fixedPTop!=A && st.fixedPBottom!=A) { + tmp= el.offsetTop; st.top= A; st.height= fixed_ARBITRARY+'px'; + tmp= fixed_ARBITRARY+el.offsetTop-tmp+cbTop+cbBottom; + st.top= st.fixedPTop; st.height= ((tmp<1)?1:tmp)+'px'; + } + // move all non-auto edges relative to the viewport + st.fixedCLeft= (st.fixedPLeft=='auto') ? oLeft : oLeft-cbLeft; + st.fixedCTop= (st.fixedPTop=='auto') ? oTop : oTop-cbTop; + st.fixedCRight= (st.fixedPRight=='auto') ? oRight : oRight-cbRight; + st.fixedCBottom= (st.fixedPBottom=='auto') ? oBottom : oBottom-cbBottom; + // remove left-positioning of right-positioned elements + if (st.fixedPLeft=='auto' && st.fixedPRight!='auto') st.fixedCLeft= 'auto'; + if (st.fixedPTop=='auto' && st.fixedPBottom!='auto') st.fixedCTop= 'auto'; + } + + + // calculate initial positioning of fixed backgrounds + for (i= fixed_backgrounds.length; i-->0;) { + el= fixed_backgrounds[i]; st= el.style; + tmp= st.fixedBImage; + if (tmp) { + if (tmp.readyState!='uninitialized') { + st.fixedBWidth= tmp.offsetWidth; + st.fixedBHeight= tmp.offsetHeight; + st.fixedBImage= window.undefined; + } + } + st.fixedBX= fixed_length(el, st.fixedBLeft, vpWidth-st.fixedBWidth); + st.fixedBY= fixed_length(el, st.fixedBTop, vpHeight-st.fixedBHeight); + } + + // now call scroll() to set the positions from the values just calculated + fixed_scroll(); +} + +// Scrolling. Offset fixed elements relative to viewport scrollness + +var fixed_lastX, fixed_lastY; +var fixed_PATCHDELAY= 300; +var fixed_patching= false; + +// callback function after a scroll, because incorrect scroll position is +// often reported first go! +function fixed_patch() { + fixed_patching= false; + var scrollX= fixed_viewport.scrollLeft, scrollY= fixed_viewport.scrollTop; + if (scrollX!=fixed_lastX && scrollY!=fixed_lastY) fixed_scroll(); +} + +function fixed_scroll() { + if (!fixed_viewport) return; + var i, el, st, viewportX, viewportY; + var scrollX= fixed_viewport.scrollLeft, scrollY= fixed_viewport.scrollTop; + fixed_lastX= scrollX; fixed_lastY= scrollY; + + // move non-nested fixed-position elements + for (i= fixed_positions.length; i-->0;) { + st= fixed_positions[i].style; + viewportX= (st.fixedNest) ? 0 : scrollX; + viewportY= (st.fixedNest) ? 0 : scrollY; + if (st.fixedCLeft!='auto') st.left= (st.fixedCLeft+viewportX)+'px'; + if (st.fixedCTop!='auto') st.top= (st.fixedCTop+viewportY)+'px'; + viewportX= (st.fixedCB==null || st.fixedCB==fixed_viewport) ? 0 : viewportX; + viewportY= (st.fixedCB==null || st.fixedCB==fixed_viewport) ? 0 : viewportY; + st.right= (st.fixedCRight-viewportX+1)+'px'; st.right= (st.fixedCRight-viewportX)+'px'; + st.bottom= (st.fixedCBottom-viewportY+1)+'px'; st.bottom= (st.fixedCBottom-viewportY)+'px'; + } + + // align fixed backgrounds to viewport + for (i= fixed_backgrounds.length; i-->0;) { + el= fixed_backgrounds[i]; st= el.style; + viewportX= scrollX; + viewportY= scrollY; + while (el.offsetParent) { + viewportX-= el.offsetLeft+el.clientLeft; + viewportY-= el.offsetTop +el.clientTop; + el= el.offsetParent; + } + st.backgroundPositionX= (st.fixedBX+viewportX)+'px'; + st.backgroundPositionY= (st.fixedBY+viewportY)+'px'; + } + + // call back again in a tic + if (!fixed_patching) { + fixed_patching= true; + window.setTimeout(fixed_patch, fixed_PATCHDELAY); + } +} + +// Measurement. Load bg-image into an invisible element on the page, when +// loaded write the width/height to an element's style for layout use; detect +// when font size changes + +function fixed_measureBack(el) { + var measure= document.getElementById('fixed-measure'); + var img= document.createElement('img'); + img.setAttribute('src', fixed_parseURL(el.currentStyle.backgroundImage)); + measure.appendChild(img); + el.style.fixedBImage= img; + if (img.readyState=='uninitialized') + img.attachEvent('onreadystatechange', fixed_measureBackImage_ready); +} + +function fixed_measureBackImage_ready() { + var img= event.srcElement; + if (img && img.readyState!='uninitialized') { + img.detachEvent('onreadystatechange', fixed_measureBackImage_ready); + fixed_layout(); + } +} + +var fixed_fontsize= 0; +function fixed_measureFont() { + var fs= document.getElementById('fixed-measure').offsetHeight; + if (fixed_fontsize!=fs && fixed_fontsize!=0) + fixed_delayout(); + fixed_fontsize= fs; + return '5em'; +} + +// Utility. General-purpose functions + +// parse url() to get value inside + +function fixed_parseURL(v) { + v= v.substring(4, v.length-1); + if (v.charAt(0)=='"' && v.charAt(v.length-1)=='"' || + v.charAt(0)=="'" && v.charAt(v.length-1)=="'") + return v.substring(1, v.length-1); + else return v; +} + +// parse length or auto or background-position keyword into number and unit + +var fixed_numberChars= '+-0123456789.'; +var fixed_ZERO= new Array(0, 'px'); +var fixed_50PC= new Array(50, '%'); +var fixed_100PC= new Array(100, '%'); +var fixed_AUTO= new Array(0, 'auto'); + +function fixed_parseLength(v) { + var num, i; + if (v=='left' || v=='top') return fixed_ZERO; + if (v=='right' || v=='bottom') return fixed_100PC; + if (v=='center') return fixed_50PC; + if (v=='auto') return fixed_AUTO; + i= 0; + while (i arrives, then call main init. Pass any new elements +// found on each scan to be bound + +var fixed_SCANDELAY= 500; + +function fixed_scan() { + if (!document.body) return; + if (!fixed_viewport) fixed_init(); + var el; + for (var i= 0; i + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/help.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/help.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/help.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/help.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + ? + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/last.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/last.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/last.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/last.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/left.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/left.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/left.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/left.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark-bg-16.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark-bg-16.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark-bg.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark-bg.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark-bg.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark-bg.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark-bg_old.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark-bg_old.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mark.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + 1 + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-horizontal-on.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-horizontal-on.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-horizontal-on.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-horizontal-on.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-horizontal.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-horizontal.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-horizontal.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-horizontal.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-vertical-on.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-vertical-on.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-vertical-on.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-vertical-on.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-vertical.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-vertical.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-vertical.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-vertical.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/options.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/options.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/options.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/options.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/original-size.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/original-size.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/original-size.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/original-size.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + 1 + 1 + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/page.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/page.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/page.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/page.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/pagewidth.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/pagewidth.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/pagewidth.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/pagewidth.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/pixel-by-pixel.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/pixel-by-pixel.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/pixel-by-pixel.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/pixel-by-pixel.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/quality.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/quality.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/quality.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/quality.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + Q + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/reference.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/reference.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/reference.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/reference.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + http: + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/reset.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/reset.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/reset.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/reset.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rgb-on.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rgb-on.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rgb-on.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rgb-on.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rgb.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rgb.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rgb.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rgb.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/right.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/right.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/right.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/right.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rightleft.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rightleft.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate-on.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate-on.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate-on.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate-on.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/ruler-top.gif Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/ruler-top.gif has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/size.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/size.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/size.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/size.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/trans.gif Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/trans.gif has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/up.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/up.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/up.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/up.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-area.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-area.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-area.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-area.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-full.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-full.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-full.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-full.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-in.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-in.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-in.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-in.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-out.png Binary file src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-out.png has changed diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-out.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-out.svg Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/listener/SelectNavigationListener.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/listener/SelectNavigationListener.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,62 @@ +package de.mpg.mpiwg.itgroup.digilib.listener; + +import java.util.List; + +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiNav; +import de.mpg.mpiwg.itgroup.digilib.manipulator.IDigilibImageManipulator; +import de.mpg.mpiwg.itgroup.digilib.manipulator.DigilibImageManipulatorProvider; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + +public class SelectNavigationListener implements MouseListener { + + private String keyword; + private DigiImageController dc; + private Label label; + + public SelectNavigationListener(String keyword,DigiImageController dc, Label label) { + this.dc=dc; + this.keyword=keyword; + this.label=label; + + } + public void handleEvent(Event event) { + // TODO Auto-generated method stub + System.out.println(event); + } + + public void mouseDoubleClick(MouseEvent e) { + // TODO Auto-generated method stub + + } + + public void mouseDown(MouseEvent e) { + // TODO Auto-generated method stub + + } + + public void mouseUp(MouseEvent e) { + // TODO Auto-generated method stub + IDigilibImageManipulator action = (IDigilibImageManipulator)DigilibImageManipulatorProvider.INSTANCE.getManipulator(keyword); + + + action.run(dc); + + + this.label.setImage(action.createImage(label.getParent())); + + + + + } + + + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/DigilibImageManipulatorProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/DigilibImageManipulatorProvider.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,69 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; + +import org.eclipse.jface.viewers.CellEditor; + + + +/** + * This singleton class manages the property extensions. + * + * @author Julia Damerow + * + */ +public class DigilibImageManipulatorProvider { + + public static DigilibImageManipulatorProvider INSTANCE = new DigilibImageManipulatorProvider(); + + private List propertyExtensions; + private HashMap propertyExtensionsMap; + + + private DigilibImageManipulatorProvider() { + propertyExtensions = new ArrayList(); + propertyExtensionsMap = new HashMap(); + + IConfigurationElement[] configs = Platform.getExtensionRegistry().getConfigurationElementsFor("de.mpg.mpiwg.itgroup.digilib.plugin","DigilibImageManipulation"); + for (IConfigurationElement e : configs) + { + Object o = null; + try { + o = e.createExecutableExtension("class"); + + } catch (CoreException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + continue; + } + if (o != null) + { + IDigilibImageManipulator dim = (IDigilibImageManipulator)o; + propertyExtensions.add(dim); + propertyExtensionsMap.put(dim.getKeyword(), dim); + } + } + } + + /** + * Get all registered FieldEditorPreferencePages. + * @return a list with all registered FieldEditorPreferencePages + */ + public List getAllManipulators() + { + + return propertyExtensions; + } + + public IDigilibImageManipulator getManipulator(String keyword) { + return propertyExtensionsMap.get(keyword); + } + + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/IDigilibImageManipulator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/IDigilibImageManipulator.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,18 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; + +public interface IDigilibImageManipulator { + + + + public Image createImage(Composite parent); + public String getKeyword(); + public void run(DigiImageController dc); + + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ManipulatorExtension.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ManipulatorExtension.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,66 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + +import java.io.InputStream; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.manipulator.IDigilibImageManipulator; + +public abstract class ManipulatorExtension implements IDigilibImageManipulator { + + private String iconOff; + private String iconOn; + + private String imagePath; + private String keyword; + + + public String getKeyword() { + return keyword; + } + + + public void run(DigiImageController dc) {}; + + public void setImagePath(String ip) { + imagePath=ip; + + } + + public String getImagePath() { + return imagePath; + + } + + public void setKeyword(String keyword) { + this.keyword = keyword; + } + + public Image createImage(Composite parent) { + InputStream is = getClass().getResourceAsStream(getImagePath()); + Image img = new Image(parent.getDisplay(),is); + return img; + } + + public void toggleIcon(){ + if(imagePath.equals(iconOff)){ + setImagePath(iconOn); + } else { + setImagePath(iconOff); + } + } + + public void setOffIcon(){ + setImagePath(iconOff); + } + + public void setIconPaths(String iconOff, String iconOn) { + this.iconOff=iconOff; + this.iconOn=iconOn; + + } + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/MirrorHorizontal.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/MirrorHorizontal.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,34 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + +import org.eclipse.swt.SWT; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + + +public class MirrorHorizontal extends ManipulatorExtension { + + public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-horizontal.png"; + public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-horizontal-on.png"; + + + public MirrorHorizontal() { + setIconPaths(iconOff,iconOn); + setOffIcon(); + setKeyword("mirrorHorizontal"); + } + + + + + public void run(DigiImageController dc) { + + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_WAIT); + dc.hmir(); + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_ARROW); + toggleIcon(); + } + + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/MirrorVertical.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/MirrorVertical.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,34 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + +import org.eclipse.swt.SWT; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + + +public class MirrorVertical extends ManipulatorExtension{ + + public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-vertical.png"; + public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/mirror-vertical-on.png"; + + public MirrorVertical() { + setIconPaths(iconOff,iconOn); + setOffIcon(); + setKeyword("mirrorVertical"); + } + + + + public void run(DigiImageController dc) { + + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_WAIT); + dc.vmir(); + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_ARROW); + + toggleIcon(); + } + + + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/NextPage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/NextPage.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,43 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + + + + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageParameter; +import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.dialogs.RotateDialog; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + +public class NextPage extends ManipulatorExtension { + + public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/fwd.png"; + public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/fwd.png"; + + + public NextPage() { + setIconPaths(iconOff,iconOn); + setOffIcon(); + setKeyword("Forward"); + } + + public void run(final DigiImageController dc) { + + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_WAIT); + + dc.nextPage(); + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_ARROW); + + DigilibLinkEditorObservable.INSTANCE.imageHasChanged(dc.digiImage); + + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/PrevPage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/PrevPage.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,43 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + + + + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageParameter; +import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.dialogs.RotateDialog; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + +public class PrevPage extends ManipulatorExtension { + + public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/back.png"; + public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/back.png"; + + + public PrevPage() { + setIconPaths(iconOff,iconOn); + setOffIcon(); + setKeyword("PreviousPage"); + } + + public void run(final DigiImageController dc) { + + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_WAIT); + + dc.prevPage(); + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_ARROW); + + DigilibLinkEditorObservable.INSTANCE.imageHasChanged(dc.digiImage); + + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/RectangleListener.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/RectangleListener.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,94 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + + + + + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.graphics.Device; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + +public class RectangleListener implements MouseListener { + static int FIRST_CLICK=1; + static int SECOND_CLICK=2; + static int NO_CLICK=0; + int status=NO_CLICK; + private Label label; + private Point firstPoint; + private DigiImageController dc; + + + private RectangleListener() { + + } + + public RectangleListener(DigiImageController dc,Label label){ + this.label =label; + this.dc=dc; + } + public void reset(){ + status=0; + } + public void mouseDoubleClick(MouseEvent e) { + // TODO Auto-generated method stub + + } + + public void mouseDown(MouseEvent e) { + // TODO Auto-generated method stub + + } + + public void mouseUp(MouseEvent e) { + if (status==NO_CLICK){ + handleFirstClick(e); + } else if (status==FIRST_CLICK){ + handleSecondClick(e); + } + + } + + private void handleSecondClick(MouseEvent e) { + //Canvas canvas = new Canvas(label.getParent(),SWT.NO_BACKGROUND); + + GC gc = new GC(label.getImage()); + + gc.setForeground(new Color(label.getDisplay(),255,0,0)); + + gc.drawRectangle(firstPoint.x, firstPoint.y, e.x-firstPoint.x, e.y-firstPoint.y); + gc.dispose(); + label.redraw(); + status=SECOND_CLICK; + dc.zoomArea(firstPoint.x,firstPoint.y,e.x,e.y); + dc.digiImage.getLabel().removeMouseListener(this); + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_ARROW); + DigilibLinkEditorObservable.INSTANCE.imageHasChanged(dc.digiImage); + + } + + private void handleFirstClick(MouseEvent e) { + //Canvas canvas = new Canvas(label.getParent(),SWT.NO_BACKGROUND); + + GC gc = new GC(label.getImage()); + + gc.setForeground(new Color(label.getDisplay(),255,0,0)); + firstPoint = new Point(e.x,e.y); + gc.drawOval(e.x, e.y, 10, 10); + gc.dispose(); + status=FIRST_CLICK; + label.redraw(); + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_CROSS); + } + + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/Rotate.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/Rotate.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,61 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + + + +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.dialogs.RotateDialog; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + +public class Rotate extends ManipulatorExtension { + + public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate.png"; + public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate-on.png"; + + + public Rotate() { + setIconPaths(iconOff,iconOn); + setOffIcon(); + setKeyword("rotateHorizontal"); + } + + public void run(final DigiImageController dc) { + + //digiImage.hmir(); + //toggleIcon(); + + Listener buttonListener = new Listener() { + int rotateValue=0; + public void handleEvent(Event event) { + Widget wg = event.widget; + if (Button.class.isInstance(wg)){ + dc.rotate(rotateValue); + Shell sh = ((Button)wg).getShell(); + DigilibLinkEditorObservable.INSTANCE.imageHasChanged(dc.digiImage); + setOffIcon(); + sh.close(); + } else if (Text.class.isInstance(wg)) { + Text txt = (Text)wg; + if (txt.getText()!=null){ + String t = txt.getText(); + try{ + rotateValue=Integer.valueOf(t); + } catch (NumberFormatException e) { + // TODO: handle exception + } + } + } + } + }; + + RotateDialog rd = new RotateDialog(buttonListener,dc); + rd.open(); + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ScaleDown.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ScaleDown.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,40 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + + + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageParameter; +import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.dialogs.RotateDialog; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + +public class ScaleDown extends ManipulatorExtension { + + public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-out.png"; + public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-out.png"; + + + public ScaleDown() { + setIconPaths(iconOff,iconOn); + setOffIcon(); + setKeyword("scaleDown"); + } + + public void run(final DigiImageController dc) { + + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_WAIT); + + dc.scaleDown(); + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_ARROW); + DigilibLinkEditorObservable.INSTANCE.imageHasChanged(dc.digiImage); + + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ScaleUp.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ScaleUp.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,43 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + + + + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageParameter; +import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.dialogs.RotateDialog; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + +public class ScaleUp extends ManipulatorExtension { + + public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-in.png"; + public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-in.png"; + + + public ScaleUp() { + setIconPaths(iconOff,iconOn); + setOffIcon(); + setKeyword("ScaleUp"); + } + + public void run(final DigiImageController dc) { + + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_WAIT); + + dc.scaleUp(); + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_ARROW); + + DigilibLinkEditorObservable.INSTANCE.imageHasChanged(dc.digiImage); + + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ZoomArea.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ZoomArea.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,45 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Label; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + +public class ZoomArea extends ManipulatorExtension { + + public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-area.png"; + public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-area.png"; + + public ZoomArea() { + setIconPaths(iconOff,iconOn); + setOffIcon(); + setKeyword("zoomArea"); + } + + + + public void run(DigiImageController dc) { + + DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_HAND); + RectangleListener ml = dc.digiImage.getRectangleListener(); + Label label = dc.digiImage.getLabel(); + if (ml!=null){ + try { + label.removeMouseListener(ml); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + ml = new RectangleListener(dc,label); + dc.digiImage.setRectangleListener(ml); + } + ml.reset(); + label.addMouseListener(ml); + + + + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ZoomFull.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ZoomFull.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,36 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; + + + +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageParameter; +import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.dialogs.RotateDialog; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; + +public class ZoomFull extends ManipulatorExtension { + + public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-full.png"; + public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-full.png"; + + + public ZoomFull() { + setIconPaths(iconOff,iconOn); + setOffIcon(); + setKeyword("zoomFull"); + } + + public void run(final DigiImageController dc) { + + dc.zoomFull(); + DigilibLinkEditorObservable.INSTANCE.imageHasChanged(dc.digiImage); + + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/dialogs/RotateDialog.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/dialogs/RotateDialog.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,54 @@ +package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.dialogs; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; + +public class RotateDialog { + static boolean deleteFlag = false; + private Listener listener; + private Composite parent; + private String rotateValue; + + public RotateDialog(Listener listener,DigiImageController dc) { + this.listener=listener; + this.parent = dc.digiImage.getParent(); + this.rotateValue = String.valueOf(dc.digiImage + .getParameter().getRot()); + } + + public void open(){ + Shell shell = new Shell(parent.getDisplay()); + shell.setText("Rotate"); + shell.setSize(300, 200); + shell.open(); + + final Button button = new Button(shell, SWT.PUSH); + button.setText("Rotate"); + button.setBounds(20, 40, 80, 25); + + final Text text = new Text(shell, SWT.SHADOW_IN); + text.setBounds(140, 40, 100, 25); + text.setText(rotateValue); + + + + + + button.addListener(SWT.Selection, listener); + text.addListener(SWT.CHANGED, listener); + + + } + } + + + diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/plugin/Activator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/plugin/Activator.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,61 @@ +package de.mpg.mpiwg.itgroup.digilib.plugin; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "de.mpg.mpiwg.itgroup.diglib.plugin"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/plugin/DigilibHandler.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/plugin/DigilibHandler.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,66 @@ +package de.mpg.mpiwg.itgroup.digilib.plugin; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.handlers.HandlerUtil; + +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorInput; +import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorPart; + +public class DigilibHandler implements IHandler { + + public void addHandlerListener(IHandlerListener handlerListener) { + // TODO Auto-generated method stub + + } + + public void dispose() { + // TODO Auto-generated method stub + + } + + public Object execute(ExecutionEvent event) throws ExecutionException { + + ISelection currentSelection = HandlerUtil.getCurrentSelection(event); + if (IStructuredSelection.class.isInstance(currentSelection)) { + IStructuredSelection selection = (IStructuredSelection) currentSelection; + //TextGridObject object = AdapterUtils.getAdapter(selection.getFirstElement(), TextGridObject.class); + Object object = selection.getFirstElement(); + + //IFile file = (IFile) object.getAdapter(IFile.class); + IFile file = (IFile) object; + DigilibLinkEditorInput input = new DigilibLinkEditorInput(file,DigilibLinkEditorInput.INDEX_META); + + try { + DigilibLinkEditorPart dp = (DigilibLinkEditorPart) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().openEditor(input,"de.mpg.mpiwg.itgroup.digilib.plugin.digilibLinkEditor"); + return dp; + } catch (PartInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return null; + } + + public boolean isEnabled() { + + return true; + } + + public boolean isHandled() { + // TODO Auto-generated method stub + return true; + } + + public void removeHandlerListener(IHandlerListener handlerListener) { + // TODO Auto-generated method stub + + } + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorContributor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorContributor.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,103 @@ +package de.mpg.mpiwg.itgroup.digilib.plugin.editors; + +import org.eclipse.jface.action.*; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.ide.IDEActionFactory; +import org.eclipse.ui.part.MultiPageEditorActionBarContributor; +import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.ui.texteditor.ITextEditorActionConstants; + +/** + * Manages the installation/deinstallation of global actions for multi-page editors. + * Responsible for the redirection of global actions to the active editor. + * Multi-page contributor replaces the contributors for the individual editors in the multi-page editor. + */ +public class DigilibLinkEditorContributor extends MultiPageEditorActionBarContributor { + private IEditorPart activeEditorPart; + private Action sampleAction; + /** + * Creates a multi-page contributor. + */ + public DigilibLinkEditorContributor() { + super(); + createActions(); + } + /** + * Returns the action registed with the given text editor. + * @return IAction or null if editor is null. + */ + protected IAction getAction(ITextEditor editor, String actionID) { + return (editor == null ? null : editor.getAction(actionID)); + } + /* (non-JavaDoc) + * Method declared in AbstractMultiPageEditorActionBarContributor. + */ + + public void setActivePage(IEditorPart part) { + if (activeEditorPart == part) + return; + + activeEditorPart = part; + + IActionBars actionBars = getActionBars(); + if (actionBars != null) { + + ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null; + + actionBars.setGlobalActionHandler( + ActionFactory.DELETE.getId(), + getAction(editor, ITextEditorActionConstants.DELETE)); + actionBars.setGlobalActionHandler( + ActionFactory.UNDO.getId(), + getAction(editor, ITextEditorActionConstants.UNDO)); + actionBars.setGlobalActionHandler( + ActionFactory.REDO.getId(), + getAction(editor, ITextEditorActionConstants.REDO)); + actionBars.setGlobalActionHandler( + ActionFactory.CUT.getId(), + getAction(editor, ITextEditorActionConstants.CUT)); + actionBars.setGlobalActionHandler( + ActionFactory.COPY.getId(), + getAction(editor, ITextEditorActionConstants.COPY)); + actionBars.setGlobalActionHandler( + ActionFactory.PASTE.getId(), + getAction(editor, ITextEditorActionConstants.PASTE)); + actionBars.setGlobalActionHandler( + ActionFactory.SELECT_ALL.getId(), + getAction(editor, ITextEditorActionConstants.SELECT_ALL)); + actionBars.setGlobalActionHandler( + ActionFactory.FIND.getId(), + getAction(editor, ITextEditorActionConstants.FIND)); + actionBars.setGlobalActionHandler( + IDEActionFactory.BOOKMARK.getId(), + getAction(editor, IDEActionFactory.BOOKMARK.getId())); + actionBars.updateActionBars(); + } + } + private void createActions() { + sampleAction = new Action() { + public void run() { + MessageDialog.openInformation(null, "digilibClient", "Sample Action Executed"); + } + }; + sampleAction.setText("Sample Action"); + sampleAction.setToolTipText("Sample Action tool tip"); + sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages(). + getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK)); + } + public void contributeToMenu(IMenuManager manager) { + IMenuManager menu = new MenuManager("Editor &Menu"); + manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu); + menu.add(sampleAction); + } + public void contributeToToolBar(IToolBarManager manager) { + manager.add(new Separator()); + manager.add(sampleAction); + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorInput.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorInput.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,65 @@ +package de.mpg.mpiwg.itgroup.digilib.plugin.editors; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IPersistableElement; + +public class DigilibLinkEditorInput implements IEditorInput { + + private IFile indexMetaFile; + public static int INDEX_META=0; + private int type; + + public IFile getIndexMetaFile() { + return indexMetaFile; + } + + public void setIndexMetaFile(IFile indexMetaFile) { + this.indexMetaFile = indexMetaFile; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public DigilibLinkEditorInput(IFile file, int type) { + indexMetaFile = file; + setType(type); + } + + public Object getAdapter(Class adapter) { + // TODO Auto-generated method stub + return null; + } + + public boolean exists() { + // TODO Auto-generated method stub + return false; + } + + public ImageDescriptor getImageDescriptor() { + // TODO Auto-generated method stub + return null; + } + + public String getName() { + // TODO Auto-generated method stub + return "hello_name"; + } + + public IPersistableElement getPersistable() { + // TODO Auto-generated method stub + return null; + } + + public String getToolTipText() { + // TODO Auto-generated method stub + return "hello"; + } + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorObservable.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorObservable.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,26 @@ +package de.mpg.mpiwg.itgroup.digilib.plugin.editors; + +import java.util.Observable; + +import org.eclipse.swt.SWT; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; + +public class DigilibLinkEditorObservable extends Observable { + + static public final DigilibLinkEditorObservable INSTANCE = new DigilibLinkEditorObservable(); + + protected DigilibLinkEditorObservable(){}; + + public void imageHasChanged(DigiImage di){ + setChanged(); + notifyObservers(di); + } + + + public void setCursorStatus(int status) { + setChanged(); + notifyObservers(status); + + } +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorPart.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorPart.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,179 @@ +package de.mpg.mpiwg.itgroup.digilib.plugin.editors; + + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Observable; +import java.util.Observer; + +import info.textgrid.lab.linkeditor.mip.gui.ImagePanel; + +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Scale; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.EditorPart; +import org.jdom.JDOMException; + +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageParameter; +import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiNav; +import de.mpg.mpiwg.itgroup.digilib.digiImage.exceptions.DigilibInputTypeException; +import de.mpg.mpiwg.itgroup.indexMeta.Utils.ParseIndexMeta; + +/** + * + * @author dwinter + * + */ +public class DigilibLinkEditorPart extends EditorPart implements IResourceChangeListener, Observer{ + + private ImagePanel imagePanel; + private Composite mainComposite; + private ScrolledComposite sc; + + public void resourceChanged(IResourceChangeEvent event) { + // TODO Auto-generated method stub + + } + + @Override + public void doSave(IProgressMonitor monitor) { + // TODO Auto-generated method stub + + } + + @Override + public void doSaveAs() { + // TODO Auto-generated method stub + + } + + @Override + public void init(IEditorSite site, IEditorInput input) + throws PartInitException { + setInput(input); + setSite(site); + + } + + @Override + public boolean isDirty() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isSaveAsAllowed() { + // TODO Auto-generated method stub + return false; + } + + @Override + public void createPartControl(Composite frame) { + + sc = new ScrolledComposite(frame, SWT.H_SCROLL | SWT.V_SCROLL); + mainComposite = new Composite(sc,SWT.None); + + GridLayout imageLayout = new GridLayout(2,false); + mainComposite.setLayout(imageLayout); + sc.setContent(mainComposite); + //sc.setMinSize(400, 400); + + URL url; + + DigilibLinkEditorInput input= (DigilibLinkEditorInput) getEditorInput(); + String path=""; + if (input.getType()==DigilibLinkEditorInput.INDEX_META){ + ParseIndexMeta im; + try { + im = new ParseIndexMeta(input.getIndexMetaFile()); + } catch (JDOMException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } + try { + path=im.getImagePath(); + } catch (JDOMException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } + if (path==null) + return; + } else { + //TODO: issue warning that type cannot be solved. + return; + } + + + path=path.replace("/mpiwg/online", ""); + DigiImageParameter dp = new DigiImageParameter(path); + dp.setDh(500); + dp.setDw(500); + + + DigiImage digiImage = new DigiImage(mainComposite, SWT.BORDER, dp); + DigiImageController digiImageController = new DigiImageController(digiImage); + //imageComp.setBackgroundImage(img); + DigiNav digiNav = new DigiNav(mainComposite,SWT.BORDER,digiImageController); + + sc.setMinSize(mainComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + sc.setExpandHorizontal(true); + sc.setExpandVertical(true); + sc.layout(); + DigilibLinkEditorObservable.INSTANCE.addObserver(this); + + } + + @Override + public void setFocus() { + // TODO Auto-generated method stub + + } + + public void update(Observable o, Object arg) { + if (DigiImage.class.isInstance(arg)){ + mainComposite.pack(); + sc.setMinSize(mainComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + sc.layout(); + //sc.pack(); + + } else if (Integer.class.isInstance(arg)){ + int b = (Integer) arg; + + Cursor waitCursor = new Cursor(mainComposite.getDisplay(),b); + mainComposite.setCursor(waitCursor); + + + } + + } + + + +} diff -r 6829553d2378 -r 83c58ea33792 src/de/mpg/mpiwg/itgroup/indexMeta/Utils/ParseIndexMeta.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpg/mpiwg/itgroup/indexMeta/Utils/ParseIndexMeta.java Mon Jan 03 09:11:25 2011 +0100 @@ -0,0 +1,48 @@ +package de.mpg.mpiwg.itgroup.indexMeta.Utils; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.JDOMException; +import org.jdom.input.SAXBuilder; +import org.jdom.xpath.XPath; + +public class ParseIndexMeta { + + private Document dom; + + public ParseIndexMeta(IFile indexMetaFile) throws JDOMException, IOException, CoreException { + SAXBuilder builder = new SAXBuilder(); + InputStream is = indexMetaFile.getContents(); + dom = builder.build(is); + } + + public String getPath() throws JDOMException { + // TODO Auto-generated method stub + XPath xpath = XPath.newInstance("//archive-path"); + Element el = (Element)xpath.selectSingleNode(dom); + if (el==null) + return null; + return el.getTextTrim(); + } + + public String getImagePath() throws JDOMException{ + String path = getPath(); + + XPath xpath = XPath.newInstance("//texttool/image"); + Element el = (Element)xpath.selectSingleNode(dom); + if (el==null) + return null; + String imagePath =el.getTextTrim(); + + return(path+"/"+imagePath); + + } + +}