]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.26
authorfred <fred>
Sun, 24 Mar 2002 19:28:54 +0000 (19:28 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:28:54 +0000 (19:28 +0000)
hdr/complexstaff.hh [new file with mode: 0644]
hdr/lyriccolumn.hh
src/complexprint.cc [new file with mode: 0644]

diff --git a/hdr/complexstaff.hh b/hdr/complexstaff.hh
new file mode 100644 (file)
index 0000000..4413add
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+  complexstaff.hh -- part of LilyPond
+
+  (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifndef COMPLEXSTAF_HH
+#define COMPLEXSTAF_HH
+
+
+#include "key.hh"
+#include "stcol.hh"
+#include "staff.hh"
+#include "staffwalker.hh"
+
+/// column of Complex_staff: store one request
+struct Complex_column : Staff_column {
+
+    Array<Request*> todo_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);
+};
+
+
+/// Complex  staff: one voicegroup  at a time
+struct Complex_staff : Staff {
+    /// indirection to the PStaff.
+    PStaff *theline_l_;
+
+    /****************/
+    Staff_column*create_col(Score_column*);    
+    virtual Item *get_TYPESET_item(Command*);
+    virtual void set_output(PScore *);
+    void process_commands( PCursor<Command*> &where);
+    virtual void walk();
+
+    Complex_staff();
+};
+
+#endif // COMPLEXSTAF_HH
+
index 368dadf1bc0bc5b45307a36f68695d7f4487b840..145ff7fc08a2dc69ac2e9be209adf02fe1cae758 100644 (file)
@@ -10,7 +10,6 @@
 #include "key.hh"
 #include "stcol.hh"
 #include "staff.hh"
-#include "staffwalker.hh"
 
 struct Lyric_staff;
 
@@ -28,12 +27,7 @@ struct Lyric_column : Staff_column {
     Lyric_staff* lstaff_l_;
     
     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 process_requests();
+    virtual void setup_requests();
 
     Lyric_column(Score_column*s,Lyric_staff*rs);
 };
diff --git a/src/complexprint.cc b/src/complexprint.cc
new file mode 100644 (file)
index 0000000..f266f7b
--- /dev/null
@@ -0,0 +1,98 @@
+#include "request.hh"
+#include "pscore.hh"
+#include "paper.hh"
+#include "complexstaff.hh"
+#include "sccol.hh"
+#include "debug.hh"
+
+#include "clefitem.hh"
+#include "bar.hh"
+#include "meter.hh"
+
+Item *
+Complex_staff::get_TYPESET_item(Command *com)
+{
+    Item *s=0;
+    Array<Scalar> arg( com->args);
+    String type =arg[0];
+    arg.del(0);
+    if (type ==  "BAR" ) {
+       s = new Bar(com->args[1]);      
+    } else if (type == "METER") {
+       s = new Meter(arg);
+    } else if (type == "CLEF" || type == "CURRENTCLEF") {
+       Clef_item * c = new Clef_item;
+       s = c;
+       c->change = (type == "CLEF");   
+    }else{
+       WARN << "ignoring TYPESET command for " << type << '\n';
+    }
+    return s;
+}
+
+
+Interval
+citemlist_width(const Array<Item*> &its)
+{
+    Interval iv ;
+    iv.set_empty();
+     
+    for (int j =0; j < its.size(); j++){
+       iv.unite (its[j]->width());
+
+    }
+    return iv;
+}
+
+void
+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);
+    
+    if (breakst == BREAK_PRE - BREAK_PRE) {
+       
+        Array<Item*> to_move(
+           staff_l_->pscore_l_->select_items(staff_l_->theline_l_,
+                                         score_column_l_->pcol_l_->prebreak_p_));
+       Interval column_wid = citemlist_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));
+       }
+    }
+}    
+/*
+  UGGGG
+  */
+void
+Complex_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH!
+{
+    assert(i);
+    PCol * c=score_column_l_->pcol_l_;
+    if (breakst == 0)
+       c = c->prebreak_p_;
+    else if (breakst == 2)
+       c = c->postbreak_p_;
+    
+    Array<Item*> to_move(staff_l_->pscore_l_->select_items(staff_l_->theline_l_,
+                                                     c));    
+    typeset_item(i, breakst);
+
+    Interval column_wid = citemlist_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 )
+{
+    pscore_l_ = ps;
+    pscore_l_->add(theline_l_);
+}
+
+