working on how to debug theme.txt changes

This commit is contained in:
Ben Fry
2021-07-08 06:25:22 -04:00
parent 17389ed858
commit 80ee40d035
2 changed files with 45 additions and 17 deletions
@@ -2,6 +2,9 @@ package processing.app.tools;
import processing.app.Base;
import processing.app.ui.Editor;
import processing.app.ui.Theme;
import java.io.File;
public class ThemeEngine implements Tool {
@@ -19,13 +22,32 @@ public class ThemeEngine implements Tool {
public void run() {
//setVisible(true);
//Preferences.init();
Editor activeEditor = base.getActiveEditor();
for (Editor editor : base.getEditors()) {
System.out.println("Updating theme for " + editor.getSketch().getName());
//editor.applyPreferences();
editor.updateTheme();
File sketchbookFile = Theme.getSketchbookFile();
if (!sketchbookFile.exists()) {
// When first called, just create the theme.txt file
Theme.save();
if (activeEditor != null) {
activeEditor.statusNotice("Saved theme.txt to " + sketchbookFile);
}
} else {
// Normally, just reset the theme by loading theme.txt
//setVisible(true);
//Preferences.init();
Theme.load();
for (Editor editor : base.getEditors()) {
System.out.println("Updating theme for " + editor.getSketch().getName());
//editor.applyPreferences();
editor.updateTheme();
}
if (activeEditor != null) {
activeEditor.statusNotice("Finished updating theme.");
}
}
}
}