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
|
|
6 import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage;
|
|
7 import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController;
|
|
8 import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable;
|
|
9
|
|
10 public class ZoomArea extends ManipulatorExtension {
|
|
11
|
|
12 public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-area.png";
|
|
13 public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/zoom-area.png";
|
|
14
|
|
15 public ZoomArea() {
|
|
16 setIconPaths(iconOff,iconOn);
|
|
17 setOffIcon();
|
|
18 setKeyword("zoomArea");
|
|
19 }
|
|
20
|
|
21
|
|
22
|
|
23 public void run(DigiImageController dc) {
|
|
24
|
|
25 DigilibLinkEditorObservable.INSTANCE.setCursorStatus(SWT.CURSOR_HAND);
|
|
26 RectangleListener ml = dc.digiImage.getRectangleListener();
|
|
27 Label label = dc.digiImage.getLabel();
|
|
28 if (ml!=null){
|
|
29 try {
|
|
30 label.removeMouseListener(ml);
|
|
31 } catch (Exception e) {
|
|
32 // TODO Auto-generated catch block
|
|
33 e.printStackTrace();
|
|
34 }
|
|
35 } else {
|
|
36 ml = new RectangleListener(dc,label);
|
|
37 dc.digiImage.setRectangleListener(ml);
|
|
38 }
|
|
39 ml.reset();
|
|
40 label.addMouseListener(ml);
|
|
41
|
|
42
|
|
43
|
|
44 }
|
|
45 }
|