KeplerBR

FreeCol - Improvements in minimap: add fog of war and politi

Oct 18th, 2013
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 38.28 KB | None | 0 0
  1.  .gitignore                                         |   6 +-
  2.  data/base/client-options.xml                       |   4 +
  3.  data/rules/classic/resources.properties            |  87 +++++++++++++++------
  4.  .../order-buttons/disabled/toggle_fog_of_war.png   | Bin 0 -> 2833 bytes
  5.  .../disabled/toggle_fog_of_war_no.png              | Bin 0 -> 2833 bytes
  6.  .../disabled/toggle_view_politics.png              | Bin 0 -> 2833 bytes
  7.  .../highlighted/toggle_fog_of_war.png              | Bin 0 -> 3916 bytes
  8.  .../highlighted/toggle_fog_of_war_no.png           | Bin 0 -> 4132 bytes
  9.  .../highlighted/toggle_view_economic.png           | Bin 0 -> 3551 bytes
  10.  .../highlighted/toggle_view_politics.png           | Bin 0 -> 3926 bytes
  11.  .../ui/order-buttons/normal/toggle_fog_of_war.png  | Bin 0 -> 3826 bytes
  12.  .../order-buttons/normal/toggle_fog_of_war_no.png  | Bin 0 -> 3858 bytes
  13.  .../order-buttons/normal/toggle_view_economic.png  | Bin 0 -> 3394 bytes
  14.  .../order-buttons/normal/toggle_view_politics.png  | Bin 0 -> 3405 bytes
  15.  .../ui/order-buttons/pressed/toggle_fog_of_war.png | Bin 0 -> 3826 bytes
  16.  .../order-buttons/pressed/toggle_fog_of_war_no.png | Bin 0 -> 3858 bytes
  17.  .../order-buttons/pressed/toggle_view_economic.png | Bin 0 -> 3394 bytes
  18.  .../order-buttons/pressed/toggle_view_politics.png | Bin 0 -> 3405 bytes
  19.  data/strings/FreeColMessages.properties            |  16 +++-
  20.  src/net/sf/freecol/client/ClientOptions.java       |  18 +++++
  21.  src/net/sf/freecol/client/gui/GUI.java             |  10 +++
  22.  .../freecol/client/gui/action/ActionManager.java   |   4 +
  23.  .../gui/action/MiniMapToggleFogOfWarAction.java    |  74 ++++++++++++++++++
  24.  .../client/gui/action/MiniMapToggleViewAction.java |  73 +++++++++++++++++
  25.  .../client/gui/panel/CornerMapControls.java        |   4 +
  26.  .../sf/freecol/client/gui/panel/MapControls.java   |  29 ++++++-
  27.  src/net/sf/freecol/client/gui/panel/MiniMap.java   |  59 ++++++++++++--
  28.  27 files changed, 348 insertions(+), 36 deletions(-)
  29.  
  30. diff --git a/.gitignore b/.gitignore
  31. index 06c44c6..f1b4fba 100644
  32. --- a/.gitignore
  33. +++ b/.gitignore
  34. @@ -8,4 +8,8 @@ FreeCol.log
  35.  FreeCol.jar
  36.  src/MANIFEST.MF
  37.  build/
  38. -doc/specification_*.html
  39. \ No newline at end of file
  40. +doc/specification_*.html
  41. +/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_fog_of_war.png
  42. +/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_fog_of_war_no.png
  43. +/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_fog_of_war.png
  44. +/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_fog_of_war_no.png
  45. diff --git a/data/base/client-options.xml b/data/base/client-options.xml
  46. index c4a58e8..e60089c 100644
  47. --- a/data/base/client-options.xml
  48. +++ b/data/base/client-options.xml
  49. @@ -65,6 +65,10 @@
  50.        <booleanOption id="model.option.smoothRendering" defaultValue="false"/>
  51.        <!-- Option to disable end turn grey background. -->
  52.        <booleanOption id="model.option.disableGrayLayer" defaultValue="false"/>
  53. +     <!-- If selected: Draws the fog of war on the minimap. -->
  54. +     <booleanOption id="model.option.miniMapToggleFogOfWar" defaultValue="true"/>
  55. +     <!-- If selected: Draws the borders on the minimap. -->
  56. +     <booleanOption id="model.option.miniMapToggleBorders" defaultValue="true"/>
  57.        <!-- The color to fill in around the actual map on the minimap. -->
  58.        <selectOption id="model.option.color.background" defaultValue="0" localizedLabels="true">
  59.          <selectValue label="clientOptions.minimap.color.background.black" value="0"/>
  60. diff --git a/data/rules/classic/resources.properties b/data/rules/classic/resources.properties
  61. index 794a01a..5d1c6dd 100644
  62. --- a/data/rules/classic/resources.properties
  63. +++ b/data/rules/classic/resources.properties
  64. @@ -39,6 +39,10 @@ orderButton.normal.build=resources/images/ui/order-buttons/normal/build.png
  65.  orderButton.normal.disband=resources/images/ui/order-buttons/normal/disband.png
  66.  orderButton.normal.zoom_in=resources/images/ui/order-buttons/normal/zoom_in.png
  67.  orderButton.normal.zoom_out=resources/images/ui/order-buttons/normal/zoom_out.png
  68. +orderButton.normal.toggle_fog_of_war=resources/images/ui/order-buttons/normal/toggle_fog_of_war.png
  69. +orderButton.normal.toggle_fog_of_war_no=resources/images/ui/order-buttons/normal/toggle_fog_of_war_no.png
  70. +orderButton.normal.toggle_view_politics=resources/images/ui/order-buttons/normal/toggle_view_politics.png
  71. +orderButton.normal.toggle_view_economic=resources/images/ui/order-buttons/normal/toggle_view_economic.png
  72.  orderButton.highlighted.wait=resources/images/ui/order-buttons/highlighted/wait.png
  73.  orderButton.highlighted.done=resources/images/ui/order-buttons/highlighted/done.png
  74.  orderButton.highlighted.fortify=resources/images/ui/order-buttons/highlighted/fortify.png
  75. @@ -50,6 +54,10 @@ orderButton.highlighted.build=resources/images/ui/order-buttons/highlighted/buil
  76.  orderButton.highlighted.disband=resources/images/ui/order-buttons/highlighted/disband.png
  77.  orderButton.highlighted.zoom_in=resources/images/ui/order-buttons/highlighted/zoom_in.png
  78.  orderButton.highlighted.zoom_out=resources/images/ui/order-buttons/highlighted/zoom_out.png
  79. +orderButton.highlighted.toggle_fog_of_war=resources/images/ui/order-buttons/highlighted/toggle_fog_of_war.png
  80. +orderButton.highlighted.toggle_fog_of_war_no=resources/images/ui/order-buttons/highlighted/toggle_fog_of_war_no.png
  81. +orderButton.highlighted.toggle_view_politics=resources/images/ui/order-buttons/highlighted/toggle_view_politics.png
  82. +orderButton.highlighted.toggle_view_economic=resources/images/ui/order-buttons/highlighted/toggle_view_economic.png
  83.  orderButton.pressed.wait=resources/images/ui/order-buttons/pressed/wait.png
  84.  orderButton.pressed.done=resources/images/ui/order-buttons/pressed/done.png
  85.  orderButton.pressed.fortify=resources/images/ui/order-buttons/pressed/fortify.png
  86. @@ -61,6 +69,10 @@ orderButton.pressed.build=resources/images/ui/order-buttons/pressed/build.png
  87.  orderButton.pressed.disband=resources/images/ui/order-buttons/pressed/disband.png
  88.  orderButton.pressed.zoom_in=resources/images/ui/order-buttons/pressed/zoom_in.png
  89.  orderButton.pressed.zoom_out=resources/images/ui/order-buttons/pressed/zoom_out.png
  90. +orderButton.pressed.toggle_fog_of_war=resources/images/ui/order-buttons/pressed/toggle_fog_of_war.png
  91. +orderButton.pressed.toggle_fog_of_war_no=resources/images/ui/order-buttons/pressed/toggle_fog_of_war_no.png
  92. +orderButton.pressed.toggle_view_politics=resources/images/ui/order-buttons/pressed/toggle_view_politics.png
  93. +orderButton.pressed.toggle_view_economic=resources/images/ui/order-buttons/pressed/toggle_view_economic.png
  94.  orderButton.disabled.wait=resources/images/ui/order-buttons/disabled/wait.png
  95.  orderButton.disabled.done=resources/images/ui/order-buttons/disabled/done.png
  96.  orderButton.disabled.fortify=resources/images/ui/order-buttons/disabled/fortify.png
  97. @@ -72,6 +84,10 @@ orderButton.disabled.build=resources/images/ui/order-buttons/disabled/build.png
  98.  orderButton.disabled.disband=resources/images/ui/order-buttons/disabled/disband.png
  99.  orderButton.disabled.zoom_in=resources/images/ui/order-buttons/disabled/zoom_in.png
  100.  orderButton.disabled.zoom_out=resources/images/ui/order-buttons/disabled/zoom_out.png
  101. +orderButton.disabled.toggle_fog_of_war=resources/images/ui/order-buttons/disabled/toggle_fog_of_war.png
  102. +orderButton.disabled.toggle_fog_of_war_no=resources/images/ui/order-buttons/disabled/toggle_fog_of_war_no.png
  103. +orderButton.disabled.toggle_view_politics=resources/images/ui/order-buttons/disabled/toggle_view_politics.png
  104. +orderButton.disabled.toggle_view_economic=resources/images/ui/order-buttons/disabled/toggle_view_economic.png
  105.  
  106.  # Video
  107.  Opening.video=resources/video/freecol-opening.video.ogg
  108. @@ -642,29 +658,54 @@ model.foundingFather.juanDeSepulveda.image=resources/images/foundingFathers/juan
  109.  # National Colors are in the spec
  110.  
  111.  # Tiles
  112. -model.tile.plains.color=urn:color:0x24801f
  113. -model.tile.grassland.color=urn:color:0x24801f
  114. -model.tile.prairie.color=urn:color:0x24801f
  115. -model.tile.savannah.color=urn:color:0x24801f
  116. -model.tile.marsh.color=urn:color:0x24803d
  117. -model.tile.swamp.color=urn:color:0x24803d
  118. -model.tile.desert.color=urn:color:0x63732b
  119. -model.tile.tundra.color=urn:color:0x639e5e
  120. -model.tile.mixedForest.color=urn:color:0x24731f
  121. -model.tile.coniferForest.color=urn:color:0x24731f
  122. -model.tile.broadleafForest.color=urn:color:0x24731f
  123. -model.tile.tropicalForest.color=urn:color:0x24731f
  124. -model.tile.wetlandForest.color=urn:color:0x24731f
  125. -model.tile.rainForest.color=urn:color:0x24731f
  126. -model.tile.scrubForest.color=urn:color:0x24731f
  127. -model.tile.borealForest.color=urn:color:0x24731f
  128. -model.tile.hills.color=urn:color:0x708052
  129. -model.tile.mountains.color=urn:color:0x577352
  130. -model.tile.arctic.color=urn:color:0xffffff
  131. -model.tile.ocean.color=urn:color:0x600000ff
  132. -model.tile.lake.color=urn:color:0x46436d
  133. -model.tile.highSeas.color=urn:color:0x300000ff
  134. -model.tile.greatRiver.color=urn:color:0x555187
  135. +model.tile.plains.economicColor=urn:color:0x24801f
  136. +model.tile.grassland.economicColor=urn:color:0x24801f
  137. +model.tile.prairie.economicColor=urn:color:0x24801f
  138. +model.tile.savannah.economicColor=urn:color:0x24801f
  139. +model.tile.marsh.economicColor=urn:color:0x24803d
  140. +model.tile.swamp.economicColor=urn:color:0x24803d
  141. +model.tile.desert.economicColor=urn:color:0x63732b
  142. +model.tile.tundra.economicColor=urn:color:0x639e5e
  143. +model.tile.mixedForest.economicColor=urn:color:0x24731f
  144. +model.tile.coniferForest.economicColor=urn:color:0x24731f
  145. +model.tile.broadleafForest.economicColor=urn:color:0x24731f
  146. +model.tile.tropicalForest.economicColor=urn:color:0x24731f
  147. +model.tile.wetlandForest.economicColor=urn:color:0x24731f
  148. +model.tile.rainForest.economicColor=urn:color:0x24731f
  149. +model.tile.scrubForest.economicColor=urn:color:0x24731f
  150. +model.tile.borealForest.economicColor=urn:color:0x24731f
  151. +model.tile.hills.economicColor=urn:color:0x708052
  152. +model.tile.mountains.economicColor=urn:color:0x577352
  153. +model.tile.arctic.economicColor=urn:color:0xffffff
  154. +model.tile.ocean.economicColor=urn:color:0x600000ff
  155. +model.tile.lake.economicColor=urn:color:0x46436d
  156. +model.tile.highSeas.economicColor=urn:color:0x300000ff
  157. +model.tile.greatRiver.economicColor=urn:color:0x555187
  158. +
  159. +model.tile.plains.politicsColor=urn:color:0x24801f
  160. +model.tile.grassland.politicsColor=urn:color:0x24801f
  161. +model.tile.prairie.politicsColor=urn:color:0x24801f
  162. +model.tile.savannah.politicsColor=urn:color:0x24801f
  163. +model.tile.marsh.politicsColor=urn:color:0x24801f
  164. +model.tile.swamp.politicsColor=urn:color:0x24801f
  165. +model.tile.desert.politicsColor=urn:color:0x24801f
  166. +model.tile.tundra.politicsColor=urn:color:0x24801f
  167. +model.tile.mixedForest.politicsColor=urn:color:0x24801f
  168. +model.tile.coniferForest.politicsColor=urn:color:0x24801f
  169. +model.tile.broadleafForest.politicsColor=urn:color:0x24801f
  170. +model.tile.tropicalForest.politicsColor=urn:color:0x24801f
  171. +model.tile.wetlandForest.politicsColor=urn:color:0x24801f
  172. +model.tile.rainForest.politicsColor=urn:color:0x24801f
  173. +model.tile.scrubForest.politicsColor=urn:color:0x24801f
  174. +model.tile.borealForest.politicsColor=urn:color:0x24801f
  175. +model.tile.hills.politicsColor=urn:color:0x24801f
  176. +model.tile.mountains.politicsColor=urn:color:0x24801f
  177. +model.tile.arctic.politicsColor=urn:color:0x24801f
  178. +model.tile.ocean.politicsColor=urn:color:0x9696f2
  179. +model.tile.lake.politicsColor=urn:color:0x9696f2
  180. +model.tile.highSeas.politicsColor=urn:color:0x44446e
  181. +model.tile.greatRiver.politicsColor=urn:color:0x9696f2
  182. +
  183.  model.tile.arctic.center0.image=resources/images/terrain/arctic/center0.png
  184.  model.tile.arctic.center1.image=resources/images/terrain/arctic/center1.png
  185.  model.tile.arctic.border_N_even.image=resources/images/terrain/arctic/border_N_even.png
  186. diff --git a/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_fog_of_war.png b/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_fog_of_war.png
  187. new file mode 100644
  188. index 0000000..5a66c4f
  189. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_fog_of_war.png differ
  190. diff --git a/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_fog_of_war_no.png b/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_fog_of_war_no.png
  191. new file mode 100644
  192. index 0000000..5a66c4f
  193. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_fog_of_war_no.png differ
  194. diff --git a/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_view_politics.png b/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_view_politics.png
  195. new file mode 100644
  196. index 0000000..5a66c4f
  197. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/disabled/toggle_view_politics.png differ
  198. diff --git a/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_fog_of_war.png b/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_fog_of_war.png
  199. new file mode 100644
  200. index 0000000..a79d951
  201. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_fog_of_war.png differ
  202. diff --git a/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_fog_of_war_no.png b/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_fog_of_war_no.png
  203. new file mode 100644
  204. index 0000000..f34db58
  205. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_fog_of_war_no.png differ
  206. diff --git a/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_view_economic.png b/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_view_economic.png
  207. new file mode 100644
  208. index 0000000..4f33e3a
  209. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_view_economic.png differ
  210. diff --git a/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_view_politics.png b/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_view_politics.png
  211. new file mode 100644
  212. index 0000000..58a1ed7
  213. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/highlighted/toggle_view_politics.png differ
  214. diff --git a/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_fog_of_war.png b/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_fog_of_war.png
  215. new file mode 100644
  216. index 0000000..7ff9e75
  217. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_fog_of_war.png differ
  218. diff --git a/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_fog_of_war_no.png b/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_fog_of_war_no.png
  219. new file mode 100644
  220. index 0000000..dd02aca
  221. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_fog_of_war_no.png differ
  222. diff --git a/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_view_economic.png b/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_view_economic.png
  223. new file mode 100644
  224. index 0000000..04277ae
  225. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_view_economic.png differ
  226. diff --git a/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_view_politics.png b/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_view_politics.png
  227. new file mode 100644
  228. index 0000000..d2d8f5b
  229. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/normal/toggle_view_politics.png differ
  230. diff --git a/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_fog_of_war.png b/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_fog_of_war.png
  231. new file mode 100644
  232. index 0000000..7ff9e75
  233. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_fog_of_war.png differ
  234. diff --git a/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_fog_of_war_no.png b/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_fog_of_war_no.png
  235. new file mode 100644
  236. index 0000000..dd02aca
  237. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_fog_of_war_no.png differ
  238. diff --git a/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_view_economic.png b/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_view_economic.png
  239. new file mode 100644
  240. index 0000000..04277ae
  241. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_view_economic.png differ
  242. diff --git a/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_view_politics.png b/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_view_politics.png
  243. new file mode 100644
  244. index 0000000..d2d8f5b
  245. Binary files /dev/null and b/data/rules/classic/resources/images/ui/order-buttons/pressed/toggle_view_politics.png differ
  246. diff --git a/data/strings/FreeColMessages.properties b/data/strings/FreeColMessages.properties
  247. index 5c79173..ac531fc 100644
  248. --- a/data/strings/FreeColMessages.properties
  249. +++ b/data/strings/FreeColMessages.properties
  250. @@ -341,9 +341,9 @@ menuBar.report=Report
  251.  menuBar.statusLine=Score: %score%    |    Gold: %gold%    |    Tax: %tax%%    |    Year: %year%
  252.  
  253.  findSettlementDialog.name=Find Settlement
  254. -findSettlementDialog.displayAll=Find all settlements
  255. -findSettlementDialog.displayOnlyNatives=Find only native settlements
  256. -findSettlementDialog.displayOnlyEuropean=Find only European settlements
  257. +findSettlementDialog.displayAll=Find all settlement
  258. +findSettlementDialog.displayOnlyNatives=Find only settlement native
  259. +findSettlementDialog.displayOnlyEuropean=Find only settlement european
  260.  
  261.  metaServer.couldNotConnect=Sorry, could not connect to the meta-server. Please try again later.
  262.  metaServer.communicationError=There was an error while communicating with the meta-server. Please try again later.
  263. @@ -820,6 +820,10 @@ model.option.defaultZoomLevel.name=Default zoom level
  264.  model.option.defaultZoomLevel.shortDescription=Which default zoom level the minimap uses.
  265.  model.option.color.background.name=Background Color
  266.  model.option.color.background.shortDescription=When the minimap is fully zoomed-out, this color surrounds the map and fog-of-war.
  267. +model.option.miniMapToggleBorders.name=Toogle borders on the minimap
  268. +model.option.miniMapToggleBorders.shortDescription=If selected: Draws the borders on the minimap.
  269. +model.option.miniMapToggleFogOfWar.name=Toogle fog of war on the minimap
  270. +model.option.miniMapToggleFogOfWar.shortDescription=If selected: Draws the fog of war on the minimap.
  271.  clientOptions.minimap.color.background.black=Black
  272.  clientOptions.minimap.color.background.gray.dark.very=Very Dark Gray
  273.  clientOptions.minimap.color.background.gray.dark=Dark Gray
  274. @@ -1103,10 +1107,10 @@ indianDemand.food.no=Alas, our warehouses are empty.
  275.  indianDemand.gold.text=The colonists of %colony% have committed innumerable atrocities against the %nation%. Now we demand %amount% gold in reparation.
  276.  indianDemand.gold.yes=Accept
  277.  indianDemand.gold.no=Begone, thieves!
  278. +
  279.  indianDemand.other.text=The colonists of %colony% have committed innumerable atrocities against the %nation%. Now we demand %amount% %goods% in reparation.
  280.  indianDemand.other.yes=Accept
  281.  indianDemand.other.no=Begone, thieves!
  282. -
  283.  exploreLostCityRumour.text=Really explore the ruins of a lost city?
  284.  exploreMoundsRumour.text=You discover some strange mounds. Do you really want to explore them?
  285.  exploreLostCityRumour.yes=What could go wrong?
  286. @@ -1488,6 +1492,10 @@ miniMapZoomOutAction.name=Zoom out MiniMap
  287.  miniMapZoomOutAction.accelerator=control MINUS
  288.  miniMapZoomOutAction.secondary.name=Zoom out MiniMap (secondary)
  289.  miniMapZoomOutAction.secondary.accelerator=control SUBTRACT
  290. +miniMapToggleBordersAction.name=Toggle the view between political and economic
  291. +miniMapToggleBordersAction.secondary.name=Toggle the view between political and economic (secondary)
  292. +miniMapToggleFogOfWarAction.name=Toggle fog of war
  293. +miniMapToggleFogOfWarAction.secondary.name=Toggle fog of war (secondary)
  294.  moveAction.E.accelerator=NUMPAD6
  295.  moveAction.E.name=Move East
  296.  moveAction.E.secondary.accelerator=RIGHT
  297. diff --git a/src/net/sf/freecol/client/ClientOptions.java b/src/net/sf/freecol/client/ClientOptions.java
  298. index faa2d98..d87e19f 100644
  299. --- a/src/net/sf/freecol/client/ClientOptions.java
  300. +++ b/src/net/sf/freecol/client/ClientOptions.java
  301. @@ -232,6 +232,18 @@ public class ClientOptions extends OptionGroup {
  302.          = "model.option.disableGrayLayer";
  303.  
  304.      /**
  305. +     * If selected: Draws the borders on the minimap.
  306. +     */
  307. +    public static final String MINIMAP_TOGGLE_BORDERS
  308. +        = "model.option.miniMapToggleBorders";
  309. +    
  310. +    /**
  311. +     * If selected: Draws the fog of war on the minimap.
  312. +     */
  313. +    public static final String MINIMAP_TOGGLE_FOG_OF_WAR
  314. +        = "model.option.miniMapToggleFogOfWar";
  315. +    
  316. +    /**
  317.       * The color to fill in around the actual map on the
  318.       * minimap.  Typically only visible when the minimap is at full
  319.       * zoom-out, but at the default 'black' you can't differentiate
  320. @@ -846,6 +858,12 @@ public class ClientOptions extends OptionGroup {
  321.          addBooleanOption(REMEMBER_PANEL_SIZES,
  322.              "clientOptions.gui", true);
  323.          // end @compat 0.10.7
  324. +        // @compact 0.10.8
  325. +        addBooleanOption(MINIMAP_TOGGLE_BORDERS,
  326. +            "clientOptions.gui", true);    
  327. +        addBooleanOption(MINIMAP_TOGGLE_FOG_OF_WAR,
  328. +            "clientOptions.gui", true);
  329. +        // end @compact 0.10.8
  330.      }
  331.  
  332.      private void addBooleanOption(String id, String gr, boolean val) {
  333. diff --git a/src/net/sf/freecol/client/gui/GUI.java b/src/net/sf/freecol/client/gui/GUI.java
  334. index 8e7a186..11f9975 100644
  335. --- a/src/net/sf/freecol/client/gui/GUI.java
  336. +++ b/src/net/sf/freecol/client/gui/GUI.java
  337. @@ -999,6 +999,16 @@ public class GUI {
  338.      public boolean canZoomOutMapControls() {
  339.          return mapControls != null && mapControls.canZoomOutMapControls();
  340.      }
  341. +    
  342. +    public void miniMapToggleViewControls() {
  343. +        if (mapControls == null) return;
  344. +        mapControls.toggleView();
  345. +    }
  346. +    
  347. +    public void miniMapToggleFogOfWarControls() {
  348. +        if (mapControls == null) return;
  349. +        mapControls.toogleFogOfWar();
  350. +    }
  351.  
  352.  
  353.      // Trivial delegations to Canvas
  354. diff --git a/src/net/sf/freecol/client/gui/action/ActionManager.java b/src/net/sf/freecol/client/gui/action/ActionManager.java
  355. index 474ecb2..0e6e759 100644
  356. --- a/src/net/sf/freecol/client/gui/action/ActionManager.java
  357. +++ b/src/net/sf/freecol/client/gui/action/ActionManager.java
  358. @@ -100,6 +100,10 @@ public class ActionManager extends OptionGroup {
  359.          add(new LoadAction(freeColClient));
  360.          add(new MapControlsAction(freeColClient));
  361.          add(new MapEditorAction(freeColClient));
  362. +        add(new MiniMapToggleViewAction(freeColClient));
  363. +        add(new MiniMapToggleViewAction(freeColClient, true));
  364. +        add(new MiniMapToggleFogOfWarAction(freeColClient));
  365. +        add(new MiniMapToggleFogOfWarAction(freeColClient, true));
  366.          add(new MiniMapZoomInAction(freeColClient));
  367.          add(new MiniMapZoomInAction(freeColClient, true));
  368.          add(new MiniMapZoomOutAction(freeColClient));
  369. diff --git a/src/net/sf/freecol/client/gui/action/MiniMapToggleFogOfWarAction.java b/src/net/sf/freecol/client/gui/action/MiniMapToggleFogOfWarAction.java
  370. new file mode 100644
  371. index 0000000..12b62b3
  372. --- /dev/null
  373. +++ b/src/net/sf/freecol/client/gui/action/MiniMapToggleFogOfWarAction.java
  374. @@ -0,0 +1,74 @@
  375. +/**
  376. + *  Copyright (C) 2002-2013   The FreeCol Team
  377. + *
  378. + *  This file is part of FreeCol.
  379. + *
  380. + *  FreeCol is free software: you can redistribute it and/or modify
  381. + *  it under the terms of the GNU General Public License as published by
  382. + *  the Free Software Foundation, either version 2 of the License, or
  383. + *  (at your option) any later version.
  384. + *
  385. + *  FreeCol is distributed in the hope that it will be useful,
  386. + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  387. + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  388. + *  GNU General Public License for more details.
  389. + *
  390. + *  You should have received a copy of the GNU General Public License
  391. + *  along with FreeCol.  If not, see <http://www.gnu.org/licenses/>.
  392. + */
  393. +
  394. +package net.sf.freecol.client.gui.action;
  395. +
  396. +import java.awt.event.ActionEvent;
  397. +import net.sf.freecol.client.ClientOptions;
  398. +
  399. +import net.sf.freecol.client.FreeColClient;
  400. +
  401. +
  402. +/**
  403. + * An action for enable/disable fog of war in on the minimap.
  404. + */
  405. +public class MiniMapToggleFogOfWarAction extends MapboardAction {
  406. +
  407. +    public static final String id = "miniMapToggleFogOfWarAction";
  408. +
  409. +
  410. +    /**
  411. +     * Creates a new <code>MiniMapToggleFogAction</code>.
  412. +     *
  413. +     * @param freeColClient The <code>FreeColClient</code> for the game.
  414. +     */
  415. +    public MiniMapToggleFogOfWarAction(FreeColClient freeColClient) {
  416. +        super(freeColClient, id);
  417. +        
  418. +        addImageIcons("toggle_fog_of_war");
  419. +    }
  420. +
  421. +    /**
  422. +     * Creates a new <code>MiniMapToggleFogAction</code>.
  423. +     *
  424. +     * @param freeColClient The <code>FreeColClient</code> for the game.
  425. +     * @param b a <code>boolean</code> value
  426. +     */
  427. +    public MiniMapToggleFogOfWarAction(FreeColClient freeColClient, boolean b) {
  428. +        super(freeColClient, id + ".secondary");
  429. +
  430. +        addImageIcons("toggle_fog_of_war");
  431. +    }
  432. +    
  433. +    // Interface ActionListener
  434. +
  435. +    /**
  436. +     * {@inheritDoc}
  437. +     */
  438. +    public void actionPerformed(ActionEvent e) {
  439. +        getGUI().miniMapToggleFogOfWarControls();
  440. +
  441. +        if (freeColClient.getClientOptions().getBoolean(ClientOptions.MINIMAP_TOGGLE_FOG_OF_WAR)) {
  442. +            addImageIcons("toggle_fog_of_war");
  443. +        } else {
  444. +            addImageIcons("toggle_fog_of_war_no");
  445. +        }
  446. +    }
  447. +}
  448. +
  449. diff --git a/src/net/sf/freecol/client/gui/action/MiniMapToggleViewAction.java b/src/net/sf/freecol/client/gui/action/MiniMapToggleViewAction.java
  450. new file mode 100644
  451. index 0000000..770767e
  452. --- /dev/null
  453. +++ b/src/net/sf/freecol/client/gui/action/MiniMapToggleViewAction.java
  454. @@ -0,0 +1,73 @@
  455. +/**
  456. + *  Copyright (C) 2002-2013   The FreeCol Team
  457. + *
  458. + *  This file is part of FreeCol.
  459. + *
  460. + *  FreeCol is free software: you can redistribute it and/or modify
  461. + *  it under the terms of the GNU General Public License as published by
  462. + *  the Free Software Foundation, either version 2 of the License, or
  463. + *  (at your option) any later version.
  464. + *
  465. + *  FreeCol is distributed in the hope that it will be useful,
  466. + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  467. + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  468. + *  GNU General Public License for more details.
  469. + *
  470. + *  You should have received a copy of the GNU General Public License
  471. + *  along with FreeCol.  If not, see <http://www.gnu.org/licenses/>.
  472. + */
  473. +
  474. +package net.sf.freecol.client.gui.action;
  475. +
  476. +import java.awt.event.ActionEvent;
  477. +import net.sf.freecol.client.ClientOptions;
  478. +
  479. +import net.sf.freecol.client.FreeColClient;
  480. +
  481. +
  482. +/**
  483. + * Change view in on the minimap.
  484. + */
  485. +public class MiniMapToggleViewAction extends MapboardAction {
  486. +    
  487. +    public static final String id = "miniMapToggleBordersAction";
  488. +    
  489. +    
  490. +    /**
  491. +     * Creates a new <code>MiniMapToggleViewAction</code>.
  492. +     *
  493. +     * @param freeColClient The <code>FreeColClient</code> for the game.
  494. +     */
  495. +    public MiniMapToggleViewAction(FreeColClient freeColClient) {
  496. +        super(freeColClient, id);
  497. +
  498. +        addImageIcons("toggle_view_politics");
  499. +    }
  500. +
  501. +    /**
  502. +     * Creates a new <code>MiniMapToggleViewAction</code>.
  503. +     *
  504. +     * @param freeColClient The <code>FreeColClient</code> for the game.
  505. +     * @param b a <code>boolean</code> value
  506. +     */
  507. +    public MiniMapToggleViewAction(FreeColClient freeColClient, boolean b) {
  508. +        super(freeColClient, id + ".secondary");
  509. +
  510. +        addImageIcons("toggle_view_politics");
  511. +    }
  512. +
  513. +    // Interface ActionListener
  514. +
  515. +    /**
  516. +     * {@inheritDoc}
  517. +     */
  518. +    public void actionPerformed(ActionEvent e) {
  519. +        getGUI().miniMapToggleViewControls();
  520. +
  521. +        if (freeColClient.getClientOptions().getBoolean(ClientOptions.MINIMAP_TOGGLE_BORDERS)) {
  522. +            addImageIcons("toggle_view_politics");
  523. +        } else {
  524. +            addImageIcons("toggle_view_economic");
  525. +        }
  526. +    }
  527. +}
  528. diff --git a/src/net/sf/freecol/client/gui/panel/CornerMapControls.java b/src/net/sf/freecol/client/gui/panel/CornerMapControls.java
  529. index 2227eb0..c08ddd6 100644
  530. --- a/src/net/sf/freecol/client/gui/panel/CornerMapControls.java
  531. +++ b/src/net/sf/freecol/client/gui/panel/CornerMapControls.java
  532. @@ -113,6 +113,8 @@ public final class CornerMapControls extends MapControls {
  533.          miniMapPanel.setLayout(null);
  534.          miniMap.setSize(MAP_WIDTH, MAP_HEIGHT);
  535.          // Add buttons:
  536. +        miniMapPanel.add(miniMapToggleBorders);
  537. +        miniMapPanel.add(miniMapToggleFogOfWarButton);
  538.          miniMapPanel.add(miniMapZoomInButton);
  539.          miniMapPanel.add(miniMapZoomOutButton);
  540.          miniMapPanel.add(miniMap);
  541. @@ -125,6 +127,8 @@ public final class CornerMapControls extends MapControls {
  542.              // TODO-LATER: The values below should be specified by a
  543.              // skin-configuration-file.
  544.              miniMap.setLocation(38, 75);
  545. +            miniMapToggleBorders.setLocation(4,114);
  546. +            miniMapToggleFogOfWarButton.setLocation(4, 144);
  547.              miniMapZoomInButton.setLocation(4, 174);
  548.              miniMapZoomOutButton.setLocation(264, 174);
  549.          } else {
  550. diff --git a/src/net/sf/freecol/client/gui/panel/MapControls.java b/src/net/sf/freecol/client/gui/panel/MapControls.java
  551. index c8b8e4e..7aa5121 100644
  552. --- a/src/net/sf/freecol/client/gui/panel/MapControls.java
  553. +++ b/src/net/sf/freecol/client/gui/panel/MapControls.java
  554. @@ -23,6 +23,8 @@ import java.util.ArrayList;
  555.  import java.util.List;
  556.  
  557.  import javax.swing.JLayeredPane;
  558. +import net.sf.freecol.client.ClientOptions;
  559. +import static net.sf.freecol.client.ClientOptions.MINIMAP_TOGGLE_FOG_OF_WAR;
  560.  
  561.  import net.sf.freecol.client.FreeColClient;
  562.  import net.sf.freecol.client.gui.Canvas;
  563. @@ -32,6 +34,8 @@ import net.sf.freecol.client.gui.action.BuildColonyAction;
  564.  import net.sf.freecol.client.gui.action.DisbandUnitAction;
  565.  import net.sf.freecol.client.gui.action.FortifyAction;
  566.  import net.sf.freecol.client.gui.action.FreeColAction;
  567. +import net.sf.freecol.client.gui.action.MiniMapToggleViewAction;
  568. +import net.sf.freecol.client.gui.action.MiniMapToggleFogOfWarAction;
  569.  import net.sf.freecol.client.gui.action.MiniMapZoomInAction;
  570.  import net.sf.freecol.client.gui.action.MiniMapZoomOutAction;
  571.  import net.sf.freecol.client.gui.action.SentryAction;
  572. @@ -64,6 +68,8 @@ public abstract class MapControls {
  573.      protected final FreeColClient freeColClient;
  574.      protected final InfoPanel infoPanel;
  575.      protected MiniMap miniMap;
  576. +    protected final UnitButton miniMapToggleBorders;
  577. +    protected final UnitButton miniMapToggleFogOfWarButton;
  578.      protected final UnitButton miniMapZoomOutButton;
  579.      protected final UnitButton miniMapZoomInButton;
  580.      protected final List<UnitButton> unitButtons;
  581. @@ -103,10 +109,13 @@ public abstract class MapControls {
  582.              unitButtons.add(new UnitButton(am, BuildColonyAction.id));
  583.              unitButtons.add(new UnitButton(am, DisbandUnitAction.id));
  584.          }
  585. -
  586. +        miniMapToggleBorders = new UnitButton(am, MiniMapToggleViewAction.id);
  587. +        miniMapToggleFogOfWarButton = new UnitButton(am, MiniMapToggleFogOfWarAction.id);
  588.          miniMapZoomOutButton = new UnitButton(am, MiniMapZoomOutAction.id);
  589.          miniMapZoomInButton = new UnitButton(am, MiniMapZoomInAction.id);
  590.  
  591. +        miniMapToggleBorders.setFocusable(false);
  592. +        miniMapToggleFogOfWarButton.setFocusable(false);
  593.          miniMapZoomOutButton.setFocusable(false);
  594.          miniMapZoomInButton.setFocusable(false);
  595.  
  596. @@ -187,5 +196,23 @@ public abstract class MapControls {
  597.          miniMap.zoomOut();
  598.          repaint();
  599.      }
  600. +    
  601. +    public void toggleView() {
  602. +        if (freeColClient.getClientOptions().getBoolean(ClientOptions.MINIMAP_TOGGLE_BORDERS)) {
  603. +            miniMap.setToogleBordersOption(false);
  604. +        } else {
  605. +            miniMap.setToogleBordersOption(true);
  606. +        }
  607. +        repaint();
  608. +    }
  609. +    
  610. +    public void toogleFogOfWar() {
  611. +        if (freeColClient.getClientOptions().getBoolean(ClientOptions.MINIMAP_TOGGLE_FOG_OF_WAR)) {
  612. +            miniMap.setToogleFogOfWarOption(false);
  613. +        } else {
  614. +            miniMap.setToogleFogOfWarOption(true);
  615. +        }
  616. +        repaint();
  617. +    }
  618.  
  619.  }
  620. diff --git a/src/net/sf/freecol/client/gui/panel/MiniMap.java b/src/net/sf/freecol/client/gui/panel/MiniMap.java
  621. index d7232e8..6b5daa9 100644
  622. --- a/src/net/sf/freecol/client/gui/panel/MiniMap.java
  623. +++ b/src/net/sf/freecol/client/gui/panel/MiniMap.java
  624. @@ -34,10 +34,18 @@ import javax.swing.JPanel;
  625.  import javax.swing.event.MouseInputListener;
  626.  
  627.  import net.sf.freecol.client.ClientOptions;
  628. +import static net.sf.freecol.client.ClientOptions.MINIMAP_TOGGLE_BORDERS;
  629. +import static net.sf.freecol.client.ClientOptions.MINIMAP_TOGGLE_FOG_OF_WAR;
  630.  import net.sf.freecol.client.FreeColClient;
  631.  import net.sf.freecol.client.gui.GUI;
  632.  import net.sf.freecol.client.gui.ImageLibrary;
  633. +import net.sf.freecol.client.gui.MapViewer;
  634.  import net.sf.freecol.common.model.Map;
  635. +import static net.sf.freecol.common.model.Map.Direction.N;
  636. +import static net.sf.freecol.common.model.Map.Direction.E;
  637. +import static net.sf.freecol.common.model.Map.Direction.S;
  638. +import static net.sf.freecol.common.model.Map.Direction.W;
  639. +import net.sf.freecol.common.model.Player;
  640.  import net.sf.freecol.common.model.Tile;
  641.  import net.sf.freecol.common.model.TileType;
  642.  import net.sf.freecol.common.model.Unit;
  643. @@ -158,7 +166,14 @@ public final class MiniMap extends JPanel implements MouseInputListener {
  644.          freeColClient.getClientOptions().setInteger(ClientOptions.DEFAULT_MINIMAP_ZOOM, zoom);
  645.      }
  646.  
  647. -
  648. +    public void setToogleBordersOption(boolean toggle) {
  649. +        freeColClient.getClientOptions().setBoolean(MINIMAP_TOGGLE_BORDERS, toggle);
  650. +    }
  651. +    
  652. +    public void setToogleFogOfWarOption(boolean toggle) {
  653. +        freeColClient.getClientOptions().setBoolean(MINIMAP_TOGGLE_FOG_OF_WAR, toggle);
  654. +    }
  655. +    
  656.      /**
  657.       * Paints this component.
  658.       * @param graphics The <code>Graphics</code> context in which
  659. @@ -175,11 +190,15 @@ public final class MiniMap extends JPanel implements MouseInputListener {
  660.          paintMap(graphics);
  661.       }
  662.  
  663. -    private Color getMinimapColor(TileType type) {
  664. -        return ResourceManager.getColor(type.getId() + ".color");
  665. +    private Color getMinimapEconomicColor(TileType type) {
  666. +        return ResourceManager.getColor(type.getId() + ".economicColor");
  667.      }
  668.  
  669. -
  670. +    private Color getMinimapPoliticsColor(TileType type) {
  671. +        return ResourceManager.getColor(type.getId() + ".politicsColor");
  672. +    }
  673. +    
  674. +    
  675.      /**
  676.       * Paints a representation of the mapboard onto this component.
  677.       * @param graphics The <code>Graphics</code> context in which
  678. @@ -265,12 +284,18 @@ public final class MiniMap extends JPanel implements MouseInputListener {
  679.          tilePath.lineTo(halfWidth, tileHeight);
  680.          tilePath.lineTo(0, halfHeight);
  681.          tilePath.closePath();
  682. +        
  683.          GeneralPath settlementPath = new GeneralPath(tilePath);
  684.          settlementPath.transform(AffineTransform.getScaleInstance(0.7, 0.7));
  685.          settlementPath.transform(AffineTransform.getTranslateInstance(0.15 * tileWidth, 0.15 * tileHeight));
  686. +        
  687.          GeneralPath unitPath = new GeneralPath(tilePath);
  688.          unitPath.transform(AffineTransform.getScaleInstance(0.5, 0.5));
  689.          unitPath.transform(AffineTransform.getTranslateInstance(0.25 * tileWidth, 0.25 * tileHeight));
  690. +        
  691. +        GeneralPath paintFull = new GeneralPath(tilePath);
  692. +        paintFull.transform(AffineTransform.getScaleInstance(1, 1));;
  693. +        
  694.          g.setStroke(new BasicStroke(1f));
  695.  
  696.          AffineTransform baseTransform = g.getTransform();
  697. @@ -291,8 +316,21 @@ public final class MiniMap extends JPanel implements MouseInputListener {
  698.              for (int column = firstColumn; column <= lastColumn; column++) {
  699.                  Tile tile = map.getTile(column, row);
  700.                  if (tile.isExplored()) {
  701. -                    g.setColor(getMinimapColor(tile.getType()));
  702. -                    g.fill(tilePath);
  703. +                    if (freeColClient.getClientOptions().getBoolean(ClientOptions.MINIMAP_TOGGLE_BORDERS)) {
  704. +                        g.setColor(getMinimapPoliticsColor(tile.getType()));
  705. +                        g.fill(tilePath);
  706. +                        
  707. +                        if (tile.getOwner() != null) {
  708. +                            Color nationOwner = tile.getOwner().getNationColor();
  709. +                            Color colorTransparent =
  710. +                                    new Color(nationOwner.getRed(), nationOwner.getGreen(), nationOwner.getBlue(), 100);
  711. +                            g.setColor(colorTransparent);
  712. +                            g.fill(paintFull);
  713. +                        }
  714. +                    } else {
  715. +                        g.setColor(getMinimapEconomicColor(tile.getType()));
  716. +                        g.fill(tilePath);
  717. +                    }
  718.                      if (!tile.hasSettlement()) {
  719.                          Unit unit = tile.getFirstUnit();
  720.                          if (unit != null) {
  721. @@ -307,7 +345,14 @@ public final class MiniMap extends JPanel implements MouseInputListener {
  722.                          g.setColor(tile.getSettlement().getOwner().getNationColor());
  723.                          g.fill(settlementPath);
  724.                      }
  725. -                }
  726. +                    if (!freeColClient.getMyPlayer().canSee(tile)
  727. +                            && freeColClient.getClientOptions().getBoolean(ClientOptions.MINIMAP_TOGGLE_FOG_OF_WAR)) {
  728. +                        Color blackTransparent = new Color(0, 0, 0, 100);
  729. +                        g.setColor(blackTransparent);
  730. +                        g.fill(paintFull);
  731. +                    }
  732. +
  733. +                 }
  734.                  g.translate(tileWidth, 0);
  735.              }
  736.              g.setTransform(rowTransform);
Add Comment
Please, Sign In to add comment