]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.76
authorfred <fred>
Sun, 24 Mar 2002 19:48:20 +0000 (19:48 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:48:20 +0000 (19:48 +0000)
lily/include/col-info.hh [new file with mode: 0644]
lily/p-score.cc

diff --git a/lily/include/col-info.hh b/lily/include/col-info.hh
new file mode 100644 (file)
index 0000000..985df3b
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+  col-info.hh -- declare 
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef COL_INFO_HH
+#define COL_INFO_HH
+
+#include "lily-proto.hh"
+#include "pointer.hh"
+#include "interval.hh"
+
+/// helper struct for #Spacing_problem#
+struct Colinfo {
+    PCol *pcol_l_;
+    P<Real> fixpos_p_;
+    Interval width;
+    int rank_i_;
+    /// did some tricks to make this column come out.
+    bool ugh_b_;               
+    /* *************** */
+    Colinfo();
+    Colinfo(PCol *,Real const *);
+
+    void print() const;
+    bool fixed() const { return fixpos_p_.get_C();}
+    Real fixed_position()const { return *fixpos_p_; }
+    Real minright() const { return width.right; }
+    Real minleft() const { return -width.left; }
+};
+
+#endif // COL_INFO_HH
index 92e8d4e871f029a83a07e0b910c8faf49c015df9..0e093c9693a55ec6e849ec987ea503aef74c517a 100644 (file)
@@ -7,7 +7,6 @@
 */
 
 #include "super-elem.hh"
-#include "idealspacing.hh"
 #include "debug.hh"
 #include "lookup.hh"
 #include "spanner.hh"
 #include "scoreline.hh"
 #include "p-score.hh"
 #include "tex-stream.hh"
-#include "break.hh"
+#include "word-wrap.hh"
 #include "p-col.hh"
 
+PScore::PScore(Paper_def*p)
+{
+    paper_l_ = p;
+    super_elem_l_   = new Super_elem;
+    typeset_element(super_elem_l_);
+}
+
+PScore::~PScore()
+{
+    super_elem_l_->unlink_all();
+}
+
 void
 PScore::typeset_element(Score_elem * elem_p)
 {
@@ -60,10 +71,10 @@ PScore::typeset_broken_spanner(Spanner*span_p)
 void
 PScore::typeset_unbroken_spanner(Spanner*span_p)
 {
-    spanners.bottom().add(span_p);
+    span_p_list_.bottom().add(span_p);
     span_p->pscore_l_=this;
 
-    if (     span_p->left_col_l_) 
+    if (span_p->left_col_l_) 
        span_p->left_col_l_->used_b_ = true;
     if ( span_p->right_col_l_)
        span_p->right_col_l_->used_b_ = true;
@@ -72,23 +83,12 @@ PScore::typeset_unbroken_spanner(Spanner*span_p)
     span_p->add_processing();
 }
 
-Idealspacing*
-PScore::get_spacing(PCol*l, PCol*r)
-{
-    assert(l!=r);
-
-    Idealspacing*i_p =new Idealspacing(l,r);
-    suz.bottom().add(i_p);
-
-    return i_p;
-}
-
 
 void
 PScore::clean_cols()
 {
     int rank_i = 0;
-    for (iter_top(cols,c); c.ok(); )
+    for (iter_top(col_p_list_,c); c.ok(); )
        if (!c->used_b()) {
            delete c.remove_p();
        } else {
@@ -97,27 +97,6 @@ PScore::clean_cols()
        }
 }
 
-void
-PScore::do_connect(PCol *c1, PCol *c2, Real d, Real h)
-{
-    if (!c1 || !c2 )
-       return;
-    Idealspacing*s_l=get_spacing(c1,c2);
-
-    
-    s_l->hooke = h;
-    s_l->space =d;
-}
-
-void
-PScore::connect(PCol* c1, PCol *c2, Real d, Real h)
-{
-    do_connect(c1,c2,d,h);
-    do_connect(c1->postbreak_p_, c2,d,h);
-    do_connect(c1, c2->prebreak_p_,d,h);
-    do_connect(c1->postbreak_p_, c2->prebreak_p_,d,h);
-}
-
 void
 PScore::add(PCol *p)
 {
@@ -126,14 +105,7 @@ PScore::add(PCol *p)
        p->prebreak_p_->pscore_l_ = this;
        p->postbreak_p_->pscore_l_ = this;
     }
-    cols.bottom().add(p);
-}
-
-PScore::PScore(Paper_def*p)
-{
-    paper_l_ = p;
-    super_elem_l_   = new Super_elem;
-    typeset_element(super_elem_l_);
+    col_p_list_.bottom().add(p);
 }
 
 void
@@ -145,19 +117,12 @@ PScore::output(Tex_stream &ts)
 }
 
 
-PScore::~PScore()
-{
-    super_elem_l_->unlink_all();
-}
-
 void
 PScore::OK()const
 {
 #ifndef NDEBUG
-    for (iter_top(cols,cc); cc.ok(); cc++)
+    for (iter_top(col_p_list_,cc); cc.ok(); cc++)
        cc->OK();
-    for (iter_top(suz,i); i.ok(); i++)
-       i->OK();
 #endif
 }
 
@@ -171,15 +136,12 @@ PScore::print() const
     for (iter_top(elem_p_list_,cc); cc.ok(); cc++)     
        cc->print();
     mtor << "\n unbroken spanners: ";
-    for (iter(spanners.top(), i); i.ok(); i++)
+    for (iter(span_p_list_.top(), i); i.ok(); i++)
        i->print();
     mtor << "\ncolumns: ";
-     for (iter_top(cols,cc); cc.ok(); cc++)
+     for (iter_top(col_p_list_,cc); cc.ok(); cc++)
        cc->print();
     
-    mtor << "\nideals: ";
-    for (iter_top(suz,i); i.ok(); i++)
-       i->print();
     mtor << "}\n";
 #endif 
 }
@@ -205,7 +167,7 @@ PScore::find_col(PCol const *c)const
     if (what->daddy_l_ )
        what = what->daddy_l_;
     
-    return cols.find((PCol*)what);
+    return col_p_list_.find((PCol*)what);
 }
 
 
@@ -216,7 +178,7 @@ PScore::set_breaking(Array<Col_hpositions> const &breaking)
     super_elem_l_->break_processing();
 
 
-    for (iter(spanners.top(),i); i.ok(); ) {
+    for (iter(span_p_list_.top(),i); i.ok(); ) {
        Spanner *span_p = i.remove_p();
        if (span_p->broken_b()) {
            span_p->unlink();
@@ -234,7 +196,7 @@ PScore::set_breaking(Array<Col_hpositions> const &breaking)
            i++;
     }
 
-    for (iter_top(cols, i); i.ok(); i++)
+    for (iter_top(col_p_list_, i); i.ok(); i++)
        i->clean_breakable_items();
 }
 
@@ -242,6 +204,7 @@ void
 PScore::calc_breaking()
 {
     Word_wrap w(*this);
+
     set_breaking(w.solve());
 }
 
@@ -264,8 +227,8 @@ PScore::breakable_col_range(PCol*l,PCol*r)const
 {
     Link_array<PCol> ret;
 
-    PCursor<PCol*> start(l ? find_col(l)+1 : cols.top() );
-    PCursor<PCol*> stop(r ? find_col(r) : cols.bottom());
+    PCursor<PCol*> start(l ? find_col(l)+1 : col_p_list_.top() );
+    PCursor<PCol*> stop(r ? find_col(r) : col_p_list_.bottom());
 
     /*
       ugh! windows-suck-suck-suck.
@@ -283,8 +246,8 @@ PScore::col_range(PCol*l,PCol*r)const
 {
     Link_array<PCol> ret;
     
-    PCursor<PCol*> start(l ? find_col(l)+1 : cols.top() );
-    PCursor<PCol*> stop(r ? find_col(r) : cols.bottom());
+    PCursor<PCol*> start(l ? find_col(l)+1 : col_p_list_.top() );
+    PCursor<PCol*> stop(r ? find_col(r) : col_p_list_.bottom());
     ret.push(l);
     
     /*
@@ -301,8 +264,8 @@ PScore::broken_col_range(PCol*l,PCol*r)const
 {
     Link_array<PCol> ret;
 
-    PCursor<PCol*> start(l ? find_col(l)+1 : cols.top() );
-    PCursor<PCol*> stop(r ? find_col(r) : cols.bottom());
+    PCursor<PCol*> start(l ? find_col(l)+1 : col_p_list_.top() );
+    PCursor<PCol*> stop(r ? find_col(r) : col_p_list_.bottom());
   
     /*
       ugh! windows-suck-suck-suck.