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( "never_run_ftl", "false" );
|
||||
config.setProperty( "use_default_ui", "false" );
|
||||
config.setProperty( "remember_geometry", "true" );
|
||||
// "update_catalog" doesn't have a default.
|
||||
// "manager_geometry" doesn't have a default.
|
||||
|
||||
// Read the config file.
|
||||
InputStream in = null;
|
||||
|
|
|
@ -45,12 +45,14 @@ public class SlipstreamConfig {
|
|||
out = new FileOutputStream( configFile );
|
||||
String configComments = "";
|
||||
configComments += "\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 += " 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 += " 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 += " 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 += " 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.\n";
|
||||
configComments += " use_default_ui - If true, no attempt will be made to resemble a native GUI. Default: false.\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" );
|
||||
config.store( writer, configComments );
|
||||
|
|
|
@ -241,11 +241,13 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver
|
|||
|
||||
SlipstreamConfig appConfig = ManagerFrame.this.appConfig;
|
||||
|
||||
if ( ManagerFrame.this.getExtendedState() == JFrame.NORMAL ) {
|
||||
Rectangle managerBounds = ManagerFrame.this.getBounds();
|
||||
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 );
|
||||
appConfig.setProperty( "manager_geometry", geometry );
|
||||
if ( appConfig.getProperty( "remember_geometry" ).equals( "true" ) ) {
|
||||
if ( ManagerFrame.this.getExtendedState() == JFrame.NORMAL ) {
|
||||
Rectangle managerBounds = ManagerFrame.this.getBounds();
|
||||
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 );
|
||||
appConfig.setProperty( "manager_geometry", geometry );
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -348,7 +350,8 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver
|
|||
this.setMinimumSize( new Dimension( 300, modActionsPanel.getPreferredSize().height+90 ) );
|
||||
this.setLocationRelativeTo(null);
|
||||
|
||||
setGeometryFromConfig();
|
||||
if ( appConfig.getProperty( "remember_geometry" ).equals( "true" ) )
|
||||
setGeometryFromConfig();
|
||||
|
||||
showAboutInfo();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue