From 591ac899640292c49c6ca5ef245098c87dbc2a40 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:36:20 +0000 Subject: [PATCH] lilypond-0.0.44 --- lily/note.cc | 183 +-------------------------------------------------- lily/rest.cc | 18 +++-- 2 files changed, 16 insertions(+), 185 deletions(-) diff --git a/lily/note.cc b/lily/note.cc index 9c26c57f08..0d43d53234 100644 --- a/lily/note.cc +++ b/lily/note.cc @@ -16,138 +16,7 @@ #include "parseconstruct.hh" #include "input-music.hh" #include "voice-element.hh" -Moment -Lexer_prefs::plet_mom() -{ - return Moment(default_plet_dur, default_plet_type); -} -Lexer_prefs::Lexer_prefs() -{ - default_duration = 4, default_dots=0, default_octave_i_=0; - default_plet_type = 1, default_plet_dur = 1; - textstyle_str_="roman"; // in lexer? - - last_duration_mode = false; -} - -void -Lexer_prefs::set_duration_mode(String s) -{ - s = s.upper_str(); - last_duration_mode = (s== "LAST"); -} - -void -Lexer_prefs::set_last_duration(int n) -{ - if (last_duration_mode) - default_duration = n; -} - -/* triplet is '2/3' */ -void -Lexer_prefs::set_plet(int num,int den) -{ - assert(num >0&& den>0); - default_plet_dur = num; - default_plet_type = den; -} - -Text_def* -get_text(String s) return t; -{ - t= new Text_def; - t->text_str_= s; - t->style_str_ = lexer->prefs.textstyle_str_; - t->defined_ch_c_l_ = defined_ch_c_l; - return t; -} -Voice_element * -get_note_element(Note_req *rq, int * duration ) -{ - Voice_element*v = new Voice_element; - v->defined_ch_c_l_ = defined_ch_c_l; - - int dur = duration[0]; - int dots = duration[1]; - - if (dur >= 2) { - Stem_req * stem_req_p = new Stem_req(dur,dots); - stem_req_p->plet_factor = lexer->prefs.plet_mom(); - - stem_req_p->defined_ch_c_l_ = defined_ch_c_l; - v->add(stem_req_p); - } - - if ( !defined_ch_c_l ) - defined_ch_c_l = lexer->here_ch_c_l(); - - rq->balltype = dur; - rq->dots = dots; - rq->plet_factor = lexer->prefs.plet_mom(); - - rq->defined_ch_c_l_ = defined_ch_c_l; - - v->add(rq); - - return v; -} - -Voice_element* -get_word_element(Text_def* tdef_p, int* duration) -{ - Voice_element* velt_p = new Voice_element; - velt_p->defined_ch_c_l_ = defined_ch_c_l; - - int dur = duration[0]; - int dots=duration[1]; - - tdef_p->defined_ch_c_l_ = defined_ch_c_l; - - Lyric_req* lreq_p = new Lyric_req(tdef_p); - - lreq_p->balltype = dur; - lreq_p->dots = dots; - lreq_p->plet_factor = lexer->prefs.plet_mom(); - lreq_p->print(); - lreq_p->defined_ch_c_l_ = defined_ch_c_l; - - velt_p->add(lreq_p); - - return velt_p; -} -Voice_element * -get_rest_element(String, int * duration ) -{ - Voice_element* velt_p = new Voice_element; - velt_p->defined_ch_c_l_ = defined_ch_c_l; - - Rest_req * rest_req_p = new Rest_req; - rest_req_p->plet_factor = lexer->prefs.plet_mom(); - rest_req_p->balltype = duration[0]; - rest_req_p->dots = duration[1]; - rest_req_p->print(); - rest_req_p->defined_ch_c_l_ = defined_ch_c_l; - - velt_p->add(rest_req_p); - - return velt_p; -} - -void -Lexer_prefs::get_default_duration(int *p) -{ - *p++ = default_duration; - *p = default_dots; -} - -void -Lexer_prefs::set_default_duration(int *p) -{ - default_duration = *p++; - default_dots = *p++; -} Request* get_plet_request( char c, int dur_i, int type_i ) @@ -159,53 +28,6 @@ get_plet_request( char c, int dur_i, int type_i ) return plet_req_p; } -Request* -get_request(char c) -{ - Request* req_p=0; - switch (c) { - case '|': - req_p = new Barcheck_req; - break; - - case '[': - case ']': - { - Beam_req*b = new Beam_req; - int p_i=lexer->prefs.default_plet_type ; - if (p_i!= 1) - b->nplet = p_i; - req_p = b; - } - break; - - - case ')': - case '(': - req_p = new Slur_req; - break; - default: - assert(false); - break; - } - - switch (c) { - case '(': - case '[': - req_p->span()->spantype = Span_req::START; - break; - case ')': - case ']': - req_p->span()->spantype = Span_req::STOP; - break; - - default: - break; - } - - req_p->defined_ch_c_l_ = req_defined_ch_c_l; - return req_p; -} void add_requests(Voice_element *v, Array &req) @@ -215,8 +37,7 @@ add_requests(Voice_element *v, Array &req) } req.set_size(0); } - -Script_def* +String * get_scriptdef(char c) { String s; @@ -238,7 +59,7 @@ get_scriptdef(char c) case '.' : s = "staccato"; break; } - return lexer->lookup_identifier(s)->script(1); + return new String(s); } Request* diff --git a/lily/rest.cc b/lily/rest.cc index 39347b1d5b..97f91a6a6a 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -1,15 +1,24 @@ +/* + rest.cc -- implement Rest + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ +#include "duration.hh" #include "rest.hh" #include "dimen.hh" #include "debug.hh" #include "paper-def.hh" #include "lookup.hh" #include "molecule.hh" +#include "rest.hh" - -Rest::Rest(int t, int d) +Rest::Rest(Duration d) { - balltype = t; - dots = d; + balltype = d.type_i_; + dots = d.dots_i_; + pos_i_ = 0; } @@ -37,6 +46,7 @@ Rest::brew_molecule_p()const dm.add(Atom(d)); m->add_right(dm); } + m->translate(Offset(0,pos_i_ * paper()->internote())); return m; } -- 2.39.5