]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.35
authorfred <fred>
Sun, 24 Mar 2002 19:33:33 +0000 (19:33 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:33:33 +0000 (19:33 +0000)
NEWS
init/table_sixteen.ini
src/inputmusic.cc
src/score.cc
src/staff.cc
src/staffcolumn.cc [new file with mode: 0644]
src/voice.cc

diff --git a/NEWS b/NEWS
index 9e99b19fe00690cec3ad6c2ebf3398014a4f4acd..bd29eda5ceabebc9160092b9171b1df56ae12c08 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+pl 35
+       - Register_group
+Bugfix
+       - alignment of breakable items.
+
 *******
 pl 34
        - better midi syntax.
index 689f935b0f3e58f8e00d0c16fe74e278cb7e4a62..1b7b379f67270b5c8585c6e78649928aae9aa7cf 100644 (file)
@@ -39,11 +39,11 @@ symboltables {
 
      "clefs" = table {
             "violin"   "\violinclef"           0pt     12.8pt  -10pt   18pt
-            "bass"     "\bassclef"             0pt     11.2pt  0pt     16pt
+            "bass"     "\bassclef"             0pt     12.8pt  0pt     16pt
             "alto"     "\altoclef"             0pt     12.8pt  0pt     16pt
             "tenor"    "\altoclef"             0pt     12.8pt  0pt     16pt
             "violin_change"    "\cviolinclef"  0pt     11.2pt  -12pt   12pt
-            "bass_change"      "\cbassclef"    0pt     12.8pt  0pt     16pt
+            "bass_change"      "\cbassclef"    0pt     11.2pt  0pt     16pt
             "alto_change"      "\caltoclef"    0pt     11.2pt  0pt     16pt
             "tenor_change"     "\caltoclef"    0pt     11.2pt  0pt     16pt
      }
index 8f3ca2cb933bc96e9c8450a69306d30ede325b78..b7ad70b0ab34b61deaa4f0c0540157f9c7ce6e90 100644 (file)
@@ -8,12 +8,12 @@ Input_music::check_plet(Voice_element* velt_l)
 {
     for (iter_top(velt_l->reqs,i); i.ok(); i++)
        if ( i->plet() ) {
-           Moment start_moment = 0.0;
+           Moment start_moment = 0;
            if ( !find_plet_start_bo( i->plet()->type_c_, start_moment ) ) {
                error( "begin of plet not found", i->defined_ch_c_l_ );
                break;
            }
-           Moment moment = 0.0;
+           Moment moment = 0;
            set_plet_backwards( moment, start_moment, i->plet()->dur_i_, i->plet()->type_i_ );
            i.del();
            break;
@@ -209,7 +209,7 @@ Music_general_chord::translate_time(Moment t)
 Moment
 Music_general_chord::length()const
 {
-    Moment l =0.0;
+    Moment l =0;
     
     for (iter_top(elts,i); i.ok(); i++) 
        l = l >? i->length();
index 83bffd72f775038d1a1ce06650d518de92f8a056..4d8ac6329699020e557eaed645594e7bf62d55f6 100644 (file)
@@ -7,7 +7,7 @@
 */
 #include "tstream.hh"
 #include "score.hh"
-#include "sccol.hh"
+#include "scorecolumn.hh"
 #include "pscore.hh"
 #include "staff.hh"
 #include "debug.hh"
@@ -159,15 +159,12 @@ Score::find_col(Moment w, bool mus)
 }
 
 void
-Score::do_cols()
-    
+Score::do_cols()    
 {
-
     iter_top(cols_,i);
     for (; i.ok(); i++) {
        pscore_p_->add(i->pcol_l_);
     }
-
 }
 
 Moment
index a99696466125b5b3884762f5b92770c270206910..d5c08487abeea758e8bc8753377eff337df3e92c 100644 (file)
@@ -2,8 +2,8 @@
 #include "score.hh"
 #include "voice.hh"
 #include "staffwalker.hh"
-#include "stcol.hh"
-#include "sccol.hh"
+#include "staffcolumn.hh"
+#include "scorecolumn.hh"
 
 #include "debug.hh"
 #include "musicalrequest.hh"
@@ -57,17 +57,17 @@ Staff::get_col(Moment w, PCursor<Staff_column*> *last)
     }
 
 
-    PCursor<Score_column*> sccols(score_l_->find_col(w, false));
-    Staff_column* stcol_p = new Staff_column;
-    stcol_p->staff_l_ = this;
-    Score_column* comcol_l  = sccols++;
-    stcol_p->set_cols(comcol_l, sccols);
+    PCursor<Score_column*> scorecolumns(score_l_->find_col(w, false));
+    Staff_column* staffcolumn_p = new Staff_column;
+    staffcolumn_p->staff_l_ = this;
+    Score_column* comcol_l  = scorecolumns++;
+    staffcolumn_p->set_cols(comcol_l, scorecolumns);
     
     if (!i.ok()) {
-       cols_.bottom().add(    stcol_p);
+       cols_.bottom().add(    staffcolumn_p);
        i = cols_.bottom();
     } else {
-       i.insert(stcol_p);
+       i.insert(staffcolumn_p);
        i--;
     }
     if (last)
@@ -117,7 +117,7 @@ Staff::OK() const
 Moment
 Staff::last() const
 {
-    Moment l = 0.0;
+    Moment l = 0;
     for (iter_top(voice_list_,i); i.ok(); i++) {
        l = l >? i->last();
     }
diff --git a/src/staffcolumn.cc b/src/staffcolumn.cc
new file mode 100644 (file)
index 0000000..229ab69
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+  staffcolumn.cc -- implement Staff_column
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "staff.hh"
+#include "voice.hh"
+#include "timedescription.hh"
+#include "scorecolumn.hh"
+#include "staffcolumn.hh"
+#include "commandrequest.hh"
+#include "musicalrequest.hh"
+#include "interval.hh"
+#include "pscore.hh"
+#include "item.hh"
+#include "pcol.hh"
+
+void
+Staff_column::OK() const
+{
+#ifndef NDEBUG
+    assert (command_column_l_->when() == musical_column_l_->when());
+#endif
+}
+
+Moment
+Staff_column::when() const
+{
+    return (command_column_l_)?
+       command_column_l_->when():
+       musical_column_l_->when();
+}
+
+void
+Staff_column::add(Voice_element*ve)
+{
+    for (iter_top(ve->reqs,j); j.ok(); j++) {
+       if (j->command()) {
+           Command_req * c_l = j->command();
+           if (c_l->timing()) {
+               timing_req_l_arr_.push(j->command()->timing());
+           }
+           if (!c_l->barcheck() &&  !c_l->partial() &&
+               !c_l->measuregrouping())
+               setup_one_request(j);   // no need to bother children
+       } else {
+           if (j->rhythmic()) {
+               musical_column_l_->add_duration(j->rhythmic()->duration());
+           }
+           if (!j->musical()->skip())
+               setup_one_request(j);
+       }
+    }
+}
+
+Staff_column::Staff_column()
+{
+    musical_column_l_ = 0;
+    command_column_l_ = 0;
+    staff_l_ = 0;
+}
+
+
+
+
+Staff_column::~Staff_column()
+{
+}
+
+void
+Staff_column::set_cols(Score_column*c1, Score_column*c2)
+{
+    command_column_l_ = c1;
+    musical_column_l_ = c2;
+}
+
+void
+Staff_column::setup_one_request(Request * j)
+{
+    if (j->command()) // ugh
+       commandreq_l_arr_.push(j);
+    else if (j->musical())
+       musicalreq_l_arr_.push(j);
+}
+
+void
+Staff_column::typeset_musical_item(Item*i)
+{
+    assert(i);
+    Score_column * scorecolumn_l = musical_column_l_;
+    musical_column_l_->pcol_l_->pscore_l_->typeset_item(i, scorecolumn_l->pcol_l_,
+                                                       staff_l_->pstaff_l_);
+}
+
+/**
+  align items in #item_l_arr#,
+
+  @return the width of the items after aligning.
+ */
+Interval
+align_items(Array<Item*> item_l_arr)
+{
+    Interval wid(0,0);
+    for  (int i =0; i < item_l_arr.size(); i++) {
+       Interval item_width= item_l_arr[i]->width();
+       Real dx =wid.right - item_width.left;
+       item_width += dx;
+       item_l_arr[i]->translate(Offset(dx ,0));
+       wid.unite(item_width);
+    }
+    return wid;
+}
+
+void 
+translate_items(Real x,  Array<Item*> item_l_arr)
+{
+    for  (int i =0; i < item_l_arr.size(); i++) 
+       item_l_arr[i]->translate(Offset(x, 0));
+}
+/*
+  UGR
+  This still sux
+  */
+void
+Staff_column::typeset_breakable_items(Array<Item *> &pre_p_arr,
+                                     Array<Item *> &nobreak_p_arr,
+                                     Array<Item *> &post_p_arr)
+{
+    PCol * c= command_column_l_->pcol_l_;
+    PScore *ps_l=command_column_l_->pcol_l_->pscore_l_;
+    
+    if (!c->breakable_b()) {     
+       for  (int i =0; i < pre_p_arr.size(); i++)
+           delete pre_p_arr[i];
+       pre_p_arr.set_size(0);
+       for  (int i =0; i < post_p_arr.size(); i++)
+           delete post_p_arr[i];
+       post_p_arr.set_size(0);
+    }
+
+      
+    for  (int i =0; i < pre_p_arr.size(); i++) {
+       ps_l->typeset_item(pre_p_arr[i], c, staff_l_->pstaff_l_,0);
+    }
+    for  (int i =0; i < nobreak_p_arr.size(); i++) {
+       ps_l->typeset_item(nobreak_p_arr[i], c, staff_l_->pstaff_l_,1);
+    }
+    for  (int i =0; i < post_p_arr.size(); i++) {
+       ps_l->typeset_item(post_p_arr[i], c, staff_l_->pstaff_l_,2);
+    }
+
+    Interval pre_wid= align_items(pre_p_arr);
+    translate_items( -pre_wid.right, pre_p_arr);
+    align_items(nobreak_p_arr);
+    Interval post_wid =align_items(post_p_arr);
+    translate_items (-post_wid.left , post_p_arr);
+
+    pre_p_arr.set_size(0);
+    post_p_arr.set_size(0);
+    nobreak_p_arr.set_size(0);
+}
index 718e7cb6d1124b215d79b5f053bcf2bfcea6b765..ad07cf2040acbac7375f11cd385801abb910a01b 100644 (file)
@@ -48,7 +48,7 @@ Voice::Voice(Voice const&src)
 
 Voice::Voice()
 {
-    start = 0.0;
+    start = 0;
 }
 
 void