--- /dev/null
+
+\score
+{
+\notes {
+ c''4
+ \outputproperty #(make-type-checker 'Note_head) #'staff-position = #20
+ c''4
+
+}
+}
#include "engraver.hh"
#include "stem.hh"
#include "note-head.hh"
+#include "group-interface.hh"
/**
print text & hairpin dynamics.
Dynamic_engraver();
protected:
+
+ void announce_element (Score_element_info);
+
virtual void do_removal_processing ();
virtual void acknowledge_element (Score_element_info);
virtual bool do_try_music (Music *req_l);
virtual void typeset_element (Score_element*);
};
+void
+Dynamic_engraver::announce_element (Score_element_info i)
+{
+ group (i.elem_l_, "interfaces").add_thing (ly_symbol2scm ("dynamic"));
+
+ Engraver::announce_element (i);
+}
Dynamic_engraver::Dynamic_engraver()
{
p->used_b_ = true;
elt_l_->used_b_ = true;
-
+
+ add_thing (p->self_scm_);
+}
+
+void
+Group_interface::add_thing (SCM s)
+{
elt_l_->set_elt_property (name_,
- gh_cons (p->self_scm_, elt_l_->get_elt_property (name_)));
+ gh_cons (s, elt_l_->get_elt_property (name_)));
+
}
+
int
Group_interface::count ()
{
#include "lily-guile.hh"
#include "smobs.hh"
+/*
+ rename to list interface?
+ */
+
+/**
+ Look at Score element ELT as thing which has a list property called
+ NAME_. Normally the list would contain Score_elements, but
+ sometimes it can be different things.
+*/
struct Group_interface
{
Score_element * elt_l_;
Group_interface (Score_element const*);
Group_interface (Score_element const*, String);
int count ();
+ void add_thing (SCM);
bool has_interface_b ();
void set_interface ();
void add_element (Score_element*);
Group_interface group (Score_element*);
Group_interface group (Score_element*, String);
-/*
- template<class T>
- Link_array<T> Group_interface__extract_elements (T *, String name);
-*/
+/**
+ Put all score elements of ELT's property called NAME into an array,
+ and return it. */
template<class T>
Link_array<T>
Group_interface__extract_elements (Score_element const *elt, T *, String name)
--- /dev/null
+/*
+ output-property.hh -- declare Output_property
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef OUTPUT_PROPERTY_HH
+#define OUTPUT_PROPERTY_HH
+
+#include "music.hh"
+#include "protected-scm.hh"
+
+class Output_property : public Music
+{
+public:
+ Output_property(SCM, SCM, SCM);
+
+ /**
+ relevant stuff: the predicate, the symbol, the value
+ */
+ Protected_scm pred_sym_val_list_;
+};
+
+#endif /* OUTPUT_PROPERTY_HH */
#include "music-iterator.hh"
-class Request_iterator : public Music_iterator
+class Simple_music_iterator : public Music_iterator
{
public:
- Request_iterator ();
protected:
virtual void do_process_and_next (Moment );
};
static Interval dim_cache_callback (Dimension_cache const*);
public:
+ static SCM ly_set_elt_property (SCM, SCM,SCM);
+ static SCM ly_get_elt_property (SCM, SCM);
+
virtual void handle_broken_dependencies ();
virtual void handle_prebroken_dependencies ();
virtual Moment now_mom () const;
protected:
+ /*
+ UGH. Clean this up.
+ */
enum {
ORPHAN,
VIRGIN,
}
-void
+static void
init_functions ()
{
scm_make_gsubr ("ly-warn", 1, 0, 0, (SCM(*)(...))ly_warning);
/*
Appendable list L: the cdr contains the list, the car the last cons
in the list.
-
*/
-
SCM
appendable_list ()
{
(c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+
+/*
+ UGH. too many includes.
+ */
#include "debug.hh"
#include "music-list.hh"
#include "music-iterator.hh"
#include "auto-change-iterator.hh"
#include "request.hh"
#include "request-iterator.hh"
+#include "output-property.hh"
void
Music_iterator::do_print() const
else
p = new Unfolded_repeat_iterator;
}
- else if (Request const * r = dynamic_cast<Request const* > (m))
+ else
{
- p = new Request_iterator ;
+ p = new Simple_music_iterator ;
}
- else
- assert (0);
p->music_l_ = m;
return p;
{"name", NAME},
{"notenames", NOTENAMES},
{"notes", NOTES},
+ {"outputproperty", OUTPUTPROPERTY},
{"partial", PARTIAL},
{"paper", PAPER},
{"penalty", PENALTY},
--- /dev/null
+/*
+ output-property-engraver.cc -- implement Output_property_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "output-property.hh"
+#include "engraver.hh"
+#include "score-element.hh"
+
+class Output_property_engraver : public Engraver
+{
+public:
+ VIRTUAL_COPY_CONS(Translator);
+protected:
+
+ Link_array<Output_property> props_;
+
+ virtual void do_pre_move_processing ();
+ virtual void acknowledge_element (Score_element_info);
+ virtual bool do_try_music (Music*);
+};
+
+
+bool
+Output_property_engraver::do_try_music (Music* m)
+{
+ if (Output_property * o = dynamic_cast<Output_property*> (m))
+ {
+ props_.push (o);
+ return true;
+ }
+ return false;
+}
+
+void
+Output_property_engraver::acknowledge_element (Score_element_info inf)
+{
+ for (int i=props_.size (); i--; )
+ {
+ Output_property * o = props_[i];
+ SCM pred = gh_car (o->pred_sym_val_list_);
+ /*
+ should typecheck pred.
+ */
+ SCM result=gh_apply (pred,
+ gh_list (inf.elem_l_->self_scm_, SCM_UNDEFINED));
+ if (to_boolean (result))
+ {
+ Score_element::ly_set_elt_property (inf.elem_l_->self_scm_,
+ gh_cadr (o->pred_sym_val_list_),
+ gh_caddr (o->pred_sym_val_list_));
+ }
+ }
+}
+
+void
+Output_property_engraver::do_pre_move_processing ()
+{
+ props_.clear ();
+}
+
+ADD_THIS_TRANSLATOR(Output_property_engraver);
--- /dev/null
+/*
+ output-property-engraver.cc -- implement Output_property_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "output-property.hh"
+#include "engraver.hh"
+
+class Output_property_engraver : public Engraver
+{
+public:
+ Output_property_engraver();
+ VIRTUAL_COPY_CONS(Translator);
+protected:
+
+ Link_array<Output_property> props_;
+
+ virtual void do_acknowledge_element (Score_element_info);
+ virtual bool do_try_music (Music*);
+};
+
+
+Output_property_engraver::do_try_music (Music* m)
+{
+ if (Output_property * o = dynamic_cast<Output_property*> (m))
+ {
+ props_.push (m);
+ return true;
+ }
+ return false;
+}
+
+void
+Output_property_engraver::do_acknowledge_element (Score_element_info i)
+{
+ for (int i=props_.size (); i--; )
+ {
+ Output_property * o = props_[i];
+ SCM pred = gh_car (o->pred_sym_val_list_);
+ /*
+ should typecheck pred.
+ */
+ SCM result=gh_apply (pred,
+ gh_listify (i.elem_l_->self_scm_, SCM_UNDEFINED));
+ if (to_boolean (result))
+ {
+ i.elem_l_->set_elt_property (gh_cadr (o->pred_sym_val_list_),
+ gh_caddr (o->pred_sym_val_list_));
+ }
+ }
+}
+
+void
+Output_property_engraver::do_pre_move_processing ()
+{
+ props_.clear ();
+}
--- /dev/null
+/*
+ output-property.cc -- implement Output_property
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+#include "output-property.hh"
+#include "lily-guile.hh"
+
+Output_property::Output_property(SCM pred, SCM sym, SCM val)
+{
+ pred_sym_val_list_ = gh_list (pred, sym, val, SCM_UNDEFINED);
+}
+
/*
- request-iterator.cc -- implement
+ request-iterator.cc -- implement Simple_music_iterator
source file of the GNU LilyPond music typesetter
#include "request-iterator.hh"
#include "music.hh"
-Request_iterator::Request_iterator()
-{
-}
-
void
-Request_iterator::do_process_and_next (Moment m)
+Simple_music_iterator::do_process_and_next (Moment m)
{
if (first_b_)
{
bool g= try_music (music_l_);
if (!g)
- music_l_->warning (_f ("Junking request: `%s'", classname(music_l_)));
+ music_l_->warning (_f ("Junking music: `%s'", classname(music_l_)));
first_b_ = false;
}
currentpicture := currentpicture shifted (0, r);
fet_endchar;
+%%% strange turning path.
fet_beginchar("accBayanbase", "accBayanbase", "accBayanbase")
save lh;
lh = accreg_lh;
cTwo = 0.60;
enddef;
+%%% strange turning path.
fet_beginchar("accSB", "accSB", "accSB")
set_char_box(.4staffsize#, .4staffsize#, 0, 2.4staff_space#);
def_some_vars;
currentpicture := currentpicture shifted (0, 2.4staff_space);
fet_endchar;
+%%% strange turning path.
fet_beginchar("accBB", "accBB", "accBB")
set_char_box(.4staffsize#, .4staffsize#, 0, 2.4staff_space#);
def_some_vars;
fet_endchar;
+%%% strange turning path.
fet_beginchar("accOldEE", "accOldEE", "accOldEE")
set_char_box(staff_space#, staff_space#, 0, 2staff_space#);
show w;