@Override public int getSelectedFrame() { return Math.max(snapshot.getIntegerVariable(MuSnapshot.getSelectedWindow()), 0); }
private int getInitialSelectedTab(FolderPanelType folderPanelType, int window) { // Checks which kind of initial path we're dealing with. boolean isCustom = MuConfigurations.getPreferences().getVariable(MuPreference.STARTUP_FOLDERS, MuPreferences.DEFAULT_STARTUP_FOLDERS).equals(MuPreferences.STARTUP_FOLDERS_CUSTOM); return isCustom ? 0 : MuConfigurations.getSnapshot().getIntegerVariable(MuSnapshot.getTabsSelectionVariable(window, folderPanelType == FolderPanelType.LEFT)); }
/** * Private Constructor */ private GlobalLocationHistory() { Configuration snapshot = MuConfigurations.getSnapshot(); // Restore the global history from last run int nbLocations = snapshot.getIntegerVariable(MuSnapshot.getRecentLocationsCountVariable()); for (int i=0; i<nbLocations; ++i) { String filePath = snapshot.getVariable(MuSnapshot.getRecentLocationVariable(i)); try { history.add(FileURL.getFileURL(filePath)); } catch (MalformedURLException e) { LOGGER.debug("Got invalid URL from the snapshot file: " + filePath, e); } } }
int nbFolderPaths = snapshot.getIntegerVariable(MuSnapshot.getTabsCountVariable(window, folderPanelType == FolderPanelType.LEFT)); folderPaths = new String[nbFolderPaths]; for (int i=0; i<nbFolderPaths;++i)
private MainFrame createMainFrame(int index) { int nbTabsInLeftPanel = snapshot.getIntegerVariable(MuSnapshot.getTabsCountVariable(index, true)); ConfFileTableTab[] leftTabs = new ConfFileTableTab[nbTabsInLeftPanel]; for (int i=0; i<nbTabsInLeftPanel; ++i) snapshot.getVariable(MuSnapshot.getTabTitleVariable(index, true, i))); int nbTabsInRightPanel = snapshot.getIntegerVariable(MuSnapshot.getTabsCountVariable(index, false)); ConfFileTableTab[] rightTabs = new ConfFileTableTab[nbTabsInRightPanel]; for (int i=0; i<nbTabsInRightPanel; ++i) 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)); int lastScreenWidth = MuConfigurations.getSnapshot().getIntegerVariable(MuSnapshot.SCREEN_WIDTH); int lastScreenHeight = MuConfigurations.getSnapshot().getIntegerVariable(MuSnapshot.SCREEN_HEIGHT);
@Override public MainFrame[] build() { int nbFrames = snapshot.getIntegerVariable(MuSnapshot.getWindowsCount()); // if there is no window saved in the snapshot file or custom folders are set, open one window with default settings if (nbFrames == 0 || MuConfigurations.getPreferences().getVariable(MuPreference.STARTUP_FOLDERS).equals(MuPreferences.STARTUP_FOLDERS_CUSTOM)) { MainFrame mainFrame = new MainFrame( new ConfFileTableTab(getInitialPath(FolderPanelType.LEFT)), getFileTableConfiguration(FolderPanelType.LEFT, -1), new ConfFileTableTab(getInitialPath(FolderPanelType.RIGHT)), getFileTableConfiguration(FolderPanelType.RIGHT, -1)); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // 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 int x = screenSize.width / 10; int y = screenSize.height / 10; int width = (int)(screenSize.width * 0.8); int height = (int)(screenSize.height * 0.8); mainFrame.setBounds(new Rectangle(x, y, width, height)); return new MainFrame[] {mainFrame}; } else { MainFrame[] mainFrames = new MainFrame[nbFrames]; for (int i=0; i<mainFrames.length; ++i) mainFrames[i] = createMainFrame(i); return mainFrames; } }
protected FileTableConfiguration getFileTableConfiguration(FolderPanelType folderPanelType, int window) { FileTableConfiguration conf; conf = new FileTableConfiguration(); // Loop on columns for(Column c : Column.values()) { if(c!=Column.NAME) { // Skip the special name column (always visible, width automatically calculated) // Sets the column's initial visibility. conf.setEnabled(c, MuConfigurations.getSnapshot().getVariable( MuSnapshot.getShowColumnVariable(window, c, folderPanelType == FolderPanelType.LEFT), c.showByDefault() ) ); // Sets the column's initial width. conf.setWidth(c, MuConfigurations.getSnapshot().getIntegerVariable(MuSnapshot.getColumnWidthVariable(window, c, folderPanelType == FolderPanelType.LEFT))); } // Sets the column's initial order conf.setPosition(c, MuConfigurations.getSnapshot().getVariable( MuSnapshot.getColumnPositionVariable(window, c, folderPanelType == FolderPanelType.LEFT), c.ordinal()) ); } return conf; }