From 6f67b7df9e9ca408e23af8ed3d1356016a7c53e7 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sun, 29 Oct 2006 07:48:39 +0000 Subject: [PATCH] Fix chord editing display --- Sources/VLModel.cpp | 5 +++-- Sources/VLSheetViewChords.mm | 15 ++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Sources/VLModel.cpp b/Sources/VLModel.cpp index aaa11e3..d56b551 100644 --- a/Sources/VLModel.cpp +++ b/Sources/VLModel.cpp @@ -283,8 +283,9 @@ failed: } static const char * kStepNames[] = { - "", "", "sus2", "", "", "sus", "♭5", "", "+", "6", "7", "♯7", "", - "♭9", "9", "♯9", "", "11", "♯11", "", "♭13", "13" + "", "", "sus2", "", "", "sus", kVLFlatStr "5", "", "+", "6", + "7", kVLSharpStr "7", "", kVLFlatStr "9", "9", kVLSharpStr "9", "", + "11", kVLSharpStr "11", "", kVLFlatStr "13", "13" }; void VLChord::Name(std::string & base, std::string & ext, std::string & root, bool useSharps) const diff --git a/Sources/VLSheetViewChords.mm b/Sources/VLSheetViewChords.mm index 38c2e3e..11e1ec0 100644 --- a/Sources/VLSheetViewChords.mm +++ b/Sources/VLSheetViewChords.mm @@ -23,12 +23,12 @@ std::string NormalizeName(NSString* rawName) for (;;) { size_t found; - found = chordName.find("\xE2\x99\xAF", 0, 3); + found = chordName.find(kVLSharpStr, 0, 3); if (found != std::string::npos) { chordName.replace(found, 3, 1, '#'); continue; } - found = chordName.find("\xE2\x99\xAD", 0, 3); + found = chordName.find(kVLFlatStr, 0, 3); if (found != std::string::npos) { chordName.replace(found, 3, 1, 'b'); continue; @@ -95,13 +95,18 @@ std::string NormalizeName(NSString* rawName) // // Found it! // + VLSoundOut::Instance()->PlayChord(*chord); + const VLProperties & prop = fSong->fProperties.front(); std::string name, ext, root; chord->Name(name, ext, root, prop.fKey > 0); - return [NSString stringWithFormat:@"%s%s%s", - name.c_str(), ext.c_str(), - root.size() ? ("/"+root).c_str() : ""]; + NSString * ns = [NSString stringWithUTF8String:name.c_str()]; + NSString * es = [NSString stringWithUTF8String:ext.c_str()]; + NSString * rs = [NSString stringWithUTF8String:root.c_str()]; + + return [NSString stringWithFormat:@"%@%@%s%@", ns, es, + [rs length] ? "/" : "", rs]; } at += chord->fDuration; }