Changeset 13832 in josm
- Timestamp:
- 2018-05-25T21:05:36+02:00 (6 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 4 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r13795 r13832 27 27 import javax.swing.ButtonGroup; 28 28 import javax.swing.ImageIcon; 29 import javax.swing.InputMap; 29 30 import javax.swing.JButton; 30 31 import javax.swing.JCheckBoxMenuItem; … … 222 223 splitPane.setUI(new NoBorderSplitPaneUI()); 223 224 224 // JSplitPane supports F6 and F8 shortcuts by default, but we need them for Audio actions 225 splitPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), new Object()); 226 splitPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_F8, 0), new Object()); 225 // JSplitPane supports F6, F8, Home and End shortcuts by default, but we need them for Audio and Image Mapping actions 226 InputMap splitInputMap = splitPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); 227 splitInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), new Object()); 228 splitInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F8, 0), new Object()); 229 splitInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0), new Object()); 230 splitInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_END, 0), new Object()); 227 231 228 232 add(splitPane, BorderLayout.CENTER); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
r13289 r13832 75 75 } 76 76 77 private JButton btnLast; 77 78 private JButton btnNext; 78 79 private JButton btnPrevious; 80 private JButton btnFirst; 79 81 private JButton btnCollapse; 80 82 private JToggleButton tbCentre; … … 88 90 } 89 91 92 private static JButton createNavigationButton(JosmAction action, Dimension buttonDim) { 93 JButton btn = new JButton(action); 94 btn.setPreferredSize(buttonDim); 95 btn.setEnabled(false); 96 return btn; 97 } 98 90 99 private void build() { 91 100 JPanel content = new JPanel(new BorderLayout()); … … 95 104 Dimension buttonDim = new Dimension(26, 26); 96 105 97 btnPrevious = new JButton(imagePreviousAction); 98 btnPrevious.setPreferredSize(buttonDim); 99 btnPrevious.setEnabled(false); 106 btnFirst = createNavigationButton(imageFirstAction, buttonDim); 107 btnPrevious = createNavigationButton(imagePreviousAction, buttonDim); 100 108 101 109 JButton btnDelete = new JButton(imageRemoveAction); … … 108 116 btnCopyPath.setPreferredSize(buttonDim); 109 117 110 btnNext = new JButton(imageNextAction); 111 btnNext.setPreferredSize(buttonDim); 112 btnNext.setEnabled(false); 118 btnNext = createNavigationButton(imageNextAction, buttonDim); 119 btnLast = createNavigationButton(imageLastAction, buttonDim); 113 120 114 121 tbCentre = new JToggleButton(imageCenterViewAction); … … 123 130 124 131 JPanel buttons = new JPanel(); 132 buttons.add(btnFirst); 125 133 buttons.add(btnPrevious); 126 134 buttons.add(btnNext); 135 buttons.add(btnLast); 127 136 buttons.add(Box.createRigidArea(new Dimension(7, 0))); 128 137 buttons.add(tbCentre); … … 204 213 private class ImageFirstAction extends JosmAction { 205 214 ImageFirstAction() { 206 super(null, (ImageProvider) null, null, Shortcut.registerShortcut(215 super(null, new ImageProvider("dialogs", "first"), tr("First"), Shortcut.registerShortcut( 207 216 "geoimage:first", tr("Geoimage: {0}", tr("Show first Image")), KeyEvent.VK_HOME, Shortcut.DIRECT), 208 217 false, null, false); … … 219 228 private class ImageLastAction extends JosmAction { 220 229 ImageLastAction() { 221 super(null, (ImageProvider) null, null, Shortcut.registerShortcut(230 super(null, new ImageProvider("dialogs", "last"), tr("Last"), Shortcut.registerShortcut( 222 231 "geoimage:last", tr("Geoimage: {0}", tr("Show last Image")), KeyEvent.VK_END, Shortcut.DIRECT), 223 232 false, null, false); … … 319 328 } 320 329 330 /** 331 * Displays image for the given layer. 332 * @param layer geo image layer 333 * @param entry image entry 334 */ 321 335 public static void showImage(GeoImageLayer layer, ImageEntry entry) { 322 336 getInstance().displayImage(layer, entry); … … 334 348 */ 335 349 public static void setPreviousEnabled(boolean value) { 350 getInstance().btnFirst.setEnabled(value); 336 351 getInstance().btnPrevious.setEnabled(value); 337 352 } … … 343 358 public static void setNextEnabled(boolean value) { 344 359 getInstance().btnNext.setEnabled(value); 360 getInstance().btnLast.setEnabled(value); 345 361 } 346 362 … … 361 377 private transient ImageEntry currentEntry; 362 378 379 /** 380 * Displays image for the given layer. 381 * @param layer geo image layer 382 * @param entry image entry 383 */ 363 384 public void displayImage(GeoImageLayer layer, ImageEntry entry) { 364 385 boolean imageChanged;
Note:
See TracChangeset
for help on using the changeset viewer.