]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.21
authorfred <fred>
Fri, 3 Jan 1997 22:22:02 +0000 (22:22 +0000)
committerfred <fred>
Fri, 3 Jan 1997 22:22:02 +0000 (22:22 +0000)
hdr/request.hh
src/request.cc

index 279947a21cab04c7bdea14633bea6d86f279e25a..43b31d75cc98e23e20a374e50317f04a50a57a4c 100644 (file)
@@ -13,55 +13,33 @@ struct Request {
     /****************/
 
     Request();
+    virtual ~Request(){}
 
     virtual void print()const ;
     virtual Note_req *note() {return 0;}
+    virtual Script_req *script() {return 0;}
     virtual Stem_req *stem() {return 0;}
+    virtual Text_req*text() { return 0; }
     virtual Rest_req *rest() {return 0;}
     virtual Span_req *span() {return 0;}
     virtual Beam_req *beam() { return 0 ; }
     virtual Slur_req *slur() { return 0 ; }
-    virtual  Rhythmic_req*rhythmic() { return 0;}
+    virtual Rhythmic_req*rhythmic() { return 0; }
+    virtual Melodic_req *melodic() { return 0; }
     virtual Moment duration() const { return 0.0; }
     virtual Request* clone() const =0;
 };
 
 /**
-    Any Voice_element can do a number of requests. A request is done
-    to the #Staff# which contains the #Voice_element#. The staff decides
-    whether to to honor the request, ignore it, or merge it with other
-    requests. Merging of requests is preferably done with other
-    requests done by members of the same voicegroups (beams, brackets, stems) 
-
-    Please refer to the documentation of the Child classes of
-    #Request# for explanation of each request type.
-
-    The result of a request will be an #Item# or a #Spanner#, which
-    will be put on a #PStaff#. Note that the #PStaff# and the original
-    #Staff# need not have anything in common. For example, the
-    ``double'' piano Staff could interpret commands which juggle
-    melodies across the left and right hand, and may put the result in
-    two five-line PStaffs (maybe with extra PStaffs to carry the dynamic
-    signs and any lyric.
-
-    The class #Staff# should be thought as a container for the
-    #Voice#s, and an interpreter for #Request#s and #Command#s.
-    Different staffs can produce different outputs; a melodious voice
-    which is put into a percussion-Staff, will be typeset as the rythm of
-    that voice.
-
-    After #Staff# made up her mind (Would #Staff# be a smart
-    name? How about #struct Susan {}# :-), the resultant items and
-    spanners are put on the PScore, and pointers to these items are
-    stored in the #Voice_element#. This construction enables the
-    beams/stems to look up the balls it has to connect to.  */
+see lilygut page
+ */
        
 
 /// a request with a duration
-struct Rhythmic_req : Request {
+struct Rhythmic_req : virtual Request {
     int balltype;
     int dots;
-    
+    Moment plet_factor;
     /****************/
 
     Moment duration() const;
@@ -71,30 +49,32 @@ struct Rhythmic_req : Request {
     Request*clone() const;
 };
 
-/// Put a note of specified type, height, and with accidental on the staff.
-struct Note_req : Rhythmic_req {
-    char name;
+
+struct Melodic_req :virtual  Request
+{
+    /// 0 is c
+    int name;
     int octave;
     int accidental;
     bool forceacc;
-    
-    /****************/
 
     // return height from central c (in halflines)
     int height()const; 
-    Note_req();
+    Melodic_req();
+    Melodic_req*melodic() { return this;}
+    virtual void print() const;
+    Request*clone() const;
+};
+
+/// Put a note of specified type, height, and with accidental on the staff.
+struct Note_req : Rhythmic_req, virtual Melodic_req {
+    Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
+    
     Note_req*note() { return this;}
     virtual void print() const;
     Request*clone() const;
 };
 /**
-Staff has to decide if the ball should be hanging left or right. This
-influences the horizontal dimensions of a column, and this  is why
-request processing should be done before horizontal spacing.
-
-Other voices' frivolities may cause the need for accidentals, so this
-is also for the Staff to decide. The Staff can decide on positioning
-based on ottava commands and the appropriate clef.
 */
 
 
@@ -146,11 +126,8 @@ struct Beam_req : Span_req {
     virtual Beam_req * beam() { return this; }
     virtual Request*clone()const;
 };
-/** Staff will have to combine this with the stem_request, since the
-    number of flags that a stem wants to carry will determine the
-    number of beams.  if #nplet# is set, the staff will try to put an
-    appropriate number over the beam
-
+/**   if #nplet# is set, the staff will try to put an
+appropriate number over the beam
     */
 
 /// a slur
@@ -160,25 +137,42 @@ struct Slur_req : Span_req {
 };
 
 
-#if 0
+///Put a script above or below this ``note''    
+struct Script_req : Request {
+    int dir;
+    Script_def *scriptdef;
 
-///Put a lyric above or below (?) this staff.
-struct Lyric_req : Request {
-    String text;
+    /****************/
+    Script_req*script() { return this; }
+    virtual void print() const;
+    Request *clone()const;
+    Script_req(int d, Script_def*);
+    ~Script_req();
 };
+/** eg upbow, downbow. Why a request? These symbols may conflict with
+slurs and brackets, so this also a request */
 
 
-///Put a script above or below this ``note''    
-struct Script_req : Request {
-    int orientation;
-    Symbol sym;
+///Put a text above or below (?) this staff.
+struct Text_req : Request {
+    int dir;
+    Text_def *spec;
+    /****************/
+    Text_req*text() { return this; }
+    virtual void print() const;
+    Request *clone()const;
+    Text_req(int d, Text_def*);
+    ~Text_req();  
 };
-/**
-eg upbow, downbow. Why a request? These symbols may conflict with slurs and brackets, so this
-also a request
-*/
 
 
+#if 0
+
+///Put a lyric above or below (?) this staff.
+struct Lyric_req : Request {
+    String text;
+};
+
 
 
 ///Draw a (Guitar) chord above or below this ``note''
@@ -199,17 +193,22 @@ enum Loudness {
 
 ///Start / stop a slur or a bracket.
 struct Bracket_req : Span_req {
-    int nplet;
+    int nplet;                 // print a number over the beam.
 };
+
 /**
 Start/stop a bracket at this note. if #nplet# is set, the staff will
 try to put an appropriate number over the bracket
 */
 
-/// helper in the hierarchy
-struct Dynamic {
+struct Subtle_request {
     Moment subtime;
 };
+
+/// helper in the hierarchy
+struct Dynamic:Subtle_request {
+
+};
 /** Each dynamic is bound to one note ( a crescendo spanning multiple
     notes is thought to be made of two "dynamics": a start and a stop).
     Dynamic changes can occur in a smaller time than the length of its
@@ -234,7 +233,23 @@ struct Decresc_req : Span_req, Dynamic {
 
 /// do a dynamic like "fff" or "mp"
 struct Absdynamic_req : Request, Dynamic {
-        Loudness loudness;
+    Loudness loudness;
+};
+
+struct Grace_req : Subtle_request {
+    
+};
+
+struct Grace_turn_req : Grace_turn {
+    
+};
+
+struct Grace_note : Melodic_req {
+    
+};
+
+struct Grace_notes {
+    
 };
 #endif
 #endif
index 2645d5dc9075abd57c10909308f43e36ad1c782f..4cb98c2f3459cccbe6a35ddc4d71c8d712141a75 100644 (file)
@@ -1,14 +1,19 @@
 #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)
 
 RCONS(Rest_req);
+RCONS(Text_req);
 RCONS(Rhythmic_req);
 RCONS(Stem_req);
+RCONS(Script_req);
 RCONS(Note_req);
+RCONS(Melodic_req);
 RCONS(Span_req);
 RCONS(Slur_req);
 RCONS(Beam_req);
@@ -26,7 +31,7 @@ Request::Request()
     elt = 0;
 }
 
-Note_req::Note_req()
+Melodic_req::Melodic_req()
 {
     name = 0;
     octave = 0;
@@ -35,13 +40,14 @@ Note_req::Note_req()
 }
 
 int
-Note_req::height() const
+Melodic_req::height() const
 {
     return  name + octave*7;
 }
 
 Rhythmic_req::Rhythmic_req()
 {
+    plet_factor = 1;
     balltype = 1;
     dots = 0;
 }
@@ -53,13 +59,20 @@ Rhythmic_req::print() const
     int d =dots;
     while (d--)
        mtor << '.';
-    mtor<<"\n";
+    
+    mtor<<"xPlet factor"<<plet_factor<<"\n";
 }
 
 void
-Note_req::print() const
+Melodic_req::print() const
 {
     mtor << "note: " << name << " oct: "<< octave;
+}
+
+void
+Note_req::print() const
+{
+    Melodic_req::print();
     Rhythmic_req::print();
 }
 
@@ -73,7 +86,7 @@ Rest_req::print() const
 
 Moment
 Rhythmic_req::duration() const {    
-    return wholes( balltype,dots);
+    return wholes(balltype,dots)*plet_factor;
 }
 
 Beam_req::Beam_req()
@@ -85,3 +98,44 @@ Span_req::Span_req()
 {
     spantype = NOSPAN;
 }
+
+Script_req::Script_req(int d , Script_def*def)
+{
+    dir = d;
+    scriptdef = def;
+}
+
+void
+Script_req::print() const
+{
+    mtor << " dir " << dir ;
+    scriptdef->print();
+}
+
+
+Script_req::~Script_req()
+{
+    delete scriptdef;
+}
+
+
+Text_req::Text_req(int d , Text_def*def)
+{
+    dir = d;
+    spec = def;
+}
+
+void
+Text_req::print() const
+{
+    mtor << " dir " << dir ;
+    spec->print();
+}
+
+
+Text_req::~Text_req()
+{
+    delete spec;
+}
+
+