Update layout settings.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@9074 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-09-06 22:01:00 +00:00
committed by derek
parent 603312e3b1
commit 0a64da8ab8

View File

@ -62,19 +62,19 @@ public class LayoutSettingsManager {
String chatFrameWidth = Integer.toString(layoutSettings.getChatFrameWidth()); String chatFrameWidth = Integer.toString(layoutSettings.getChatFrameWidth());
String chatFrameHeight = Integer.toString(layoutSettings.getChatFrameHeight()); String chatFrameHeight = Integer.toString(layoutSettings.getChatFrameHeight());
String splitDividerLocation = Integer.toString(layoutSettings.getSplitPaneDividerLocation()); String splitDividerLocation = Integer.toString(layoutSettings.getSplitPaneDividerLocation());
props.setProperty("mainWindowX", mainWindowX); props.setProperty("mainWindowX", mainWindowX);
props.setProperty("mainWindowY", mainWindowY); props.setProperty("mainWindowY", mainWindowY);
props.setProperty("mainWindowHeight", mainWindowHeight); props.setProperty("mainWindowHeight", mainWindowHeight);
props.setProperty("mainWindowWidth", mainWindowWidth); props.setProperty("mainWindowWidth", mainWindowWidth);
props.setProperty("chatFrameX", chatFrameX); props.setProperty("chatFrameX", chatFrameX);
props.setProperty("chatFrameY", chatFrameY); props.setProperty("chatFrameY", chatFrameY);
props.setProperty("chatFrameWidth", chatFrameWidth); props.setProperty("chatFrameWidth", chatFrameWidth);
props.setProperty("chatFrameHeight", chatFrameHeight); props.setProperty("chatFrameHeight", chatFrameHeight);
props.setProperty("splitDividerLocation", splitDividerLocation); props.setProperty("splitDividerLocation", splitDividerLocation);
try { try {
props.store(new FileOutputStream(getSettingsFile()), "Storing Spark Layout Settings"); props.store(new FileOutputStream(getSettingsFile()), "Storing Spark Layout Settings");
} }
@ -121,7 +121,7 @@ public class LayoutSettingsManager {
String chatFrameWidth = props.getProperty("chatFrameWidth"); String chatFrameWidth = props.getProperty("chatFrameWidth");
String chatFrameHeight = props.getProperty("chatFrameHeight"); String chatFrameHeight = props.getProperty("chatFrameHeight");
String splitDividerLocation = props.getProperty("splitDividerLocation"); String splitDividerLocation = props.getProperty("splitDividerLocation");
settings = new LayoutSettings(); settings = new LayoutSettings();
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
@ -133,11 +133,11 @@ public class LayoutSettingsManager {
int mainWindowHeightInt = Integer.parseInt(mainWindowHeight); int mainWindowHeightInt = Integer.parseInt(mainWindowHeight);
int mainWindowWidthInt = Integer.parseInt(mainWindowWidth); int mainWindowWidthInt = Integer.parseInt(mainWindowWidth);
if (mainWindowXInt + mainWindowWidthInt > width) { if (mainWindowXInt + mainWindowWidthInt > width || mainWindowXInt < 0) {
mainWindowXInt = (width - mainWindowWidthInt) / 2; mainWindowXInt = (width - mainWindowWidthInt) / 2;
} }
if (mainWindowYInt + mainWindowHeightInt > height) { if (mainWindowYInt + mainWindowHeightInt > height || mainWindowYInt < 0) {
mainWindowYInt = (height - mainWindowHeightInt) / 2; mainWindowYInt = (height - mainWindowHeightInt) / 2;
} }
@ -147,7 +147,7 @@ public class LayoutSettingsManager {
int chatFrameWidthInt = Integer.parseInt(chatFrameWidth); int chatFrameWidthInt = Integer.parseInt(chatFrameWidth);
int chatFrameHeightInt = Integer.parseInt(chatFrameHeight); int chatFrameHeightInt = Integer.parseInt(chatFrameHeight);
int splitDividerLocationInt = splitDividerLocation == null ? -1 : Integer.parseInt(splitDividerLocation); int splitDividerLocationInt = splitDividerLocation == null ? -1 : Integer.parseInt(splitDividerLocation);
if (chatFrameXInt + chatFrameWidthInt > width) { if (chatFrameXInt + chatFrameWidthInt > width) {
chatFrameXInt = (width - chatFrameWidthInt) / 2; chatFrameXInt = (width - chatFrameWidthInt) / 2;
} }
@ -156,6 +156,10 @@ public class LayoutSettingsManager {
chatFrameYInt = (height - chatFrameHeightInt) / 2; chatFrameYInt = (height - chatFrameHeightInt) / 2;
} }
if(chatFrameHeightInt < 100){
chatFrameHeightInt = 100;
}
settings.setMainWindowX(mainWindowXInt); settings.setMainWindowX(mainWindowXInt);
settings.setMainWindowY(mainWindowYInt); settings.setMainWindowY(mainWindowYInt);