@@ -17,17 +17,17 @@ import "selectionhelper.js" as SelHelper
1717
1818/**********************************************/
1919MuseScore {
20- menuPath: " Plugins." + qsTr (" Euclidian Rhythm" )
20+ menuPath: " Plugins." + qsTr (" Euclidean Rhythm" )
2121 version: " 1.0.0"
2222 requiresScore: true
23- description: qsTr (" Create an euclidian rhythm" )
23+ description: qsTr (" Create an euclidean rhythm" )
2424 pluginType: " dialog"
2525
2626 id: mainWindow
2727
2828 Component .onCompleted : {
2929 if (mscoreMajorVersion >= 4 ) {
30- mainWindow .title = qsTr (" Euclidian Rhythm" );
30+ mainWindow .title = qsTr (" Euclidean Rhythm" );
3131 mainWindow .thumbnailName = " logo.png" ;
3232 // mainWindow.categoryCode = "batch-processing";
3333 }
@@ -53,7 +53,7 @@ MuseScore {
5353 var pArr= settings .freePattern ;
5454 console .log (" pArr: " + (pArr? JSON .stringify (pArr): " undefined" ));
5555 console .log (" is array ? " + Array .isArray (pArr));
56- console .log (" Size %1 vs. pattern %2" .arg (pArr .length ).arg (freePattern .count ));
56+ console .log (" Size %1 vs. pattern %2" .arg (pArr? pArr .length : 0 ).arg (freePattern .count ));
5757 if (pArr && Array .isArray (pArr)) {
5858 for (var i= 0 ;i< Math .min (pArr .length , freePattern .count );i++ ) {
5959 freePattern .itemAt (i).checked = (pArr[i]=== 1 );
@@ -83,6 +83,15 @@ MuseScore {
8383 }
8484
8585 atCursor .checked = true ;
86+
87+ // Default value, if nothing from settings
88+ if (! euclideanRhythm .checked && ! freeRhythm .checked ) {
89+ euclideanRhythm .checked = true ;
90+ }
91+
92+ if (! mult .currentIndex || mult .currentIndex <= 0 ) {
93+ mult .currentIndex = 0 ;
94+ }
8695
8796 }
8897
@@ -292,8 +301,8 @@ MuseScore {
292301 }
293302
294303 RadioButton {
295- id: euclidianRhythm
296- text: qsTr (" Euclidian Rhythm" )
304+ id: euclideanRhythm
305+ text: qsTr (" Euclidean Rhythm" )
297306 ButtonGroup .group : rhythmType
298307 onToggled: refresh ()
299308
@@ -324,7 +333,7 @@ MuseScore {
324333 selectByMouse: true
325334 onTextChanged: refresh ()
326335
327- enabled: euclidianRhythm .checked
336+ enabled: euclideanRhythm .checked
328337
329338 validator: IntValidator {
330339 bottom: 1 ;
@@ -333,12 +342,12 @@ MuseScore {
333342 }
334343 Label {
335344 text: " /"
336- color: euclidianRhythm .checked ? sysActivePalette .text : sysActivePalette .mid
345+ color: euclideanRhythm .checked ? sysActivePalette .text : sysActivePalette .mid
337346 }
338347 TextField {
339348 Layout .preferredWidth : 40
340349 id: patternSize
341- text: " 32 "
350+ text: " 16 "
342351 selectByMouse: true
343352 onDisplayTextChanged: refresh ()
344353 validator: IntValidator {
@@ -404,13 +413,13 @@ MuseScore {
404413 Layout .column : 0
405414 Layout .row : 2
406415 text: qsTr (" Start at step" ) + " :"
407- color: euclidianRhythm .checked ? sysActivePalette .text : sysActivePalette .mid
416+ color: euclideanRhythm .checked ? sysActivePalette .text : sysActivePalette .mid
408417 }
409418 SpinBox {
410419 Layout .column : 1
411420 Layout .row : 2
412421 id: startAt
413- enabled: euclidianRhythm .checked
422+ enabled: euclideanRhythm .checked
414423
415424 from: (parseInt (patternSize .text ) * (- 1 ))
416425 value: 0
@@ -447,7 +456,7 @@ MuseScore {
447456 id: mult
448457 textRole: " text"
449458 onActivated: refresh ()
450- enabled: euclidianRhythm .checked
459+ enabled: euclideanRhythm .checked
451460 }
452461 Label {
453462 text: qsTr (" unit(s)" )
@@ -719,13 +728,13 @@ MuseScore {
719728 // Plugin settings
720729 Settings {
721730 id: settings
722- category: " EuclidianRhythmPlugin "
731+ category: " EuclideanRhythmPlugin "
723732 property alias nbbeats: patternBeats .text
724733 property alias size: patternSize .text
725734 property alias duration: duration .text
726735 property alias unit: unit .unitDuration
727736 property alias mult: mult .currentIndex
728- property alias euclidianRhythm : euclidianRhythm .checked
737+ property alias euclideanRhythm : euclideanRhythm .checked
729738 property alias freeRhythm: freeRhythm .checked
730739 property alias altNote: adhocNote .currentIndex
731740 property alias altOffNote: offbeatNote .currentIndex
@@ -775,7 +784,7 @@ MuseScore {
775784 text: " "
776785 }
777786
778- // The core Euclidian rhythm function
787+ // The core Euclidean rhythm function
779788 function isBeat (n ) {
780789
781790 var m = n + startAt .value ;
@@ -792,7 +801,7 @@ MuseScore {
792801 function getPattern () {
793802 var beats = [];
794803
795- if (euclidianRhythm .checked ) {
804+ if (euclideanRhythm .checked ) {
796805 for (var n = 0 ; n < duration .text ; n++ ) {
797806 for (var i = 0 ; i < patternSize .text ; i++ ) {
798807 beats .push (isBeat (i));
@@ -811,7 +820,7 @@ MuseScore {
811820 function getMergedPattern () {
812821 var beats= getPattern ();
813822 var summary= [];
814- var defMult = durationmult .get (mult .currentIndex ).mult ;
823+ var defMult = ( mult . currentIndex >= 0 ) ? durationmult .get (mult .currentIndex ).mult : 1 ;
815824 for (var i = 0 ; i < beats .length ; i++ ) {
816825 var play = beats[i];
817826 var action= {index: i, action: play, dur: 1 };
0 commit comments