mirror of https://github.com/FreeCol/freecol.git
Areas are now only showed in the map editor while editing them.
This commit is contained in:
parent
7870bc7bb8
commit
dd23a7c3ac
|
@ -78,6 +78,8 @@ public final class MapEditorController extends FreeColClientHolder {
|
|||
private MapTransform currentMapTransform = null;
|
||||
|
||||
private Area currentArea = null;
|
||||
|
||||
private boolean displayAreas = false;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -230,6 +232,23 @@ public final class MapEditorController extends FreeColClientHolder {
|
|||
public Area getCurrentArea() {
|
||||
return currentArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if areas should be displayed while editing.
|
||||
* @return {@code true} if the areas should be displayed.
|
||||
*/
|
||||
public boolean isDisplayAreas() {
|
||||
return displayAreas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if areas should be displayed while editing.
|
||||
* @param displayAreas {@code true} if the areas should be displayed.
|
||||
*/
|
||||
public void setDisplayAreas(boolean displayAreas) {
|
||||
this.displayAreas = displayAreas;
|
||||
getGUI().refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms the given {@code Tile} using the
|
||||
|
|
|
@ -539,6 +539,9 @@ public final class Canvas extends JDesktopPane {
|
|||
@Override
|
||||
public void internalFrameClosing(InternalFrameEvent e) {
|
||||
savePositionAndSize(comp, f);
|
||||
if (comp instanceof FreeColPanel) {
|
||||
((FreeColPanel) comp).onFrameClosing();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -707,9 +707,7 @@ public final class MapViewer extends FreeColClientHolder {
|
|||
|
||||
displayDebugAiDefensiveMap(nonAnimationG2d, tcb);
|
||||
|
||||
if (getFreeColClient().isMapEditor()) {
|
||||
displayAreasInMapEditor(nonAnimationG2d, tcb);
|
||||
}
|
||||
displayAreasInMapEditor(nonAnimationG2d, tcb);
|
||||
|
||||
// Display the colony names, if needed
|
||||
long t14 = now();
|
||||
|
@ -763,6 +761,13 @@ public final class MapViewer extends FreeColClientHolder {
|
|||
|
||||
|
||||
private void displayAreasInMapEditor(Graphics2D nonAnimationG2d, TileClippingBounds tcb) {
|
||||
if (!getFreeColClient().isMapEditor()) {
|
||||
return;
|
||||
}
|
||||
if (!getFreeColClient().getMapEditorController().isDisplayAreas()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Object oldAntialiasingHint = nonAnimationG2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
|
||||
nonAnimationG2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
|
||||
|
||||
|
|
|
@ -309,6 +309,14 @@ public abstract class FreeColPanel extends MigPanel implements ActionListener {
|
|||
public PopupPosition getFramePopupPosition() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows subclasses to execute code when the frame is closed
|
||||
* using the "X" button (in the map editor).
|
||||
*/
|
||||
public void onFrameClosing() {
|
||||
|
||||
}
|
||||
|
||||
// Interface ActionListener
|
||||
|
||||
|
|
|
@ -467,6 +467,7 @@ public final class MapEditorTransformPanel extends FreeColPanel {
|
|||
if (mt instanceof AssignAreaTransform) {
|
||||
getGUI().showFreeColPanel(chooseAreaModificationPanel, true, null, true);
|
||||
newMapTransform = null;
|
||||
ctlr.setDisplayAreas(true);
|
||||
}
|
||||
newMapTransform = mt;
|
||||
}
|
||||
|
|
|
@ -88,4 +88,10 @@ public final class ChooseAreaModificationPanel extends FreeColPanel {
|
|||
return Messages.message("mapEditor.chooseAreaModificationPanel.title");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFrameClosing() {
|
||||
super.onFrameClosing();
|
||||
getFreeColClient().getMapEditorController().setDisplayAreas(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue