2 register.hh -- declare Request_register
4 source file of the LilyPond music typesetter
6 (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
13 #include "lily-proto.hh"
16 #include "staff-elem-info.hh"
17 #include "staff-info.hh"
20 a struct which processes requests, and creates the #Score_elem#s.
21 It may use derived classes. Hungarian postfix: register
23 class Request_register {
24 friend class Register_group_register;
26 You cannot copy a Request_register
28 Request_register(const Request_register&){}
33 virtual Paper_def * paper() const;
36 try to fit the request in this register
39 false: not noted, not taken.
41 true: request swallowed. Don't try to put the request elsewhere.
44 Default: always return false
46 virtual bool try_request(Request *req_l);
48 /// make items/spanners with the requests you got
49 virtual void process_requests(){}
51 /** typeset any items/spanners. Default: do nothing
53 virtual void pre_move_processing(){}
54 /** reset any appropriate data. Default: do nothing
56 virtual void post_move_processing(){}
59 Is this request eligible to be processed? Default: return false.
61 virtual bool acceptable_request_b(Request*) const;
64 typeset a "command" item. Default: pass on to daddy.
65 If the column is not breakable, #pre_p# and #post_p# are junked
67 virtual void typeset_breakable_item(Item * pre_p ,
68 Item * nobreak_p, Item * post_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();
106 virtual void do_print()const;
108 /** Every Request_register (except for the 'top' which is directly
109 inside the Staff_walker, is a element of a group. */
110 Register_group_register * daddy_reg_l_;
113 virtual ~Request_register(){}
114 NAME_MEMBERS(Request_register);
119 A macro to automate administration of registers.
121 #define ADD_THIS_REGISTER(c) \
123 static Request_register * globalctor (){ \
127 add_request_register(c::static_name(), globalctor); \
132 typedef Request_register*(*Reg_ctor)(void);
133 void add_request_register(String s, Reg_ctor f);
135 #endif // REGISTER_HH