Files
Stef Tervelde 1237c55ece Welcome screen (#1353)
* 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

* Clean up handlePrefs method by removing comments

Removed commented-out code for preferences frame initialization.

* 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

* 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.

* Added survey button to the new welcome screen

---------

Co-authored-by: Raphaël de Courville <groupes.raphael@gmail.com>
2025-12-09 10:14:01 -05:00
..
2025-12-09 10:14:01 -05:00
2025-02-05 16:50:32 +01:00
2025-01-10 13:59:32 +01:00
2025-02-05 16:50:32 +01:00

How to Build Processing

This folder contains files for the legacy Ant build system. This build system will be removed in the future when we're sure we no longer need it.

IntelliJ IDEA CE

First, download the IntelliJ IDEA Community Edition. Make sure to select the "Community Edition", not "Ultimate". The Community Edition is free and built on open-source software. You may need to scroll down to find the download link. Then:

  1. Clone the Processing4 repository to your machine locally
  2. Open the cloned repository in IntelliJ IDEA CE
  3. Click Install Required Plugins on the bottom right or in the notification tray
  4. Open the Project Structure window (Ctrl+Alt+Shift+S on Windows/Linux or ⌘; on macOS)
  5. Go to Project Settings > Project
  6. In the SDK Dropdown option, select a JDK version 17 or Download a JDK
  7. Select your platform (Windows, MacOS or Linux) in the top right of the window
  8. Click the green Run Icon next to it
  9. Logs can be found in the messages or run pane on the bottom left of the window

Manual Approach

The short version:

  1. Download and install JDK 17 from https://adoptium.net/

  2. Make sure ant is installed for your platform.

  3. Open a Terminal window/Command Prompt/whatever and type:

     cd /path/to/processing4/build
     ant run
    

Updating an older 4.x checkout

If you checked out this repository before, but now it's behaving strangely, try the following:

git pull
git checkout main
ant clean
ant clean-libs
ant run

Major changes happened during the 4.x series, including a reorganization of the core library, changes to how .jar files for libraries were downloaded, and the master branch was renamed to main.

The ant clean-libs task (added in 4.0 beta 9) clears out downloaded support files (JOGL, Ant, etc) and makes sure they're the latest versions.

Java version complaints

You might have multiple versions of Java installed. Type java -version and if it says something other than 17, you'll need to set the JAVA_HOME environment variable.

On macOS, you can use:

export JAVA_HOME="`/usr/libexec/java_home -v 17`"

If you need to go back to Java 8 (i.e. to build Processing 3), you can use:

export JAVA_HOME="`/usr/libexec/java_home -v 1.8`"

On Windows and Linux, you can set JAVA_HOME to point at the installation the way you would any other environment variable.

On Linux (Ubuntu 20.04 in particular), the headless version of OpenJDK may be installed by default. If so, you may get errors when trying to run tests in core:

java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-17-openjdk-amd64/lib/libawt_xawt.so

If so, use sudo apt install openjdk-17-jdk to install a full version. You could also make use of the JDK that's downloaded by Processing itself to avoid duplication, but that's a little trickier to get everything bootstrapped and (sym)linked properly.

The Long Version

A more detailed explanation of how to build and release Processing across Windows, macOS, and Linux, and a bit more about how the build system works.

Local Environment Setup

Processing's ant-based build chain can create executables natively runnable for Linux, Mac, and Windows.

Pre-Requisites

Although Processing will download and use its own copy of OpenJDK and OpenJFX, the build chain itself requires Java 17 and Ant in addition to getting a copy of the Processing source code.

Getting Java and Ant

You can choose to install these yourself or use the following guides below:

Download the Processing source code

One will also need to clone the repository for Processing itself.

git clone https://github.com/processing/processing4.git

Building

One can either build for your own operating system (the "host" operating system) or, starting with Processing 4, one can "cross-build" from a host nix system (linux or mac) to any other "target os" build. Before continuing, please be aware that you are agreeing to the license terms and that the developers do not make any guarantee or warranty (implicit or express) for any purpose.

Overview of steps

Before actually building, it is worth outlining the steps of the build process briefly:

  • The modules outside of build are built first. During this process, a number of automated unit tests will be executed with results displayed on the command line.
  • The build module itself will built and results will go into build/{os}/work where {os} is the operating system for which you are building like "windows". Note that both ARM and x64 builds go into the same OS directory.
  • During the build of build, the OpenJDK and OpenJFX will be downloaded with their binaries copied into the distribution. If building for the first time, these automated downloads from AdoptOpenJDK and Gluon may take some time.

Note that one may need to “clean” via ant clean, which removes previous files (i.e. from the work folder).

Building for the "host" operating system

If building for your own system, navigate to where where you pulled the Processing source and execute ant build on the command line.

cd /path/to/processing4
cd build
ant build

The results will go into build/{os}/work where {os} matches the "host" operating system.

Running

The build can be run directly or through Ant.

Executing via Ant

If built for the host operating system, one can use the ant run target as shown below:

cd /path/to/processing4
cd build
ant run

If not yet built, this will cause Processing to be built prior to running.

Using Executable Directly

Except when doing a cross-build (below), the build process creates executables that can be run directly on the target operating system:

  • macOS: the .app file can be executed via a double click at build/macosx/work/Processing.app or open build/macosx/work/Processing.app.
  • Linux: The resulting executable ends up at build/linux/work/processing.
  • Windows: The resulting executable ends up at build/windows/work/processing.exe.

Advanced: cross platform builds, tests, and distribution

Executing a "cross-build"

If building for another operating system (if you are on Linux and want to build for Windows), there are a number of "cross-build" targets available. Note that one can only execute "cross-builds" on a *nix system (Linux or Mac) but "cross-builds" are available for all targeted operating systems.

For example, here is how to execute a cross-build "targeting" Windows (the results will go into build/windows/work):

cd /path/to/processing4
cd build
ant cross-build-windows

The following cross-build targets are available:

  • cross-build-macosx
  • cross-build-linux-x64
  • cross-build-linux-aarch64
  • cross-build-windows

Automated Tests

Unit tests are available by running the test target:

cd /path/to/processing4
cd build
ant test

These tests are not executed by default when running the build target but are recommended for developers contributing to the project.

Distributing

A number of targets are provided for distribution of executables. If the executable is not yet built, it will be created prior to running the dist target.

Available targets:

  • macosx-dist
  • windows-dist
  • linux-dist

One can also use ant dist to distribute for the host OS.

Examples

For the host system, one can distribute like so:

cd /path/to/processing4
cd build
ant dist

From a *nix system, one can cross-build and distribute for linux like so:

cd /path/to/processing4
cd build
ant linux-dist

Regardless, the distributable ends up in build/{os}/work where {os} is the target OS.

Using an IDE for development (Eclipse or IntelliJ)

Eclipse

If you're using Eclipse, it'll complain about the lack of jogl-all-src.jar. Steps to create your own:

git clone --recurse-submodules git://jogamp.org/srv/scm/jogl.git jogl
cd jogl
git checkout 0779f229b0e9538c640b18b9a4e095af1f5a35b3
zip -r ../jogl-all-src.jar src

Then copy that jogl-all-src.jar file to sit next to the jogl-all.jar folder inside /path/to/processing/core/library.