rightTabs[i] = new ConfFileTableTab(
snapshot.getBooleanVariable(MuSnapshot.getTabLockedVariable(index, false, i)),
restoreFileURL(snapshot.getVariable(MuSnapshot.getTabLocationVariable(index, false, i))),
snapshot.getVariable(MuSnapshot.getTabTitleVariable(index, false, i)));
MainFrame mainFrame = new MainFrame(
leftTabs,
getInitialSelectedTab(FolderPanelType.LEFT, index),
getFileTableConfiguration(FolderPanelType.LEFT, index),
rightTabs,
getInitialSelectedTab(FolderPanelType.RIGHT, index),
getFileTableConfiguration(FolderPanelType.RIGHT, index));
// Retrieve last saved window bounds
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int x = MuConfigurations.getSnapshot().getIntegerVariable(MuSnapshot.getX(index));
int y = MuConfigurations.getSnapshot().getIntegerVariable(MuSnapshot.getY(index));
int width = MuConfigurations.getSnapshot().getIntegerVariable(MuSnapshot.getWidth(index));
int height = MuConfigurations.getSnapshot().getIntegerVariable(MuSnapshot.getHeight(index));
// Retrieves the last known size of the screen.
int lastScreenWidth = MuConfigurations.getSnapshot().getIntegerVariable(MuSnapshot.SCREEN_WIDTH);
int lastScreenHeight = MuConfigurations.getSnapshot().getIntegerVariable(MuSnapshot.SCREEN_HEIGHT);
// If no previous location was saved, or if the resolution has changed,
// reset the window's dimensions to their default values.
if(x == -1 || y == -1 || width == -1 || height == -1 ||
screenSize.width != lastScreenWidth || screenSize.height != lastScreenHeight
|| width + x > screenSize.width + 5 || height + y > screenSize.height + 5) {
// Full screen bounds are not reliable enough, in particular under Linux+Gnome
// so we simply make the initial window 4/5 of screen's size, and center it.
// This should fit under any window manager / platform
x = screenSize.width / 10;
y = screenSize.height / 10;
width = (int)(screenSize.width * 0.8);
height = (int)(screenSize.height * 0.8);
}
mainFrame.setBounds(new Rectangle(x, y, width, height));
return mainFrame;
}