persist zoom level

This commit is contained in:
bancika
2011-01-17 22:48:43 +00:00
parent b9aeaff6da
commit 5cea9f0193
2 changed files with 4 additions and 2 deletions
@@ -73,7 +73,7 @@ public class StatusBar extends JPanel implements IPlugIn {
if (zoomBox == null) {
zoomBox = new JComboBox(new Double[] { 0.25d, 0.3333d, 0.5d, 0.6667d, 0.75d, 1d, 1.25d,
1.5d, 2d });
zoomBox.setSelectedItem(1d);
zoomBox.setSelectedItem(plugInPort.getZoomLevel());
zoomBox.setFocusable(false);
zoomBox.setRenderer(new PercentageListCellRenderer());
zoomBox.addActionListener(new ActionListener() {
@@ -66,10 +66,11 @@ public class Presenter implements IPlugInPort {
public static final VersionNumber CURRENT_VERSION = new VersionNumber(3, 0, 1);
public static final String DEFAULTS_KEY_PREFIX = "default.";
public static final String METRIC_KEY = "metric";
public static final String ZOOM_KEY = "zoom";
public static final int ICON_SIZE = 32;
private double zoomLevel = 1;
private double zoomLevel = ConfigurationManager.getInstance().readDouble(ZOOM_KEY, 1d);
private Project currentProject;
private String currentFileName = null;
private boolean modified = false;
@@ -149,6 +150,7 @@ public class Presenter implements IPlugInPort {
public void setZoomLevel(double zoomLevel) {
LOG.info(String.format("setZoomLevel(%s)", zoomLevel));
this.zoomLevel = zoomLevel;
ConfigurationManager.getInstance().writeValue(ZOOM_KEY, zoomLevel);
messageDispatcher.dispatchMessage(EventType.ZOOM_CHANGED, zoomLevel);
messageDispatcher.dispatchMessage(EventType.REPAINT);
}