Changeset 317 in josm
- Timestamp:
- 2007-09-04T00:11:08+02:00 (17 years ago)
- Files:
-
- 4 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java
r316 r317 19 19 import java.awt.event.MouseAdapter; 20 20 import java.awt.event.MouseEvent; 21 import java.awt.event.KeyEvent; 21 22 import java.io.File; 22 23 import java.io.IOException; … … 244 245 p.add(scroll, BorderLayout.CENTER); 245 246 246 final JToggleButton scale = new JToggleButton(ImageProvider.get(" misc", "rectangle"));247 final JButton next = new JButton(">>");248 final JButton prev = new JButton( "<<");249 final J Button cent = new JButton("Centre");247 final JToggleButton scale = new JToggleButton(ImageProvider.get("dialogs", "zoom-best-fit")); 248 final JButton next = new JButton(ImageProvider.get("dialogs", "next")); 249 final JButton prev = new JButton(ImageProvider.get("dialogs", "previous")); 250 final JToggleButton cent = new JToggleButton(ImageProvider.get("dialogs", "centreview")); 250 251 251 252 JPanel p2 = new JPanel(); … … 258 259 p.add(p2, BorderLayout.SOUTH); 259 260 final JOptionPane pane = new JOptionPane(p, JOptionPane.PLAIN_MESSAGE); 260 //final JDialog dlg = pane.createDialog(Main.parent, e.image+" ("+e.coor.lat()+","+e.coor.lon()+")");261 261 final JDialog dlg = pane.createDialog(Main.parent, e.image+" ("+e.coor.toDisplayString()+")"); 262 262 scale.addActionListener(new ActionListener(){ … … 271 271 }); 272 272 scale.setSelected(true); 273 prev.addActionListener(new ActionListener(){274 public void actionPerformed(ActionEvent ev) {275 p.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));276 if(currentImage>0) currentImage--;277 if(currentImage==0) prev.setEnabled(false);278 next.setEnabled(true);279 final ImageEntry e = data.get(currentImage);280 if (scale.getModel().isSelected())281 ((JLabel)vp.getView()).setIcon(loadScaledImage(e.image, Math.max(vp.getWidth(), vp.getHeight())));282 else283 ((JLabel)vp.getView()).setIcon(new ImageIcon(e.image.getPath()));284 dlg.setTitle(e.image+" ("+e.coor.toDisplayString()+")");285 //dlg.setTitle(e.image+" ("+e.coor.lat()+","+e.coor.lon()+")");286 p.setCursor(Cursor.getDefaultCursor());287 }288 });289 next.addActionListener(new ActionListener(){290 public void actionPerformed(ActionEvent ev) {291 p.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));292 if(currentImage<data.size()-1) currentImage++;293 if(currentImage==data.size()-1) next.setEnabled(false);294 prev.setEnabled(true);295 final ImageEntry e = data.get(currentImage);296 if (scale.getModel().isSelected())297 ((JLabel)vp.getView()).setIcon(loadScaledImage(e.image, Math.max(vp.getWidth(), vp.getHeight())));298 else299 ((JLabel)vp.getView()).setIcon(new ImageIcon(e.image.getPath()));300 dlg.setTitle(e.image+" (" + e.coor.toDisplayString() + ")");301 p.setCursor(Cursor.getDefaultCursor());302 }303 });304 273 cent.addActionListener(new ActionListener(){ 305 274 public void actionPerformed(ActionEvent ev) { 306 275 final ImageEntry e = data.get(currentImage); 307 //Main.map.mapView.repaint();308 276 if (cent.getModel().isSelected()) 277 Main.map.mapView.zoomTo(e.pos, Main.map.mapView.getScale()); 309 278 } 310 279 }); 280 281 ActionListener nextprevAction = new ActionListener(){ 282 public void actionPerformed(ActionEvent ev) { 283 p.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); 284 if (ev.getActionCommand().equals("Next")) { 285 currentImage++; 286 if(currentImage>=data.size()-1) next.setEnabled(false); 287 prev.setEnabled(true); 288 } else { 289 currentImage--; 290 if(currentImage<=0) prev.setEnabled(false); 291 next.setEnabled(true); 292 } 293 294 final ImageEntry e = data.get(currentImage); 295 if (scale.getModel().isSelected()) 296 ((JLabel)vp.getView()).setIcon(loadScaledImage(e.image, Math.max(vp.getWidth(), vp.getHeight()))); 297 else 298 ((JLabel)vp.getView()).setIcon(new ImageIcon(e.image.getPath())); 299 dlg.setTitle(e.image+" ("+e.coor.toDisplayString()+")"); 300 if (cent.getModel().isSelected()) 301 Main.map.mapView.zoomTo(e.pos, Main.map.mapView.getScale()); 302 p.setCursor(Cursor.getDefaultCursor()); 303 } 304 }; 305 next.setActionCommand("Next"); 306 prev.setActionCommand("Previous"); 307 next.setMnemonic(KeyEvent.VK_RIGHT); 308 prev.setMnemonic(KeyEvent.VK_LEFT); 309 scale.setMnemonic(KeyEvent.VK_F); 310 cent.setMnemonic(KeyEvent.VK_C); 311 next.setToolTipText("Show next image"); 312 prev.setToolTipText("Show previous image"); 313 cent.setToolTipText("Centre image location in main display"); 314 scale.setToolTipText("Scale image to fit"); 315 316 prev.addActionListener(nextprevAction); 317 next.addActionListener(nextprevAction); 318 cent.setSelected(false); 319 311 320 dlg.setModal(false); 312 321 dlg.setVisible(true);
Note:
See TracChangeset
for help on using the changeset viewer.