Changeset 30709 in osm for applications/editors/josm


Ignore:
Timestamp:
2014-10-11T09:24:53+02:00 (11 years ago)
Author:
akks
Message:

JOSM/FastDraw: do not catch keys from other windows, fix default tags combobox

Location:
applications/editors/josm/plugins/FastDraw
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified applications/editors/josm/plugins/FastDraw/build.xml

    r30416 r30709  
    22<project name="FastDraw" default="dist" basedir=".">
    33    <!-- enter the SVN commit message -->
    4     <property name="commit.message" value="JOSM/FastDraw: line stroke and point size customization"/>
     4    <property name="commit.message" value="JOSM/FastDraw: do not catch keys from other windows, fix default tags combobox"/>
    55    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    66    <property name="plugin.main.version" value="7001"/>
  • TabularUnified applications/editors/josm/plugins/FastDraw/nbproject/project.xml

    r30416 r30709  
    44    <configuration>
    55        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
     6            <name>FastDraw</name>
     7        </general-data>
     8        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
    69            <!-- Не используйте диалоговое окно свойств проекта при редактировании данного файла вручную. -->
    710            <name>FastDraw</name>
     
    1316                    <location>src</location>
    1417                </source-folder>
     18                <build-file>
     19                    <location>../../dist/FastDraw.jar</location>
     20                </build-file>
    1521            </folders>
    1622            <ide-actions>
     
    5662                </context-menu>
    5763            </view>
     64            <subprojects/>
    5865        </general-data>
    5966        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
    6067            <compilation-unit>
    6168                <package-root>src</package-root>
    62                 <classpath mode="compile">../../core/src</classpath>
     69                <classpath mode="compile">../../core/src;../../core/dist/josm-custom.jar</classpath>
    6370                <built-to>../../dist/FastDraw.jar</built-to>
    6471                <source-level>1.7</source-level>
  • TabularUnified applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java

    r30532 r30709  
    77import java.text.NumberFormat;
    88import java.text.ParseException;
     9import java.util.ArrayList;
     10import java.util.Collection;
     11import java.util.Collections;
    912
    1013import javax.swing.AbstractAction;
     
    6164        });
    6265        pasteButton.setToolTipText(tr("Try copying tags from properties table"));
    63        
    64         addTags.setPossibleItems(Main.pref.getCollection("fastdraw.tags-history"));
     66        ArrayList<String> history = new ArrayList<>(Main.pref.getCollection("fastdraw.tags-history"));
     67        while (history.remove("")) { };
     68        addTags.setPossibleItems(history);
    6569       
    6670        all.add(label1,GBC.std().insets(10,0,0,0));
     
    118122            settings.simplifyMode=combo1.getSelectedIndex();
    119123            settings.autoTags=addTags.getText();
    120             addTags.addCurrentItemToHistory();
     124            if (!settings.autoTags.isEmpty()) {
     125                addTags.addCurrentItemToHistory();
     126            }
    121127            Main.pref.putCollection("fastdraw.tags-history", addTags.getHistory());
    122128            settings.savePrefs();
  • TabularUnified applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java

    r29595 r30709  
    99import java.awt.AWTEvent;
    1010import java.awt.Color;
     11import java.awt.Component;
    1112import java.awt.Cursor;
    1213import java.awt.Graphics2D;
     14import java.awt.KeyboardFocusManager;
    1315import java.awt.Point;
    1416import java.awt.Toolkit;
    1517import java.awt.event.*;
    1618import java.util.*;
     19import javax.swing.JFrame;
    1720import javax.swing.JOptionPane;
     21import javax.swing.SwingUtilities;
    1822import javax.swing.Timer;
    1923
     
    265269                  set.add((e.getKeyCode()));
    266270                }
    267             doKeyEvent((KeyEvent) event);
     271            // check if key press is done in main window, not in dialogs
     272            Component focused = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
     273            if (SwingUtilities.getWindowAncestor(focused) instanceof JFrame) {
     274                doKeyEvent((KeyEvent) event);
     275            }
    268276        }
    269277        if (event.getID() == KeyEvent.KEY_RELEASED) {
Note: See TracChangeset for help on using the changeset viewer.