@@ -143,7 +143,7 @@ static public void guardedMain(String args[]) throws Exception {
143
143
144
144
BaseNoGui .initParameters (args );
145
145
146
- System .setProperty ("swing.aatext" , Preferences .get ("editor.antialias" , "true" ));
146
+ System .setProperty ("swing.aatext" , PreferencesData .get ("editor.antialias" , "true" ));
147
147
148
148
BaseNoGui .initVersion ();
149
149
@@ -257,9 +257,9 @@ public Base(String[] args) throws Exception {
257
257
if (sketchbookPath == null ) {
258
258
File defaultFolder = getDefaultSketchbookFolderOrPromptForIt ();
259
259
if (BaseNoGui .getPortableFolder () != null )
260
- Preferences .set ("sketchbook.path" , BaseNoGui .getPortableSketchbookFolder ());
260
+ PreferencesData .set ("sketchbook.path" , BaseNoGui .getPortableSketchbookFolder ());
261
261
else
262
- Preferences .set ("sketchbook.path" , defaultFolder .getAbsolutePath ());
262
+ PreferencesData .set ("sketchbook.path" , defaultFolder .getAbsolutePath ());
263
263
if (!defaultFolder .exists ()) {
264
264
defaultFolder .mkdirs ();
265
265
}
@@ -293,7 +293,7 @@ public Base(String[] args) throws Exception {
293
293
294
294
boolean showEditor = parser .isGuiMode ();
295
295
if (!parser .isForceSavePrefs ())
296
- Preferences .setDoSave (showEditor );
296
+ PreferencesData .setDoSave (showEditor );
297
297
if (handleOpen (file , nextEditorLocation (), showEditor ) == null ) {
298
298
String mess = I18n .format (_ ("Failed to open sketch: \" {0}\" " ), path );
299
299
// Open failure is fatal in upload/verify mode
@@ -406,13 +406,13 @@ protected void onProgress(Progress progress) {
406
406
} else if (parser .isVerifyOrUploadMode ()) {
407
407
splashScreenHelper .close ();
408
408
// Set verbosity for command line build
409
- Preferences .set ("build.verbose" , "" + parser .isDoVerboseBuild ());
410
- Preferences .set ("upload.verbose" , "" + parser .isDoVerboseUpload ());
411
- Preferences .set ("runtime.preserve.temp.files" , Boolean .toString (parser .isPreserveTempFiles ()));
409
+ PreferencesData .set ("build.verbose" , "" + parser .isDoVerboseBuild ());
410
+ PreferencesData .set ("upload.verbose" , "" + parser .isDoVerboseUpload ());
411
+ PreferencesData .set ("runtime.preserve.temp.files" , Boolean .toString (parser .isPreserveTempFiles ()));
412
412
413
413
// Make sure these verbosity preferences are only for the
414
414
// current session
415
- Preferences .setDoSave (false );
415
+ PreferencesData .setDoSave (false );
416
416
417
417
Editor editor = editors .get (0 );
418
418
@@ -443,14 +443,14 @@ protected void onProgress(Progress progress) {
443
443
}
444
444
445
445
// Check for updates
446
- if (Preferences .getBoolean ("update.check" )) {
446
+ if (PreferencesData .getBoolean ("update.check" )) {
447
447
new UpdateCheck (this );
448
448
}
449
449
} else if (parser .isNoOpMode ()) {
450
450
// Do nothing (intended for only changing preferences)
451
451
System .exit (0 );
452
452
} else if (parser .isGetPrefMode ()) {
453
- String value = Preferences .get (parser .getGetPref (), null );
453
+ String value = PreferencesData .get (parser .getGetPref (), null );
454
454
if (value != null ) {
455
455
System .out .println (value );
456
456
System .exit (0 );
@@ -474,11 +474,11 @@ protected boolean restoreSketches() throws Exception {
474
474
Dimension screen = Toolkit .getDefaultToolkit ().getScreenSize ();
475
475
boolean windowPositionValid = true ;
476
476
477
- if (Preferences .get ("last.screen.height" ) != null ) {
477
+ if (PreferencesData .get ("last.screen.height" ) != null ) {
478
478
// if screen size has changed, the window coordinates no longer
479
479
// make sense, so don't use them unless they're identical
480
- int screenW = Preferences .getInteger ("last.screen.width" );
481
- int screenH = Preferences .getInteger ("last.screen.height" );
480
+ int screenW = PreferencesData .getInteger ("last.screen.width" );
481
+ int screenH = PreferencesData .getInteger ("last.screen.height" );
482
482
483
483
if ((screen .width != screenW ) || (screen .height != screenH )) {
484
484
windowPositionValid = false ;
@@ -499,10 +499,10 @@ protected boolean restoreSketches() throws Exception {
499
499
// If !windowPositionValid, then ignore the coordinates found for each.
500
500
501
501
// Save the sketch path and window placement for each open sketch
502
- int count = Preferences .getInteger ("last.sketch.count" );
502
+ int count = PreferencesData .getInteger ("last.sketch.count" );
503
503
int opened = 0 ;
504
504
for (int i = 0 ; i < count ; i ++) {
505
- String path = Preferences .get ("last.sketch" + i + ".path" );
505
+ String path = PreferencesData .get ("last.sketch" + i + ".path" );
506
506
if (BaseNoGui .getPortableFolder () != null ) {
507
507
File absolute = new File (BaseNoGui .getPortableFolder (), path );
508
508
try {
@@ -513,7 +513,7 @@ protected boolean restoreSketches() throws Exception {
513
513
}
514
514
int [] location ;
515
515
if (windowPositionValid ) {
516
- String locationStr = Preferences .get ("last.sketch" + i + ".location" );
516
+ String locationStr = PreferencesData .get ("last.sketch" + i + ".location" );
517
517
location = PApplet .parseInt (PApplet .split (locationStr , ',' ));
518
518
} else {
519
519
location = nextEditorLocation ();
@@ -534,8 +534,8 @@ protected boolean restoreSketches() throws Exception {
534
534
protected void storeSketches () {
535
535
// Save the width and height of the screen
536
536
Dimension screen = Toolkit .getDefaultToolkit ().getScreenSize ();
537
- Preferences .setInteger ("last.screen.width" , screen .width );
538
- Preferences .setInteger ("last.screen.height" , screen .height );
537
+ PreferencesData .setInteger ("last.screen.width" , screen .width );
538
+ PreferencesData .setInteger ("last.screen.height" , screen .height );
539
539
540
540
String untitledPath = untitledFolder .getAbsolutePath ();
541
541
@@ -554,14 +554,14 @@ protected void storeSketches() {
554
554
if (path == null )
555
555
continue ;
556
556
}
557
- Preferences .set ("last.sketch" + index + ".path" , path );
557
+ PreferencesData .set ("last.sketch" + index + ".path" , path );
558
558
559
559
int [] location = editor .getPlacement ();
560
560
String locationStr = PApplet .join (PApplet .str (location ), "," );
561
- Preferences .set ("last.sketch" + index + ".location" , locationStr );
561
+ PreferencesData .set ("last.sketch" + index + ".location" , locationStr );
562
562
index ++;
563
563
}
564
- Preferences .setInteger ("last.sketch.count" , index );
564
+ PreferencesData .setInteger ("last.sketch.count" , index );
565
565
}
566
566
567
567
@@ -577,7 +577,7 @@ protected void storeSketchPath(Editor editor, int index) {
577
577
if (path == null )
578
578
path = "" ;
579
579
}
580
- Preferences .set ("last.sketch" + index + ".path" , path );
580
+ PreferencesData .set ("last.sketch" + index + ".path" , path );
581
581
}
582
582
583
583
@@ -616,8 +616,8 @@ protected void handleActivated(Editor whichEditor) {
616
616
617
617
618
618
protected int [] nextEditorLocation () {
619
- int defaultWidth = Preferences .getInteger ("editor.window.width.default" );
620
- int defaultHeight = Preferences .getInteger ("editor.window.height.default" );
619
+ int defaultWidth = PreferencesData .getInteger ("editor.window.width.default" );
620
+ int defaultHeight = PreferencesData .getInteger ("editor.window.height.default" );
621
621
622
622
if (activeEditor == null ) {
623
623
Rectangle screen = GraphicsEnvironment .getLocalGraphicsEnvironment ().getDefaultScreenDevice ().getDefaultConfiguration ().getBounds ();
@@ -808,7 +808,7 @@ public void handleOpenReplace(File file) {
808
808
public void handleOpenPrompt () throws Exception {
809
809
// get the frontmost window frame for placing file dialog
810
810
FileDialog fd = new FileDialog (activeEditor , _ ("Open an Arduino sketch..." ), FileDialog .LOAD );
811
- File lastFolder = new File (Preferences .get ("last.folder" , getSketchbookFolder ().getAbsolutePath ()));
811
+ File lastFolder = new File (PreferencesData .get ("last.folder" , getSketchbookFolder ().getAbsolutePath ()));
812
812
if (lastFolder .exists () && lastFolder .isFile ()) {
813
813
lastFolder = lastFolder .getParentFile ();
814
814
}
@@ -832,7 +832,7 @@ public boolean accept(File dir, String name) {
832
832
833
833
File inputFile = new File (directory , filename );
834
834
835
- Preferences .set ("last.folder" , inputFile .getAbsolutePath ());
835
+ PreferencesData .set ("last.folder" , inputFile .getAbsolutePath ());
836
836
handleOpen (inputFile );
837
837
}
838
838
@@ -1378,9 +1378,9 @@ private JRadioButtonMenuItem createBoardMenusAndCustomMenus(
1378
1378
Map <String , ButtonGroup > buttonGroupsMap ,
1379
1379
TargetBoard board , TargetPlatform targetPlatform , TargetPackage targetPackage )
1380
1380
throws Exception {
1381
- String selPackage = Preferences .get ("target_package" );
1382
- String selPlatform = Preferences .get ("target_platform" );
1383
- String selBoard = Preferences .get ("board" );
1381
+ String selPackage = PreferencesData .get ("target_package" );
1382
+ String selPlatform = PreferencesData .get ("target_platform" );
1383
+ String selBoard = PreferencesData .get ("board" );
1384
1384
1385
1385
String boardId = board .getId ();
1386
1386
String packageName = targetPackage .getId ();
@@ -1418,7 +1418,7 @@ public void actionPerformed(ActionEvent actionevent) {
1418
1418
@ SuppressWarnings ("serial" )
1419
1419
Action subAction = new AbstractAction (_ (boardCustomMenu .get (customMenuOption ))) {
1420
1420
public void actionPerformed (ActionEvent e ) {
1421
- Preferences .set ("custom_" + menuId , ((TargetBoard ) getValue ("board" )).getId () + "_" + getValue ("custom_menu_option" ));
1421
+ PreferencesData .set ("custom_" + menuId , ((TargetBoard ) getValue ("board" )).getId () + "_" + getValue ("custom_menu_option" ));
1422
1422
onBoardOrPortChange ();
1423
1423
}
1424
1424
};
@@ -1433,7 +1433,7 @@ public void actionPerformed(ActionEvent e) {
1433
1433
menu .add (subItem );
1434
1434
buttonGroupsMap .get (menuId ).add (subItem );
1435
1435
1436
- String selectedCustomMenuEntry = Preferences .get ("custom_" + menuId );
1436
+ String selectedCustomMenuEntry = PreferencesData .get ("custom_" + menuId );
1437
1437
if (selBoard .equals (boardId ) && (boardId + "_" + customMenuOption ).equals (selectedCustomMenuEntry )) {
1438
1438
menuItemsToClickAfterStartup .add (subItem );
1439
1439
}
@@ -1534,12 +1534,12 @@ public void rebuildProgrammerMenu(JMenu menu) {
1534
1534
AbstractAction action = new AbstractAction (targetPlatform
1535
1535
.getProgrammer (programmer ).get ("name" )) {
1536
1536
public void actionPerformed (ActionEvent actionevent ) {
1537
- Preferences .set ("programmer" , "" + getValue ("id" ));
1537
+ PreferencesData .set ("programmer" , "" + getValue ("id" ));
1538
1538
}
1539
1539
};
1540
1540
action .putValue ("id" , id );
1541
1541
JMenuItem item = new JRadioButtonMenuItem (action );
1542
- if (Preferences .get ("programmer" ).equals (id ))
1542
+ if (PreferencesData .get ("programmer" ).equals (id ))
1543
1543
item .setSelected (true );
1544
1544
group .add (item );
1545
1545
menu .add (item );
0 commit comments