Ignore:
Timestamp:
2007-08-12T13:08:46+02:00 (17 years ago)
Author:
david
Message:
 
Location:
applications/editors/josm/plugins/nearclick
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/nearclick/.classpath

    r2397 r4088  
    33        <classpathentry kind="src" path="src"/>
    44        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    5         <classpathentry combineaccessrules="false" kind="src" path="/josm"/>
     5        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
     6        <classpathentry kind="src" path="/josm"/>
    67        <classpathentry kind="output" path="bin"/>
    78</classpath>
  • applications/editors/josm/plugins/nearclick/.project

    r2397 r4088  
    1111                        </arguments>
    1212                </buildCommand>
     13                <buildCommand>
     14                        <name>org.eclipse.pde.ManifestBuilder</name>
     15                        <arguments>
     16                        </arguments>
     17                </buildCommand>
     18                <buildCommand>
     19                        <name>org.eclipse.pde.SchemaBuilder</name>
     20                        <arguments>
     21                        </arguments>
     22                </buildCommand>
    1323        </buildSpec>
    1424        <natures>
    1525                <nature>org.eclipse.jdt.core.javanature</nature>
     26                <nature>org.eclipse.pde.PluginNature</nature>
    1627        </natures>
    1728</projectDescription>
  • applications/editors/josm/plugins/nearclick/build.xml

    r3789 r4088  
    88        <!-- Windows has a different home directory scheme then unix/linux -->
    99        <!-- I don't know an automatic way to find it with ant :-(, if you know, please fix -->
    10         <property name="plugins" location="${user.home}/.josm/plugins" ></property>
    11         <!--<property name="plugins" location="${user.home}/Anwendungsdaten/JOSM/plugins" ></property>-->
     10        <!--<property name="plugins" location="${user.home}/.josm/plugins" ></property>-->
     11        <property name="plugins" location="${user.home}/Application Data/JOSM/plugins" ></property>
    1212
    1313        <!-- you should not need to modify anything below this! -->
     
    2020
    2121        <target name="compile" depends="init">
    22                 <javac srcdir="src" classpath="${josm}" destdir="build" debug="true">
     22                <javac srcdir="src" target="1.5" classpath="${josm}" destdir="build" debug="true">
    2323                        <include name="**/*.java" />
    2424                </javac>
  • applications/editors/josm/plugins/nearclick/src/nearclick/NearClickPlugin.java

    r2397 r4088  
    88import java.awt.event.AWTEventListener;
    99import java.awt.event.MouseEvent;
     10import org.openstreetmap.josm.Main;
    1011
    1112public class NearClickPlugin implements AWTEventListener {
     
    1415    private int mouseDownY = -1;
    1516    private long mouseDownTime = -1;
     17    private int radiussquared = 49;
     18    private int delay = 250;
    1619
    1720    public NearClickPlugin() {
    1821        Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
     22        try {
     23            int radius = Integer.parseInt(Main.pref.get("nearclick.radius", "7"));
     24            radiussquared = radius * radius;
     25            delay = Integer.parseInt(Main.pref.get("nearclick.delay", "250"));
     26        } catch (NumberFormatException ex) {
     27            delay = 250;
     28            radiussquared = 7 * 7;
     29        }
    1930    }
    2031
     
    2435            if ( e.getButton() != MouseEvent.BUTTON1 )
    2536                return;
     37            int xdiff = e.getPoint().x - mouseDownX;
     38            int ydiff = e.getPoint().y - mouseDownY;
     39           
    2640            if (e.getID() == MouseEvent.MOUSE_RELEASED) {
    27                 if ( e.getWhen() - mouseDownTime < 250 &&
    28                         e.getPoint().x - mouseDownX < 7 &&
    29                         e.getPoint().y - mouseDownY < 7 &&
    30                         e.getPoint().x != mouseDownX &&
    31                         e.getPoint().y != mouseDownY ) {
     41                if ( e.getWhen() - mouseDownTime < delay &&
     42                     ( e.getPoint().x != mouseDownX ||
     43                       e.getPoint().y != mouseDownY) &&
     44                     xdiff * xdiff + ydiff * ydiff < radiussquared
     45                  ) {
    3246                    try {
    3347                        Robot r = new Robot(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
Note: See TracChangeset for help on using the changeset viewer.