]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.46
authorfred <fred>
Tue, 26 Mar 2002 23:21:21 +0000 (23:21 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:21:21 +0000 (23:21 +0000)
Documentation/user/properties.itely
input/bugs/volta.ly [new file with mode: 0644]
input/trip.ly
lily/bar-number-engraver.cc
lily/mark-engraver.cc
lily/side-position-interface.cc
lily/volta-spanner.cc
ly/engraver.ly

index a73d49e5c97404cd4a031cf988eac7f3f7fc07d0..815f1a65fbc310de55df348f097f83e6ea76d67c 100644 (file)
@@ -7,6 +7,10 @@ property is listed in parentheses after the property name.
  (\t\)
 @end macro
 
+
+TODO:
+
+
 @table @samp
   @item @code{Generic_property_list}
     Defines names and types for generic properties. These are properties
@@ -591,6 +595,9 @@ no clef is printed upon creation.
 
 @cindex properties!Score
 
+
+
+
 @table @samp
   @item @code{skipBars}@indexcode{skipBars} @propertytype{boolean}
     Set to 1 to skip the empty bars that are produced by
@@ -621,6 +628,28 @@ r1 r1*3 R1*3\property Score.skipBars=1 r1*3 R1*3
          "Time_signature"
        )
 @end example
+
+
+@item @code{timing}@indexcode{timing} @propertytype{boolean}
+  Keep administration of measure length, position, bar number, etc?
+Switch off for cadenzas.
+
+@item @code{currentBarNumber}@indexcode{currentBarNumber} @propertytype{integer}
+  Contains the current barnumber. This property is incremented at
+every barline.
+
+@item @code{measurePosition}@indexcode{measurePosition} @propertytype{Moment}
+
+  How much of the current measure (measured in whole notes) have we had?
+
+@item @code{oneBeat}@indexcode{oneBeat} @propertytype{Moment}
+
+  How long does one beat in the current time signature last?
+
+@item @code{measureLength}@indexcode{measureLength} @propertytype{Moment}
+
+  How long does one measure in the current time signature last?
+
 @end table
 
 @subsubheading ChordNamesVoice properties
diff --git a/input/bugs/volta.ly b/input/bugs/volta.ly
new file mode 100644 (file)
index 0000000..48889cf
--- /dev/null
@@ -0,0 +1,42 @@
+
+voice4 = \notes {
+\clef bass;
+ \property Staff.instrument = "Bass"
+ \property Staff.instr = "B"
+ \time 4/4;  f,2 (   ) f,8    r8   f8    e8    
+\repeat  volta 2
+{
+ d8.    d16    e8.    f16    f8    c8    c16    c8. 
+}
+\alternative
+{
+    {   f,2 (   ) f,8    r8   f8    e8 ( \break   }
+    {   ) f,2.    r8   c16    c16      |
+    }
+}
+}
+voicedefault = \notes {
+ \property Staff.timeSignatureStyle="C"
+ \time 4/4; \key f; 
+ \tempo 4 = 200;
+}
+\score{
+        \notes <
+
+
+        \context Staff="4"
+        {
+            \$voicedefault
+            \$voice4 
+        }
+
+    >
+        \paper {
+            font_normal = 12.;
+            \translator {
+                 \StaffContext 
+                 \consists Instrument_name_engraver;
+            }
+        }
+}
+
index 09ef7e35d889997c195fbf2f324641ef08b9b2fb..4ea9a9beae08dd5ef21ea6066cec3b9ff33d9795 100644 (file)
@@ -135,8 +135,8 @@ fugaIILeft = \notes {
     \context Voice = two { \stemdown s2 e4 |
       fis2 fis4 }
   >
-  \stemdown cis2 e4 |
-  b4. b8 b4 |
+  \stemboth cis2 [e16( fis a \clef "treble"; b] |
+  d'4 ) b8 b8 b4 |
   %19
 }
 
@@ -152,8 +152,6 @@ fugaIIPedal = \notes \relative c {
   %19
 }
 
-
-
 % these should be two separate scores...
 \score{
   \context Score  \notes <
@@ -166,14 +164,18 @@ fugaIIPedal = \notes \relative c {
 
 
        \property Score.midiInstrument = "church organ"
-        \praeludiumRight r1 \fugaIIRight }
-      \context Staff = bass { 
+        \praeludiumRight 
+        r1 \mark "B";
+          \fugaIIRight }
+      \context Staff = bass {
+       \property Staff.instrument = #"left"
+       \property Staff.instr = #"lt"
         \praeludiumLeft r1 \fugaIILeft }
     > 
     \context Staff = pedal \relative c  <
       {
-       \property Staff.instrument = #"left"
-       \property Staff.instr = #"lt"
+        \property Staff.instrument = #"bass"
+        \property Staff.instr = #"bs"  
 
         \time 4/4;
        \key e; 
@@ -197,7 +199,9 @@ fugaIIPedal = \notes \relative c {
 
   \paper {
 
-   \translator { \OrchestralScoreContext }
+       \translator {
+               \OrchestralScoreContext
+       }
        \translator { \PianoStaffContext
                \consists "Instrument_name_engraver";
        }
index 53d4cf47660164f21b5be150c2f14b35d75345b6..3aa50afbf22914da8eea7a5a42536f7d174f2eb6 100644 (file)
@@ -6,18 +6,34 @@
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "bar-number-engraver.hh"
-#include "engraver-group-engraver.hh"
+
+#include "lily-guile.hh"
+#include "paper-column.hh"
+#include "paper-def.hh"
+#include "side-position-interface.hh"
+#include "staff-symbol.hh"
 #include "text-item.hh"
 #include "moment.hh"
+#include "engraver.hh"
+#include "protected-scm.hh"
 
-Bar_number_engraver::Bar_number_engraver()
+class Bar_number_engraver : public Engraver
 {
-  axis_ = Y_AXIS;
-  type_ = "barNumber";
-}
-
+protected:
+  Text_item* text_p_;
+  Protected_scm visibility_lambda_;
+  Protected_scm staffs_;
 
+protected:
+  virtual void do_creation_processing ();
+  virtual void do_pre_move_processing ();
+  virtual void acknowledge_element (Score_element_info);
+  void create_items();
+  void do_process_music ();
+public:
+  VIRTUAL_COPY_CONS(Translator);
+  Bar_number_engraver();
+};
 
 void
 Bar_number_engraver::do_process_music ()
@@ -30,13 +46,99 @@ Bar_number_engraver::do_process_music ()
   if (gh_number_p (bn) &&
       !mp && now_mom () > Moment (0))
     {
-      create_items (0);
+      create_items ();
 
       // guh.
       text_p_->set_elt_property ("text",
                                 ly_str02scm (to_str (gh_scm2int (bn)).ch_C()));
-                                
     }
 }
 
 ADD_THIS_TRANSLATOR(Bar_number_engraver);
+
+Bar_number_engraver::Bar_number_engraver ()
+{
+  text_p_ =0;
+  staffs_ = SCM_EOL;
+}
+
+void
+Bar_number_engraver::do_creation_processing ()
+{
+  String t = "barNumberVisibilityFunction";
+  SCM proc = get_property (t);
+
+  if (gh_procedure_p (proc))
+    visibility_lambda_ = proc;
+}
+
+
+                                              
+void
+Bar_number_engraver::acknowledge_element (Score_element_info inf)
+{
+  Score_element * s = inf.elem_l_;
+  if (dynamic_cast<Staff_symbol*> (s))
+    {
+      staffs_ = gh_cons (inf.elem_l_->self_scm_, staffs_);
+    }
+  else if (text_p_
+          && dynamic_cast<Item*> (s)
+          && s->get_elt_property ("break-align-symbol") == ly_symbol2scm ("Left_edge_item"))
+    {
+      /*
+       By default this would land on the Paper_column -- so why
+       doesn't it work when you leave this out?  */
+      text_p_->set_parent (s, X_AXIS);
+    }
+}
+
+void 
+Bar_number_engraver::do_pre_move_processing ()
+{
+  if (text_p_)
+    {
+      text_p_->set_elt_property ("side-support", staffs_);
+      typeset_element (text_p_);
+      text_p_ =0;
+    }
+}
+
+
+void
+Bar_number_engraver::create_items ()
+{
+  if (text_p_)
+    return;
+  
+  text_p_ = new Text_item;
+  text_p_->set_elt_property ("breakable", SCM_BOOL_T); // ugh
+  Side_position_interface staffside(text_p_);
+  staffside.set_axis (Y_AXIS);
+
+  SCM prop = get_property ("barNumberDirection");
+  if (!isdir_b (prop))
+    {
+      prop = gh_int2scm (UP);
+    }
+  text_p_->set_elt_property ("direction", prop);
+
+  SCM padding = get_property ("barNumberScriptPadding");
+  if (gh_number_p(padding))
+    {
+      text_p_->set_elt_property ("padding", padding);
+    }
+  else
+    {
+      text_p_
+       ->set_elt_property ("padding",
+                           gh_double2scm(paper_l ()->get_var ("interline")));
+    }
+
+  if (gh_procedure_p (visibility_lambda_))
+      text_p_->set_elt_property ("visibility-lambda",
+                                visibility_lambda_);
+
+  announce_element (Score_element_info (text_p_, 0));
+}
+
index 1158daec6e39ffbabfbd866886958c650950c67a..0c2b543d465c02acc38006f2e221b4e11bf55466 100644 (file)
@@ -6,19 +6,41 @@
  (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
+
+#include "bar.hh"
+#include "clef-item.hh"
 #include "command-request.hh"
-#include "bar-script-engraver.hh"
+#include "dimension-cache.hh"
 #include "engraver-group-engraver.hh"
+#include "engraver.hh"
+#include "lily-guile.hh"
+#include "paper-column.hh"
+#include "paper-def.hh"
+#include "protected-scm.hh"
+#include "side-position-interface.hh"
+#include "staff-symbol-referencer.hh"
+#include "staff-symbol.hh"
 #include "text-item.hh"
 
-/**Print rehearsal marks.
-  */
-class Mark_engraver : public Bar_script_engraver 
+/**
+  put stuff over or next to  bars.  Examples: bar numbers, marginal notes,
+  rehearsal marks.
+ */
+class Mark_engraver : public Engraver
 {
 public:
-  Mark_engraver ();
   VIRTUAL_COPY_CONS(Translator);
+  Mark_engraver ();
 protected:
+  Text_item* text_p_;
+  Protected_scm visibility_lambda_;
+  Protected_scm staffs_;
+  
+protected:
+  virtual void do_creation_processing ();
+  virtual void do_pre_move_processing ();
+  virtual void acknowledge_element (Score_element_info);
+  void create_items(Request*);
   virtual bool do_try_music (Music *req_l);
   virtual void do_process_music ();
   virtual void do_post_move_processing ();
@@ -29,13 +51,94 @@ private:
 
 ADD_THIS_TRANSLATOR (Mark_engraver);
 
+
 Mark_engraver::Mark_engraver ()
 {
+  text_p_ =0;
   mark_req_l_ = 0;
-  axis_ = Y_AXIS;
-  type_ = "mark";
+  staffs_ = SCM_EOL;
+}
+
+void
+Mark_engraver::do_creation_processing ()
+{
+  String t = "markVisibilityFunction";
+  SCM proc = get_property (t);
+
+  if (gh_procedure_p (proc))
+    visibility_lambda_ = proc;
+}
+
+
+
+void
+Mark_engraver::acknowledge_element (Score_element_info inf)
+{
+  Score_element * s = inf.elem_l_;
+  if (dynamic_cast<Staff_symbol*> (s))
+    {
+      staffs_ = gh_cons (inf.elem_l_->self_scm_, staffs_);
+    }
+  else if (text_p_ && dynamic_cast<Bar*> (s))
+    {
+      /*
+       Ugh. Figure out how to do this right at beginning of line, (without
+       creating class Bar_script : public Text_item).
+      */
+      text_p_->set_parent (s, X_AXIS);
+    }
 }
 
+void 
+Mark_engraver::do_pre_move_processing ()
+{
+  if (text_p_)
+    {
+      text_p_->set_elt_property ("side-support" , staffs_);
+      typeset_element (text_p_);
+      text_p_ =0;
+    }
+}
+
+
+void
+Mark_engraver::create_items (Request *rq)
+{
+  if (text_p_)
+    return;
+  
+  text_p_ = new Text_item;
+  text_p_->set_elt_property ("breakable", SCM_BOOL_T); // ugh
+  Side_position_interface staffside(text_p_);
+  staffside.set_axis (Y_AXIS);
+
+  SCM prop = get_property ("markDirection");
+  if (!isdir_b (prop))
+    {
+      prop = gh_int2scm (UP);
+    }
+  text_p_->set_elt_property ("direction", prop);
+
+  SCM padding = get_property ("markScriptPadding");
+  if (gh_number_p(padding))
+    {
+      text_p_->set_elt_property ("padding", padding);
+    }
+  else
+    {
+      text_p_
+       ->set_elt_property ("padding",
+                           gh_double2scm(paper_l ()->get_var ("interline")));
+    }
+
+  if (gh_procedure_p (visibility_lambda_))
+      text_p_->set_elt_property ("visibility-lambda",
+                                visibility_lambda_);
+  
+  announce_element (Score_element_info (text_p_, rq));
+}
+
+
 void
 Mark_engraver::do_post_move_processing ()
 {
@@ -67,6 +170,9 @@ Mark_engraver::do_process_music ()
 
       String t;
 
+      /*
+       automatic marks.
+       */
       SCM m = (mark_req_l_->mark_label_ == SCM_UNDEFINED)
        ? get_property ("rehearsalMark")
        : SCM(mark_req_l_->mark_label_);
index f93dd1856fe12c73b95a04f049cf7973c830dea1..c11f2e8909ab363f96c40b3aacde3e13d6d28142 100644 (file)
@@ -71,7 +71,7 @@ Side_position_interface::side_position (Dimension_cache const * c)
   SCM support = me->get_elt_property ("side-support");
   for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
     {
-      Score_element * e  = unsmob_element ( gh_car (s));
+      Score_element * e  = unsmob_element (gh_car (s));
       if (e)
        common = common->common_refpoint (e, axis);
     }
index b9467fb08144dab54c17aed5d3d83d6b80051e2f..f3cc65b459df303fa4a2dbab1971cef3dfd3cb13 100644 (file)
@@ -32,7 +32,12 @@ Volta_spanner::Volta_spanner ()
 
 /*
   this is too complicated. Yet another version of side-positioning,
-  badly implemented.  */
+  badly implemented.
+
+  --
+
+  Should look for system_start_delim to find left edge of staff.
+*/
 Molecule 
 Volta_spanner::do_brew_molecule () const
 {
index e32f472d022f98dd87178ba9525a1428b300b73b..72a0a5678e3ac725daeb42fefb1bf9c77bfdce27 100644 (file)
@@ -242,7 +242,7 @@ StaffGroupContext= \translator {
        systemStartDelimiterGlyph = #'bracket
        
 
-       \consistsend "Axis_group_engraver" ;
+
 
 
        \name StaffGroup;
@@ -372,6 +372,7 @@ ScoreContext = \translator {
          Time_signature
        )
        \consists "Spacing_engraver";
+
        \consists "Vertical_align_engraver";
        alignmentReference = \down;
        defaultClef = #"treble"