private void setSavedSize() { String s = ClassicPrefs.getWindowSizeAndLocation(); if (s == null) { setDefaultSize(); return; } try { int i = s.indexOf(','); int x = Integer.parseInt(s.substring(0, i)); s = s.substring(i + 1); i = s.indexOf(','); int y = Integer.parseInt(s.substring(0, i)); s = s.substring(i + 1); i = s.indexOf(','); int width = Integer.parseInt(s.substring(0, i)); s = s.substring(i + 1); int height = Integer.parseInt(s); setBounds(x, y, width, height); } catch (Exception x) { String msg = "Parsing of window size and location string failed"; CC.getLogger().log(Level.INFO, msg, x); setDefaultSize(); } if (ClassicPrefs.getWindowMaximized()) setExtendedState(getExtendedState() | MAXIMIZED_BOTH); }
/** Invoked when this window is about to close. */ protected void onWindowClose() { if (ClassicPrefs.getSaveWindowProperties()) { ClassicPrefs.setWindowMaximized((getExtendedState() & MAXIMIZED_BOTH) == MAXIMIZED_BOTH); setVisible(false); if (ClassicPrefs.getWindowMaximized()) { // setExtendedState(getExtendedState() & ~MAXIMIZED_BOTH); CC.cleanExit(); return; } java.awt.Point p = getLocation(); Dimension d = getSize(); StringBuffer sb = new StringBuffer(); sb.append(p.x).append(',').append(p.y).append(','); sb.append(d.width).append(',').append(d.height); ClassicPrefs.setWindowSizeAndLocation(sb.toString()); ClassicPrefs.setHSplitDividerLocation(hSplitPane.getDividerLocation()); } if (ClassicPrefs.getSaveLeftPaneState()) { int idx = 0; for (int i = 0; i < getLeftPane().getPages().length; i++) { if (getLeftPane().getPages()[i] == getLeftPane().getCurrentPage()) { idx = i; break; } } ClassicPrefs.setLeftPanePageIndex(idx); idx = getLeftPane().getOrchestrasPage().getCurrentOrchestraIndex(); if (idx >= 0 && idx < CC.getOrchestras().getOrchestraCount()) ClassicPrefs.setCurrentOrchestraIndex(idx); } StringBuffer sb = new StringBuffer(); for (String s : recentScripts) sb.append(s).append("\n"); ClassicPrefs.setRecentScripts(sb.toString()); LSConsoleModel model = getLSConsoleModel(); sb = new StringBuffer(); for (String s : model.getCommandHistory()) sb.append(s).append("\n"); ClassicPrefs.setLSConsoleHistory(sb.toString()); ClassicPrefs.setShowLSConsole(isLSConsoleShown()); ClassicPrefs.setLSConsolePopOut(isLSConsolePopOut()); ClassicPrefs.setVSplitDividerLocation(vSplitPane.getDividerLocation()); super.onWindowClose(); }