]> git.donarmstrong.com Git - lilypond.git/blob - lily/mark-engraver.cc
patch::: 1.1.17.mb1: Re: LilyPond Xmas release
[lilypond.git] / lily / mark-engraver.cc
1 /*
2   mark-engraver.cc -- implement Mark_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6  (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #include "mark-engraver.hh"
10 #include "text-def.hh"
11 #include "script.hh"
12 #include "paper-def.hh"
13 #include "command-request.hh"
14 #include "time-description.hh"
15 #include "engraver-group.hh"
16
17
18 ADD_THIS_TRANSLATOR (Mark_engraver);
19
20 Mark_engraver::Mark_engraver ()
21 {
22   mark_req_l_ = 0;
23   script_p_ = 0;
24 }
25
26 bool
27 Mark_engraver::do_try_music (Music* r_l)
28 {
29   if (Mark_req *mr = dynamic_cast <Mark_req *> (r_l))
30     {
31       mark_req_l_ = mr;
32       return true;
33     }
34   return false;
35 }
36
37 void
38 Mark_engraver::do_process_requests ()
39 {  
40   if (!mark_req_l_ || script_p_)
41     return;
42
43   script_p_ = new Script;
44   //  script_p_->breakable_b_ = true;
45
46   Text_def *td_p = new Text_def;
47
48   td_p->text_str_ = mark_req_l_->str_;
49   td_p->align_dir_ = CENTER;
50
51   td_p->style_str_ = td_p->text_str_.index_any_i ("0123456789") >= 0 
52     ? "mark" : "Large";
53
54   script_p_->dir_ = UP;
55   script_p_->specs_p_ = td_p->clone ();
56   // script_p_->postbreak_only_b_ = false;
57   
58   Scalar padding = get_property ("markScriptPadding");
59   if (padding.length_i() && padding.isnum_b ())
60     {
61       script_p_->padding_f_ = Real(padding);
62     }
63   Scalar break_priority = get_property ("markBreakPriority");
64   if (break_priority.length_i() && break_priority.isnum_b ())
65     {
66       script_p_->break_priority_i_ = int(break_priority);
67     }
68
69   
70   announce_element (Score_element_info (script_p_, mark_req_l_));
71 }
72
73 void 
74 Mark_engraver::do_pre_move_processing ()
75 {
76   if (script_p_) 
77     {
78       typeset_element (script_p_);
79       script_p_ = 0;
80       mark_req_l_ = 0;
81     }
82 }
83