Skip to content
Open
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
3 changes: 3 additions & 0 deletions app/src/main/resources/languages/PDE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/resources/languages/PDE_ar.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/resources/languages/PDE_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/resources/languages/PDE_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/resources/languages/PDE_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/resources/languages/PDE_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/resources/languages/PDE_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/resources/languages/PDE_zh-CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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” 模式与当前模式不兼容。
warn.cannot_change_mode.body = 无法切换模式,\n因为 “%s” 模式与当前模式不兼容。

# ---------------------------------------
# Welcome
welcome.survey.title=参与社区调查(英文)
welcome.survey.description=Processing 是免费的、开源的,并由社区共同塑造。你的回答将帮助我们关注最重要的事项。
25 changes: 12 additions & 13 deletions app/src/processing/app/ui/Welcome.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand All @@ -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) {
Expand Down
71 changes: 71 additions & 0 deletions app/src/processing/app/ui/WelcomeSurvey.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
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
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.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.Platform
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)
.clickable {
Platform.openURL("https://survey.processing.org/")
}
.pointerHoverIcon(
PointerIcon.Hand
)
) {
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 = locale["welcome.survey.title"],
style = MaterialTheme.typography.subtitle1.copy(fontWeight = FontWeight.Bold)
)
Text(
text = locale["welcome.survey.description"],
)

}
}
}
}
}
}
}
62 changes: 30 additions & 32 deletions app/src/processing/app/ui/WelcomeToBeta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -150,43 +144,47 @@ 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) }
var clicked by remember { mutableStateOf(false) }
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
)
}
}
}

Expand Down
18 changes: 13 additions & 5 deletions app/src/processing/app/ui/theme/Locale.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)"))
Expand Down