]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.30
authorfred <fred>
Sun, 24 Mar 2002 19:31:13 +0000 (19:31 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:31:13 +0000 (19:31 +0000)
12 files changed:
hdr/complexcolumn.hh [new file with mode: 0644]
hdr/complexstaff.hh
hdr/lyriccolumn.hh
hdr/lyricstaff.hh
hdr/score.hh
hdr/stcol.hh
src/complexprint.cc
src/lyriccolumn.cc
src/lyricstaff.cc
src/score.cc
src/staffwalker.cc
src/stcol.cc

diff --git a/hdr/complexcolumn.hh b/hdr/complexcolumn.hh
new file mode 100644 (file)
index 0000000..50ad5fc
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+  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
index 17d489be960119b90e2aba006ed6df33f056c197..6c7dbdb18d01d659aba66bc43a90a00f0428e695 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  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 *);
index 145ff7fc08a2dc69ac2e9be209adf02fe1cae758..118b9f34bdb5beca83d4d521211307e878b8338f 100644 (file)
@@ -26,10 +26,10 @@ struct Lyric_column : Staff_column {
     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
index 6959636c60f42ce70a69c92c4537b33ee3100038..22fb8958b6cc8cf25b31cbbc9e4af39ef510a175 100644 (file)
 
 /// (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();
 
index 64e282861454d06dc711ede99aa67d699bc0c16a..cd5a56c5e73279b4952efc41eaa542b55dec3ea9 100644 (file)
@@ -5,6 +5,7 @@
 #include "plist.hh"
 #include "moment.hh"
 #include "assoc.hh"
+#include "string.hh"
 
 /// the total music def of one movement
 struct Score {
@@ -20,7 +21,8 @@ struct Score {
     int errorlevel_i_;
     
     Assoc<String, Moment> markers_assoc_;
-    /****************************************************************/
+
+    /* *************************************************************** */
 
     /// construction
     Score(Paperdef*);
@@ -40,28 +42,26 @@ struct Score {
 
     // 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
index 0984f88022b2cfc64ca244f0ac0ce60c0f1211ab..0ae5244d8a6751d9c8a366bb81f69f2ad26c9bd3 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  stcol.hh -- part of LilyPond
+  stcol.hh -- declare Staff_column
 
   (c) 1996,97 Han-Wen Nienhuys
 */
@@ -23,22 +23,22 @@ struct Staff_column {
 
     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&);
 };
 
 
index 372d86db103aa8ba1a7a41e0e89ba9dd2a09ede4..ec38b575e1d5b79784663a674d25d6065c69b043 100644 (file)
@@ -6,7 +6,7 @@
 #include "complexstaff.hh"
 #include "sccol.hh"
 #include "debug.hh"
-#include "linepstaff.hh"
+
 #include "clefitem.hh"
 #include "bar.hh"
 #include "meter.hh"
@@ -38,7 +38,7 @@ Complex_staff::get_TYPESET_item(Command *com)
 
 
 Interval
-citemlist_width(const Array<Item*> &its)
+itemlist_width(const Array<Item*> &its)
 {
     Interval iv ;
     iv.set_empty();
@@ -56,14 +56,14 @@ Complex_column::typeset_item(Item *i, int breakst)
     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++) {
@@ -84,22 +84,22 @@ Complex_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH!
     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_);
 }
 
 
index c016957eb64f846d198fd2b7ef7bf2f3838921a2..c54ebc2b397ad5bc10c3146db8e94c47d94c0da0 100644 (file)
@@ -9,7 +9,7 @@
 #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;
@@ -33,28 +33,11 @@ Lyric_column::setup_requests()
     }
 }
 
-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()
index 3afea78a8fbb1018a5c3874fca8bc8ab1341ec22..279db7ff87b83a08161ed31354acf0adcff33fa4 100644 (file)
@@ -6,16 +6,13 @@
 #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*
@@ -25,18 +22,18 @@ Lyric_staff::create_col(Score_column*s)
 }
 
 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();
     }
 }
index 0f697655b24b2f46ec14d6dae35421cda423bc52..ab9a9d9a93d374718b565365ac7e3c0755e0c4e2 100644 (file)
 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();
     }
 
@@ -34,6 +35,7 @@ Score::process()
 
     // debugging
     OK();
+    *mlog << endl;
     pscore_p_->process();    
 }
 
@@ -88,9 +90,10 @@ Score::create_cols(Moment w)
 }
 
 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;
@@ -112,6 +115,7 @@ Score::do_cols()
     }
     clean_cols();    // can't move clean_cols() farther up.
 }
+
 Moment
 Score::last() const
 {    
@@ -157,10 +161,10 @@ Score::print() 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;
 }
index 3bf94ceabaebfc63b8a2a97dd749244f51c8b640..eac45b5b13fcd1c94e5a15565be44cea30dfb7fe 100644 (file)
@@ -2,6 +2,7 @@
 #include "staffwalker.hh"
 #include "stcol.hh"
 #include "sccol.hh"
+#include "debug.hh"
 
 Staff_walker::~Staff_walker() {}
 Staff_walker::Staff_walker(Staff_walker const &s)
@@ -29,7 +30,7 @@ Staff_walker::process()
 {
     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++) {
@@ -66,6 +67,11 @@ void
 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();
 }
index 89a572408a621779b6b7be9eaeb80e2956238c3d..07124096624fd8bb9830b22ef42b4e7fc16c21cc 100644 (file)
@@ -16,7 +16,7 @@ Staff_column::OK() const
 }
 
 bool
-Staff_column::mus() const
+Staff_column::musical_b() const
 {
     return score_column_l_->musical_;
 }
@@ -38,10 +38,11 @@ Staff_column::add(Voice_element*ve)
     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;
 }