Add Navigation on Popup Editing
This commit is contained in:
parent
dc86d9ddc4
commit
a5977d5dd1
3 changed files with 89 additions and 27 deletions
|
|
@ -633,10 +633,10 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
|||
val isNoteModified = newNot != oldNot
|
||||
// println("est-ce? $isNoteModified = $newNot != $oldNot")
|
||||
|
||||
/*if (!isNoteModified) {
|
||||
println("Voix $linePrefix : Aucune modification détectée (Note: $oldNot ).")
|
||||
if (!isNoteModified) {
|
||||
// println("Voix $linePrefix : Aucune modification détectée (Note: $oldNot ).")
|
||||
continue
|
||||
}*/
|
||||
}
|
||||
|
||||
val newNote = notesByVoice[voiceNum] ?: ""
|
||||
if (newNote.isEmpty()) continue
|
||||
|
|
@ -936,8 +936,8 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
|||
compactedBlock.append("")
|
||||
}
|
||||
|
||||
println(String.format("%-4d | %-25s | %-15s | %-25s",
|
||||
currentLogicalIdx, rawBlockText, actionTaken, compactedBlock.toString()))
|
||||
// println(String.format("%-4d | %-25s | %-15s | %-25s",
|
||||
// currentLogicalIdx, rawBlockText, actionTaken, compactedBlock.toString()))
|
||||
|
||||
resultBody.append(compactedBlock)
|
||||
if (i < body.length) resultBody.append(body[i])
|
||||
|
|
@ -951,9 +951,9 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
|||
}
|
||||
|
||||
val finalResult = "$prefix$resultBody$suffix"
|
||||
println("-".repeat(100))
|
||||
println("RÉSULTAT FINAL COMPACTÉ : $finalResult")
|
||||
println("=".repeat(100))
|
||||
// println("-".repeat(100))
|
||||
// println("RÉSULTAT FINAL COMPACTÉ : $finalResult")
|
||||
// println("=".repeat(100))
|
||||
|
||||
return finalResult
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import androidx.compose.foundation.text.BasicTextField
|
|||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowForward
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.Build
|
||||
import androidx.compose.material.icons.filled.Clear
|
||||
|
|
@ -41,9 +43,11 @@ fun TUODetailDialog(
|
|||
globalIndex: Int,
|
||||
isEditable: Boolean,
|
||||
canAdd: Boolean,
|
||||
onIndexChanged: (Int) -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
onSave: (TUOEditState) -> Unit
|
||||
) {
|
||||
var currentIndex by remember(globalIndex) { mutableStateOf(globalIndex) }
|
||||
val notes = remember {
|
||||
mutableStateMapOf<Int, String>().apply {
|
||||
putAll(editState.notesByVoice)
|
||||
|
|
@ -107,13 +111,49 @@ fun TUODetailDialog(
|
|||
color = Color(0xFF2D2D2D).copy(0.75f),
|
||||
) {
|
||||
Column(modifier = Modifier.padding(horizontal = 10.dp, vertical = 5.dp).fillMaxWidth()) {
|
||||
Row (
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
if (currentIndex > 0) {
|
||||
IconButton(
|
||||
onClick = {
|
||||
currentIndex--
|
||||
onIndexChanged(currentIndex)
|
||||
},
|
||||
modifier = Modifier.size(32.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||
contentDescription = "Précédent",
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Text(
|
||||
text = "N°$globalIndex",
|
||||
text = "N°$currentIndex",
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.White
|
||||
)
|
||||
|
||||
IconButton(
|
||||
onClick = {
|
||||
currentIndex++
|
||||
onIndexChanged(currentIndex)
|
||||
},
|
||||
modifier = Modifier.size(32.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Filled.ArrowForward,
|
||||
contentDescription = "Suivant",
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(2.dp))
|
||||
|
||||
Column(
|
||||
|
|
@ -494,13 +534,13 @@ public fun getGlobalTemplate(editState: TUOEditState): String {
|
|||
if (combinedChar == ',' && result.isNotEmpty() && result.last() == ' ') {
|
||||
result.deleteCharAt(result.length - 1)
|
||||
}
|
||||
println("Pour $i = ${chars.toString()} on a > ${combinedChar.toString()}")
|
||||
// println("Pour $i = ${chars.toString()} on a > ${combinedChar.toString()}")
|
||||
|
||||
val lastChar = if (result.isNotEmpty()) result.last() else null
|
||||
if (!((combinedChar == '.' && lastChar == '.') || (combinedChar == ',' && lastChar == ','))) {
|
||||
result.append(combinedChar)
|
||||
}
|
||||
println("all = ${result.toString()}")
|
||||
// println("all = ${result.toString()}")
|
||||
|
||||
if (openAfter[i]) result.append('(')
|
||||
if (closeAfter[i]) result.append(')')
|
||||
|
|
|
|||
|
|
@ -877,6 +877,19 @@ fun LazyVerticalGridTUO(
|
|||
sharedScreenModel.openTUOEditor(newState)
|
||||
showAddDialog = false
|
||||
showEditDialog = false
|
||||
},
|
||||
onIndexChanged = { newIndex ->
|
||||
selectedIndex = newIndex
|
||||
val globalList = sharedScreenModel.tuoList.value
|
||||
val nextTUO = globalList.getOrNull(newIndex)
|
||||
|
||||
if (nextTUO != null) {
|
||||
selectedTUO = nextTUO
|
||||
}else {
|
||||
showAddDialog = false
|
||||
showDetailDialog = false
|
||||
showEditDialog = false
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
@ -1267,12 +1280,12 @@ fun autoFixNote(rawNote: String, template: String): String {
|
|||
val noteRegex = Regex("([drmfsltDRFSTw][ia]?|―)[0-9'¹²³⁴₁₂₃₄,]*")
|
||||
val actualNotes = if (rawNote.isEmpty()) emptyList() else noteRegex.findAll(rawNote).map { it.value }.toList()
|
||||
|
||||
if (rawNote.contains("•") || rawNote.contains("―") || rawNote.contains(",")) {
|
||||
/*if (rawNote.contains("•") || rawNote.contains("―") || rawNote.contains(",")) {
|
||||
val templateNotesCount = template.count { c ->
|
||||
c in 'A'..'Y' || c in 'a'..'y'
|
||||
}
|
||||
if (actualNotes.size >= templateNotesCount) return rawNote
|
||||
}
|
||||
}*/
|
||||
val requiredNotesCount = template.count { it in 'A'..'Y' || it in 'a'..'y' }
|
||||
|
||||
val shouldIncludeParentheses = actualNotes.size >= requiredNotesCount
|
||||
|
|
@ -1286,25 +1299,33 @@ fun autoFixNote(rawNote: String, template: String): String {
|
|||
(char in 'A'..'Y' || char in 'a'..'y') -> {
|
||||
if (noteIdx < actualNotes.size) {
|
||||
val noteToAdd = actualNotes[noteIdx]
|
||||
if (noteIdx > 0) {
|
||||
if (noteIdx > 0 && result.isNotEmpty()) {
|
||||
val lastChar = result.last()
|
||||
if (lastChar != '•' && lastChar != ',' && lastChar != '(' && lastChar != ' ') {
|
||||
result.append(" ")
|
||||
}
|
||||
}
|
||||
|
||||
result.append(noteToAdd)
|
||||
noteIdx++
|
||||
} else {
|
||||
if (rawNote.isEmpty()) {
|
||||
/*if (rawNote.isEmpty()) {*/
|
||||
result.append("z")
|
||||
} else {
|
||||
/*} else {
|
||||
result.append("―")
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
char == '-' -> {
|
||||
if (noteIdx < actualNotes.size && actualNotes[noteIdx] == "―") {
|
||||
result.append("―")
|
||||
noteIdx++
|
||||
} else {
|
||||
val prev = if (i > 0) template[i - 1] else null
|
||||
val next = if (i < template.lastIndex) template[i + 1] else null
|
||||
if (prev == '.' && next == ',') result.append(" ") else result.append("―")
|
||||
}
|
||||
}
|
||||
char == 'z' -> result.append(" ")
|
||||
char == '.' -> {
|
||||
val currentText = result.toString()
|
||||
|
|
@ -1322,5 +1343,6 @@ fun autoFixNote(rawNote: String, template: String): String {
|
|||
}
|
||||
}
|
||||
}
|
||||
// println("on a RES ${result.toString()}")
|
||||
return result.toString()
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue