]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.30
authorfred <fred>
Mon, 10 Feb 1997 23:50:19 +0000 (23:50 +0000)
committerfred <fred>
Mon, 10 Feb 1997 23:50:19 +0000 (23:50 +0000)
hdr/scriptreg.hh [new file with mode: 0644]
hdr/textreg.hh [new file with mode: 0644]
src/textreg.cc [new file with mode: 0644]

diff --git a/hdr/scriptreg.hh b/hdr/scriptreg.hh
new file mode 100644 (file)
index 0000000..7295342
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  scriptreg.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_;
+    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 (file)
index 0000000..3dd2172
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+  textreg.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_;
+    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 (file)
index 0000000..309bf6f
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+  textreg.cc -- implement Text_register
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#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;
+}