]> git.donarmstrong.com Git - lilypond.git/blobdiff - hdr/pscore.hh
partial: 0.0.39-1.hanjan
[lilypond.git] / hdr / pscore.hh
index 70e783c889c561b700f49873c49b0b8339cb535f..b7ad49c0e12ea69eea8cd7d59386768010675196 100644 (file)
 #ifndef PSCORE_HH
 #define PSCORE_HH
 
-
-#include "vray.hh"
+#include "colhpos.hh"
+#include "varray.hh"
 #include "pcol.hh"
 #include "pstaff.hh"
 
-/// all stuff which goes onto paper
+
+/** 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.
+ */
+
 struct PScore {
-    Paperdef *paper_;          // indirection.
+    Paper_def *paper_l_;
     
     /// the columns, ordered left to right
-    PointerList<PCol *> cols;
+    IPointerList<PCol *> cols;
 
     /// the idealspacings, no particular order
-    PointerList<Idealspacing*> suz;
+    IPointerList<Idealspacing*> suz;
 
     /// the staffs ordered top to bottom
-    PointerList<PStaff*> staffs;
+    IPointerList<PStaff*> staffs;
 
     /// all symbols in score. No particular order.
-    PointerList<Item*> its;
+    IPointerList<Item*> its;
 
     /// if broken, the different lines
-    PointerList<Line_of_score*> lines;
+    IPointerList<Line_of_score*> lines;
 
     /// crescs etc; no particular order
-    PointerList<Spanner *> spanners;
-
-    /****************************************************************/
-
-    svec<Item*> select_items(PStaff*, PCol*);
-
-    /// before calc_breaking
-    void preprocess();
-    
-    void calc_breaking();
-    /**
-      calculate where the lines are to be broken.
+    IPointerList<Spanner *> spanners;
 
-      POST
-    
-      lines contain the broken lines.
-     */
+    /// broken spanners
+    IPointerList<Spanner*> broken_spans;
 
-    /// after calc_breaking
-    void postprocess();
+    /* *************** */
+    /* CONSTRUCTION */
     
-    /// search all pcols which are breakable.
-    svec<const PCol *> find_breaks() const;
-
+    PScore(Paper_def*);
     /// add a line to the broken stuff. Positions given in #config#
-    void add_line(svec<const PCol *> curline, svec<Real> config);
-
-    /// helper: solve for the columns in #curline#.
-    svec<Real> solve_line(svec<const PCol *> curline) const;
+    void set_breaking(Array<Col_hpositions>);
 
     void add(PStaff *);
-    /// add item
-    void typeset_item(Item *,  PCol *,PStaff*,int=1);
+    
+
+    /** 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);
 
-    /// add an Spanner
+    /// add a Spanner
     void typeset_spanner(Spanner*, PStaff*);
  
     ///    add to bottom of pcols
     void add(PCol*);
-    /**
+    void add_broken(Spanner*);
 
-    */
-    void output(Tex_stream &ts);
+    /* INSPECTION */
+    Array<Item*> select_items(PStaff*, PCol*);
 
-    Idealspacing* get_spacing(PCol *, PCol *);
-    /*
-    get the spacing between c1 and c2, create one if necessary.
-    */
+     /**
+       @return argument as a cursor of the list
+       */
+    PCursor<PCol *> find_col(const PCol *)const;
 
-    /// return argument as a cursor.
-    PCursor<PCol *> find_col(PCol *);
+    /* MAIN ROUTINES */
+    void process();
 
-    /// delete unused columns
-    void clean_cols();
+    /// last deed of this struct
+    void output(Tex_stream &ts);
+
+    /* UTILITY ROUTINES */
 
+    /// get the spacing between c1 and c2, create one if necessary.
+    Idealspacing* get_spacing(PCol *c1, PCol *c2);
 
-    /// check if the spacing/breaking problem is well-stated
-    void problem_OK() const;
+    /// connect c1 and c2
+    void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f);
 
-    /// invarinants
+    /// 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;
-    PScore(Paperdef*);
     void print() const;
+private:
+    /// before calc_breaking
+    void preprocess();
+
+    /// calculate where the lines are to be broken, and use results
+    void calc_breaking();
 
-    /// does curline fit on the paper?
-    bool feasible(svec<const PCol *> curline) const;
+    /// after calc_breaking
+    void postprocess();
+    
+    /// delete unused columns
+    void clean_cols();
 };
-/** 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.
- */
+
 #endif