Refactor MainView and enhance View management
Replaced `MainView` object with a `Views` singleton for better modularity and lazy initialization. Adjusted CSS structure, updated dependencies, and improved FM/AM modulation logic for greater flexibility. Additionally, upgraded Kotlin multiplatform version and added inline source mapping.
This commit is contained in:
@@ -37,6 +37,7 @@ import nl.astraeus.komp.Komponent
|
||||
import nl.astraeus.komp.currentElement
|
||||
import nl.astraeus.midi.message.TimedMidiMessage
|
||||
import nl.astraeus.midi.message.getCurrentTime
|
||||
import nl.astraeus.vst.chip.Views
|
||||
import nl.astraeus.vst.chip.audio.VstChipWorklet
|
||||
import nl.astraeus.vst.chip.audio.VstChipWorklet.midiChannel
|
||||
import nl.astraeus.vst.chip.midi.Midi
|
||||
@@ -61,7 +62,7 @@ object WaveformView: Komponent() {
|
||||
}
|
||||
|
||||
fun onAnimationFrame(time: Double) {
|
||||
if (MainView.started) {
|
||||
if (Views.mainView.started) {
|
||||
VstChipWorklet.postMessage("start_recording")
|
||||
}
|
||||
|
||||
@@ -98,7 +99,7 @@ object WaveformView: Komponent() {
|
||||
}
|
||||
}
|
||||
|
||||
object MainView : Komponent(), CssName {
|
||||
class MainView : Komponent() {
|
||||
private var messages: MutableList<String> = ArrayList()
|
||||
var started = false
|
||||
|
||||
@@ -275,7 +276,7 @@ object MainView : Komponent(), CssName {
|
||||
value = VstChipWorklet.fmModFreq,
|
||||
label = "FM Freq",
|
||||
minValue = 0.0,
|
||||
maxValue = 1.0,
|
||||
maxValue = 2.0,
|
||||
step = 5.0 / 127.0,
|
||||
width = 100,
|
||||
height = 120,
|
||||
@@ -420,18 +421,19 @@ object MainView : Komponent(), CssName {
|
||||
}
|
||||
}
|
||||
|
||||
object MainDivCss : CssName
|
||||
object ActiveCss : CssName
|
||||
object ButtonCss : CssName
|
||||
object ButtonBarCss : CssName
|
||||
object SelectedCss : CssName
|
||||
object NoteBarCss : CssName
|
||||
object StartSplashCss : CssName
|
||||
object StartBoxCss : CssName
|
||||
object StartButtonCss : CssName
|
||||
object ControlsCss : CssName
|
||||
companion object MainViewCss : CssName() {
|
||||
object MainDivCss : CssName()
|
||||
object ActiveCss : CssName()
|
||||
object ButtonCss : CssName()
|
||||
object ButtonBarCss : CssName()
|
||||
object SelectedCss : CssName()
|
||||
object NoteBarCss : CssName()
|
||||
object StartSplashCss : CssName()
|
||||
object StartBoxCss : CssName()
|
||||
object StartButtonCss : CssName()
|
||||
object ControlsCss : CssName()
|
||||
|
||||
private fun css() {
|
||||
private fun css() {
|
||||
defineCss {
|
||||
select("*") {
|
||||
select("*:before") {
|
||||
@@ -530,23 +532,23 @@ object MainView : Komponent(), CssName {
|
||||
backgroundColor(Css.currentStyle.mainBackgroundColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Style.commonButton() {
|
||||
display(Display.inlineBlock)
|
||||
padding(1.rem)
|
||||
backgroundColor(Css.currentStyle.buttonBackgroundColor)
|
||||
borderColor(Css.currentStyle.buttonBorderColor)
|
||||
borderWidth(Css.currentStyle.buttonBorderWidth)
|
||||
color(Css.currentStyle.mainFontColor)
|
||||
|
||||
hover {
|
||||
backgroundColor(Css.currentStyle.buttonBackgroundColor.hover())
|
||||
}
|
||||
and(SelectedCss.cls()) {
|
||||
backgroundColor(Css.currentStyle.buttonBackgroundColor.hover().hover().hover())
|
||||
|
||||
private fun Style.commonButton() {
|
||||
display(Display.inlineBlock)
|
||||
padding(1.rem)
|
||||
backgroundColor(Css.currentStyle.buttonBackgroundColor)
|
||||
borderColor(Css.currentStyle.buttonBorderColor)
|
||||
borderWidth(Css.currentStyle.buttonBorderWidth)
|
||||
color(Css.currentStyle.mainFontColor)
|
||||
|
||||
hover {
|
||||
backgroundColor(Css.currentStyle.buttonBackgroundColor.hover())
|
||||
}
|
||||
and(SelectedCss.cls()) {
|
||||
backgroundColor(Css.currentStyle.buttonBackgroundColor.hover().hover().hover())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user