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 */
*/
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;
IDACCESSOR(Duration)
VIRTUAL_COPY_CONS(Identifier);
+ DECLARE_SMOBS(Identifier, foo);
protected:
virtual void do_print () const;
virtual String do_str () const;
*/
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_;
--- /dev/null
+/*
+ lyric-phrasing-engraver.hh -- declare Lyric_phrasing_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Glen Prideaux <glenprideaux@iname.com>
+*/
+
+
+#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<Score_element> 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
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, / );
/**
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;
class Foo {
Scheme_hash_table tab;
}
+
+
+ 2. UPON DESTRUCTION, DO
+
+ scm_unprotect_object (tab->self_scm_);
+
*/
class Scheme_hash_table : private Scm_stl_map
{
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 */
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*);
virtual void handle_prebroken_dependencies ();
- DECLARE_SMOBS;
+ DECLARE_SMOBS(Score_element,foo);
void init ();