/*
- linespace.hh -- declare Colinfo, Spacing_problem
+ linespace.hh -- declare Spacing_problem
- source file of the LilyPond music typesetter
+ source file of the GNU LilyPond music typesetter
- (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#error
#ifndef LINESPACE_HH
#define LINESPACE_HH
-#include "glob.hh"
+
#include "plist.hh"
-#include "varray.hh"
+#include "array.hh"
#include "vector.hh"
#include "interval.hh"
#include "pointer.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; }
-};
-
/** the problem, given by the columns (which include constraints) and
intercolumn spacing. The problem is:
*/
class Spacing_problem {
- Array<Idealspacing const *> ideals;
- Array<Colinfo> cols;
- Array<Colinfo> loose_col_arr_;
+ PointerList<Idealspacing *> ideal_p_list_;
+ Array<Column_info> cols;
+ Array<Column_info> loose_col_arr_;
/// mark column #i# as being loose.
- void loosen_column(int i);
+ void loosen_column (int i);
/// the index of #c# in #cols#
- int col_id(PCol const *c) const;
+ int col_id (Paper_column const *c) const;
/// generate an (nonoptimal) solution
Vector find_initial_solution() const;
bool check_feasible() const;
/// does #this# contain the column #w#?
- bool contains(PCol const *w);
+ bool contains (Paper_column const *w);
/// make the energy function
- void make_matrices(Matrix &quad, Vector &lin,Real&) const;
+ void make_matrices (Matrix &quad, Vector &lin,Real&) const;
/// generate the LP constraints
- void make_constraints(Mixed_qp& lp) const;
+ void make_constraints (Mixed_qp& lp) const;
void handle_loose_cols();
- void position_loose_cols(Vector &) const;
-public:
- Array<PCol*> error_pcol_l_arr() const;
-
- /** solve the spacing problem
-
- @return the column positions, and the energy (last element)
+ void position_loose_cols (Vector &) const;
+ void print_ideal (Idealspacing const *) const;
+ Vector try_initial_solution() const;
+ void calcideal();
- */
- Array<Real> solve() const;
+ Score_column* scol_l (int);
+ void connect (int i,int j, Real,Real);
+public:
+ static Line_spacer *constructor() {
+ return new Line_spacer;
+ }
+ Array<Paper_column*> error_pcol_l_arr() const;
-
- /**
- add a idealspacing to the problem.
-
- One pair of columns can have no, one or more idealspacings,
- since they can be "summed" if the columns to which #i# refers are
- not in this problem, the spacing is ignored.
- */
- void add_ideal(Idealspacing const *i);
-
-
- /** add a col to the problem. columns have to be added left to right. The column contains
- info on it's minimum width.
- */
- void add_column(PCol *, bool fixed=false, Real fixpos=0.0);
+ virtual Array<Real> solve() const;
+ virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0);
-
- bool check_constraints(Vector v) const;
-
- Vector try_initial_solution() const;
- void OK() const;
- void print() const;
- void print_ideal(Idealspacing const *)const;
- void prepare();
+ virtual Vector default_solution() contains {
+ return try_initial_solution() ;
+ }
+ virtual bool check_constraints (Vector v) const;
+ virtual void OK() const;
+ virtual void print() const;
+ virtual void prepare();
};
-
-
-#endif