Added a config arg to opt out of window geometry saving
This commit is contained in:
parent
6cefc144eb
commit
cd040e6ecc
3 changed files with 19 additions and 12 deletions
|
@ -46,7 +46,9 @@ public class FTLModManager {
|
||||||
config.setProperty( "ftl_dats_path", "" );
|
config.setProperty( "ftl_dats_path", "" );
|
||||||
config.setProperty( "never_run_ftl", "false" );
|
config.setProperty( "never_run_ftl", "false" );
|
||||||
config.setProperty( "use_default_ui", "false" );
|
config.setProperty( "use_default_ui", "false" );
|
||||||
|
config.setProperty( "remember_geometry", "true" );
|
||||||
// "update_catalog" doesn't have a default.
|
// "update_catalog" doesn't have a default.
|
||||||
|
// "manager_geometry" doesn't have a default.
|
||||||
|
|
||||||
// Read the config file.
|
// Read the config file.
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
|
|
|
@ -48,9 +48,11 @@ public class SlipstreamConfig {
|
||||||
configComments += " allow_zip - Sets whether to treat .zip files as .ftl files. Default: false.\n";
|
configComments += " allow_zip - Sets whether to treat .zip files as .ftl files. Default: false.\n";
|
||||||
configComments += " ftl_dats_path - The path to FTL's resources folder. If invalid, you'll be prompted.\n";
|
configComments += " ftl_dats_path - The path to FTL's resources folder. If invalid, you'll be prompted.\n";
|
||||||
configComments += " never_run_ftl - If true, there will be no offer to run FTL after patching. Default: false.\n";
|
configComments += " never_run_ftl - If true, there will be no offer to run FTL after patching. Default: false.\n";
|
||||||
configComments += " update_catalog - If true, periodically download descriptions for the latest mods. If invalid, you'll be prompted.\n";
|
configComments += " update_catalog - If true, periodically download descriptions for the latest mods.\n";
|
||||||
configComments += " use_default_ui - If true, no attempt will be made to resemble a native GUI. Default: false.\n";
|
configComments += " use_default_ui - If true, no attempt will be made to resemble a native GUI. Default: false.\n";
|
||||||
configComments += " manager_geometry - Saved position/size/etc of the main window.\n";
|
configComments += " remember_geometry - If true, window geometry will be saved on exit and restored on startup.\n";
|
||||||
|
configComments += "\n";
|
||||||
|
configComments += " manager_geometry - Last saved position/size/etc of the main window.\n";
|
||||||
|
|
||||||
OutputStreamWriter writer = new OutputStreamWriter( out, "UTF-8" );
|
OutputStreamWriter writer = new OutputStreamWriter( out, "UTF-8" );
|
||||||
config.store( writer, configComments );
|
config.store( writer, configComments );
|
||||||
|
|
|
@ -241,12 +241,14 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver
|
||||||
|
|
||||||
SlipstreamConfig appConfig = ManagerFrame.this.appConfig;
|
SlipstreamConfig appConfig = ManagerFrame.this.appConfig;
|
||||||
|
|
||||||
|
if ( appConfig.getProperty( "remember_geometry" ).equals( "true" ) ) {
|
||||||
if ( ManagerFrame.this.getExtendedState() == JFrame.NORMAL ) {
|
if ( ManagerFrame.this.getExtendedState() == JFrame.NORMAL ) {
|
||||||
Rectangle managerBounds = ManagerFrame.this.getBounds();
|
Rectangle managerBounds = ManagerFrame.this.getBounds();
|
||||||
int dividerLoc = splitPane.getDividerLocation();
|
int dividerLoc = splitPane.getDividerLocation();
|
||||||
String geometry = String.format( "x,%d;y,%d;w,%d;h,%d;divider,%d", managerBounds.x, managerBounds.y, managerBounds.width, managerBounds.height, dividerLoc );
|
String geometry = String.format( "x,%d;y,%d;w,%d;h,%d;divider,%d", managerBounds.x, managerBounds.y, managerBounds.width, managerBounds.height, dividerLoc );
|
||||||
appConfig.setProperty( "manager_geometry", geometry );
|
appConfig.setProperty( "manager_geometry", geometry );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
appConfig.writeConfig();
|
appConfig.writeConfig();
|
||||||
|
@ -348,6 +350,7 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver
|
||||||
this.setMinimumSize( new Dimension( 300, modActionsPanel.getPreferredSize().height+90 ) );
|
this.setMinimumSize( new Dimension( 300, modActionsPanel.getPreferredSize().height+90 ) );
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
|
|
||||||
|
if ( appConfig.getProperty( "remember_geometry" ).equals( "true" ) )
|
||||||
setGeometryFromConfig();
|
setGeometryFromConfig();
|
||||||
|
|
||||||
showAboutInfo();
|
showAboutInfo();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue