Skip to content

Commit

Permalink
MPR preferences are not persistent nroduit#589
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed Sep 13, 2024
1 parent 4ceec00 commit 132f3bb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -933,14 +933,6 @@ public void propertyChange(SynchCineEvent synch) {
}
} else {
double location = synch.getLocation().doubleValue();
// TODO add a way in GUI to resynchronize series. Offset should be in Series tag and
// related
// to
// a specific series
// Double offset = (Double) actionsInView.get(ActionW.STACK_OFFSET.cmd());
// if (offset != null) {
// location += offset;
// }
imgElement =
series.getNearestImage(
location,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ private EventManager() {
options, WindowOp.P_APPLY_WL_COLOR, prefNode, Boolean.TRUE.toString());
WProperties.setProperty(options, WindowOp.P_INVERSE_LEVEL, prefNode, Boolean.TRUE.toString());
WProperties.setProperty(options, PRManager.PR_APPLY, prefNode, Boolean.FALSE.toString());

WProperties.setProperty(options, View2d.P_CROSSHAIR_MODE, prefNode, "1");
WProperties.setProperty(options, View2d.P_CROSSHAIR_CENTER_GAP, prefNode, "40");
}

initializeParameters();
Expand Down Expand Up @@ -1440,6 +1443,13 @@ public void savePreferences(BundleContext bundleContext) {
BundlePreferences.putBooleanPreferences(
prefNode, PRManager.PR_APPLY, options.getBooleanProperty(PRManager.PR_APPLY, false));

BundlePreferences.putIntPreferences(
prefNode, View2d.P_CROSSHAIR_MODE, options.getIntProperty(View2d.P_CROSSHAIR_MODE, 1));
BundlePreferences.putIntPreferences(
prefNode,
View2d.P_CROSSHAIR_CENTER_GAP,
options.getIntProperty(View2d.P_CROSSHAIR_CENTER_GAP, 40));

Preferences containerNode =
prefs.node(View2dContainer.UI.clazz.getSimpleName().toLowerCase());
InsertableUtil.savePreferences(View2dContainer.UI.toolBars, containerNode, Type.TOOLBAR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,29 +108,30 @@ private void setDefaultLayout() {

@Override
public void closeAdditionalWindow() {
EventManager eventManager = EventManager.getInstance();
WProperties properties = EventManager.getInstance().getOptions();

int mode = comboBox3DCursorMode.getSelectedIndex();
eventManager.getOptions().putIntProperty(View2d.P_CROSSHAIR_MODE, mode);
properties.putIntProperty(View2d.P_CROSSHAIR_MODE, mode);
int gapSize = (int) spinnerCrossGapSize.getValue();
eventManager.getOptions().putIntProperty(View2d.P_CROSSHAIR_CENTER_GAP, gapSize);
GuiUtils.getUICore()
.getSystemPreferences()
.put(
MprFactory.P_DEFAULT_LAYOUT,
((GridBagLayoutModel) comboBoxLayouts.getSelectedItem()).getId());

properties.putIntProperty(View2d.P_CROSSHAIR_CENTER_GAP, gapSize);
GridBagLayoutModel layout = (GridBagLayoutModel) comboBoxLayouts.getSelectedItem();
if (layout != null) {
GuiUtils.getUICore().getSystemPreferences().put(MprFactory.P_DEFAULT_LAYOUT, layout.getId());
}
GuiUtils.getUICore().saveSystemPreferences();
}

@Override
public void resetToDefaultValues() {

comboBox3DCursorMode.setSelectedIndex(1);

// Get the default server configuration and if no value take the default value in parameter.
WProperties properties = EventManager.getInstance().getOptions();
properties.resetProperty(View2d.P_CROSSHAIR_CENTER_GAP, null);
properties.resetProperty(View2d.P_CROSSHAIR_MODE, "1");
int mode = properties.getIntProperty(View2d.P_CROSSHAIR_MODE, 1);
comboBox3DCursorMode.setSelectedIndex(mode);
if (comboBox3DCursorMode.getSelectedIndex() < 0) {
comboBox3DCursorMode.setSelectedItem(1);
}
properties.resetProperty(View2d.P_CROSSHAIR_CENTER_GAP, "40");
int gapSize = properties.getIntProperty(View2d.P_CROSSHAIR_CENTER_GAP, 40);
spinnerCrossGapSize.setValue(gapSize);
GuiUtils.getUICore()
Expand Down

0 comments on commit 132f3bb

Please sign in to comment.