Setup additional elements that are only required when running with a GUI, rather than from the command-line. Note that this will not be called when the Mode is used from the command line (because Base will be null).
()
| 197 | * the Mode is used from the command line (because Base will be null). |
| 198 | */ |
| 199 | public void setupGUI() { |
| 200 | try { |
| 201 | // First load the default theme data for the whole PDE. |
| 202 | theme = new Settings(Platform.getContentFile("lib/theme.txt")); |
| 203 | |
| 204 | // The mode-specific theme.txt file should only contain additions, |
| 205 | // and in extremely rare cases, it might override entries from the |
| 206 | // main theme. Do not override for style changes unless they are |
| 207 | // objectively necessary for your Mode. |
| 208 | File modeTheme = new File(folder, "theme/theme.txt"); |
| 209 | if (modeTheme.exists()) { |
| 210 | // Override the built-in settings with what the theme provides |
| 211 | theme.load(modeTheme); |
| 212 | } |
| 213 | |
| 214 | // Against my better judgment, adding the ability to override themes |
| 215 | // https://github.com/processing/processing/issues/5445 |
| 216 | File sketchbookTheme = |
| 217 | new File(Base.getSketchbookFolder(), "theme.txt"); |
| 218 | if (sketchbookTheme.exists()) { |
| 219 | theme.load(sketchbookTheme); |
| 220 | } |
| 221 | |
| 222 | // other things that have to be set explicitly for the defaults |
| 223 | theme.setColor("run.window.bgcolor", SystemColor.control); |
| 224 | |
| 225 | } catch (IOException e) { |
| 226 | Messages.showError("Problem loading theme.txt", |
| 227 | "Could not load theme.txt, please re-install Processing", e); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | |
| 232 | public File getContentFile(String path) { |
no test coverage detected