diff --git a/how-to-build.md b/how-to-build.md index ae8e304..b2ed335 100644 --- a/how-to-build.md +++ b/how-to-build.md @@ -10,6 +10,12 @@ C:\Program Files\Micro-Manager-2.0\plugins\Micro-Manager\MMJ_.jar The jar is not tracked by this repository, so it is not updated for you. Copy it again after upgrading Micro-Manager, or the plugin will be built against an older java layer than the one it runs in. A Micro-Manager 1.4 installation also contains an `MMJ_.jar`; it is a different artifact and will not work here. -To build, run `mvn clean package` from the `LightSheetManager`. The resultant jar will be available in the `LightSheetManager/target` folder, and then must be manually copied into the `Micro-manager/mmplugins`. Currently, the automated tests are throwing an error. In the case the tests can be skipped adnt the plugin built with `mvn clean package -Dmaven.test.skip`. +Building requires JDK 11: the pom's enforcer plugin fails the build on any other JDK, so a jar cannot silently be produced by the wrong toolchain. If the `java` on your PATH or your `JAVA_HOME` is newer, point `JAVA_HOME` at a JDK 11 for the build shell, for example on Windows PowerShell: -Doing this requires having Maven installed. Most IDEs have a Maven plugin that can accomplish the same thing as the manual way above. \ No newline at end of file +``` +$env:JAVA_HOME = 'C:\Program Files\Eclipse Adoptium\jdk-11.0.31.11-hotspot' +``` + +To build, run `mvn clean package` from the `LightSheetManager` directory. The resultant jar will be available in the `LightSheetManager/target` folder, and then must be manually copied into the `Micro-manager/mmplugins`. The build runs no automated tests. The first build on a machine must be run online so Maven can download the build plugins; after that `mvn -o clean package` works offline. + +Doing this requires having Maven installed. Most IDEs have a Maven plugin that can accomplish the same thing as the manual way above. diff --git a/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java b/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java index b6b807e..6a4642b 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java +++ b/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java @@ -15,7 +15,7 @@ public class LightSheetManagerPlugin implements MenuPlugin, SciJavaPlugin { public static final String copyright = "Applied Scientific Instrumentation (ASI), 2022-2026"; public static final String description = "A plugin to control various types of light sheet microscopes."; public static final String menuName = "Light Sheet Manager"; - public static final String version = "0.8.11"; + public static final String version = "0.8.12"; private Studio studio_; diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java index 4e74922..0e9be2c 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java @@ -33,11 +33,16 @@ public ChannelTable(final LightSheetManager model) { // set the channel group first to get the correct channel array final String channelGroup = model_.acquisitions().settings().channels().group(); - final ChannelSpec[] channels = model_.acquisitions().settings().channels().used(); + final ChannelSpec[] channels = model_.acquisitions().settings().channels().data(); tableData_ = new ChannelTableData(channelGroup, channels); - tableModel_ = new ChannelTableModel(tableData_, - () -> model_.acquisitions().updateDurationLabels()); + tableModel_ = new ChannelTableModel(tableData_, () -> { + // Push every row, used and unused, so the edit reaches the builder. The table's rows are + // not always the objects the builder holds, so an unpushed edit can be lost. + model_.acquisitions().settingsBuilder() + .channelBuilder().data(tableData_.getChannels()); + model_.acquisitions().updateDurationLabels(); + }); table_ = new JTable(tableModel_); // init presets combo box diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTableModel.java b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTableModel.java index 0b68df3..fd5ccf7 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTableModel.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTableModel.java @@ -22,11 +22,13 @@ public class ChannelTableModel extends AbstractTableModel { }; private final ChannelTableData data_; - private final Runnable onUseToggled_; - public ChannelTableModel(final ChannelTableData tableData, final Runnable onUseToggled) { + /** Runs after any accepted cell edit, to commit the table into the settings. */ + private final Runnable onEdit_; + + public ChannelTableModel(final ChannelTableData tableData, final Runnable onEdit) { data_ = Objects.requireNonNull(tableData); - onUseToggled_ = Objects.requireNonNull(onUseToggled); + onEdit_ = Objects.requireNonNull(onEdit); } public void addEmptyChannel() { @@ -99,7 +101,6 @@ public void setValueAt(Object value, int row, int col) { case COLUMN_USE: if (value instanceof Boolean) { channelSpec.setUsed((boolean) value); - onUseToggled_.run(); // update durations } else { return; // early exit => wrong type } @@ -122,6 +123,9 @@ public void setValueAt(Object value, int row, int col) { throw new IllegalArgumentException("Invalid column index: " + col); } + // commit the edit; the wrong type cases above return before reaching this + onEdit_.run(); + // update the table ui fireTableCellUpdated(row, col); } diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTablePanel.java b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTablePanel.java index 3737006..de1fdc1 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTablePanel.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTablePanel.java @@ -102,7 +102,7 @@ private void createEventHandlers() { model_.acquisitions().settingsBuilder().channelBuilder().group(channelGroup); model_.acquisitions().updateSettings(); // update the table data model and refresh ui - table_.getData().setChannels(channelGroup, model_.acquisitions().settings().channels().used()); + table_.getData().setChannels(channelGroup, model_.acquisitions().settings().channels().data()); table_.getData().setChannelGroup(channelGroup); table_.refreshData(); // a different group can select a different number of channels, which changes the duration diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/devices/vendor/ASIPLogic.java b/src/main/java/org/micromanager/lightsheetmanager/model/devices/vendor/ASIPLogic.java index cef28fd..173e6bf 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/devices/vendor/ASIPLogic.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/devices/vendor/ASIPLogic.java @@ -216,7 +216,8 @@ public enum Preset { BNC3_SOURCE_CELL_11("35 - BNC3 source = cell 11", 35), CELL_10_EQ_CELL_8("36 - cell 10 = cell 8", 36), BNC1_8_ON_17_24("51 - cells 17-24 on BNC1-8", 51), - BNC3_SOURCE_TTL5("52 - BNC3 source = TTL5", 52); + BNC3_SOURCE_TTL5("52 - BNC3 source = TTL5", 52), + MOD3_COUNTER_RESETTABLE("60 - mod3 counter", 60); private final String text_; private final int code_;