Skip to content

Commit 201cab6

Browse files
SteftervSableRaf
andauthored
New Preferences Screen (#1318)
* Remove ContributionManager and ContributionPane UI files Deleted ContributionManager.kt and ContributionPane.kt from the contrib/ui directory. This removes the Compose-based contributions manager and its detail pane prototypes which got merged unnecessarily * Enhance Preferences reactivity and test coverage Refactored ReactiveProperties to use snapshotStateMap for Compose reactivity. Improved PreferencesProvider and watchFile composables with better file watching, override support via system properties, and added documentation. Updated PreferencesKtTest to use temporary files and verify file-to-UI reactivity. * Small bugfix for removed function * Add compose ui test to the deps * Refactor Locale class and add LocaleProvider test * Make setLocale parameter nullable in Locale class Changed the setLocale parameter in the Locale class to be nullable and updated its usage to safely invoke it. This allows for more flexible instantiation when a setLocale function is not required. * Add compose ui test to the deps * Update locale change method in test Replaces the call to locale.setLocale with locale.set in LocaleKtTest to match the updated API for changing the locale. * Add PDE window utilities for Compose and Swing Introduces PDESwingWindow and PDEComposeWindow classes to simplify creating themed and localized windows in Compose and Swing applications. Includes macOS-specific handling for full window content and localization support for window titles. * Refactor beta welcome window handling Replaces custom JFrame setup in WelcomeToBeta with PDESwingWindow and PDEComposeWindow, centralizing window logic and close handling. Adds onClose callback to PDESwingWindow for improved lifecycle management. Also ensures beta welcome preference is reset on forced update check. * Remove ContributionManager and ContributionPane UI files (#1276) Deleted ContributionManager.kt and ContributionPane.kt from the contrib/ui directory. This removes the Compose-based contributions manager and its detail pane prototypes which got merged unnecessarily * Refactor Locale class and add LocaleProvider test (#1283) * Refactor Locale class and add LocaleProvider test * Make setLocale parameter nullable in Locale class Changed the setLocale parameter in the Locale class to be nullable and updated its usage to safely invoke it. This allows for more flexible instantiation when a setLocale function is not required. * Add compose ui test to the deps * Update locale change method in test Replaces the call to locale.setLocale with locale.set in LocaleKtTest to match the updated API for changing the locale. * Theming (#1298) * Add Material3-based Processing theme and typography Introduces Colors.kt with custom color schemes for light and dark themes using Material3. Refactors Theme.kt to use Material3 theming, adds a PDETheme composable, and provides a desktop preview app for theme components. Updates Typography.kt to use Space Grotesk font family and defines new typography styles for Material3. * Refactor to use Material3 and update theme usage Replaces Material2 components with Material3 in WelcomeToBeta, removes custom PDEButton in favor of Material3 Button, and updates theme usage to PDETheme. Also simplifies background modifier in PDETheme and removes unused Kotlin Multiplatform plugin from build.gradle.kts. * Add Space Grotesk font files and license Includes SpaceGrotesk font variants (Bold, Light, Medium, Regular, SemiBold) and the associated SIL Open Font License. This enables usage of the Space Grotesk typeface in the project. * Update markdown renderer to m3 and adjust UI Switched markdown renderer imports from m2 to m3 and updated the dependency version to 0.37.0. Adjusted WelcomeToBeta window size, layout, and logo dimensions for improved appearance. Ensured Box in Theme.kt fills available space for better layout consistency. * Switch from ProcessingTheme to PDETheme in window UI Replaces the use of ProcessingTheme with PDETheme in the PDEWindowContent composable * Refactor preferences to Jetpack Compose UI Replaces the legacy PreferencesFrame with a new Jetpack Compose-based preferences UI. Adds reactive preferences management using a custom ReactiveProperties class, and introduces modular preference groups (General, Interface, Other) with composable controls. Updates Base.java to launch the new preferences window, and refactors theme and window code for Compose integration. * Remove obsolete TODO for onClose callback * Refactor theme system to Material 3 color schemes Replaces legacy color definitions with Material 3 color schemes and introduces extended color support for warnings. Dialogs in Messages.kt are now implemented using Compose Material 3 components for a modern UI. Removes deprecated color sets and updates PDETheme to use new color schemes, improving consistency and maintainability. * Add PDEWelcome Composable UI screen Introduces a new PDEWelcome.kt file with a Composable UI for the Processing welcome screen. Includes layout with buttons for language selection, new sketch, examples, and sketchbook, as well as a placeholder for right-side content and a main entry point for launching the window. * Clean up handlePrefs method by removing comments Removed commented-out code for preferences frame initialization. * Initial layout * Revamp welcome screen UI and add social icons Refactors the PDEWelcome screen to improve layout, update button icons, and add support for Discord, GitHub, and Instagram SVG icons. The welcome screen now receives a Base instance for proper action handling, and new methods replace deprecated ones in Base.java. Updates related menu actions to pass the Base instance as needed. * Add example previews to welcome screen Replaces placeholder text on the right side of the PDEWelcome screen with a LazyColumn displaying example sketches. Each example attempts to show a preview image if available, or a placeholder icon otherwise. Introduces an Example data class and related image loading logic. * Add hover-activated play button to example previews Introduced a hover effect on example preview images in the welcome screen, displaying a play button that opens the example when clicked. Refactored title key usage for consistency. * Localize welcome screen UI strings Replaced hardcoded strings in the PDEWelcome screen with localized values using the LocalLocale context. Added new keys for the welcome screen to the English and Dutch language property files to support internationalization. * Composable Preferences rewrite (#1277) * Remove ContributionManager and ContributionPane UI files Deleted ContributionManager.kt and ContributionPane.kt from the contrib/ui directory. This removes the Compose-based contributions manager and its detail pane prototypes which got merged unnecessarily * Enhance Preferences reactivity and test coverage Refactored ReactiveProperties to use snapshotStateMap for Compose reactivity. Improved PreferencesProvider and watchFile composables with better file watching, override support via system properties, and added documentation. Updated PreferencesKtTest to use temporary files and verify file-to-UI reactivity. * Small bugfix for removed function * Add compose ui test to the deps * Add language selector and UI improvements to welcome screen Introduces a language selection dropdown to the PDE welcome screen using a shared composable from preferences. Refactors the layout for better spacing, updates example cards with animated overlays, and replaces the show-on-startup button with a checkbox. Also adds a new translation key for the open example button. * Refactor example listing and randomize welcome sketches Moved example folder listing logic in Contributions.ExamplesList to a companion object function for reuse. Updated PDEWelcome to display a randomized selection of sketches from all available examples, replacing the previous static list. * Refactor example handling to use Sketch objects Replaces Example objects with Sketch objects for managing example sketches in the welcome screen. Updates all relevant usages to reference Sketch properties, simplifying the code and improving clarity. * Add vertical scrollbar to welcome screen examples Introduces a VerticalScrollbar to the examples list in the PDEWelcome screen for improved navigation. Also adjusts spacing and arrangement in several UI components for better layout consistency, and updates the welcome screen title in the language properties. * Add rounded corners to buttons in PDEWelcome Introduced a RoundedCornerShape with 12.dp radius and applied it to various buttons in the PDEWelcome screen for improved UI consistency and aesthetics. * Refactor PDEWelcome UI and add Sketch card composable Refactored the PDEWelcome screen for improved structure and readability, including extracting the example preview into a reusable Sketch.card composable. Updated icon usage for RTL support, adjusted layout and padding, and improved the examples list initialization. Also, customized scrollbar style in PDETheme for a more consistent UI appearance. * Add unique window handling to prevent duplicates Introduces a 'unique' parameter to PDESwingWindow and PDEComposeWindow, allowing windows to be identified by a KClass and preventing multiple instances of the same window. If a window with the same unique identifier exists, it is brought to the front and the new one is disposed. This helps avoid duplicate welcome or other singleton windows. * Refactor dialog handling and improve AlertDialog UI Refactored the showDialog function to accept a modifier and updated all AlertDialog usages to use RectangleShape and the modifier parameter. Improved dialog sizing and positioning by dynamically adjusting the window size based on content, and set additional window properties for better integration on macOS. * Set application window icon using Toolkit.setIcon Added calls to Toolkit.setIcon(window) in Start.kt and Window.kt to ensure the application window icon is set consistent * Simplify imports and update scrollbar colors in Theme.kt Consolidated import statements for Compose libraries using wildcard imports to reduce verbosity. Updated scrollbar hover and unhover colors to use the default outlineVariant color without alpha modification. * Preferences screen Adds most of the options for the preferences screen based on the new design * Replace Row with Column in sketch naming options Changed the layout container from Row to Column for the sketch naming options in the General preferences UI. This improves vertical arrangement and removes unnecessary padding modifiers. * Enhance preferences UI and add memory options Refactored preferences UI to swap primary and tertiary colors, improved sidebar button color handling, and updated search bar logic. Added clickable folder icon for sketchbook location selection. Improved interface scale slider logic and display. Added new preferences for increasing available memory and max memory, with enable/disable logic. Updated experimental preferences to use localized description keys if available. Extended ShimAWT to support folder selection via callback and refactored file/folder selection logic for better composability. Updated language properties with new preference keys and descriptions. * Fixed a color issue * Improve preferences UI layout and window size Increased the preferences window width from 800 to 850 pixels for better layout. Updated the General preferences to display FilterChip options in rows with spacing, improving visual organization and usability. * Add theme selection and UI improvements to preferences Introduces a theme selector for the editor in the Interface preferences, allowing users to choose between system, dark, and light themes. Updates Coding and General preferences with improved layout and feedback, including a copied state for diagnostics. Updates localization strings to support new features and labels. * Added the ability to undo the changes + icon/language changes * Update animation spec for slideInVertically Changed the animationSpec for slideInVertically from a 500ms EaseOutBounce to a 300ms default tween for consistency and smoother transitions. * Welcome screen implementation (#1307) * Remove ContributionManager and ContributionPane UI files Deleted ContributionManager.kt and ContributionPane.kt from the contrib/ui directory. This removes the Compose-based contributions manager and its detail pane prototypes which got merged unnecessarily * Enhance Preferences reactivity and test coverage Refactored ReactiveProperties to use snapshotStateMap for Compose reactivity. Improved PreferencesProvider and watchFile composables with better file watching, override support via system properties, and added documentation. Updated PreferencesKtTest to use temporary files and verify file-to-UI reactivity. * Small bugfix for removed function * Add compose ui test to the deps * Refactor theme system to Material 3 color schemes Replaces legacy color definitions with Material 3 color schemes and introduces extended color support for warnings. Dialogs in Messages.kt are now implemented using Compose Material 3 components for a modern UI. Removes deprecated color sets and updates PDETheme to use new color schemes, improving consistency and maintainability. * Add PDEWelcome Composable UI screen Introduces a new PDEWelcome.kt file with a Composable UI for the Processing welcome screen. Includes layout with buttons for language selection, new sketch, examples, and sketchbook, as well as a placeholder for right-side content and a main entry point for launching the window. * Initial layout * Revamp welcome screen UI and add social icons Refactors the PDEWelcome screen to improve layout, update button icons, and add support for Discord, GitHub, and Instagram SVG icons. The welcome screen now receives a Base instance for proper action handling, and new methods replace deprecated ones in Base.java. Updates related menu actions to pass the Base instance as needed. * Add example previews to welcome screen Replaces placeholder text on the right side of the PDEWelcome screen with a LazyColumn displaying example sketches. Each example attempts to show a preview image if available, or a placeholder icon otherwise. Introduces an Example data class and related image loading logic. * Add hover-activated play button to example previews Introduced a hover effect on example preview images in the welcome screen, displaying a play button that opens the example when clicked. Refactored title key usage for consistency. * Localize welcome screen UI strings Replaced hardcoded strings in the PDEWelcome screen with localized values using the LocalLocale context. Added new keys for the welcome screen to the English and Dutch language property files to support internationalization. * Add language selector and UI improvements to welcome screen Introduces a language selection dropdown to the PDE welcome screen using a shared composable from preferences. Refactors the layout for better spacing, updates example cards with animated overlays, and replaces the show-on-startup button with a checkbox. Also adds a new translation key for the open example button. * Refactor example listing and randomize welcome sketches Moved example folder listing logic in Contributions.ExamplesList to a companion object function for reuse. Updated PDEWelcome to display a randomized selection of sketches from all available examples, replacing the previous static list. * Refactor example handling to use Sketch objects Replaces Example objects with Sketch objects for managing example sketches in the welcome screen. Updates all relevant usages to reference Sketch properties, simplifying the code and improving clarity. * Add vertical scrollbar to welcome screen examples Introduces a VerticalScrollbar to the examples list in the PDEWelcome screen for improved navigation. Also adjusts spacing and arrangement in several UI components for better layout consistency, and updates the welcome screen title in the language properties. * Add rounded corners to buttons in PDEWelcome Introduced a RoundedCornerShape with 12.dp radius and applied it to various buttons in the PDEWelcome screen for improved UI consistency and aesthetics. * Refactor PDEWelcome UI and add Sketch card composable Refactored the PDEWelcome screen for improved structure and readability, including extracting the example preview into a reusable Sketch.card composable. Updated icon usage for RTL support, adjusted layout and padding, and improved the examples list initialization. Also, customized scrollbar style in PDETheme for a more consistent UI appearance. * Add unique window handling to prevent duplicates Introduces a 'unique' parameter to PDESwingWindow and PDEComposeWindow, allowing windows to be identified by a KClass and preventing multiple instances of the same window. If a window with the same unique identifier exists, it is brought to the front and the new one is disposed. This helps avoid duplicate welcome or other singleton windows. * Refactor dialog handling and improve AlertDialog UI Refactored the showDialog function to accept a modifier and updated all AlertDialog usages to use RectangleShape and the modifier parameter. Improved dialog sizing and positioning by dynamically adjusting the window size based on content, and set additional window properties for better integration on macOS. * Set application window icon using Toolkit.setIcon Added calls to Toolkit.setIcon(window) in Start.kt and Window.kt to ensure the application window icon is set consistent * Simplify imports and update scrollbar colors in Theme.kt Consolidated import statements for Compose libraries using wildcard imports to reduce verbosity. Updated scrollbar hover and unhover colors to use the default outlineVariant color without alpha modification. * Removing the Preferences work to keep the PR clean * Update background color in PDEWelcome UI Changed the background color from surfaceContainerLow to surfaceContainerLowest in the PDEWelcome composable for improved visual consistency with the MaterialTheme. * Tweak welcome actions naming and order - Rename `Empty Sketch` to `New Sketch` - Rename `Sketchbook` to `My Sketches` - Move `Open Examples` below `My Sketches` * Rather than setting the decorations app wide, just modify the editor screen --------- Co-authored-by: Raphaël de Courville <groupes.raphael@gmail.com> * Replace ProcessingTheme with PDETheme in WelcomeSurvey * Add Material Theme Builder file headers Added autogenerated file headers to Color.kt and Theme.kt indicating they were generated by the Material Theme Builder tool and should not be edited directly. Also reordered imports in Theme.kt for consistency. * Fix preferences file override and update test property Corrects the logic for selecting the preferences file in PreferencesProvider to use the override if present. Updates the test to set the correct system property for the settings folder. * Update Theme.kt * Normalize backward slashes in preferences file Added logic to replace backward slashes with forward slashes in the preferences file to ensure consistent path formatting. Updated tests to verify the normalization behavior. * Add support for preferences file override and path normalization Allows overriding the preferences file location via the 'processing.app.preferences.file' system property. Also normalizes slashes in preference values to forward slashes. Updates tests to verify path normalization and override behavior. --------- Co-authored-by: Raphaël de Courville <groupes.raphael@gmail.com>
1 parent 1237c55 commit 201cab6

File tree

16 files changed

+1989
-137
lines changed

16 files changed

+1989
-137
lines changed

app/src/main/resources/languages/PDE.properties

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,39 +205,91 @@ close.unsaved_changes = Save changes to %s?
205205

206206
# Preferences (Frame)
207207
preferences = Preferences
208+
preferences.description=Change how Processing works on your computer. These settings affect all Processing windows and stay the same even after you restart.
209+
preferences.pane.general=General
210+
preferences.pane.interface=Appearance
211+
preferences.pane.editor=Code
212+
preferences.pane.sketches=Sketches
213+
preferences.pane.other=Advanced
214+
preferences.new=New
215+
preferences.reset=Reset to Defaults
216+
preferences.reset_changes=Reset
217+
preferences.unconfirmed_changes=You have unsaved changes!
218+
preferences.apply_changes=Confirm Changes
219+
preferences.experimental=Experimental
220+
preferences.no_results=No results found
221+
preferences.sync_folder_and_filename=Folder name matches sketch name
222+
preferences.sync_folder_and_filename.tip=When enabled, renaming a sketch will also rename its folder to match the sketch name. [Learn more](https://discourse.processing.org/t/sketch-folder-and-sketch-name-syncing/15345)
223+
preferences.show_welcome_screen=Show welcome screen at startup
224+
preferences.diagnostics=Generate diagnostic report for support
225+
preferences.diagnostics.tip=Copies information about your installation into your clipboard, useful for troubleshooting issues.
226+
preferences.diagnostics.button=Generate Report
227+
preferences.diagnostics.button.copied=Report copied to clipboard
208228
preferences.button.width = 80
209229
preferences.restart_required = Restart Processing to apply changes
210230
preferences.sketchbook_location = Sketchbook folder
211231
preferences.sketchbook_location.popup = Sketchbook folder
212232
preferences.sketch_naming = Sketch name
213-
preferences.language = Language:
214-
preferences.editor_and_console_font = Editor and Console font:
215-
preferences.editor_and_console_font.tip = Select the font used in the Editor and the Console.<br>Only monospaced (fixed-width) fonts may be used,<br>though the list may be imperfect.
216-
preferences.editor_font_size = Editor font size:
217-
preferences.console_font_size = Console font size:
218-
preferences.interface_scale = Interface scale:
233+
preferences.sketch_naming.tip=Choose how new sketches are named and numbered.
234+
preferences.language=Language
235+
preferences.editor_and_console_font=Editor and Console font
236+
preferences.editor_and_console_font.tip=Installed Monospaced fonts will be displayed as options.
237+
preferences.editor_font_size=Editor font size
238+
preferences.console_font_size=Console font size
239+
preferences.editor.theme=Theme
240+
preferences.editor.theme.tip=Choose a color theme for windows except for the editor.
241+
preferences.editor.theme.system=System
242+
preferences.editor.theme.light=Light
243+
preferences.editor.theme.dark=Dark
244+
preferences.interface_theme=Interface theme
245+
preferences.interface_scale=Interface scale
246+
preferences.interface_scale.tip=Adjust the size of interface elements.
219247
preferences.interface_scale.auto = Automatic
220248
preferences.background_color = Background color when Presenting:
221-
preferences.background_color.tip = Select the background color used when using Present.<br>Present is used to present a sketch in full-screen,<br>accessible from the Sketch menu.
249+
preferences.background_color.tip=Select the background color used when using Present. Present is used to present a sketch in full-screen, accessible from the Sketch menu.
222250
preferences.use_smooth_text = Use smooth text in editor window
223251
preferences.enable_complex_text = Enable complex text input
224-
preferences.enable_complex_text.tip = Using languages such as Chinese, Japanese, and Arabic<br>in the Editor window require additional features to be enabled.
252+
preferences.enable_complex_text.tip=Using languages such as Chinese, Japanese, and Arabic in the Editor window require additional features to be enabled.
225253
preferences.continuously_check = Continuously check for errors
226254
preferences.show_warnings = Show warnings
227255
preferences.code_completion = Code completion with
228256
preferences.trigger_with = Trigger with
229257
preferences.cmd_space = space
230258
preferences.suggest_imports = Suggest import statements
259+
preferences.increase_memory=Increase maximum available memory
231260
preferences.increase_max_memory = Increase maximum available memory to
232261
# preferences.delete_previous_folder_on_export = Delete previous folder on export
233262
preferences.check_for_updates_on_startup = Allow update checking (see FAQ for information shared)
263+
preferences.update_check=Check for updates on startup
264+
preferences.update_check.tip=No personal information is sent during this process. See the [FAQ](https://github.com/processing/processing4/wiki/FAQ#checking-for-updates)
234265
preferences.run_sketches_on_display = Run sketches on display
235-
preferences.run_sketches_on_display.tip = Sets the display where sketches are initially placed.<br>As usual, if the sketch window is moved, it will re-open<br>at the same location, however when running in present<br>(full screen) mode, this display will always be used.
266+
preferences.run_sketches_on_display.tip=Sets the display where sketches are initially placed. As usual, if the sketch window is moved, it will re-open at the same location, however when running in present (full screen) mode, this display will always be used.
236267
preferences.automatically_associate_pde_files = Automatically associate .pde files with Processing
237268
preferences.launch_programs_in = Launch programs in
238269
preferences.launch_programs_in.mode = mode
239270
preferences.file = More preferences can be edited directly in the file:
240271
preferences.file.hint = (Edit only when Processing is not running.)
272+
preferences.other=Show experimental settings
273+
preferences.other.tip=These settings are contained in the preferences.txt file and are not officially supported. They may be removed or changed without notice in future versions of Processing.
274+
# Preferences (Experimental Pane)
275+
# Keys from the comments of defaults.txt (Nov 2025)
276+
preferences.contribution.backup.on_remove=Backup contributions when "Remove" button is pressed
277+
preferences.contribution.backup.on_remove.tip=When enabled, a backup copy of the contribution will be created in your sketchbook "tools", "modes", "libraries", or "examples" folder when you remove it via the Contribution Manager.
278+
preferences.contribution.backup.on_install=Backup contributions when installing a newer version
279+
preferences.contribution.backup.on_install.tip=When enabled, a backup copy of the contribution will be created in your sketchbook "tools", "modes", "libraries", or "examples" folder when you install a newer version via the Contribution Manager.
280+
preferences.recent.count=Number of recent sketches to show
281+
preferences.chooser.files.native=Use native file chooser dialogs
282+
preferences.theme.gradient.method=Gradient method for themes
283+
preferences.theme.gradient.method.tip=Set to 'lab' to interpolate theme gradients using L*a*b* color space
284+
preferences.platform.auto_file_type_associations=Automatically set file type associations (Windows only)
285+
preferences.platform.auto_file_type_associations.tip=When enabled, Processing will attempt to set itself as the default application for .pde files on Windows systems.
286+
preferences.editor.window.width.default=Default editor window width
287+
preferences.editor.window.height.default=Default editor window height
288+
preferences.editor.window.width.min=Minimum editor window width
289+
preferences.editor.window.height.min=Minimum editor window height
290+
preferences.editor.smooth=Enable antialiasing in the code editor
291+
preferences.editor.caret.blink=Blink the caret
292+
preferences.editor.caret.block=Use block caret
241293

242294
# Sketchbook Location (Frame)
243295
sketchbook_location = Select new sketchbook folder

app/src/processing/app/Base.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,10 +2174,7 @@ static private Mode findSketchMode(File folder, List<Mode> modeList) {
21742174
* Show the Preferences window.
21752175
*/
21762176
public void handlePrefs() {
2177-
if (preferencesFrame == null) {
2178-
preferencesFrame = new PreferencesFrame(this);
2179-
}
2180-
preferencesFrame.showFrame();
2177+
PDEPreferencesKt.show();
21812178
}
21822179

21832180

app/src/processing/app/Messages.kt

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ import androidx.compose.ui.window.Window
2929
import androidx.compose.ui.window.application
3030
import androidx.compose.ui.window.rememberWindowState
3131
import com.formdev.flatlaf.FlatLightLaf
32+
import androidx.compose.runtime.Composable
33+
import androidx.compose.ui.ExperimentalComposeUiApi
34+
import androidx.compose.ui.awt.ComposeDialog
35+
import androidx.compose.ui.layout.onSizeChanged
36+
import androidx.compose.ui.platform.LocalDensity
3237
import processing.app.ui.Toolkit
3338
import processing.app.ui.theme.PDETheme
3439
import java.awt.EventQueue
40+
import java.awt.Dimension
3541
import java.awt.Frame
3642
import java.io.PrintWriter
3743
import java.io.StringWriter
@@ -284,14 +290,65 @@ class Messages {
284290
}
285291
}
286292
}
287-
fun main(){
293+
294+
@OptIn(ExperimentalComposeUiApi::class)
295+
fun showDialog(title: String, content: @Composable (modifier: Modifier, dismiss: () -> Unit) -> Unit) {
296+
ComposeDialog().apply {
297+
isModal = true
298+
setTitle(title)
299+
size = Dimension(400, 400)
300+
rootPane.putClientProperty("apple.awt.fullWindowContent", true)
301+
rootPane.putClientProperty("apple.awt.transparentTitleBar", true)
302+
rootPane.putClientProperty("apple.awt.windowTitleVisible", false);
303+
304+
305+
setContent {
306+
PDETheme {
307+
val density = LocalDensity.current
308+
content(Modifier.onSizeChanged {
309+
size = Dimension((it.width / density.density).toInt(), (it.height / density.density).toInt())
310+
setLocationRelativeTo(null)
311+
}, ::dispose)
312+
}
313+
}
314+
setLocationRelativeTo(null)
315+
isVisible = true
316+
}
317+
}
318+
319+
fun main() {
288320
val types = mapOf(
289321
"message" to { Messages.showMessage("Test Title", "This is a test message.") },
290322
"warning" to { Messages.showWarning("Test Warning", "This is a test warning.", Exception("dfdsfjk")) },
291323
"trace" to { Messages.showTrace("Test Trace", "This is a test trace.", Exception("Test Exception"), false) },
292-
"tiered_warning" to { Messages.showWarningTiered("Test Tiered Warning", "Primary message", "Secondary message", null) },
293-
"yes_no" to { Messages.showYesNoQuestion(null, "Test Yes/No", "Do you want to continue?", "Choose yes or no.") },
294-
"custom_question" to { Messages.showCustomQuestion(null, "Test Custom Question", "Choose an option:", "Select one of the options below.", 1, "Option 1", "Option 2", "Option 3") },
324+
"tiered_warning" to {
325+
Messages.showWarningTiered(
326+
"Test Tiered Warning",
327+
"Primary message",
328+
"Secondary message",
329+
null
330+
)
331+
},
332+
"yes_no" to {
333+
Messages.showYesNoQuestion(
334+
null,
335+
"Test Yes/No",
336+
"Do you want to continue?",
337+
"Choose yes or no."
338+
)
339+
},
340+
"custom_question" to {
341+
Messages.showCustomQuestion(
342+
null,
343+
"Test Custom Question",
344+
"Choose an option:",
345+
"Select one of the options below.",
346+
1,
347+
"Option 1",
348+
"Option 2",
349+
"Option 3"
350+
)
351+
},
295352
"error" to { Messages.showError("Test Error", "This is a test error.", null) },
296353
)
297354
Platform.init()
@@ -322,6 +379,7 @@ fun String.formatClassName() = this
322379
.replace(".", "/")
323380
.padEnd(40)
324381
.colorizePathParts()
382+
325383
fun String.colorizePathParts() = split("/").joinToString("/") { part ->
326384
"\u001B[${31 + (part.hashCode() and 0x7).rem(6)}m$part\u001B[0m"
327385
}

app/src/processing/app/Preferences.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,13 @@ static public void init() {
8787
setBoolean("editor.input_method_support", true);
8888
}
8989

90+
9091
// next load user preferences file
9192
preferencesFile = Base.getSettingsFile(PREFS_FILE);
93+
var preferencesFileOverride = System.getProperty("processing.app.preferences.file");
94+
if (preferencesFileOverride != null && !preferencesFileOverride.isEmpty()) {
95+
preferencesFile = new File(preferencesFileOverride);
96+
}
9297
boolean firstRun = !preferencesFile.exists();
9398
if (!firstRun) {
9499
try {
@@ -179,9 +184,11 @@ static public void load(InputStream input) throws IOException {
179184

180185
String[] lines = PApplet.loadStrings(input); // Reads as UTF-8
181186
for (String line : lines) {
182-
if ((line.length() == 0) ||
187+
if ((line.isEmpty()) ||
183188
(line.charAt(0) == '#')) continue;
184189

190+
line = line.replace("\\", "/"); // normalize slashes in paths
191+
185192
// this won't properly handle = signs being in the text
186193
int equals = line.indexOf('=');
187194
if (equals != -1) {

app/src/processing/app/Preferences.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ fun PreferencesProvider(content: @Composable () -> Unit) {
8787
preferencesFile.createNewFile()
8888
}
8989

90+
remember {
91+
// check if the file has backward slashes
92+
if (preferencesFile.readText().contains("\\")) {
93+
val correctedText = preferencesFile.readText().replace("\\", "/")
94+
preferencesFile.writeText(correctedText)
95+
}
96+
}
97+
9098
val update = watchFile(preferencesFile)
9199

92100

app/src/processing/app/ui/EditorFooter.java

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@
2222

2323
package processing.app.ui;
2424

25-
import java.awt.CardLayout;
26-
import java.awt.Color;
27-
import java.awt.Component;
28-
import java.awt.Dimension;
29-
import java.awt.Font;
30-
import java.awt.Graphics;
31-
import java.awt.Graphics2D;
32-
import java.awt.Image;
33-
import java.awt.datatransfer.Clipboard;
25+
import processing.app.Base;
26+
import processing.app.Mode;
27+
import processing.app.Sketch;
28+
import processing.app.contrib.ContributionManager;
29+
import processing.data.StringDict;
30+
31+
import javax.swing.*;
32+
import java.awt.*;
3433
import java.awt.datatransfer.StringSelection;
3534
import java.awt.event.MouseAdapter;
3635
import java.awt.event.MouseEvent;
@@ -39,14 +38,6 @@
3938
import java.util.ArrayList;
4039
import java.util.List;
4140

42-
import javax.swing.*;
43-
44-
import processing.app.Base;
45-
import processing.app.Mode;
46-
import processing.app.Sketch;
47-
import processing.app.contrib.ContributionManager;
48-
import processing.data.StringDict;
49-
5041

5142
/**
5243
* Console/error/whatever tabs at the bottom of the editor window.
@@ -118,6 +109,18 @@ public void mousePressed(MouseEvent e) {
118109
Base.DEBUG = !Base.DEBUG;
119110
editor.updateDevelopMenu();
120111
}
112+
copyDebugInformationToClipboard();
113+
}
114+
});
115+
116+
tabBar.add(version);
117+
118+
add(tabBar);
119+
120+
updateTheme();
121+
}
122+
123+
public static void copyDebugInformationToClipboard() {
121124
var debugInformation = String.join("\n",
122125
"Version: " + Base.getVersionName(),
123126
"Revision: " + Base.getRevision(),
@@ -127,18 +130,12 @@ public void mousePressed(MouseEvent e) {
127130
var stringSelection = new StringSelection(debugInformation);
128131
var clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
129132
clipboard.setContents(stringSelection, null);
130-
}
131-
});
132-
133-
tabBar.add(version);
134-
135-
add(tabBar);
136-
137-
updateTheme();
138-
}
133+
}
139134

140135

141-
/** Add a panel with no icon. */
136+
/**
137+
* Add a panel with no icon.
138+
*/
142139
public void addPanel(Component comp, String name) {
143140
addPanel(comp, name, null);
144141
}

0 commit comments

Comments
 (0)