]> git.donarmstrong.com Git - lilypond.git/blobdiff - src/request.cc
release: 0.0.28
[lilypond.git] / src / request.cc
index 6f3778a66d5d0af9730f12f1d0880af70d821d2e..0a5c8dc3d842fdd9661cddf86e8e53f5226d648e 100644 (file)
 #include "request.hh"
+#include "misc.hh"
 #include "debug.hh"
+#include "scriptdef.hh"
+#include "textdef.hh"
 
-#define VIRTUALCONS(T,R) R *T::clone() const { return  new T(*this); } struct T
-#define RCONS(T) VIRTUALCONS(T, Request)
+#include "inputcommand.hh"
 
-RCONS(Rest_req);
-RCONS(Rhythmic_req);
-RCONS(Stem_req);
-RCONS(Note_req);
-RCONS(Span_req);
-RCONS(Slur_req);
-RCONS(Beam_req);
+void
+Stem_req::do_print() const
+{
+    Rhythmic_req::do_print();
+    mtor << "dir : " << dir_i_;
+}
+
+Stem_req::Stem_req(int s, int d)
+    : Rhythmic_req(s,d)
+{
+    dir_i_ = 0;
+}
 
+/****************/
 void
-Request::print() const    
+Barcheck_req::do_print() const    
 {
 #ifndef NPRINT
-    mtor << "Req{ unknown }\n";
+
 #endif
 }
 
-Request::Request()
+/****************/
+
+void
+Request::print() const
+
+{
+    mtor << name() << " {";
+    do_print();
+    mtor << "}\n";
+}
+     
+
+void
+Request::do_print() const    
+{
+#ifndef NPRINT
+#endif
+}
+
+void
+Span_req::do_print() const    
 {
-    elt = 0;
+#ifndef NPRINT
+    mtor  << spantype ;
+#endif
 }
 
-Note_req::Note_req()
+Request::Request()
 {
-    name = 0;
+    elt_l_ = 0;
+    defined_ch_c_l_m = 0;
+}
+Request::Request(Request const&src)
+{
+    elt_l_ = 0;
+    defined_ch_c_l_m = src.defined_ch_c_l_m;
+}
+/****************/
+Spacing_req::Spacing_req()
+{
+    next = 0;
+    distance = 0;
+    strength = 0;
+}
+void
+Spacing_req::do_print()const
+{
+    mtor << "next " << next << "dist " << distance << "strength\n";
+}
+void
+Blank_req::do_print()const
+{
+    Spacing_req::do_print();
+}
+/****************/
+Melodic_req::Melodic_req()
+{
+    notename = 0;
     octave = 0;
     accidental = 0;
     forceacc = false;
 }
 
+void
+Melodic_req::do_print() const
+{
+    mtor << "notename: " << notename << " oct: "<< octave;
+}
+
 int
-Note_req::height() const
+Melodic_req::height() const
 {
-    return  name + octave*7;
+    return  notename + octave*7;
+}
+
+/****************/
+int
+Rhythmic_req::compare(const Rhythmic_req &r1, const Rhythmic_req &r2)
+{
+    return r1.duration() - r2.duration();
+}
+Rhythmic_req::Rhythmic_req(int b, int d)
+{
+    plet_factor = 1;
+    balltype = b;
+    dots = d;
 }
 
 Rhythmic_req::Rhythmic_req()
 {
+    plet_factor = 1;
     balltype = 1;
     dots = 0;
 }
 
 void
-Rhythmic_req::print() const
+Rhythmic_req::do_print() const
 {
-    mtor << "rhythmic: " << balltype ;
+    mtor << "ball: " << balltype ;
     int d =dots;
     while (d--)
        mtor << '.';
-    mtor<<"\n";
+    
+    mtor<<", plet factor"<<plet_factor<<"\n";
+}
+
+
+Moment
+Rhythmic_req::duration() const {    
+    return wholes(balltype,dots)*plet_factor;
+}
+/****************/
+
+Lyric_req::Lyric_req(Text_def* def_p)
+    :Text_req(0, def_p)
+{
+    def_p->align_i_ = 1;       // raggedright
+    dir_i_ = -1;               // lyrics below (invisible) staff
+}
+
+void
+Lyric_req::do_print() const
+{    
+    Rhythmic_req::do_print();
+    Text_req::do_print();
+}
+/****************/
+void
+Note_req::do_print() const
+{
+    Melodic_req::do_print();
+    Rhythmic_req::do_print();
+}
+/****************/
+void
+Rest_req::do_print() const
+{
+        Rhythmic_req::do_print();
+}
+
+/****************/
+Beam_req::Beam_req()
+{
+    nplet = 0;
+}
+
+void Beam_req::do_print()const{}
+/****************/
+void Slur_req::do_print()const{}
+/****************/
+int
+Span_req:: compare(const Span_req &r1, const Span_req &r2)
+{
+     return r1.spantype - r2.spantype;
 }
 
+Span_req::Span_req()
+{
+    spantype = NOSPAN;
+}
+/****************/
+void
+Group_feature_req::do_print() const
+{
+    mtor << "stemdir " << stemdir_i_;
+}
+Group_feature_req::Group_feature_req()
+{
+    stemdir_i_ = 0;
+}
+void
+Group_change_req::do_print()const
+{
+    mtor << "id : " << newgroup_str_;
+}
 void
-Note_req::print() const
+Terminate_voice_req::do_print()const
+{
+}
+/****************/
+Script_req::Script_req(int d , Script_def*def)
+{
+    dir_i_ = d;
+    scriptdef_p_ = def;
+}
+
+int
+Script_req::compare(const Script_req &d1, const Script_req &d2)
+{
+    return d1.dir_i_ == d2.dir_i_ &&
+       d1.scriptdef_p_->compare(*d2.scriptdef_p_);
+}
+
+Script_req::Script_req(Script_req const &s)
 {
-    mtor << "note: " << name << " oct: "<< octave;
-    Rhythmic_req::print();
+    dir_i_ = s.dir_i_;
+    scriptdef_p_ = new Script_def(*s.scriptdef_p_);
 }
 
 void
-Rest_req::print() const
+Script_req::do_print() const
 {
-    mtor << "rest, " ;
-    Rhythmic_req::print();
+    mtor << " dir " << dir_i_ ;
+    scriptdef_p_->print();
 }
 
-Real
-wholes(int dur, int dots)
+
+Script_req::~Script_req()
 {
-    Real f = 1.0/Real(dur);
-    Real delta = f;
+    delete scriptdef_p_;
+}
+/****************/
+int
+Text_req:: compare(const Text_req &r1, const Text_req &r2)
+{
+    bool b1 = (r1.dir_i_ == r2.dir_i_);
+    bool b2 = (r1.tdef_p_ ->compare(*r2.tdef_p_));
+    return b1 && b2;
+}
+Text_req::~Text_req()
+{
+    delete tdef_p_;
+    tdef_p_ = 0;
+}
 
-    while (dots--) {
-       delta /= 2.0;
-       f += delta;
-    }
-    return f;    
+Text_req::Text_req(Text_req const& src)
+{
+    tdef_p_ = new Text_def(*src.tdef_p_);
+    dir_i_ = src.dir_i_;
 }
 
-Real
-Rhythmic_req::duration() const {    
-    return wholes( balltype,dots);
+Text_req::Text_req(int dir_i, Text_def* tdef_p)        
+{
+    dir_i_ = dir_i;
+    tdef_p_ = tdef_p;
 }
 
-Beam_req::Beam_req()
+void
+Text_req::do_print() const
 {
-    nplet = 0;
+    mtor << " dir " << dir_i_ ;
+    tdef_p_->print();
 }
 
-Span_req::Span_req()
+
+
+/****************/
+
+Mark_req::Mark_req(String s)
 {
-    spantype = NOSPAN;
+    mark_str_ = s;
 }
+
+void
+Mark_req::do_print()const
+{
+#ifndef NDEBUG
+    mtor<< " `" << mark_str_ << "\'\n";
+#endif
+}
+/****************/
+Staff_command_req::Staff_command_req(Input_command * p)
+{
+    com_p_ = p;
+}
+Staff_command_req::~Staff_command_req()
+{
+    delete com_p_;
+}
+Staff_command_req::Staff_command_req(Staff_command_req const&src)
+{
+    com_p_ = new Input_command(*src.com_p_);
+}
+void
+Staff_command_req::do_print()const
+{
+    com_p_->print();
+}
+
+