Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.gradle.internal.jvm.Jvm
import org.gradle.internal.os.OperatingSystem
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.compose.ExperimentalComposeLibrary
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.compose.desktop.application.tasks.AbstractJPackageTask
import org.jetbrains.compose.internal.de.undercouch.gradle.tasks.download.Download
Expand All @@ -16,6 +17,7 @@ plugins{

alias(libs.plugins.compose.compiler)
alias(libs.plugins.jetbrainsCompose)

alias(libs.plugins.serialization)
alias(libs.plugins.download)
}
Expand Down Expand Up @@ -59,7 +61,7 @@ compose.desktop {
).map { "-D${it.first}=${it.second}" }.toTypedArray())

nativeDistributions{
modules("jdk.jdi", "java.compiler", "jdk.accessibility", "java.management.rmi", "java.scripting", "jdk.httpserver")
modules("jdk.jdi", "java.compiler", "jdk.accessibility", "jdk.zipfs", "java.management.rmi", "java.scripting", "jdk.httpserver")
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "Processing"

Expand Down Expand Up @@ -107,25 +109,29 @@ dependencies {

implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(compose.materialIconsExtended)

implementation(compose.desktop.currentOs)
implementation(libs.material3)

implementation(libs.compottie)
implementation(libs.kaml)
implementation(libs.markdown)
implementation(libs.markdownJVM)

implementation(libs.clikt)
implementation(libs.kotlinxSerializationJson)

@OptIn(ExperimentalComposeLibrary::class)
testImplementation(compose.uiTest)
testImplementation(kotlin("test"))
testImplementation(libs.mockitoKotlin)
testImplementation(libs.junitJupiter)
testImplementation(libs.junitJupiterParams)

implementation(libs.clikt)
implementation(libs.kotlinxSerializationJson)

}

tasks.test {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/resources/icons/Discord.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/src/main/resources/icons/GitHub.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/src/main/resources/icons/Instagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 21 additions & 25 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,29 @@

package processing.app;

import java.awt.*;
import java.awt.event.ActionListener;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.List;
import java.util.Map.Entry;

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;

import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.FlatLightLaf;
import processing.app.contrib.*;
import processing.app.tools.Tool;
import processing.app.ui.*;
import processing.app.ui.Toolkit;
import processing.core.*;
import processing.core.PApplet;
import processing.data.StringList;

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.awt.*;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.List;
import java.util.Map.Entry;

/**
* The base class for the main processing application.
* Primary role of this class is for platform identification and
Expand Down Expand Up @@ -374,13 +376,7 @@ static private void handleWelcomeScreen(Base base) {
// Needs to be shown after the first editor window opens, so that it
// shows up on top, and doesn't prevent an editor window from opening.
if (Preferences.getBoolean("welcome.four.show")) {
try {
new Welcome(base);
} catch (IOException e) {
Messages.showTrace("Unwelcoming",
"Please report this error to\n" +
"https://github.com/processing/processing4/issues", e, false);
}
PDEWelcomeKt.showWelcomeScreen(base);
}
}

Expand Down Expand Up @@ -608,7 +604,7 @@ public JMenu initDefaultFileMenu() {
defaultFileMenu.add(item);

item = Toolkit.newJMenuItemShift(Language.text("menu.file.examples"), 'O');
item.addActionListener(e -> thinkDifferentExamples());
item.addActionListener(e -> showExamplesFrame());
defaultFileMenu.add(item);

return defaultFileMenu;
Expand Down Expand Up @@ -1884,7 +1880,7 @@ public void handleRestart() {
// }


public void thinkDifferentExamples() {
public void showExamplesFrame() {
nextMode.showExamplesFrame();
}

Expand Down Expand Up @@ -2190,10 +2186,10 @@ static private Mode findSketchMode(File folder, List<Mode> modeList) {
* Show the Preferences window.
*/
public void handlePrefs() {
if (preferencesFrame == null) {
preferencesFrame = new PreferencesFrame(this);
}
preferencesFrame.showFrame();
if (preferencesFrame == null) {
preferencesFrame = new PreferencesFrame(this);
}
preferencesFrame.showFrame();
}


Expand Down
45 changes: 45 additions & 0 deletions app/src/processing/app/Messages.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,27 @@
*/
package processing.app

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import androidx.compose.ui.window.rememberWindowState
import com.formdev.flatlaf.FlatLightLaf
import processing.app.ui.Toolkit
import processing.app.ui.theme.PDETheme
import java.awt.EventQueue
import java.awt.Frame
import java.io.PrintWriter
import java.io.StringWriter
import javax.swing.JFrame
import javax.swing.JOptionPane
import javax.swing.UIManager


class Messages {
companion object {
Expand Down Expand Up @@ -270,6 +284,37 @@ class Messages {
}
}
}
fun main(){
val types = mapOf(
"message" to { Messages.showMessage("Test Title", "This is a test message.") },
"warning" to { Messages.showWarning("Test Warning", "This is a test warning.", Exception("dfdsfjk")) },
"trace" to { Messages.showTrace("Test Trace", "This is a test trace.", Exception("Test Exception"), false) },
"tiered_warning" to { Messages.showWarningTiered("Test Tiered Warning", "Primary message", "Secondary message", null) },
"yes_no" to { Messages.showYesNoQuestion(null, "Test Yes/No", "Do you want to continue?", "Choose yes or no.") },
"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") },
"error" to { Messages.showError("Test Error", "This is a test error.", null) },
)
Platform.init()
UIManager.setLookAndFeel(FlatLightLaf())
application {
val state = rememberWindowState(
size = DpSize(500.dp, 300.dp)
)
Window(state = state, onCloseRequest = ::exitApplication, title = "Test Messages") {
PDETheme {
Column {
for ((type, action) in types) {
Button(onClick = { action() }, modifier = Modifier.padding(8.dp)) {
Text("Show $type dialog")
}
}
}
}
}

}

}

// Helper functions to give the base classes a color
fun String.formatClassName() = this
Expand Down
8 changes: 8 additions & 0 deletions app/src/processing/app/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ static public void skipInit() {
initialized = true;
}

/**
* Check whether Preferences.init() has been called. If not, we are probably not running the full application.
* @return true if Preferences has been initialized
*/
static public boolean isInitialized() {
return initialized;
}


static void handleProxy(String protocol, String hostProp, String portProp) {
String proxyHost = get("proxy." + protocol + ".host");
Expand Down
Loading