Skip to content

Commit f916d27

Browse files
committed
Adding a settings panel to the editor
For upcoming plugin support we need a way to enable plugins based on each sketch
1 parent 550200c commit f916d27

File tree

6 files changed

+44
-6
lines changed

6 files changed

+44
-6
lines changed

app/src/processing/app/gradle/GradleService.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class GradleService(
2929
) {
3030
val active = mutableStateOf(Preferences.getBoolean("run.use_gradle"))
3131

32+
val settings = GradleSettings()
33+
3234
var sketch: Sketch? = null
3335
set (value) {
3436
field = value
@@ -77,5 +79,11 @@ class GradleService(
7779
fun setEnabled(active: Boolean) {
7880
if(!active) stopJobs()
7981
this.active.value = active
82+
val editor = editor ?: return
83+
if(active){
84+
editor.footer?.addPanel(settings, text("gradle.settings"), "/lib/footer/settings")
85+
}else{
86+
editor.footer?.removePanel(settings)
87+
}
8088
}
8189
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package processing.app.gradle
2+
3+
import androidx.compose.material.Text
4+
import androidx.compose.runtime.Composable
5+
import androidx.compose.ui.awt.ComposePanel
6+
import javax.swing.JPanel
7+
8+
class GradleSettings : JPanel() {
9+
init{
10+
val compose = ComposePanel()
11+
compose.setContent {
12+
Panel()
13+
}
14+
this.add(compose)
15+
}
16+
companion object{
17+
@Composable
18+
fun Panel(){
19+
Text("Gradle settings will be here soon")
20+
}
21+
22+
}
23+
}

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,16 @@ public void addPanel(Component comp, String name, String icon) {
154154
cardPanel.add(name, comp);
155155
}
156156

157-
158-
// public void setPanel(int index) {
159-
// cardLayout.show(cardPanel, tabs.get(index).name);
160-
// }
161-
157+
/**
158+
* Remove a panel from the footer.
159+
* @param comp Component that links to this tab.
160+
* */
161+
public void removePanel(Component comp){
162+
cardLayout.show(cardPanel, tabs.get(0).title);
163+
tabs.removeIf(tab -> tab.comp == comp);
164+
cardPanel.remove(comp);
165+
repaint();
166+
}
162167

163168
public void setPanel(Component comp) {
164169
for (Tab tab : tabs) {
Lines changed: 1 addition & 0 deletions
Loading

build/shared/lib/languages/PDE.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ debugger.type = Type
324324
gradle.instructions = About this file: \nProcessing creates this file when you run your sketch. \nIt configures the tools needed to build and export your code. \nLearn more: [Gradle Primer link]\n \nTo customize this file: \n1. Delete the line above that begins with '@processing-auto-generated'. \nThis will prevent Processing from overwriting this file in the future. \n2. Make your desired changes.
325325
gradle.using_gradle = Building sketch using the new build system. (See settings to switch to the legacy build system.)
326326
gradle.using_eclipse = Building sketch using the legacy build system. (See settings to switch to the new build system.)
327+
gradle.settings = Settings
327328

328329
# ---------------------------------------
329330
# Toolbars

java/gradle/src/main/kotlin/ProcessingPlugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact
6969
extension.extensions.getByType(DesktopExtension::class.java).application { application ->
7070
// Set the class to be executed initially
7171
application.mainClass = sketchName
72-
application.nativeDistributions.modules("java.management","jdk.jdwp.agent")
72+
application.nativeDistributions.includeAllModules = true
7373
if(debugPort != null) {
7474
application.jvmArgs("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$debugPort")
7575
}

0 commit comments

Comments
 (0)