]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.4
authorfred <fred>
Tue, 22 Oct 1996 19:45:35 +0000 (19:45 +0000)
committerfred <fred>
Tue, 22 Oct 1996 19:45:35 +0000 (19:45 +0000)
item.cc
line.cc
linespace.hh
pcol.cc [new file with mode: 0644]
pscore.hh
template1.cc

diff --git a/item.cc b/item.cc
index 72f447be94cb47eecca35b7070e568b563543781..453200627b0e5694a8dc3d3c59912c52829f1158 100644 (file)
--- a/item.cc
+++ b/item.cc
@@ -1,13 +1,14 @@
 #include "line.hh"
 #include "symbol.hh"
-#include "cols.hh"
+#include "molecule.hh"
+#include "pcol.hh"
 
 String
 Spanner::TeXstring() const
 {
     assert(right->line);
     Real w = left->hpos - right->hpos;
-    return (*strets)(w);
+    return strets->eval(w).tex;
 }
 
 Spanner *
diff --git a/line.cc b/line.cc
index d0a5d794bbf90ab7f5878b1cf3bcd9a07d6e8912..ebe9595d3b78b1a94e534d9559cff414c56b3557 100644 (file)
--- a/line.cc
+++ b/line.cc
@@ -1,21 +1,23 @@
 #include "line.hh"
+#include "dimen.hh"
 #include "symbol.hh"
-#include "cols.hh"
+#include "pcol.hh"
 #include "pscore.hh"
 
 String
 Line_of_staff::TeXstring() const
 {
     String s("%line_of_staff\n\\vbox to ");
-    s += String(maxheight() * VERT_TO_PT) +"pt{";
+    s += print_dimen(maxheight() ) +"{";
 
     //make some room
-    s += vstrut(base* VERT_TO_PT);
+    s += vstrut(base);
 
     // the staff itself: eg lines, accolades
     s += "\\hbox{";
     {
-       s+=(*pstaff_->stafsym)(scor->score->linewidth);
+       Symbol sym = pstaff_->get_stafsym(scor->score->linewidth);
+       s+=sym.tex;
        PCursor<const PCol *> cc(scor->cols);
        Real lastpos=cc->hpos;
 
@@ -25,7 +27,7 @@ Line_of_staff::TeXstring() const
            lastpos = cc->hpos;
 
            // moveover
-           s +=String( "\\kern ") + HOR_TO_PT*delta + "pt ";
+           s +=String( "\\kern ") + print_dimen(delta);
 
            // now output the items.
 
@@ -102,7 +104,10 @@ Real
 Line_of_staff::maxheight() const
 {
     Interval y;
-    y = pstaff_->stafsym->height(scor->score->linewidth);
+    {
+       Symbol s = pstaff_->stafsym->eval(scor->score->linewidth);
+       y = s.dim.y;
+    }
     PCursor<const PCol *> cc(scor->cols);
     
     // all items in the current line & staff.
index 5a3c4edeb88303aec5b17f51592aed9d54f5bee8..e5b23ca7f0504a829424cd54c1a47187695de3a3 100644 (file)
@@ -4,7 +4,7 @@
 #include "glob.hh"
 #include "list.hh"
 #include "vray.hh"
-#include "cols.hh"
+#include "pcol.hh"
 #include "matrix.hh"
 
 /// helper struct for #Spacing_problem#
@@ -12,10 +12,7 @@ struct Colinfo {
     const PCol *col;
     bool fixed;
     Real fixpos;
-    Colinfo() {
-       fixed=false;
-       col=0;
-    }
+    Colinfo();
     void print() const;
     Real minright()const { return col->width().max; }
     Real minleft()const { return -col->width().min; }
@@ -42,7 +39,7 @@ class Spacing_problem {
     void make_matrices(Matrix &quad, Vector &lin,Real&) const;
 
     /// generate the LP constraints
-    void make_constraints(Optimisation_problem& lp) const;
+    void make_constraints(Mixed_qp& lp) const;
 
 public:
     /// solve the spacing problem
diff --git a/pcol.cc b/pcol.cc
new file mode 100644 (file)
index 0000000..44c82a9
--- /dev/null
+++ b/pcol.cc
@@ -0,0 +1,106 @@
+#include "pcol.hh"
+#include "pstaff.hh"
+#include "debug.hh"
+
+void
+Idealspacing::print() const
+{
+    #ifndef NPRINT
+    mtor << "idealspacing {" ;
+    mtor << "distance "<<space<< " strength " << hooke << "}\n";
+    #endif
+}
+
+Idealspacing::Idealspacing(const PCol * l,const PCol * r)
+{
+    space = 0.0;
+    hooke = 0.0;
+    left = l;
+    right = r;
+}
+void
+Idealspacing::OK() const
+{
+#ifndef NDEBUG
+    assert(hooke >= 0 && left  && right);
+#endif    
+}
+
+/****************************************************************/
+
+Interval
+PCol::width() const
+{
+    Interval w;
+
+    for (PCursor<const Item *> ic(its); ic.ok(); ic++)
+       w.unite(ic->width());
+    if (w.empty())
+       w.unite(Interval(0,0));
+    return w;
+}
+
+void
+PCol::print() const
+{
+    #ifndef NPRINT
+    mtor << "PCol {";
+    mtor << "# symbols: " << its.size() ;
+    mtor << "breakable: " << breakable<<"\n";
+    mtor << "extent: " << width().min << ", " << width().max << "\n";
+    mtor << "}\n";
+    #endif 
+}
+
+int
+PCol::compare(const PCol &, const PCol &)
+{
+    assert(false);
+    return 0 ;
+}
+
+void
+PCol::OK () const
+{
+    if (prebreak || postbreak ) {
+       assert(breakable);
+    }
+    
+}
+
+void
+PCol::set_breakable()
+{
+    if (breakable)
+       return;
+
+    prebreak = new PCol(this);
+    postbreak = new PCol(this);
+    breakable = true;
+    used = true;
+}
+
+PCol::PCol(PCol *parent) {
+    daddy = parent;
+    prebreak=0;
+    postbreak=0;
+    breakable=false;
+    line=0;
+    used  = false;
+}
+
+PCol::~PCol()
+{
+    if (prebreak)
+       delete prebreak;        // no recursion!
+    if (postbreak)
+       delete postbreak;       
+}
+
+void
+PCol::add(const Item *i)
+{
+    its.bottom().add(i);
+    used = true;
+}
+
index 75da46a4a5274341443e96878e6e344c90ec23e9..5ae4c37951649695cca690a9f1e99339500f56d3 100644 (file)
--- a/pscore.hh
+++ b/pscore.hh
@@ -5,7 +5,7 @@
 
 
 #include "vray.hh"
-#include "cols.hh"
+#include "pcol.hh"
 #include "pstaff.hh"
 
 /// all stuff which goes onto paper
@@ -32,6 +32,8 @@ struct PScore {
     PointerList<Spanner *> spanners;
 
     /****************************************************************/
+
+    svec<Item*> select_items(PStaff*, PCol*);
     
     void calc_breaking();
     /**
@@ -69,9 +71,10 @@ struct PScore {
 
     PCursor<PCol *> find_col(PCol *);
     void clean_cols();
-    void problem_OK() ;
-
+    void problem_OK()const ;
+    void OK()const ;
     PScore();
+    void print() const;
 };
 /** notes, signs, symbols in a score can be grouped in two ways:
     horizontally (staffwise), and vertically (columns). #PScore#
index 908de8d4e1ac1c32784386bf8bce2a0e87c2fd89..b7c453b6e07065e84562087e2d8d24ca13e8e6b6 100644 (file)
@@ -1,20 +1,20 @@
 #include "line.hh"
 
 #include "list.hh"
-#include "cols.hh"
+#include "pcol.hh"
 #include "item.hh"
 #include "request.hh"
 #include "command.hh"
 
 #include "list.cc"
 #include "cursor.cc"
+#define PLC_instantiate(a) PL_instantiate(a); PL_instantiate(const a)
 
-
-PL_instantiate(Line_of_score);
-PL_instantiate(Line_of_staff);
-PL_instantiate(Item);
-PL_instantiate(Spanner);
-PL_instantiate(PStaff);
-PL_instantiate(Idealspacing);
-PL_instantiate(PCol);
+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);