From 273f7754faaa020095b4e6dfc57c67dd0e9f92c9 Mon Sep 17 00:00:00 2001 From: Mats Bengtsson Date: Mon, 19 Oct 1998 22:16:24 +0200 Subject: [PATCH] patch::: 1.0.17.mb1: Re: LilyPond 1.0.17 pl 17.mb1 - bf: No unnecessary warnings about time signatures - Added optional second argument of \key. Set to \major or \minor to get a major or minor key. Default: major. - Parser support for cautionary accidentals, i.e. accidentals within parantheses. Syntax: cis? The main part of the implementation is still missing. --- Documentation/tex/refman.yo | 25 ++++++++----- Documentation/tex/tutorial.yo | 10 +++--- NEWS | 8 +++++ TODO | 1 - VERSION | 2 +- init/declarations.ly | 3 ++ input/test/keys.ly | 4 +-- input/test/time.fly | 1 + lily/command-request.cc | 4 +-- lily/include/command-request.hh | 3 +- lily/include/lookup.hh | 4 +-- lily/include/musical-request.hh | 2 ++ lily/include/ps-lookup.hh | 2 +- lily/include/tex-lookup.hh | 2 +- lily/key-engraver.cc | 3 +- lily/local-key-engraver.cc | 6 ++++ lily/lookup.cc | 8 ++--- lily/musical-request.cc | 7 +++- lily/parser.yy | 17 ++++++++- lily/ps-lookup.cc | 4 +-- lily/tex-lookup.cc | 4 +-- mutopia/gallina.ly | 63 +++++++++++++++++++++------------ 22 files changed, 123 insertions(+), 60 deletions(-) diff --git a/Documentation/tex/refman.yo b/Documentation/tex/refman.yo index ae08ad2d24..aee4718c24 100644 --- a/Documentation/tex/refman.yo +++ b/Documentation/tex/refman.yo @@ -951,8 +951,14 @@ argument var(file) is a string. The full filename including the file(.ly) extension must be given, and the filename must be quoted. (An unquoted string will not work here.) -dit(code(\key) var(pitch)code(;)) Change key signature to that of -var(pitch)-major. +dit(code(\key) var(pitch) var(type) code(;)) Change the key signature. +var(type) should be code(\major) or code(\minor) to get +var(pitch)-major or var(pitch)-minor, respectively. The second +argument is optional, the default is major keys. +The var(\type) argument can also be given as an integer, which tells +the number of semitones that should be added to the pitch given in the +subsequent code(\key) commands to get the corresponding major key, +e.g. code(\minor) is defined as 3. dit(code(\keysignature) var(pitchseq)code(;)) Specify an arbitrary key signature. The pitches from var(pitch) will @@ -1295,9 +1301,6 @@ dit(code(barAlways)) If set to 1 a bar line is drawn after each note. dit(code(defaultBarType)) Sets the default type of bar line. See code(\bar) keyword. - - - dit(code(keyoctaviation)) If set to 1, then keys are the same in all octaves. If set to 0 then the key signature for different octaves can be different and is specified independently: code(\keysignature bes @@ -1323,16 +1326,16 @@ default) if you do not want key signatures printed. dit(code(timeSignatureStyle)) Changes the default two-digit layout for time signatures. The following values are recognized: description( - dit(code(C)): 4/4 and 2/2 are typeset as C and struck C, + dit(code(C)) 4/4 and 2/2 are typeset as C and struck C, respectively. All other time signatures are written with two digits. - dit(code(old)): 2/2, 3/2, 3/4, 4/4, 6/4 and 9/4 are typeset with + dit(code(old)) 2/2, 3/2, 3/4, 4/4, 6/4 and 9/4 are typeset with old-style mensuration marks. All other time signatures are written with two digits. - dit(code(1)): All time signatures are typeset with a single + dit(code(1)) All time signatures are typeset with a single digit, e.g. 3/2 is written as 3. dit(code(C2/2), code(C4/4), code(old2/2), code(old3/2), code(old3/4), code(old4/4), code(old6/4) or - code(old9/4)): Tells Lilypond to use a specific symbol as time + code(old9/4)) Tells Lilypond to use a specific symbol as time signature. ) The different time signature characters are shown below with @@ -1439,6 +1442,10 @@ code(castingalgorithm). Is equal to 1.0. dit(code(\infinity)) Used for setting the Score.beamslopedamping property. Is actually equal to 10000. dit(code(\left)) Used for setting textalignment property. Is equal to -1. +dit(code(\major)) Used as the second argument of the code(\key) +command to get a major key. +dit(code(\minor)) Used as the second argument of the code(\key) +command to get a minor key. dit(code(\mf)) Print mezzoforte symbol on preceeding note. dit(code(\mp)) Print mezzopiano symbol on preceeding note. dit(code(\nobreak)) Prevent a line break in music by using a large diff --git a/Documentation/tex/tutorial.yo b/Documentation/tex/tutorial.yo index 02bdaaf9a3..cf2e0e5349 100644 --- a/Documentation/tex/tutorial.yo +++ b/Documentation/tex/tutorial.yo @@ -696,10 +696,12 @@ dit(code(\clef) var(clefname)) This command sets the current clef for notation, \clef "treble"; c'4 \clef "alto"; c'4 ) -dit(code(\key) var(pitch)) This command changes the current key signature. The - key signature is printed at the start of every line. The argument - is the name of the corresponding major key. The key of C-minor can - thus be specified as `code(\key es)'. +dit(code(\key) var(pitch) var(type)) This command changes the current + key signature. The key signature is printed at the start of every + line. The var(type) argument is set to code(\major) or code(\minor) + to get major or minor keys, respectively. Omitting the second + argument gives major keys. The key of C-minor can thus be specified + as `code(\key es)' or `code(\key \c minor)'. dit(code(\keysignature) var(pitchlist)) diff --git a/NEWS b/NEWS index 5cff9ea377..b9549a6e24 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +pl 17.mb1 + - bf: No unnecessary warnings about time signatures + - Added optional second argument of \key. Set to \major or \minor + to get a major or minor key. Default: major. + - Parser support for cautionary accidentals, i.e. accidentals + within parantheses. Syntax: cis? The main part of the + implementation is still missing. + pl 17 - fixed RPM building. diff --git a/TODO b/TODO index 6c18aa1a12..57fddc2402 100644 --- a/TODO +++ b/TODO @@ -490,7 +490,6 @@ PROJECTS * Keys: - merge key{item} & localkey{item}? - - Major/Minor - spacing, national styles? * Support for TAB diff --git a/VERSION b/VERSION index 951bd357fd..4644aeabd9 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=0 PATCH_LEVEL=17 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=mb1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/init/declarations.ly b/init/declarations.ly index d28a53c62f..675a66269c 100644 --- a/init/declarations.ly +++ b/init/declarations.ly @@ -33,6 +33,9 @@ center=0 break = { \penalty = 10000; } nobreak = { \penalty = -10000; } +major = 0 +minor = 3 + \include "property.ly" % music = "\melodic\relative c" diff --git a/input/test/keys.ly b/input/test/keys.ly index 211c7c1e20..aa12b97e65 100644 --- a/input/test/keys.ly +++ b/input/test/keys.ly @@ -6,8 +6,8 @@ test key itemv breaking \score { \notes { - \key bes; c1 \key c; c1 + \key bes; c1 \key c \minor; c1 \break - \key bes; c1 \key d;\break c1 + \key bes \major; c1 \key d;\break c1 } } diff --git a/input/test/time.fly b/input/test/time.fly index 3908c4cf64..5b8f1dfe32 100644 --- a/input/test/time.fly +++ b/input/test/time.fly @@ -1,3 +1,4 @@ + \property Staff.timeSignatureStyle = "C" \time 1/1; c''1^"timeSignatureStyle = \"C\"" | diff --git a/lily/command-request.cc b/lily/command-request.cc index b32dc96ff4..aaad0f9fe6 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -322,7 +322,7 @@ Key_change_req::do_print() const Key_change_req::Key_change_req() { - minor_b_ = false; + modality_i_ = 0; ordinary_key_b_= false; } @@ -366,7 +366,7 @@ Key_change_req::flats_i() bool Key_change_req::minor_b() const { - return minor_b_; + return modality_i_ == 3; } int diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index a0afdc8f5e..9449dd33e9 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -145,7 +145,7 @@ public: class Key_change_req : public Command_req { public: Array pitch_arr_; - bool minor_b_; + int modality_i_; bool ordinary_key_b_; Key_change_req(); @@ -160,7 +160,6 @@ public: int sharps_i(); void transpose (Musical_pitch d); - /// is minor key? bool minor_b() const; }; diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 7efe60bb7e..23c9011fa4 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -31,8 +31,8 @@ public: Atom accidental (int) const; void add (String, Symtable*); - virtual Atom afm_find (String s) const = 0; - Atom afm_find (String, String) const; + virtual Atom afm_find (String s, bool warn=true) const = 0; + Atom afm_find (String, String, bool warn=true) const; virtual Atom* atom_p (String, int, Box) const = 0; Atom ball (int) const; Atom bar (String, Real height) const; diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 2f3c3f599c..e03a3e8646 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -129,6 +129,8 @@ public: /// force/supress printing of accidental. bool forceacc_b_; + /// Cautionary, i.e. parenthesized accidental. + bool cautionary_b_; Note_req(); bool do_equal_b (Request*) const; Rhythmic_req* access_Rhythmic_req () { return Rhythmic_req::access_Rhythmic_req (); } diff --git a/lily/include/ps-lookup.hh b/lily/include/ps-lookup.hh index 2eb9ed025a..adbc7ebf6d 100644 --- a/lily/include/ps-lookup.hh +++ b/lily/include/ps-lookup.hh @@ -19,7 +19,7 @@ public: Ps_lookup (Symtables const& s); virtual ~Ps_lookup (); - virtual Atom afm_find (String s) const; + virtual Atom afm_find (String s, bool warn=true) const; virtual Atom* atom_p (String, int, Box) const; virtual String character_str (int i) const; virtual Atom dashed_slur (Array controls, Real thick, Real dash) const; diff --git a/lily/include/tex-lookup.hh b/lily/include/tex-lookup.hh index cdb9839fcc..c0443abd06 100644 --- a/lily/include/tex-lookup.hh +++ b/lily/include/tex-lookup.hh @@ -20,7 +20,7 @@ public: Tex_lookup (Symtables const& s); virtual ~Tex_lookup(); - virtual Atom afm_find (String s) const; + virtual Atom afm_find (String s, bool warn=true) const; virtual String character_str (int i) const; virtual Atom dashed_slur (Array controls, Real thick, Real dash) const; virtual Atom* atom_p (String, int, Box) const; diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 83fd6ec6db..9917b398b0 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -116,8 +116,7 @@ Key_engraver::read_req (Key_change_req const * r) else { p = r->pitch_arr_[0].semitone_pitch (); - if (r->minor_b ()) - p += 3; + p += r->modality_i_; } /* Solve the equation 7*no_of_acc mod 12 = p, -6 <= no_of_acc <= 5 */ int no_of_acc = (7*p) % 12; diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index c6a3a07189..a74b27d79e 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -67,6 +67,12 @@ Local_key_engraver::process_acknowledged () key_item_p_ = new Local_key_item; announce_element (Score_element_info (key_item_p_, 0)); } + ///////// TODO: Handle cautionary accidentals + if (note_l->cautionary_b_) + { + warning (_("cautionary accidentals are not yet supported")); + } + key_item_p_->add (note_l->pitch_); key_item_p_->add_support (support_l); local_key_.set (note_l->pitch_); diff --git a/lily/lookup.cc b/lily/lookup.cc index 8ba88483f5..bc8d12d71f 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -65,7 +65,7 @@ Lookup::add (String s, Symtable*p) } Atom -Lookup::afm_find (String s, String str) const +Lookup::afm_find (String s, String str, bool warn) const { if (!afm_p_) { @@ -74,7 +74,7 @@ Lookup::afm_find (String s, String str) const *mlog << "]" << flush ; DOUT << this->afm_p_->str (); } - Adobe_font_char_metric m = afm_p_->find_char (s); + Adobe_font_char_metric m = afm_p_->find_char (s, warn); Atom a; if (m.code () < 0) @@ -229,11 +229,11 @@ Atom Lookup::special_time_signature (String s, Array arr) const { String symbolname = "timesig-"+s+"%/%"; - Atom a (afm_find (substitute_args (symbolname, arr))); + Atom a (afm_find (substitute_args (symbolname, arr), false)); if (!a.empty ()) return a; // Try if the full name was given - a = afm_find ("timesig-"+s); + a = afm_find ("timesig-"+s, false); if (!a.empty ()) return a; // Resort to default layout with numbers diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 3ee6004add..dd7da312df 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -184,6 +184,7 @@ Note_req::do_equal_b (Request*r) const Note_req::Note_req () { + cautionary_b_ = false; forceacc_b_ = false; } @@ -194,7 +195,11 @@ Note_req::do_print () const { #ifndef NPRINT Melodic_req::do_print (); - if (forceacc_b_) + if (cautionary_b_) + { + DOUT << " force cautionary accidental\n"; + } + else if (forceacc_b_) { DOUT << " force accidental\n"; } diff --git a/lily/parser.yy b/lily/parser.yy index bf82af8ec4..882241a4bb 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -249,6 +249,7 @@ yylex (YYSTYPE *s, void * v_l) %type abbrev_type %type int unsigned %type script_dir +%type optional_modality %type identifier_init simple_identifier_init block_identifier %type steno_duration notemode_duration %type entered_notemode_duration explicit_duration @@ -901,10 +902,11 @@ verbose_command_req: $$ = new Clef_change_req (*$2); delete $2; } - | KEY NOTENAME_PITCH { + | KEY NOTENAME_PITCH optional_modality { Key_change_req *key_p= new Key_change_req; key_p->pitch_arr_.push(*$2); key_p->ordinary_key_b_ = true; + key_p->modality_i_ = $3; $$ = key_p; delete $2; } @@ -961,6 +963,15 @@ post_request: } ; +optional_modality: + /* empty */ { + $$ = 0; + } + | int { + $$ = $1; + } + ; + sup_quotes: '\'' { $$ = 1; @@ -1019,6 +1030,10 @@ steno_notepitch: | steno_notepitch '!' { $$->forceacc_b_ = ! $$->forceacc_b_; } + | steno_notepitch '?' { + $$->forceacc_b_ = ! $$->forceacc_b_; + $$->cautionary_b_ = ! $$->cautionary_b_; + } ; diff --git a/lily/ps-lookup.cc b/lily/ps-lookup.cc index 8d160b1f88..62322e738b 100644 --- a/lily/ps-lookup.cc +++ b/lily/ps-lookup.cc @@ -43,9 +43,9 @@ Ps_lookup::~Ps_lookup () } Atom -Ps_lookup::afm_find (String s) const +Ps_lookup::afm_find (String s, bool warn) const { - return Lookup::afm_find (s, String ("(\\%03o) show ")); + return Lookup::afm_find (s, String ("(\\%03o) show "), warn); } Atom* diff --git a/lily/tex-lookup.cc b/lily/tex-lookup.cc index 4f10886e11..4c3a3e3bcb 100644 --- a/lily/tex-lookup.cc +++ b/lily/tex-lookup.cc @@ -42,9 +42,9 @@ Tex_lookup::~Tex_lookup() } Atom -Tex_lookup::afm_find (String s) const +Tex_lookup::afm_find (String s, bool warn) const { - return Lookup::afm_find (s, String ("\\char%d")); + return Lookup::afm_find (s, String ("\\char%d"), warn); } Atom* diff --git a/mutopia/gallina.ly b/mutopia/gallina.ly index b693616337..ffaa8941cd 100644 --- a/mutopia/gallina.ly +++ b/mutopia/gallina.ly @@ -29,8 +29,8 @@ either. /Mats - -Tested Features: Note placement, multipart score, figured base, \breve +Tested Features: Note placement, multipart score, figured base, \breve, + time signature styles %} %{ @@ -47,8 +47,28 @@ definition below. --MB \version "1.0.7"; -vi1=\notes \relative c'' { +global = \notes { + \property StaffGroup.timeSignatureStyle = "old" + \time 4/4; + \tempo 4=80; + \skip 1*31; + \property StaffGroup.timeSignatureStyle = "1" + \time 3/2; + \bar ":|:"; + \tempo 2=140; + \skip 1.*15; + \property StaffGroup.timeSignatureStyle = "old" \time 4/4; + \tempo 4=80; + \skip 1; + \bar ":|:"; + \skip 1*13; + \bar "|."; +} + +vi1=\type Staff = vi1 < +\global +\notes \relative c'' { [d8 d d d] d4 [a16 b c a] | [b8 g ][ g g16 a][ b8 g ][ g g16 a] | @@ -80,9 +100,8 @@ vi1=\notes \relative c'' { [c8 g ][ g g16 f] e4 d | r8 g [g g16 f] e4 d | r8 [d16 a ][ b8 b16 c] a2 | - b1 | - \time 3/2; - \tempo 2=140; + b1 | + r4 d d d d d | e1. | r4 c c c c c | @@ -98,8 +117,7 @@ vi1=\notes \relative c'' { a4 [c8 b] a4 [b8 c] f,4 [g8 a] | d,4 g g g g g | a [d,8 c] b4 [c8 d] a2 | - \time 4/4; - \tempo 4=80; + b1 | [d8 d d d] d4 [a16 b c a] | [b8 g ][ g g16 a] [b8 g ][ g g16 a] | @@ -114,11 +132,11 @@ vi1=\notes \relative c'' { fis4 g2 fis!4 | \cadenza 1; g\breve - \bar "|."; -} +}> -vi2=\notes \relative c'' { - \time 4/4; +vi2=\type Staff = vi2 < +\global +\notes \relative c'' { r1 | r | r | [d8 d d d] d4 [a16 b c a] | @@ -149,7 +167,7 @@ vi2=\notes \relative c'' { e4 d r8 [c16 g ][ b8 b16 c] | a4 g2 fis4 | g1 | - \time 3/2; + r1. | r4 [g'8 f] e4 [f8 g] c,4 [d8 e] | a,1. | @@ -165,7 +183,7 @@ vi2=\notes \relative c'' { c,4 a a a a a | b [d8 c] b4 [c8 d] d,4 e | fis2 g fis! | - \time 4/4; + g1 | r1 | r1 | [g'8 g g g] g4 [d16 e f d] | @@ -179,13 +197,13 @@ vi2=\notes \relative c'' { [a d c b ][ a g fis e] d4 d' | \cadenza 1; b\breve - \bar "|."; -} +}> -bc=\notes\transpose c'{ +bc=\type Staff = bc < +\global +\notes\transpose c'{ \clef "bass"; - \time 4/4; G2 d^"4 3" | G1 | g2 c4 G | d1^"3 4 3" | @@ -203,7 +221,7 @@ bc=\notes\transpose c'{ G1^"3 4 3" | c4 B c g | c B c G | d1^"3 4 3" | G1 | - \time 3/2; + g1. | c | f | d^"\\textsharp" | g | c | @@ -212,8 +230,9 @@ bc=\notes\transpose c'{ d^"\\textsharp" | e | f | g1 B2 | d1.^"3 4 3" | - \time 4/4; + G1 | + \bar ":|:"; g2 fis | g G | g1^"3 4 3" | c | G^"3 4 3" | c2 G | @@ -222,12 +241,10 @@ bc=\notes\transpose c'{ ) d^"3 4 3" | \cadenza 1; G\breve - \bar "|."; -} +}> \score{ \type StaffGroup < - \property StaffGroup.timeSignatureStyle = "old" \vi1 \vi2 \bc -- 2.39.5