]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.10
authorfred <fred>
Fri, 15 Nov 1996 23:49:15 +0000 (23:49 +0000)
committerfred <fred>
Fri, 15 Nov 1996 23:49:15 +0000 (23:49 +0000)
src/accidental.cc [new file with mode: 0644]
src/beam.cc
src/break.cc
src/keyitem.cc [new file with mode: 0644]
src/note.cc
src/paper.cc
src/request.cc
src/staff.cc
src/template1.cc
src/template2.cc
src/voice.cc

diff --git a/src/accidental.cc b/src/accidental.cc
new file mode 100644 (file)
index 0000000..eb3ca7c
--- /dev/null
@@ -0,0 +1,32 @@
+#include "accidental.hh"
+#include "debug.hh"
+#include "molecule.hh"
+#include "paper.hh"
+#include "lookup.hh"
+
+Accidental::Accidental(int t, int p)
+{
+    type = t;
+    pos = p;
+}
+
+void
+Accidental::preprocess()
+{
+    brew_molecole();
+}
+
+void
+Accidental::brew_molecole()
+{    
+    Symbol s =paper()->lookup_->accidental(type);   
+    output = new Molecule(Atom(s));
+    output->translate(Offset(0, pos * paper()->interline()/2));
+}
+
+void
+Accidental::print()const
+{
+    mtor << "Accidental "<<type;
+    Item::print();
+}
index 49214c91f277ad5db850b9b112a2abe6a3fbad30..88dab8992d94d0d1d8853b07f42d3125fab924c6 100644 (file)
@@ -15,6 +15,8 @@ struct Stem_info {
     Real miny;
     int no_beams;
 
+    ///////////////
+    
     Stem_info(){}
     Stem_info(const Stem*);
 };
@@ -58,7 +60,9 @@ Beam::set_default_dir()
        sc->dir = dir;
     }
 }
-
+/*
+  should use minimum energy formulation (cf linespacing)
+  */
 void
 Beam::solve_slope()
 {
@@ -88,13 +92,14 @@ Beam::solve_slope()
     left_pos *= dir;    
     slope *= dir;
     
-    {Real inter =paper()->interline()/2;
-    Real unitslope = slope*inter;
-
-    // set beamslope, for setting stems correctly
-    // ignoring return.
-    Symbol sy = paper()->lookup_->beam(unitslope, width().length());
-    slope =unitslope / inter;
+    {
+       Real inter =paper()->interline()/2;
+       Real unitslope = slope*inter;
+
+       // set beamslope, for setting stems correctly
+       // ignoring return.
+       Symbol sy = paper()->lookup_->beam(unitslope, width().length());
+       slope =unitslope / inter;
     }
 }
 
index de9a704984ea9efa3ab0dac418fbb5f3054f4486..6cb1d3303b4a4d823aa4bb1c5278f8496b212080 100644 (file)
@@ -100,7 +100,7 @@ PScore::calc_breaking()
        while (i < breakpoints.sz()) {
 
            // add another measure.
-           while(breakpoints[i] !=curcol){
+           while (breakpoints[i] != curcol.ptr()){
                
                current.add(curcol);
                curcol++;
@@ -118,7 +118,7 @@ PScore::calc_breaking()
                minimum = current;         
            } else {            // we're one col too far.
                i--;
-               while (curcol != breakpoints[i])
+               while (curcol.ptr() != breakpoints[i])
                    curcol --;
                
                break;
diff --git a/src/keyitem.cc b/src/keyitem.cc
new file mode 100644 (file)
index 0000000..d02ed70
--- /dev/null
@@ -0,0 +1,50 @@
+#include "keyitem.hh"
+#include "key.hh"
+#include "debug.hh"
+#include "molecule.hh"
+#include "paper.hh"
+#include "lookup.hh"
+
+
+Keyitem::Keyitem(int c)
+{
+    c_position = c;
+}
+
+
+void
+Keyitem::read(svec<int> s)
+{
+    for (int i = 0 ; i< s.sz(); ) {
+       int note = s[i++];
+       int acc = s[i++];
+           
+       add(note, acc);
+    }
+}
+void
+Keyitem::add(int p, int a)
+{
+    pitch.add(p);
+    acc.add(a);
+}
+
+void
+Keyitem::preprocess() {
+    brew_molecole();
+}
+
+void
+Keyitem::brew_molecole()
+{
+    output = new Molecule;
+    Real inter = paper()->interline()/2;
+    
+    for (int i =0; i < pitch.sz(); i++) {
+       Symbol s= paper()->lookup_->accidental(acc[i]);
+       Atom a(s);
+       a.translate(Offset(0,c_position + pitch[i] * inter));
+       Molecule m(a);
+       output->add_right(m);   
+    }    
+}
index 0041bb723879d68c5bdb9d793b18cf40b901cc1d..1c1a4cb5718ec175c079a35f39c1b62560b76fe3 100644 (file)
@@ -105,10 +105,7 @@ get_note_element(String pitch, String durstr)
     int oct, pit, acc;
     bool forceacc;
     parse_pitch(pitch, i, oct, forceacc, pit, acc);
-    char nm =  pit + 'c';
-    if (nm > 'g')
-       nm += 'a' - 'h';
-    rq->name =nm;
+    rq->name =pit;
     
     rq->octave = oct;
     rq->accidental = acc;
index 8cd98339d4575baf0ef7e53a2b7ce5ea6bf086cf..2b98eef98850598172b65dcbc9fe104c057c5580 100644 (file)
@@ -31,7 +31,8 @@ Paperdef::Paperdef()
     parse();
     linewidth = convert_dimen(15,"cm");                // in cm for now
     whole_width= 8*note_width();
-    geometric_ = PHI;
+//    geometric_ = PHI;
+        geometric_ = sqrt(2);
 }
 
 void 
@@ -40,8 +41,7 @@ Paperdef::parse()
     Text_db symini("symbol.ini");
 
     
-    while (!symini.eof()) {
-       
+    while (!symini.eof()) {    
         Text_record  r(  symini++);
        
         if  (r[0] == "symboltables")
index 9928f62bed3d1a28c2364074f7d887a854740b8f..6f3778a66d5d0af9730f12f1d0880af70d821d2e 100644 (file)
@@ -27,7 +27,7 @@ Request::Request()
 
 Note_req::Note_req()
 {
-    name = 'c';
+    name = 0;
     octave = 0;
     accidental = 0;
     forceacc = false;
@@ -36,10 +36,7 @@ Note_req::Note_req()
 int
 Note_req::height() const
 {
-    int s = name -'c';
-    if (s < 0)
-       s+=7;
-    return  s + octave*7;
+    return  name + octave*7;
 }
 
 Rhythmic_req::Rhythmic_req()
index 3a32801b2f33b1d65bba1275fa01555ff317a6ef..4b3322fcef00f4d8244d8e3a485f2d0d657e3f80 100644 (file)
@@ -36,30 +36,36 @@ Staff::get_col(Real w, bool mus)
 {
     Score_column* sc = score_->find_col(w,mus);
     assert(sc->when == w);
-    PCursor<Staff_column *> stc(cols);
-    for (; stc.ok(); stc++) {
-       if (*stc->score_column > *sc) // too far
+    
+    PCursor<Staff_column *> i(cols);
+    for (; i.ok(); i++) {
+       if (*i->score_column > *sc) // too far
            break;
-       if (sc == stc->score_column)
-           return stc;
+       if (sc == i->score_column)
+           return i;
     }
+    /* post: *sc > *->score_column || !i.ok() */
     Staff_column* newst = create_col(sc);
 
-    if (!stc.ok()) {
+    if (!i.ok()) {
        cols.bottom().add(newst);
        return cols.bottom();
     }
     
     if (mus) {
-       stc.insert(newst);
+       i.insert(newst);
        return newst;
     }
 
-    if ((stc-1)->when() == newst->when()) {
-       stc--;
+//  ;  assert((i-1).ok())
+    // todo!
+    
+    // making a fix at 2:30 am, with several beers drunk. 
+    if ((i-1).ok()&& (i-1)->when() == newst->when()) {
+       i--;
     }
 
-    stc.insert(newst);
+    i.insert(newst);
     
     return newst;
 }
index fd2431130e1ef1e0135e124d61f629f7caee3a37..e2bae216b66cdb790636b94fc61deb9698f4990e 100644 (file)
 #include "plist.cc"
 #include "cursor.cc"
 
-#define PLC_instantiate(a) PL_instantiate(a); PL_instantiate(const a)
+#define IPLC_instantiate(a) IPL_instantiate(a); PL_instantiate(const a)
 
-L_instantiate(Stem*);
-PLC_instantiate(Line_of_score);
-PLC_instantiate(Line_of_staff);
-PLC_instantiate(Item);
-PLC_instantiate(Spanner);
-PLC_instantiate(PStaff);
-PLC_instantiate(Idealspacing);
-PLC_instantiate(PCol);
+IPLC_instantiate(Stem*);
+IPLC_instantiate(Line_of_score);
+IPLC_instantiate(Line_of_staff);
+IPLC_instantiate(Item);
+IPLC_instantiate(Spanner);
+IPLC_instantiate(PStaff);
+IPLC_instantiate(Idealspacing);
+IPLC_instantiate(PCol);
 
index 01695c863fa07ef2143d18d97bfbf708652b86e8..a4ce99da1fac3421f17a24d02d97a332e78071d2 100644 (file)
 #include "list.cc"
 #include "plist.cc"
 #include "cursor.cc"
-PL_instantiate(Score_column);
-PL_instantiate(Staff_column);
-PL_instantiate(Staff);
-PL_instantiate(Voice_element);
-PL_instantiate(Voice);
+
+IPL_instantiate(Score_column);
+IPL_instantiate(Staff_column);
+IPL_instantiate(Staff);
+IPL_instantiate(Voice_element);
+IPL_instantiate(Voice);
 
 
index 14883e149966d9997b6029168cd9e297cfb1c1ec..c713822a4b26c5eb21dae28a58f7d3186ee014c7 100644 (file)
@@ -72,7 +72,7 @@ Voice_element::Voice_element(Voice_element const&src)
 {
     duration=src.duration;
     voice=src.voice;
-    PointerList__copy(Request*, reqs, src.reqs, clone());
+    IPointerList__copy(Request*, reqs, src.reqs, clone());
     group=src.group;
     assert(!granted_items.size() && !granted_spanners.size());
 }