Skip to content
Snippets Groups Projects
Commit 8ccc65ea authored by SeeLook's avatar SeeLook
Browse files

Get rid of separate rhythm, accidental, technical controls. Move them to...

Get rid of separate rhythm, accidental, technical controls. Move them to single 'score toolbox' appearing on the left when cursor is active
parent f0d657d7
No related branches found
No related tags found
No related merge requests found
......@@ -53,9 +53,7 @@
<file alias="score/AddLine.qml">qml/score/AddLine.qml</file>
<file alias="score/NoteCursor.qml">qml/score/NoteCursor.qml</file>
<file alias="score/NotePrompt.qml">qml/score/NotePrompt.qml</file>
<file alias="score/AccidControl.qml">qml/score/AccidControl.qml</file>
<file alias="score/RhythmControl.qml">qml/score/RhythmControl.qml</file>
<file alias="score/TechnicalControl.qml">qml/score/TechnicalControl.qml</file>
<file alias="score/ScoreToolbox.qml">qml/score/ScoreToolbox.qml</file>
<file alias="score/ControlButton.qml">qml/score/ControlButton.qml</file>
<file alias="score/NoteAdd.qml">qml/score/NoteAdd.qml</file>
<file alias="score/DelControl.qml">qml/score/DelControl.qml</file>
......
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
/**
* Visibility of this control depends on active (cursor) note of the score
*/
ControlBase {
id: accidControl
property int selectedId: idArray[scoreObj.cursorAlter + 2]
property string text: selectedId > -1 ? accidGlyphs[selectedId] : ""
property int alter: accidArray[selectedId + 1]
readonly property var accidGlyphs: [ "\ue264", "\ue260", "\ue262", "\ue263" ]
readonly property var accidArray: [ 0, -2, -1, 1, 2 ]
readonly property var idArray: [ 0, 1, -1, 2, 3 ]
property var techControl: null
x: (show ? scoreObj.xFirstInActivBar : -Noo.fontSize()) - width
y: score.contentY + (score.height - height) / 2
component: Component {
Column {
ControlButton {
factor: accidControl.factor
height: factor * 2.5
visible: scoreObj.enableTechnical && scoreObj.selectedItem
font { pixelSize: factor * 1.5; bold: true }
text: ""
onClicked: {
if (!techControl) {
var c = Qt.createComponent("qrc:/score/TechnicalControl.qml")
techControl = c.createObject(score)
}
techControl.x = scoreObj.selectedItem.x * score.scale
techControl.active = true
}
onEntered: hideTimer.stop()
onExited: hideTimer.restart()
}
Repeater {
model: 4
ControlButton {
factor: accidControl.factor
yOffset: factor * -4.4
visible: score.enableDoubleAccids || index === 1 || index === 2
selected: accidControl.selectedId === index
font { family: "scorek"; pixelSize: factor * 3 }
text: accidGlyphs[index]
onClicked: scoreObj.cursorAlter = accidArray[(selectedId === index ? -1 : index) + 1]
onEntered: hideTimer.stop()
onExited: hideTimer.restart()
}
}
}
}
Behavior on x { enabled: GLOB.useAnimations; SpringAnimation { spring: 2; damping: 0.3; duration: 300 }}
}
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
import Score 1.0
ControlBase {
id: rhythmControl
parent: score.parent
x: show ? 1 : -width - Noo.fontSize()
y: Noo.fontSize() / 2
visible: !scoreObj.touched
property string rhythmText: Noo.rhythmText(scoreObj.workRhythm)
property bool triplet: false
property bool tie: false
component: Component {
id: contentComp
Column {
Component {
id: ctrlButtonComp
ControlButton {
property int rhythm: 1
property bool rest: false
factor: rhythmControl.factor * 0.9
yOffset: factor / 2
font { family: "nootka"; pixelSize: factor * 1.8 }
text: Noo.rhythmText(Noo.rhythm(rhythm, rest, false, false))
selected: rhythm === scoreObj.workRtmValue && rest === scoreObj.workRtmRest
onEntered: hideTimer.stop()
onExited: hideTimer.restart()
}
}
Grid {
columns: 2
Repeater {
model: 10
Loader {
sourceComponent: ctrlButtonComp
onLoaded: { item.rhythm = 1 + index / 2; item.rest = index % 2 === 0 }
Connections {
target: item
onClicked: { scoreObj.workRtmValue = item.rhythm; scoreObj.workRtmRest = item.rest }
}
}
}
Loader { // triplet
id: tripLoad
sourceComponent: ctrlButtonComp
onLoaded: { item.rhythm = 0; item.text = "\u0183" }
Binding { target: tripLoad.item; property: "selected"; value: rhythmControl.triplet }
Connections {
target: tripLoad.item
onClicked: { rhythmControl.triplet = !tripLoad.item.selected; scoreObj.workRhythm = rhythm }
}
}
Loader { // dot
id: dotLoad
sourceComponent: ctrlButtonComp
onLoaded: { item.rhythm = 0; item.text = "." }
Binding { target: dotLoad.item; property: "selected"; value: scoreObj.workRtmDot }
Binding { target: dotLoad.item; property: "enabled"; value: scoreObj.workRtmValue !== Trhythm.Sixteenth }
Connections {
target: dotLoad.item
onClicked: scoreObj.workRtmDot = !scoreObj.workRtmDot
}
}
}
// ControlButton { // tie
// anchors.horizontalCenter: parent.horizontalCenter
// factor: rhythmControl.factor * 1.2
// selected: rhythmControl.tie
// height: factor * 1.5
// yOffset: -factor * 1.5
// font { family: "nootka"; pixelSize: factor * 3.6 }
// text: "\ue18c"
// onClicked: rhythmControl.tie = !selected
// onEntered: hideTimer.stop()
// onExited: hideTimer.restart()
// }
}
}
Behavior on x { enabled: GLOB.useAnimations; SpringAnimation { spring: 2; damping: 0.3; duration: 300 }}
}
......@@ -31,7 +31,7 @@ Flickable {
property alias singleNote: scoreObj.singleNote
property alias recordMode: scoreObj.recordMode
property alias bgRect: bgRect
property alias alterText: accidControl.text
property string alterText: ""
property alias insertNoteAct: scoreObj.insertNoteAct
property alias deleteNoteAct: scoreObj.deleteNoteAct
......@@ -42,6 +42,7 @@ Flickable {
property var noteAdd: null
property var delControl: null
property var cursor: null
property var scoreToobox: null
clip: true
boundsBehavior: Flickable.StopAtBounds
......@@ -51,6 +52,8 @@ Flickable {
ScrollBar.vertical: ScrollBar { active: false; visible: active }
// maximumFlickVelocity: 1000 // 2500 by default
TscoreObject {
id: scoreObj
width: score.width / scale
......@@ -70,10 +73,6 @@ Flickable {
if (staves.length > 1)
ensureVisible(lastNote.staffItem.y, lastNote.staffItem.height * scale)
}
onScoreWasCleared: {
accidControl.show = false
rtmControl.show = false
}
onAllowAddingChanged: {
if (allowAdding) {
if (!delControl) {
......@@ -84,6 +83,10 @@ Flickable {
var c = Qt.createComponent("qrc:/score/NoteAdd.qml")
noteAdd = c.createObject(contentItem)
}
if (!scoreToobox) {
var c = Qt.createComponent("qrc:/score/ScoreToolbox.qml")
scoreToobox = c.createObject(parent)
}
}
}
onActiveNoteChanged: {
......@@ -114,16 +117,6 @@ Flickable {
meter: Meter { parent: staff0 }
}
AccidControl {
id: accidControl
active: !readOnly && score.clef !== Tclef.NoClef && (scoreObj.activeNote !== null || (noteAdd && noteAdd.active))
}
RhythmControl {
id: rtmControl
active: !readOnly && meter !== Tmeter.NoMeter && (scoreObj.activeNote !== null || (noteAdd && noteAdd.active))
}
function ensureVisible(yy, hh) {
if (contentY >= yy)
contentY = yy
......
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
import Score 1.0
ControlBase {
id: toolbox
x: show ? factor / 5 : -width - Noo.fontSize()
y: Noo.fontSize() / 2
visible: !scoreObj.touched
active: !score.readOnly && (scoreObj.activeNote !== null || (score.noteAdd && score.noteAdd.active))
factor: Noo.fontSize() * (Noo.isAndroid() ? 1 : 1.2)
property string rhythmText: Noo.rhythmText(scoreObj.workRhythm)
property bool triplet: false
property bool tie: false
// Accidentals
property int selectedId: idArray[scoreObj.cursorAlter + 2]
property string text: selectedId > -1 ? accidGlyphs[selectedId] : ""
property int alter: accidArray[selectedId + 1]
readonly property var accidGlyphs: [ "\ue264", "\ue260", "\ue262", "\ue263" ]
readonly property var accidArray: [ 0, -2, -1, 1, 2 ]
readonly property var idArray: [ 0, 1, -1, 2, 3 ]
Component {
id: ctrlButtonComp
ControlButton {
property int rhythm: 1
property bool rest: false
factor: toolbox.factor * 0.9
yOffset: factor * 0.5
font { family: "nootka"; pointSize: factor * 1.8 }
text: Noo.rhythmText(Noo.rhythm(rhythm, rest, false, false))
selected: rhythm === scoreObj.workRtmValue && rest === scoreObj.workRtmRest
onEntered: hideTimer.stop()
onExited: hideTimer.restart()
}
}
component: Component {
id: contentComp
Column {
Grid {
columns: score.meter === Tmeter.NoMeter ? 1 : 2
anchors.horizontalCenter: parent.horizontalCenter
Repeater {
model: 4
ControlButton {
factor: toolbox.factor * 0.9
yOffset: factor * -4.4
visible: score.enableDoubleAccids || index === 1 || index === 2
selected: selectedId === index
font { family: "scorek"; pixelSize: factor * 3 }
text: accidGlyphs[index]
onClicked: {
scoreObj.cursorAlter = accidArray[(selectedId === index ? -1 : index) + 1]
score.alterText = toolbox.text
}
onEntered: hideTimer.stop()
onExited: hideTimer.restart()
}
}
}
Rectangle { visible: score.meter !== Tmeter.NoMeter; width: toolbox.width; height: 1; color: activPal.text }
Grid {
visible: score.meter !== Tmeter.NoMeter
columns: 2
Repeater {
model: 10
Loader {
sourceComponent: ctrlButtonComp
onLoaded: { item.rhythm = 1 + index / 2; item.rest = index % 2 === 0 }
Connections {
target: item
onClicked: { scoreObj.workRtmValue = item.rhythm; scoreObj.workRtmRest = item.rest }
}
}
}
Loader { // triplet
id: tripLoad
sourceComponent: ctrlButtonComp
onLoaded: { item.rhythm = 0; item.text = "\u0183" }
Binding { target: tripLoad.item; property: "selected"; value: toolbox.triplet }
// Connections {
// target: tripLoad.item
// onClicked: { toolbox.triplet = !tripLoad.item.selected; scoreObj.workRhythm = rhythm }
// }
}
Loader { // dot
id: dotLoad
sourceComponent: ctrlButtonComp
onLoaded: { item.rhythm = 0; item.text = "." }
Binding { target: dotLoad.item; property: "selected"; value: scoreObj.workRtmDot }
Binding { target: dotLoad.item; property: "enabled"; value: scoreObj.workRtmValue !== Trhythm.Sixteenth }
Connections {
target: dotLoad.item
onClicked: scoreObj.workRtmDot = !scoreObj.workRtmDot
}
}
}
ControlButton { // tie
visible: false //score.meter !== Tmeter.NoMeter
anchors.horizontalCenter: parent.horizontalCenter
factor: toolbox.factor * 1.2
selected: toolbox.tie
height: factor * 1.5
yOffset: factor * -2.2
font { family: "nootka"; pointSize: factor * 3.6 }
text: "\ue18c"
// onClicked: toolbox.tie = !selected
onEntered: hideTimer.stop()
onExited: hideTimer.restart()
}
Rectangle { visible: scoreObj.enableTechnical; width: toolbox.width; height: 1; color: activPal.text }
Grid {
visible: scoreObj.enableTechnical
columns: score.meter === Tmeter.NoMeter ? 1 : 2
Repeater {
model: [ "\uE610", "\uE612" ]
ControlButton {
factor: toolbox.factor * 0.9
height: factor * 2
yOffset: factor * -2.5
font { family: "Scorek"; pixelSize: factor * 2 }
text: modelData
onClicked: {
show = false
if (scoreObj.selectedItem) {
var b = index === 0 ? TnoteItem.BowDown : TnoteItem.BowUp
if (scoreObj.selectedItem.bowing() === b)
b = TnoteItem.BowUndefined
scoreObj.selectedItem.setBowing(b)
}
}
//TODO select bow control according to currently selected note
// onVisibleChanged: selected = scoreObj.selectedItem && scoreObj.selectedItem.bowing() === (index === 0 ? TnoteItem.BowDown : TnoteItem.BowUp)
onEntered: hideTimer.stop()
onExited: hideTimer.restart()
}
}
}
}
}
Connections {
target: scoreObj
onScoreWasCleared: show = false
}
Behavior on x { enabled: GLOB.useAnimations; SpringAnimation { spring: 2; damping: 0.3; duration: 300 }}
}
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2018 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
import Score 1.0
ControlBase {
id: techControl
y: accidControl.y
visible: show
component: Component {
Row {
Repeater {
model: [ "\uE610", "\uE612" ]
ControlButton {
factor: accidControl.factor * 0.9
height: factor * 2
yOffset: -factor * 2.5
font { family: "Scorek"; pixelSize: factor * 2 }
text: modelData
onClicked: {
techControl.show = false
if (scoreObj.selectedItem) {
var b = index === 0 ? TnoteItem.BowDown : TnoteItem.BowUp
if (scoreObj.selectedItem.bowing() === b)
b = TnoteItem.BowUndefined
scoreObj.selectedItem.setBowing(b)
}
}
onVisibleChanged: {
selected = scoreObj.selectedItem.bowing() === (index === 0 ? TnoteItem.BowDown : TnoteItem.BowUp)
}
onEntered: techControl.hideTimer.stop()
onExited: techControl.active = false
}
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment