From a815cc09da5c0b558c473bff40b2f05b4ca396e5 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sun, 28 Aug 2011 06:12:44 +0200 Subject: [PATCH] Double accidentals mostly work, but highlighting on playback is broken --- Resources/Music/doubleflat.eps | 126 ++++++++++++++++++++++++++ Resources/Music/doubleflatcursor.eps | 126 ++++++++++++++++++++++++++ Resources/Music/doublesharp.eps | 123 +++++++++++++++++++++++++ Resources/Music/doublesharpcursor.eps | 123 +++++++++++++++++++++++++ Sources/VLPitchGrid.cpp | 10 ++ Sources/VLPitchGrid.h | 5 + Sources/VLSheetView.h | 4 + Sources/VLSheetView.mm | 102 ++++++++------------- Sources/VLSheetViewInternal.h | 6 +- Sources/VLSheetViewNotes.mm | 52 +++++++---- Sources/VLSheetViewSelection.mm | 22 ++++- 11 files changed, 614 insertions(+), 85 deletions(-) create mode 100644 Resources/Music/doubleflat.eps create mode 100644 Resources/Music/doubleflatcursor.eps create mode 100644 Resources/Music/doublesharp.eps create mode 100644 Resources/Music/doublesharpcursor.eps diff --git a/Resources/Music/doubleflat.eps b/Resources/Music/doubleflat.eps new file mode 100644 index 0000000..eb16e84 --- /dev/null +++ b/Resources/Music/doubleflat.eps @@ -0,0 +1,126 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%BoundingBox: -25 -157 362 470 +%%Pages: 0 +%%Title: accidentals.flatflat from Emmentaler-26 +%%Creator: FontForge +%%Author: Matthias Neeracher +%%CreationDate: 5:16 28-8-2011 +%%EndComments +%%BeginPreview: 45 74 4 74 +%0000000000000000000000000000000000000000000000 +%6CEEC600000000000018DFEA3000000000000000000000 +%DFFFFD0000000000004FFFFF9000000000000000000000 +%DFFFFD0000000000003FFFFF9000000000000000000000 +%CFFFFC0000000000003FFFFF9000000000000000000000 +%CFFFFC0000000000003FFFFF8000000000000000000000 +%CFFFFC0000000000002FFFFF8000000000000000000000 +%CFFFFC0000000000002FFFFF8000000000000000000000 +%BFFFFB0000000000002FFFFF7000000000000000000000 +%BFFFFB0000000000001FFFFF7000000000000000000000 +%BFFFFB0000000000001FFFFF7000000000000000000000 +%AFFFFB0000000000001FFFFF6000000000000000000000 +%AFFFFA0000000000000FFFFF6000000000000000000000 +%AFFFFA0000000000000FFFFF6000000000000000000000 +%AFFFFA0000000000000FFFFF5000000000000000000000 +%9FFFFA0000000000000FFFFF5000000000000000000000 +%9FFFF90000000000000EFFFF5000000000000000000000 +%9FFFF90000000000000EFFFF5000000000000000000000 +%9FFFF90000000000000EFFFF4000000000000000000000 +%8FFFF90000000000000DFFFF4000000000000000000000 +%8FFFF80000000000000DFFFF4000000000000000000000 +%8FFFF80000000000000DFFFF3000000000000000000000 +%7FFFF80000000000000CFFFF3000000000000000000000 +%7FFFF80000000000000CFFFF3000000000000000000000 +%7FFFF70000000000000CFFFF2000000000000000000000 +%7FFFF70000000000000BFFFF2000000000000000000000 +%6FFFF70000000000000BFFFF2000000000000000000000 +%6FFFF60000000000000BFFFF2000000000000000000000 +%6FFFF60000000000000BFFFF1000000000000000000000 +%6FFFF60000000000000AFFFF1000000000000000000000 +%5FFFF60000000000000AFFFF1000000000000000000000 +%5FFFF50000000000000AFFFF0000000000000000000000 +%5FFFF500000000000009FFFF0000000000000000000000 +%4FFFF500000000000009FFFF0000000000000000000000 +%4FFFF500000000000009FFFE0000000000000000000000 +%4FFFF400000000000008FFFE0000000000000000000000 +%4FFFF400000000000008FFFE0000000000000000000000 +%3FFFF400000000000008FFFE0000000000000000000000 +%3FFFF400003688630007FFFD0000003578762000000000 +%3FFFF3018DFFFFFFD507FFFD0003AEFFFFFFFC60000000 +%2FFFF34DFFFFFFFFFFB8FFFD03CFFFFFFFFFFFFC200000 +%2FFFF9FFFFFFFFFFFFFFFFFD8FFFFFFFFFFFFFFFE30000 +%2FFFFFFFFDEFFFFFFFFFFFFFFFFFFEDFFFFFFFFFFE2000 +%2FFFFFF91007FFFFFFFFFFFFFFFB30018FFFFFFFFFC000 +%1FFFFF9000009FFFFFFFFFFFFFA0000008FFFFFFFFF500 +%1FFFFE1000002FFFFFFFFFFFFD00000001EFFFFFFFFC00 +%1FFFF90000000EFFFFFFFFFFF600000000AFFFFFFFFF10 +%1FFFF40000000AFFFFFFFFFFE0000000005FFFFFFFFF60 +%0FFFF200000008FFFFFFFFFFB0000000002FFFFFFFFF70 +%0FFFF000000007FFFFFFFFFF90000000001FFFFFFFFF90 +%0FFFE000000007FFFFFFFFFF70000000000EFFFFFFFF90 +%0EFFE000000007FFFFFFFFFF70000000000FFFFFFFFF70 +%0EFFE000000008FFFFFFFFFF70000000001FFFFFFFFF40 +%0EFFE00000000AFFFFFFFFFF70000000004FFFFFFFFE10 +%0EFFD00000000DFFFFFFFFFF70000000008FFFFFFFF800 +%0DFFD00000002FFFFFFFFFFF6000000000CFFFFFFFF200 +%0DFFD00000007FFFFFFFFFFF6000000004FFFFFFFF8000 +%0DFFD0000000DFFFFFFFFFFF600000000BFFFFFFFB0000 +%0DFFD0000005FFFFFFFDFFFF600000005FFFFFFFD20000 +%0CFFD000000CFFFFFFD2FFFF60000001EFFFFFFD200000 +%0CFFD000007FFFFFFD21FFFF7000001CFFFFFFD2000000 +%0CFFE00002FFFFFFD201FFFF800000BFFFFFFA10000000 +%0BFFE0000CFFFFFC1000FFFF900009FFFFFF6000000000 +%0BFFF0008FFFFFA10000FFFFA0008FFFFFD30000000000 +%0BFFF106FFFFF9000000FFFFB009FFFFF9100000000000 +%0BFFF25FFFFF60000000EFFFC1BFFFFE60000000000000 +%0AFFF8FFFFE400000000EFFFDCFFFFC200000000000000 +%0AFFFFFFFD3000000000EFFFFFFFF90000000000000000 +%0AFFFFFFC10000000000EFFFFFFE500000000000000000 +%0AFFFFFB000000000000DFFFFFC2000000000000000000 +%09FFFFD1000000000000DFFFFD10000000000000000000 +%06FFFE30000000000000AFFFE300000000000000000000 +%00AFD4000000000000002CFC3000000000000000000000 +%0000000000000000000000000000000000000000000000 +%%EndPreview +%%EndProlog +%%Page "accidentals.flatflat" 1 +gsave newpath + 187 44 moveto + 186 -25 lineto + 186 -36 lineto + 186 -58 188 -80 190 -102 curveto + 235 -65 279 -21 279 37 curveto + 279 71 267 106 238 106 curveto + 208 106 188 76 187 44 curveto + closepath + 17 44 moveto + 16 -25 lineto + 16 -36 lineto + 16 -59 17 -81 20 -104 curveto + 60 -66 92 -18 92 37 curveto + 92 70 86 106 58 106 curveto + 31 106 18 75 17 44 curveto + closepath + 149 -136 moveto + 147 -30 lineto + 119 -65 76 -93 42 -125 curveto + 30 -136 24 -157 7 -157 curveto + -5 -157 -14 -148 -14 -136 curveto + -25 463 lineto + -17 467 -9 470 0 470 curveto + 9 470 17 467 25 463 curveto + 19 114 lineto + 37 133 61 144 87 144 curveto + 109 144 129 135 144 121 curveto + 137 463 lineto + 145 467 153 470 162 470 curveto + 171 470 180 467 188 463 curveto + 181 114 lineto + 205 133 236 144 267 144 curveto + 321 144 362 99 362 45 curveto + 362 -37 272 -73 209 -125 curveto + 195 -136 188 -157 170 -157 curveto + 158 -157 149 -148 149 -136 curveto + closepath +fill grestore +%%EOF diff --git a/Resources/Music/doubleflatcursor.eps b/Resources/Music/doubleflatcursor.eps new file mode 100644 index 0000000..6c00af5 --- /dev/null +++ b/Resources/Music/doubleflatcursor.eps @@ -0,0 +1,126 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%BoundingBox: -25 -157 362 470 +%%Pages: 0 +%%Title: accidentals.flatflat from Emmentaler-26 +%%Creator: FontForge +%%Author: Matthias Neeracher +%%CreationDate: 5:16 28-8-2011 +%%EndComments +%%BeginPreview: 45 74 4 74 +%0000000000000000000000000000000000000000000000 +%6CEEC600000000000018DFEA3000000000000000000000 +%DFFFFD0000000000004FFFFF9000000000000000000000 +%DFFFFD0000000000003FFFFF9000000000000000000000 +%CFFFFC0000000000003FFFFF9000000000000000000000 +%CFFFFC0000000000003FFFFF8000000000000000000000 +%CFFFFC0000000000002FFFFF8000000000000000000000 +%CFFFFC0000000000002FFFFF8000000000000000000000 +%BFFFFB0000000000002FFFFF7000000000000000000000 +%BFFFFB0000000000001FFFFF7000000000000000000000 +%BFFFFB0000000000001FFFFF7000000000000000000000 +%AFFFFB0000000000001FFFFF6000000000000000000000 +%AFFFFA0000000000000FFFFF6000000000000000000000 +%AFFFFA0000000000000FFFFF6000000000000000000000 +%AFFFFA0000000000000FFFFF5000000000000000000000 +%9FFFFA0000000000000FFFFF5000000000000000000000 +%9FFFF90000000000000EFFFF5000000000000000000000 +%9FFFF90000000000000EFFFF5000000000000000000000 +%9FFFF90000000000000EFFFF4000000000000000000000 +%8FFFF90000000000000DFFFF4000000000000000000000 +%8FFFF80000000000000DFFFF4000000000000000000000 +%8FFFF80000000000000DFFFF3000000000000000000000 +%7FFFF80000000000000CFFFF3000000000000000000000 +%7FFFF80000000000000CFFFF3000000000000000000000 +%7FFFF70000000000000CFFFF2000000000000000000000 +%7FFFF70000000000000BFFFF2000000000000000000000 +%6FFFF70000000000000BFFFF2000000000000000000000 +%6FFFF60000000000000BFFFF2000000000000000000000 +%6FFFF60000000000000BFFFF1000000000000000000000 +%6FFFF60000000000000AFFFF1000000000000000000000 +%5FFFF60000000000000AFFFF1000000000000000000000 +%5FFFF50000000000000AFFFF0000000000000000000000 +%5FFFF500000000000009FFFF0000000000000000000000 +%4FFFF500000000000009FFFF0000000000000000000000 +%4FFFF500000000000009FFFE0000000000000000000000 +%4FFFF400000000000008FFFE0000000000000000000000 +%4FFFF400000000000008FFFE0000000000000000000000 +%3FFFF400000000000008FFFE0000000000000000000000 +%3FFFF400003688630007FFFD0000003578762000000000 +%3FFFF3018DFFFFFFD507FFFD0003AEFFFFFFFC60000000 +%2FFFF34DFFFFFFFFFFB8FFFD03CFFFFFFFFFFFFC200000 +%2FFFF9FFFFFFFFFFFFFFFFFD8FFFFFFFFFFFFFFFE30000 +%2FFFFFFFFDEFFFFFFFFFFFFFFFFFFEDFFFFFFFFFFE2000 +%2FFFFFF91007FFFFFFFFFFFFFFFB30018FFFFFFFFFC000 +%1FFFFF9000009FFFFFFFFFFFFFA0000008FFFFFFFFF500 +%1FFFFE1000002FFFFFFFFFFFFD00000001EFFFFFFFFC00 +%1FFFF90000000EFFFFFFFFFFF600000000AFFFFFFFFF10 +%1FFFF40000000AFFFFFFFFFFE0000000005FFFFFFFFF60 +%0FFFF200000008FFFFFFFFFFB0000000002FFFFFFFFF70 +%0FFFF000000007FFFFFFFFFF90000000001FFFFFFFFF90 +%0FFFE000000007FFFFFFFFFF70000000000EFFFFFFFF90 +%0EFFE000000007FFFFFFFFFF70000000000FFFFFFFFF70 +%0EFFE000000008FFFFFFFFFF70000000001FFFFFFFFF40 +%0EFFE00000000AFFFFFFFFFF70000000004FFFFFFFFE10 +%0EFFD00000000DFFFFFFFFFF70000000008FFFFFFFF800 +%0DFFD00000002FFFFFFFFFFF6000000000CFFFFFFFF200 +%0DFFD00000007FFFFFFFFFFF6000000004FFFFFFFF8000 +%0DFFD0000000DFFFFFFFFFFF600000000BFFFFFFFB0000 +%0DFFD0000005FFFFFFFDFFFF600000005FFFFFFFD20000 +%0CFFD000000CFFFFFFD2FFFF60000001EFFFFFFD200000 +%0CFFD000007FFFFFFD21FFFF7000001CFFFFFFD2000000 +%0CFFE00002FFFFFFD201FFFF800000BFFFFFFA10000000 +%0BFFE0000CFFFFFC1000FFFF900009FFFFFF6000000000 +%0BFFF0008FFFFFA10000FFFFA0008FFFFFD30000000000 +%0BFFF106FFFFF9000000FFFFB009FFFFF9100000000000 +%0BFFF25FFFFF60000000EFFFC1BFFFFE60000000000000 +%0AFFF8FFFFE400000000EFFFDCFFFFC200000000000000 +%0AFFFFFFFD3000000000EFFFFFFFF90000000000000000 +%0AFFFFFFC10000000000EFFFFFFE500000000000000000 +%0AFFFFFB000000000000DFFFFFC2000000000000000000 +%09FFFFD1000000000000DFFFFD10000000000000000000 +%06FFFE30000000000000AFFFE300000000000000000000 +%00AFD4000000000000002CFC3000000000000000000000 +%0000000000000000000000000000000000000000000000 +%%EndPreview +%%EndProlog +%%Page "accidentals.flatflat" 1 +gsave newpath + 187 44 moveto + 186 -25 lineto + 186 -36 lineto + 186 -58 188 -80 190 -102 curveto + 235 -65 279 -21 279 37 curveto + 279 71 267 106 238 106 curveto + 208 106 188 76 187 44 curveto + closepath + 17 44 moveto + 16 -25 lineto + 16 -36 lineto + 16 -59 17 -81 20 -104 curveto + 60 -66 92 -18 92 37 curveto + 92 70 86 106 58 106 curveto + 31 106 18 75 17 44 curveto + closepath + 149 -136 moveto + 147 -30 lineto + 119 -65 76 -93 42 -125 curveto + 30 -136 24 -157 7 -157 curveto + -5 -157 -14 -148 -14 -136 curveto + -25 463 lineto + -17 467 -9 470 0 470 curveto + 9 470 17 467 25 463 curveto + 19 114 lineto + 37 133 61 144 87 144 curveto + 109 144 129 135 144 121 curveto + 137 463 lineto + 145 467 153 470 162 470 curveto + 171 470 180 467 188 463 curveto + 181 114 lineto + 205 133 236 144 267 144 curveto + 321 144 362 99 362 45 curveto + 362 -37 272 -73 209 -125 curveto + 195 -136 188 -157 170 -157 curveto + 158 -157 149 -148 149 -136 curveto + closepath +1 0 0 setrgbcolor fill grestore +%%EOF diff --git a/Resources/Music/doublesharp.eps b/Resources/Music/doublesharp.eps new file mode 100644 index 0000000..0f50355 --- /dev/null +++ b/Resources/Music/doublesharp.eps @@ -0,0 +1,123 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%BoundingBox: -8 -133 258 133 +%%Pages: 0 +%%Title: accidentals.doublesharp from Emmentaler-26 +%%Creator: FontForge +%%Author: Matthias Neeracher +%%CreationDate: 5:16 28-8-2011 +%%EndComments +%%BeginPreview: 73 74 4 74 +%00000000000000000000000000000000000000000000000000000000000000000000000000 +%06EFDCA976431000000000000000000000000000000000000000000000000235689BCEFE30 +%1FFFFFFFFFFFFFDCA9764310000000000000000000000000000235689BCEFFFFFFFFFFFFC0 +%2FFFFFFFFFFFFFFFFFFFFFFFDCA81000000000000000039ACEFFFFFFFFFFFFFFFFFFFFFFD0 +%1FFFFFFFFFFFFFFFFFFFFFFFFFFFD0000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFC0 +%0EFFFFFFFFFFFFFFFFFFFFFFFFFFF4000000000000008FFFFFFFFFFFFFFFFFFFFFFFFFFFA0 +%0DFFFFFFFFFFFFFFFFFFFFFFFFFFF5000000000000009FFFFFFFFFFFFFFFFFFFFFFFFFFF90 +%0BFFFFFFFFFFFFFFFFFFFFFFFFFFF6000000000000009FFFFFFFFFFFFFFFFFFFFFFFFFFF70 +%09FFFFFFFFFFFFFFFFFFFFFFFFFFF600000000000000AFFFFFFFFFFFFFFFFFFFFFFFFFFF60 +%08FFFFFFFFFFFFFFFFFFFFFFFFFFF700000000000000BFFFFFFFFFFFFFFFFFFFFFFFFFFF40 +%06FFFFFFFFFFFFFFFFFFFFFFFFFFF800000000000000BFFFFFFFFFFFFFFFFFFFFFFFFFFF30 +%05FFFFFFFFFFFFFFFFFFFFFFFFFFF800000000000000CFFFFFFFFFFFFFFFFFFFFFFFFFFF10 +%03FFFFFFFFFFFFFFFFFFFFFFFFFFF900000000000000DFFFFFFFFFFFFFFFFFFFFFFFFFFF00 +%02FFFFFFFFFFFFFFFFFFFFFFFFFFFB00000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFD00 +%00FFFFFFFFFFFFFFFFFFFFFFFFFFFD00000000000002FFFFFFFFFFFFFFFFFFFFFFFFFFFC00 +%00EFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000004FFFFFFFFFFFFFFFFFFFFFFFFFFFA00 +%00CFFFFFFFFFFFFFFFFFFFFFFFFFFF30000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFF900 +%00BFFFFFFFFFFFFFFFFFFFFFFFFFFF6000000000000AFFFFFFFFFFFFFFFFFFFFFFFFFFF700 +%009FFFFFFFFFFFFFFFFFFFFFFFFFFFA000000000000EFFFFFFFFFFFFFFFFFFFFFFFFFFF600 +%008FFFFFFFFFFFFFFFFFFFFFFFFFFFE000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFF400 +%006FFFFFFFFFFFFFFFFFFFFFFFFFFFF400000000008FFFFFFFFFFFFFFFFFFFFFFFFFFFF200 +%005FFFFFFFFFFFFFFFFFFFFFFFFFFFF80000000000CFFFFFFFFFFFFFFFFFFFFFFFFFFFF100 +%003FFFFFFFFFFFFFFFFFFFFFFFFFFFFE0000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFE000 +%002FFFFFFFFFFFFFFFFFFFFFFFFFFFFF600000000AFFFFFFFFFFFFFFFFFFFFFFFFFFFFD000 +%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000002FFFFFFFFFFFFFFFFFFFFFFFFFFFFFB000 +%000EFFFFFFFFFFFFFFFFFFFFFFFFFFFFF50000009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFA000 +%000CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE100004FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000 +%000AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6000 +%0003EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF600AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD1000 +%0000267889AABEFFFFFFFFFFFFFFFFFFFFFF48FFFFFFFFFFFFFFFFFFFFFFDBA99877510000 +%000000000000001369CFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFB852000000000000000 +%000000000000000000026BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEA510000000000000000000 +%000000000000000000000029EFFFFFFFFFFFFFFFFFFFFFFFFD710000000000000000000000 +%00000000000000000000000019FFFFFFFFFFFFFFFFFFFFFE60000000000000000000000000 +%000000000000000000000000003CFFFFFFFFFFFFFFFFFFA100000000000000000000000000 +%0000000000000000000000000000AFFFFFFFFFFFFFFFF60000000000000000000000000000 +%000000000000000000000000000007FFFFFFFFFFFFFE400000000000000000000000000000 +%000000000000000000000000000007FFFFFFFFFFFFFE400000000000000000000000000000 +%0000000000000000000000000000AFFFFFFFFFFFFFFFF60000000000000000000000000000 +%000000000000000000000000003CFFFFFFFFFFFFFFFFFFA100000000000000000000000000 +%00000000000000000000000019FFFFFFFFFFFFFFFFFFFFFE60000000000000000000000000 +%000000000000000000000029EFFFFFFFFFFFFFFFFFFFFFFFFD710000000000000000000000 +%000000000000000000016BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEA510000000000000000000 +%000000000000000269CFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFB852000000000000000 +%0000267789AABDFFFFFFFFFFFFFFFFFFFFFF48FFFFFFFFFFFFFFFFFFFFFFDBA99877510000 +%0003EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF600AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD1000 +%000AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6000 +%000CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE100004FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000 +%000EFFFFFFFFFFFFFFFFFFFFFFFFFFFFF60000009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFA000 +%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000002FFFFFFFFFFFFFFFFFFFFFFFFFFFFFB000 +%002FFFFFFFFFFFFFFFFFFFFFFFFFFFFF600000000AFFFFFFFFFFFFFFFFFFFFFFFFFFFFD000 +%003FFFFFFFFFFFFFFFFFFFFFFFFFFFFE0000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFE000 +%005FFFFFFFFFFFFFFFFFFFFFFFFFFFF80000000000CFFFFFFFFFFFFFFFFFFFFFFFFFFFF100 +%006FFFFFFFFFFFFFFFFFFFFFFFFFFFF400000000008FFFFFFFFFFFFFFFFFFFFFFFFFFFF200 +%008FFFFFFFFFFFFFFFFFFFFFFFFFFFE000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFF400 +%009FFFFFFFFFFFFFFFFFFFFFFFFFFFA000000000000EFFFFFFFFFFFFFFFFFFFFFFFFFFF600 +%00BFFFFFFFFFFFFFFFFFFFFFFFFFFF7000000000000AFFFFFFFFFFFFFFFFFFFFFFFFFFF700 +%00CFFFFFFFFFFFFFFFFFFFFFFFFFFF30000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFF900 +%00EFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000004FFFFFFFFFFFFFFFFFFFFFFFFFFFA00 +%00FFFFFFFFFFFFFFFFFFFFFFFFFFFD00000000000002FFFFFFFFFFFFFFFFFFFFFFFFFFFC00 +%02FFFFFFFFFFFFFFFFFFFFFFFFFFFB00000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFD00 +%03FFFFFFFFFFFFFFFFFFFFFFFFFFF900000000000000DFFFFFFFFFFFFFFFFFFFFFFFFFFF00 +%05FFFFFFFFFFFFFFFFFFFFFFFFFFF800000000000000CFFFFFFFFFFFFFFFFFFFFFFFFFFF10 +%06FFFFFFFFFFFFFFFFFFFFFFFFFFF800000000000000BFFFFFFFFFFFFFFFFFFFFFFFFFFF30 +%08FFFFFFFFFFFFFFFFFFFFFFFFFFF700000000000000BFFFFFFFFFFFFFFFFFFFFFFFFFFF40 +%09FFFFFFFFFFFFFFFFFFFFFFFFFFF600000000000000AFFFFFFFFFFFFFFFFFFFFFFFFFFF60 +%0BFFFFFFFFFFFFFFFFFFFFFFFFFFF6000000000000009FFFFFFFFFFFFFFFFFFFFFFFFFFF70 +%0DFFFFFFFFFFFFFFFFFFFFFFFFFFF5000000000000009FFFFFFFFFFFFFFFFFFFFFFFFFFF90 +%0EFFFFFFFFFFFFFFFFFFFFFFFFFFF4000000000000008FFFFFFFFFFFFFFFFFFFFFFFFFFFA0 +%1FFFFFFFFFFFFFFFFFFFFFFFFFFFD0000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFC0 +%2FFFFFFFFFFFFFFFFFFFFFFFDCA81000000000000000039BCEFFFFFFFFFFFFFFFFFFFFFFD0 +%1FFFFFFFFFFFFFDCA9764310000000000000000000000000000235689BCEFFFFFFFFFFFFC0 +%06FFECA976431000000000000000000000000000000000000000000000000235689BCEFE40 +%00000000000000000000000000000000000000000000000000000000000000000000000000 +%%EndPreview +%%EndProlog +%%Page "accidentals.doublesharp" 1 +gsave newpath + 150 0 moveto + 173 -23 208 -28 241 -28 curveto + 245 -28 249 -32 249 -36 curveto + 258 -125 lineto + 258 -129 255 -133 251 -133 curveto + 250 -133 lineto + 161 -124 lineto + 157 -124 153 -120 153 -116 curveto + 153 -83 148 -48 125 -25 curveto + 102 -48 97 -83 97 -116 curveto + 97 -120 93 -124 89 -124 curveto + 0 -133 lineto + -1 -133 lineto + -5 -133 -8 -129 -8 -125 curveto + 1 -36 lineto + 1 -32 5 -28 9 -28 curveto + 42 -28 77 -23 100 0 curveto + 77 23 42 28 9 28 curveto + 5 28 1 32 1 36 curveto + -8 125 lineto + -8 129 -5 133 -1 133 curveto + 0 133 lineto + 89 124 lineto + 93 124 97 120 97 116 curveto + 97 83 102 48 125 25 curveto + 148 48 153 83 153 116 curveto + 153 120 157 124 161 124 curveto + 250 133 lineto + 251 133 lineto + 255 133 258 129 258 125 curveto + 249 36 lineto + 249 32 245 28 241 28 curveto + 208 28 173 23 150 0 curveto + closepath +fill grestore +%%EOF diff --git a/Resources/Music/doublesharpcursor.eps b/Resources/Music/doublesharpcursor.eps new file mode 100644 index 0000000..ada235e --- /dev/null +++ b/Resources/Music/doublesharpcursor.eps @@ -0,0 +1,123 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%BoundingBox: -8 -133 258 133 +%%Pages: 0 +%%Title: accidentals.doublesharp from Emmentaler-26 +%%Creator: FontForge +%%Author: Matthias Neeracher +%%CreationDate: 5:16 28-8-2011 +%%EndComments +%%BeginPreview: 73 74 4 74 +%00000000000000000000000000000000000000000000000000000000000000000000000000 +%06EFDCA976431000000000000000000000000000000000000000000000000235689BCEFE30 +%1FFFFFFFFFFFFFDCA9764310000000000000000000000000000235689BCEFFFFFFFFFFFFC0 +%2FFFFFFFFFFFFFFFFFFFFFFFDCA81000000000000000039ACEFFFFFFFFFFFFFFFFFFFFFFD0 +%1FFFFFFFFFFFFFFFFFFFFFFFFFFFD0000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFC0 +%0EFFFFFFFFFFFFFFFFFFFFFFFFFFF4000000000000008FFFFFFFFFFFFFFFFFFFFFFFFFFFA0 +%0DFFFFFFFFFFFFFFFFFFFFFFFFFFF5000000000000009FFFFFFFFFFFFFFFFFFFFFFFFFFF90 +%0BFFFFFFFFFFFFFFFFFFFFFFFFFFF6000000000000009FFFFFFFFFFFFFFFFFFFFFFFFFFF70 +%09FFFFFFFFFFFFFFFFFFFFFFFFFFF600000000000000AFFFFFFFFFFFFFFFFFFFFFFFFFFF60 +%08FFFFFFFFFFFFFFFFFFFFFFFFFFF700000000000000BFFFFFFFFFFFFFFFFFFFFFFFFFFF40 +%06FFFFFFFFFFFFFFFFFFFFFFFFFFF800000000000000BFFFFFFFFFFFFFFFFFFFFFFFFFFF30 +%05FFFFFFFFFFFFFFFFFFFFFFFFFFF800000000000000CFFFFFFFFFFFFFFFFFFFFFFFFFFF10 +%03FFFFFFFFFFFFFFFFFFFFFFFFFFF900000000000000DFFFFFFFFFFFFFFFFFFFFFFFFFFF00 +%02FFFFFFFFFFFFFFFFFFFFFFFFFFFB00000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFD00 +%00FFFFFFFFFFFFFFFFFFFFFFFFFFFD00000000000002FFFFFFFFFFFFFFFFFFFFFFFFFFFC00 +%00EFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000004FFFFFFFFFFFFFFFFFFFFFFFFFFFA00 +%00CFFFFFFFFFFFFFFFFFFFFFFFFFFF30000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFF900 +%00BFFFFFFFFFFFFFFFFFFFFFFFFFFF6000000000000AFFFFFFFFFFFFFFFFFFFFFFFFFFF700 +%009FFFFFFFFFFFFFFFFFFFFFFFFFFFA000000000000EFFFFFFFFFFFFFFFFFFFFFFFFFFF600 +%008FFFFFFFFFFFFFFFFFFFFFFFFFFFE000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFF400 +%006FFFFFFFFFFFFFFFFFFFFFFFFFFFF400000000008FFFFFFFFFFFFFFFFFFFFFFFFFFFF200 +%005FFFFFFFFFFFFFFFFFFFFFFFFFFFF80000000000CFFFFFFFFFFFFFFFFFFFFFFFFFFFF100 +%003FFFFFFFFFFFFFFFFFFFFFFFFFFFFE0000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFE000 +%002FFFFFFFFFFFFFFFFFFFFFFFFFFFFF600000000AFFFFFFFFFFFFFFFFFFFFFFFFFFFFD000 +%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000002FFFFFFFFFFFFFFFFFFFFFFFFFFFFFB000 +%000EFFFFFFFFFFFFFFFFFFFFFFFFFFFFF50000009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFA000 +%000CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE100004FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000 +%000AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6000 +%0003EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF600AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD1000 +%0000267889AABEFFFFFFFFFFFFFFFFFFFFFF48FFFFFFFFFFFFFFFFFFFFFFDBA99877510000 +%000000000000001369CFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFB852000000000000000 +%000000000000000000026BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEA510000000000000000000 +%000000000000000000000029EFFFFFFFFFFFFFFFFFFFFFFFFD710000000000000000000000 +%00000000000000000000000019FFFFFFFFFFFFFFFFFFFFFE60000000000000000000000000 +%000000000000000000000000003CFFFFFFFFFFFFFFFFFFA100000000000000000000000000 +%0000000000000000000000000000AFFFFFFFFFFFFFFFF60000000000000000000000000000 +%000000000000000000000000000007FFFFFFFFFFFFFE400000000000000000000000000000 +%000000000000000000000000000007FFFFFFFFFFFFFE400000000000000000000000000000 +%0000000000000000000000000000AFFFFFFFFFFFFFFFF60000000000000000000000000000 +%000000000000000000000000003CFFFFFFFFFFFFFFFFFFA100000000000000000000000000 +%00000000000000000000000019FFFFFFFFFFFFFFFFFFFFFE60000000000000000000000000 +%000000000000000000000029EFFFFFFFFFFFFFFFFFFFFFFFFD710000000000000000000000 +%000000000000000000016BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEA510000000000000000000 +%000000000000000269CFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFB852000000000000000 +%0000267789AABDFFFFFFFFFFFFFFFFFFFFFF48FFFFFFFFFFFFFFFFFFFFFFDBA99877510000 +%0003EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF600AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD1000 +%000AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6000 +%000CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE100004FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000 +%000EFFFFFFFFFFFFFFFFFFFFFFFFFFFFF60000009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFA000 +%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000002FFFFFFFFFFFFFFFFFFFFFFFFFFFFFB000 +%002FFFFFFFFFFFFFFFFFFFFFFFFFFFFF600000000AFFFFFFFFFFFFFFFFFFFFFFFFFFFFD000 +%003FFFFFFFFFFFFFFFFFFFFFFFFFFFFE0000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFE000 +%005FFFFFFFFFFFFFFFFFFFFFFFFFFFF80000000000CFFFFFFFFFFFFFFFFFFFFFFFFFFFF100 +%006FFFFFFFFFFFFFFFFFFFFFFFFFFFF400000000008FFFFFFFFFFFFFFFFFFFFFFFFFFFF200 +%008FFFFFFFFFFFFFFFFFFFFFFFFFFFE000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFF400 +%009FFFFFFFFFFFFFFFFFFFFFFFFFFFA000000000000EFFFFFFFFFFFFFFFFFFFFFFFFFFF600 +%00BFFFFFFFFFFFFFFFFFFFFFFFFFFF7000000000000AFFFFFFFFFFFFFFFFFFFFFFFFFFF700 +%00CFFFFFFFFFFFFFFFFFFFFFFFFFFF30000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFF900 +%00EFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000004FFFFFFFFFFFFFFFFFFFFFFFFFFFA00 +%00FFFFFFFFFFFFFFFFFFFFFFFFFFFD00000000000002FFFFFFFFFFFFFFFFFFFFFFFFFFFC00 +%02FFFFFFFFFFFFFFFFFFFFFFFFFFFB00000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFD00 +%03FFFFFFFFFFFFFFFFFFFFFFFFFFF900000000000000DFFFFFFFFFFFFFFFFFFFFFFFFFFF00 +%05FFFFFFFFFFFFFFFFFFFFFFFFFFF800000000000000CFFFFFFFFFFFFFFFFFFFFFFFFFFF10 +%06FFFFFFFFFFFFFFFFFFFFFFFFFFF800000000000000BFFFFFFFFFFFFFFFFFFFFFFFFFFF30 +%08FFFFFFFFFFFFFFFFFFFFFFFFFFF700000000000000BFFFFFFFFFFFFFFFFFFFFFFFFFFF40 +%09FFFFFFFFFFFFFFFFFFFFFFFFFFF600000000000000AFFFFFFFFFFFFFFFFFFFFFFFFFFF60 +%0BFFFFFFFFFFFFFFFFFFFFFFFFFFF6000000000000009FFFFFFFFFFFFFFFFFFFFFFFFFFF70 +%0DFFFFFFFFFFFFFFFFFFFFFFFFFFF5000000000000009FFFFFFFFFFFFFFFFFFFFFFFFFFF90 +%0EFFFFFFFFFFFFFFFFFFFFFFFFFFF4000000000000008FFFFFFFFFFFFFFFFFFFFFFFFFFFA0 +%1FFFFFFFFFFFFFFFFFFFFFFFFFFFD0000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFC0 +%2FFFFFFFFFFFFFFFFFFFFFFFDCA81000000000000000039BCEFFFFFFFFFFFFFFFFFFFFFFD0 +%1FFFFFFFFFFFFFDCA9764310000000000000000000000000000235689BCEFFFFFFFFFFFFC0 +%06FFECA976431000000000000000000000000000000000000000000000000235689BCEFE40 +%00000000000000000000000000000000000000000000000000000000000000000000000000 +%%EndPreview +%%EndProlog +%%Page "accidentals.doublesharp" 1 +gsave newpath + 150 0 moveto + 173 -23 208 -28 241 -28 curveto + 245 -28 249 -32 249 -36 curveto + 258 -125 lineto + 258 -129 255 -133 251 -133 curveto + 250 -133 lineto + 161 -124 lineto + 157 -124 153 -120 153 -116 curveto + 153 -83 148 -48 125 -25 curveto + 102 -48 97 -83 97 -116 curveto + 97 -120 93 -124 89 -124 curveto + 0 -133 lineto + -1 -133 lineto + -5 -133 -8 -129 -8 -125 curveto + 1 -36 lineto + 1 -32 5 -28 9 -28 curveto + 42 -28 77 -23 100 0 curveto + 77 23 42 28 9 28 curveto + 5 28 1 32 1 36 curveto + -8 125 lineto + -8 129 -5 133 -1 133 curveto + 0 133 lineto + 89 124 lineto + 93 124 97 120 97 116 curveto + 97 83 102 48 125 25 curveto + 148 48 153 83 153 116 curveto + 153 120 157 124 161 124 curveto + 250 133 lineto + 251 133 lineto + 255 133 258 129 258 125 curveto + 249 36 lineto + 249 32 245 28 241 28 curveto + 208 28 173 23 150 0 curveto + closepath +1 0 0 setrgbcolor fill grestore +%%EOF diff --git a/Sources/VLPitchGrid.cpp b/Sources/VLPitchGrid.cpp index 157c2a6..5dae8fc 100644 --- a/Sources/VLPitchGrid.cpp +++ b/Sources/VLPitchGrid.cpp @@ -53,6 +53,16 @@ static inline bool HasSharp(int semi, int key) return sSharps[key-1] & (1<<(semi+2)); } +uint16_t VLVisualInKey(int8_t pitch, int key) +{ + if (key < 0 && HasFlat(pitch % 12, key)) + return VLNote::kWantFlat; + else if (key > 0 && HasSharp(pitch % 12, key)) + return VLNote::kWantSharp; + else + return 0; +} + static inline int8_t SemiToStep(int semi) { static const int8_t sSteps[] = diff --git a/Sources/VLPitchGrid.h b/Sources/VLPitchGrid.h index a96d1be..e7a94d8 100644 --- a/Sources/VLPitchGrid.h +++ b/Sources/VLPitchGrid.h @@ -10,6 +10,11 @@ #include +// +// Inquire about accidentals +// +uint16_t VLVisualInKey(int8_t pitch, int key); + // // Grid position is defined from middle C // diff --git a/Sources/VLSheetView.h b/Sources/VLSheetView.h index e204f9f..3074320 100644 --- a/Sources/VLSheetView.h +++ b/Sources/VLSheetView.h @@ -22,6 +22,8 @@ enum VLMusicElement { kMusicFlat, kMusicSharp, kMusicNatural, + kMusic2Flat, + kMusic2Sharp, kMusicWholeNote, kMusicHalfNote, kMusicNote, @@ -38,6 +40,8 @@ enum VLMusicElement { kMusicFlatCursor, kMusicSharpCursor, kMusicNaturalCursor, + kMusic2FlatCursor, + kMusic2SharpCursor, kMusicRestCursor, kMusicKillCursor, kMusicExtendCursor, diff --git a/Sources/VLSheetView.mm b/Sources/VLSheetView.mm index 53891d5..d71443b 100644 --- a/Sources/VLSheetView.mm +++ b/Sources/VLSheetView.mm @@ -30,6 +30,8 @@ static NSString * sElementNames[kMusicElements] = { @"flat", @"sharp", @"natural", + @"doubleflat", + @"doublesharp", @"whole-notehead", @"half-notehead", @"notehead", @@ -46,6 +48,8 @@ static NSString * sElementNames[kMusicElements] = { @"flatcursor", @"sharpcursor", @"naturalcursor", + @"doubleflatcursor", + @"doublesharpcursor", @"restcursor", @"killcursor", @"extendcursor", @@ -169,11 +173,13 @@ static float sFlatPos[] = { { switch (visual & VLNote::kAccidentalsMask) { case VLNote::kWantSharp: - case VLNote::kWant2Sharp: // TODO return kMusicSharp; case VLNote::kWantFlat: - case VLNote::kWant2Flat: // TODO return kMusicFlat; + case VLNote::kWant2Sharp: + return kMusic2Sharp; + case VLNote::kWant2Flat: + return kMusic2Flat; case VLNote::kWantNatural: return kMusicNatural; default: @@ -725,7 +731,7 @@ static int8_t sSharpAcc[] = { // // Extension // - if ([event modifierFlags] & NSShiftKeyMask) { + if (([event modifierFlags] & (NSShiftKeyMask|NSAlternateKeyMask|NSCommandKeyMask))==NSShiftKeyMask) { fCursorAccidental = kMusicExtendCursor; return; } @@ -734,66 +740,38 @@ static int8_t sSharpAcc[] = { const VLProperties & prop = [self song]->fProperties[cursorSection]; - if (prop.fKey >= 0) { - if (prop.fKey >= sSharpAcc[fCursorPitch % 12]) { // Sharp in Key - switch ([event modifierFlags] & (NSAlternateKeyMask|NSCommandKeyMask)) { - case NSAlternateKeyMask: - fCursorAccidental = kMusicFlatCursor; // G# -> Gb - fCursorActualPitch = fCursorPitch-1; - break; - case NSCommandKeyMask: - fCursorAccidental = kMusicSharpCursor; - // Fall through - default: - fCursorActualPitch = fCursorPitch+1; - break; // G# -> G# - case NSAlternateKeyMask|NSCommandKeyMask: - fCursorAccidental = kMusicNaturalCursor; // G# -> G - fCursorActualPitch = fCursorPitch; - break; - } - return; - } - } else { - if (prop.fKey <= -sFlatAcc[fCursorPitch % 12]) { // Flat in Key - switch ([event modifierFlags] & (NSAlternateKeyMask|NSCommandKeyMask)) { - case NSAlternateKeyMask: - fCursorAccidental = kMusicFlatCursor; - // Fall through - default: - fCursorActualPitch = fCursorPitch-1; - break; // Gb -> Gb - case NSCommandKeyMask: - fCursorAccidental = kMusicSharpCursor; // Gb -> G# - fCursorActualPitch = fCursorPitch+1; - break; - case NSAlternateKeyMask|NSCommandKeyMask: - fCursorAccidental = kMusicNaturalCursor; // Gb -> G - fCursorActualPitch = fCursorPitch; - break; - } - return; - } - } - // - // Natural - // - switch ([event modifierFlags] & (NSAlternateKeyMask|NSCommandKeyMask)) { - case NSAlternateKeyMask: - fCursorAccidental = kMusicFlatCursor; // G -> Gb - fCursorActualPitch = fCursorPitch-1; - break; - case NSCommandKeyMask: - fCursorAccidental = kMusicSharpCursor; // G -> G# - fCursorActualPitch = fCursorPitch+1; - break; + switch ([event modifierFlags] & (NSShiftKeyMask|NSAlternateKeyMask|NSCommandKeyMask)) { + case NSShiftKeyMask|NSAlternateKeyMask: + fCursorAccidental = kMusic2FlatCursor; // Gbb + fCursorActualPitch = fCursorPitch-2; + break; + case NSAlternateKeyMask: + fCursorAccidental = kMusicFlatCursor; // Gb + fCursorActualPitch = fCursorPitch-1; + break; + case NSShiftKeyMask|NSCommandKeyMask: + fCursorAccidental = kMusic2SharpCursor; // G## + fCursorActualPitch = fCursorPitch+2; + break; + case NSCommandKeyMask: + fCursorAccidental = kMusicSharpCursor; // G# + fCursorActualPitch = fCursorPitch+1; + break; case NSAlternateKeyMask|NSCommandKeyMask: - fCursorAccidental = kMusicNaturalCursor; - // Fall through - default: - fCursorActualPitch = fCursorPitch; - break; // G -> G - } + fCursorAccidental = kMusicNaturalCursor; // G + fCursorActualPitch = fCursorPitch; + break; + default: + switch (VLVisualInKey(fCursorPitch, prop.fKey)) { + case VLNote::kWantFlat: + fCursorActualPitch = fCursorPitch-1; + case VLNote::kWantSharp: + fCursorActualPitch = fCursorPitch+1; + default: + fCursorActualPitch = fCursorPitch; + } + break; + } } - (VLRegion) findRegionForEvent:(NSEvent *) event diff --git a/Sources/VLSheetViewInternal.h b/Sources/VLSheetViewInternal.h index be7b5ef..5babf0f 100644 --- a/Sources/VLSheetViewInternal.h +++ b/Sources/VLSheetViewInternal.h @@ -5,7 +5,7 @@ // // (MN) Matthias Neeracher // -// Copyright © 2006-2007 Matthias Neeracher +// Copyright © 2006-2011 Matthias Neeracher // const float kLineX = 5.0; @@ -28,9 +28,13 @@ const float kAccW = 10.0f; const float kSharpY =-15.0f; const float kFlatY = -7.0f; const float kNaturalY =-15.0f; +const float k2SharpY = -5.0f; +const float k2FlatY = -7.0f; const float kSharpW =-11.0f; const float kFlatW = -9.0f; const float kNaturalW = -7.0f; +const float k2SharpW =-11.0f; +const float k2FlatW =-11.0f; const float kImgScale = 0.04f; #define kChordY ((fNumTopLedgers+6)*kLineH) const float kChordW = 40.0f; diff --git a/Sources/VLSheetViewNotes.mm b/Sources/VLSheetViewNotes.mm index 77b65d4..f2b4c3a 100644 --- a/Sources/VLSheetViewNotes.mm +++ b/Sources/VLSheetViewNotes.mm @@ -30,8 +30,16 @@ case kMusicSharpCursor: newNote.fVisual |= VLNote::kWantSharp; break; + case kMusic2FlatCursor: + newNote.fVisual |= VLNote::kWant2Flat; + break; + case kMusic2SharpCursor: + newNote.fVisual |= VLNote::kWant2Sharp; + break; case kMusicNaturalCursor: newNote.fVisual |= VLNote::kWantNatural; + break; + default: break; } [[self document] willChangeSong]; @@ -88,33 +96,21 @@ int cursorX; int cursorY; int cursorSect; - uint16_t cursorVisual = 0; VLMusicElement cursorElt; cursorX = [self noteXInMeasure:measure at:at]; if (accidental == kMusicExtendCursor) { cursorY = [self noteYInMeasure:measure withPitch:pitch]; cursorElt = accidental; - } else + } else { + uint16_t visual = 0; switch (mode) { default: - switch (accidental) { - case kMusicSharp: - cursorVisual = VLNote::kWantSharp; - break; - case kMusicFlat: - cursorVisual = VLNote::kWantFlat; - break; - default: - break; - } - cursorY = - [self noteYInMeasure:measure withPitch:pitch - visual:&cursorVisual] - kNoteY; + cursorY = [self noteYInMeasure:measure withPitch:pitch visual:&visual] - kNoteY; cursorSect = [self song]->fMeasures[measure].fPropIdx; [self drawLedgerLinesInSection:cursorSect withPitch:pitch - visual:cursorVisual at:NSMakePoint(cursorX, - [self systemY:fLayout->SystemForMeasure(measure)])]; + visual:visual at:NSMakePoint(cursorX, + [self systemY:fLayout->SystemForMeasure(measure)])]; cursorElt = kMusicNoteCursor; break; case 'r': @@ -126,12 +122,13 @@ cursorElt = kMusicKillCursor; break; } + } NSPoint xy = NSMakePoint(cursorX-kNoteX, cursorY); [[self musicElement:cursorElt] compositeToPoint:xy operation: NSCompositeSourceOver]; - if (accidental && accidental != kMusicExtendCursor) { + if (mode && accidental && accidental != kMusicExtendCursor) { xy.y += kNoteY; switch (cursorElt= accidental) { case kMusicFlatCursor: @@ -142,6 +139,14 @@ xy.x += kSharpW; xy.y += kSharpY; break; + case kMusic2FlatCursor: + xy.x += k2FlatW; + xy.y += k2FlatY; + break; + case kMusic2SharpCursor: + xy.x += k2SharpW; + xy.y += k2SharpY; + break; default: xy.x += kNaturalW; xy.y += kNaturalY; @@ -156,8 +161,7 @@ - (void) drawNoteCursor:(int)pitch inMeasure:(size_t)measure at:(VLFract)at accidental:(VLMusicElement)accidental { - [self drawNoteCursor:pitch inMeasure:measure at:at - accidental:accidental mode:' ']; + [self drawNoteCursor:pitch inMeasure:measure at:at accidental:accidental mode:0]; } - (void) drawNoteCursor @@ -209,6 +213,14 @@ at.x += kFlatW; at.y += kFlatY; break; + case kMusic2Sharp: + at.x += k2SharpW; + at.y += k2SharpY; + break; + case kMusic2Flat: + at.x += k2FlatW; + at.y += k2FlatY; + break; case kMusicNatural: at.x += kNaturalW; at.y += kNaturalY; diff --git a/Sources/VLSheetViewSelection.mm b/Sources/VLSheetViewSelection.mm index 54c27bc..0d3deb8 100644 --- a/Sources/VLSheetViewSelection.mm +++ b/Sources/VLSheetViewSelection.mm @@ -51,8 +51,26 @@ VLMIDIUserEvent * event = (VLMIDIUserEvent *)[ev pointerValue]; if (event->fPitch) { fNotePitch = event->fPitch; - fNoteAccidental = (event->fVisual & VLNote::kWantFlat) ? kMusicFlat - : ((event->fVisual & VLNote::kWantSharp) ? kMusicSharp : kMusicNothing); + fNoteAccidental = kMusicNothing; + switch (event->fVisual & VLNote::kAccidentalsMask) { + case VLNote::kWantFlat: + fNoteAccidental = kMusicFlatCursor; + break; + case VLNote::kWantSharp: + fNoteAccidental = kMusicSharpCursor; + break; + case VLNote::kWant2Flat: + fNoteAccidental = kMusic2FlatCursor; + break; + case VLNote::kWant2Sharp: + fNoteAccidental = kMusic2SharpCursor; + break; + case VLNote::kWantNatural: + fNoteAccidental = kMusicNaturalCursor; + break; + default: + break; + } fNoteMeasure = event->fMeasure; fNoteAt = event->fAt; fStanza = event->fStanza;