Skip to content

Commit 8a5026d

Browse files
committed
rename pref, add pref to window for sketch name sync
1 parent 3d2f59b commit 8a5026d

4 files changed

Lines changed: 15 additions & 11 deletions

File tree

app/src/processing/app/Sketch.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public void handleRenameCode() {
350350
// ask for new name of file (internal to window)
351351
// TODO maybe just pop up a text area?
352352
renamingCode = true;
353-
String prompt = (currentIndex == 0 && Preferences.getBoolean("sketch.sync_folder_and_filename")) ?
353+
String prompt = (currentIndex == 0 && Preferences.getBoolean("editor.sync_folder_and_filename")) ?
354354
Language.text("editor.sketch.rename.description") :
355355
Language.text("editor.tab.rename.description");
356356
String oldName = (current.isExtension(mode.getDefaultExtension())) ?
@@ -535,7 +535,7 @@ protected void nameCode(String newName) {
535535

536536
if (renamingCode) {
537537
if (currentIndex == 0 &&
538-
Preferences.getBoolean("sketch.sync_folder_and_filename")) {
538+
Preferences.getBoolean("editor.sync_folder_and_filename")) {
539539
if (!renameSketch(newName, newExtension)) return;
540540

541541
} else { // else if something besides code[0], or ok to decouple name
@@ -890,7 +890,7 @@ public boolean saveAs() throws IOException {
890890
// user canceled selection
891891
if (newSketchName == null) return false;
892892

893-
boolean sync = Preferences.getBoolean("sketch.sync_folder_and_filename");
893+
boolean sync = Preferences.getBoolean("editor.sync_folder_and_filename");
894894
String newMainFileName = null; // only set with !sync
895895
File newFolder;
896896
if (sync) {

app/src/processing/app/ui/PreferencesFrame.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public class PreferencesFrame {
7474
JCheckBox zoomAutoBox;
7575

7676
JCheckBox hidpiDisableBox;
77+
JCheckBox syncSketchNameBox;
7778

7879
JComboBox<String> displaySelectionBox;
7980
JComboBox<String> languageSelectionBox;
@@ -187,6 +188,10 @@ public PreferencesFrame(Base base) {
187188
hidpiDisableBox.setVisible(false); // only for Windows
188189

189190

191+
// [ ] Keep sketch name and main tab name in sync
192+
syncSketchNameBox = new JCheckBox("Keep sketch name and main tab in sync (experimental)");
193+
194+
190195
// Colors
191196

192197
JLabel backgroundColorLabel = new JLabel(Language.text("preferences.background_color")+": ");
@@ -429,6 +434,7 @@ public void mouseExited(MouseEvent e) {
429434
.addComponent(mbLabel))
430435
.addComponent(deletePreviousBox)
431436
.addComponent(checkUpdatesBox)
437+
.addComponent(syncSketchNameBox)
432438
.addGroup(layout.createSequentialGroup()
433439
.addComponent(displayLabel)
434440
.addComponent(displaySelectionBox,
@@ -489,6 +495,7 @@ public void mouseExited(MouseEvent e) {
489495
.addComponent(mbLabel))
490496
.addComponent(deletePreviousBox)
491497
.addComponent(checkUpdatesBox)
498+
.addComponent(syncSketchNameBox)
492499
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
493500
.addComponent(displayLabel)
494501
.addComponent(displaySelectionBox))
@@ -666,6 +673,7 @@ protected void applyFrame() {
666673
if (Platform.isWindows()) {
667674
Splash.setDisableHiDPI(hidpiDisableBox.isSelected());
668675
}
676+
Preferences.setBoolean("editor.sync_folder_and_filename", syncSketchNameBox.isSelected());
669677

670678
Preferences.setColor("run.present.bgcolor", presentColor.getBackground());
671679

@@ -731,6 +739,7 @@ public void showFrame() {
731739
if (Platform.isWindows()) {
732740
hidpiDisableBox.setSelected(Splash.getDisableHiDPI());
733741
}
742+
syncSketchNameBox.setSelected(Preferences.getBoolean("editor.sync_folder_and_filename"));
734743

735744
presentColor.setBackground(Preferences.getColor("run.present.bgcolor"));
736745
presentColorHex.setText(Preferences.get("run.present.bgcolor").substring(1));

build/shared/lib/defaults.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
32

43

@@ -57,7 +56,7 @@ last.sketch.count = 0
5756
last.sketch.restore = true
5857

5958
# set 'true' for the default behavior before 4.0b6
60-
sketch.sync_folder_and_filename = true
59+
editor.sync_folder_and_filename = true
6160

6261
# by default, contributions are moved to backup folders when
6362
# they are removed or replaced. The locations of the backup

todo.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ X change cmd-click in window title to point to sketch folder
66

77
change detector
88
X text in second line of custom dialogs was showing too large
9-
X i.e. change detector with large text for the "either way" part of the message
9+
X change detector had large text for the "either way" part of the message
1010
X remove nonsense removeCode() error text
1111

1212
modes and properties
1313
X major rewrite of handleOpen() et al
1414
X fix bug when changing the Mode between Java and Android
1515
X appears that it would have been broken for a long time
16-
17-
18-
_ PDF export not working with Processing 4.0 beta 5
19-
_ was working with beta 3 and 4
20-
_ https://github.com/processing/processing4/issues/395
16+
X add option to disable keeping sketch folder and main tab in sync
2117

2218

2319
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

0 commit comments

Comments
 (0)