1
|
1 package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions;
|
|
2
|
|
3 import org.eclipse.swt.SWT;
|
|
4 import org.eclipse.swt.widgets.Label;
|
|
5
|
9
|
6
|
1
|
7 import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController;
|
|
8 import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable;
|
|
9
|
9
|
10 /**
|
|
11 * Set ZoomAreaRectangleListener on the digiimage, which then calls zoom area after selecting an area.
|
|
12 *
|
|
13 * @author dwinter
|
|
14 *
|
|
15 */
|
1
|
16 public class ZoomArea extends ManipulatorExtension {
|
|
17
|
|
18 public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-area.png";
|
|
19 public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-area.png";
|
|
20
|
|
21 public ZoomArea() {
|
|
22 setIconPaths(iconOff,iconOn);
|
|
23 setOffIcon();
|
|
24 setKeyword("zoomArea");
|
|
25 }
|
|
26
|
|
27
|
|
28
|
|
29 public void run(DigiImageController dc) {
|
|
30
|
|
31 DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_HAND);
|
9
|
32 ZoomAreaRectangleListener ml = dc.digiImage.getRectangleListener();
|
1
|
33 Label label = dc.digiImage.getLabel();
|
|
34 if (ml!=null){
|
|
35 try {
|
|
36 label.removeMouseListener(ml);
|
|
37 } catch (Exception e) {
|
|
38 // TODO Auto-generated catch block
|
|
39 e.printStackTrace();
|
|
40 }
|
|
41 } else {
|
9
|
42 ml = new ZoomAreaRectangleListener(dc);
|
1
|
43 dc.digiImage.setRectangleListener(ml);
|
|
44 }
|
|
45 ml.reset();
|
|
46 label.addMouseListener(ml);
|
|
47
|
|
48
|
|
49
|
|
50 }
|
|
51 }
|