add restoring tournament table chat divider location

refactor getting current bounds into utility function
This commit is contained in:
GrayedFox 2018-05-22 20:36:05 +02:00
parent 5822a7d94d
commit ebc36c503e
No known key found for this signature in database
GPG key ID: 7FF4748DBF28C93F
4 changed files with 22 additions and 7 deletions

View file

@ -410,10 +410,8 @@ public class TablesPanel extends javax.swing.JPanel {
}
private void saveDividerLocations() {
// save desktop bounds and divider locations
Rectangle rec = MageFrame.getDesktop().getBounds();
String currentBounds = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
PreferencesDialog.saveValue(KEY_MAGE_PANEL_LAST_SIZE, currentBounds);
// save divider locations and divider saveDividerLocations
GuiDisplayUtil.saveCurrentBoundsToPrefs();
GuiDisplayUtil.setDividerLocation(KEY_TABLES_DIVIDER_LOCATION_1, this.jSplitPane1.getDividerLocation());
GuiDisplayUtil.setDividerLocation(KEY_TABLES_DIVIDER_LOCATION_2, this.jSplitPaneTables.getDividerLocation());
GuiDisplayUtil.setDividerLocation(KEY_TABLES_DIVIDER_LOCATION_3, chatPanelMain.getSplitDividerLocation());
@ -432,9 +430,9 @@ public class TablesPanel extends javax.swing.JPanel {
private void restoreDividers() {
Rectangle currentBounds = MageFrame.getDesktop().getBounds();
if (currentBounds != null) {
String firstDivider = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_1, null);
String tableDivider = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_2, null);
String chatDivider = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_3, null);
String firstDivider = PreferencesDialog.getCachedValue(KEY_TABLES_DIVIDER_LOCATION_1, null);
String tableDivider = PreferencesDialog.getCachedValue(KEY_TABLES_DIVIDER_LOCATION_2, null);
String chatDivider = PreferencesDialog.getCachedValue(KEY_TABLES_DIVIDER_LOCATION_3, null);
GuiDisplayUtil.restoreDividerLocations(currentBounds, firstDivider, jSplitPane1);
GuiDisplayUtil.restoreDividerLocations(currentBounds, tableDivider, jSplitPaneTables);
GuiDisplayUtil.restoreDividerLocations(currentBounds, chatDivider, chatPanelMain);