]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/local-key-item.hh
release: 1.3.25
[lilypond.git] / lily / include / local-key-item.hh
index 2d4ed66e8f74b64715a463497f116bae12abf742..b1d20b3ac4f89ea2ed2332ea6f9cc261cc4d8397 100644 (file)
@@ -1,43 +1,56 @@
 /*
   local-key-item.hh -- part of GNU LilyPond
 
-  (c) 1996,97 Han-Wen Nienhuys
+  (c) 1996--2000 Han-Wen Nienhuys
 */
 
 #ifndef LOCALKEYITEM_HH
 #define LOCALKEYITEM_HH
 #include "item.hh"
-#include "varray.hh"
+#include "array.hh"
+#include "musical-pitch.hh"
 
-struct Local_acc {
-    int name_i_;
-    int accidental_i_;
-    int octave_i_;
-    static int compare(Local_acc&, Local_acc&);
+
+
+struct Local_key_cautionary_tuple
+{
+  Musical_pitch pitch_;
+  bool cautionary_b_;
+  bool natural_b_;
+
+  Local_key_cautionary_tuple ()
+  {
+    cautionary_b_ = false;
+    natural_b_ = false;
+  }
+  static int compare (Local_key_cautionary_tuple const&s1, Local_key_cautionary_tuple const&s2)
+  {
+    return Musical_pitch::compare (s1.pitch_, s2.pitch_);
+  }
 };
 
 /**
   Accidentals which can be different for each octave.
 
-  TODO:
-  update item if Items are removed
+  
+  TODO
+
+  Make an item for each accidental separately, and make a
+  Accidental_column to group them.
+  
  */
-struct Local_key_item : Item {
-    DECLARE_MY_RUNTIME_TYPEINFO;
-    Array<Local_acc> accs;
-    Link_array<Item> support_items_;
-    int c0_position;
-
-    /* *************** */
-    
-    Local_key_item(int c0position);
-    void add_support(Item*);
-    void add(int oct, int pitch, int acc);
-    void add(Melodic_req*);
+
+class Local_key_item : public Item
+{
+  Array<Local_key_cautionary_tuple> accidental_arr_;
+
+  Molecule accidental (int,bool,bool) const;
 public:
-    virtual void do_pre_processing();    
-    virtual void do_substitute_dependency(Score_elem*,Score_elem*);
-    virtual Molecule* brew_molecule_p()const;
+
+  void add_pitch (Musical_pitch, bool cautionary, bool natural);
+protected:
+  virtual void do_pre_processing();
+  virtual Molecule* do_brew_molecule_p() const;
 };
 #endif // LOCALKEYITEM_HH