]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.35
authorfred <fred>
Sun, 24 Mar 2002 19:33:21 +0000 (19:33 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:33:21 +0000 (19:33 +0000)
14 files changed:
hdr/complexstaff.hh
hdr/registergroup.hh [new file with mode: 0644]
hdr/scorecolumn.hh [new file with mode: 0644]
hdr/staffcolumn.hh [new file with mode: 0644]
src/calcideal.cc
src/complexstaff.cc
src/lyricwalker.cc
src/scorecolumn.cc [new file with mode: 0644]
src/scorewalker.cc
src/template2.cc
src/template4.cc
src/template6.cc
src/voicegroupregs.cc [new file with mode: 0644]
src/voiceregs.cc

index b7d0c714d9cdbc008dc74fbc477a25a9c6cdc769..74ecef473221fd36381f45ef42188c3c4a75d528 100644 (file)
@@ -9,7 +9,6 @@
 
 
 #include "key.hh"
-#include "stcol.hh"
 #include "staff.hh"
 #include "staffwalker.hh"
 
diff --git a/hdr/registergroup.hh b/hdr/registergroup.hh
new file mode 100644 (file)
index 0000000..c3a4df4
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+  registergroup.hh -- declare 
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef REGISTERGROUP_HH
+#define REGISTERGROUP_HH
+
+
+#include "plist.hh"
+#include "staffeleminfo.hh"
+/**
+  Group a number of registers. Usually delegates everything to its contents.
+  */
+class Register_group {
+public:
+    IPointerList<Request_register*> reg_list_;
+    
+    void set_dir(int i);
+    bool acceptable_request_b(Request*);
+    void pre_move_processing();
+    void post_move_processing();
+    void acknowledge_element(Staff_elem_info info);
+    bool try_request(Request*);
+    void process_requests();
+    virtual ~Register_group();
+    void add(Request_register* reg_p);
+    bool contains_b(Request_register*);
+//    bool contains_b(Register_group*);
+};
+
+#endif // REGISTERGROUP_HH
+
+
diff --git a/hdr/scorecolumn.hh b/hdr/scorecolumn.hh
new file mode 100644 (file)
index 0000000..e961d04
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+  sccol.hh -- part of LilyPond
+
+  (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef SCCOL_HH
+#define SCCOL_HH
+#include "proto.hh"
+#include "varray.hh"
+#include "moment.hh"
+
+
+/**
+
+    When typesetting hasn't started on PScore yet, the columns which
+    contain data have a rhythmical position. Score_column is the type
+    with a rhythmical time attached to it. The calculation of
+    idealspacing is done with data in these columns. (notably: the
+    #durations# field)
+
+    */
+
+class Score_column {
+    friend class Score;
+    friend class Score_walker;
+
+    bool musical_b_;
+    Moment when_;
+    void set_breakable();
+public:
+    /// indirection to column
+    PCol * pcol_l_;
+
+    /// length of notes/rests in this column
+    Array<Moment> durations;
+    
+    /* *************** */
+
+    Moment when() {  return when_; }
+    Score_column(Moment when);       
+    static int compare(Score_column & c1, Score_column &c2);
+    void add_duration(Moment );
+    void preprocess();
+    bool breakable_b();
+    bool musical_b() { return musical_b_; }
+    bool used_b();
+    void print() const;
+
+
+};
+
+instantiate_compare(Score_column&, Score_column::compare);
+
+#endif // SCCOL_HH
+
+
+
+
diff --git a/hdr/staffcolumn.hh b/hdr/staffcolumn.hh
new file mode 100644 (file)
index 0000000..d80b6fa
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+  staffcolumn.hh -- declare Staff_column
+
+  (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef STAFFCOLUMN_HH
+#define STAFFCOLUMN_HH
+#include "proto.hh"
+#include "varray.hh"
+#include "moment.hh"
+
+/// store simultaneous requests
+class Staff_column {
+
+    Staff_column(Staff_column const&);
+
+public:
+    Array<Request*> musicalreq_l_arr_;
+    Array<Request*> commandreq_l_arr_;
+    Staff * staff_l_;
+
+    /// fields to collect timing data vertically.
+    Array<Timing_req*> timing_req_l_arr_;
+    Score_column *musical_column_l_, *command_column_l_;
+
+    /* *************** */
+    
+    Staff_column();
+
+    Moment when() const;
+    void set_cols(Score_column *c1, Score_column *c2);
+    void add(Voice_element*ve);
+    void OK() const;
+    ~Staff_column();
+    void typeset_breakable_items(Array<Item *> &pre_p_arr,
+                                Array<Item *> &nobreak_p_arr,
+                                Array<Item *> &post_p_arr);
+    void typeset_musical_item(Item *i);
+protected:
+     void setup_one_request(Request*);
+};
+
+
+
+#endif // STAFFCOLUMN_HH
+
index 08180c64fbc7e4f6f780f298378c13c3beb687d7..1a96243426ee01cbddc793eeda8198ab729ee0fb 100644 (file)
@@ -2,7 +2,7 @@
 #include "score.hh"
 #include "pscore.hh"
 #include "paperdef.hh"
-#include "sccol.hh"
+#include "scorecolumn.hh"
 #include "dimen.hh"
 
 
index 9eb84cb59a13d28515c559ce0641dba8d61b5f62..627b5745e20f4c3f6e86465e7fd2d39ac2878649 100644 (file)
@@ -7,7 +7,7 @@
 #include "pscore.hh"
 #include "bar.hh"
 #include "meter.hh"
-#include "sccol.hh"
+#include "scorecolumn.hh"
 #include "commandrequest.hh"
 
 const NO_LINES = 5;
index fbff9a8cd5265ae1f037c8cfedbbc82480145d10..c77b716ec2afefba960dc10c9095eb4f492774a1 100644 (file)
@@ -13,7 +13,7 @@
 #include "lyricwalker.hh"
 #include "debug.hh"
 #include "lyricitem.hh"
-#include "stcol.hh"
+#include "staffcolumn.hh"
 
 void
 Lyric_walker::process_requests()
diff --git a/src/scorecolumn.cc b/src/scorecolumn.cc
new file mode 100644 (file)
index 0000000..80fc804
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+  scorecolumn.cc -- implement Score_column
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "debug.hh"
+#include "pcol.hh"
+#include "scorecolumn.hh"
+
+int
+Score_column::compare(Score_column & c1, Score_column &c2)
+{
+       return sign(c1.when_ - c2.when_);
+}
+
+void
+Score_column::set_breakable()
+{
+    pcol_l_->set_breakable();
+}
+
+Score_column::Score_column(Moment w)
+{
+    when_ = w;
+    pcol_l_ = new PCol(0);
+    musical_b_ = false;
+}
+
+bool
+Score_column::used_b() {
+    return pcol_l_->used_b();
+}
+
+void
+Score_column::print() const
+{
+#ifndef NPRINT
+    mtor << "Score_column { mus "<< musical_b_ <<" at " <<  when_<<'\n';
+    mtor << "durations: [";
+    for (int i=0; i < durations.size(); i++)
+       mtor << durations[i] << " ";
+    mtor << "]\n";
+    pcol_l_->print();
+    mtor << "}\n";
+#endif
+}
+
+int
+Moment_compare(Moment &a , Moment& b)
+{
+    return sign(a-b);
+}
+
+void
+Score_column::preprocess()
+{
+    durations.sort(Moment_compare);
+}
+void
+Score_column::add_duration(Moment d)
+{
+    assert(d);
+    for (int i = 0; i< durations.size(); i++) {
+       if (d == durations[i])
+           return ;
+    }
+    durations.push(d);
+}
+
+bool
+Score_column::breakable_b()
+{
+    return pcol_l_->breakable_b();
+}
index 1cd9339ce92e59e71de421ac0d2b435b07616657..c79031ab9a62219b7158d49fce5cc9a5567828e4 100644 (file)
@@ -11,7 +11,7 @@
 #include "score.hh"
 #include "staffwalker.hh"
 #include "staff.hh"
-#include "sccol.hh"
+#include "scorecolumn.hh"
 
 Score_walker::Score_walker(Score *s)
     :PCursor<Score_column *> (s->cols_)
index 29d4b1eaf387af9a5308cc6a871cc1c15c51dff5..b3b8624ef06b1aa3b4d159e4c7ab4c56d17a9231 100644 (file)
@@ -1,9 +1,17 @@
+/*
+  template2.cc -- instantiate some list templates. 
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "symbol.hh"
 #include "voice.hh"
 #include "musicalrequest.hh"
 #include "staff.hh"
-#include "sccol.hh"
-#include "stcol.hh"
+#include "scorecolumn.hh"
+#include "staffcolumn.hh"
 #include "spanner.hh"
 #include "plist.tcc"
 #include "pcursor.tcc"
index 69f7513390806572fe75962959ed710704998504..d26e748e6f490afe5ebc94024471d4675eeba0ce 100644 (file)
@@ -1,3 +1,11 @@
+/*
+  template4.cc -- instantiate PointerList baseclass.
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "proto.hh"
 #include "list.tcc"
 #include "cursor.tcc"
index 1f94149abfe7de72bdb31f0010c201b70764427f..e85062003e9b38e7467755adcff5feeec883bff7 100644 (file)
@@ -1,8 +1,10 @@
 #include "proto.hh"
 #include "plist.tcc"
 #include "register.hh"
-#include "voicegroup.hh"
+#include "voicegroupregs.hh"
+#include "voiceregs.hh"
 
 
 IPL_instantiate(Voice_registers);
 IPL_instantiate(Voice_group_registers);
+IPL_instantiate(Request_register);
diff --git a/src/voicegroupregs.cc b/src/voicegroupregs.cc
new file mode 100644 (file)
index 0000000..d23b58a
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+  voicegroup.cc -- implement Voice_group_registers
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "plist.hh"
+#include "musicalrequest.hh"
+#include "voiceregs.hh"
+#include "voicegroupregs.hh"
+#include "register.hh"
+#include "textreg.hh"
+#include "stembeamreg.hh"
+#include "scriptreg.hh"
+#include "complexwalker.hh"
+#include "commandrequest.hh"
+
+static int temp_id_count;
+
+Voice_group_registers::Voice_group_registers(Complex_walker*w_l, String id)
+{
+    walk_l_ = w_l;
+    add(new Text_register(w_l));
+    add(new Stem_beam_register(w_l));
+    add(new Script_register(w_l));
+    
+    if (id=="")                        // UGH
+       id = __FUNCTION__ + String(temp_id_count++);
+    group_id_str_ = id;
+}
+
+bool
+Voice_group_registers::try_request(Request*r_l)
+{
+    if (r_l->groupfeature()) {
+       set_dir(r_l->groupfeature()->stemdir_i_);
+       return true;
+    }
+    return Register_group::try_request(r_l);
+}
+    
+void
+Voice_group_registers::acknowledge_element(Staff_elem_info i)
+{
+    if (i.group_regs_l_!= this)
+       return;
+    Register_group::acknowledge_element(i);
+}
+#if 1
+void
+Voice_group_registers::set_dir(int i)
+{
+    Register_group::set_dir(i);
+
+    // ughh
+    Array<Voice_registers*> vr_arr (walk_l_->get_voice_regs(this));
+    for (int j=0; j<vr_arr.size(); j++) {
+       if (vr_arr[j])
+           vr_arr[j]->set_dir(i);
+    }
+}
+#endif
+bool
+Voice_group_registers::acceptable_request_b(Request*r)
+{
+    return (r->stem() || r->beam() || r->text() || r->script() ||
+           r->groupfeature());
+}
index d6c24cd674e1e2bb2ca72ed9f118c0007e49a01c..ea56a5da4643b064da4fc54b94a26049e8097ad2 100644 (file)
@@ -1,5 +1,13 @@
+/*
+  voiceregs.cc -- implement Voice_registers
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "musicalrequest.hh"
-#include "voicegroup.hh"
+#include "voiceregs.hh"
 #include "register.hh"
 #include "slurreg.hh"
 #include "headreg.hh"
@@ -7,21 +15,8 @@
 Voice_registers::Voice_registers(Complex_walker*c_l, Voice *v_p)
 {
     voice_l_ = v_p;
-    head_reg_ = new Notehead_register(c_l);
-    slur_reg_ = new Slur_register(c_l);
-}
-Voice_registers::~Voice_registers()
-{
-    delete head_reg_;
-    delete slur_reg_;
-}
-bool
-Voice_registers::try_request(Request * r_l)
-{
-    bool b = head_reg_->try_request(r_l);
-    if (!b)
-       b = slur_reg_->try_request(r_l);
-    return b;
+    add(new Notehead_register(c_l));
+    add(new Slur_register(c_l));
 }
 
 void
@@ -29,41 +24,11 @@ Voice_registers::acknowledge_element(Staff_elem_info i)
 {
     if (i.voice_l_ != voice_l_)
        return;
-    if (i.origin_reg_l_ != slur_reg_)
-       slur_reg_->acknowledge_element(i);
-}
-
-void
-Voice_registers::pre_move_processing()
-{
-    head_reg_->pre_move_processing();
-    slur_reg_->pre_move_processing();
-}
-void
-Voice_registers::post_move_processing()
-{
-    head_reg_->post_move_processing();
-    slur_reg_->post_move_processing();
-}
-
-void
-Voice_registers::process_requests()
-{
-    head_reg_->process_request();
-    slur_reg_->process_request();
+    Register_group::acknowledge_element(i);
 }
 
 bool
-Voice_registers::acceptable_request(Request*r)
+Voice_registers::acceptable_request_b(Request*r)
 {
     return (r->rest() || r->note() || r->slur());
-    
-}
-
-void
-Voice_registers::set_dir(int i)
-{
-    head_reg_->set_dir(i);
-    slur_reg_->set_dir(i);
 }
-