]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.38
authorfred <fred>
Sun, 24 Mar 2002 19:34:11 +0000 (19:34 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:34:11 +0000 (19:34 +0000)
12 files changed:
Documentation/CodingStyle.pod
hdr/bar-reg.hh [new file with mode: 0644]
hdr/clef-reg.hh [new file with mode: 0644]
hdr/headreg.hh
hdr/key-reg.hh [new file with mode: 0644]
hdr/local-key-reg.hh [new file with mode: 0644]
hdr/meter-reg.hh [new file with mode: 0644]
hdr/script-reg.hh [new file with mode: 0644]
hdr/slur-reg.hh [new file with mode: 0644]
hdr/stem-beam-reg.hh [new file with mode: 0644]
hdr/text-reg.hh [new file with mode: 0644]
src/walkregs.cc

index 521bf1e1266ab6b2e32d3b50cd7328c3eb8051a2..2ccc103080827a60f4749b3efc09449fc46d0ad1 100644 (file)
@@ -16,13 +16,14 @@ in emacs:
 
        (add-hook 'c-mode-hook
                  '(lambda ()(setq c-basic-offset 4)))
-
-
        (add-hook 'c++-mode-hook
                  '(lambda() (c-set-style "Stroustrup")
                     )
                  )
+=head2 FILES
 
+The class C<This_is_a_class> is declared in F<this-is-a-class.hh> and
+implemented in F<this-is-a-class.cc>.
 
 =head2 CLASSES and TYPES:
 
@@ -34,7 +35,7 @@ in emacs:
        Class::member()
        Type Class::member_type_
 
-the C<type> is a Hungarian notation postfix for $C<Type>$. See below
+the C<type> is a Hungarian notation postfix for C<Type>. See below
 
 
 =head2 COMMENTS
@@ -88,7 +89,7 @@ symbols. Staff is  the "brains" for PStaff
 NB: in PCursor (which is part of the library) P stands for PointerCursor
 
 
-=head2 MEMBERS(2)
+=head2 MEMBERS (2)
 
 Standard methods:
 
diff --git a/hdr/bar-reg.hh b/hdr/bar-reg.hh
new file mode 100644 (file)
index 0000000..c73e5d1
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+  bar-reg.hh -- declare Bar_register
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef BARREG_HH
+#define BARREG_HH
+#include "register.hh"
+
+/**
+  generate bars. Either user ("|:"), or default (new measure)
+  */
+class Bar_register : public Request_register {
+    void split_bar(Bar *& pre, Bar * no, Bar * &post);
+public:
+    Bar_req * bar_req_l_;
+    Bar * bar_p_;
+    virtual bool try_request(Request *req_l);
+    virtual void process_requests();
+    virtual void pre_move_processing();
+    virtual void post_move_processing();
+    Bar_register();
+    NAME_MEMBERS(Bar_register);
+};
+
+#endif // BARREG_HH
diff --git a/hdr/clef-reg.hh b/hdr/clef-reg.hh
new file mode 100644 (file)
index 0000000..cc3a8a9
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+  clef.hh -- part of LilyPond
+
+  (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef CLEF_HH
+#define CLEF_HH
+
+#include "scalar.hh"
+#include "varray.hh"
+#include "register.hh"
+
+/// where is c-0 in the staff?
+class Clef_register : public  Request_register {
+    Clef_item *clef_p_;
+    Clef_change_req * clef_req_l_;
+
+public:
+    int c0_position_i_;
+    String clef_type_str_;
+
+    /* ************** */
+    virtual void process_requests();
+    virtual void pre_move_processing();
+    virtual void post_move_processing();
+    virtual bool try_request(Request*);
+    Clef_register();
+    NAME_MEMBERS(Clef_register);
+    void read_req(Clef_change_req*);
+    bool set_type(String);
+};
+#endif // CLEF_HH
+
index d5eb6fa5cd2f0764d1949b25112d64176da91da7..eaa2d6f9d7794aaa8192f5e74f54d51615185bab 100644 (file)
 
 struct Notehead_register : Request_register {
     Item* note_p_;
+    Rhythmic_req * note_req_l_;
     int dir_i_;
+    
     /* *************** */
-    Notehead_register(Complex_walker*);
+    Notehead_register();
     virtual bool try_request(Request *req_l) ;
-    virtual void process_request();
-    virtual void do_pre_move_process();
-    void set_dir(int);
+    virtual void process_requests();
+    virtual void pre_move_processing();
+    virtual void post_move_processing();
+    void set_feature(Features);
+    NAME_MEMBERS(Notehead_register);
 };
 
 
diff --git a/hdr/key-reg.hh b/hdr/key-reg.hh
new file mode 100644 (file)
index 0000000..d8a96d0
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+  key-reg.hh -- declare Key_register
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef KEYREG_HH
+#define KEYREG_HH
+
+#include "register.hh"
+#include "key.hh"
+
+struct Key_register : Request_register {
+    Key key_;
+    Key_change_req * keyreq_l_;
+    Key_item * kit_p_;
+    Array<int> accidental_idx_arr_;
+    bool default_key_b_;
+    
+    virtual bool try_request(Request *req_l);
+    virtual void process_requests();
+    virtual void pre_move_processing();
+    virtual void post_move_processing();
+    virtual void acknowledge_element(Staff_elem_info);
+    Key_register();
+    NAME_MEMBERS(Key_register);
+private:
+    
+    void read_req(Key_change_req * r);
+};
+
+#endif // KEYREG_HH
diff --git a/hdr/local-key-reg.hh b/hdr/local-key-reg.hh
new file mode 100644 (file)
index 0000000..d0a2867
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+  local-key-reg.hh -- declare Local_key_register
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef LOCALKEYREG_HH
+#define LOCALKEYREG_HH
+#include "register.hh"
+#include "key.hh"
+
+struct Local_key_register : Request_register {
+    Local_key local_key_;
+    Local_key_item* key_item_p_;
+    const Key *key_c_l_;
+    /* *************** */
+    virtual void process_requests();
+    virtual void acknowledge_element(Staff_elem_info);
+    virtual void pre_move_processing();
+    Local_key_register();
+    NAME_MEMBERS(Local_key_register);
+};
+
+#endif // LOCALKEYREG_HH
diff --git a/hdr/meter-reg.hh b/hdr/meter-reg.hh
new file mode 100644 (file)
index 0000000..6ebe18c
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+  meter-reg.hh -- declare  Meter_register
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef METERREG_HH
+#define METERREG_HH
+#include "register.hh"
+
+/**
+  generate meters. 
+  */
+class Meter_register : public Request_register {
+public:
+    Meter_change_req * meter_req_l_;
+    Meter * meter_p_;
+    virtual bool try_request(Request *req_l);
+    virtual void process_requests();
+    virtual void pre_move_processing();
+    virtual void post_move_processing();
+    Meter_register();
+    NAME_MEMBERS(Meter_register);
+};
+#endif // METERREG_HH
diff --git a/hdr/script-reg.hh b/hdr/script-reg.hh
new file mode 100644 (file)
index 0000000..33592ca
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+  script-reg.hh -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef SCRIPTREG_HH
+#define SCRIPTREG_HH
+
+#include "register.hh"
+
+
+struct Script_register : Request_register {
+    Script * script_p_;
+    Script_req * script_req_l_;
+    int dir_i_;
+    /* *************** */
+    void set_feature(Features dir_i_);
+    Script_register();
+    virtual bool try_request(Request*);
+    virtual void process_requests();
+    virtual void acknowledge_element(Staff_elem_info);
+    virtual void pre_move_processing();
+    virtual void post_move_processing();
+    NAME_MEMBERS(Script_register);
+};
+
+#endif // SCRIPTREG_HH
diff --git a/hdr/slur-reg.hh b/hdr/slur-reg.hh
new file mode 100644 (file)
index 0000000..e357c87
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+  slur-reg.hh -- declare Slur_register
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef SLURREG_HH
+#define SLURREG_HH
+
+#include "register.hh"
+
+struct Slur_register : Request_register {
+    Array<Slur_req*> requests_arr_;
+    Array<Slur_req*> new_slur_req_l_arr_;
+    Array<Slur *> slur_l_stack_;
+    Array<Slur*> end_slur_l_arr_;
+
+    int dir_i_;
+    
+    /* *************** */
+    ~Slur_register();
+    Slur_register();
+    virtual bool try_request(Request*);
+    virtual void process_requests();
+    virtual void acknowledge_element(Staff_elem_info);
+    virtual void pre_move_processing();
+    virtual void post_move_processing();
+    virtual void set_feature(Features);
+    NAME_MEMBERS(Slur_register);
+};
+
+#endif // SLURREG_HH
diff --git a/hdr/stem-beam-reg.hh b/hdr/stem-beam-reg.hh
new file mode 100644 (file)
index 0000000..dddba26
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+  stem-beam-reg.hh -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STEMBEAMREG_HH
+#define STEMBEAMREG_HH
+#include "register.hh"
+
+struct Stem_beam_register : Request_register {
+    Stem * stem_p_;
+    Beam * beam_p_;
+    Beam_req * beam_req_l_;
+    Stem_req * stem_req_l_;
+    Beam_req * start_req_l_;
+    bool end_beam_b_;
+    Rhythmic_grouping *current_grouping;
+    int default_dir_i_;
+    
+    /* *************** */
+    Stem_beam_register();
+    ~Stem_beam_register();
+    virtual void set_feature(Features dir_i_);
+    virtual bool try_request(Request*);
+    virtual void process_requests();
+    virtual void acknowledge_element(Staff_elem_info);
+    virtual void pre_move_processing();
+    virtual void post_move_processing();
+    NAME_MEMBERS(Stem_beam_register);
+};
+#endif // STEMBEAMREG_HH
diff --git a/hdr/text-reg.hh b/hdr/text-reg.hh
new file mode 100644 (file)
index 0000000..59317e5
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  text-reg.hh -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef TEXTREG_HH
+#define TEXTREG_HH
+#include "register.hh"
+
+struct Text_register : Request_register{
+    Text_item * text_p_;
+    Text_req * text_req_l_;
+    int dir_i_;
+    /* *************** */
+    virtual void set_feature(Features );
+    Text_register();
+    virtual bool try_request(Request*);
+    virtual void process_requests();
+    virtual void pre_move_processing();
+    virtual void post_move_processing();
+    NAME_MEMBERS(Text_register);
+};
+
+#endif // TEXTREG_HH
index dc24ecd96a86c907bc535febef28d6cb4cbcf961..cf88c06c7387ab77c54c0b193a21a692b86febdf 100644 (file)
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
-#include "clefreg.hh"
-#include "localkeyreg.hh"
-#include "keyreg.hh"
-#include "meterreg.hh"
-#include "barreg.hh"
+#include "debug.hh"
+#include "clef-reg.hh"
+#include "local-key-reg.hh"
+#include "key-reg.hh"
+#include "meter-reg.hh"
+#include "bar-reg.hh"
+#include "bar.hh"
 #include "walkregs.hh"
+#include "staff-elem.hh"
+#include "staff.hh"
+#include "complex-walker.hh"
+#include "staff-column.hh"
+#include "voice-group-regs.hh"
+#include "voice-regs.hh"
+#include "commandrequest.hh"
+
 
 Walker_registers::Walker_registers(Complex_walker *w)
 {
-    add( new Bar_register(w));
-    add( new Clef_register(w));
-    add( new Key_register(w));
-    add( new Meter_register(w));
-    add( new Local_key_register(w));
+    walk_l_ = w;
+    add( new Bar_register);
+    add( new Clef_register);
+    add( new Key_register);
+    add( new Meter_register);
+    add( new Local_key_register);
+}
+
+void
+Walker_registers::announce_element(Staff_elem_info info)
+{
+    if (info.elem_p_->name() == Bar::static_name()) {
+       walk_l_->allow_break();
+    }
+    announce_info_arr_.push(info);
+}
+
+void
+Walker_registers::acknowledge_element(Staff_elem_info )
+{
+    assert(false);
+}
+
+void
+Walker_registers::do_announces()
+{
+    Request dummy_req;
+    for (int i = 0; i < announce_info_arr_.size(); i++){
+       Staff_elem_info info = announce_info_arr_[i];
+
+       if (!info.req_l_)
+           info.req_l_ = &dummy_req;
+       Register_group_register::acknowledge_element(info);
+    }
+    announce_info_arr_.set_size(0);
+}
+
+void
+Walker_registers::typeset_element(Staff_elem *elem_p)
+{
+    typeset_musical_item(elem_p);
+}
+
+void
+Walker_registers::typeset_musical_item(Staff_elem * elem_p)
+{
+    walk_l_->typeset_element(elem_p);
+}
+
+void
+Walker_registers::typeset_breakable_item(Item * pre_p , Item * nobreak_p,
+                                      Item * post_p)
+{
+    if (pre_p)
+       prebreak_item_p_arr_.push(pre_p);
+    if (nobreak_p)
+       nobreak_item_p_arr_.push(nobreak_p);
+    if (post_p)
+       postbreak_item_p_arr_.push(post_p);
+}
+
+void
+Walker_registers::pre_move_processing()
+{
+    // this generates all items.
+    Register_group_register::pre_move_processing();
+    walk_l_->ptr()->typeset_breakable_items(prebreak_item_p_arr_,
+                                           nobreak_item_p_arr_,
+                                           postbreak_item_p_arr_);
+}
+void
+Walker_registers::post_move_processing()
+{
+    Register_group_register::post_move_processing();
+}
+
+void
+Walker_registers::change_group(Group_change_req * greq_l,
+                              Voice_registers *voice_regs_l,
+                              Voice_group_registers * old_group)
+{
+    Voice_registers *regs_p = (old_group)
+       ? (Voice_registers*) old_group->get_register_p(voice_regs_l)
+       : new Voice_registers(greq_l->voice_l());
+    Voice_group_registers * new_group_l = get_group(greq_l->newgroup_str_);
+    new_group_l->add(regs_p);
+    
+    mtor << "processed change request";
+    print();
+}
+
+Voice_group_registers *
+Walker_registers::get_group(String id)
+{
+    for (int i=0; i < group_l_arr_.size(); i++) {
+       if (group_l_arr_[i]->group_id_str_ == id)
+           return group_l_arr_[i];
+    }
+    Voice_group_registers *group_p = new Voice_group_registers(id);
+    group_l_arr_.push(group_p);
+    add(group_p);
+    return group_p;
+}
+
+void
+Walker_registers::terminate_register(Request_register * reg)
+{
+    for (int i=0; i < group_l_arr_.size(); i++) {
+       if (group_l_arr_[i] == reg) {
+           group_l_arr_.del(i);
+           Register_group_register::terminate_register(reg);
+           return;
+       }
+    }
+    assert(false);
+}
+
+bool
+Walker_registers::try_request(Request * r)
+{
+    bool b = Register_group_register::try_request(r);
+    if (!b) {
+       Command_req * cr_l = r->command() ;
+       
+       if (cr_l && cr_l->groupchange()) {
+           change_group(cr_l->groupchange(), 0, 0);
+       } else 
+           warning("junking request: "  + String(r->name()),
+                   r->defined_ch_c_l_);
+    }
+    return b;
+}
+
+
+Staff_info
+Walker_registers::get_staff_info() return inf;
+{
+    inf.c0_position_i_ = &walk_l_->c0_position_i_;
+    inf.walk_l_ = walk_l_;
+    inf.time_c_l_ = &walk_l_->time_;
+    inf.rhythmic_c_l_ = walk_l_->default_grouping;
+}
+Paper_def*
+Walker_registers::paper()const
+{
+    return walk_l_->staff_l_->paper();
 }