From 7fee5b1fd1de904931114d68f02868e93ca01055 Mon Sep 17 00:00:00 2001 From: Stef Tervelde Date: Mon, 24 Nov 2025 15:59:44 +0100 Subject: [PATCH 1/4] Add welcome survey to Welcome screen Introduces a new Compose-based survey component to the Welcome screen via WelcomeSurvey.kt. Refactors Welcome.java to include the survey, and updates PDEButton in WelcomeToBeta.kt to support a modifier and proper content color handling. --- app/src/processing/app/ui/Welcome.java | 25 ++++---- app/src/processing/app/ui/WelcomeSurvey.kt | 74 ++++++++++++++++++++++ app/src/processing/app/ui/WelcomeToBeta.kt | 62 +++++++++--------- 3 files changed, 116 insertions(+), 45 deletions(-) create mode 100644 app/src/processing/app/ui/WelcomeSurvey.kt diff --git a/app/src/processing/app/ui/Welcome.java b/app/src/processing/app/ui/Welcome.java index 5e4c4cf715..47751dfdc8 100644 --- a/app/src/processing/app/ui/Welcome.java +++ b/app/src/processing/app/ui/Welcome.java @@ -21,22 +21,18 @@ package processing.app.ui; -import java.awt.Color; -import java.awt.EventQueue; -import java.awt.Font; +import processing.app.Base; +import processing.app.Platform; +import processing.app.Preferences; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; import java.awt.event.ItemEvent; import java.io.File; import java.io.IOException; -import javax.swing.Box; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComponent; -import javax.swing.border.EmptyBorder; - -import processing.app.Base; -import processing.app.Platform; -import processing.app.Preferences; +import static processing.app.ui.WelcomeSurveyKt.addSurveyToWelcomeScreen; public class Welcome { @@ -47,6 +43,7 @@ public class Welcome { public Welcome(Base base) throws IOException { this.base = base; + var parent = Box.createVerticalBox(); JComponent panel = Box.createHorizontalBox(); //panel.setBackground(new Color(245, 245, 245)); panel.setBackground(Color.WHITE); @@ -71,11 +68,13 @@ public Welcome(Base base) throws IOException { button.setFont(Toolkit.getSansFont(14, Font.PLAIN)); button.addActionListener(e -> view.handleClose()); panel.add(button); + parent.add(addSurveyToWelcomeScreen()); + parent.add(panel); File indexFile = getIndexFile(); if (indexFile == null) return; // giving up; error already printed - view = new WebFrame(getIndexFile(), 420, panel) { + view = new WebFrame(getIndexFile(), 420, parent) { /* @Override public void handleSubmit(StringDict dict) { diff --git a/app/src/processing/app/ui/WelcomeSurvey.kt b/app/src/processing/app/ui/WelcomeSurvey.kt new file mode 100644 index 0000000000..ac96ffe9cb --- /dev/null +++ b/app/src/processing/app/ui/WelcomeSurvey.kt @@ -0,0 +1,74 @@ +package processing.app.ui + +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.awt.ComposePanel +import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import processing.app.ui.WelcomeToBeta.Companion.PDEButton +import processing.app.ui.theme.LocalLocale +import processing.app.ui.theme.ProcessingTheme +import javax.swing.JComponent + + +fun addSurveyToWelcomeScreen(): JComponent { + return ComposePanel().apply { + setContent { + ProcessingTheme { + val locale = LocalLocale.current + Box { + Row( + modifier = Modifier + .width(420.dp) + .padding(16.dp) + .padding(bottom = 12.dp) + .clip(RoundedCornerShape(12.dp)) + .background(MaterialTheme.colors.surface) + ) { + Image( + painter = painterResource("bird.svg"), + contentDescription = locale["beta.logo"], + modifier = Modifier + .align(Alignment.CenterVertically) + .padding(20.dp) + .size(50.dp) + + ) + Column( + modifier = Modifier.padding(12.dp), + ) { + Text( + text = "Survey", + style = MaterialTheme.typography.subtitle1.copy(fontWeight = FontWeight.Bold) + ) + Text( + text = "welcome survey message" + ) + + } + } + + PDEButton( + onClick = { + + }, + modifier = Modifier + .align(Alignment.BottomEnd) + .padding(horizontal = 6.dp, vertical = 16.dp) + ) { + Text(text = "Take Survey") + } + } + } + } + } + +} \ No newline at end of file diff --git a/app/src/processing/app/ui/WelcomeToBeta.kt b/app/src/processing/app/ui/WelcomeToBeta.kt index 7757e820f6..73e55e2940 100644 --- a/app/src/processing/app/ui/WelcomeToBeta.kt +++ b/app/src/processing/app/ui/WelcomeToBeta.kt @@ -5,7 +5,7 @@ import androidx.compose.animation.core.animateFloatAsState import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.* -import androidx.compose.material.MaterialTheme +import androidx.compose.material.LocalContentColor import androidx.compose.material.MaterialTheme.colors import androidx.compose.material.MaterialTheme.typography import androidx.compose.material.Surface @@ -21,10 +21,8 @@ import androidx.compose.ui.input.pointer.PointerIcon import androidx.compose.ui.input.pointer.onPointerEvent import androidx.compose.ui.input.pointer.pointerHoverIcon import androidx.compose.ui.res.painterResource -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import androidx.compose.ui.window.Window import androidx.compose.ui.window.WindowPosition import androidx.compose.ui.window.application @@ -33,11 +31,9 @@ import com.formdev.flatlaf.util.SystemInfo import com.mikepenz.markdown.compose.Markdown import com.mikepenz.markdown.m2.markdownColor import com.mikepenz.markdown.m2.markdownTypography -import com.mikepenz.markdown.model.MarkdownColors -import com.mikepenz.markdown.model.MarkdownTypography -import processing.app.Preferences import processing.app.Base.getRevision import processing.app.Base.getVersionName +import processing.app.Preferences import processing.app.ui.theme.LocalLocale import processing.app.ui.theme.LocalTheme import processing.app.ui.theme.Locale @@ -46,8 +42,6 @@ import java.awt.Cursor import java.awt.Dimension import java.awt.event.KeyAdapter import java.awt.event.KeyEvent -import java.io.InputStream -import java.util.Properties import javax.swing.JFrame import javax.swing.SwingUtilities @@ -150,7 +144,7 @@ class WelcomeToBeta { } @OptIn(ExperimentalComposeUiApi::class) @Composable - fun PDEButton(onClick: () -> Unit, content: @Composable BoxScope.() -> Unit) { + fun PDEButton(onClick: () -> Unit, modifier: Modifier = Modifier, content: @Composable BoxScope.() -> Unit) { val theme = LocalTheme.current var hover by remember { mutableStateOf(false) } @@ -158,35 +152,39 @@ class WelcomeToBeta { val offset by animateFloatAsState(if (hover) -5f else 5f) val color by animateColorAsState(if(clicked) colors.primaryVariant else colors.primary) - Box(modifier = Modifier.padding(end = 5.dp, top = 5.dp)) { + Box(modifier = modifier.padding(end = 5.dp, top = 5.dp)) { Box( modifier = Modifier .offset((-offset).dp, (offset).dp) .background(theme.getColor("toolbar.button.pressed.field")) .matchParentSize() ) - Box( - modifier = Modifier - .onPointerEvent(PointerEventType.Press) { - clicked = true - } - .onPointerEvent(PointerEventType.Release) { - clicked = false - onClick() - } - .onPointerEvent(PointerEventType.Enter) { - hover = true - } - .onPointerEvent(PointerEventType.Exit) { - hover = false - } - .pointerHoverIcon(PointerIcon(Cursor(Cursor.HAND_CURSOR))) - .background(color) - .padding(10.dp) - .sizeIn(minWidth = 100.dp), - contentAlignment = Alignment.Center, - content = content - ) + CompositionLocalProvider( + LocalContentColor provides colors.onPrimary + ) { + Box( + modifier = Modifier + .onPointerEvent(PointerEventType.Press) { + clicked = true + } + .onPointerEvent(PointerEventType.Release) { + clicked = false + onClick() + } + .onPointerEvent(PointerEventType.Enter) { + hover = true + } + .onPointerEvent(PointerEventType.Exit) { + hover = false + } + .pointerHoverIcon(PointerIcon(Cursor(Cursor.HAND_CURSOR))) + .background(color) + .padding(10.dp) + .sizeIn(minWidth = 100.dp), + contentAlignment = Alignment.Center, + content = content + ) + } } } From 1290ab6476742a1dfbf2d27f0cd09019995daa15 Mon Sep 17 00:00:00 2001 From: Stef Tervelde Date: Thu, 27 Nov 2025 09:00:36 +0100 Subject: [PATCH 2/4] Make survey card clickable and remove button Replaces the separate 'Take Survey' button with a clickable survey card that opens the survey URL. Adds pointer hover icon for better UX and updates the survey message text. --- app/src/processing/app/ui/WelcomeSurvey.kt | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/app/src/processing/app/ui/WelcomeSurvey.kt b/app/src/processing/app/ui/WelcomeSurvey.kt index ac96ffe9cb..229782ba99 100644 --- a/app/src/processing/app/ui/WelcomeSurvey.kt +++ b/app/src/processing/app/ui/WelcomeSurvey.kt @@ -2,6 +2,7 @@ package processing.app.ui import androidx.compose.foundation.Image import androidx.compose.foundation.background +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.MaterialTheme @@ -10,10 +11,12 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.awt.ComposePanel import androidx.compose.ui.draw.clip +import androidx.compose.ui.input.pointer.PointerIcon +import androidx.compose.ui.input.pointer.pointerHoverIcon import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp -import processing.app.ui.WelcomeToBeta.Companion.PDEButton +import processing.app.Platform import processing.app.ui.theme.LocalLocale import processing.app.ui.theme.ProcessingTheme import javax.swing.JComponent @@ -32,6 +35,12 @@ fun addSurveyToWelcomeScreen(): JComponent { .padding(bottom = 12.dp) .clip(RoundedCornerShape(12.dp)) .background(MaterialTheme.colors.surface) + .clickable { + Platform.openURL("https://survey.processing.org/") + } + .pointerHoverIcon( + PointerIcon.Hand + ) ) { Image( painter = painterResource("bird.svg"), @@ -50,25 +59,13 @@ fun addSurveyToWelcomeScreen(): JComponent { style = MaterialTheme.typography.subtitle1.copy(fontWeight = FontWeight.Bold) ) Text( - text = "welcome survey message" + text = "click here to take part in the survey and help us improve Processing!", ) } } - - PDEButton( - onClick = { - - }, - modifier = Modifier - .align(Alignment.BottomEnd) - .padding(horizontal = 6.dp, vertical = 16.dp) - ) { - Text(text = "Take Survey") - } } } } } - } \ No newline at end of file From 6ba5eabbf68ea6c2f4c3110dd4949af0e3f94e51 Mon Sep 17 00:00:00 2001 From: Stef Tervelde Date: Thu, 27 Nov 2025 15:09:31 +0100 Subject: [PATCH 3/4] Localize welcome survey text and fix resource paths Added localized strings for the welcome survey title and description in PDE.properties. Updated WelcomeSurvey.kt to use these localized strings. Fixed resource loading paths in Locale.kt to correctly reference the 'languages' directory. --- .../main/resources/languages/PDE.properties | 3 +++ app/src/processing/app/ui/WelcomeSurvey.kt | 4 ++-- app/src/processing/app/ui/theme/Locale.kt | 18 +++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/src/main/resources/languages/PDE.properties b/app/src/main/resources/languages/PDE.properties index 19a5c9f866..13d70e1423 100644 --- a/app/src/main/resources/languages/PDE.properties +++ b/app/src/main/resources/languages/PDE.properties @@ -633,6 +633,9 @@ beta.window.title = Welcome to Beta beta.title = Thanks for testing this Processing Beta! beta.message = This preview release lets us gather feedback and fix issues before the final version. **Some features may not work as expected.** If you encounter problems, [please post on the forum](https://discourse.processing.org) or [open a GitHub issue](https://github.com/processing/processing4/issues). beta.button = Ok +# Welcome +welcome.survey.title=Take the Community Survey +welcome.survey.description=Processing is free, open-source, and shaped by its community. Your answers help us focus on what matters most. # --------------------------------------- # Color Chooser diff --git a/app/src/processing/app/ui/WelcomeSurvey.kt b/app/src/processing/app/ui/WelcomeSurvey.kt index 229782ba99..ecc771c278 100644 --- a/app/src/processing/app/ui/WelcomeSurvey.kt +++ b/app/src/processing/app/ui/WelcomeSurvey.kt @@ -55,11 +55,11 @@ fun addSurveyToWelcomeScreen(): JComponent { modifier = Modifier.padding(12.dp), ) { Text( - text = "Survey", + text = locale["welcome.survey.title"], style = MaterialTheme.typography.subtitle1.copy(fontWeight = FontWeight.Bold) ) Text( - text = "click here to take part in the survey and help us improve Processing!", + text = locale["welcome.survey.description"], ) } diff --git a/app/src/processing/app/ui/theme/Locale.kt b/app/src/processing/app/ui/theme/Locale.kt index 254c0946c1..a99f00b0fa 100644 --- a/app/src/processing/app/ui/theme/Locale.kt +++ b/app/src/processing/app/ui/theme/Locale.kt @@ -3,7 +3,6 @@ package processing.app.ui.theme import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.compositionLocalOf -import processing.app.LocalPreferences import processing.app.Messages import processing.app.Platform import processing.app.PlatformStart @@ -15,10 +14,19 @@ import java.util.* class Locale(language: String = "") : Properties() { init { val locale = java.util.Locale.getDefault() - load(ClassLoader.getSystemResourceAsStream("PDE.properties")) - load(ClassLoader.getSystemResourceAsStream("PDE_${locale.language}.properties") ?: InputStream.nullInputStream()) - load(ClassLoader.getSystemResourceAsStream("PDE_${locale.toLanguageTag()}.properties") ?: InputStream.nullInputStream()) - load(ClassLoader.getSystemResourceAsStream("PDE_${language}.properties") ?: InputStream.nullInputStream()) + load(ClassLoader.getSystemResourceAsStream("languages/PDE.properties")) + load( + ClassLoader.getSystemResourceAsStream("languages/PDE_${locale.language}.properties") + ?: InputStream.nullInputStream() + ) + load( + ClassLoader.getSystemResourceAsStream("languages/PDE_${locale.toLanguageTag()}.properties") + ?: InputStream.nullInputStream() + ) + load( + ClassLoader.getSystemResourceAsStream("languages/PDE_${language}.properties") + ?: InputStream.nullInputStream() + ) } @Deprecated("Use get instead", ReplaceWith("get(key)")) From 557ad6e0f7c3fb846bac40ebe38d436a64d711a3 Mon Sep 17 00:00:00 2001 From: Stef Tervelde Date: Thu, 27 Nov 2025 18:42:24 +0100 Subject: [PATCH 4/4] Add welcome survey translations to language files Introduced 'welcome.survey.title' and 'welcome.survey.description' keys to multiple language property files, providing localized text for the community survey prompt in Arabic, German, French, Italian, Japanese, Dutch, and Chinese. This improves internationalization support for the welcome survey feature. --- app/src/main/resources/languages/PDE_ar.properties | 4 ++++ app/src/main/resources/languages/PDE_de.properties | 4 ++++ app/src/main/resources/languages/PDE_fr.properties | 3 +++ app/src/main/resources/languages/PDE_it.properties | 5 +++++ app/src/main/resources/languages/PDE_ja.properties | 5 +++++ app/src/main/resources/languages/PDE_nl.properties | 5 +++++ app/src/main/resources/languages/PDE_zh-CN.properties | 7 ++++++- 7 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/src/main/resources/languages/PDE_ar.properties b/app/src/main/resources/languages/PDE_ar.properties index 8f15db5c39..2f25f33e4d 100644 --- a/app/src/main/resources/languages/PDE_ar.properties +++ b/app/src/main/resources/languages/PDE_ar.properties @@ -550,6 +550,10 @@ update_check = تحديث update_check.updates_available.core = يوجد نسخة جديدة من بروسسنج جاهزة للتحميل. \nهل تود زيارة الموقع الرسمي لتحميلها؟ update_check.updates_available.contributions = يوجد تحديثات متوفرة لبعض المشاركات المثبتة. \nهل تريد الذهاب إلى مدير المشاركات الآن؟ +# --------------------------------------- +# Welcome +welcome.survey.title=شارك في استطلاع المجتمع (بالإنجليزية) +welcome.survey.description=Processing مجاني ومفتوح المصدر ومشكّل من قبل مجتمعه. إجاباتك تساعدنا على التركيز على ما يهم أكثر. # --------------------------------------- # Color Chooser diff --git a/app/src/main/resources/languages/PDE_de.properties b/app/src/main/resources/languages/PDE_de.properties index 2bba70141a..1b0c4b48d3 100644 --- a/app/src/main/resources/languages/PDE_de.properties +++ b/app/src/main/resources/languages/PDE_de.properties @@ -420,6 +420,10 @@ update_check = Update update_check.updates_available.core = Eine neue Version von Processing ist verfügbar,\nsoll der Download-Bereich aufgerufen werden? update_check.updates_available.contributions = Es sind neue Updates von installierten Paketen verfügbar,\nsoll der Contribution Manager geöffnet werden? +# --------------------------------------- +# Welcome +welcome.survey.title=Nimm an der Community-Umfrage teil (auf Englisch) +welcome.survey.description=Processing ist kostenlos, open source und von seiner Community geprägt. Deine Antworten helfen uns, die wichtigsten Schwerpunkte zu setzen. # --------------------------------------- # Color Chooser diff --git a/app/src/main/resources/languages/PDE_fr.properties b/app/src/main/resources/languages/PDE_fr.properties index 4b43a35d57..d519f2e1d8 100644 --- a/app/src/main/resources/languages/PDE_fr.properties +++ b/app/src/main/resources/languages/PDE_fr.properties @@ -502,6 +502,9 @@ update_check = Mise à jour update_check.updates_available.core = Une nouvelle version de Processing est disponible, \nVoulez-vous visiter la page de téléchargement de Processing? update_check.updates_available.contributions = Il y a des mises à jour disponibles pour certaines des contributions installées, \nVoulez-vous ouvrir le gestionnaire de contributions? +# Welcome +welcome.survey.title=Participez au sondage de la communauté (en anglais) +welcome.survey.description=Processing est gratuit, open source et façonné par sa communauté. Vos réponses nous aident à nous concentrer sur ce qui compte le plus. # --------------------------------------- # Color Chooser diff --git a/app/src/main/resources/languages/PDE_it.properties b/app/src/main/resources/languages/PDE_it.properties index 9119de9c14..374232430e 100644 --- a/app/src/main/resources/languages/PDE_it.properties +++ b/app/src/main/resources/languages/PDE_it.properties @@ -546,6 +546,11 @@ update_check = Aggiorna update_check.updates_available.core = Una nuova versione di Processing è disponibile,\nvuoi visitare la pagina di download del sito di Processing? update_check.updates_available.contributions = Ci sono aggiornamenti disponibili per alcuni dei contributi installati,\nvorresti aprire il gestore dei contributi ora? +# --------------------------------------- +# Welcome +welcome.survey.title=Partecipa al sondaggio della community (in inglese) +welcome.survey.description=Processing è gratuito, open-source e plasmato dalla sua community. Le tue risposte ci aiutano a capire ciò che conta di più. + # --------------------------------------- # Color Chooser diff --git a/app/src/main/resources/languages/PDE_ja.properties b/app/src/main/resources/languages/PDE_ja.properties index b85fa2dc7a..3297f9ced1 100644 --- a/app/src/main/resources/languages/PDE_ja.properties +++ b/app/src/main/resources/languages/PDE_ja.properties @@ -550,6 +550,11 @@ update_check = 更新 update_check.updates_available.core = 新しいバージョンのProcessingが利用可能です。\nProcessingのダウンロードページにアクセスしますか? update_check.updates_available.contributions = There are updates available for some of the installed contributions,\nwould you like to open the the Contribution Manager now? +# --------------------------------------- +# Welcome +welcome.survey.title=コミュニティ調査にご協力ください(英語) +welcome.survey.description=Processing は無料でオープンソースであり、コミュニティによって形作られています。あなたの回答は、私たちが何に注力すべきかを知る助けになります。 + # --------------------------------------- # Color Chooser diff --git a/app/src/main/resources/languages/PDE_nl.properties b/app/src/main/resources/languages/PDE_nl.properties index e7f11b0a1f..d80e2d7ccf 100644 --- a/app/src/main/resources/languages/PDE_nl.properties +++ b/app/src/main/resources/languages/PDE_nl.properties @@ -315,6 +315,11 @@ update_check = Update update_check.updates_available.core = Een nieuwe versie van Processing is beschikbaar,\nwilt u de Processing download pagina bezoeken? update_check.updates_available.contributions = Er zijn updates beschikbaar voor sommige van de door u geïnstalleerde bijdragen,\nwilt u nu de Bijdragen Manager openen? +# --------------------------------------- +# Welcome +welcome.survey.title=Doe mee aan de community-enquête (in het Engels) +welcome.survey.description=Processing is gratis, open-source en gevormd door de community. Jouw antwoorden helpen ons te focussen op wat het belangrijkst is. + # --------------------------------------- # Beta beta.window.title = Welkom bij Beta diff --git a/app/src/main/resources/languages/PDE_zh-CN.properties b/app/src/main/resources/languages/PDE_zh-CN.properties index 97e3df413e..77d3c15acc 100644 --- a/app/src/main/resources/languages/PDE_zh-CN.properties +++ b/app/src/main/resources/languages/PDE_zh-CN.properties @@ -313,4 +313,9 @@ warn.delete.sketch_last = 为了确保您的文件安全,Processing 不支持 warn.delete.file = 你确定要删除 "%s" 吗? warn.delete.sketch_file = 你确定要删除 “%s” 吗? warn.cannot_change_mode.title = 无法切换模式 -warn.cannot_change_mode.body = 无法切换模式,\n因为 “%s” 模式与当前模式不兼容。 \ No newline at end of file +warn.cannot_change_mode.body = 无法切换模式,\n因为 “%s” 模式与当前模式不兼容。 + +# --------------------------------------- +# Welcome +welcome.survey.title=参与社区调查(英文) +welcome.survey.description=Processing 是免费的、开源的,并由社区共同塑造。你的回答将帮助我们关注最重要的事项。 \ No newline at end of file