mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
working on how to debug theme.txt changes
This commit is contained in:
@@ -42,10 +42,6 @@ public class Theme {
|
||||
static Settings theme;
|
||||
|
||||
static public void init() {
|
||||
load();
|
||||
}
|
||||
|
||||
static public void load() {
|
||||
try {
|
||||
File inputFile = Platform.getContentFile("lib/theme.txt");
|
||||
if (inputFile == null) {
|
||||
@@ -54,6 +50,8 @@ public class Theme {
|
||||
// First load the default theme data for the whole PDE.
|
||||
theme = new Settings(inputFile);
|
||||
|
||||
// A spot-check of Modes shows that theme.txt is not being overridden,
|
||||
// so removing this (questionable, warned against) capability for 4.0a6.
|
||||
/*
|
||||
// The mode-specific theme.txt file should only contain additions,
|
||||
// and in extremely rare cases, it might override entries from the
|
||||
@@ -66,22 +64,30 @@ public class Theme {
|
||||
}
|
||||
*/
|
||||
|
||||
// https://github.com/processing/processing/issues/5445
|
||||
File sketchbookTheme = getSketchbookFile();
|
||||
// new File(Base.getSketchbookFolder(), "theme.txt");
|
||||
if (sketchbookTheme.exists()) {
|
||||
theme.load(sketchbookTheme);
|
||||
}
|
||||
|
||||
// other things that have to be set explicitly for the defaults
|
||||
theme.setColor("run.window.bgcolor", SystemColor.control);
|
||||
|
||||
// pull in the version from the user's sketchbook folder
|
||||
load();
|
||||
|
||||
} catch (IOException e) {
|
||||
Messages.showError("Problem loading theme.txt",
|
||||
"Could not load theme.txt, please re-install Processing", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load theme.txt from the user's sketchbook folder.
|
||||
*/
|
||||
static public void load() {
|
||||
File sketchbookTheme = getSketchbookFile();
|
||||
if (sketchbookTheme.exists()) {
|
||||
theme.load(sketchbookTheme);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public void save() {
|
||||
theme.save(getSketchbookFile());
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user