From: fred Date: Sun, 24 Mar 2002 19:56:05 +0000 (+0000) Subject: lilypond-0.1.11 X-Git-Tag: release/1.5.59~3984 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8bac8ed505ba108cb3b7cf65ae7090dd4b6aafef;p=lilypond.git lilypond-0.1.11 --- diff --git a/Documentation/Makefile b/Documentation/Makefile index 521caa1bb6..4da45d58b0 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -39,7 +39,7 @@ giffiles=$(XPMS:.xpm=.gif) gifs: $(addprefix $(outdir)/, $(giffiles)) -EXTRA_DISTFILES = $(XPMS) $(DOCFILES) $(wildcard Vocab*) +EXTRA_DISTFILES = $(XPMS) $(DOCFILES) vocabulary-data vocabulary-forms.el # don't do DVI files. They can only be made if lily is installed do-doc: $(TEXTFILES) diff --git a/Documentation/vocabulary-data b/Documentation/vocabulary-data new file mode 100644 index 0000000000..c2ed3f098f --- /dev/null +++ b/Documentation/vocabulary-data @@ -0,0 +1,244 @@ +Francais:US English:Deutsch:UK English:Nederlands:Italiaans +accentuation:accentuation:::accent: +accolade:brace:::: +accord:chord:::akkoord: +accord de neuvième dominante:chord of the dominant ninth:::dominant akkoord: +accord de septième dominante:chord of the dominant seventh:::septiem akkoord: +accord parfait majeur:perfect major chord:::: +accord parfait mineur:perfect minor chord:::: +alto:alto:::alt: +altération accidentelle:accident; accidental alteration:::toevallig teken: +altération essentielle:essential alteration:::: +appogiature:appoggiatura:::: +appogiature brève:short appoggiatura:::: +appogiature double:double appoggiatura:::: +appogiature longue:long appoggiatura:::: +appogiature simple:simple appoggiatura:::: +armature [de la clé]:key signature:::toonsoort (voortekens): +armure [de la clé]:key signature:::: +arpège:arpeggio:::: +augmenté (intervalle):augmented (interval):::: +bariton:baritone:::: +barre de mesure:bar line:::: +barre de reprise:repeat:::: +basse:bass:::: +blanche:half note:::: +bâton de pause:(arbitrary number of bars' rest):::: +bâton de pause:four-bar rest:::: +bâton de pause:two-bar rest:::: +bécarre:natural sign:::herstellingsteken: +bémol:flat:::mol: +cadence:cadence:::: +cadence harmonique:harmonic cadence:::: +cadence mélodique:melodic cadence:::: +caractère:character:::: +chaîne de trilles:chain of trills:::: +chevron:chevron:::: +chiffrage (chiffres indicateurs):time signature:::maatsoort: +chiffre inférieur:lower number:::: +chiffre supérieur:upper number:::: +clé:clef:::sleutel: +clé d'octave:octave line:::: +clé d'ut:middle C clef:::C sleutel: +clé de fa:bass clef:::: +clé de sol:treble clef:::: +comma:comma:::: +comma enharmonique:::: +comma pythagoricien:::: +comma syntonique:::: +consonance:consonant interval; consonance:::consonant: +contralto:contralto:::: +contre-temps:contro-time:::: +contre-temps irrégulier:irregular contro-time:::: +contre-temps régulier:regular contro-time:::: +coulé:slur:::binding, bindingsboog: +courbe rythmique:rythmic curve:::: +cresendo:opening angular bracket:::: +croche:eighth note:::: +decrescendo:closing angular bracket:::: +degré [de la gamme]:degree [of the scale]:::: +demi-pause:half rest:::: +demi-soupir:eighth rest:::: +demi-ton:semitone:::: +demi-ton chromatique:chromatic semitone:::: +demi-ton diatonique:diatonic semitone:::: +diapason:pitch pipe; tuning fork:::: +diminué (intervalle):diminished (interval):::: +dissonance:dissonant interval; dissonance:::: +dièse:sharp:::: +do:C:::: +do central:middle C::::: +doigté::::: +doigté de pédale::::: +dominante:dominant:::: +double barre:double bar line:::: +double bémol:double flat:::: +double croche:sixteenth note:::: +double dièse:double sharp:::: +double triolet:double triplet:::: +duolet:duplet:::: +durée:duration:::: +échelle d'octave:octave line:::: +échelle musicale:Musical Ladder:::: +enharmonie:enharmony:::: +espace:space:::: +extension d'intervalle:extension of interval:::: +fa:F:::: +figure de note:kind of note:::: +figure de silence:kind of rest:::: +fioriture:cadenza:::: +forme du mode mineur ancien:ancient form (diatonic minor scale):::: +forme harmonique:harmonic form (diatonic minor scale):::: +forme mélodique:melodic form (diatonic minor scale):::: +gamme:scale:::: +gamme chromatique:chromatic scale:::: +gamme diatonique majeure:diatonic major scale:::: +gamme diatonique mineure:diatonic minor scale:::: +gammes enharmoniques:enharmonic scales:::: +gammes relatives:relative scales:::: +genre chromatique:chromatic type:::: +genre diatonique:diatonic type:::: +genre enharmonique:enharmonic type:::: +groupe irrégulier:irregular group:::: +grupetto:turn; gruppetto:::: +hauteur:pitch:::: +huitième de soupir:thirty-second rest:::: +incise:motive:::: +indication de pédale:::: +indication métronomique:metronomic indication:::: +intervalle:interval:::: +intervalle ascendant:ascending interval:::: +intervalle composé:compound interval:::: +intervalle descendant:descending interval:::: +intervalle harmonique:harmonic interval:::: +intervalle simple:simple interval:::: +intervalles enharmoniques:enharmonic intervals:::: +juste (intervalle):perfect (interval):::: +la:A:::: +liaison:tie:::: +liaison rythmique:legato curve:::: +ligne:line:::: +ligne supplémentaire:ledger line:::: +majeur (intervalle):major (interval):::: +membre de phrase:phrase member:::: +mesure:bar; measure:::maat, maatstreep: +mesure artificielle:artificial measure:::: +mesure composée:compound measure:::: +mesure incomplète:incomplete measure:::: +mesure irrégulière:irregular measure:::: +mesure simple:simple measure:::: +mezzo-soprano:mezzo-soprano:::: +mi:E:::: +mineur (intervalle):minor (interval):::: +mode:mode:::: +mode ecclésiastique:::: +mode majeur:major mode:::: +mode mineur:minor mode:::: +modulation:modulation:::: +mordant:mordent:::: +mouvement:tempo; movement:::: +mouvement conjoint:conjunct movement:::: +mouvement disjoint:disjunct movement:::: +mouvement lent:slow tempo:::: +mouvement modéré:moderate tempo:::: +mouvement rapide:fast tempo:::: +médiante:mediant:::: +métronome:metronome:::: +noire:quarter note:::: +note:note:::: +note doublement pointée:double dotted note:::: +note modale:modal note:::: +note pointée:dotted note:::: +note tonale:tonal note:::: +notes enharmoniques:enharmonic notes:::: +nuance:shading:::: +octave:octave:::: +ornement:embellishment; accessory:::: +partition:score:::: +pause:whole rest:::: +phrase:phrase:::: +phrasé:phrasing:::: +pizzicato:dash over/below:::: +point:dot:::: +point d'orgue:pause:::: +point et liaison combinés:dot and curved line combined:::: +pointillés:::: +portamento:underline over/below:::: +portée:staff:::: +portées:staves:::: +quadruple croche:sixty-fourth note:::: +quart de soupir:sixteenth rest:::: +quarte:fourth:::: +quartolet:quadruplet:::: +quinte:fifth:::: +registre:register:::: +renversement d'intervalle:inversion of interval:::: +renvoi:return sign:::: +respiration:artificial rest:::: +:double whole note::breve:brevis:breve +ronde:whole note:::: +rythme:rythm:::: +ré:D:::: +seconde:second:::: +seizième de soupir:sixty-fourth rest:::: +sensible:leading note:::: +septième:seventh:::: +sextolet:sextuplet:::: +si:B:::: +signes indicateurs de nuance:shading signs:::: +silence:rest:::: +sixain:sextuplet:::: +sixte:sixth:::: +sol:G:::: +soprano:soprano:::: +soupir:quarter rest:::: +sous-dominante:subdominant:::: +sous-tonique:subtonic:::: +staccato:dot over/below:::: +sus-dominante:superdominant:::: +sus-tonique:supertonic:::: +syncope:syncopation; upbeat:::: +syncope irrégulière:irregular syncopation:::: +syncope régulière:regular syncopation:::: +temps:beat:::: +temps binaire:binary beat:::: +temps faible:weak beat:::: +temps fort:strong beat:::: +temps ternaire:ternary beat:::: +tempérament mésotonique:meantone tuning:::: +tempérament égal:tempered tuning:::: +tierce:third:::: +ton:tone:::: +tonalité:tonality:::: +tonique:tonic:::: +tons relatifs:relative scales:::: +tons voisins:adjacent keys:::: +transposition:transposition:::: +transposition chromatique:chromatic transposition:::: +transposition enharmonique:enharmonic transposition:::: +trille:trill; shake:::: +trille double:double trill:::: +triolet:triplet:::: +triple croche:thirty-second note:::: +triton:tritone:::: +ténor:tenor:::: +tétracorde:tetrachord:::: +unisson:unison:::: +unité de mesure:unit of measure:::: +unité de temps:unit of beat:::: +ut:C:::: +voix:voice:::: +:quarter note::crotchet:: +:quarter rest::crotchet rest:: +:thirty-second note::demisemiquaver:: +:thirty-second rest::demisemiquaver rest:: +:sixty-fourth note::hemidemisemiquaver:: +:sixty-fourth rest::hemidemisemiquaver rest:: +:half note::minim:: +:half rest::minim rest:: +:eighth note::quaver:: +:eighth rest::quaver rest:: +:whole note::semibreve:: +:whole rest::semibreve rest:: +:sixteenth note::semiquaver:: +:sixteenth rest::semiquaver rest:: diff --git a/Documentation/vocabulary-forms.el b/Documentation/vocabulary-forms.el new file mode 100644 index 0000000000..87893d2e13 --- /dev/null +++ b/Documentation/vocabulary-forms.el @@ -0,0 +1,21 @@ +; Musical vocabularies are Copyright (C) 1993 Free Software Foundation, Inc. +; Francois Pinard , +; Neil Jerram . +; Forms by Han-Wen Nienhuys + +(setq forms-file "vocabulary-data") +(setq forms-number-of-fields 6) +(setq forms-read-only nil) ; to make sure +(setq forms-field-sep ":") +(setq forms-multi-line nil) + +(setq forms-format-list + (list + "*** Musical vocabulary ***\n" + "\nItalian: " 6 + "\nFrench: " 1 + "\nUS English: " 2 + "\nGerman: " 3 + "\nBritish English: " 4 + "\nDutch: " 5 + )) diff --git a/TODO b/TODO index 26517e4b48..ff14045e1e 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,10 @@ done, or is an idea that I want to think about Most of the items are marked in the code as well, with full explanation. grep for TODO and ugh/ugr + * check out egcs + + * give Items/Spanners access to unbroken originals + 3RD PARTY BUGS: * ICE: spring-spacer::calcideal() @@ -38,17 +42,19 @@ PROJECTS - have make dist produce tarball in out/ directory. - Use Automake - shared lib on Solaris too. - - check libtool, automake + - check libtool - generate stuff in out/default, out/sun5-irix etc iso out/ and out-sun5/ + * Add mudela-output to Rosegarden. - * Add mudela to Rosegarden. - - * a musical dictionary. See Documentation/Vocab* - - other languages - - emacs forms mode for editing it. - + * a musical dictionary. See Documentation/vocabulary-*, other +languages: + - italian + - german + - dutch + - swedish + .. ? * chords - guitar chords @@ -58,7 +64,7 @@ PROJECTS - MIDI output? - typesetting - * integrate midi-elts from mi2mu and lily + * integrate midi-elts from mi2mu and lily? * Debug logs: - derive lily_stream, Dstream, texstream from ostream? @@ -80,8 +86,7 @@ PROJECTS - adapt for multiple font sizes. - make separate class for Grace_*_engravers (which is at Voice_gravs level) - - move stem, beam, slur into baseclass to adapt for (fixed - size) grace notes. + - make encapsulated spacing problems. * accidentals per Voice_group @@ -111,7 +116,7 @@ PROJECTS - NIFF ? - Common Music Notation - PostScript output (esp. Beams, Slurs, etc) - - Move PScore, Items, Spanners etc. into libmutype.a + - Move all Score_elems, into libmutype.a * Documentation @@ -148,7 +153,6 @@ PROJECTS - rewrite : make a metafont iso font * Font support: - - update 20 pt table - mixed fontsizes * lines: @@ -175,7 +179,6 @@ PROJECTS - redo Notehead to allow digits as heads - add a \tablature {} lexer mode for easy entering - * should adjust stemlength for flag number. * breaking: @@ -188,6 +191,8 @@ PROJECTS * Rhythmic staff. + * Baroque superstaff + SEVERELY LACKING: * SPEED! @@ -240,9 +245,6 @@ SMALLISH PROJECTS * lyric in staff (sharpsharp in staff, text below) - * replace Score_elem member access by get()/set() methods, to enable - future embedded code. - * write Dynamic_line (to group dynamics horizontally) * write Rest_collision @@ -275,7 +277,6 @@ SMALLISH PROJECTS - String hash - Pointer hash - * binsearch/hash for identifiers * stafftypes: voice names/ instrument names. @@ -290,10 +291,9 @@ SMALLISH PROJECTS * textspanner: center position - * Brackets - * Scricts: + * Scripts: - stack scripts in chords: % fingering: footing: < a-4 c-2 g-1 > < c-\ltoe e-\lheel > @@ -309,13 +309,6 @@ SMALLISH PROJECTS % --|--- --|--- (where "to" is a tiny bow) -DOC - * all errors - - * hacking-HOWTO - -FUTURE - * auxilliary file for caching info. * Text_crescendo @@ -326,6 +319,11 @@ FUTURE * volta +DOC + * all errors + + * hacking-HOWTO + IDEAS * scoping in Lexer: do general id- assignments in mudela. @@ -357,7 +355,9 @@ IDEAS * move towards incremental algorithms. - * design meta-language like TeX and Metafont + * far fetched language ideas + - design meta-language like TeX and Metafont + - programming/macros input * Global type registration. @@ -366,11 +366,6 @@ IDEAS if ( t <= get_type( q )) .. - - * virtualise PCols to make encapsulated spacing problems - - * don't count bars which are not on first beat. - * naming of Voice_group/Voice * benchmark band_matrices. @@ -391,8 +386,11 @@ IDEAS * lyrics in chords still fuck up. - * rewire acknowledge_element() logic with a process_acknowledged() - + * + - rewire acknowledge_element() logic with a process_acknowledged() + - construct Stem upon receiving Notehead. Junk Stem_req + + * pushgroup/popgroup * whole head on ledger line diff --git a/lily/beam.cc b/lily/beam.cc index 70a1ce88d0..927d85cd8d 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -32,7 +32,7 @@ struct Stem_info { Real x; - int dir_i_; + int dir_; Real idealy_f_; Real miny_f_; int beams_i_; @@ -44,45 +44,45 @@ struct Stem_info { Stem_info::Stem_info (Stem const *s) { x = s->hpos_f(); - dir_i_ = s->dir_i_; - beams_i_ = intlog2( s->flag_i_) - 2; + dir_ = s->dir_; + beams_i_ = intlog2(s->flag_i_) - 2; /* - [todo] - * get algorithm - * runtime - - Breitkopf + H\"artel: - miny_f_ = interline + #beams * interbeam - ideal8 = 2 * interline + interbeam - ideal16,32,64,128 = 1.5 * interline + #beams * interbeam - - * B\"arenreiter: - miny_f_ = interline + #beams * interbeam - ideal8,16 = 2 interline + #beams * interbeam - ideal32,64,128 = 1.5 interline + #beams * interbeam + [todo] + * get algorithm + * runtime + + Breitkopf + H\"artel: + miny_f_ = interline + #beams * interbeam + ideal8 = 2 * interline + interbeam + ideal16,32,64,128 = 1.5 * interline + #beams * interbeam + + * B\"arenreiter: + miny_f_ = interline + #beams * interbeam + ideal8,16 = 2 interline + #beams * interbeam + ideal32,64,128 = 1.5 interline + #beams * interbeam - */ + */ Real notehead_y = s->paper()->interline_f (); // huh? why do i need the / 2 -// Real interbeam_f = s->paper()->interbeam_f (); + // Real interbeam_f = s->paper()->interbeam_f (); Real interbeam_f = s->paper()->interbeam_f () / 2; /* well eh, huh? - idealy_f_ = dir_i_ * s->stem_start_f() + beams_i_ * interbeam_f; - if ( beams_i_ < 3) - idealy_f_ += 2 * interline_f; - else - idealy_f_ += 1.5 * interline_f; - */ + idealy_f_ = dir_ * s->stem_start_f() + beams_i_ * interbeam_f; + if (beams_i_ < 3) + idealy_f_ += 2 * interline_f; + else + idealy_f_ += 1.5 * interline_f; + */ - idealy_f_ = dir_i_ * s->stem_end_f(); + idealy_f_ = dir_ * s->stem_end_f(); - miny_f_ = dir_i_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f; + miny_f_ = dir_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f; idealy_f_ = miny_f_ >? idealy_f_; -// assert (miny_f_ <= idealy_f_); + // assert (miny_f_ <= idealy_f_); } @@ -90,7 +90,7 @@ Stem_info::Stem_info (Stem const *s) Offset -Beam::center()const +Beam::center() const { Real w=(paper()->note_width () + width ().length ())/2.0; return Offset (w, (left_pos + w* slope)*paper()->internote_f ()); @@ -109,6 +109,10 @@ Beam::add (Stem*s) stems.push (s); s->add_dependency (this); s->print_flag_b_ = false; + + if (!spanned_drul_[LEFT]) + set_bounds(LEFT,s); + set_bounds(RIGHT,s); } void @@ -119,34 +123,34 @@ Beam::set_default_dir() for (int i=0; i get_center_distance_from_top(); - int cur_up = sl->get_center_distance_from_bottom(); - if (cur_down) - { - down += cur_down; - down_count++; - } - if (cur_up) - { - up += cur_up; - up_count++; - } + Stem *sl = stems[i]; + int cur_down = sl->get_center_distance_from_top(); + int cur_up = sl->get_center_distance_from_bottom(); + if (cur_down) + { + down += cur_down; + down_count++; + } + if (cur_up) + { + up += cur_up; + up_count++; + } } if (!down) - down_count = 1; + down_count = 1; if (!up) - up_count = 1; + up_count = 1; // the following relation is equal to // up / up_count > down / down_count - dir_i_ = (up * down_count > down * up_count) ? 1 : -1; + dir_ = (up * down_count > down * up_count) ? UP : DOWN; - for (int i=0; i dir_i_ = dir_i_; - } + for (int i=0; i dir_ = dir_; + } } /* @@ -163,57 +167,57 @@ Beam::solve_slope() Array sinfo; for (int j=0; j set_default_extents(); - if (i->invisible_b()) - continue; + i->set_default_extents(); + if (i->invisible_b()) + continue; - Stem_info info (i); - sinfo.push (info); + Stem_info info (i); + sinfo.push (info); } if (! sinfo.size()) - slope = left_pos = 0; + slope = left_pos = 0; else if (sinfo.size() == 1) { - slope = 0; - left_pos = sinfo[0].idealy_f_; + slope = 0; + left_pos = sinfo[0].idealy_f_; } else { - Real leftx = sinfo[0].x; - Least_squares l; - for (int i=0; i < sinfo.size(); i++) - { - sinfo[i].x -= leftx; - l.input.push (Offset (sinfo[i].x, sinfo[i].idealy_f_)); - } - - l.minimise (slope, left_pos); + Real leftx = sinfo[0].x; + Least_squares l; + for (int i=0; i < sinfo.size(); i++) + { + sinfo[i].x -= leftx; + l.input.push (Offset (sinfo[i].x, sinfo[i].idealy_f_)); + } + + l.minimise (slope, left_pos); } Real dy = 0.0; for (int i=0; i < sinfo.size(); i++) { - Real y = sinfo[i].x * slope + left_pos; - Real my = sinfo[i].miny_f_; + Real y = sinfo[i].x * slope + left_pos; + Real my = sinfo[i].miny_f_; - if (my - y > dy) - dy = my -y; + if (my - y > dy) + dy = my -y; } left_pos += dy; - left_pos *= dir_i_; + left_pos *= dir_; - slope *= dir_i_; + slope *= dir_; /* This neat trick is by Werner Lemberg, damped = tanh (slope) corresponds with some tables in [Wanske] - */ + */ slope = 0.6 * tanh (slope); - // ugh + // ugh Real sl = slope*paper()->internote_f (); paper()->lookup_l ()->beam (sl, 20 PT); slope = sl /paper()->internote_f (); @@ -225,10 +229,10 @@ Beam::set_stemlens() Real x0 = stems[0]->hpos_f(); for (int j=0; j hpos_f()-x0; - s->set_stemend (left_pos + slope * x); + Real x = s->hpos_f()-x0; + s->set_stemend (left_pos + slope * x); } } @@ -236,11 +240,11 @@ Beam::set_stemlens() void Beam::do_post_processing() { - if ( stems.size() < 2) + if (stems.size() < 2) { - warning ("Beam with less than 2 stems"); - transparent_b_ = true; - return ; + warning ("Beam with less than 2 stems"); + transparent_b_ = true; + return ; } solve_slope(); set_stemlens(); @@ -257,35 +261,35 @@ Beam::set_grouping (Rhythmic_grouping def, Rhythmic_grouping cur) Array b; { - Array flags; - for (int j=0; j flag_i_))-2; - assert (f>0); - flags.push (f); - } - int fi =0; - b= cur.generate_beams (flags, fi); - b.insert (0,0); - b.push (0); - assert (stems.size() == b.size ()/2); - } + Array flags; + for (int j=0; j flag_i_))-2; + assert (f>0); + flags.push (f); + } + int fi =0; + b= cur.generate_beams (flags, fi); + b.insert (0,0); + b.push (0); + assert (stems.size() == b.size ()/2); + } for (int j=0, i=0; i < b.size() && j beams_left_i_ = b[i]; - s->beams_right_i_ = b[i+1]; + Stem *s = stems[j]; + s->beams_left_i_ = b[i]; + s->beams_right_i_ = b[i+1]; } } void Beam::do_pre_processing() { - if (!dir_i_) - set_default_dir(); + if (!dir_) + set_default_dir(); } @@ -294,18 +298,18 @@ Interval Beam::do_width() const { return Interval (stems[0]->hpos_f(), - stems.top()->hpos_f ()); + stems.top()->hpos_f ()); } /* beams to go with one stem. */ Molecule -Beam::stem_beams (Stem *here, Stem *next, Stem *prev)const +Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const { - assert (!next || next->hpos_f() > here->hpos_f () ); - assert (!prev || prev->hpos_f() < here->hpos_f () ); -// Real dy=paper()->internote_f ()*2; + assert (!next || next->hpos_f() > here->hpos_f ()); + assert (!prev || prev->hpos_f() < here->hpos_f ()); + // Real dy=paper()->internote_f ()*2; Real dy = paper()->interbeam_f (); Real stemdx = paper()->rule_thickness (); Real sl = slope*paper()->internote_f (); @@ -317,48 +321,48 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev)const /* half beams extending to the left. */ if (prev) { - int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ; - int lwholebeams= here->beams_left_i_ beams_right_i_ ; - Real w = (here->hpos_f() - prev->hpos_f ())/4; - Symbol dummy; - Atom a (dummy); - if (lhalfs) // generates warnings if not - a = paper()->lookup_l ()->beam (sl, w); - a.translate (Offset (-w, -w * sl)); - for (int j = 0; j < lhalfs; j++) - { - Atom b (a); - b.translate (-dir_i_ * dy * (lwholebeams+j), Y_AXIS); - leftbeams.add (b); - } + int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ; + int lwholebeams= here->beams_left_i_ beams_right_i_ ; + Real w = (here->hpos_f() - prev->hpos_f ())/4; + Symbol dummy; + Atom a (dummy); + if (lhalfs) // generates warnings if not + a = paper()->lookup_l ()->beam (sl, w); + a.translate (Offset (-w, -w * sl)); + for (int j = 0; j < lhalfs; j++) + { + Atom b (a); + b.translate (-dir_ * dy * (lwholebeams+j), Y_AXIS); + leftbeams.add (b); + } } if (next) { - int rhalfs = here->beams_right_i_ - next->beams_left_i_; - int rwholebeams = here->beams_right_i_ beams_left_i_; + int rhalfs = here->beams_right_i_ - next->beams_left_i_; + int rwholebeams = here->beams_right_i_ beams_left_i_; - Real w = next->hpos_f() - here->hpos_f (); - Atom a = paper()->lookup_l ()->beam (sl, w + stemdx); + Real w = next->hpos_f() - here->hpos_f (); + Atom a = paper()->lookup_l ()->beam (sl, w + stemdx); - int j = 0; - for (; j < rwholebeams; j++) - { - Atom b (a); - b.translate (-dir_i_ * dy * j, Y_AXIS); - rightbeams.add (b); - } - - w /= 4; - if (rhalfs) - a = paper()->lookup_l ()->beam (sl, w); + int j = 0; + for (; j < rwholebeams; j++) + { + Atom b (a); + b.translate (-dir_ * dy * j, Y_AXIS); + rightbeams.add (b); + } + + w /= 4; + if (rhalfs) + a = paper()->lookup_l ()->beam (sl, w); - for (; j < rwholebeams + rhalfs; j++) - { - Atom b (a); - b.translate (-dir_i_ * dy * j, Y_AXIS); - rightbeams.add (b); - } + for (; j < rwholebeams + rhalfs; j++) + { + Atom b (a); + b.translate (-dir_ * dy * j, Y_AXIS); + rightbeams.add (b); + } } leftbeams.add (rightbeams); @@ -372,21 +376,21 @@ Beam::brew_molecule_p() const Molecule *mol_p = new Molecule; // huh? inter-what -// Real inter_f = paper()->interbeam_f (); + // Real inter_f = paper()->interbeam_f (); Real inter_f = paper()->internote_f (); Real x0 = stems[0]->hpos_f(); for (int j=0; j 0)? stems[j-1] : 0; - Stem * next = (j < stems.size()-1) ? stems[j+1] :0; - - Molecule sb = stem_beams (i, next, prev); - Real x = i->hpos_f()-x0; - sb.translate (Offset (x, (x * slope + left_pos)* inter_f)); - mol_p->add (sb); + Stem *i = stems[j]; + Stem * prev = (j > 0)? stems[j-1] : 0; + Stem * next = (j < stems.size()-1) ? stems[j+1] :0; + + Molecule sb = stem_beams (i, next, prev); + Real x = i->hpos_f()-x0; + sb.translate (Offset (x, (x * slope + left_pos)* inter_f)); + mol_p->add (sb); } - mol_p->translate (x0 - left_col_l_->hpos_f_, X_AXIS); + mol_p->translate (x0 - spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), X_AXIS); return mol_p; } @@ -394,7 +398,7 @@ Beam::brew_molecule_p() const IMPLEMENT_IS_TYPE_B1(Beam, Spanner); void -Beam::do_print()const +Beam::do_print() const { #ifndef NPRINT DOUT << "slope " <is_type_b (Stem::static_name())) { - stems.substitute ((Stem*)o->item(), n?(Stem*) n->item ():0); + stems.substitute ((Stem*)o->item(), n?(Stem*) n->item ():0); } } diff --git a/lily/crescendo.cc b/lily/crescendo.cc index d5c16cb442..3fe1a4114c 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -15,14 +15,14 @@ Crescendo::Crescendo() { - grow_dir_i_ =0; - dir_i_ = -1 ; - left_dyn_b_ = right_dyn_b_ =false; + grow_dir_ =0; + dir_ = DOWN ; + dyn_b_drul_[LEFT] = dyn_b_drul_[RIGHT] =false; inside_staff_b_ = false; } Interval -Crescendo::symbol_height()const +Crescendo::symbol_height() const { return get_symbol().dim[Y_AXIS]; } @@ -30,25 +30,25 @@ Crescendo::symbol_height()const static Real absdyn_dim = 10 PT; // ugh Symbol -Crescendo::get_symbol()const +Crescendo::get_symbol() const { Real w_dim = width().length (); - if ( left_dyn_b_) + if (dyn_b_drul_[LEFT]) { - w_dim -= absdyn_dim; + w_dim -= absdyn_dim; } - if ( right_dyn_b_) + if (dyn_b_drul_[RIGHT]) { - w_dim -= absdyn_dim; + w_dim -= absdyn_dim; } if (w_dim < 0) { - warning ("Crescendo too small"); - w_dim = 0; + warning ("Crescendo too small"); + w_dim = 0; } - return Symbol (paper()->lookup_l ()->hairpin (w_dim, grow_dir_i_ < 0)); + return Symbol (paper()->lookup_l ()->hairpin (w_dim, grow_dir_ < 0)); } Molecule* @@ -56,8 +56,8 @@ Crescendo::brew_molecule_p() const { Molecule* m_p =0; Real x_off_dim=0.0; - if ( left_dyn_b_) - x_off_dim += absdyn_dim; + if (dyn_b_drul_[LEFT]) + x_off_dim += absdyn_dim; m_p = new Molecule; Symbol s (get_symbol()); diff --git a/lily/directional-spanner.cc b/lily/directional-spanner.cc index 837fae76d9..62ab05f8b4 100644 --- a/lily/directional-spanner.cc +++ b/lily/directional-spanner.cc @@ -3,17 +3,17 @@ void Directional_spanner::set_default_dir() { - dir_i_ = -1; + dir_ = DOWN; } void Directional_spanner::do_pre_processing() { - if (!dir_i_) + if (!dir_) set_default_dir(); } Directional_spanner::Directional_spanner() { - dir_i_ = 0; + dir_ = CENTER; } diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 2346d1625c..64328afc97 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -22,22 +22,22 @@ class Musical_req : public virtual Request { public: - virtual Lyric_req* lreq_l() { return 0; } - virtual Note_req *note() { return 0;} - virtual Stem_req *stem() { return 0;} - virtual Melodic_req *melodic() { return 0; } - virtual Slur_req *slur() { return 0 ; } - virtual Beam_req *beam() { return 0 ; } - virtual Rhythmic_req*rhythmic() { return 0; } - virtual Musical_script_req*musicalscript() { return 0; } - virtual Text_req*text() { return 0; } - virtual Rest_req *rest() { return 0; } - virtual Skip_req* skip() { return 0; } - virtual Dynamic_req* dynamic() { return 0; } - virtual Absolute_dynamic_req * absdynamic() { return 0; } - virtual Tie_req * tie() { return 0; } - virtual Span_dynamic_req * span_dynamic() { return 0; } - REQUESTMETHODS(Musical_req, musical); + virtual Lyric_req* lreq_l() { return 0; } + virtual Note_req *note() { return 0;} + virtual Stem_req *stem() { return 0;} + virtual Melodic_req *melodic() { return 0; } + virtual Slur_req *slur() { return 0 ; } + virtual Beam_req *beam() { return 0 ; } + virtual Rhythmic_req*rhythmic() { return 0; } + virtual Musical_script_req*musicalscript() { return 0; } + virtual Text_req*text() { return 0; } + virtual Rest_req *rest() { return 0; } + virtual Skip_req* skip() { return 0; } + virtual Dynamic_req* dynamic() { return 0; } + virtual Absolute_dynamic_req * absdynamic() { return 0; } + virtual Tie_req * tie() { return 0; } + virtual Span_dynamic_req * span_dynamic() { return 0; } + REQUESTMETHODS(Musical_req, musical); }; @@ -47,50 +47,50 @@ public: */ class Rhythmic_req : public virtual Musical_req { public: - Duration duration_; + Duration duration_; - /* *************** */ - void set_duration (Duration); - bool do_equal_b (Request*)const; - virtual Moment duration() const; - Rhythmic_req(); - static int compare (Rhythmic_req const&,Rhythmic_req const&); - REQUESTMETHODS(Rhythmic_req, rhythmic); + /* *************** */ + void set_duration (Duration); + bool do_equal_b (Request*) const; + virtual Moment duration() const; + Rhythmic_req(); + static int compare (Rhythmic_req const&,Rhythmic_req const&); + REQUESTMETHODS(Rhythmic_req, rhythmic); }; class Skip_req : public Rhythmic_req { public: - REQUESTMETHODS(Skip_req, skip); + REQUESTMETHODS(Skip_req, skip); }; struct Spacing_req :virtual Request { - Moment next; - Real distance; - Real strength; - /* *************** */ - Spacing_req(); - REQUESTMETHODS(Spacing_req, spacing); + Moment next; + Real distance; + Real strength; + /* *************** */ + Spacing_req(); + REQUESTMETHODS(Spacing_req, spacing); }; class Blank_req : public Spacing_req, Rhythmic_req { public: - REQUESTMETHODS(Spacing_req, spacing); + REQUESTMETHODS(Spacing_req, spacing); }; /// Put a text above or below (?) this staff. class Text_req : public virtual Musical_req { public: - /// preferred position (above/below) - int dir_i_; - /// the characteristics of the text - Text_def *tdef_p_; + /// preferred position (above/below) + Direction dir_; + /// the characteristics of the text + Text_def *tdef_p_; - /* *************** */ - Text_req (int d, Text_def*); - ~Text_req(); - Text_req (Text_req const&); + /* *************** */ + Text_req (int d, Text_def*); + ~Text_req(); + Text_req (Text_req const&); - REQUESTMETHODS(Text_req,text); + REQUESTMETHODS(Text_req,text); }; /** Put a text in lyric_staff @@ -98,65 +98,55 @@ public: */ class Lyric_req : public Rhythmic_req, public Text_req { public: - Lyric_req (Text_def* t_p); - REQUESTMETHODS(Lyric_req, lreq_l); + Lyric_req (Text_def* t_p); + REQUESTMETHODS(Lyric_req, lreq_l); }; /// request which has some kind of pitch struct Melodic_req :virtual Musical_req { - /// 0 is c, 6 is b - int notename_i_; - /// 0 is central c - int octave_i_; + /// 0 is c, 6 is b + int notename_i_; + /// 0 is central c + int octave_i_; /// 0 natural, 1 sharp, etc - int accidental_i_; + int accidental_i_; - /// return height from central c (in halflines) - int height()const; + /// return height from central c (in halflines) + int height() const; - /// transpose. #delta# is relative to central c. - void transpose (Melodic_req const &delta); - /// return pitch from central c (in halfnotes) - int pitch()const; - Melodic_req(); - bool do_equal_b (Request*)const; - static int compare (Melodic_req const&,Melodic_req const&); - REQUESTMETHODS(Melodic_req,melodic); + /// transpose. #delta# is relative to central c. + void transpose (Melodic_req const &delta); + /// return pitch from central c (in halfnotes) + int pitch() const; + Melodic_req(); + bool do_equal_b (Request*) const; + static int compare (Melodic_req const&,Melodic_req const&); + REQUESTMETHODS(Melodic_req,melodic); }; /// Put a note of specified type, height, and with accidental on the staff. class Note_req : public Rhythmic_req, virtual public Melodic_req { public: - /// force/supress printing of accidental. - bool forceacc_b_; - Note_req(); - bool do_equal_b (Request*)const; - Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic (); } - REQUESTMETHODS(Note_req, note); - }; + /// force/supress printing of accidental. + bool forceacc_b_; + Note_req(); + bool do_equal_b (Request*) const; + Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic (); } + REQUESTMETHODS(Note_req, note); +}; /** Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded. */ class Rest_req : public Rhythmic_req { public: - REQUESTMETHODS(Rest_req,rest); + REQUESTMETHODS(Rest_req,rest); }; -/** - attach a stem to the noteball. - Rhythmic_req parent needed to determine if it will fit inside a beam. - */ -class Stem_req : public Rhythmic_req { -public: - /// preferred direction for the stem - int dir_i_; - Stem_req(); - REQUESTMETHODS(Stem_req,stem); -}; + /** Requests to start or stop something. @@ -164,14 +154,14 @@ public: */ class Span_req : public virtual Musical_req { public: - /// should the spanner start or stop, or is it unwanted? - enum { - NOSPAN, START, STOP - } spantype ; - bool do_equal_b (Request*)const; - REQUESTMETHODS(Span_req,span); + /// should the spanner start or stop, or is it unwanted? + enum { + NOSPAN, START, STOP + } spantype ; + bool do_equal_b (Request*) const; + REQUESTMETHODS(Span_req,span); - Span_req(); + Span_req(); }; @@ -179,12 +169,12 @@ public: will try to put an appropriate number over the beam */ class Beam_req : public Span_req { public: - int nplet; + int nplet; - /* *************** */ - REQUESTMETHODS(Beam_req,beam); + /* *************** */ + REQUESTMETHODS(Beam_req,beam); - Beam_req(); + Beam_req(); }; /** @@ -192,45 +182,45 @@ public: */ class Tie_req : public Musical_req { public: - REQUESTMETHODS(Tie_req, tie); + REQUESTMETHODS(Tie_req, tie); }; /// a slur class Slur_req : public Span_req { public: - REQUESTMETHODS(Slur_req,slur); + REQUESTMETHODS(Slur_req,slur); }; class Musical_script_req : public Musical_req, public Script_req { public: - REQUESTMETHODS(Musical_script_req, musicalscript); + REQUESTMETHODS(Musical_script_req, musicalscript); }; class Dynamic_req : public virtual Musical_req { public: - /// for absolute dynamics - enum Loudness { - FFF, FF, F, MF, MP, P, PP, PPP - }; - static String loudness_str (Loudness); - REQUESTMETHODS(Dynamic_req, dynamic); + /// for absolute dynamics + enum Loudness { + FFF, FF, F, MF, MP, P, PP, PPP + }; + static String loudness_str (Loudness); + REQUESTMETHODS(Dynamic_req, dynamic); }; class Absolute_dynamic_req : public Dynamic_req { public: - Loudness loudness_; - Absolute_dynamic_req(); - REQUESTMETHODS(Absolute_dynamic_req, absdynamic); + Loudness loudness_; + Absolute_dynamic_req(); + REQUESTMETHODS(Absolute_dynamic_req, absdynamic); }; class Span_dynamic_req : public Dynamic_req, public Span_req { public: - /// Grow or shrink the volume: 1=cresc, -1 = decresc - int dynamic_dir_i_; - Span_dynamic_req(); - REQUESTMETHODS(Span_dynamic_req, span_dynamic); + /// Grow or shrink the volume: 1=cresc, -1 = decresc + Direction dynamic_dir_; + Span_dynamic_req(); + REQUESTMETHODS(Span_dynamic_req, span_dynamic); }; #endif // MUSICALREQUESTS_HH diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 6fab4812b5..c6826f2cfc 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -33,7 +33,7 @@ public: int dots_i_; int balltype_i_; int dot_delta_y_i_; - int x_dir_i_; + Direction x_dir_; /* *************** */ @@ -46,9 +46,9 @@ public: void set_dots(); static int compare (Note_head * const &a, Note_head *const &b) ; protected: - virtual void do_print()const; + virtual void do_print() const; virtual void do_pre_processing(); - virtual Molecule* brew_molecule_p()const; + virtual Molecule* brew_molecule_p() const; }; #endif // NOTEHEAD_HH diff --git a/lily/include/script-def.hh b/lily/include/script-def.hh index 1dd72b7ec7..ac5bf63561 100644 --- a/lily/include/script-def.hh +++ b/lily/include/script-def.hh @@ -12,37 +12,37 @@ /** The characteristics of a certain kind of accent. It is not the accent itself. */ class Script_def : public General_script_def { - /// invert if below staff? - bool invertsym_b_; - String symidx_str_; + /// invert if below staff? + bool invertsym_b_; + String symidx_str_; - /// on the other side of the stem? - int rel_stem_dir_i_; + /// on the other side of the stem? + Direction rel_stem_dir_; - /// below or above staff? - int staff_dir_i_; + /// below or above staff? + Direction staff_dir_; - /// how close to the note do we want to be? - int priority_i_; + /// how close to the note do we want to be? + int priority_i_; - /// follow the ball inside staff? - bool inside_staff_b_; + /// follow the ball inside staff? + bool inside_staff_b_; public: - virtual int staff_dir_i()const; - virtual int rel_stem_dir_i()const; - virtual int priority_i()const; - virtual bool inside_b()const; - virtual Atom get_atom (Paper_def* p, int dir_i_)const; - DECLARE_MY_RUNTIME_TYPEINFO; - - virtual bool do_equal_b (General_script_def const *)const; - virtual void do_print() const; - Script_def(); - void set_from_input (String, bool, int, int ,bool,int); + virtual Direction staff_dir() const; + virtual Direction rel_stem_dir() const; + virtual int priority_i() const; + virtual bool inside_b() const; + virtual Atom get_atom (Paper_def* p, Direction dir_) const; + DECLARE_MY_RUNTIME_TYPEINFO; + + virtual bool do_equal_b (General_script_def const *) const; + virtual void do_print() const; + Script_def(); + void set_from_input (String, bool, int, int ,bool,int); protected: - VIRTUAL_COPY_CONS(Script_def,General_script_def); + VIRTUAL_COPY_CONS(Script_def,General_script_def); }; diff --git a/lily/lyric-grav.cc b/lily/lyric-grav.cc index c29b46d5fe..a10cf614b2 100644 --- a/lily/lyric-grav.cc +++ b/lily/lyric-grav.cc @@ -33,12 +33,12 @@ Lyric_engraver::do_try_request (Request*r) void Lyric_engraver::do_process_requests() { - if ( lreq_l_) + if (lreq_l_) { lyric_item_p_ = new Text_item (lreq_l_->tdef_p_); lyric_item_p_->translate (paper()->note_width ()/2 , X_AXIS); - lyric_item_p_->dir_i_ = -1; + lyric_item_p_->dir_ = DOWN; lyric_item_p_->fat_b_ = true; announce_element (Score_elem_info (lyric_item_p_, lreq_l_)); } @@ -53,7 +53,7 @@ Lyric_engraver::do_post_move_processing() void Lyric_engraver::do_pre_move_processing() { - if ( lyric_item_p_) + if (lyric_item_p_) { typeset_element (lyric_item_p_); lyric_item_p_ =0; diff --git a/lily/note-column-grav.cc b/lily/note-column-grav.cc index 34e12316d0..a77557793e 100644 --- a/lily/note-column-grav.cc +++ b/lily/note-column-grav.cc @@ -14,19 +14,19 @@ #include "rest-column.hh" bool -Note_column_engraver::acceptable_elem_b (Score_elem const*elem_C)const +Note_column_engraver::acceptable_elem_b (Score_elem const*elem_C) const { char const*nC = elem_C->name(); return (nC == Script::static_name() || nC == Note_head::static_name () - || nC == Stem::static_name()); + || nC == Stem::static_name()); } Note_column* Note_column_engraver::note_col_l() { if (!ncol_p_) { - ncol_p_ = new Note_column; - announce_element (Score_elem_info (ncol_p_, 0)); + ncol_p_ = new Note_column; + announce_element (Score_elem_info (ncol_p_, 0)); } return ncol_p_; } @@ -36,8 +36,8 @@ Note_column_engraver::rest_col_l() { if (!restcol_p_) { - restcol_p_ = new Rest_column; - announce_element (Score_elem_info (restcol_p_,0)); + restcol_p_ = new Rest_column; + announce_element (Score_elem_info (restcol_p_,0)); } return restcol_p_; } @@ -46,49 +46,49 @@ void Note_column_engraver::acknowledge_element (Score_elem_info i) { if (!acceptable_elem_b (i.elem_l_)) - return; + return; char const*nC = i.elem_l_->name(); if (nC == Script::static_name() && i.req_l_ && i.req_l_->musical ()) { - script_l_arr_.push ((Script*)i.elem_l_->item()); + script_l_arr_.push ((Script*)i.elem_l_->item()); } else if (nC == Note_head::static_name()) { - Note_head * h_l = (Note_head*)i.elem_l_->item(); - if (h_l->rest_b_) - rest_col_l()->add (h_l); - else - note_col_l()->add (h_l); + Note_head * h_l = (Note_head*)i.elem_l_->item(); + if (h_l->rest_b_) + rest_col_l()->add (h_l); + else + note_col_l()->add (h_l); } else if (nC == Stem::static_name()) { - stem_l_ = (Stem*)i.elem_l_->item(); + stem_l_ = (Stem*)i.elem_l_->item(); } - if ( ncol_p_ || restcol_p_) + if (ncol_p_ || restcol_p_) { - if ( stem_l_) - { - if (restcol_p_&& !restcol_p_->stem_l_) - restcol_p_->set (stem_l_); - if (ncol_p_ && !ncol_p_->stem_l_) - ncol_p_->set (stem_l_); - } + if (stem_l_) + { + if (restcol_p_&& !restcol_p_->stem_l_) + restcol_p_->set (stem_l_); + if (ncol_p_ && !ncol_p_->stem_l_) + ncol_p_->set (stem_l_); + } - for (int i=0; i < script_l_arr_.size(); i++) - { - if (restcol_p_) - restcol_p_->add (script_l_arr_[i]); - if ( ncol_p_) - ncol_p_->add (script_l_arr_[i]); - } + for (int i=0; i < script_l_arr_.size(); i++) + { + if (restcol_p_) + restcol_p_->add (script_l_arr_[i]); + if (ncol_p_) + ncol_p_->add (script_l_arr_[i]); + } - script_l_arr_.clear(); + script_l_arr_.clear(); } } @@ -98,21 +98,21 @@ Note_column_engraver::do_pre_move_processing() { if (ncol_p_) { - if (! ncol_p_->h_shift_b_) - ncol_p_->h_shift_b_ = h_shift_b_; - if (! ncol_p_->dir_i_) - ncol_p_->dir_i_ = dir_i_; + if (! ncol_p_->h_shift_b_) + ncol_p_->h_shift_b_ = h_shift_b_; + if (! ncol_p_->dir_) + ncol_p_->dir_ = dir_; - typeset_element (ncol_p_); - ncol_p_ =0; + typeset_element (ncol_p_); + ncol_p_ =0; } if (restcol_p_) { - if (! restcol_p_->dir_i_) - restcol_p_->dir_i_ = dir_i_; + if (! restcol_p_->dir_) + restcol_p_->dir_ = dir_; - typeset_element (restcol_p_); - restcol_p_ =0; + typeset_element (restcol_p_); + restcol_p_ =0; } } @@ -126,15 +126,15 @@ Note_column_engraver::do_post_move_processing() void Note_column_engraver::set_feature (Feature i) { - if (i.type_ == "vdir") - dir_i_ = i.value_; - if (i.type_ == "hshift") - h_shift_b_ = (bool)(int)i.value_; + if (i.type_ == "vdir") + dir_ = (Direction) int(i.value_); + if (i.type_ == "hshift") + h_shift_b_ = (bool)(int)i.value_; } Note_column_engraver::Note_column_engraver() { - dir_i_ =0; + dir_ =CENTER; h_shift_b_ = false; ncol_p_=0; diff --git a/lily/note-column.cc b/lily/note-column.cc index 19cf429928..f310d0828c 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -14,13 +14,6 @@ IMPLEMENT_IS_TYPE_B1(Note_column,Head_column); -void -Note_column::set (Stem*s) -{ - stem_l_ = s; - add_support (s); -} - Note_column::Note_column() { h_shift_b_ =false; @@ -33,10 +26,10 @@ Note_column::sort() } Interval_t -Note_column::head_positions_interval()const +Note_column::head_positions_interval() const { ((Note_column*)this)->sort(); - return Interval_t ( head_l_arr_[0]->position_i_, + return Interval_t (head_l_arr_[0]->position_i_, head_l_arr_.top()->position_i_); } @@ -45,9 +38,9 @@ Note_column::head_positions_interval()const void Note_column::do_pre_processing() { - if (!dir_i_&& !stem_l_) + if (!dir_&& !stem_l_) { - dir_i_ = (head_positions_interval().center () >= 5) ? -1 : 1; + dir_ = (head_positions_interval().center () >= 5) ? DOWN:UP; } Head_column::do_pre_processing(); } diff --git a/lily/notehead.cc b/lily/notehead.cc index 6871240ff9..0afaabd49f 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -31,7 +31,7 @@ Note_head::Note_head (int ss) { - x_dir_i_ = 0; + x_dir_ = CENTER; staff_size_i_=ss; position_i_ = 0; balltype_i_ = 0; @@ -46,14 +46,14 @@ Note_head::do_pre_processing() { // 8 ball looks the same as 4 ball: if (balltype_i_ > 2 && !rest_b_) - balltype_i_ = 2; + balltype_i_ = 2; if (rest_b_) { - if (balltype_i_ == 0) - position_i_ += 6; - else if (balltype_i_ == 0) - position_i_ += 4; + if (balltype_i_ == 0) + position_i_ += 6; + else if (balltype_i_ == 0) + position_i_ += 4; } } @@ -68,13 +68,13 @@ Note_head::set_rhythmic (Rhythmic_req*r_req_l) IMPLEMENT_IS_TYPE_B1(Note_head,Item); void -Note_head::do_print()const +Note_head::do_print() const { #ifndef NPRINT if (rest_b_) - DOUT << "REST! "; + DOUT << "REST! "; DOUT << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_ - << "dots_i_ " << dots_i_; + << "dots_i_ " << dots_i_; #endif } @@ -89,9 +89,9 @@ void Note_head::set_dots() { if (!(position_i_ %2) && rest_b_ && balltype_i_ == 0) - dot_delta_y_i_ = -1; + dot_delta_y_i_ = -1; else if (!(position_i_ %2)) - dot_delta_y_i_ = 1; + dot_delta_y_i_ = 1; } /* @@ -110,39 +110,39 @@ Note_head::brew_molecule_p() const bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1); if (!rest_b_) - s = p->lookup_l()->ball (balltype_i_); + s = p->lookup_l()->ball (balltype_i_); else { - s = p->lookup_l()->rest (balltype_i_, streepjes_b); + s = p->lookup_l()->rest (balltype_i_, streepjes_b); } out = new Molecule (Atom (s)); - out->translate (x_dir_i_ * s.dim.x().length () , X_AXIS); + out->translate (x_dir_ * s.dim.x().length () , X_AXIS); if (dots_i_) { - Symbol d = p->lookup_l()->dots (dots_i_); - Molecule dm; - dm.add (Atom (d)); - dm.translate (inter_f * dot_delta_y_i_ , Y_AXIS); - out->add_right (dm); + Symbol d = p->lookup_l()->dots (dots_i_); + Molecule dm; + dm.add (Atom (d)); + dm.translate (inter_f * dot_delta_y_i_ , Y_AXIS); + out->add_right (dm); } if (rest_b_) { - streepjes_b = false; + streepjes_b = false; } if (streepjes_b) { - int dir = sign (position_i_); - int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2; + int dir = sign (position_i_); + int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2; - Symbol str = p->lookup_l()->streepjes (s); - Molecule sm; - sm.add (Atom (str)); - if (position_i_ % 2) - sm.translate (-inter_f* dir, Y_AXIS); - out->add (sm); + Symbol str = p->lookup_l()->streepjes (s); + Molecule sm; + sm.add (Atom (str)); + if (position_i_ % 2) + sm.translate (-inter_f* dir, Y_AXIS); + out->add (sm); } out->translate (inter_f*position_i_, Y_AXIS); diff --git a/lily/script.cc b/lily/script.cc index e27086c40d..ea3bfbef20 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -27,7 +27,7 @@ Script::do_substitute_dependency (Score_elem*o,Score_elem*n) Staff_side::do_substitute_dependency (o,n); if (o == stem_l_) { - stem_l_ = n ? (Stem*)n->item() : 0; + stem_l_ = n ? (Stem*)n->item() : 0; } } @@ -44,35 +44,35 @@ Script::Script() specs_l_ = 0; inside_staff_b_ = false; stem_l_ = 0; - dir_i_ = 0; + dir_ = CENTER; } void Script::set_default_dir() { - int s_i=specs_l_->rel_stem_dir_i(); + int s_i=specs_l_->rel_stem_dir(); if (s_i) { - if (stem_l_) - dir_i_ = stem_l_->dir_i_ * s_i; - else - { - specs_l_->warning ("Script needs stem direction"); - dir_i_ = -1; - } + if (stem_l_) + dir_ = stem_l_->dir_ * s_i; + else + { + specs_l_->warning ("Script needs stem direction"); + dir_ = DOWN; + } } else { - dir_i_ =specs_l_->staff_dir_i(); + dir_ =specs_l_->staff_dir(); } - assert (dir_i_); + assert (dir_); } Interval Script::do_width() const { - return specs_l_->get_atom (paper(), dir_i_).extent ().x (); + return specs_l_->get_atom (paper(), dir_).extent ().x (); } void @@ -80,18 +80,18 @@ Script::do_pre_processing() { if (breakable_b_ && break_status_i() != 1) { - transparent_b_ = empty_b_ = true; + transparent_b_ = empty_b_ = true; } - if (!dir_i_) - set_default_dir(); + if (!dir_) + set_default_dir(); inside_staff_b_ = specs_l_->inside_b(); } Interval -Script::symbol_height()const +Script::symbol_height() const { - return specs_l_->get_atom (paper(), dir_i_).extent ().y (); + return specs_l_->get_atom (paper(), dir_).extent ().y (); } Molecule* @@ -99,7 +99,7 @@ Script::brew_molecule_p() const { Real dy = paper()->internote_f (); - Molecule*out = new Molecule (specs_l_->get_atom (paper(), dir_i_)); + Molecule*out = new Molecule (specs_l_->get_atom (paper(), dir_)); out->translate (dy * pos_i_, Y_AXIS); return out; } diff --git a/lily/slur-grav.cc b/lily/slur-grav.cc index 1657e2e12a..a96eae70cb 100644 --- a/lily/slur-grav.cc +++ b/lily/slur-grav.cc @@ -17,7 +17,7 @@ Slur_engraver::do_try_request (Request *req_l) { Musical_req *mus_l = req_l->musical(); if (!mus_l || !mus_l->slur()) - return false; + return false; new_slur_req_l_arr_.push (mus_l->slur()); return true; @@ -28,11 +28,11 @@ Slur_engraver::acknowledge_element (Score_elem_info info) { if (info.elem_l_->name() == Note_column::static_name ()) { - Note_column *col_l =(Note_column*) info.elem_l_->item() ;// ugh - for (int i = 0; i < slur_l_stack_.size(); i++) - slur_l_stack_[i]->add (col_l); - for (int i = 0; i < end_slur_l_arr_.size(); i++) - end_slur_l_arr_[i]->add (col_l); + Note_column *col_l =(Note_column*) info.elem_l_->item() ;// ugh + for (int i = 0; i < slur_l_stack_.size(); i++) + slur_l_stack_[i]->add (col_l); + for (int i = 0; i < end_slur_l_arr_.size(); i++) + end_slur_l_arr_[i]->add (col_l); } } @@ -40,7 +40,7 @@ void Slur_engraver::set_feature (Feature f) { if (f.type_ == "vdir") - dir_i_ = f.value_ ; + dir_ = (Direction)int(f.value_); } /* @@ -48,7 +48,7 @@ Slur_engraver::set_feature (Feature f) */ Slur_engraver::Slur_engraver() { - dir_i_ =0; + dir_ =CENTER; } void Slur_engraver::do_process_requests() @@ -56,31 +56,31 @@ Slur_engraver::do_process_requests() Array start_slur_l_arr_; for (int i=0; i< new_slur_req_l_arr_.size(); i++) { - Slur_req* slur_req_l = new_slur_req_l_arr_[i]; - // end slur: move the slur to other array - if (slur_req_l->spantype == Span_req::STOP) - { - if (slur_l_stack_.empty()) + Slur_req* slur_req_l = new_slur_req_l_arr_[i]; + // end slur: move the slur to other array + if (slur_req_l->spantype == Span_req::STOP) + { + if (slur_l_stack_.empty()) - slur_req_l->warning ("can't find slur to end"); - else - { - end_slur_l_arr_.push (slur_l_stack_.pop()); - requests_arr_.pop(); - } - } - else if (slur_req_l->spantype == Span_req::START) - { - // push a new slur onto stack. - //(use temp. array to wait for all slur STOPs) - Slur * s_p =new Slur; - requests_arr_.push (slur_req_l); - start_slur_l_arr_.push (s_p); - announce_element (Score_elem_info (s_p, slur_req_l)); - } + slur_req_l->warning ("can't find slur to end"); + else + { + end_slur_l_arr_.push (slur_l_stack_.pop()); + requests_arr_.pop(); + } + } + else if (slur_req_l->spantype == Span_req::START) + { + // push a new slur onto stack. + //(use temp. array to wait for all slur STOPs) + Slur * s_p =new Slur; + requests_arr_.push (slur_req_l); + start_slur_l_arr_.push (s_p); + announce_element (Score_elem_info (s_p, slur_req_l)); + } } for (int i=0; i < start_slur_l_arr_.size(); i++) - slur_l_stack_.push (start_slur_l_arr_[i]); + slur_l_stack_.push (start_slur_l_arr_[i]); } void @@ -88,9 +88,9 @@ Slur_engraver::do_pre_move_processing() { for (int i = 0; i < end_slur_l_arr_.size(); i++) { - if (dir_i_) - end_slur_l_arr_[i]->dir_i_ = dir_i_; - typeset_element (end_slur_l_arr_[i]); + if (dir_) + end_slur_l_arr_[i]->dir_ = dir_; + typeset_element (end_slur_l_arr_[i]); } end_slur_l_arr_.clear(); } @@ -104,7 +104,7 @@ Slur_engraver::~Slur_engraver() { for (int i=0; i < requests_arr_.size(); i++) { - requests_arr_[i]->warning ("unterminated slur"); + requests_arr_[i]->warning ("unterminated slur"); } } diff --git a/lily/slur.cc b/lily/slur.cc index 54c5b5009d..87dea00618 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -7,12 +7,10 @@ */ /* - TODO: think about crossing stems. Begin and end should be treated as a Script. - */ #include "slur.hh" #include "scalar.hh" @@ -37,22 +35,22 @@ Slur::add (Note_column*n) void Slur::set_default_dir() { - dir_i_ = -1; + dir_ = DOWN; for (int i=0; i < encompass_arr_.size(); i ++) { - if (encompass_arr_[i]->dir_i_ < 0) - { - dir_i_ =1; - break; - } + if (encompass_arr_[i]->dir_ < 0) + { + dir_ =UP; + break; + } } } void Slur::do_pre_processing() { - right_col_l_ = encompass_arr_.top()->pcol_l_; - left_col_l_ = encompass_arr_[0]->pcol_l_; + set_bounds(LEFT, encompass_arr_[0]); + set_bounds(RIGHT, encompass_arr_.top()); } @@ -62,10 +60,10 @@ Slur::do_substitute_dependency (Score_elem*o, Score_elem*n) int i; while ((i = encompass_arr_.find_i ((Note_column*)o->item())) >=0) { - if (n) - encompass_arr_[i] = (Note_column*)n->item(); - else - encompass_arr_.del (i); + if (n) + encompass_arr_[i] = (Note_column*)n->item(); + else + encompass_arr_.del (i); } } @@ -73,29 +71,31 @@ Slur::do_substitute_dependency (Score_elem*o, Score_elem*n) static int Note_column_compare (Note_column *const&n1 , Note_column* const&n2) { - return n1->pcol_l_->rank_i() - n2->pcol_l_->rank_i (); + return Item::left_right_compare(n1, n2); } void Slur::do_post_processing() { encompass_arr_.sort (Note_column_compare); - if (!dir_i_) - set_default_dir(); + if (!dir_) + set_default_dir(); Real inter_f = paper()->internote_f (); - if (encompass_arr_[0]->stem_l_) - left_pos_i_ = rint (encompass_arr_[0]->stem_l_->height()[dir_i_]/inter_f); - else - left_pos_i_ = rint ( encompass_arr_[0]->head_positions_interval()[dir_i_]); - - if (encompass_arr_.top()->stem_l_) - right_pos_i_ = rint (encompass_arr_.top()->stem_l_->height ()[dir_i_]/inter_f); - else - right_pos_i_ = rint (encompass_arr_.top()->head_positions_interval ()[dir_i_]); + Drul_array extrema; + extrema[LEFT] = encompass_arr_[0]; + extrema[RIGHT] = encompass_arr_.top(); - left_pos_i_ += dir_i_; - right_pos_i_ += dir_i_; + Direction d=LEFT; + do + { + if (extrema[d]->stem_l_ && !extrema[d]->stem_l_->transparent_b_) + pos_i_drul_[d] = (int)rint (extrema[d]->stem_l_->height()[dir_]/inter_f); + else + pos_i_drul_[d] = (int)rint (extrema[d]->head_positions_interval()[dir_]); + pos_i_drul_[d] += dir_; + } + while ((d *= -1) != LEFT); } IMPLEMENT_IS_TYPE_B1(Slur,Spanner);