2 register.hh -- declare Request_register
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
13 #include "lily-proto.hh"
16 #include "score-elem-info.hh"
17 #include "staff-info.hh"
23 a struct which processes requests, and creates the #Score_elem#s.
24 It may use derived classes. Hungarian postfix: register
26 class Request_register {
27 friend class Register_group_register;
29 You cannot copy a Request_register
31 Request_register(const Request_register&){}
47 virtual Paper_def * paper() const;
50 /// make items/spanners with the requests you got
51 virtual void do_process_requests(){}
53 /** typeset any items/spanners. Default: do nothing
55 virtual void do_pre_move_processing(){}
56 /** reset any appropriate data. Default: do nothing
58 virtual void do_post_move_processing(){}
61 virtual void do_creation_processing () {}
62 virtual void do_removal_processing() {}
65 typeset a "command" item. Default: pass on to daddy.
66 If the column is not breakable, #pre_p# and #post_p# are junked
68 virtual void typeset_breakable_item(Item * nobreak_p);
70 Invoke walker method to typeset element. Default: pass on to daddy.
72 virtual void typeset_element(Score_elem*elem_p);
75 take note of item/spanner
76 put item in spanner. Adjust local key; etc.
78 Default: ignore the info
80 virtual void acknowledge_element(Score_elem_info) {}
82 Announce element. Default: pass on to daddy. Utility
84 virtual void announce_element(Score_elem_info);
86 Set Feature of the register(s). Default: ignore Feature.
88 virtual void set_feature(Feature){}
90 ask daddy for a feature
92 virtual Scalar get_feature(String type_str);
94 Does this equal or contain a certain register?
97 virtual void sync_features() {}
99 virtual bool contains_b(Request_register*reg_l)const;
101 Get information on the staff. Default: ask daddy.
103 virtual Staff_info get_staff_info()const;
104 virtual void fill_staff_info(Staff_info&);
107 virtual void do_print()const;
110 Default: always return false
112 virtual bool do_try_request(Request *req_l);
114 void pre_move_processing();
115 void process_requests();
117 try to fit the request in this register
120 false: not noted, not taken.
122 true: request swallowed. Don't try to put the request elsewhere.
125 bool try_request(Request*);
127 void post_move_processing();
129 Register_group_register * daddy_reg_l_;
132 virtual ~Request_register(){}
138 A macro to automate administration of registers.
140 #define ADD_THIS_REGISTER(c) \
142 static Request_register * globalctor (){ \
146 add_request_register(c::static_name(), globalctor); \
151 typedef Request_register*(*Reg_ctor)(void);
152 void add_request_register(String s, Reg_ctor f);
154 #endif // REGISTER_HH