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

diff --git a/lily/include/spanner-elem-group.hh b/lily/include/spanner-elem-group.hh
new file mode 100644 (file)
index 0000000..a23819a
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+  spanner-elem-group.hh -- declare Spanner_elem_group
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef SPANNER_ELEM_GROUP_HH
+#define SPANNER_ELEM_GROUP_HH
+
+#include "spanner.hh"
+#include "elem-group.hh"
+
+class Spanner_elem_group : public Spanner, public Element_group {
+    
+protected:
+    void do_break_at(PCol*,PCol*);
+    virtual Interval do_width()const;
+    virtual void do_print() const;
+    SPANNER_CLONE(Spanner_elem_group)
+    NAME_MEMBERS(Spanner_elem_group);
+};
+#endif // SPANNER_ELEM_GROUP_HH
index 107d360c79860b7a3c86001bf7f097230238b6bd..f059a1418fe59f2fbfee5c2c79457f96363188b0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  staffline.hh --     horizontal structures for broken scores.
+  staffline.hh -- horizontal structures for broken scores.
 
   (c) 1996,97 Han-Wen Nienhuys
 */
@@ -7,25 +7,20 @@
 #ifndef STAFFLINE_HH
 #define STAFFLINE_HH
 
-#include "proto.hh"
-#include "real.hh"
-#include "plist.hh"
-#include "varray.hh"
-#include "glob.hh"
-#include "p-staff.hh"
+#include "spanner-elem-group.hh"
 
 /// one broken line of staff.
-struct Line_of_staff {
+struct Line_of_staff : public Spanner_elem_group{
 
-    Line_of_score  * line_of_score_l_;
-    PStaff *pstaff_l_;
+    SPANNER_CLONE(Line_of_staff)
+public:
+    NAME_MEMBERS(Line_of_staff);
 
     /* *************** */
-    
-    String TeXstring() const;
-    Line_of_staff(Line_of_score*, PStaff *);
-    Interval height() const;
-    void process();
+    /** 
+      Add an element. If it is a Element_group, only the dependency
+      (otherwise, might translate doubly) */
+    void add_element(Score_elem*);
 };
 
 #endif
index c4d4861b8c29c07d23f3e74b227a90a3c1a052b1..533d51264585dcb7123c33db4969dd0b6b647ac5 100644 (file)
 #include "p-col.hh"
 #include "p-score.hh"
 
-static String
-make_vbox(Interval i)
-{
-    if (i.empty_b()) 
-       i = Interval(0,0);
-    Real r = i.length();
-    String s("\\vbox to ");
-    s += print_dimen(r);
-    s += "{\\vskip "+print_dimen(i.right)+" ";
-    return s;
-}
-
-    
-String
-Line_of_staff::TeXstring() const
-{
-    String s("%line_of_staff\n");
-    
-    s+=make_vbox(height());
-    // the staff itself: eg lines, accolades
-    s += "\\hbox{";
-    {                          
-       iter_top(line_of_score_l_->cols,cc);
-       Real lastpos=cc->hpos;
 
-       
-       // all items in the current line & staff.
-       for (; cc.ok(); cc++) {
-           String chunk_str;
-           
-           Real delta  = cc->hpos - lastpos;
-           
-           
-           if (cc->error_mark_b_) {
-               chunk_str += String("\\columnerrormark");
-           }
-           // now output the items.
-           for (iter_top(cc->its,i); i.ok(); i++) {
-               if (i->pstaff_l_ == pstaff_l_)
-                   chunk_str += i->TeXstring();
-           }
-           // spanners.
-           for (iter_top(cc->starters,i); i.ok(); i++)
-               if (i->pstaff_l_ == pstaff_l_)
-                   chunk_str += i->TeXstring();
-
-           if (chunk_str!="") {
-               // moveover
-               if (delta)
-                   s +=String( "\\kern ") + print_dimen(delta);
-               s += chunk_str;
-               lastpos = cc->hpos;
-           }
-       }
-    }
-    s+="\\hss}\\vss}";
-    return s;
-}
-
-Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
-{
-    line_of_score_l_=sc;
-    pstaff_l_=st;
-
-    PCol *linestart = sc->cols.top();
-    PCol *linestop = sc->cols.bottom();
-    
-    for (iter_top(pstaff_l_->spans,i); i.ok(); i++) {
-       PCol *brokenstart = &max(*linestart, *i->left_col_l_);
-       PCol *brokenstop = &min(*linestop, *i->right_col_l_);
-       if ( *brokenstart < *brokenstop) {
-           Spanner*span_p =i->broken_at(brokenstart,brokenstop);
-           line_of_score_l_->pscore_l_-> // higghl
-               add_broken(span_p);
-       }
-    }
-}
-
-
-Interval
-Line_of_staff::height() const
-{
-    Interval y(0,0);
-
-    iter_top(line_of_score_l_->cols,cc);
-    
-    // all items in the current line & staff.
-    for (; cc.ok(); cc++) {
-       for (iter_top(cc->its,i); i.ok(); i++) {
-           if (i->pstaff_l_ == pstaff_l_) 
-               y.unite(i->height());
-           
-       }
-       // spanners.
-       for (iter_top(cc->starters,i); i.ok(); i++)
-           if (i->pstaff_l_ == pstaff_l_) {
-               y.unite(i->height());
-           }
-    }
-    
-    return y;
-}
+IMPLEMENT_STATIC_NAME(Line_of_staff);
 
 void
-Line_of_staff::process()
+Line_of_staff::add_element(Score_elem*elem_l)
 {
-#if 0
-    if (!pstaff_l_->stafsym_p_)
-       pstaff_l_->brew_molecule_p(line_of_score_l_->pscore_l_->
-                                paper_l_->linewidth);
-#endif
+    if (!elem_l->group_element_i_)
+       Element_group::add_element(elem_l);
 }