From: fred Date: Tue, 26 Mar 2002 23:25:11 +0000 (+0000) Subject: lilypond-1.3.74 X-Git-Tag: release/1.5.59~1456 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=53f9630e632149ef023ba3506edbef6f07ed7201;p=lilypond.git lilypond-1.3.74 --- diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index 9db37fda4e..843fab6ffe 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -17,31 +17,34 @@ struct Font_metric { - Font_metric (); SCM name_; virtual SCM description () const; virtual Box get_char (int ascii, bool warn) const; virtual ~Font_metric (); virtual Box text_dimension (String) const; - DECLARE_SMOBS; + DECLARE_SIMPLE_SMOBS(Font_metric,); private: Font_metric (Font_metric const&); // no copy. +protected: + Font_metric (); }; struct Scaled_font_metric : public Font_metric { + virtual SCM description () const; + virtual Box text_dimension (String) const; + + static SCM make_scaled_font_metric (Font_metric*, int); +protected: Font_metric *orig_l_; int magstep_i_; - Scaled_font_metric (Font_metric*, int); - virtual SCM description () const; - virtual Box text_dimension (String) const; + Scaled_font_metric (Font_metric*,int); }; Font_metric * unsmob_metrics (SCM s); - #endif /* FONT_METRIC_HH */ diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index 750c49089a..02587ce978 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -33,14 +33,11 @@ virtual Class * access_content_ ## Class (bool) const { error (#Class + String */ struct Identifier : public Input { - DECLARE_SMOBS; bool init_b_; bool accessed_b_; int token_code_i_; Identifier (Identifier const&); Identifier (int code) ; - virtual ~Identifier() ; - void print() const; @@ -52,6 +49,7 @@ struct Identifier : public Input { IDACCESSOR(Duration) VIRTUAL_COPY_CONS(Identifier); + DECLARE_SMOBS(Identifier, foo); protected: virtual void do_print () const; virtual String do_str () const; diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index d0f5e33f2c..88f48b2603 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -24,15 +24,11 @@ */ class Lookup { - - Lookup (); Lookup (Lookup const&); - - friend class Brutus; // kai su, teknon. (make GCC shut up.) - + DECLARE_SIMPLE_SMOBS(Lookup,); public: - DECLARE_SMOBS; + static SCM make_lookup (); String font_name_; Adobe_font_metric * afm_l_; diff --git a/lily/include/lyric-phrasing-engraver.hh b/lily/include/lyric-phrasing-engraver.hh new file mode 100644 index 0000000000..45b0769de2 --- /dev/null +++ b/lily/include/lyric-phrasing-engraver.hh @@ -0,0 +1,114 @@ +/* + lyric-phrasing-engraver.hh -- declare Lyric_phrasing_engraver + + source file of the GNU LilyPond music typesetter + + (c) 2000 Glen Prideaux +*/ + + +#ifndef LYRIC_PHRASING_ENGRAVER_HH +#define LYRIC_PHRASING_ENGRAVER_HH + +#include "lily-proto.hh" +#include "engraver.hh" +#include "item.hh" +#include "smobs.hh" + +class Voice_alist_entry; + + +/** + Align lyrics with noteheads, left aligning beginning of phrases, + right aligning end of phrases, centering others under their notes. + */ + + +/* +* Build an engraver that catches noteheads and lyrics. + +(It needs to be in a context above Staff and Lyrics, eg. in Score +context.) + +* Determine which heads belong to which lyrics + +(eg. by looking at the names of their originating contexts, or maybe +some \properties) + +* Attach the lyrics to the appropriate heads + +(by doing lyric->set_parent (head, X_AXIS), that will fix the current +noteheadwidth guessing kludge) + +* Check if the lyric syllables end or start a phrase. + +(eg. check if the syllable ends with punctuation, and remember that +fact for the next one.) + +* Adjust their alignment accordingly. + +(eg. by doing lyric->add_offset_callback(centered_on_parent,X_AXIS) +and setting self-alignment-X) + +* Add a property to switch on/off the engraver (for multi stanza + vs. single stanza music) + +Maybe this engraver could also take care of correct lyric alignment +for melismas as well. + + + */ + + +class Lyric_phrasing_engraver : public Engraver +{ +protected: + virtual void acknowledge_element(Score_element_info); + virtual void process_acknowledged (); + virtual void do_pre_move_processing(); + +private: + void record_notehead(const String &context_id, Score_element * notehead); + void record_lyric(const String &context_id, Score_element * lyric); + Voice_alist_entry * lookup_context_id(const String &context_id); + +public: + Lyric_phrasing_engraver (); + ~Lyric_phrasing_engraver (); + VIRTUAL_COPY_CONS (Translator); + +private: + /** association list of Voice_alist_entry smobs + */ + Protected_scm voice_alist_; +}; + + +class Voice_alist_entry +{ + bool first_in_phrase_b_; + Score_element * notehead_l_; + Link_array lyric_list_; + int longest_lyric_; + int shortest_lyric_; + int alignment_i_; + +public: + static SCM make_entry(); + void set_first_in_phrase(bool f); + void set_notehead(Score_element * notehead); + void add_lyric(Score_element * lyric); + void clear(); + bool is_empty(); + bool set_lyric_align(const char *punc); + int appropriate_alignment(const char *punc); + void next_lyric(); +private: + Voice_alist_entry(); + DECLARE_SIMPLE_SMOBS(Voice_alist_entry,); +} ; + +Voice_alist_entry * unsmob_voice_entry (SCM); + + +#endif // LYRIC_PHRASING_ENGRAVER_HH diff --git a/lily/include/moment.hh b/lily/include/moment.hh index 53afd01816..0bd535a6d5 100644 --- a/lily/include/moment.hh +++ b/lily/include/moment.hh @@ -17,18 +17,22 @@ Rationals with glue for Guilification; FIXME: remove self_scm_ and then remove this class */ -struct Moment : public Rational +class Moment : public Rational { - Moment () { self_scm_ = SCM_EOL; } - Moment (int m) : Rational (m) {self_scm_ = SCM_EOL; } - Moment (int m, int n) : Rational (m,n) {self_scm_ = SCM_EOL; } - Moment (Rational m) : Rational (m) {self_scm_ = SCM_EOL; } - ~Moment (); - - DECLARE_SMOBS; + DECLARE_SIMPLE_SMOBS(Moment,); +public: + Moment () { } + Moment (int m) : Rational (m) { } + Moment (int m, int n) : Rational (m,n) { } + Moment (Rational m) : Rational (m) { } + + /* + Deliver a copy of THIS as a smobified SCM + */ + SCM make_scm () const; }; -SCM smobify (Moment*); + Moment * unsmob_moment (SCM); IMPLEMENT_ARITHMETIC_OPERATOR (Moment, / ); diff --git a/lily/include/scm-hash.hh b/lily/include/scm-hash.hh index 7a903469c1..ae733e9df8 100644 --- a/lily/include/scm-hash.hh +++ b/lily/include/scm-hash.hh @@ -30,7 +30,7 @@ typedef map Scm_stl_map; /** auto resizing hash table. This should come from GUILE. - ALWAYS USE THIS AS VIA A POINTER, i.e. + 1. ALWAYS USE THIS AS VIA A POINTER, i.e. class Foo { Scheme_hash_table * tab; @@ -41,6 +41,12 @@ typedef map Scm_stl_map; class Foo { Scheme_hash_table tab; } + + + 2. UPON DESTRUCTION, DO + + scm_unprotect_object (tab->self_scm_); + */ class Scheme_hash_table : private Scm_stl_map { @@ -57,9 +63,10 @@ public: Scheme_hash_table (); void operator = (Scheme_hash_table const &); Scheme_hash_table (Scheme_hash_table const &); - virtual ~Scheme_hash_table (); - DECLARE_SMOBS; + SCM to_alist () const; + DECLARE_SMOBS(Scheme_hash_table,foo); + }; #endif /* SCM_HASH_HH */ diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 7ce14c8cc1..85ff5e8774 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -141,11 +141,6 @@ public: static Interval molecule_extent (Score_element *,Axis); protected: - /** - Junk score element. This is protected because this is supposed to - be handled by GUILE gc. */ - virtual ~Score_element (); - ///executed directly after the item is added to the Paper_score virtual void do_add_processing (); static Interval dim_cache_callback (Dimension_cache const*); @@ -163,7 +158,7 @@ public: virtual void handle_prebroken_dependencies (); - DECLARE_SMOBS; + DECLARE_SMOBS(Score_element,foo); void init ();