Skip to content

Commit

Permalink
Merge branch 'master' into slim
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Pope committed Jun 23, 2020
2 parents 7e6f23b + bd2bea2 commit 91142a7
Show file tree
Hide file tree
Showing 24 changed files with 868 additions and 999 deletions.
49 changes: 47 additions & 2 deletions data/strings/FreeColMessages_be-tarask.properties

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions data/strings/FreeColMessages_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3023,6 +3023,29 @@ mapEditorTransformPanel.minorRiver=Ruisseau
mapEditorTransformPanel.changeRiverConnections=Ajouter/supprimer des connexions de rivières
mapEditorTransformPanel.setRiverStyle=Définir le style de rivière
mapEditorTransformPanel.resource=Modifier/supprimer des ressources
freecol.map.L_America_JsTheDude=<html>L Amérique<br><font size="-2">Par JsTheDude</font></html>
freecol.map.L_America_Mazim=<html>L Amérique<br>Par Mazim</html>
freecol.map.L_Asia_Mazim=<html>L Asie<br>Par Mazim</html>
freecol.map.L_PacificSouth_Mazim=<html>L Pacifique Sud<br>Par Mazim</html>
freecol.map.L_TheOldWorld_Mazim=<html>L L’Ancien Monde<br>Par Mazim</html>
freecol.map.M_Africa_Gilolat=<html>M Afrique<br>Par Gilolat</html>
freecol.map.M_Africa_Mazim=<html>M Afrique<br>Par Mazim</html>
freecol.map.M_America_Mazim=<html>M Amérique<br>Par Mazim</html>
freecol.map.M_AustraliaOceania_Mazim=<html>M Australie<br>Océanie<br>Par Mazim</html>
freecol.map.M_Caribbean_Piotrus=<html>M Bassin caribéen<br>Par Piotrus</html>
freecol.map.M_CaribbeanIslands_Mazim=<html>M Îles des Caraïbes<br>Par Mazim</html>
freecol.map.M_Eurasia_Mazim=<html>M Eurasie<br>Par Mazim</html>
freecol.map.M_NorthAmerica_Mazim=<html>M Amérique du nord 2<br>Par Mazim</html>
freecol.map.M_NorthAmerica2_Mazim=<html>M Nord<br>Amérique<br>Par Mazim</html>
freecol.map.M_SouthAmerica_Mazim=<html>M Sud<br>Amérique<br>Par Mazim</html>
freecol.map.S_Arabias_Mazim=<html>S Arabie<br>Par Mazim</html>
freecol.map.S_AustraliaOceania_Gilolat=<html>S Australie<br>Océanie<br>Par Gilolat</html>
freecol.map.S_Caribbean_Phil=<html>S Bassin caribéen<br>Par Phil</html>
freecol.map.S_FeudalJapan_Mazim=<html>S Japon féodal<br>Par Mazim</html>
freecol.map.S_SouthEastAsia_Mazim=<html>S Asie du sud-est<br>Par Mazim</html>
freecol.map.S_USA_Mazim=<html>S USA<br>Par Mazim</html>
freecol.map.XL_GigaEarth_Mazim=<html>XL Giga Terre<br>Par Mazim</html>
freecol.map.XXL_HugeWorld_Mazim=<html>XXL Monde immense<br>Par Mazim</html>
mapGeneratorOptionsDialog.badWidth=La largeur de la carte (%width%) est trop petite, inférieure à quatre fois la distance au bord (%edge%)
mapSizeDialog.mapSize=Sélectionner la taille de la carte
modifierFormat.unknown=???
Expand Down
5 changes: 5 additions & 0 deletions data/strings/FreeColMessages_pl_PL.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2938,6 +2938,11 @@ mapEditorTransformPanel.minorRiver=Mała rzeka
mapEditorTransformPanel.changeRiverConnections=Dodaj/usuń połączenia rzek
mapEditorTransformPanel.setRiverStyle=Ustaw styl rzek
mapEditorTransformPanel.resource=Zmień lub usuń surowce
freecol.map.L_PacificSouth_Mazim=<html>L Pacific South<br>Przez Mazim</html>
freecol.map.S_Arabias_Mazim=<html>S Arabias<br>Przez Mazim</html>
freecol.map.S_SouthEastAsia_Mazim=<html>S South East Asia<br>Przez Mazim</html>
freecol.map.S_USA_Mazim=<html>S USA<br>Przez Mazim</html>
freecol.map.XXL_HugeWorld_Mazim=<html>XXL Huge World<br>Przez Mazim</html>
mapSizeDialog.mapSize=Wybież rozmiar mapy
monarchDialog.default=Wiadomość od Korony
newPanel.editDifficulty=Edytuj stopień trudności
Expand Down
1 change: 1 addition & 0 deletions data/strings/FreeColMessages_pms.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2717,6 +2717,7 @@ report.colony.exploring.description=%colony% a l'avrìa dij benefissi a esploré
report.colony.exploring.summary.description=Nùmer total ëd casele ëd colònia ch'a l'avran dij benefissi da l'esplorassion për cost continent-sì.
report.colony.grow.description=Nùmer d'unità che la colònia a peul dësvlupé sensa danegé soa produssion
report.colony.grow.header=+
report.colony.growing.description=%colony% a peul chërse ëd {{plural:%amount%|one=un-a unità|other=%amount% unità}} sensa danegé soa produssion
report.continentalCongress.none=(gnun)
report.continentalCongress.recruiting=As assum
report.foreignAffair.congress=Pare fondador
Expand Down
3 changes: 2 additions & 1 deletion data/strings/FreeColMessages_qqq.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# Author: Nemo bis
# Author: Nike
# Author: Odisseus
# Author: Patriot Kur
# Author: Pierpao
# Author: Purodha
# Author: Robby
Expand Down Expand Up @@ -55,7 +56,7 @@ accept={{Identical|Accept}}\n\nThis means to agree to a proposed action.
all={{Identical|All}}
and={{Identical|And}}
browse={{Identical|Browse}}
cancel={{Identical|Cancel}}
cancel={{Identical|Ləğv karde}}
client={{Identical|Client}}
close=[[Image:Freecol-europe.png|thumb]]\n{{Identical|Close}}
color={{Identical|Color}}
Expand Down
23 changes: 23 additions & 0 deletions data/strings/FreeColMessages_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2948,6 +2948,29 @@ mapEditorTransformPanel.minorRiver=Küçük nehir
mapEditorTransformPanel.changeRiverConnections=Nehir bağlantıları ekle/kaldır
mapEditorTransformPanel.setRiverStyle=Nehir stilini ayarla
mapEditorTransformPanel.resource=Kaynağı değiştir/çıkar
freecol.map.L_America_JsTheDude=<html>L Amerika<br><font size="-2">JsTheDude tarafından</font></html>
freecol.map.L_America_Mazim=<html>L Amerika<br>Mazim tarafından</html>
freecol.map.L_Asia_Mazim=<html>L Asya<br>Mazim tarafından</html>
freecol.map.L_PacificSouth_Mazim=<html>L Güney Pasifik<br>Mazim tarafından</html>
freecol.map.L_TheOldWorld_Mazim=<html>L Eski Dünyası<br>Mazim tarafından</html>
freecol.map.M_Africa_Gilolat=<html>M Afrika<br>Gilolat tarafından</html>
freecol.map.M_Africa_Mazim=<html>M Afrika<br>Mazim tarafından</html>
freecol.map.M_America_Mazim=<html>M Amerika<br>Mazim tarafından</html>
freecol.map.M_AustraliaOceania_Mazim=<html>M Avustralya<br>Okyanusya<br>Mazim tarafından</html>
freecol.map.M_Caribbean_Piotrus=<html>M Karayip Havzası<br>Piotrus tarafından</html>
freecol.map.M_CaribbeanIslands_Mazim=<html>M Karayip Adaları<br>Mazim tarafından</html>
freecol.map.M_Eurasia_Mazim=<html>M Avrasya<br>Mazim tarafından</html>
freecol.map.M_NorthAmerica_Mazim=<html>M Kuzey Amerika 2<br>Mazim tarafından</html>
freecol.map.M_NorthAmerica2_Mazim=<html>M Kuzey<br>Amerika<br>Mazim tarafından</html>
freecol.map.M_SouthAmerica_Mazim=<html>M Güney<br>Amerika<br>Mazim tarafından</html>
freecol.map.S_Arabias_Mazim=<html>S Arabiler<br>Mazim tarafından</html>
freecol.map.S_AustraliaOceania_Gilolat=<html>S Avustralya<br>Okyanusya<br>Gilolat tarafından</html>
freecol.map.S_Caribbean_Phil=<html>S Karayip Havzası<br>Phil tarafından</html>
freecol.map.S_FeudalJapan_Mazim=<html>S Feodal Japonya<br>Mazim tarafından</html>
freecol.map.S_SouthEastAsia_Mazim=<html>S Güneydoğu Asya<br>Mazim tarafından</html>
freecol.map.S_USA_Mazim=<html>S ABD<br>Mazim tarafından</html>
freecol.map.XL_GigaEarth_Mazim=<html>XL Giga Dünya<br>Mazim tarafından</html>
freecol.map.XXL_HugeWorld_Mazim=<html>XXL Büyük Dünya<br>Mazim tarafından</html>
mapGeneratorOptionsDialog.badWidth=Harita genişliği (%width%) çok dar, kenar mesafesinin 4 katından az (%edge%)
mapSizeDialog.mapSize=Harita boyutu seç
modifierFormat.unknown=???
Expand Down
23 changes: 23 additions & 0 deletions data/strings/FreeColMessages_zh-hant.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2971,6 +2971,29 @@ mapEditorTransformPanel.minorRiver=小河
mapEditorTransformPanel.changeRiverConnections=添加/移除河流連結
mapEditorTransformPanel.setRiverStyle=設定河流樣式
mapEditorTransformPanel.resource=修改/刪除資源
freecol.map.L_America_JsTheDude=<html>大型美洲<br><font size="-2">出自 JsTheDude</font></html>
freecol.map.L_America_Mazim=<html>大型美洲<br><font size="-2">出自 Mazim</font></html>
freecol.map.L_Asia_Mazim=<html>大型亞洲<br>出自 Mazim</html>
freecol.map.L_PacificSouth_Mazim=<html>大型南太平洋<br>出自 Mazim</html>
freecol.map.L_TheOldWorld_Mazim=<html>大型舊大陸<br>出自 Mazim</html>
freecol.map.M_Africa_Gilolat=<html>中型非洲<br>出自 Gilolat</html>
freecol.map.M_Africa_Mazim=<html>中型非洲<br>出自 Mazim</html>
freecol.map.M_America_Mazim=<html>中型美洲<br>出自 Mazim</html>
freecol.map.M_AustraliaOceania_Mazim=<html>中型澳洲<br>大洋洲<br>出自 Mazim</html>
freecol.map.M_Caribbean_Piotrus=<html>中型加勒比海盆地<br>出自 Piotrus</html>
freecol.map.M_CaribbeanIslands_Mazim=<html>中型加勒比海群島<br>出自 Mazim</html>
freecol.map.M_Eurasia_Mazim=<html>中型歐亞大陸<br>出自 Mazim</html>
freecol.map.M_NorthAmerica_Mazim=<html>中型北美洲 2<br>出自 Mazim</html>
freecol.map.M_NorthAmerica2_Mazim=<html>中型北<br>美洲<br>出自 Mazim</html>
freecol.map.M_SouthAmerica_Mazim=<html>中型南<br>美洲<br>出自 Mazim</html>
freecol.map.S_Arabias_Mazim=<html>小型阿拉伯半島<br>出自 Mazim</html>
freecol.map.S_AustraliaOceania_Gilolat=<html>小型澳洲<br>大洋洲<br>出自 Gilolat</html>
freecol.map.S_Caribbean_Phil=<html>小型加勒比海盆地<br>出自 Phil</html>
freecol.map.S_FeudalJapan_Mazim=<html>小型封建時代日本<br>出自 Mazim</html>
freecol.map.S_SouthEastAsia_Mazim=<html>小型東南亞<br>出自 Mazim</html>
freecol.map.S_USA_Mazim=<html>小型美國<br>出自 Mazim</html>
freecol.map.XL_GigaEarth_Mazim=<html>加大型地球<br>出自 Mazim</html>
freecol.map.XXL_HugeWorld_Mazim=<html>特大型全世界<br>出自 Mazim</html>
mapGeneratorOptionsDialog.badWidth=地圖寬度(%width%)太狹窄了:它小於邊緣距離的四倍(%edge%)
mapSizeDialog.mapSize=選擇地圖大小
modifierFormat.unknown=???
Expand Down
19 changes: 8 additions & 11 deletions src/net/sf/freecol/client/control/ConnectController.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@

package net.sf.freecol.client.control;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import net.sf.freecol.FreeCol;
import net.sf.freecol.client.ClientOptions;
import net.sf.freecol.client.FreeColClient;
Expand All @@ -37,17 +44,7 @@
import net.sf.freecol.common.util.Utils;
import net.sf.freecol.server.FreeColServer;
import net.sf.freecol.server.FreeColServer.ServerState;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import static net.sf.freecol.common.util.CollectionUtils.alwaysTrue;
import static net.sf.freecol.common.util.CollectionUtils.makeUnmodifiableList;
import static net.sf.freecol.common.util.CollectionUtils.transform;
import static net.sf.freecol.common.util.CollectionUtils.*;


/**
Expand Down
116 changes: 64 additions & 52 deletions src/net/sf/freecol/client/gui/Canvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,11 @@ private static class ToolBoxFrame extends JInternalFrame {}
private FreeColFrame parentFrame;

/** Remember the current size (from getSize()), check for changes. */
private Dimension oldSize = null;
private Dimension oldSize;

/** The component that displays the map. */
private final MapViewer mapViewer;

/** The various sorts of map controls. */
private MapControls mapControls;

/** Has a goto operation started? */
private boolean gotoStarted = false;

Expand All @@ -163,6 +160,9 @@ private static class ToolBoxFrame extends JInternalFrame {}
/** The chat message area. */
private final ChatDisplay chatDisplay;

/** The various sorts of map controls. */
private MapControls mapControls;

/** The dialogs in view. */
private final List<FreeColDialog<?>> dialogs = new ArrayList<>();

Expand Down Expand Up @@ -201,10 +201,23 @@ public Canvas(final FreeColClient freeColClient,
this.parentFrame = createFrame(null, windowBounds);
this.oldSize = getSize();
this.mapViewer = mapViewer;
this.mapControls = null;
this.greyLayer = new GrayLayer(freeColClient);
this.chatDisplay = new ChatDisplay();

final String className = this.freeColClient.getClientOptions()
.getString(ClientOptions.MAP_CONTROLS);
final String panelName = "net.sf.freecol.client.gui.panel."
+ lastPart(className, ".");
try {
this.mapControls = (MapControls)Introspector.instantiate(panelName,
new Class[] { FreeColClient.class },
new Object[] { this.freeColClient });
logger.info("Instantiated " + panelName);
} catch (Introspector.IntrospectorException ie) {
logger.log(Level.WARNING, "Failed in make map controls for: "
+ panelName, ie);
}

setDoubleBuffered(true);
setOpaque(false);
setLayout(null);
Expand All @@ -218,6 +231,7 @@ public Canvas(final FreeColClient freeColClient,
startGamePanel = new StartGamePanel(freeColClient);
statusPanel = new StatusPanel(freeColClient);

enableMapControls(true);
mapViewer.startCursorBlinking();
logger.info("Canvas created woth bounds: " + windowBounds);
}
Expand Down Expand Up @@ -263,16 +277,21 @@ private void destroyFrame() {
}

/**
* Has the canvas been resized?
* If the canvas been resized, resize the map and reposition the
* map controls.
*
* @return The new {@code Dimension} for the canvas.
* @return The {@code Dimension} for the canvas.
*/
private Dimension checkResize() {
Dimension newSize = getSize();
if (this.oldSize.width == newSize.width
&& this.oldSize.height == newSize.height) return null;

this.oldSize = newSize;
if (this.oldSize.width != newSize.width
|| this.oldSize.height != newSize.height) {
logger.info("Canvas resized from " + this.oldSize
+ " to " + newSize);
this.oldSize = newSize;
updateMapControlsInCanvas();
mapViewer.changeSize(newSize);
}
return newSize;
}

Expand Down Expand Up @@ -939,67 +958,65 @@ public void toggleFrame() {
}

// Map controls


private void removeMapControls() {
for (Component c : this.mapControls.getComponents()) {
removeFromCanvas(c);
}
}

public boolean canZoomInMapControls() {
return mapControls != null && mapControls.canZoomInMapControls();
if (this.mapControls == null) return false;
return this.mapControls.canZoomInMapControls();
}

public boolean canZoomOutMapControls() {
return mapControls != null && mapControls.canZoomOutMapControls();
if (this.mapControls == null) return false;
return this.mapControls.canZoomOutMapControls();
}

public void enableMapControls(boolean enable) {
// Always instantiate in game.
if (enable && mapControls == null) {
String className = this.freeColClient.getClientOptions()
.getString(ClientOptions.MAP_CONTROLS);
final String panelName = "net.sf.freecol.client.gui.panel."
+ lastPart(className, ".");
try {
mapControls = (MapControls)Introspector.instantiate(panelName,
new Class[] { FreeColClient.class },
new Object[] { this.freeColClient });
mapControls.addToComponent(this);
mapControls.update();
logger.info("Instantiated " + panelName);
} catch (Introspector.IntrospectorException ie) {
logger.log(Level.WARNING, "Failed in make map controls for: "
+ panelName, ie);
if (this.mapControls == null) return;
if (enable) {
if (!this.mapControls.isShowing()) {
this.mapControls.addToComponent(this);
}
} else {
if (this.mapControls.isShowing()) {
removeMapControls();
}
} else if (!enable && mapControls != null) {
mapControls.removeFromComponent(this);
mapControls = null;
}
}

public void miniMapToggleViewControls() {
if (mapControls == null) return;
mapControls.toggleView();
if (this.mapControls == null) return;
this.mapControls.toggleView();
}

public void miniMapToggleFogOfWarControls() {
if (mapControls == null) return;
mapControls.toggleFogOfWar();
if (this.mapControls == null) return;
this.mapControls.toggleFogOfWar();
}

public void updateMapControls() {
if (mapControls != null) mapControls.update();
public void updateMapControls(Unit unit) {
if (this.mapControls == null) return;
this.mapControls.update(unit);
}

public void updateMapControlsInCanvas() {
if (mapControls == null) return;
mapControls.removeFromComponent(this);
mapControls.addToComponent(this);
if (this.mapControls == null) return;
removeMapControls();
this.mapControls.addToComponent(this);
}

public void zoomInMapControls() {
if (mapControls == null) return;
mapControls.zoomIn();
if (this.mapControls == null) return;
this.mapControls.zoomIn();
}

public void zoomOutMapControls() {
if (mapControls == null) return;
mapControls.zoomOut();
if (this.mapControls == null) return;
this.mapControls.zoomOut();
}

// Map viewer
Expand Down Expand Up @@ -1588,16 +1605,11 @@ public TradeRouteInputPanel showTradeRouteInputPanel(TradeRoute newRoute) {
*/
@Override
public void paintComponent(Graphics g) {
Dimension newSize = checkResize();
if (newSize != null) {
updateMapControlsInCanvas();
mapViewer.changeSize(newSize);
}
Dimension size = checkResize();
boolean hasMap = this.freeColClient != null
&& this.freeColClient.getGame() != null
&& this.freeColClient.getGame().getMap() != null;
Graphics2D g2d = (Graphics2D) g;
Dimension size = getSize();

if (freeColClient.isMapEditor()) {
if (hasMap) {
Expand Down
6 changes: 4 additions & 2 deletions src/net/sf/freecol/client/gui/FreeColFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public FreeColFrame(FreeColClient freeColClient, GraphicsDevice gd,
setMinimumSize(new Dimension(656 + insets.left + insets.right,
480 + insets.top + insets.bottom));

if(!windowed || bounds==null || bounds.width<=0 || bounds.height<=0) {
if (!windowed || bounds==null || bounds.width<=0 || bounds.height<=0) {
bounds = gd.getDefaultConfiguration().getBounds();
if (windowed) {
Insets screenInsets = Toolkit.getDefaultToolkit()
Expand All @@ -97,6 +97,7 @@ public FreeColFrame(FreeColClient freeColClient, GraphicsDevice gd,
}
setBounds(bounds);
logger.info("Frame created in size " + bounds.width + "x" + bounds.height);
/* TODO: this should do something useful!
if (windowed) {
addComponentListener(new ComponentAdapter() {
@Override
Expand All @@ -105,6 +106,7 @@ public void componentResized(ComponentEvent e) {
}
});
}
*/
}

public void exitFullScreen() {
Expand Down Expand Up @@ -144,5 +146,5 @@ public void updateMenuBar() {
*/
private static String getFrameName() {
return "FreeCol " + FreeCol.getVersion();
}
}
}
Loading

0 comments on commit 91142a7

Please sign in to comment.