#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 *
#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;
lastpos = cc->hpos;
// moveover
- s +=String( "\\kern ") + HOR_TO_PT*delta + "pt ";
+ s +=String( "\\kern ") + print_dimen(delta);
// now output the items.
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.
#include "glob.hh"
#include "list.hh"
#include "vray.hh"
-#include "cols.hh"
+#include "pcol.hh"
#include "matrix.hh"
/// helper struct for #Spacing_problem#
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; }
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
--- /dev/null
+#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;
+}
+
#include "vray.hh"
-#include "cols.hh"
+#include "pcol.hh"
#include "pstaff.hh"
/// all stuff which goes onto paper
PointerList<Spanner *> spanners;
/****************************************************************/
+
+ svec<Item*> select_items(PStaff*, PCol*);
void calc_breaking();
/**
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#
#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);