]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/musicexp.py
Merge remote-tracking branch 'origin/translation' into staging
[lilypond.git] / python / musicexp.py
index 24174656273198be6d69abd7a7171fd1879d101b..ea2525d866e4085e3adb90de929a7ebd91ac4f53 100644 (file)
@@ -19,7 +19,7 @@ def escape_instrument_string (input_string):
     if re.match ('.*[\r\n]+.*', retstring):
         rx = re.compile (r'[\n\r]+')
         strings = rx.split (retstring)
-        retstring = "\\markup { \\column { "
+        retstring = "\\markup { \\center-column { "
         for s in strings:
             retstring += "\\line {\"" + s + "\"} "
         retstring += "} }"
@@ -198,6 +198,17 @@ class Duration:
 
         return base * dot_fact * self.factor
 
+# implement the midi command line option '-m' and '--midi'
+# if TRUE add midi-block to .ly file (see below)
+def set_create_midi (option):
+    global midi_option
+    midi_option = option
+
+def get_create_midi ():
+    try:
+        return midi_option
+    except:
+        return False
 
 # Implement the different note names for the various languages
 def pitch_generic (pitch, notenames, accidentals):
@@ -1782,7 +1793,7 @@ class StaffGroup:
         if self.spanbar == "no":
             printer.dump ("\\override SpanBar #'transparent = ##t")
         brack = {"brace": "SystemStartBrace",
-                 "none": "f",
+                 "none": "SystemStartBar",
                  "line": "SystemStartSquare"}.get (self.symbol, None)
         if brack:
             printer.dump ("systemStartDelimiter = #'%s" % brack)
@@ -1796,7 +1807,18 @@ class StaffGroup:
                 printer.dump (m)
             printer.dump ("}")
 
+    def print_ly_chords (self,printer):
+        try:
+            for [staff_id, voices] in self.part_information:
+                for [v, lyrics, figuredbass, chordnames] in voices:
+                    if chordnames:
+                        printer ('\context ChordNames = "%s" \\%s' % (chordnames, chordnames))
+                        printer.newline ()
+        except TypeError:
+            return
+
     def print_ly (self, printer):
+        self.print_ly_chords (printer)
         if self.stafftype:
             printer.dump ("\\new %s" % self.stafftype)
         self.print_ly_overrides (printer)
@@ -1837,12 +1859,6 @@ class Staff (StaffGroup):
             sub_staff_type = self.stafftype
 
         for [staff_id, voices] in self.part_information:
-            # Chord names need to come before the staff itself!
-            for [v, lyrics, figuredbass, chordnames] in voices:
-                if chordnames:
-                    printer ('\context ChordNames = "%s" \\%s' % (chordnames, chordnames))
-
-            # now comes the real staff definition:
             if staff_id:
                 printer ('\\context %s = "%s" << ' % (sub_staff_type, staff_id))
             else:
@@ -1919,6 +1935,7 @@ class Score:
           self.contents.set_part_information (part_id, staves_info)
 
     def print_ly (self, printer):
+        self.create_midi = get_create_midi ()
         printer.dump ("\\score {");
         printer.newline ()
         if self.contents: