Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
Pop up listener functionality. Done by Nikhil.
authorlingutln <lingutln@localhost>
Wed, 28 Dec 2011 08:45:55 +0000 (08:45 +0000)
committerlingutln <lingutln@localhost>
Wed, 28 Dec 2011 08:45:55 +0000 (08:45 +0000)
svn path=/; revision=242

Annotation/src/ie/dcu/apps/ist/AppWindow.java
Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java
Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java

index f9a2a7004e9db99f83ee954bfec0d5732bd209d5..ea03479eed23fe64e913ea010aaff81703724040 100644 (file)
@@ -620,7 +620,7 @@ public class AppWindow extends ApplicationWindow implements FileDropListener {
        };
        
        
-       private class ImageObserver implements MouseMoveListener, MouseListener, ContextChangeListener {
+       private class ImageObserver implements MouseMoveListener, ContextChangeListener {
                private static final String MONOSPACE_FONT = "Monospace";
 
                private final ImageControl ctrl;
@@ -631,10 +631,6 @@ public class AppWindow extends ApplicationWindow implements FileDropListener {
                public ImageObserver(SegmentationView view) {
                        view.addContextChangeListener(this);
                        view.getCanvas().addMouseMoveListener(this);
-                       if(SegmentationView.labelMode)
-                       {
-                               view.getCanvas().addMouseListener(this);
-                       }
                        ctrl = view.getImageControl();
                        contextChanged(view.getContext());
                        FontDescriptor fd = FontDescriptor.createFrom(MONOSPACE_FONT, 8, SWT.NORMAL);
@@ -733,20 +729,5 @@ public class AppWindow extends ApplicationWindow implements FileDropListener {
                                image = null;
                        }
                }
-               @Override
-               public void mouseDoubleClick(MouseEvent arg0) {
-                       System.out.println("In mouse double click");
-                       
-               }
-               @Override
-               public void mouseDown(MouseEvent arg0) {
-                       System.out.println("In mouse down");
-                       
-               }
-               @Override
-               public void mouseUp(MouseEvent arg0) {
-                       System.out.println("In mouse up");
-                       
-               }
        }
 }
index 4f283efc48fc72b8fde9f296d5cddfe8c70cbef2..cc762de296533848e1558175693af10f06849b7b 100644 (file)
@@ -445,6 +445,7 @@ public class SegmentationView extends Composite {
                        Tool.Foreground.action.setEnabled(false);
                        Tool.Background.action.setEnabled(false);
                        view.removeContextChangeListener(eventHandler);
+                       view.getImageControl().getCanvas().addMouseListener(popupListener);
                        if(!(view.getTool() == null))
                        {
                                view.getTool().detach();
@@ -452,6 +453,7 @@ public class SegmentationView extends Composite {
                }
                else
                {
+                       view.getImageControl().getCanvas().removeMouseListener(popupListener);
                        view.addContextChangeListener(eventHandler);
                        view.getTool().attach(view.getImageControl());
                }
@@ -1048,6 +1050,22 @@ public class SegmentationView extends Composite {
                }
        };
        
+       private final MouseListener popupListener = new MouseListener() {
+
+               public void mouseUp(MouseEvent e) {
+                       System.out.println("Mouse up");
+                       Menu menu = new Menu(getShell(), SWT.POP_UP);
+                       getShell().setMenu(menu);
+               }
+               public void mouseDown(MouseEvent e) {
+                       System.out.println("In Mouse down");
+               }
+               public void mouseDoubleClick(MouseEvent e) {
+                       System.out.println("In Mouse Double click");
+               }
+               
+       };
+       
        /**
         * Class that prevents segmentation algorithms crashing the application
         * by catching any thrown exceptions and logging them.
index cfca8a2f8ec9cef17078af66aabe8a11fe528f59..c3e578e0b3b7b6f2eb3ef19a636c414332ead198 100644 (file)
@@ -390,7 +390,6 @@ public class AnnotatedImageControl extends Composite {
                }
        };
        
-
        /**
         * Listens for annotations and updates the buffer and view accordingly.
         */