From 61082fd703a5cee6d93b2bb6a417284b42367457 Mon Sep 17 00:00:00 2001 From: riverwanderer <58135975+riverwanderer@users.noreply.github.com> Date: Thu, 14 Sep 2023 19:40:05 +0100 Subject: [PATCH 1/5] Experimental VassalRefreshGHK. --- .../src/main/java/VASSAL/build/module/GameRefresher.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java index 30f4ac4f97..a32ca7d12e 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java +++ b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java @@ -47,6 +47,7 @@ import VASSAL.i18n.Resources; import VASSAL.tools.BrowserSupport; import VASSAL.tools.ErrorDialog; +import VASSAL.tools.NamedKeyStroke; import VASSAL.tools.swing.FlowLabel; import VASSAL.tools.swing.SwingUtils; import net.miginfocom.swing.MigLayout; @@ -536,6 +537,8 @@ else if (!decksToDelete.isEmpty()) { log(Resources.getString("GameRefresher.refreshable_decks", refreshable)); log(Resources.getString(options.contains("DeleteOldDecks") ? "GameRefresher.deletable_decks" : "GameRefresher.deletable_decks_2", deletable)); //NON-NLS log(Resources.getString(options.contains("AddNewDecks") ? "GameRefresher.addable_decks" : "GameRefresher.addable_decks_2", addable)); //NON-NLS + + GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalRefreshGHK")); } } } From 74cbca49d4331db098bc9f718d7ce5c2c8f229bf Mon Sep 17 00:00:00 2001 From: riverwanderer <58135975+riverwanderer@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:33:50 +0100 Subject: [PATCH 2/5] Experimental VassalRefreshGHK; corrected level; was firing only with decks option. --- .../src/main/java/VASSAL/build/module/GameRefresher.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java index a32ca7d12e..72307c21b2 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java +++ b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java @@ -538,9 +538,10 @@ else if (!decksToDelete.isEmpty()) { log(Resources.getString(options.contains("DeleteOldDecks") ? "GameRefresher.deletable_decks" : "GameRefresher.deletable_decks_2", deletable)); //NON-NLS log(Resources.getString(options.contains("AddNewDecks") ? "GameRefresher.addable_decks" : "GameRefresher.addable_decks_2", addable)); //NON-NLS - GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalRefreshGHK")); } } + // After all refreshing, allow a custom finish... + GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalRefreshGHK")); } From f921746c800ec62a0242486119ab8a4f63875d11 Mon Sep 17 00:00:00 2001 From: riverwanderer <58135975+riverwanderer@users.noreply.github.com> Date: Fri, 15 Sep 2023 05:52:32 +0100 Subject: [PATCH 3/5] Added doc to Refresh Counters section. --- .../ReferenceManual/GameRefresher.adoc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc b/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc index 3e3c115f22..418ef6f08b 100644 --- a/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc +++ b/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc @@ -18,7 +18,7 @@ Whenever a piece is created in a VASSAL game, the Id of the definition used to c The Game Refresher works by matching the Id in each piece in the current game to the Id's of all piece definitions in the current module to find the new definition. If a match is found, then the piece is replaced with one created from the new defintion. Then each trait in the new Piece is checked to see if there is an EXACTLY matching trait in the old definition. If an EXACT match is found, then the 'state' of the old trait is copied over (e.g. what is the current layer showing, or current rotation facing). -Problems occur when the definition used to create the piece no longer exists in the module, or if traits are modified slightly so that they no longer EXACTLY match the old piece. There are various options in the Game Refresher dialog that can be used to help match and update these pieces and traits. +Problems occur when the definition used to create the piece no longer exists in the module, or if traits are modified slightly so that they no longer EXACTLY match the old piece. There are various options in the Game Refresher dialog that can be used to help match and update these pieces and traits. In addition, at the end of each refresh, Vassal issues a <<#Post-Refresh,special hotkey>> that can be used to trigger custom maintenance routines which you have designed. [.text-center] image:images/GameRefresher.png[] @@ -81,3 +81,12 @@ If you select the _Delete decks_ option, then any deck found in the current game If you select the _Add decks_ option, then any _new_ deck found in the module definition that does not exist in the game being refreshed will be _added_. Note this will not add any _contents_ (e.g., cards) to the deck, it will only add the deck. If you need to add contents you will need to arrange to add them separately, e.g., from a piece palette, or dragged in from some other location. +[#Post-Refresh] +==== Post-Refresh Maintenance Hotkey +After processing a file, the Refresher triggers a special hotkey _VassalRefreshGHK_. You may use this to perform maintenance that you wish to carry out on the refreshed Predefined Setup or game file. Potential uses include converting counters or populating a new deck. + +Design and test your maintenance actions carefully. You can use _Refresh Counters_ to do one-off tests. Also, remember that Startup GKCs are not executed during Refresh Predefined Setups. + +After a Refeshing Predefined Setups, save your module as a different file name so you can do re-runs on the original if need be. + +Once you are done, disable or remove the maintenance components so that further refreshes don’t trigger them accidentally. \ No newline at end of file From 30b53e25218de86b835ad01697c3bb354b7cc685 Mon Sep 17 00:00:00 2001 From: Mark Benson Date: Wed, 20 Sep 2023 13:25:40 +0100 Subject: [PATCH 4/5] Pre & Post GHK, always try. No control checkbox. --- .../src/main/java/VASSAL/build/module/GameRefresher.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java index 72307c21b2..f112dec950 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java +++ b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java @@ -341,6 +341,10 @@ public void execute(Set options, Command command) throws IllegalBuildExc } } + // About to commence refreshing the game, allow a custom start... + GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalPreRefreshGHK")); + + /* * 2. Build a list in visual order of all stacks, decks, mats and other pieces that need refreshing */ @@ -541,7 +545,7 @@ else if (!decksToDelete.isEmpty()) { } } // After all refreshing, allow a custom finish... - GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalRefreshGHK")); + GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalPostRefreshGHK")); } From 70ef1031d9e6d9fe1bd1d041cc3e5a0d8fbd9430 Mon Sep 17 00:00:00 2001 From: Mark Benson Date: Wed, 20 Sep 2023 13:44:10 +0100 Subject: [PATCH 5/5] Pre & Post GHK, always try. Doc updated --- .../main/java/VASSAL/build/module/GameRefresher.java | 4 ++-- .../ReferenceManual/GameRefresher.adoc | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java index f112dec950..01c7081342 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java +++ b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java @@ -342,7 +342,7 @@ public void execute(Set options, Command command) throws IllegalBuildExc } // About to commence refreshing the game, allow a custom start... - GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalPreRefreshGHK")); + GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalGHKpreRefresh")); /* @@ -545,7 +545,7 @@ else if (!decksToDelete.isEmpty()) { } } // After all refreshing, allow a custom finish... - GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalPostRefreshGHK")); + GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalGHKpostRefresh")); } diff --git a/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc b/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc index 418ef6f08b..32378753c5 100644 --- a/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc +++ b/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc @@ -18,7 +18,7 @@ Whenever a piece is created in a VASSAL game, the Id of the definition used to c The Game Refresher works by matching the Id in each piece in the current game to the Id's of all piece definitions in the current module to find the new definition. If a match is found, then the piece is replaced with one created from the new defintion. Then each trait in the new Piece is checked to see if there is an EXACTLY matching trait in the old definition. If an EXACT match is found, then the 'state' of the old trait is copied over (e.g. what is the current layer showing, or current rotation facing). -Problems occur when the definition used to create the piece no longer exists in the module, or if traits are modified slightly so that they no longer EXACTLY match the old piece. There are various options in the Game Refresher dialog that can be used to help match and update these pieces and traits. In addition, at the end of each refresh, Vassal issues a <<#Post-Refresh,special hotkey>> that can be used to trigger custom maintenance routines which you have designed. +Problems occur when the definition used to create the piece no longer exists in the module, or if traits are modified slightly so that they no longer EXACTLY match the old piece. There are various options in the Game Refresher dialog that can be used to help match and update these pieces and traits. In addition to these options, <<#RefreshHotkeys,special hotkeys>> can be used to perform custom maintenance routines which you have designed. [.text-center] image:images/GameRefresher.png[] @@ -61,7 +61,7 @@ Remove Decks from the game that no longer exist in the module. See the <<#DeckRe *Add decks to game which have been added to the module since this game was created (empty deck will be added):*:: -Add Decks to teh game that have been added to the module. See the <<#DeckRefresher,Deck Refresher>> section below for full details. +Add Decks to the game that have been added to the module. See the <<#DeckRefresher,Deck Refresher>> section below for full details. |=== @@ -81,12 +81,12 @@ If you select the _Delete decks_ option, then any deck found in the current game If you select the _Add decks_ option, then any _new_ deck found in the module definition that does not exist in the game being refreshed will be _added_. Note this will not add any _contents_ (e.g., cards) to the deck, it will only add the deck. If you need to add contents you will need to arrange to add them separately, e.g., from a piece palette, or dragged in from some other location. -[#Post-Refresh] -==== Post-Refresh Maintenance Hotkey -After processing a file, the Refresher triggers a special hotkey _VassalRefreshGHK_. You may use this to perform maintenance that you wish to carry out on the refreshed Predefined Setup or game file. Potential uses include converting counters or populating a new deck. +[#RefreshHotkeys] +==== Pre & Post-Refresh Hotkeys +If this option is checked, the Refresher will trigger special hotkeys. _VassalGHKpreRefresh_ is triggered before refreshing and _VassalGHKpostRefresh_ after refreshing. You may use this feature to perform maintenance that you wish to carry out on Predefined Setup or game files. Potential uses include converting counters or populating a new deck. Design and test your maintenance actions carefully. You can use _Refresh Counters_ to do one-off tests. Also, remember that Startup GKCs are not executed during Refresh Predefined Setups. After a Refeshing Predefined Setups, save your module as a different file name so you can do re-runs on the original if need be. -Once you are done, disable or remove the maintenance components so that further refreshes don’t trigger them accidentally. \ No newline at end of file +Once you are done, consider disabling or removing the maintenance components so that further refreshes don’t trigger them accidentally. \ No newline at end of file