Re: [josm-dev] JOSM Plugin no_more_mapping

2012-10-20 Thread Russell Edwards

My 0.02 on this storm in a teacup.

Isn't all of this one of the key points about open source software?

The source is open. Ordinary users can place a degree of trust in it 
because others in the community will review code for safety.  And that's 
exactly what we've just seen on this list. Any ordinary user who doesn't 
trust others to do this for him/her can educate him/herself and vet the 
source code personally.


Russell


___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] MapMode - MouseWheelListener and KeyListener?

2012-09-20 Thread Russell Edwards

On 20/09/12 04:41, Paul Hartmann wrote:


I put your code in SelectAction and MouseWheelListener worked directly.
Not sure if you can easily suppress zoom, though. What is your mapmode 
about?


Other plugins have a similar similar setup, e.g. alignways has a 
mapmode with MouseListener. In order to catch keystrokes, you should 
try AWTEventListener.


Thanks very much -- all working now.

I have also successfully temporarily disabled map zooming  using 
Main.map.mapView.getMouseWheelListeners() and looping 
Main.map.mapView.removeMouseWheelListener(). I do this when my mode gets 
a mousePressed, and then reinstate them all with 
Main.map.mapView.addMouseWheelListener() when I get mouseReleased.


Is this allowed? It's a bit sneaky as the listeners are added by 
mapView's private member MapMover. Maybe mapView should have public 
lockMap() and unlockMap() methods?


Why do I do it? It happens to be a convenient way for the user to modify 
a selection box while they are still making it. (It's a rectangle 
selection of arbitrary orientiation, for selecting GPS points which lay 
along a straight line - so mouse x and y click drag and release are 
needed to determine the start and end of the long axis of the rectangle, 
and the scroll wheel / arrow keys are available if the width of the 
rectangle needs changing from its default due to e.g. excess spread of 
GPS points.) The user would not want to scroll or zoom the view during 
this procedure anyway, so I don't see the harm in taking over the scroll 
wheel during this operation.


Russell



___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


[josm-dev] MapMode - MouseWheelListener and KeyListener?

2012-09-19 Thread Russell Edwards

Hello,

Apologies for asking a beginner's question.

I am writing a plugin which has its own MapMode. I need to catch mouse 
wheel and key press events. How can I do this?


I have tried

... extends MapMode implements MouseWheelListener, KeyListener

... enterMode() {
...
Main.map.mapView.addMouseWheelListener(this);
Main.map.mapView.addKeyListener(this);
 ...
}

but the listeners never seem to get called. Moreover the map still zooms 
in and out when the wheel is moved.


Thanks in advance for your help and patience,

Russell


___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev