diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-213.txt b/composeApp/src/commonMain/composeResources/files/ffpm-213.txt index 92f92e8..e589678 100644 --- a/composeApp/src/commonMain/composeResources/files/ffpm-213.txt +++ b/composeApp/src/commonMain/composeResources/files/ffpm-213.txt @@ -4,6 +4,6 @@ N1:#m ssllsltdd/ m'rdrsltd/ dtltdtlls/ dtdltdrd/ mmfflsffm/ ssdlswss/ sssstwrrd/ N2:mmfffwffm/ sfmrfwfm/ ssf3wf3/ mfsssltd'/ ddrrfmrrd/ ssmrfwfm/ mmfflsffm/ ssd'lswss N3:#s dtltdtlls/ dtdltdrd/ dddsswlrs/ ssddrmfm/ ssllsltdd/ mrdrsltd/ ssttrwttd/ mmdrdmfm N4:#t, d5wd3/ d'slfswsd / mmfmrwdtt/ drmfswsd'/ d5wd3/ d'tlfswsd'ddrrswsll/ d't'lfswsd -Y1:Ry fana\hy mangetaheta/Mila fitsaharana:/Aza kivy, mahareta,/Sentonao hifarana!/Fa ny tenin'i Jehovah,/Soa mangarangarana;/Loharano tsy mi_ova,/Ao no hasambarana. +Y1:Ry fana\hy mangetaheta/Mila fitsaharana:/Aza kivy, mahareta,/Sentonao hifarana!/Fa ny tenin'i Jehova\h,/Soa mangarangarana;/Loharano tsy mi_ova,/Ao no hasambarana. Y2:Ry tontolo mila vonjy,/Te ho afa-patotra,/Ao ny tenin'ny Mpamonjy/Dia Kristy Mpanavotra!/Teny velona sy mamy,/Feno fananarana;/Ho torina eran-tany,/Fa fampihavanana. Y3:Ry Mpanjakan'ny mpanjaka!/Ao, tendreo ny lelako/Mba hitory sy hizaka,/Hampandre ny havako,/Dia tahio ny teny reny/Tsy ho very hasina,/Ka hamo_a zato heny/Ny Baiboly Masina./ diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/MarkersPopup.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/MarkersPopup.kt index a2fa3d4..3ab28c0 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/MarkersPopup.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/MarkersPopup.kt @@ -22,9 +22,9 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp -import androidx.compose.ui.window.DialogProperties import androidx.compose.ui.window.Popup import androidx.compose.ui.window.PopupProperties +import mg.dot.feufaro.viewmodel.measureOptions data class Marker( val abbr: String, @@ -138,6 +138,14 @@ private val markerGroups = listOf( markers = listOf( Marker("Dô dia", "Modulation", canEditValue = true, defaultValue = "C", options = Transpose.keyToNumber) ) + ), + + + MarkerGroup( + title = "Mesure", + markers = listOf( + Marker("m:", measureOptions.firstOrNull { it.first == "4/4" } ?.second ?: "", canEditValue = true, defaultValue = "4/4", options = measureOptions.map { it.first }) + ) ) ) diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt index b1aafde..3e04c89 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt @@ -1770,7 +1770,9 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository val finalLines = (prefix + cleanedBlocks.joinToString("")) .replace("2z11", "y") - .replace("/", "/ ") + .replace(Regex("""\$\{.*?\}|/""")) { match -> + if (match.value == "/") "/ " else match.value + } .replace(Regex("\\s+"), " ") .trim() diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/viewmodel/SharedScreenModel.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/viewmodel/SharedScreenModel.kt index be6ebe1..859761c 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/viewmodel/SharedScreenModel.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/viewmodel/SharedScreenModel.kt @@ -531,7 +531,7 @@ class SharedScreenModel(private val fileRepository: FileRepository) : ScreenMode val tempoRegex = Regex("""^(♩\s*=\s*\d+)""", RegexOption.IGNORE_CASE) val modulaRegex = Regex("""^(D(?:ô|o)?\s*dia\s*(?:C|Db|D|Eb|E|F|Gb|G|Ab|A|Bb|B))""", RegexOption.IGNORE_CASE) - + val measureRegex = Regex("""^\d+\s*/\s*\d+""") // Lexer while (remaining.isNotEmpty()) { remaining = remaining.trimStart() @@ -551,6 +551,14 @@ class SharedScreenModel(private val fileRepository: FileRepository) : ScreenMode continue } + val measureMatch = measureRegex.find(remaining) + if (measureMatch != null) { + val cleanMeasure = measureMatch.value.replace(" ", "") + tokens.add(cleanMeasure) + remaining = remaining.substring(measureMatch.value.length) + continue + } + val matchedMarker = allStaticMarkers.find { remaining.startsWith(it, ignoreCase = true) } if (matchedMarker != null) { tokens.add(matchedMarker) @@ -593,6 +601,7 @@ class SharedScreenModel(private val fileRepository: FileRepository) : ScreenMode val isDSFin = markerText.trim().contains(Regex("""D\.?S\.?""", RegexOption.IGNORE_CASE)) && markerText.trim().contains(Regex("""(fine|fin|farany|end)""", RegexOption.IGNORE_CASE)) val isRit = Regex("""rit\.?|ritard\.?|ritenuto\.?|ritardando""", RegexOption.IGNORE_CASE) val isRall = Regex("""rall\.?|rallent\.?|rallentando""", RegexOption.IGNORE_CASE) + val isMeasure = markerText.trim().matches(Regex("""^(\d+/\d+)""", RegexOption.IGNORE_CASE)) var searchIndex = index + 1 var lastValidIndex = index @@ -633,6 +642,10 @@ class SharedScreenModel(private val fileRepository: FileRepository) : ScreenMode currentMarker = currentMarker.copy(lastCallerMarker = targetIndex) newMarkerList.add("Rallentando") } + isMeasure -> { + newGridIndex = targetIndex + newMarkerList.add("${markerText.trim()}") + } else -> { newMarkerList.add(markerText) }