Skip to content

Commit c26ea19

Browse files
author
laurent
committed
Working version on MU4.5
1 parent 19e5cb7 commit c26ea19

File tree

6 files changed

+209
-38
lines changed

6 files changed

+209
-38
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ You can parametrize what to play on the "on-beats" (i.e. the "played" steps) and
4040
#### Source
4141
The plugin can use 3 sources for defining the notes to play:
4242
1. the selection in the score
43-
2. the clipboard (what you copied through CTRL/CMD+C)
43+
2. the clipboard (what you copied through CTRL/CMD+C) ***⚠ Not available in the MU4.x version***
4444
3. the manual indication of the note to play
4545

4646
#### On-beats
@@ -78,11 +78,13 @@ However the plugin does not detect any change in the clipboard. In order to refr
7878
Download the [last stable version](https://github.com/lgvr123/musescore-euclidian/releases)
7979
For installation see [Plugins](https://musescore.org/en/handbook/3/plugins).
8080

81+
* For MuseScore 3.6.2, 3.7, MU4.0-4.3 use the "Compatibility" asset.
82+
83+
* For MuseScore 4.4 or higher, use the "4.5" asset.
84+
8185
### Remark
8286
The whole zip content (so the `euclidean\ ` folder) must be unzipped **as such** in your plugin folder. <br/>
8387

84-
## Support of MS4.0
85-
Supported, although the User Interface does not look very nice in this version.
8688

8789
## Sponsorship ##
8890
If you appreciate my plugins, you can support and sponsor their development on the following platforms:

euclidean/CompatibleButton.qml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import QtQuick 2.9
2+
import QtQuick.Controls 2.2
3+
4+
/**********************
5+
/
6+
/**********************************************/
7+
8+
Button {
9+
id: control
10+
contentItem: Text {
11+
text: control.text
12+
font: control.font
13+
opacity: enabled ? 1.0 : 0.6
14+
color: (mscoreMajorVersion >= 4)? ui.theme.fontPrimaryColor : sysActivePalette.text
15+
horizontalAlignment: Text.AlignHCenter
16+
verticalAlignment: Text.AlignVCenter
17+
elide: Text.ElideRight
18+
}
19+
20+
21+
SystemPalette {
22+
id: sysActivePalette;
23+
colorGroup: SystemPalette.Active
24+
}
25+
26+
}

euclidean/CompatibleComboBox.qml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import QtQuick 2.9
2+
import QtQuick.Controls 2.2
3+
4+
// v1.1.0: including textRole
5+
// v1.1.1: bugfix on textRole
6+
// v1.1.2: disabled color
7+
8+
ComboBox {
9+
id: control
10+
11+
model: []
12+
13+
textRole: "text"
14+
15+
implicitWidth: 80
16+
17+
delegate: ItemDelegate { // requiert QuickControls 2.2
18+
width: control.width
19+
contentItem: Text {
20+
// text: modelData[textRole]
21+
text: model[textRole]
22+
anchors.verticalCenter: parent.verticalCenter
23+
color: (mscoreMajorVersion >= 4)? ui.theme.fontPrimaryColor : sysActivePalette.text
24+
opacity: (control.enabled)?1:0.6
25+
}
26+
highlighted: control.highlightedIndex === index
27+
}
28+
29+
contentItem: Text {
30+
31+
text: control.displayText
32+
anchors.verticalCenter: parent.verticalCenter
33+
color: (mscoreMajorVersion >= 4)? ui.theme.fontPrimaryColor : sysActivePalette.text
34+
opacity: (control.enabled)?1:0.6
35+
36+
leftPadding: 10
37+
rightPadding: 10 //+ control.indicator.width + control.spacing
38+
topPadding: 5
39+
bottomPadding: 5
40+
verticalAlignment: Text.AlignVCenter
41+
}
42+
43+
indicator: Canvas {
44+
x: control.width - width - control.rightPadding
45+
y: control.topPadding + (control.availableHeight - height) / 2
46+
width: 8
47+
height: 5
48+
contextType: "2d"
49+
50+
onPaint: {
51+
context.reset();
52+
context.moveTo(0, 0);
53+
context.lineTo(width, 0);
54+
context.lineTo(width / 2, height);
55+
context.closePath();
56+
context.fillStyle = (mscoreMajorVersion >= 4)? ui.theme.fontPrimaryColor : sysActivePalette.text;
57+
context.fill();
58+
}
59+
}
60+
61+
SystemPalette { id: sysActivePalette; colorGroup: SystemPalette.Active }
62+
}

euclidean/TempoUnitBox.qml

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import QtQuick.Layouts 1.3
1212
* Versions history:
1313
* 1.0.0 Version initiale tirée de TapTempo
1414
* 1.0.1 New Binding mechanism
15+
* 1.1.0 Compatibility wit MU4.5
1516
*/
1617

1718
RowLayout {
@@ -24,8 +25,6 @@ RowLayout {
2425
// control
2526
property var sizeMult: 1.5
2627

27-
property var buttonColor: "#21be2b"
28-
property var buttonDownColor: "#17a81a"
2928

3029
// returned values
3130
property real unitDuration: 1
@@ -162,22 +161,62 @@ RowLayout {
162161
console.log("Ending up with unitDuration = %1".arg(JSON.stringify(unitDuration)));
163162
}
164163

165-
implicitHeight: 40 * sizeMult
164+
implicitHeight: 30 * sizeMult
166165
implicitWidth: 90
167166

168167
font.family: 'MScore Text'
169-
font.pointSize: 10 * sizeMult
168+
font.pointSize: 15 * sizeMult
169+
// color: blue
170170

171171
delegate: ItemDelegate {
172+
width: lstMult.width
172173
contentItem: Text {
173174
// text: modelData[lstMult.textRole] // "modelData" fonctionne pour un modèle qui est une Array, "model" pour un modèle qui est un ListModel
174175
text: model[lstMult.textRole]
175176
verticalAlignment: Text.AlignVCenter
177+
// anchors.verticalCenter: parent.verticalCenter
178+
color: (mscoreMajorVersion >= 4)? ui.theme.fontPrimaryColor : sysActivePalette.text
179+
opacity: (control.enabled)?1:0.6
176180
font: lstMult.font
177181
}
178182
highlighted: multipliers.highlightedIndex === index
179183

180184
}
185+
186+
contentItem: Text {
187+
188+
text: lstMult.displayText
189+
anchors.verticalCenter: parent.verticalCenter
190+
color: (mscoreMajorVersion >= 4)? ui.theme.fontPrimaryColor : sysActivePalette.text
191+
opacity: (lstMult.enabled)?1:0.6
192+
193+
font: lstMult.font
194+
195+
196+
leftPadding: 10
197+
rightPadding: 10 + lstMult.indicator.width + lstMult.spacing
198+
topPadding: 5
199+
bottomPadding: 5
200+
verticalAlignment: Text.AlignVCenter
201+
}
202+
203+
indicator: Canvas {
204+
x: lstMult.width - width - lstMult.rightPadding
205+
y: lstMult.topPadding + (lstMult.availableHeight - height) / 2
206+
width: 8
207+
height: 5
208+
contextType: "2d"
209+
210+
onPaint: {
211+
context.reset();
212+
context.moveTo(0, 0);
213+
context.lineTo(width, 0);
214+
context.lineTo(width / 2, height);
215+
context.closePath();
216+
context.fillStyle = (mscoreMajorVersion >= 4)? ui.theme.fontPrimaryColor : sysActivePalette.text;
217+
context.fill();
218+
}
219+
}
181220

182221
}
183222

euclidean/euclidean.qml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import "selectionhelper.js" as SelHelper
2121
/* 1.2.0 : Bug: The pattern summary was always written on the first staff.
2222
/* 1.2.0 : CR: Allow ascii symbols for alterations in the pattern summaries (noteHelper 2.0.3)
2323
/* 1.2.0 : CR: Option to stop the pattern when pattern summary is encountered
24-
24+
/* 1.2.0 : Compatibility mode with MU4.5
2525
2626
Issues :
2727
* matching of accidentals in the UseAsRest: a E# is matched with a F, a Gb is matched with a F#
@@ -30,15 +30,17 @@ Issues :
3030
/**********************************************/
3131
MuseScore {
3232
menuPath: "Plugins." + qsTr("Euclidean Rhythm")
33-
version: "1.1.0"
33+
version: "1.2.0"
3434
requiresScore: true
3535
description: qsTr("Create an euclidean rhythm")
3636
pluginType: "dialog"
3737

3838
id: mainWindow
39+
//4.4 title: "Euclidean Rhythm"
40+
//4.4 thumbnailName: "logo.png"
3941

4042
Component.onCompleted: {
41-
if (mscoreMajorVersion >= 4) {
43+
if (mscoreMajorVersion >= 4 && mscoreMajorVersion<=3) {
4244
mainWindow.title = qsTr("Euclidean Rhythm");
4345
mainWindow.thumbnailName = "logo.png";
4446
// mainWindow.categoryCode = "batch-processing";
@@ -510,7 +512,7 @@ MuseScore {
510512
RowLayout {
511513
Layout.column: 1
512514
Layout.row: 3
513-
ComboBox {
515+
CompatibleComboBox {
514516
model: durationmult
515517
id: mult
516518
textRole: "text"
@@ -566,7 +568,7 @@ MuseScore {
566568
ImageButton {
567569
id: loadPattern
568570
//enabled: (typeof positionInScore !== undefined) && (typeof positionInScore.summary !== undefined)
569-
enabled: (typeof positionInScore !== undefined)?(typeof positionInScore.summary === "object"):false
571+
enabled: ((typeof positionInScore !== "undefined") && (positionInScore!==null))?(typeof positionInScore.summary === "object"):false
570572
imageHeight: 25
571573
imageSource: "upload.svg"
572574
ToolTip.text: qsTr("Load from log")
@@ -653,7 +655,7 @@ MuseScore {
653655
ButtonGroup.group: source
654656
}
655657

656-
ComboBox {
658+
CompatibleComboBox {
657659
id: adhocNote
658660
model: allnotes
659661
textRole: "name"
@@ -758,7 +760,7 @@ MuseScore {
758760
ButtonGroup.group: off
759761
}
760762

761-
ComboBox {
763+
CompatibleComboBox {
762764
model: allnotes
763765
textRole: "name"
764766
id: offbeatNote
@@ -810,15 +812,22 @@ MuseScore {
810812
alignment: Qt.AlignRight
811813
background.opacity: 0 // hide default white background
812814

813-
standardButtons: DialogButtonBox.Cancel
815+
// standardButtons: DialogButtonBox.Cancel
816+
814817

815-
Button {
818+
CompatibleButton {
816819
id: ok
817820
enabled: (patternBeats.text !== "") && (patternSize.text !== "")
818821
text: qsTr("Create")
819822
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
820823
}
821824

825+
CompatibleButton {
826+
id: cancel
827+
text: qsTr("Cancel")
828+
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
829+
}
830+
822831
onAccepted: {
823832
work();
824833
}

0 commit comments

Comments
 (0)