]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.11
authorfred <fred>
Mon, 25 Nov 1996 00:09:32 +0000 (00:09 +0000)
committerfred <fred>
Mon, 25 Nov 1996 00:09:32 +0000 (00:09 +0000)
Documentation/Makefile
Documentation/pointers [new file with mode: 0644]
hdr/pscore.hh
src/pscore.cc

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)
+       
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 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);
+}