]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.11 release/0.0.11
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 6 Dec 1996 22:41:30 +0000 (23:41 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 6 Dec 1996 22:41:30 +0000 (23:41 +0100)
72 files changed:
Documentation/Makefile
Documentation/pointers [new file with mode: 0644]
Documentation/slurfont [new file with mode: 0644]
Makefile
README
Sources.make
Variables.make
dimen.tex
flower/Makefile
flower/choleski.cc
flower/cursor.cc
flower/cursor.inl
flower/fproto.hh
flower/interval.cc
flower/interval.hh
flower/matrix.cc
flower/matrix.hh
hdr/boxes.hh
hdr/keyitem.hh
hdr/localkeyitem.hh
hdr/lookup.hh
hdr/meter.hh
hdr/paper.hh
hdr/pcol.hh
hdr/proto.hh
hdr/pscore.hh
hdr/request.hh
hdr/sccol.hh
hdr/scoreline.hh
hdr/simplestaff.hh
hdr/simplewalker.hh
hdr/slur.hh [new file with mode: 0644]
hdr/staffline.hh
hdr/voice.hh
lilyponddefs.tex
maartje.ly
objects/Makefile
src/beam.cc
src/boxes.cc
src/calcideal.cc
src/key.cc
src/keyitem.cc
src/lookup.cc
src/main.cc
src/melodicstaff.cc
src/meter.cc
src/molecule.cc
src/notehead.cc
src/paper.cc
src/pcol.cc
src/pscore.cc
src/sccol.cc
src/scommands.cc
src/score.cc
src/scoreline.cc
src/simplestaff.cc
src/simplewalker.cc
src/slur.cc [new file with mode: 0644]
src/spanner.cc
src/staffline.cc
src/stem.cc
src/symbol.cc
src/symtable.cc
src/template1.cc
src/template2.cc
src/template3.cc
src/template4.cc [new file with mode: 0644]
src/tex.cc
src/texslur.cc [new file with mode: 0644]
src/voice.cc
src/warn.cc
symbol.ini

index daf587679e763264d02022409cde17e732733706..383026e355c2a39dd39a925729aee84017e930cc 100644 (file)
@@ -1,5 +1,6 @@
 
-DOCFILES=commands CodingStyle algorithms Makefile breaking
+DOCFILES=commands CodingStyle algorithms Makefile breaking\
+       slurfont pointers
 
 dist:
        ln $(DOCFILES) $(DDIR)/Documentation/
\ No newline at end of file
diff --git a/Documentation/pointers b/Documentation/pointers
new file mode 100644 (file)
index 0000000..45e2479
--- /dev/null
@@ -0,0 +1,31 @@
+This describes the ownership of certain classes in LilyPond. +
+signifies a "list of". (This is not complete)
+
+Score:
+       Paperdef
+       Staff+
+       Score_commands
+       Score_columns+
+       PScore
+               
+Staff:
+       Voice
+       Staff_column+
+       Command+
+
+
+Voice:
+       Voice_element
+
+Voice_element:
+       Request+
+
+
+PScore:
+       PStaff+
+       PCol+
+       Idealspacing+
+       Item+
+       Spanner+
+       Spanner+ (broken)
+       
diff --git a/Documentation/slurfont b/Documentation/slurfont
new file mode 100644 (file)
index 0000000..fda65e1
--- /dev/null
@@ -0,0 +1,43 @@
+How are slur fonts organised?
+
+xhslu20: see xslhu20
+
+xslhu20: half slurs, pointing up
+       right
+               width in steps of 12pt (12pt-96pt)
+                       height in 16 steps
+       left
+               idem
+       
+xslhd20: half slurs, pointing down, idem
+
+xslu20: whole slurs, ascending
+       pointing up
+               height (dy) in 8 steps
+                       width in 16 steps of 4pt (8 pt - 64pt)
+       pointing down
+               height (dy) in 8 steps
+                       width in steps of 4pt (8 pt - 64pt)
+       
+xsld20: whole slurs, descending        
+       pointing up
+               height (dy) in 8 steps
+                       width in steps of 4pt (8 pt - 60pt)
+       pointing down
+               height (dy) in 8 steps
+                       width in steps of 4pt (8 pt - 60pt)
+       
+
+xslhz: middlepieces for half-slurs
+       pointing up
+               width in 100 steps of 4 pt (4 pt to 400pt)
+       pointing down
+               idem
+
+xslz:  horizontal slurs
+       pointing up
+               width in 54 steps of 4pt
+       pointing down
+               idem
+
+xtie: same as xslhz.
index 4dcc395210a1f8f54211a81023c355e640954930..9b1b762a3adb4e06b138d2a4bc21c0d634396223 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@ $(exe): $(obs)
        $(CXX) -o $@ $^ $(LOADLIBES)
 
 clean:
+       $(MAKE) -C objects clean
        rm -f $(exe) *.o $(DOCDIR)/* core  
 
 distclean: clean
diff --git a/README b/README
index c3c4cbd23e35bc678db43322d58d9a5798d1716f..d60b5b8ca4877fa7e05470ae9df6442252658af4 100644 (file)
--- a/README
+++ b/README
@@ -5,7 +5,7 @@ INTRODUCTION
 This is a beta version of LilyPond (a music typesetter). Please send
 your helpful comments and patches to me,
 
-       hanwen@stack.urc.tue.nl
+       hanwen@stack.nl
 
 LilyPond is updated very frequently, the latest version is always available at:
 
index 61c32fa41c6551d604e6a2c63ac516653f65d492..c4d585bc6a917c9fc394175b8d8a9c9a60975d09 100644 (file)
@@ -14,7 +14,7 @@ hdr=    qlp.hh linespace.hh qlpsolve.hh\
        notehead.hh leastsquares.hh beam.hh rest.hh\
        swalker.hh bar.hh meter.hh accidental.hh\
        key.hh keyitem.hh localkeyitem.hh simplewalker.hh\
-       clef.hh clefitem.hh
+       clef.hh clefitem.hh slur.hh
 
 mycc=   qlp.cc qlpsolve.cc \
        break.cc linespace.cc molecule.cc staffline.cc\
@@ -32,6 +32,6 @@ mycc=   qlp.cc qlpsolve.cc \
        texbeam.cc rest.cc swalker.cc scoreline.cc\
        simplewalker.cc bar.cc meter.cc accidental.cc\
        key.cc keyitem.cc localkeyitem.cc\
-       clef.cc clefitem.cc\
-       template1.cc template2.cc template3.cc\
+       clef.cc clefitem.cc texslur.cc slur.cc\
+       template1.cc template2.cc template3.cc template4.cc\
        version.cc
index 2d27e3be3ff147fa48a02a8aab05eaa7135826a1..f8cd146ba4f665f9b0dc1871fd17a07bebf2e8a8 100644 (file)
@@ -18,7 +18,7 @@ EXTRACXXFLAGS=-pipe -Wall -W  -pedantic
 # version info
 MAJVER=0
 MINVER=0
-PATCHLEVEL=10
+PATCHLEVEL=11
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
 
 # directories
index 7665eb33798de689dd336ea3b992bc08e9bc41b4..f0198c6c75ded6346ae631ac720b26c08911a47c 100644 (file)
--- a/dimen.tex
+++ b/dimen.tex
@@ -1,5 +1,7 @@
 \font\musicfnt=musix20
-\def\mb#1{{\musicfnt\musicfnt\char#1}}
+%\def\mb#1{{\musicfnt\musicfnt\char#1}}
+\font\slurfont=xslhz20
+\def\mb#1{{\musicfnt\slurfont\char#1}}
 \newdimen\wid
 \newdimen\inc
 \newdimen\here
@@ -13,6 +15,7 @@
                \hbox to0pt{\kern\here\vrule width0.05pt height 2pt\hss}%
        \repeat%
 }
+
 \def\vruler#1{%
        \wid=#1pt
        \inc=\wid
index 46fb7b5ab41f0a8805218a92dccc198bff680eba..25e9384d56c9d816de50e6808c25b3d33ee48d10 100644 (file)
@@ -1,6 +1,6 @@
 MAJVER=1
 MINVER=0
-PATCHLEVEL=11
+PATCHLEVEL=12
 
 PACKAGENAME=flower
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
index 82740a27c18addcbeca4278ac401dca765c2b773..4202a9b1e5eed0a3b64349f7fcb1954ea5a5b073 100644 (file)
@@ -15,13 +15,11 @@ Choleski_decomposition::solve(Vector rhs)const
            sum += y(j) * L(i,j);
        y(i) = (rhs(i) - sum)/L(i,i);
     }
-    for (int i=0; i < n; i++) {
-       assert(D(i));
+    for (int i=0; i < n; i++)
        y(i) /= D(i);
-    }
 
     // backward subst
-    Vector x(n);
+    Vector &x(rhs);            // using input as return val.
     for (int i=n-1; i >= 0; i--) {
        Real sum(0.0);
        for (int j=i+1; j < n; j++)
@@ -91,7 +89,3 @@ Choleski_decomposition::inverse() const
     
     return invm;
 }
-
-
-
-
index 75f607dcaaefe86cfe8cbdaf5bc9b47035a38a03..3d2116c46f826b28350b39ba3fa41f4ec58feb8e 100644 (file)
@@ -5,14 +5,25 @@
 #include <assert.h>
 
 template<class T>
-Cursor<T> 
-Cursor<T>::operator ++( int )    
+ void
+Cursor<T>::backspace()
 {
-    Cursor<T> r = *this;
-    assert( pointer_ );
-    pointer_ = pointer_->next();
-    return r;
+    Cursor<T> c(*this);
+    c--;        
+    list_.remove( *this );
+}
+
+template<class T>
+ void
+Cursor<T>::del()
+{
+    Cursor<T> c(*this);
+    c++;
+    list_.remove( *this );    
+    *this = c;
 }
+
+
 template<class T>
 Cursor<T> 
 Cursor<T>::operator -=( int j )    
@@ -30,16 +41,6 @@ Cursor<T>::operator +=( int j )
     return *this;
 }
 
-template<class T>
-Cursor<T>
-Cursor<T>::operator --( int )
-{
-    Cursor<T> r = *this;
-    assert( pointer_ );
-    pointer_ = pointer_->previous();
-    return r;
-}
-
 template<class T>
 Cursor<T> 
 Cursor<T>::operator +( int i ) const    
index 0b077bd811d0aac1cca336eaebafc2e290f67589..4337ef446afa452246c87d39158a39545afdd71e 100644 (file)
@@ -54,25 +54,6 @@ Cursor<T>::insert( const T& th )
     list_.insert( th, *this );
 }
 
-template<class T>
-inline void
-Cursor<T>::backspace()
-{
-    Cursor<T> c(*this);
-    c--;        
-    list_.remove( *this );
-}
-
-template<class T>
-inline void
-Cursor<T>::del()
-{
-    Cursor<T> c(*this);
-    c++;
-    list_.remove( *this );    
-    *this = c;
-}
-
 template<class T>
 inline const List<T>&
 Cursor<T>::list() const
@@ -108,4 +89,25 @@ Cursor<T>::ok()
     return ( pointer_ != 0 );
 }
 
+
+template<class T>
+inline Cursor<T> 
+Cursor<T>::operator ++( int )    
+{
+    Cursor<T> r (*this);
+    assert( pointer_ );
+    pointer_ = pointer_->next();
+    return r;
+}
+
+template<class T>
+inline Cursor<T>
+Cursor<T>::operator --( int )
+{
+    Cursor<T> r (*this);
+    assert( pointer_ );
+    pointer_ = pointer_->previous();
+    return r;
+}
+
 #endif
index 672a992dc99701baf3508104f32e5a2558b0dd52..43452af7b8a9794a0c41943b4f2a11c43d356369 100644 (file)
@@ -29,6 +29,7 @@ struct Getopt_long ;
 struct Matrix ;
 struct StringData ;
 struct String_handle ;
+struct String;
 struct virtual_smat ;
 struct Vector  ;
 class Text_stream;
index b307f4c634f5974ecf0fa12eddce38817f314218..6cc2a7916e9d51e1e4e0758730de40c52ac87a1f 100644 (file)
@@ -1,6 +1,8 @@
 #include <assert.h> 
-#include "interval.hh"
 #include <math.h>
+#include "interval.hh"
+#include "string.hh"
+
 
 const Real INFTY = HUGE;
 
@@ -15,4 +17,34 @@ Interval::length() const {
     assert(max >= min);
     return max-min;
 }
+void
+Interval::unite(Interval h)
+{
+    if (h.min<min)
+       min = h.min;
+    if (h.max>max)
+       max = h.max;
+}
+void
+Interval::intersect(Interval h)
+{
+    min = MAX(h.min, min);
+    max = MIN(h.max, max);
+}
 
+Interval
+intersect(Interval x, Interval const &y)
+{
+    x.intersect(y);
+    return x;
+}
+    
+
+Interval::operator String() const
+{
+    if (empty())
+       return "[empty]";
+    String s("[");
+    return s + min + "," + max +"]";
+}
index 950945ca873216dd4b0c4e75b3a6c7a6222304bc..6f9fa63f672b6856ca6179a597a63de575b5fbc4 100644 (file)
@@ -8,6 +8,7 @@
 #define INTERVAL_HH
 
 #include <assert.h> 
+#include "fproto.hh"
 #include "real.hh"
 
 
@@ -29,15 +30,12 @@ struct Interval {
            return 0.0;
                
     }
-    void unite(Interval h) {
-       if (h.min<min)
-           min = h.min;
-       if (h.max>max)
-           max = h.max;
-    }
+    void unite(Interval h) ;
+    void intersect(Interval h);
+
     Real length() const;
     void set_empty() ;
-    bool empty() { return min > max; }
+    bool empty() const { return min > max; }
     Interval() {
        set_empty();
     }
@@ -50,9 +48,13 @@ struct Interval {
        max +=r;
        return *this;
     }
+
+    operator String() const;
 };
 
 
+Interval intersection(Interval, Interval const&);
+
 #endif // INTERVAL_HH
 
 
index b95a4ab1f9ddc3ebdeef0fb6330bc72f886bff8f..63bd85a33c2b33dbc5ef91f277be74ba05f33ba9 100644 (file)
@@ -9,24 +9,6 @@ Matrix::norm() const
     return sqrt(r);
 }
 
-//inline
-Real
-Matrix::operator()(int i,int j) const
-{
-    assert(i >= 0 && j >= 0);
-    assert(i < rows() && j < cols());
-    return dat->elem(i,j);
-}
-
-//inline
-Real &
-Matrix::operator()(int i, int j)
-{
-    assert(i >= 0 && j >= 0);
-    assert(i < rows() && j < cols());
-    return dat->elem(i,j);
-}
-
 void
 Matrix::fill(Real r)
 {
index e092a5fbe67bf343f89ba1f208af779d1c5c9db8..5283dc71ef45df9d30588b6e26957167abba05b9 100644 (file)
@@ -35,7 +35,7 @@ public:
     void unit() { set_diag(1.0); }
 
     void operator+=(const Matrix&m);
-        void operator-=(const Matrix&m);    
+    void operator-=(const Matrix&m);    
     void operator*=(Real a);
     void operator/=(Real a) { (*this) *= 1/a; }
     
@@ -74,10 +74,10 @@ public:
     void operator=(const Matrix&m);
 
     /// access an element
-    Real operator()(int i,int j) const;
+    Real operator()(int i,int j) const { return dat->elem(i,j); }
 
     /// access an element
-    Real &operator()(int i, int j);
+    Real &operator()(int i, int j) { return dat->elem(i,j); }
 
     /// Matrix multiply with vec (from right)
     Vector operator *(const Vector &v) const;
index e3ea69a3bf98563ea0ed6b29f24e3eed86f34cd2..5bc2cb2e735197da924d7c75b832e598a5234c8a 100644 (file)
@@ -5,9 +5,10 @@
 #ifndef BOXES_HH
 #define BOXES_HH
 
-#include "textdb.hh"
+#include "fproto.hh"
 #include "real.hh"
-#include "vray.hh"
+#include "interval.hh"
+
 
 /// 2d vector 
 struct Offset {
@@ -34,46 +35,6 @@ struct Offset {
     }
 };
 
-/// a Real interval
-struct Interval {
-    Real min, max;
-
-    void translate(Real t) {
-       min += t;
-       max += t;
-    }
-    Real operator[](int j) {
-       if (j==-1)
-           return min;
-       else if (j==1)
-           return max;
-       else
-           assert(false);
-               
-    }
-    void unite(Interval h) {
-       if (h.min<min)
-           min = h.min;
-       if (h.max>max)
-           max = h.max;
-    }
-    Real length() const;
-    void set_empty() ;
-    bool empty() { return min > max; }
-    Interval() {
-       set_empty();
-    }
-    Interval(Real m, Real M) {
-       min =m;
-       max = M;
-    }
-    Interval &operator += (Real r) {
-       min += r;
-       max +=r;
-       return *this;
-    }
-};
-
 
 /// a 4-tuple of #Real#s
 struct Box {
@@ -87,7 +48,7 @@ struct Box {
        x.unite(b.x);
        y.unite(b.y);
     }
-    Box(svec<Real> );
+    Box(svec<Real> &);
     Box();
     Box(Interval ix, Interval iy);
 };
index d5b159368bc36666b311f0a3f6df37f0b529ba50..ba49475ce481628749ebeed4ea7293fa511ab73e 100644 (file)
@@ -8,7 +8,7 @@
 #define KEYITEM_HH
 
 #include "item.hh"
-
+#include "vray.hh"
 struct Keyitem : Item {
     svec<int> pitch;
     svec<int> acc;
index 5b045c93ae1958ad03fa06ead3ba50d466994f3b..cc786e8e7f5b1ff6ca7fc3234d0f288e7b1bb3b0 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef LOCALKEYITEM_HH
 #define LOCALKEYITEM_HH
 #include "item.hh"
+#include "vray.hh"
 
 struct Local_acc {
     int name , acc, octave;
index 5be2b254644b8b0923fe6b79b1603ac69041ec5e..14ed92f6b80a7c523ac9f3ddbf88656ae0f7195a 100644 (file)
@@ -5,16 +5,14 @@
 #define LOOKUPSYMS_HH
 
 #include "symbol.hh"
-
+#include "fproto.hh"
 struct Lookup {
     Symtables *symtables_;
     
     /****************/
-
+    Real internote();
     void parse (Text_db&t);
     Parametric_symbol *linestaff(int n);
-    Parametric_symbol *meter(String);
-    Parametric_symbol *stem();
 
     Symbol beam_element(int,int,Real=0);
     /// round slope to closest TeXslope
@@ -26,6 +24,8 @@ struct Lookup {
       pos == -3: below staff
       */
 
+    Symbol meter(svec<String>);
+    Symbol stem(Real y1_pos, Real y2_pos);
     Symbol rule_symbol(Real height, Real width);
     Symbol accidental(int);
     Symbol ball(int);
@@ -34,6 +34,13 @@ struct Lookup {
     Symbol clef(String);
     Symbol bar(String);
     Symbol dots(int);
+    Symbol slur(int dy, Real &dx, int dir);
+    Symbol half_slur(int dy, Real &dx, int dir, int xpart);
+    Symbol half_slur_middlepart(Real &dx, int dir);
+    Symbol big_slur(int dy, Real &dx, int dir);
+    
+
+
     Lookup();
     ~Lookup();
 };
index 6af881726577cb0a8dd248d739e0225d752300c5..5498112d376c31dedfd27225354e7ac0a287ad73 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef METER_HH
 #define METER_HH
 #include "item.hh"
+#include "vray.hh"
 
 struct Meter: Item {
     svec<String> args;
index 84932a36abdba24789e77ad39fbeea5e9a04f24e..b2ba370b578ab497ab7aec64adf7b8a5e1856f7b 100644 (file)
@@ -19,6 +19,7 @@ struct Paperdef {
     Paperdef();
     ~Paperdef();
     Real interline()const;
+    Real internote()const;
     Real rule_thickness()const;
     Real standard_height()const;
     Real note_width() const;
index 7cbf93f2ab2fa3e72dbaf4f9f39b11e381ff2623..f6a38d57aab18c8a6ca7742fcbda5f64c1700357 100644 (file)
@@ -11,11 +11,6 @@ struct PCol {
     PointerList<const Item*> its;
     PointerList<const Spanner*> stoppers, starters;
     
-    /// Can this be broken? true eg. for bars. 
-    bool breakable()const;
-
-    /// does this column have items, does it have spacings attached?
-    bool used;
 
     /// prebreak is put before end of line.
     PCol *prebreak;
@@ -28,20 +23,28 @@ struct PCol {
     PCol *postbreak;
     /**  \See{prebreak}
     */
+    
     PCol *daddy;
-    /*
-    if this column is pre or postbreak, then this field points to the parent.
-    */
+    /** if this column is pre or postbreak, then this field points to
+     the parent.  */
+    
     /// if lines are broken then this column is in #line#
     const Line_of_score *line;
 
     /// if lines are broken then this column x-coord #hpos#
     Real hpos;
 
-    
-    /****************************************************************/
+    PScore * pscore_;
+
+    /****************/
 
+    /// does this column have items, does it have spacings attached?
+    bool used() const;
+    
     void add(Item *i);
+
+    /// Can this be broken? true eg. for bars. 
+    bool breakable()const;
     
     Interval width() const;
     ~PCol();
index f80b7f8d0a17e8eb0fea84a74570fb77a192dce8..33d6f8e27ac6eed14cf2f9cfe2f2900518396f43 100644 (file)
@@ -96,6 +96,6 @@ struct Keyitem;
 struct Local_key_item;
 struct Clef;
 struct Clef_item;
-
+struct Slur;
 #endif // PROTO_HH
 
index c434f5b700636ec098dbbffe67fe9c0800c01b64..00fb79bccc1bf737f6036e4b05b83c28bd44fdaf 100644 (file)
@@ -30,8 +30,13 @@ struct PScore {
     /// crescs etc; no particular order
     IPointerList<Spanner *> spanners;
 
-    /****************************************************************/
+    /// broken spanners
+    IPointerList<Spanner*> broken_spans;
 
+    /****************/
+
+    void add_broken(Spanner*);
+    
     svec<Item*> select_items(PStaff*, PCol*);
 
     /// before calc_breaking
@@ -78,7 +83,7 @@ struct PScore {
     */
 
     /// return argument as a cursor.
-    PCursor<PCol *> find_col(PCol *);
+    PCursor<PCol *> find_col(const PCol *)const;
 
     /// delete unused columns
     void clean_cols();
@@ -94,6 +99,9 @@ struct PScore {
 
     /// does curline fit on the paper?
     bool feasible(svec<const PCol *> curline) const;
+
+    /// which is first (left, higher)
+    int compare_pcols(const PCol*, const PCol*)const;
 };
 /** notes, signs, symbols in a score can be grouped in two ways:
     horizontally (staffwise), and vertically (columns). #PScore#
index 1911f20219b96afb15b2db1444d04b01883fa79a..d8ee21ccc780cecaa538084cd952592c6ab52d16 100644 (file)
@@ -19,6 +19,7 @@ struct Request {
     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 Real duration() const { return 0.0; }
     virtual Request* clone() const =0;
@@ -154,6 +155,7 @@ struct Beam_req : Span_req {
 /// a slur
 struct Slur_req : Span_req {
     virtual Request*clone()const;
+    virtual Slur_req*slur() { return this; }
 };
 
 
index 44f3fbb16deb235c267a266a6bc023a6cd726583..f8aceb23040813329b40cf6496fd78e3ea688564 100644 (file)
@@ -7,12 +7,14 @@
 #ifndef SCCOL_HH
 #define SCCOL_HH
 #include "pcol.hh"
+#include "vray.hh"
 
 
 struct Score_column {
 
     /// indirection to column
     PCol * pcol_;
+
     /// length of notes/rests in this column
     svec<Real> durations;
     
@@ -47,3 +49,6 @@ instantiate_compare(Score_column&, Score_column::compare);
 
 #endif // SCCOL_HH
 
+
+
+
index a8ae77a222f9315a6649787252b2db7588019625..5ebb936b1e1fec0a3fa71bd06852cd1076fd0188 100644 (file)
@@ -17,11 +17,11 @@ Line_of_score {
 
     // need to store height of each staff.
     IPointerList<Line_of_staff*> staffs;
-    const PScore * score;      // needed to generate staffs
+    PScore * pscore_;  // needed to generate staffs
 
     /****************/
     
-    Line_of_score(svec<const PCol *> sv, const PScore *);
+    Line_of_score(svec<const PCol *> sv,  PScore *);
 
     String TeXstring() const;
 
@@ -30,3 +30,4 @@ Line_of_score {
 };
 
 #endif
+
index e4c600ba1b4503a843d96730382c93654cd36fb7..07fc9850471813fe48f89c0f6d37198efa160d6b 100644 (file)
@@ -22,15 +22,15 @@ struct Simple_staff;
 struct Simple_column : Staff_column {
 
     svec<Rhythmic_req *> notes;
+    svec<Slur_req *> slurs;
     Stem_req *stem_;
     Beam_req *beam_;
     Simple_staff* staff_;
 
     
     /****************/
-
+    Slur_req  * find_slur(Voice *);
     void typeset_item(Item *, int=1);
-
     void typeset_item_directional(Item *, int dir, int=1);
 
     Molecule *create_command_mol(Command *com);
index 5f27957aca2092b5afa268b3a69524bca89697a8..a8db0337aa627497d3a43fd1e240159a2421035b 100644 (file)
@@ -22,7 +22,8 @@ struct Simple_walker: Staff_walker {
     bool processed_key;
     bool processed_clef;
     Clef clef_;
-    
+    svec<Slur_req*> pending_slur_reqs;
+    svec<Slur*>  pending_slurs;
     /****************/
 
     virtual void do_TYPESET_command(Command*);
@@ -30,12 +31,13 @@ struct Simple_walker: Staff_walker {
     virtual void process_requests();
     virtual void reset();
     
-    void do_notes();
+    void do_note(Rhythmic_req*);
     Simple_walker(Simple_staff*);
     Simple_column *col();
     Simple_staff *staff();
 
     void do_local_key(Note_req*n);
+    int find_slur(const Voice*v);
 };
 
 
diff --git a/hdr/slur.hh b/hdr/slur.hh
new file mode 100644 (file)
index 0000000..4335939
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+  slur.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef SLUR_HH
+#define SLUR_HH
+
+#include "spanner.hh"
+#include "fproto.hh"
+#include "vray.hh"
+
+struct Slur : Spanner {
+
+    svec<Notehead*> encompass;
+    int dir;
+
+    bool open_left,open_right;                 
+
+    /****************/
+
+    void print()const;    
+    void preprocess();
+    void add(Notehead*);
+    void set_default_dir();
+    Interval height() const;
+    Spanner* broken_at(const PCol*, const PCol*) const;
+    void process();
+private:
+    void brew_molecule();
+};
+
+#endif // SLUR_HH
+
+
index be5a7de42bf9c87a2ee11bdae28740d3400ada38..868198b01337728fd745408a66bc611c4b8770f6 100644 (file)
@@ -15,8 +15,8 @@
 
 /// one broken line of staff.
 struct Line_of_staff {
-    IPointerList<Spanner *> brokenspans;    
-    Line_of_score const * scor;
+
+    Line_of_score  * line_of_score_;
     const PStaff *pstaff_;
 
     /****************/
@@ -24,6 +24,7 @@ struct Line_of_staff {
     String TeXstring() const;
     Line_of_staff(Line_of_score*, PStaff *);
     Interval height() const;
+
 };
 
 #endif
index 4e304bb0d90f72dd7e68c03dd9f17502d8491415..db2e0872cf1c87d7a4af84385e98ce54fa41643b 100644 (file)
@@ -33,7 +33,7 @@ struct Voicegroup {
 struct Voice_element {
     Real duration;
     const Voicegroup *group;
-    const Voice *voice;
+    const Voice *voice_;
     IPointerList<Request*> reqs;
 
    PointerList<const Item *> granted_items;
index be9aada8a27c6101e32b1804f609fd4cfaadd254..1e098eb271cb6a70743e7a77598a6bff691ce961 100644 (file)
@@ -1,5 +1,6 @@
 %%
 %% include file for LilyPond
+
 \def\mdef#1#2{\def#1{{\musicfnt\char#2}}}
 
 %% musix defs
        \newdimen\interstaffrule
 
 \def\musixtwentydefs{
+       \font\slurufont=xslu20
+       \font\slurdfont=xsld20
+       \font\slurhfont=xslz20
+       \font\hslurufont=xslhu20
+       \font\hslurdfont=xslhd20
+       \font\hslurhfont=xslhz20
        \font\musicfnt=musix20
        \balkhoog=20pt
        \staffrulethickness=0.4pt
 
 \musixtwentydefs
 \musixcalc
+\def\slurcharh#1{{\slurhfont\char#1}}
+\def\slurcharu#1{{\slurufont\char#1}}
+\def\slurchard#1{{\slurdfont\char#1}}
+\def\hslurcharh#1{{\hslurhfont\char#1}}
+\def\hslurcharu#1{{\hslurufont\char#1}}
+\def\hslurchard#1{{\hslurdfont\char#1}}
 
 \mdef\quartball{'007}
 \mdef\halfball{'010}
index 928f7b28388639612e5f7afb325dbeb668aca73a..fcb64323ee0fa42fae0c6a227b2ecb592b3dbb29 100644 (file)
@@ -1,21 +1,29 @@
 ritme = rhythmstaff {
-       voice { $ c2 r32 r32 r16 r8 r4 c2 c2 c2 c2 c2
-               c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ }
+       voice { $ c2 c2
+       %[c8( )'a8 c8 c8]
+       c2 c2
+       
+       [fis16 'dis16( fis16 'dis16 ][fis16) 'dis16 fis16 'dis16]
+       c2 r32 r32 r16 r8 r4 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ }
 }
 
 melody=
 melodicstaff {
-       
-       voice { $ fis 'dis 'fis 'gisis $ }
-       voice { $ 'eses $ start 0.75}
-       voice {  $ 'cis $ start 0.75}
-       voice {  $ f $ start 0.75}
-       voice {  $ gis $ start 0.75}
+       voice { $ c () `bes $ start 0.5 }       
+       voice { $
+       %[fis16 'dis16 fis16 'dis16 fis16 'dis16 fis16 'dis16]
+       c2
+       'fis ()'gisis $ }
+
+
+       voice {  $ d () d $ start 0.5 }
+       voice {  $ a  () bes $ start 0.5 }
+       voice {  $ fis () g $ start 0.5 }
        
 
   voice { $
        ''c2.. r8 r4 r8 r16 r32 r32
-       [d8 e8 f8 g8] [d8 e8 f8 g8]
+       [d8 e8 'f8 g8] [d8 e8 f8 g8]
        ''fis1
        a8 b8 'c8 'd8 ''c8 ```c8 c4 c4  c4 c4
        \duration 16  `b16 `a16 `g16 `f16 \duration 4
@@ -32,12 +40,10 @@ score {
 %      staff { melody }
        commands {
                meter 4 4
-
                key $ fis cis gis $
                skip 2:0
                key $ $
                meter 2 4
-
                skip 19:0
        }
 }
index 701ad6d5b978602f3420e07406edf236e9958a56..585e1df1814dd8815def0c68054afb7c4e1e7247 100644 (file)
@@ -1,2 +1,5 @@
 dist:
-       ln Makefile $(DDIR)/objects/
\ No newline at end of file
+       ln Makefile $(DDIR)/objects/
+       
+clean:
+       rm -f *.o
index 88dab8992d94d0d1d8853b07f42d3125fab924c6..f8ca8b5ab8777be04b52b64257a74142a3287d8a 100644 (file)
@@ -93,7 +93,7 @@ Beam::solve_slope()
     slope *= dir;
     
     {
-       Real inter =paper()->interline()/2;
+       Real inter =paper()->internote();
        Real unitslope = slope*inter;
 
        // set beamslope, for setting stems correctly
@@ -164,7 +164,8 @@ Beam::width() const
 void
 Beam::brew_molecule()
 {
-    Real inter=paper()->interline()/2;
+    assert(left->line == right->line);
+    Real inter=paper()->internote();
     Real sl = slope*inter;
     Real w =  width().length() + paper()->rule_thickness();
     Symbol s = paper()->lookup_->beam(sl,w);
index ebfc08abfe02c7861e90e4bea5b40567339752e2..b280e45f921dbf287812dcd86db74b9933a07a35 100644 (file)
@@ -1,16 +1,8 @@
 #include "boxes.hh"
 #include "const.hh"
+#include "vray.hh"
 
-void
-Interval::set_empty() {
-    min = INFTY;
-    max = -INFTY;
-}
-Real
-Interval::length() const {
-    return max-min;
-}
-Box::Box(svec<Real> s)
+Box::Box(svec<Real> &s)
 {
     assert(s.sz() == 4);
     x.min = s[0];
index 051ac4312c99be55bf39d4fedb618d5a9f94bc58..03910ac561968f1ae2fb59075429ec86fadb4b46 100644 (file)
@@ -21,7 +21,7 @@ Score::do_connect(PCol *c1, PCol *c2, Real d)
 void
 Score::connect_nonmus(PCol* c1, PCol *c2, Real d)
 {
-    if (c2->used && c1->used) {
+    if (c2->used() && c1->used()) {
        do_connect(c1,c2,d);
 
        // alert! this is broken!
index 303bf10bebd6adf0fea51287958c55730481bc08..542549ddf9287c567a40d51f40aef68e7a1ddb8e 100644 (file)
@@ -41,7 +41,9 @@ svec<int>
 Key::read(svec<String> s)
 {
     svec<int> newkey;
-    
+    for (int j = 0; j < 7; j++)
+     accidentals[j] = 0;
+   
     for (int i=0; i < s.sz(); i++) {
        int large, small;
        lookup_notename(large, small, s[i]);
index d02ed700af5fd6e28e1282c7d1a613c35dc5a816..607e144f1af0210b38182d278e18319a8b37c45b 100644 (file)
@@ -43,7 +43,7 @@ Keyitem::brew_molecole()
     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));
+       a.translate(Offset(0,(c_position + pitch[i]) * inter));
        Molecule m(a);
        output->add_right(m);   
     }    
index 5eef666525b69a631e34814fdcdce17a486300cc..b9c369c0fca29615e50e61dc821c4ee4b2ca562e 100644 (file)
@@ -4,6 +4,12 @@
 #include "dimen.hh"
 #include "tex.hh"
 
+Real
+Lookup::internote()
+{
+    return ball(4).dim.y.length()/2;
+}
+
 void
 Lookup::parse(Text_db&t)
 {
@@ -35,6 +41,7 @@ Lookup::rest(int j)
 {
     return (*symtables_)("rests")->lookup(String(j));
 }
+
 Symbol
 Lookup::accidental(int j)
 {
@@ -54,7 +61,7 @@ Lookup::clef(String s)
     return (*symtables_)("clefs")->lookup(s);
 }
  
- Symbol
+Symbol
 Lookup::dots(int j)
 {
     if (j>3)
@@ -74,11 +81,12 @@ Lookup::streepjes(int i)
     assert(i);
     
     int arg;
-    String idx ;
-    if (i<0) {
+    String idx;
+    
+    if (i < 0) {
        idx = "botlines";
        arg = -i;
-    }else {
+    } else {
        arg = i;
        idx = "toplines";
     }
@@ -121,52 +129,42 @@ Linestaf_symbol::eval(svec<String> w)const
 /****************************************************************/
 
 
-struct Meter_sym:Parametric_symbol {
-
-    Meter_sym(Symtables*s) : Parametric_symbol(s){  }
-    Symbol eval(svec<String> a) const{
-       Symbol s;
-       s.dim.x = Interval( convert_dimen(0,"pt"),
-                           convert_dimen(10,"pt"));
-       s.dim.y = Interval(0, convert_dimen(20,"pt") ); // todo
-       String src = (*symtables_)("param")->lookup("meter").tex;
-       s.tex = substitute_args(src,a);
-       return s;
-    }
-};
-/****************************************************************/
-
-struct Stem_sym:Parametric_symbol {
 
-    Stem_sym(Symtables*s) : Parametric_symbol(s) {  }
-    Symbol eval(svec<String> a) const {
-       Real y1 = a[0].fvalue();
-       Real y2 = a[1].fvalue();
-       assert(y1 <= y2);
-       Symbol s;
-       s.dim.x = Interval(0,0);
-       s.dim.y = Interval(y1,y2);
+Symbol
+Lookup::meter(svec<String> a)
+{
+    Symbol s;
+    s.dim.x = Interval( convert_dimen(0,"pt"),
+                       convert_dimen(10,"pt"));
+    s.dim.y = Interval(0, convert_dimen(20,"pt") );    // todo
+    String src = (*symtables_)("param")->lookup("meter").tex;
+    s.tex = substitute_args(src,a);
+    return s;    
+}
 
-       String src = (*symtables_)("param")->lookup("stem").tex;
-       s.tex = substitute_args(src,a);
-       return s;
-    }
-};
 
-Parametric_symbol *
-Lookup::meter(String )
+Symbol
+Lookup::stem(Real y1,Real y2)
 {
-    return new Meter_sym(symtables_);
+    assert(y1 <= y2);
+    Symbol s;
+    
+    s.dim.x = Interval(0,0);
+    s.dim.y = Interval(y1,y2);
+    
+    svec<String> a;
+    a.add(print_dimen(y1));
+    a.add(print_dimen(y2));
+       
+    String src = (*symtables_)("param")->lookup("stem").tex;
+    s.tex = substitute_args(src,a);
+    return s;
 }
 
+
 Parametric_symbol *
 Lookup::linestaff(int n)
 {
     return new Linestaf_symbol(n,symtables_);
 }
 
-Parametric_symbol*
-Lookup::stem()
-{
-    return new Stem_sym(symtables_);
-}
index c45de7a683d9e75e86da6654dec90dde51ec2463..8e499b0204729b4236a6f9c11b8e7cb9418dcbeb 100644 (file)
@@ -27,7 +27,7 @@ void notice()
     cout <<
        "LilyPond, a music typesetter.\n"
        "Copyright (C) 1996 by\n"
-       "  Han-Wen Nienhuys <hanwen@stack.urc.tue.nl>\n"
+       "  Han-Wen Nienhuys <hanwen@stack.nl>\n"
        "\n"
        "    This program is free software; you can redistribute it and/or\n"
        "modify it under the terms of the GNU General Public License version 2\n"
index fc7ccbb8fb9fab09da210465b41d64d83906c41b..712ffb7e5f2453ac6cc34bac17e4c92b43002086 100644 (file)
@@ -38,7 +38,7 @@ Item *
 Melodic_staff::get_TYPESET_item(Command*com)
 {
     if (com->args[0] == "KEY") {
-       return new Keyitem(NO_LINES);   // urgh.
+       return new Keyitem(NO_LINES);   // urgh. depends on clef.
     } else
        return Simple_staff::get_TYPESET_item(com);
 }
index 0afa8ea1a190b7f9780e46535b1adaa3be78278a..29375b8abac158070a839b7c9bc8a4f3f4f5c8fe 100644 (file)
@@ -9,12 +9,11 @@ Meter::Meter(svec<String> a)
     :args(a)
 {
 }
+
 void
 Meter::preprocess()
-{    
-    Parametric_symbol *p = paper()->lookup_->meter("general");
-    Symbol s = p->eval(args);
-    delete p;
+{
+    Symbol s = paper()->lookup_->meter(args);
     output = new Molecule(Atom(s));
 }
 
index e8c4d2adeca0f10a6728207a6f1f5a7173e31746..a664eeb74ad00c8902360a35f147318fd9ea6fb8 100644 (file)
@@ -1,4 +1,6 @@
 #include "glob.hh"
+#include "vray.hh"
+#include "interval.hh"
 #include "dimen.hh"
 #include "string.hh"
 #include "molecule.hh"
@@ -38,6 +40,7 @@ Atom::TeXstring() const
     return substitute_args(s, a);
 }
 
+/****************/
 
 String
 Molecule::TeXstring() const
index a103e69b3daaeedcb3a0975d5741f27af8fb94a1..7abc0e6b8ec238f2a22700ea3e19487d0a52398b 100644 (file)
@@ -35,7 +35,7 @@ Notehead::brew_molecole()
 
     Paperdef *p = paper();
 
-    Real dy = p->interline()/2;
+    Real dy = p->internote();
     Symbol s = p->lookup_->ball(balltype);
     
     output = new Molecule(Atom(s));
index 2b98eef98850598172b65dcbc9fe104c057c5580..5f31611f8e86fa404116e7bc07ee859c1e23a715 100644 (file)
@@ -59,6 +59,12 @@ Paperdef::interline() const
 {
     return lookup_->ball(4).dim.y.length();
 }
+
+Real
+Paperdef::internote() const
+{
+    return lookup_->internote();
+}
 Real
 Paperdef::note_width()const
 {
index 6e3092a0e334f145e20726dd97e4e4bf215b05d0..41cf4fdb67d43f4fb760f2a3d202b26575b496b2 100644 (file)
@@ -1,4 +1,5 @@
 #include "pcol.hh"
+#include "pscore.hh"
 #include "pstaff.hh"
 #include "debug.hh"
 
@@ -44,24 +45,32 @@ PCol::width() const
 void
 PCol::print() const
 {
-    #ifndef NPRINT
+#ifndef NPRINT
     mtor << "PCol {";
+    if (pscore_) {             // ugh
+       PCursor<PCol*> me=pscore_->find_col(this);
+       PCursor<PCol*> bot(pscore_->cols.top());
+       if (me.ok()) {
+           mtor << "rank: " << me - bot << '\n';
+       }
+    }
     mtor << "# symbols: " << its.size() ;
     if (breakable()){
-       mtor << "pre,post: ";
+       mtor << "\npre,post: ";
        prebreak->print();
        postbreak->print();
+    } else if (daddy) {
+       mtor<<'\n' << ((this == daddy->prebreak) ? "prebreak" : "postbreak");
     }
     mtor << "extent: " << width().min << ", " << width().max << "\n";
     mtor << "}\n";
-    #endif 
+#endif 
 }
 
 int
-PCol::compare(const PCol &, const PCol &)
+PCol::compare(const PCol &c1, const PCol &c2)
 {
-    assert(false);
-    return 0 ;
+    return c1.pscore_->compare_pcols(&c1,&c2);
 }
 
 void
@@ -71,8 +80,7 @@ PCol::OK () const
        assert(prebreak&&postbreak);
        assert(prebreak->daddy == this);
        assert(postbreak->daddy == this);
-    }
-    
+    }    
 }
 
 void
@@ -83,7 +91,10 @@ PCol::set_breakable()
 
     prebreak = new PCol(this);
     postbreak = new PCol(this);
-    used = true;
+    prebreak->pscore_ = pscore_;
+    postbreak->pscore_ = pscore_;
+    
 }
 
 bool
@@ -98,7 +109,8 @@ PCol::PCol(PCol *parent)
     prebreak=0;
     postbreak=0;
     line=0;
-    used  = false;
+    pscore_ = 0;
 }
 
 PCol::~PCol()
@@ -112,5 +124,11 @@ PCol::add( Item *i)
 {
     its.bottom().add(i);
     i->pcol_ = this;
-    used = true;
+}
+
+bool
+PCol::used()const
+{
+    return breakable() || its.size();
 }
index 663a14c783d7d74604c2ac9fa1901ef3ac353b7f..ba1113aa1ac0dc0f7bf0cf11bfea8a6d3d7b7437 100644 (file)
@@ -13,7 +13,7 @@ void
 PScore::clean_cols()
 {
     for (PCursor<PCol *> c(cols); c.ok(); )
-       if (!c->used) {
+       if (!c->used()) {
            c.del();
        } else
            c++;
@@ -71,8 +71,7 @@ PScore::typeset_spanner(Spanner*sp, PStaff*ps)
     sp->pstaff_ = ps;
     spanners.bottom().add(sp);
     ps->spans.bottom().add(sp);
-    sp->left->starters.bottom().add(sp);
-    sp->right->stoppers.bottom().add(sp);
+    // do not init start/stop fields. These are for broken spans only.
 }
 
 
@@ -83,7 +82,7 @@ PScore::add_line(svec<const PCol *> curline, svec<Real> config)
     lines.bottom().add(p);     
     for (int i=0; i < curline.sz(); i++){
        PCol *c=(PCol *)curline[i]; // so, this isn't really const.
-       c->hpos= config[i];
+       c->hpos = config[i];
     }
 }
 
@@ -104,6 +103,15 @@ PScore::get_spacing(PCol*l, PCol*r)
 }
 
 
+int
+PScore::compare_pcols(const PCol*a, const PCol*b)const
+{
+    PCursor<PCol*> ac(find_col(a));
+    PCursor<PCol*> bc(find_col(b));
+    assert(ac.ok() && bc.ok());
+    return ac - bc;
+}
+
 /*
   return all breakable columns
  */
@@ -121,6 +129,11 @@ PScore::find_breaks() const
 void
 PScore::add(PCol *p)
 {
+    p->pscore_ = this;
+    if (p->breakable()){
+       p->prebreak->pscore_ = this;
+       p->postbreak->pscore_ = this;
+    }
     cols.bottom().add(p);
 }
 
@@ -196,10 +209,28 @@ PScore::preprocess()
 void
 PScore::postprocess()
 {
-    for (PCursor<Spanner*> ic(spanners); ic.ok(); ic++) {
+    for (PCursor<Spanner*> ic(broken_spans); ic.ok(); ic++) {
        ic->process();
     }
     for (PCursor<Item*> ic(its); ic.ok(); ic++){
        ic->postprocess();
     }
 }
+
+PCursor<PCol *>
+PScore::find_col(const PCol *c)const
+{
+    PCursor<PCol*> cc(cols);
+    for (; cc.ok(); cc++)
+       if (cc.ptr() == c || cc->prebreak == c || cc->postbreak == c)
+           return cc;
+    return cc;
+}
+
+void
+PScore::add_broken(Spanner*s)
+{
+    broken_spans.bottom().add(s);
+    s->left->starters.bottom().add (s);
+    s->right->stoppers.bottom().add (s);
+}
index 417b967e1c94588ed0164aae43b1689fcef3d4df..c29d26cf4a3b98e9ca844da4c517bcf1bffc0119 100644 (file)
@@ -10,7 +10,7 @@ Score_column::Score_column(Real w)
 
 bool
 Score_column::used() {
-    return pcol_->used;
+    return pcol_->used();
 }
 
 void
index 00830e4115cd920f9abb00c0c1014163cb8a307c..2787873adbeda434388a1db5386c3e81aca94244 100644 (file)
@@ -42,7 +42,7 @@ Score_commands::last_insertion(Real w)
        Command*c = new Command(w);
        c->priority = -10000;
        pc.add(c);
-       pc ++;
+       pc++;
     }
         
     return pc;
@@ -120,9 +120,9 @@ void
 Score_commands::insert_between(Command victim, PCursor<Command*> firstc,
                               PCursor<Command*> last)
 {
-    assert(last->when==firstc->when);
     PCursor<Command*> c(firstc+1);
-    assert(last.ok());
+    assert(last->when==firstc->when&&firstc < last&&last.ok());
+    
     while (c < last) { 
        if (c->priority <= victim.priority) {
            c.insert(new Command(victim));
index 61271961743a9ed70e48ce20137abfc4da36dcb6..f421baaae6fd23f3a035fe399d639cba8dcf052f 100644 (file)
@@ -75,7 +75,7 @@ Score::clean_cols()
        sc->clean_cols();
     
     for (PCursor<Score_column*> c(cols_); c.ok(); ) {
-       if (!c->pcol_->used) {
+       if (!c->pcol_->used()) {
            mtor << "removing : ";
            c->print();
            c.del();
index 7e40c6a76a7a23892ef54341f240e9a1f4abd5fc..03d0c8482fe8b02606496e258b06325a789d1af2 100644 (file)
@@ -23,16 +23,16 @@ Line_of_score::TeXstring() const
 
 
 Line_of_score::Line_of_score(svec<const PCol *> sv,
-                            const PScore *ps)
+                            PScore *ps)
 {
-    score = ps;
+    pscore_ = ps;
     for (int i=0; i< sv.sz(); i++) {
        PCol *p=(PCol *) sv[i];
        cols.bottom().add(p);
        p->line=this;
     }
 
-    for (PCursor<PStaff*> sc(score->staffs); sc.ok(); sc++)
+    for (PCursor<PStaff*> sc(pscore_->staffs); sc.ok(); sc++)
        staffs.bottom().add(new Line_of_staff(this, sc));    
 }
 /* construct a line with the named columns. Make the line field
index 21cccabcb135abcebd9e81740ed9af9dedd6fe30..1afe0eed08f98b995b9117bbead75b4c08424215 100644 (file)
@@ -49,6 +49,9 @@ Simple_column::process_requests()
            if (rq->beam()) {
                beam_ = rq->beam();
            }
+           if (rq->slur()) {
+               slurs.add(rq->slur());
+           }
        }
 }
 
index 710e48694789797b97a444ca201e01a31e9d4fef..4918b5e6fa2af418e627b5d5e5b5c788e8138781 100644 (file)
@@ -12,6 +12,7 @@
 #include "keyitem.hh"
 #include "clefitem.hh"
 #include "keyitem.hh"
+#include "slur.hh"
 #include "localkeyitem.hh"
 
 void
@@ -91,26 +92,30 @@ Simple_walker::do_local_key(Note_req*n)
 }
 
 void
-Simple_walker::do_notes()
+Simple_walker::do_note(Rhythmic_req*rq)
 {
     Simple_column*c = col();
     Simple_staff *s = staff();
-    for (int i = 0; i <  c->notes.sz(); i ++)  {
-       Rhythmic_req*rq = c->notes[i];
-       if (rq->note()) {
-           Note_req * req = rq->note() ;
-           Notehead*n = s->get_notehead(req, clef_.c0_pos);
-           stem_->add(n);
-           noteheads.add(n);
-
-           if (wantkey)
-               do_local_key(req);
-       }
+    
+    if (rq->note()) {
+       Note_req * req = rq->note() ;
+       const Voice *v = req->elt->voice_;
        
-       if (rq->rest()) {
-           c->typeset_item( s->get_rest(rq->rest()) );
+       Notehead*n = s->get_notehead(req, clef_.c0_pos);
+       stem_->add(n);
+       noteheads.add(n);
+       int sidx =find_slur(v);
+       if (sidx >= 0) {
+           pending_slurs[sidx]->add(n);
        }
-    }     
+
+       if (wantkey)
+           do_local_key(req);
+    }
+       
+    if (rq->rest()) {
+       c->typeset_item( s->get_rest(rq->rest()) );
+    }      
 }
 
 void
@@ -123,13 +128,25 @@ Simple_walker::process_requests()
            error("Too many beams");
        beam_ = new Beam;
     }
+    for (int i=0; i < c->slurs.sz(); i++) {
+       Slur_req*sl = c->slurs[i];
+       
+       if (sl->spantype == Span_req::START) {
+           if  (find_slur(sl->elt->voice_ )>=0)
+               error("Too many slurs in voice");
+           pending_slur_reqs.add(sl);
+           pending_slurs.add(new Slur);
+       }
+    }
     
     if (c->stem_) {
        stem_ = s->get_stem(c->stem_->stem());
     }
     
-    do_notes();
-
+    for (int i = 0; i <  c->notes.sz(); i ++)  {
+       do_note(c->notes[i]);
+    }
+    
     if (beam_) {
        beam_->add(stem_);
     }
@@ -147,7 +164,7 @@ Simple_walker::process_requests()
        c->typeset_item(noteheads[i]);
     }
     noteheads.set_size(0);
-
     if (local_key_item_) {
        c->typeset_item_directional(local_key_item_, -1);
        local_key_item_ = 0;    
@@ -155,6 +172,21 @@ Simple_walker::process_requests()
     if (stem_) {
        stem_ = 0;
     }
+    for (int i=0; i < c->slurs.sz(); i++) {
+       Slur_req*sl = c->slurs[i];
+
+       if (sl->spantype == Span_req::STOP) {
+           int idx = find_slur(sl->elt->voice_);
+           if (idx < 0)
+               error("can't find slur to end");
+           
+           pscore_->typeset_spanner(pending_slurs[idx],
+                                    s->theline);
+           pending_slurs.del(idx);
+           pending_slur_reqs.del(idx);
+       }       
+    }
+    
 }
 
 Simple_walker::Simple_walker(Simple_staff*s)
@@ -191,3 +223,15 @@ Simple_walker::reset()
     processed_clef =false;    
     processed_key = false;
 }
+
+int
+Simple_walker::find_slur(const Voice *v)
+{
+    for (int i=0; i < pending_slur_reqs.sz(); i++) {
+       if (pending_slur_reqs[i]->elt->voice_ == v)
+           return i;
+    }
+    return -1;
+}
+
+    
diff --git a/src/slur.cc b/src/slur.cc
new file mode 100644 (file)
index 0000000..171f3b0
--- /dev/null
@@ -0,0 +1,105 @@
+#include "slur.hh"
+#include "lookup.hh"
+#include "paper.hh"
+#include "notehead.hh"
+#include "pcol.hh"
+#include "molecule.hh"
+#include "debug.hh"
+#include "boxes.hh"
+
+void
+Slur::add(Notehead*n)
+{
+    encompass.add(n);
+    dir = 0;
+    open_right=open_left=false;
+}
+
+Interval
+Slur::height() const
+{
+    return Interval(0,0);      // todo
+}
+
+void
+Slur::set_default_dir()
+{
+    int sumpos=0;
+    for (int i=0; i < encompass.sz(); i ++) {
+       sumpos += encompass[i]->position;
+    }
+
+    /* should consult stems */
+    Real meanpos = sumpos/Real(encompass.sz());
+    if (meanpos < 5)           // todo
+       dir = -1;
+    else
+       dir = 1;    
+}
+
+void
+Slur::print()const
+{
+    mtor << "Slur.\n";   
+}
+
+void
+Slur::preprocess()
+{
+    right  = encompass.last()->pcol_;
+    left = encompass[0]->pcol_;    
+}
+
+Spanner*
+Slur::broken_at(const PCol*l, const PCol*r) const
+{
+    assert(l->line == r->line);
+    Slur*ret = new Slur(*this);
+    ret->encompass.set_size(0);
+    for (int i =0; i < encompass.sz(); i++) {
+       if (encompass[i]->pcol_->line==l->line)
+           ret->encompass.add(encompass[i]);
+    }
+    if (right != r)
+       ret->open_right = true;
+    if (left != l)
+       ret->open_left = true;
+
+    ret->left = l;
+    ret->right = r;
+    return ret;
+}
+
+void
+Slur::process()
+{
+    set_default_dir();
+    brew_molecule();
+}
+
+void
+Slur::brew_molecule()
+{
+    output = new Molecule;
+    assert(left->line == right->line);
+    int minp=1000, maxp=-1000; // todo
+    for (int i=0; i<encompass.sz(); i++) {
+       minp = MIN(encompass[i]->position, minp);
+       maxp = MAX(encompass[i]->position, maxp);
+    }
+    
+    assert(encompass.sz()>0);  // todo
+    int pos1 = encompass.last()->position;
+    int pos2 = encompass[0]->position;
+
+    int dy =  pos1-pos2;
+
+    Real w = width().length();
+    Real nw = paper()->note_width();
+    w -= nw;
+    Symbol sl = paper()->lookup_->slur(dy , w, dir);
+    Atom a(sl);
+    a.translate(Offset(nw,pos2*paper()->internote()));
+    output->add(a);
+}
+
index 16c3ff19cb60211c89c75b13c24f52837c211781..d38a604302f87e3f4b04a781a7aebcac750194b6 100644 (file)
@@ -33,7 +33,11 @@ Spanner::preprocess()
 Interval
 Spanner::width()const
 {
-    return Interval(0,right->hpos - left->hpos);
+    Real r =right->hpos,
+       l= left->hpos;
+    assert(r>=l);
+       
+    return Interval(0, r-l);
 }
 
 Paperdef*
index c83e904bc6fbfbd6c018bffe6557febed8547371..f0f00f1a835037dbb943d01ffc2141b0b348c992 100644 (file)
@@ -25,9 +25,10 @@ Line_of_staff::TeXstring() const
     // the staff itself: eg lines, accolades
     s += "\\hbox{";
     {
-       Symbol sym = pstaff_->get_stafsym(scor->score->paper_->linewidth);
+       Symbol sym = pstaff_->get_stafsym(line_of_score_->pscore_-> // ugh
+                                         paper_->linewidth);
        s+=sym.tex;
-       PCursor<const PCol *> cc(scor->cols);
+       PCursor<const PCol *> cc(line_of_score_->cols);
        Real lastpos=cc->hpos;
 
        // all items in the current line & staff.
@@ -57,22 +58,21 @@ Line_of_staff::TeXstring() const
 
 Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
 {
-    scor=sc;
+    line_of_score_=sc;
     pstaff_=st;
-#if 0
+
+    
     const PCol *linestart = sc->cols.top();
     const PCol *linestop = sc->cols.bottom();
 
+    
     for (PCursor<const Spanner*> sp(pstaff_->spans); sp.ok(); sp++) {
        const PCol *brokenstart = &MAX(*linestart, *sp->left);
        const PCol *brokenstop = &MIN(*linestop, *sp->right);
-//     if (*brokenstop  < *brokenstart)
-       brokenspans.bottom().add(sp->broken_at(0,0));
-    }
-#endif
-    for (PCursor<const Spanner*> sp(pstaff_->spans); sp.ok(); sp++) {
-
-       brokenspans.bottom().add(sp->broken_at(0,0));
+       if ( *brokenstart < *brokenstop) {
+           line_of_score_->pscore_-> // higghl
+               add_broken(sp->broken_at(brokenstart,brokenstop));
+       }
     }
 }
 
@@ -82,10 +82,11 @@ Line_of_staff::height() const
 {
     Interval y;
     {
-       Symbol s = pstaff_->stafsym->eval(scor->score->paper_->linewidth);
+       Symbol s = pstaff_->stafsym->eval(line_of_score_->pscore_->
+                                         paper_->linewidth);
        y = s.dim.y;
     }
-    PCursor<const PCol *> cc(scor->cols);
+    PCursor<const PCol *> cc(line_of_score_->cols);
     
     // all items in the current line & staff.
     for (; cc.ok(); cc++) {
index fb8e410117babe727c60b56a0e31e8bee686b89d..126cc30474f11a80b2eb98cf64f9c16d45a9180f 100644 (file)
@@ -31,6 +31,7 @@ Stem::Stem(int c)
 void
 Stem::set_stemend(Real se)
 {
+    assert(!output);
     // todo: margins
     assert((dir > 0 && se >= maxnote) || (se <= minnote && dir <0));
     
@@ -126,13 +127,10 @@ Stem::brew_molecole()
     assert(!output);
     
     Paperdef *p =paper();
-    Parametric_symbol *stem = p->lookup_->stem();
-    
-    Real dy = p->interline()/2;
-    String y1 =print_dimen( dy * bot);
-    String y2 = print_dimen(dy * top);
-    Symbol ss =stem->eval(y1,y2);
-    delete stem;
+
+    Real dy = p->internote();
+    Symbol ss =p->lookup_->stem(bot*dy,top*dy);
+
     
     output = new Molecule(Atom(ss));
 
index 907f1d7282d34bd33111b76f5340b51c3a326bd6..02723e19b0100a34a2474d0181d8105fe302b9ea 100644 (file)
@@ -1,4 +1,6 @@
 #include "symbol.hh"
+#include "vray.hh"
+#include "textdb.hh"
 
 Symbol::Symbol()
     :    dim(Interval(0,0),Interval(0,0))
index a28d14670c279477cf294dfe128a5cfaaba1bc1d..39b6fdead0437943f07df05d00763b4a9b7b41bf 100644 (file)
@@ -1,4 +1,5 @@
 #include "misc.hh"
+#include "textdb.hh"
 #include "dimen.hh"
 #include "debug.hh"
 #include "real.hh"
@@ -13,8 +14,10 @@ Symtable::lookup(String s) const
     if (elt_query(s))
        return (*this)[s];
     else {
-       error( "Unknown symbol " +s+'\n');
+       error( "Unknown symbol `" +s+"'\n");
     }
+    Symbol sy;                 // unreachable
+    return sy;
 }
 
 Symtable* 
@@ -27,7 +30,7 @@ void
 Symtables::read(Text_db &symini)
 {
      while (!symini.eof()) {
-        Text_record  r(  symini++);
+        Text_record  r(symini++);
         if (r[0] == "end" )
             return;
         assert (r[0] == "table");
@@ -55,6 +58,3 @@ Symtables::read(Text_db &symini)
         (*this)[tabnam] = sp;           
      }
 }
-
-
-
index e2bae216b66cdb790636b94fc61deb9698f4990e..64834ea93e1c373a4e467444d6bf3a0730eae8cf 100644 (file)
@@ -8,9 +8,9 @@
 #include "scoreline.hh" 
 #include "staffline.hh"
 
-#include "list.cc"
+
 #include "plist.cc"
-#include "cursor.cc"
+
 
 #define IPLC_instantiate(a) IPL_instantiate(a); PL_instantiate(const a)
 
index a4ce99da1fac3421f17a24d02d97a332e78071d2..23e6aae20027b972cadd0e9677eb59c9d1391e70 100644 (file)
@@ -7,9 +7,8 @@
 #include "stcol.hh"
 #include "spanner.hh"
 
-#include "list.cc"
 #include "plist.cc"
-#include "cursor.cc"
+
 
 IPL_instantiate(Score_column);
 IPL_instantiate(Staff_column);
index 00425941557697c1d7b088e5dc99d2c61eabb24f..a457b6afbbf84fd7c4fe528e3c6001298f9db64e 100644 (file)
@@ -1,11 +1,10 @@
 #include "request.hh"
 #include "command.hh"
 #include "molecule.hh"
-#include "list.cc"
 #include "plist.cc"
-#include "cursor.cc"
+
 
 IPL_instantiate(Atom);
 IPL_instantiate(Command);
 IPL_instantiate(Request);
-L_instantiate(void*);
+
diff --git a/src/template4.cc b/src/template4.cc
new file mode 100644 (file)
index 0000000..e409a9b
--- /dev/null
@@ -0,0 +1,4 @@
+#include "list.cc"
+#include "cursor.cc"
+
+L_instantiate(void *);
index ae9dc1b5f3064bb2e9d7d6fc239a046394b4030c..60d487dfd1a1a9d69ae2ac7cc09f2fc6814df372 100644 (file)
@@ -2,6 +2,7 @@
 #include "tex.hh"
 #include "symbol.hh"
 #include "const.hh"
+#include "vray.hh"
 
 String
 vstrut(Real h)
diff --git a/src/texslur.cc b/src/texslur.cc
new file mode 100644 (file)
index 0000000..413c218
--- /dev/null
@@ -0,0 +1,187 @@
+#include "lookup.hh"
+#include "molecule.hh"
+#include <math.h>
+#include "dimen.hh"
+#include "debug.hh"
+
+static
+char direction_char(int y_sign)
+{
+    char c;
+    switch(y_sign){
+    case -1:
+       c = 'd';
+       break;
+    case 0:
+       c = 'h';
+       break;
+    case 1:
+       c = 'u';
+       break;
+    default:
+       assert(false);
+    }
+    return c;
+}
+
+Symbol
+Lookup::half_slur_middlepart(Real &dx, int dir)
+{
+    if (dx >= convert_dimen(400,"pt")) // todo
+       error ("halfslur too large");
+    int    widx = int(floor(dx / 4.0));
+    dx = widx * 4.0;
+    widx --;   
+
+    Symbol s;
+    
+    s.dim.y = Interval(MIN(0,0), MAX(0,0));
+    s.dim.x = Interval(0,dx);
+
+    String f =  String("\\hslurchar");
+    f += direction_char(0);
+
+    int idx = widx;
+    if (dir < 0)
+       idx += 128;
+
+
+    f+=String( "{" ) + idx + "}";
+    s.tex = f;
+    Atom a(s);
+    a.translate(Offset(dx/2,0));
+    s.tex = a.TeXstring();
+
+    return s;
+}
+Symbol
+Lookup::half_slur(int dy, Real &dx, int dir, int xpart)
+{
+    if (!xpart)
+       return half_slur_middlepart(dx, dir);
+
+    int widx;
+               
+    if (dx >= convert_dimen(96,"pt"))
+       dx =  convert_dimen(96,"pt");
+    
+    widx = int(rint(dx/12.0));
+    dx = widx*12.0;
+    widx --;
+
+    Symbol s;
+    s.dim.x = Interval(0,dx);
+    s.dim.y = Interval(MIN(0,dy), MAX(0,dy));
+
+
+    String f = String("\\hslurchar");
+
+    f+= direction_char(dir);
+
+    int hidx = dy;
+    if (hidx <0)
+       hidx = -hidx;
+    hidx --;
+    int idx =-1;
+    
+
+    idx = widx * 16 + hidx;
+    if (xpart < 0)
+       idx += 128;
+    
+    f+=String( "{" ) + idx + "}";
+
+    
+    s.tex = f;
+    return s;
+}
+
+Symbol
+Lookup::slur (int dy , Real &dx, int dir)
+{                              // ugh. assuming pt here.
+    assert(dx >=0);
+    int y_sign = sgn(dy);
+
+    bool large = dy > 16;
+
+    if (y_sign) {
+       large |= dx>= convert_dimen(4*16, "pt");
+    } else
+       large |= dx>= convert_dimen(4*54, "pt");
+    
+    if (large) {
+       return big_slur(dy, dx, dir);
+    }
+    
+    int widx = int(floor(dx/4.0)); // slurs better too small..
+    dx = 4.0 * widx;
+    widx--;
+    int hidx = dy;
+    if (hidx <0)
+       hidx = -hidx;
+    hidx --; 
+    if (hidx > 16)
+       error("slur to steep");
+    
+    
+    Symbol s;
+    s.dim.x = Interval(0,dx);
+    s.dim.y = Interval(MIN(0,dy), MAX(0,dy));
+
+    String f = String("\\slurchar") + direction_char(y_sign);
+
+    int idx=-1;
+    if (y_sign) {      
+       idx = hidx * 16 + widx;
+       if (dir < 0)
+           idx += 128;
+    } else {
+       if (dx >= convert_dimen(4*54, "pt"))
+           error("slur too wide");
+       idx = widx;
+       if (dir > 0)
+           idx += 54;          
+    }
+    
+    f+=String( "{" ) + idx + "}";
+    s.tex = f;
+
+    Atom a(s);
+    a.translate(Offset(dx/2,0));
+    s.dim = a.extent();
+    s.tex = a.TeXstring();
+    return s;    
+}
+
+Symbol
+Lookup::big_slur(int dy , Real &dx, int dir)
+{
+    assert(dx >= convert_dimen(24,"pt"));
+
+    Real slur_extra =ABS(dy)  /2.0 + 2; 
+    int l_dy = Real (dy)/2 + slur_extra*dir;
+    int r_dy =  dy - l_dy;
+    
+    Real left_wid = dx/4.0;
+    Real right_wid = left_wid;
+
+    Atom l = half_slur(l_dy, left_wid, dir, -1);
+    Atom r = half_slur(r_dy, right_wid, dir, 1);
+    Real mid_wid = dx - left_wid - right_wid;
+    Atom m = half_slur(0, mid_wid, dir, 0);
+
+    Molecule mol;
+    mol.add(l);
+    Atom a(m);
+    a.translate(Offset(0,slur_extra * internote()));
+    mol.add_right(m);
+    mol.add_right(r);
+    mol.translate(Offset(l_dy * internote(), 0));
+    Symbol s;
+    s.tex = mol.TeXstring();
+    s.dim = mol.extent();
+    return s;
+}
+
+
index c713822a4b26c5eb21dae28a58f7d3186ee014c7..fbdb207aab283334bfd75b2ffdaff12e59e2590b 100644 (file)
@@ -15,14 +15,14 @@ Voice::Voice()
 void
 Voice::add(Voice_element*v)
 {
+    v->voice_ = this;
     elts.bottom().add(v);
 }
 
 void
 Voice::print() const
 {
-        #ifndef NPRINT
-
+#ifndef NPRINT
     mtor << "start: "<< start<<eol;
     for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
        vec->print();
@@ -63,7 +63,7 @@ Voice_element::add(Request*r)
 
 Voice_element::Voice_element()
 {
-    voice = 0;
+    voice_ = 0;
     group = 0;
     duration = 0.0;
 }
@@ -71,7 +71,7 @@ Voice_element::Voice_element()
 Voice_element::Voice_element(Voice_element const&src)
 {
     duration=src.duration;
-    voice=src.voice;
+    voice_=src.voice_;
     IPointerList__copy(Request*, reqs, src.reqs, clone());
     group=src.group;
     assert(!granted_items.size() && !granted_spanners.size());
index 426173ee0c2d63a95b3440f54ae21ca68c484804..6d35d8cad6377d06a9ecf2b3c4ed61dc5e30c6a2 100644 (file)
@@ -4,15 +4,17 @@
 
 
 
-void warning(String s)
+void
+warning(String s)
 {
     WARN << s;
 }
 
 
-void error(String s)
+void
+error(String s)
 {
-    cerr << "\n" << s << "\nexiting..\n";
+    cerr << "\nerror: " << s << "\n";
     exit(1);
 }
 
index ccebe42afd5f8275eb6fa42334ef9e08e1fab5d6..4dc275334782b21cef7c1e6cf3bab007863e42cb 100644 (file)
@@ -19,6 +19,10 @@ table balls
        4       \quartball      0pt     6pt     -2.5pt  2.5pt
 end
 
+table slur
+       whole   \slurchar%{%}   0pt     0pt     0pt     0pt
+       half    \hslurchar%{%}  0pt     0pt     0pt     0pt
+end
 table accidentals
        -2      \flatflat       0pt     10.2pt  -2.5pt 7.5pt
        -1      \flat           0pt     6pt     -2.5pt 7.5pt