--- /dev/null
+/*
+ complexcolumn.hh -- declare Complex_column
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef COMPLEXCOLUMN_HH
+#define COMPLEXCOLUMN_HH
+
+/// column of Complex_staff: store one request
+struct Complex_column : Staff_column {
+
+ Array<Request*> first_l_arr_;
+ Array<Request*> second_l_arr_;
+
+ Complex_staff* staff_l_;
+
+ /* *************** */
+
+ Slur_req *find_slur(Voice *);
+
+ void typeset_item(Item *, int=1);
+ void typeset_item_directional(Item *, int dir, int=1);
+ Molecule *create_command_mol(Command *com);
+
+ void take_request(Request *rq);
+ virtual void setup_requests();
+
+ Complex_column(Score_column*s,Complex_staff*rs);
+};
+
+#endif // COMPLEXCOLUMN_HH
/*
- complexstaff.hh -- part of LilyPond
+ complexstaff.hh -- declare Complex_staff
(c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
#include "stcol.hh"
#include "staff.hh"
#include "staffwalker.hh"
-
-/// column of Complex_staff: store one request
-struct Complex_column : Staff_column {
-
- Array<Request*> first_l_arr_;
- Array<Request*> second_l_arr_;
-
- Complex_staff* staff_l_;
-
- /****************/
-
- Slur_req *find_slur(Voice *);
-
- void typeset_item(Item *, int=1);
- void typeset_item_directional(Item *, int dir, int=1);
- Molecule *create_command_mol(Command *com);
-
- void take_request(Request *rq);
- virtual void setup_requests();
-
- Complex_column(Score_column*s,Complex_staff*rs);
-};
+#include "complexcolumn.hh"
/// Complex staff: one voicegroup at a time
struct Complex_staff : Staff {
/// indirection to the PStaff.
- PStaff *theline_l_;
+ PStaff *pstaff_l_;
- /****************/
+ /* *************** */
Staff_column*create_col(Score_column*);
virtual Item *get_TYPESET_item(Command*);
virtual void set_output(PScore *);
Array<Word_info> winfo_array_;
Lyric_staff* lstaff_l_;
- void typeset_item(Item *, int=1);
+ void typeset_item(Item *);
virtual void setup_requests();
- Lyric_column(Score_column*s,Lyric_staff*rs);
+ Lyric_column(Score_column* s,Lyric_staff*rs);
};
#endif // LYRICSTAFF_HH
/// (lstaff)
struct Lyric_staff : Staff {
- PStaff* line_pstaff_p_;
+ PStaff* pstaff_l_;
Staff_column* create_col(Score_column*);
-
-// virtual Item *get_TYPESET_item(Command*);
- virtual void set_output(PScore *);
-// virtual Local_key_item* get_local_key_item();
+ virtual void set_output(PScore *);
void process_commands(PCursor<Command*> &where);
virtual void walk();
#include "plist.hh"
#include "moment.hh"
#include "assoc.hh"
+#include "string.hh"
/// the total music def of one movement
struct Score {
int errorlevel_i_;
Assoc<String, Moment> markers_assoc_;
- /****************************************************************/
+
+ /* *************************************************************** */
/// construction
Score(Paperdef*);
// utils:
PCursor<Score_column*> create_cols(Moment);
+
+ /// find a column. The cursor is given to try a little efficiency.
PCursor<Score_column *> find_col(Moment,bool);
+
/// when does the last *musical* element finish?
Moment last() const;
private:
Score(Score const&){}
- ///
- void do_cols();
+
/**
make the pcol_l_ fields of each Score_column point to the correct PCol,
remove any unnecessary Score_column's
*/
+ void do_cols();
/// remove unused cols
void clean_cols();
/// add #Idealspacings# to #pscore_#
void calc_idealspacing();
- /** add the score wide commands (bars, breaks) to each staff so
- they can process (typeset) them if needed */
};
-/**
-
- */
#endif
/*
- stcol.hh -- part of LilyPond
+ stcol.hh -- declare Staff_column
(c) 1996,97 Han-Wen Nienhuys
*/
Time_description *tdescription_;
- /****************/
+ /* *************** */
- Staff_column(Score_column*s);
- bool mus() const;
+ Staff_column(Score_column*);
+ bool musical_b() const;
Moment when() const;
void add(Voice_element*ve);
void OK() const;
- /****************************************************************
+ /*
VIRTUAL
- ****************************************************************/
+ */
virtual void setup_requests()=0;
virtual ~Staff_column();
private:
- Staff_column(Staff_column const&){}
+ Staff_column(Staff_column const&);
};
#include "complexstaff.hh"
#include "sccol.hh"
#include "debug.hh"
-#include "linepstaff.hh"
+
#include "clefitem.hh"
#include "bar.hh"
#include "meter.hh"
Interval
-citemlist_width(const Array<Item*> &its)
+itemlist_width(const Array<Item*> &its)
{
Interval iv ;
iv.set_empty();
assert(i);
staff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_,
- staff_l_->theline_l_,breakst);
+ staff_l_->pstaff_l_,breakst);
if (breakst == BREAK_PRE - BREAK_PRE) {
Array<Item*> to_move(
- staff_l_->pscore_l_->select_items(staff_l_->theline_l_,
+ staff_l_->pscore_l_->select_items(staff_l_->pstaff_l_,
score_column_l_->pcol_l_->prebreak_p_));
- Interval column_wid = citemlist_width(to_move);
+ Interval column_wid = itemlist_width(to_move);
assert(!column_wid.empty());
for (int j=0; j < to_move.size(); j++) {
else if (breakst == 2)
c = c->postbreak_p_;
- Array<Item*> to_move(staff_l_->pscore_l_->select_items(staff_l_->theline_l_,
+ Array<Item*> to_move(staff_l_->pscore_l_->select_items(staff_l_->pstaff_l_,
c));
typeset_item(i, breakst);
- Interval column_wid = citemlist_width(to_move);
+ Interval column_wid = itemlist_width(to_move);
if (column_wid.empty())
column_wid = Interval(0,0);
i->translate(Offset(column_wid[dir] - i->width()[-dir], 0));
}
void
-Complex_staff::set_output(PScore* ps )
+Complex_staff::set_output(PScore* pscore_l )
{
- theline_l_ = new Linestaff(NO_LINES,ps); // theline_l_ is added to pscore later.
- pscore_l_ = ps;
- pscore_l_->add(theline_l_);
+ pstaff_l_ = new PStaff(pscore_l); // pstaff_l_ is added to pscore later.
+ pscore_l_ = pscore_l;
+ pscore_l_->add(pstaff_l_);
}
#include "pscore.hh"
#include "main.hh"
-Lyric_column::Lyric_column(Score_column*s, Lyric_staff* lstaff_l)
+Lyric_column::Lyric_column(Score_column* s, Lyric_staff* lstaff_l)
: Staff_column(s)
{
lstaff_l_ = lstaff_l;
}
}
-Interval itemlist_width(const Array<Item*> &its);
-
void
-Lyric_column::typeset_item(Item *i, int breakst)
-{
- assert(i);
-
+Lyric_column::typeset_item(Item *i)
+{
lstaff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_,
- lstaff_l_->line_pstaff_p_,breakst);
-
- if (breakst == BREAK_PRE - BREAK_PRE) {
-
- Array<Item*> to_move(
- lstaff_l_->pscore_l_->select_items(lstaff_l_->line_pstaff_p_,
- score_column_l_->pcol_l_->prebreak_p_));
- Interval column_wid = itemlist_width(to_move);
- assert(!column_wid.empty());
-
- for (int j=0; j < to_move.size(); j++) {
- to_move[j]->translate(Offset(-column_wid.right, 0));
- }
- }
+ lstaff_l_->pstaff_l_);
}
Word_info::Word_info()
#include "command.hh"
#include "lyricstaff.hh"
#include "lyriccolumn.hh"
-#include "linepstaff.hh"
#include "sccol.hh"
#include "lyricwalker.hh"
#include "pscore.hh"
-
-
Lyric_staff::Lyric_staff()
{
- line_pstaff_p_ = 0;
+ pstaff_l_=0;
}
Staff_column*
}
void
-Lyric_staff::set_output(PScore*ps)
+Lyric_staff::set_output(PScore*pscore_l)
{
- line_pstaff_p_ = new Linestaff(0,ps);
- pscore_l_ = ps;
- pscore_l_->add(line_pstaff_p_);
+ pstaff_l_ = new PStaff(pscore_l);
+ pscore_l_ = pscore_l;
+ pscore_l_->add(pstaff_l_);
}
void
Lyric_staff::walk()
{
for (Lyric_walker lcols(this); lcols.ok(); lcols++) {
- lcols.lcol_l()->setup_requests();// TODO
+ lcols.lcol_l()->setup_requests();
lcols.process();
}
}
void
Score::process()
{
- *mlog << "\nProcessing music" << endl;
+ *mlog << "\nProcessing music ..." << flush;
assert (paper_p_);
if (last() == Moment(0)) {
warning("Need to have music in a score.", defined_ch_c_l_);
}
+
// distribute commands to disciples
pscore_p_ = new PScore(paper_p_);
for (iter_top(staffs_,i); i.ok(); i++) {
- i->truncate_cols(last());
i->set_output(pscore_p_);
+ i->truncate_cols(last());
i->process();
}
// debugging
OK();
+ *mlog << endl;
pscore_p_->process();
}
}
PCursor<Score_column*>
-Score::find_col(Moment w,bool mus)
-{
- iter_top(cols_,i);
+Score::find_col(Moment w, bool mus)
+{ iter_top( cols_,i);
+
+
for (; i.ok(); i++) {
if (i->when() == w && i->musical_ == mus)
return i;
}
clean_cols(); // can't move clean_cols() farther up.
}
+
Moment
Score::last() const
{
#endif
}
-Score::Score(Paperdef*p)
+Score::Score(Paperdef*paper_p)
{
pscore_p_=0;
- paper_p_ = p; // ?? safe?
+ paper_p_ = paper_p;
errorlevel_i_ = 0;
defined_ch_c_l_ = 0;
}
#include "staffwalker.hh"
#include "stcol.hh"
#include "sccol.hh"
+#include "debug.hh"
Staff_walker::~Staff_walker() {}
Staff_walker::Staff_walker(Staff_walker const &s)
{
break_status = BREAK_END - BREAK_PRE;
- if (ptr()->mus()) {
+ if (ptr()->musical_b()) {
process_requests();
} else if (ptr()->staff_commands_p_)
for (iter_top(*ptr()->staff_commands_p_,i); i.ok(); i++) {
Staff_walker::operator++(int i)
{
do_pre_move();
+ if (ptr()->musical_b() && ptr()->tdescription_
+ && !ptr()->tdescription_->whole_in_measure) {
+ *mlog << "[" << ptr()->tdescription_->bars<<"]"<< flush;
+ }
PCursor<Staff_column*>::operator++(i);
+
do_post_move();
}
}
bool
-Staff_column::mus() const
+Staff_column::musical_b() const
{
return score_column_l_->musical_;
}
v_elts.push(ve);
}
-Staff_column::Staff_column(Score_column *s_l)
+Staff_column::Staff_column(Score_column * cur)
+
{
tdescription_ =0;
- score_column_l_ = s_l;
+ score_column_l_=cur;
staff_commands_p_ = 0;
}