]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.65
authorfred <fred>
Sun, 24 Mar 2002 19:44:15 +0000 (19:44 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:44:15 +0000 (19:44 +0000)
lily/complex-walker.cc
lily/include/p-score.hh
lily/include/staff-side.hh
lily/slur.cc
lily/spanner-elem-group.cc [new file with mode: 0644]
lily/staff.cc

index 1e1ac452d78d07feb5e2cb0c2cd48ec968e41bfc..d32d9db2eb6545040be1d1cc74949a0e62ce64e0 100644 (file)
@@ -1,18 +1,20 @@
 /*
   complex-walker.cc -- implement Complex_walker
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
-
+#include "score.hh" 
 #include "staff-column.hh"
 #include "voice.hh"
 #include "p-score.hh"
-#include "complex-staff.hh"
 #include "debug.hh"
 #include "complex-walker.hh"
 #include "walk-regs.hh"
+#include "score-elem.hh"
+#include "staff.hh"
+#include "staffline.hh"
 
 void
 Complex_walker::do_post_move()
@@ -72,14 +74,15 @@ Complex_walker::typeset_element(Score_elem *elem_p)
 {
     if (!elem_p)
        return;
+    staff_l_->staff_line_l_->add_element(elem_p);
     if (elem_p->spanner())
-       pscore_l_->typeset_spanner(elem_p->spanner(), staff()->pstaff_l_);
+       pscore_l_->typeset_unbroken_spanner(elem_p->spanner());
     else
        ptr()->typeset_musical_item(elem_p->item()); 
 }
 
-Complex_walker::Complex_walker(Complex_staff*s)
-    : Staff_walker(s, s->pstaff_l_->pscore_l_)
+Complex_walker::Complex_walker(Staff*s)
+    : Staff_walker(s, s->score_l_->pscore_p_)
 {
     walk_regs_p_ = new Walker_registers(this);    
     do_post_move();
@@ -88,12 +91,7 @@ Complex_walker::Complex_walker(Complex_staff*s)
 
 Complex_walker::~Complex_walker()
 {
-}
-
-Complex_staff*
-Complex_walker::staff()
-{
-    return (Complex_staff*) staff_l_;
+    delete walk_regs_p_;
 }
 
 
index 1e283faf9e4a8b6f59c7f0b8bdf470b6da5e6db5..5490345729eb3d7b42432b8aa675c3be36cef849 100644 (file)
@@ -1,7 +1,7 @@
 /*
   p-score.hh -- declare PScore
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
   (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 #define P_SCORE_HH
 
 #include "colhpos.hh"
-#include "varray.hh"
+#include "parray.hh"
 #include "lily-proto.hh"
-#include "p-col.hh"
-#include "p-staff.hh"
+#include "plist.hh"
 
+/** all stuff which goes onto paper. notes, signs, symbols in a score
+     #PScore# contains the items, the columns.
+    
+    */
 
-/** 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 {
+class PScore {
+public:
     Paper_def *paper_l_;
-    
+
     /// the columns, ordered left to right
     Pointer_list<PCol *> cols;
 
     /// the idealspacings, no particular order
     Pointer_list<Idealspacing*> suz;
 
-    /// the staffs ordered top to bottom
-    Pointer_list<PStaff*> staffs;
-
-    /// all symbols in score. No particular order.
-    Pointer_list<Item*> its;
-
-    /// if broken, the different lines
-    Pointer_list<Line_of_score*> lines;
-
     /// crescs etc; no particular order
     Pointer_list<Spanner *> spanners;
 
-    /// broken spanners
-    Pointer_list<Spanner*> broken_spans;
+    /// other elements
+    Pointer_list<Score_elem*> elem_p_list_;
+    
+    Super_elem *super_elem_l_;
 
-    Pointer_list<Vertical_spanner*> vspan_p_list_;
     /* *************** */
     /* CONSTRUCTION */
     
@@ -54,30 +45,22 @@ struct PScore {
     /// add a line to the broken stuff. Positions given in #config#
     void set_breaking(Array<Col_hpositions> const &);
 
-    void add(PStaff *);
-    
-
     /** 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=1);
 
-    /// 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;
+    
     /* MAIN ROUTINES */
     void process();
 
@@ -98,6 +81,13 @@ struct PScore {
     /* 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();
index c81353f0cb769664669583dbbf0d8c02c44db640..d25d109d22ecff81e5b70b102abde7026ee89b74 100644 (file)
@@ -1,7 +1,7 @@
 /*
   staff-side.hh -- declare Staff_side
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 #ifndef STAFF_SIDE_HH
 #define STAFF_SIDE_HH
 
-#include "staff-elem.hh"
+#include "score-elem.hh"
 
 /// A symbol which sits along  the staff
-class Staff_side  {
-    Array<Score_elem*> support_l_arr_;
+class Staff_side : virtual Score_elem {
+    Link_array<Score_elem> support_l_arr_;
     int staff_size_i_;
-    Score_elem * elem_l_;
     Interval support_height()const;
     Staff_symbol* staff_sym_l_;
+
     void read_staff_sym();
 public:
-    Real inter_f_;
+
     /**
       Vertical dir of symbol relative to staff. -1 = below staff?
       */
@@ -30,12 +30,13 @@ public:
     /// follow the support inside the staff?
     bool inside_staff_b_;
 
-    void set_staffsym(Staff_symbol*);
+    void set_staffsym(Staff_symbol *  );
   
-    Staff_side(Score_elem*);
+    Staff_side();
     void add_support(Score_elem*);
     
 protected:
+    virtual void do_substitute_dependency(Score_elem *, Score_elem*);
     int get_position_i()const;
     int get_position_i(Interval)const;
 };
index 1fa1ad288531e0ac6f9f703910428a5d9d2780ea..9b6d75caf10793ce464b7998181fc3c82c33fd94 100644 (file)
@@ -1,7 +1,7 @@
 /*
   slur.cc -- implement  Slur
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
   (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
@@ -53,27 +53,38 @@ Slur::do_pre_processing()
     left_col_l_ = encompass_arr_[0]->pcol_l_;    
 }
 
-Spanner*
-Slur::do_break_at(PCol*l, PCol*r) const
+void
+Slur::do_break_at(PCol*l, PCol*r) 
 {
     assert(l->line_l_ == r->line_l_);
-    Slur*ret = new Slur(*this);
 
-    ret->encompass_arr_.set_size(0);
-    for (int i =0; i < encompass_arr_.size(); i++) {
-       if (encompass_arr_[i]->pcol_l_->line_l_==l->line_l_)
-           ret->encompass_arr_.push(encompass_arr_[i]);
+    Array<Note_column*> old_encompass_arr = encompass_arr_;
+    encompass_arr_.set_size(0);
+    for (int i =0; i < old_encompass_arr.size(); i++) {
+       if (old_encompass_arr[i]->pcol_l_->line_l_==l->line_l_)
+           encompass_arr_.push(old_encompass_arr[i]);
     }
+}
 
-    return ret;
+void
+Slur::do_substitute_dependency(Score_elem*o, Score_elem*n)
+{
+    int i;
+    while((i = encompass_arr_.find_i((Note_column*)o->item())) >=0) {
+       if (n)
+           encompass_arr_[i] = (Note_column*)n->item();
+       else
+           encompass_arr_.del(i);
+    }
 }
 
+
 void
 Slur::do_post_processing()
 {
     if (!dir_i_)
        set_default_dir();
-    Real inter_f = paper()->internote();
+    Real inter_f = paper()->internote_f();
     if (encompass_arr_[0]->stem_l_)
         left_pos_i_ = rint(encompass_arr_[0]->stem_l_->height()[dir_i_]/inter_f);
     else
diff --git a/lily/spanner-elem-group.cc b/lily/spanner-elem-group.cc
new file mode 100644 (file)
index 0000000..1baf0a6
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+  spanner-elem-group.cc -- implement 
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "p-col.hh"
+#include "spanner-elem-group.hh"
+
+void
+Spanner_elem_group::do_break_at(PCol*c1, PCol*c2 )
+{
+    Line_of_score * line_C = c1->line_l_;
+    Array<Score_elem*>  old_elems=elem_l_arr_;
+    elem_l_arr_.set_size(0);
+    for (int i=0; i < old_elems.size(); i++) {
+       if (old_elems[i]->line_l() == line_C) {
+           add_element(old_elems[i]);
+       }
+    }
+}
+
+IMPLEMENT_STATIC_NAME(Spanner_elem_group);
+
+Interval
+Spanner_elem_group::do_width() const
+{
+    return Spanner::do_width();
+}
+
+void
+Spanner_elem_group::do_print() const
+{
+    Element_group::do_print();
+}
+
index c601837147a81e86c0ebd71d8749479333b4dfd6..76e6d995cab21a8a75c907c739bcadd1b3b400b1 100644 (file)
@@ -1,12 +1,14 @@
 /*
   staff.cc -- implement Staff
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
-#include "input-register.hh"
+
 #include "proto.hh"
+#include "plist.hh"
+#include "input-register.hh"
 #include "staff.hh"
 #include "score.hh"
 #include "voice.hh"
 #include "debug.hh"
 #include "musical-request.hh"
 #include "command-request.hh" // todo
-
+#include "staffline.hh"
+#include "complex-walker.hh"
+#include "super-elem.hh"
+#include "p-score.hh"
+#include "scoreline.hh"
 
 void
 Staff::add(Link_list<Voice*> const &l)
@@ -57,9 +63,6 @@ Staff::OK() const
 #ifndef NDEBUG
     cols_.OK();
     voice_list_.OK();
-    iter_top(cols_, i);
-    iter_top(cols_, j);
-    i++;
     assert(score_l_);
 #endif    
 }
@@ -88,12 +91,16 @@ Staff::print() const
 #endif
 }
 
+Staff::~Staff()
+{
+    delete ireg_p_;
+}
+
 Staff::Staff()
 {    
     ireg_p_ =0;
     score_l_ =0;
     pscore_l_ =0;
-    pstaff_l_ =0;
 }
 
 void
@@ -102,3 +109,19 @@ Staff::add_col(Staff_column*c_l)
     cols_.bottom().add(c_l);
     c_l->staff_l_ = this;
 }
+
+void
+Staff::set_output(PScore* pscore_l )
+{
+    pscore_l_ = pscore_l;
+    staff_line_l_ = new Line_of_staff;
+    pscore_l_->typeset_unbroken_spanner(staff_line_l_);
+    pscore_l_->super_elem_l_->line_of_score_l_->add_line(staff_line_l_);
+}
+
+
+Staff_walker * 
+Staff::get_walker_p()
+{
+    return new Complex_walker(this);
+}