Ignore:
Timestamp:
2007-10-13T00:12:31+02:00 (19 years ago)
Author:
framm
Message:
  • introduced various modifier keys to existing modes (for add node mode, shift to disable auto-connect and ctrl to disable auto-insert/reuse; for delete mode, shift to delete way segment and alt to delete way+nodes)
  • added small help bar at bottom of screen to display available modifiers
Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r365 r373  
    5454         * The status line below the map
    5555         */
    56         private MapStatus statusLine;
     56        public MapStatus statusLine;
    5757
    5858        public ConflictDialog conflictDialog;
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r343 r373  
    66import java.awt.AWTEvent;
    77import java.awt.Cursor;
     8import java.awt.Dimension;
    89import java.awt.EventQueue;
    910import java.awt.Font;
     
    1718import java.awt.event.MouseMotionListener;
    1819import java.lang.reflect.InvocationTargetException;
     20import java.text.DecimalFormat;
     21import java.text.NumberFormat;
    1922import java.util.Collection;
    2023import java.util.ConcurrentModificationException;
     
    5861         * The position of the mouse cursor.
    5962         */
    60         JTextField positionText = new JTextField("-000.00000000000000 -000.00000000000000".length());
     63        DecimalFormat latlon = new DecimalFormat("###0.0000000");
     64        JTextField positionText = new JTextField(25);
     65       
    6166        /**
    6267         * The field holding the name of the object under the mouse.
     
    6469        JTextField nameText = new JTextField(30);
    6570
     71        /**
     72         * The field holding information about what the user can do.
     73         */
     74        JTextField helpText = new JTextField();
     75       
    6676        /**
    6777         * The collector class that waits for notification and then update
     
    114124                                // the data.
    115125                                try {
    116                                         Collection<OsmPrimitive> osms = mv.getAllNearest(ms.mousePos);
    117 
    118                                         if (osms == null && osmStatus == null && ms.modifiers == oldModifiers)
    119                                                 continue;
    120                                         if (osms != null && osms.equals(osmStatus) && ms.modifiers == oldModifiers)
    121                                                 continue;
    122 
     126                                        // Popup Information
     127                                        if ((ms.modifiers & MouseEvent.BUTTON2_DOWN_MASK) != 0 ) {
     128                                                Collection<OsmPrimitive> osms = mv.getAllNearest(ms.mousePos);
     129
     130                                                if (osms == null)
     131                                                        continue;
     132                                                if (osms != null && osms.equals(osmStatus) && ms.modifiers == oldModifiers)
     133                                                        continue;
     134                                        /*
    123135                                        osmStatus = osms;
    124136                                        oldModifiers = ms.modifiers;
     
    133145                                        } else
    134146                                                nameText.setText("");
    135 
    136                                         // Popup Information
    137                                         if ((ms.modifiers & MouseEvent.BUTTON2_DOWN_MASK) != 0 && osms != null) {
     147                                        */
     148                                       
     149
    138150                                                if (popup != null) {
    139151                                                        try {
     
    235247                                if ((e.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) == 0) {
    236248                                        LatLon p = mv.getLatLon(e.getX(),e.getY());
    237                                         positionText.setText(p.lat()+" "+p.lon());
     249                                        positionText.setText(latlon.format(p.lat())+" "+latlon.format(p.lon()));
    238250                                }
    239251                        }
     
    242254                positionText.setEditable(false);
    243255                nameText.setEditable(false);
    244                 setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
     256                helpText.setEditable(false);
     257                setLayout(new GridBagLayout());
    245258                setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    246                 add(new JLabel(tr("Lat/Lon")+" "));
    247                 add(positionText);
    248                 add(new JLabel(" "+tr("Object")+" "));
    249                 add(nameText);
    250 
     259                add(new JLabel(tr("Lat/Lon")+" "), GBC.std());
     260                add(positionText, GBC.std());
     261                //add(new JLabel(" "+tr("Object")+" "));
     262                //add(nameText);
     263                add(helpText, GBC.eol().fill(GBC.HORIZONTAL));
     264                positionText.setMinimumSize(new Dimension(positionText.getMinimumSize().height, 200));
     265               
    251266                // The background thread
    252267                final Collector collector = new Collector(mapFrame);
     
    270285            return "Statusline";
    271286    }
     287       
     288        public void setHelpText(String t) {
     289                helpText.setText(t);
     290        }
    272291}
Note: See TracChangeset for help on using the changeset viewer.