59 |
import schmitzm.lang.LangUtil; |
import schmitzm.lang.LangUtil; |
60 |
import schmitzm.lang.ResourceProvider; |
import schmitzm.lang.ResourceProvider; |
61 |
import schmitzm.swing.ButtonGroup; |
import schmitzm.swing.ButtonGroup; |
62 |
|
import schmitzm.swing.SwingUtil; |
63 |
import skrueger.swing.SmallButton; |
import skrueger.swing.SmallButton; |
64 |
import skrueger.swing.SmallToggleButton; |
import skrueger.swing.SmallToggleButton; |
65 |
|
|
307 |
*/ |
*/ |
308 |
protected void initToolsAndActions() { |
protected void initToolsAndActions() { |
309 |
// Panning |
// Panning |
310 |
addTool(new MapPaneToolBarAction(TOOL_PAN, this, "", new ImageIcon( |
// addTool(new MapPaneToolBarAction(TOOL_PAN, this, "", new ImageIcon( |
311 |
MapView.class.getResource("resource/icons/pan.png")), |
// MapView.class.getResource("resource/icons/pan.png")), |
312 |
R("MapPaneButtons.Pan.TT")), false); |
// R("MapPaneButtons.Pan.TT")), false); |
|
// Info |
|
|
addTool(new MapPaneToolBarAction(TOOL_INFO, this, "", new ImageIcon( |
|
|
MapView.class.getResource("resource/icons/info.png")), |
|
|
R("MapPaneButtons.Info.TT")), false); |
|
313 |
|
|
314 |
|
addTool(new MapPaneToolBarAction(TOOL_PAN, this, XMapPaneTool.PAN), false); |
315 |
|
|
316 |
|
// Info |
317 |
|
// addTool(new MapPaneToolBarAction(TOOL_INFO, this, "", new ImageIcon( |
318 |
|
// MapView.class.getResource("resource/icons/info.png")), |
319 |
|
// R("MapPaneButtons.Info.TT")), false); |
320 |
|
addTool(new MapPaneToolBarAction(TOOL_INFO, this, XMapPaneTool.INFO), false); |
321 |
|
|
322 |
// Zoom in |
// Zoom in |
323 |
addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, "", new ImageIcon( |
addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, XMapPaneTool.ZOOM_IN), false); |
324 |
MapView.class.getResource("resource/icons/zoom_in.png")), |
|
|
R("MapPaneButtons.ZoomIn.TT")), false); |
|
325 |
// Zoom out |
// Zoom out |
326 |
addTool(new MapPaneToolBarAction(TOOL_ZOOMOUT, this, "", new ImageIcon( |
addTool(new MapPaneToolBarAction(TOOL_ZOOMOUT, this, XMapPaneTool.ZOOM_OUT), false); |
327 |
MapView.class.getResource("resource/icons/zoom_out.png")), |
|
328 |
R("MapPaneButtons.ZoomOut.TT")), false); |
|
329 |
|
// // Zoom in |
330 |
|
// addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, "", new ImageIcon( |
331 |
|
// MapView.class.getResource("resource/icons/zoom_in.png")), |
332 |
|
// R("MapPaneButtons.ZoomIn.TT")), false); |
333 |
|
// |
334 |
|
// // Zoom out |
335 |
|
// addTool(new MapPaneToolBarAction(TOOL_ZOOMOUT, this, "", new ImageIcon( |
336 |
|
// MapView.class.getResource("resource/icons/zoom_out.png")), |
337 |
|
// R("MapPaneButtons.ZoomOut.TT")), false); |
338 |
|
|
339 |
|
|
340 |
|
|
341 |
// Action button to revert the last zoom |
// Action button to revert the last zoom |
342 |
addAction(new MapPaneToolBarAction(ACTION_ZOOM_BACK, this, "", |
addAction(new MapPaneToolBarAction(ACTION_ZOOM_BACK, this, "", |
440 |
switch (tool) { |
switch (tool) { |
441 |
case TOOL_PAN: |
case TOOL_PAN: |
442 |
// Set the mouse tool to "Panning" |
// Set the mouse tool to "Panning" |
443 |
mapPane.setState(SelectableXMapPane.PAN); |
// mapPane.setState(SelectableXMapPane.PAN); |
444 |
|
mapPane.setTool(XMapPaneTool.PAN); |
445 |
// mapPane.setNormalCursor(SwingUtil.PAN_CURSOR); |
// mapPane.setNormalCursor(SwingUtil.PAN_CURSOR); |
446 |
break; |
break; |
447 |
case TOOL_INFO: |
case TOOL_INFO: |
448 |
// Set the mouse tool to "Info" |
// Set the mouse tool to "Info" |
449 |
mapPane.setState(SelectableXMapPane.SELECT_ONE_FROM_TOP); |
mapPane.setTool(XMapPaneTool.INFO); |
450 |
|
// mapPane.setState(SelectableXMapPane.SELECT_ONE_FROM_TOP); |
451 |
// mapPane.setNormalCursor(SwingUtil.CROSSHAIR_CURSOR); |
// mapPane.setNormalCursor(SwingUtil.CROSSHAIR_CURSOR); |
452 |
break; |
break; |
453 |
case TOOL_ZOOMIN: |
case TOOL_ZOOMIN: |
454 |
// Set the mouse tool to "Zoom in" |
// Set the mouse tool to "Zoom in" |
455 |
mapPane.setState(SelectableXMapPane.ZOOM_IN); |
mapPane.setTool(XMapPaneTool.ZOOM_IN); |
456 |
// mapPane.setNormalCursor(SwingUtil.ZOOMIN_CURSOR); |
// mapPane.setNormalCursor(SwingUtil.ZOOMIN_CURSOR); |
457 |
break; |
break; |
458 |
case TOOL_ZOOMOUT: |
case TOOL_ZOOMOUT: |
459 |
// Set the mouse tool to "Zoom out" |
// Set the mouse tool to "Zoom out" |
460 |
mapPane.setState(SelectableXMapPane.ZOOM_OUT); |
mapPane.setTool(XMapPaneTool.ZOOM_OUT); |
461 |
|
// mapPane.setState(SelectableXMapPane.ZOOM_OUT); |
462 |
// mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR); |
// mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR); |
463 |
break; |
break; |
464 |
default: |
default: |
707 |
return -1; |
return -1; |
708 |
return selectedTool; |
return selectedTool; |
709 |
} |
} |
710 |
|
|
711 |
/** |
/** |
712 |
* Sets whether a tool or action is activated or not. The visible property |
* Sets whether a tool or action is activated or not. The visible property |
713 |
* of the button is not affected. |
* of the button is not affected. |
906 |
this.toolBar = toolBar; |
this.toolBar = toolBar; |
907 |
} |
} |
908 |
|
|
909 |
|
public MapPaneToolBarAction(int id, MapPaneToolBar toolBar, XMapPaneTool tool) { |
910 |
|
this(id, toolBar, "", tool.icon, tool.toolTip); |
911 |
|
} |
912 |
|
|
913 |
/** |
/** |
914 |
* Calls {@link MapPaneToolBar#performToolButton(int, ActionEvent)} or |
* Calls {@link MapPaneToolBar#performToolButton(int, ActionEvent)} or |
915 |
* {@link MapPaneToolBar#performActionButton(int, ActionEvent)} |
* {@link MapPaneToolBar#performActionButton(int, ActionEvent)} |