-// the breaking problem for a score.
+/*
+ p-score.hh -- declare PScore
-#ifndef PSCORE_HH
-#define PSCORE_HH
+ source file of the GNU LilyPond music typesetter
-#include "colhpos.hh"
-#include "varray.hh"
-#include "p-col.hh"
-#include "p-staff.hh"
+ (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
-/** all stuff which goes onto paper. notes, signs, symbols in a score can be grouped in two ways:
- horizontally (staffwise), and vertically (columns). #PScore#
- contains the items, the columns and the staffs.
- */
+#ifndef P_SCORE_HH
+#define P_SCORE_HH
-struct PScore {
- Paper_def *paper_l_;
-
- /// the columns, ordered left to right
- IPointer_list<PCol *> cols;
+#include "colhpos.hh"
+#include "parray.hh"
+#include "lily-proto.hh"
+#include "plist.hh"
- /// the idealspacings, no particular order
- IPointer_list<Idealspacing*> suz;
+/** all stuff which goes onto paper. notes, signs, symbols in a score
+ #PScore# contains the items, the columns.
+
+ */
- /// the staffs ordered top to bottom
- IPointer_list<PStaff*> staffs;
+class PScore {
+public:
+ Paper_def *paper_l_;
- /// all symbols in score. No particular order.
- IPointer_list<Item*> its;
+ /// the columns, ordered left to right
+ Pointer_list<PCol *> col_p_list_;
- /// if broken, the different lines
- IPointer_list<Line_of_score*> lines;
+ /// the idealspacings, no particular order
+ Pointer_list<Idealspacing*> suz_p_list_;
/// crescs etc; no particular order
- IPointer_list<Spanner *> spanners;
+ Pointer_list<Spanner *> span_p_list_;
- /// broken spanners
- IPointer_list<Spanner*> broken_spans;
+ /// other elements
+ Pointer_list<Score_elem*> elem_p_list_;
+
+ Super_elem *super_elem_l_;
/* *************** */
/* CONSTRUCTION */
PScore(Paper_def*);
/// add a line to the broken stuff. Positions given in #config#
- void set_breaking(Array<Col_hpositions>);
-
- void add(PStaff *);
-
+ void set_breaking(Array<Col_hpositions> const &);
/** add an item.
add the item in specified containers. If breakstatus is set
properly, add it to the {pre,post}break of the pcol.
*/
- void typeset_item(Item *item_p, PCol *pcol_l,PStaff*pstaf_l,int breakstatus=1);
+ void typeset_item(Item *item_p, PCol *pcol_l,int breakstatus=0);
- /// add a Spanner
- void typeset_spanner(Spanner*, PStaff*);
-
/// add to bottom of pcols
void add(PCol*);
- void add_broken(Spanner*);
- /* INSPECTION */
- Array<Item*> select_items(PStaff*, PCol*);
-
- /**
- @return argument as a cursor of the list
- */
+ /**
+ @return argument as a cursor of the list
+ */
PCursor<PCol *> find_col(PCol const *)const;
+ Link_array<PCol> col_range(PCol *left_l, PCol *right_l) const;
+ Link_array<PCol> breakable_col_range(PCol*,PCol*) const;
+ Link_array<PCol> broken_col_range(PCol*,PCol*) const;
+
/* MAIN ROUTINES */
void process();
/* UTILITY ROUTINES */
- /// get the spacing between c1 and c2, create one if necessary.
- Idealspacing* get_spacing(PCol *c1, PCol *c2);
-
- /// connect c1 and c2
- void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f);
-
- /// connect c1 and c2 and any children of c1 and c2
- void connect(PCol* c1, PCol *c2, Real distance_f,Real strength_f= 1.0);
/* STANDARD ROUTINES */
void OK()const;
void print() const;
+ ~PScore();
+ void typeset_element(Score_elem*);
+ void typeset_broken_spanner(Spanner*);
+ /// add a Spanner
+ void typeset_unbroken_spanner(Spanner*);
+
+
private:
/// before calc_breaking
void preprocess();
+ void calc_idealspacing();
/// calculate where the lines are to be broken, and use results
void calc_breaking();