]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.74
authorfred <fred>
Tue, 26 Mar 2002 23:25:11 +0000 (23:25 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:25:11 +0000 (23:25 +0000)
lily/include/font-metric.hh
lily/include/identifier.hh
lily/include/lookup.hh
lily/include/lyric-phrasing-engraver.hh [new file with mode: 0644]
lily/include/moment.hh
lily/include/scm-hash.hh
lily/include/score-element.hh

index 9db37fda4e8dbadc05ac993ee50b615e5299a760..843fab6ffe9332ecaca7f1af3125f31f1239de4f 100644 (file)
 
 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 */
 
index 750c49089a4d555328d397516b27d25cfd4e0e43..02587ce9788138e74c767052f1a8f2c22cf8cec4 100644 (file)
@@ -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;
index d0f5e33f2c54a4b36933afa8bbf30df0e30810c9..88f48b2603669cce3f3c8d016f22d5e8c0843d28 100644 (file)
  */
 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 (file)
index 0000000..45b0769
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+  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
index 53afd01816d17107c91a8b599ab59afba6307209..0bd535a6d5c7c9d5edd6174b626c53fdbf227958 100644 (file)
    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, / );
index 7a903469c1dc537de3010f30c9ea62a520dae09d..ae733e9df80a53acfe909c23b70d157fcb632fa0 100644 (file)
@@ -30,7 +30,7 @@ typedef map<SCM,SCM, SCM_less> 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,SCM, SCM_less> 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 */
index 7ce14c8cc1aef7a8e6d650fd2fc918db2e23a87f..85ff5e8774a90fd61edf77169657bfab7ed06d80 100644 (file)
@@ -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 ();