Skip to content

Commit efa77bb

Browse files
committed
Cleanup
[skip ci]
1 parent 97ec5e4 commit efa77bb

File tree

4 files changed

+28
-44
lines changed

4 files changed

+28
-44
lines changed

app/src/processing/app/gradle/Exceptions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import kotlinx.coroutines.delay
1212
import kotlinx.coroutines.launch
1313
import processing.app.Messages
1414

15+
// TODO: Consider adding a panel to the footer
1516
class Exceptions {
1617
companion object {
1718
suspend fun listen(vm: VirtualMachine) {

app/src/processing/app/gradle/ui/Toolbar.kt

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import androidx.compose.foundation.*
99
import androidx.compose.foundation.layout.*
1010
import androidx.compose.foundation.shape.CircleShape
1111
import androidx.compose.material.*
12-
import androidx.compose.material.icons.Icons
13-
import androidx.compose.material.icons.filled.PlayArrow
1412
import androidx.compose.runtime.*
1513
import androidx.compose.ui.Alignment
1614
import androidx.compose.ui.ExperimentalComposeUiApi
@@ -32,7 +30,6 @@ import androidx.compose.ui.unit.dp
3230
import androidx.compose.ui.window.Window
3331
import androidx.compose.ui.window.WindowPosition
3432
import androidx.compose.ui.window.rememberWindowState
35-
import groovyjarjarantlr4.v4.runtime.misc.Args
3633
import processing.app.gradle.helpers.ActionGradleJob
3734
import processing.app.gradle.GradleJob
3835
import processing.app.gradle.ScreenshotService
@@ -63,14 +60,10 @@ class Toolbar(val editor: Editor?) {
6360

6461
return panel
6562
}
66-
@JvmStatic
67-
fun main(args: Array<String>) {
68-
69-
}
7063
}
7164

7265
// TODO: Split into multiple files
73-
// TODO: Use svgs for icons
66+
// TODO: Make runnable outside of Processing IDE
7467
@OptIn(ExperimentalMaterialApi::class, ExperimentalComposeUiApi::class, ExperimentalFoundationApi::class)
7568
@Composable
7669
fun display() {
@@ -119,7 +112,7 @@ class Toolbar(val editor: Editor?) {
119112
}
120113

121114
}
122-
115+
var showSketchSettings by remember { mutableStateOf(false) }
123116
Row {
124117
hoverPill(actions = {
125118
actionButton(
@@ -155,9 +148,9 @@ class Toolbar(val editor: Editor?) {
155148
}
156149

157150

158-
var expanded by remember { mutableStateOf(false) }
151+
159152
actionButton(
160-
active = expanded,
153+
active = showSketchSettings,
161154
modifier = Modifier
162155
.onClick {
163156
editor ?: return@onClick
@@ -167,7 +160,7 @@ class Toolbar(val editor: Editor?) {
167160
x = x.dp,
168161
y = y.dp,
169162
)
170-
expanded = !expanded
163+
showSketchSettings = !showSketchSettings
171164
}
172165
) {
173166
val icon = useResource("toolbar/Sketch Settings.svg") { loadSvgPainter(it, Density(1f)) }
@@ -178,23 +171,7 @@ class Toolbar(val editor: Editor?) {
178171
tint = color
179172
)
180173
}
181-
Window(
182-
visible = expanded,
183-
onCloseRequest = {
184-
expanded = false
185-
},
186-
resizable = true,
187-
title = "Sketch Settings",
188-
state = windowState,
189-
) {
190-
Column(modifier = Modifier.padding(16.dp)) {
191-
Chip(onClick = {
192-
editor?.service?.active?.value = false
193-
}) {
194-
Text("Switch back to legacy")
195-
}
196-
}
197-
}
174+
198175
}, base = {
199176
actionButton {
200177
val icon = useResource("toolbar/More.svg") { loadSvgPainter(it, Density(1f)) }
@@ -206,6 +183,25 @@ class Toolbar(val editor: Editor?) {
206183
)
207184
}
208185
})
186+
187+
188+
Window(
189+
visible = showSketchSettings,
190+
onCloseRequest = {
191+
showSketchSettings = false
192+
},
193+
resizable = true,
194+
title = "Sketch Settings",
195+
state = windowState,
196+
) {
197+
Column(modifier = Modifier.padding(16.dp)) {
198+
Chip(onClick = {
199+
editor?.service?.active?.value = false
200+
}) {
201+
Text("Switch back to legacy")
202+
}
203+
}
204+
}
209205
}
210206
}
211207

app/src/processing/app/ui/theme/Colors.kt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,4 @@ val PDELightColors = Colors(
1717
onSurface = Color("#FFFFFF".toColorInt()),
1818
onError = Color("#0F195A".toColorInt()),
1919
isLight = true,
20-
)
21-
22-
fun String.toColorInt(): Int {
23-
if (this[0] == '#') {
24-
var color = substring(1).toLong(16)
25-
if (length == 7) {
26-
color = color or 0x00000000ff000000L
27-
} else if (length != 9) {
28-
throw IllegalArgumentException("Unknown color")
29-
}
30-
return color.toInt()
31-
}
32-
throw IllegalArgumentException("Unknown color")
33-
}
20+
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ abstract class ProcessingTask : SourceTask() {
6868
val libraries = File(sketchBook, "libraries")
6969
.listFiles { file -> file.isDirectory }
7070
?.map { folder ->
71-
// Find all the jars in the sketch book
71+
// Find all the jars in the sketchbook
7272
val jars = folder.resolve("library")
7373
.listFiles{ file -> file.extension == "jar" }
7474
?.map{ file ->

0 commit comments

Comments
 (0)