"(c)" not turned into copyright symbol if entered in Create New Score wizard

• Mar 12, 2011 - 20:27
Type
Functional
Severity
S4 - Minor
Status
closed
Project

Version 1.0, Windows Vista.

1. File->New
2. Copyright: "Copyright (c) 2011 Marc Sabatella"
3. Create new score from template
4. select template, hit finish

Result: "(c)" still present in generated copyright text. Only by actually editing that text and re-typing "(c) " does the option to automatically convert to the copyright symbol get triggered.

Trunk result: similar, except I can't figure out how to edit the generated copyright text directly (it's not clickable). But editing it via Edit->Meta Data... doesn't fare any better. And of course, I can't actually use templates in the trunk (crash every time), but the same thing happens with creating from scratch


Comments

Same thing on Mac OS X - thanks Marc for pointing out the re-edit work-around (not to mention for the leadsheet tutorial and templates:-).

Still the case in 1.3 and the latest nighly builds.

Guess the best approach would be to fix it in libmscore/score.cpp, in Score::metaTag (so every time tags are read, even for old scores) or Score::setMetaTag (so everytime tags are set, for whatever reason, could e.g. be import)?
Or only in MuseScore::newFile() (in mscore/file.cpp line 682, where is read the first time or line 735, where it is set the first time for a new score)?
Just search for "(c)" and replace with ©? "©" won't work, the © sign directly shouldn't be used in .cpp files, so it needs to be the U+00A9, I guess Or is 8-bit ASCII OK?

I'll see what I can do about this
That last case, doing it it file.cpp, is an easy one liner

{syntaxhighlighter brush:cpp}
@@ -679,7 +679,7 @@ void MuseScore::newFile()
QString subtitle = newWizard->subtitle();
QString composer = newWizard->composer();
QString poet = newWizard->poet();
- QString copyright = newWizard->copyright();
+ QString copyright = newWizard->copyright().replace("(c)", "\u00A9");

if (!title.isEmpty() || !subtitle.isEmpty() || !composer.isEmpty() || !poet.isEmpty()) {
MeasureBase* measure = score->measures()->first();

{/syntaxhighlighter}

Except... that it a setting in preferences...

Do we want it every time "(c)" us used in a copyright text? Also on import, or opeing existing scores?

Another related problem: that setting in preferences to autocorrect 1/2 to ½ doesn't seem to work either. Reported in #25003: replacing 1/2 with ½ doesn't work

OK, we can't (easily) do it in libmscore/score.cpp, Score::setMetaTag(), as there we don't have the preferences available.
setMetaTag() is called explitly using the tag "copyright" in mscore/importxml.cpp, mscore/importmidi.cpp and mscore/importgpt.cpp (in both wrongly? with tag "Copyright" and these tags are casesensitive), mscore/importbww.cpp, mscore/file.cpp, libmscore/scorefile.cpp and libmscore/read114.cpp. And a bit indirectly in mscore/metaedit.cpp.
Also possibly in libmscore/undo.cpp, ChangeMetaTag::flip(), we may not need to worry about that one.

So we'd lose out on importing 1.x files or reading existing 2.0 ones, but can fix the import for xml, midi, gpt and bww, as well as when creating new score and modifying an existing one.

In file.cpp I have now:
{syntaxhighlighter brush:cpp}
@@ -731,8 +731,12 @@ void MuseScore::newFile()
seg->add(tt);
score->setTempo(0, tempo);
}
- if (!copyright.isEmpty())
- score->setMetaTag("copyright", copyright);
+ if (!copyright.isEmpty()) {
+ if (preferences.replaceCopyrightSymbol)
+ score->setMetaTag("copyright", copyright.replace("(c)", "\u00A9"));
+ else
+ score->setMetaTag("copyright", copyright);
+ }

score->rebuildMidiMapping();
score->doLayout();

{/syntaxhighlighter}

I'd need directions where to go with this...

for 1.3 files it could indeed be done in read114.cpp, line 636. Difficulty with adding it there is that we can't obey preferences there (in libmscore/), as we'd need to #include a file from mscore/ (preferences.h)
One option to catch'em all would be in mscore/file.cpp, Ms::readScore() line 1855 ff?

Or make repaceCopyrightSymbol a global variable, just like (the otherwise unused!) replaceFractions.

I do not like this kind of automatism. MuseScore should not silently change any text. Its some kind of unexpected behaviour and therefore bad gui design.

There should be a more generic method to easily enter special symbols like the ability to define shortcuts or by simplifying the F2 palette.

In that case the entire preferences dialog tab dealing with copyright and fraction should go, along with the code dealing (or not, in case of fraction)
MuseScore doesn't change silently, but rather on demand of user (via his preferences)

I agree with removing the tab. Since the character is used rarely, the user can open a character map and copy the character from there. It seems to me if we implement the change of 1/2 to the unicode equivalent then why are we not including 1/4 and 3/4?

I see two options:

The first one would be to launch a character map with a button placed during text editing.
The downside is that this would involve having different paths to the character map depending on the OS.

The second would just show a new window where a user could type a unicode number, and paste it along with a preview. We could add a list of used symbols for easier input.

If the consensus (or developers' decision) is that both the copyright and the 1/2 replacement should go away rather than being fixed, just let me know and I'll do a corresponding PR.

I personally like the automatic "(c)" conversion, but I couldn't cate less about about "1/2". I could live without automatic "(c)" conversion if there is an *easy* alternative for getting the copyright symbol into a copyright messsage. The fact that copyright is no longer normal plain text makes it harder to leverage the symbols palette. But I suppose a button could be hard coded into the dialog to insert copyright symbol.

The (C) symbol is important, but only for the copyright text. Why not Alt-C, like the Mac, being trapped and converted?

On Windows, the Alt+0169 solution given only works if your keyboard has a numeric keypad. None of my last three computers have had one. The previous two at least had a way to access these keys via combinations with Fn; my current computer has no way I know of to generates this. So I've been resorting to copying from Character Map or using Google Docs to convert for me then pasting from there.

It is true a user doesn't need to add the copyright character often. But it's not difficult to predict when he is going to need it: in the first screen of the Create New Score wizard, or in File / Info. So it still seems to me that *some* way of entering the copyright symbol directly while in either of these two dialogs would be most appreciated.