From: fred Date: Mon, 10 Feb 1997 23:50:19 +0000 (+0000) Subject: lilypond-0.0.30 X-Git-Tag: release/1.5.59~6346 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5ecaa6df8684215256d9023305cf6db187a2badf;p=lilypond.git lilypond-0.0.30 --- diff --git a/hdr/scriptreg.hh b/hdr/scriptreg.hh new file mode 100644 index 0000000000..72953427d5 --- /dev/null +++ b/hdr/scriptreg.hh @@ -0,0 +1,26 @@ +/* + scriptreg.hh -- part of LilyPond + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef SCRIPTREG_HH +#define SCRIPTREG_HH + +#include "register.hh" + + +struct Script_register : Request_register { + Script * script_p_; + int dir_i_; + /* *************** */ + void set_dir(int dir_i_); + Script_register(Complex_walker*); + virtual bool try_request(Request*); + virtual void process_request(); + virtual void acknowledge_element(Staff_elem_info); + virtual void do_pre_move_process(); +}; + +#endif // SCRIPTREG_HH diff --git a/hdr/textreg.hh b/hdr/textreg.hh new file mode 100644 index 0000000000..3dd2172335 --- /dev/null +++ b/hdr/textreg.hh @@ -0,0 +1,23 @@ +/* + textreg.hh -- part of LilyPond + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef TEXTREG_HH +#define TEXTREG_HH +#include "register.hh" + +struct Text_register : Request_register{ + Text_item * text_p_; + int dir_i_; + /* *************** */ + void set_dir(int dir_i); + Text_register(Complex_walker*); + virtual bool try_request(Request*); + virtual void process_request(); + virtual void do_pre_move_process(); +}; + +#endif // TEXTREG_HH diff --git a/src/textreg.cc b/src/textreg.cc new file mode 100644 index 0000000000..309bf6fe98 --- /dev/null +++ b/src/textreg.cc @@ -0,0 +1,53 @@ +/* + textreg.cc -- implement Text_register + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "textreg.hh" +#include "textitem.hh" + +Text_register::Text_register(Complex_walker*w) + : Request_register(w) +{ + text_p_ = 0; + set_dir(0); +} + +bool +Text_register::try_request(Request*req_l) +{ + if (!req_l->text()) + return false; + if (accepted_req_arr_.size() && + Text_req::compare(*req_l->text(), *accepted_req_arr_[0]->text())) + + return false; + + accepted_req_arr_.push(req_l); + return true; +} + +void +Text_register::process_request() +{ + + if (accepted_req_arr_.size()) { + text_p_ = new Text_item(accepted_req_arr_[0]->text(), 10); + announce_element(Staff_elem_info(text_p_, accepted_req_arr_[0], this)); + } +} +void +Text_register::do_pre_move_process() +{ + if (text_p_) { + text_p_->dir_i_ = dir_i_; + typeset_element(text_p_); + text_p_ = 0; + } +} +void +Text_register::set_dir(int i) +{ + dir_i_ = i; +}