summaryrefslogtreecommitdiff
path: root/hdr/pscore.hh
blob: 70e783c889c561b700f49873c49b0b8339cb535f (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// the breaking problem for a score.

#ifndef PSCORE_HH
#define PSCORE_HH


#include "vray.hh"
#include "pcol.hh"
#include "pstaff.hh"

/// all stuff which goes onto paper
struct PScore {
    Paperdef *paper_;		// indirection.
    
    /// the columns, ordered left to right
    PointerList<PCol *> cols;

    /// the idealspacings, no particular order
    PointerList<Idealspacing*> suz;

    /// the staffs ordered top to bottom
    PointerList<PStaff*> staffs;

    /// all symbols in score. No particular order.
    PointerList<Item*> its;

    /// if broken, the different lines
    PointerList<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.

      POST
    
      lines contain the broken lines.
     */

    /// after calc_breaking
    void postprocess();
    
    /// search all pcols which are breakable.
    svec<const PCol *> find_breaks() const;

    /// 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 add(PStaff *);
    /// add item
    void typeset_item(Item *,  PCol *,PStaff*,int=1);

    /// add an Spanner
    void typeset_spanner(Spanner*, PStaff*);
 
    ///    add to bottom of pcols
    void add(PCol*);
    /**

    */
    void output(Tex_stream &ts);

    Idealspacing* get_spacing(PCol *, PCol *);
    /*
    get the spacing between c1 and c2, create one if necessary.
    */

    /// return argument as a cursor.
    PCursor<PCol *> find_col(PCol *);

    /// delete unused columns
    void clean_cols();


    /// check if the spacing/breaking problem is well-stated
    void problem_OK() const;

    /// invarinants
    void OK()const;
    PScore(Paperdef*);
    void print() const;

    /// does curline fit on the paper?
    bool feasible(svec<const PCol *> curline) const;
};
/** 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