diff options
author | Jan Nieuwenhuizen <janneke@gnu.org> | 2000-06-21 16:36:07 +0200 |
---|---|---|
committer | Jan Nieuwenhuizen <janneke@gnu.org> | 2000-06-21 16:36:07 +0200 |
commit | 4ef78bcae9cb502769f3ff7051b92381b9093e9f (patch) | |
tree | a26a53c7811320794371a209ee97b6de87fd9664 /lily | |
parent | 8d076867eab814f81d9d238d9a5ea5c509884339 (diff) |
partial: 1.3.62.jcn
======
* Made callbacks from Score_element::before_line_breaking() and
Score_element::after_line_breaking()
* Fixed website; backlinks should work again.
* Removed --ignore-version option. Added --verbose option.
1.3
Diffstat (limited to 'lily')
-rw-r--r-- | lily/hara-kiri-group-spanner.cc | 80 | ||||
-rw-r--r-- | lily/hara-kiri-vertical-group-spanner.cc | 78 | ||||
-rw-r--r-- | lily/include/hara-kiri-group-spanner.hh | 41 | ||||
-rw-r--r-- | lily/include/hara-kiri-vertical-group-spanner.hh | 39 |
4 files changed, 122 insertions, 116 deletions
diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc new file mode 100644 index 0000000000..0094a018ed --- /dev/null +++ b/lily/hara-kiri-group-spanner.cc @@ -0,0 +1,80 @@ +/* + hara-kiri-vertical-group-spanner.cc -- implement Hara_kiri_group_spanner + + source file of the GNU LilyPond music typesetter + + (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org> + Han-Wen Nienhuys <hanwen@cs.uu.nl> +*/ + +#include "axis-group-interface.hh" +#include "hara-kiri-group-spanner.hh" +#include "debug.hh" +#include "item.hh" + +/* + */ +Hara_kiri_group_spanner::Hara_kiri_group_spanner(SCM s) + : Spanner (s) +{ + set_elt_pointer ("items-worth-living", SCM_EOL); +} + +void +Hara_kiri_group_spanner::add_interesting_item (Item* n) +{ + add_dependency (n); + Pointer_group_interface (this, "items-worth-living").add_element (n); + +} + +GLUE_SCORE_ELEMENT(Hara_kiri_group_spanner,after_line_breaking); +SCM +Hara_kiri_group_spanner::member_after_line_breaking () +{ + SCM worth = get_elt_pointer ("items-worth-living"); + /* + worth == self_scm is a stupid way to signal that we're done. + */ + if (gh_pair_p (worth)) + return SCM_UNDEFINED; + + Link_array<Score_element> childs = Axis_group_interface (this).get_children (); + for (int i = 0; i < childs.size (); i++) + { + Score_element* s = childs[i]; + + if ( line_l () != s->line_l ()) + programming_error ("Killing other children too"); + s->suicide (); + } + + /* + very appropriate name here :-) + */ + suicide (); + return SCM_UNDEFINED; +} + + + +/* + We can't rely on offsets and dimensions of elements in a hara-kiri + group. Use a callback to make sure that hara-kiri has been done + before asking for offsets. */ +Real +Hara_kiri_group_spanner::force_hara_kiri_callback (Score_element const *elt, Axis a) +{ + while (elt && !dynamic_cast<Hara_kiri_group_spanner const*> (elt)) + elt = elt->parent_l(a); + + if (elt) + { + Hara_kiri_group_spanner const * seppuku = dynamic_cast<Hara_kiri_group_spanner const*> (elt); + + ((Hara_kiri_group_spanner*)seppuku)->member_after_line_breaking (); + } + + + return 0.0; +} diff --git a/lily/hara-kiri-vertical-group-spanner.cc b/lily/hara-kiri-vertical-group-spanner.cc index 21746accfd..e69de29bb2 100644 --- a/lily/hara-kiri-vertical-group-spanner.cc +++ b/lily/hara-kiri-vertical-group-spanner.cc @@ -1,78 +0,0 @@ -/* - hara-kiri-vertical-group-spanner.cc - -- implement Hara_kiri_vertical_group_spanner - - source file of the GNU LilyPond music typesetter - - (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org> - Han-Wen Nienhuys <hanwen@cs.uu.nl> -*/ - -#include "axis-group-interface.hh" -#include "hara-kiri-vertical-group-spanner.hh" -#include "debug.hh" -#include "item.hh" - -/* - */ -Hara_kiri_group_spanner::Hara_kiri_group_spanner(SCM s) - : Spanner (s) -{ - set_elt_pointer ("items-worth-living", SCM_EOL); -} - -void -Hara_kiri_group_spanner::add_interesting_item (Item* n) -{ - add_dependency (n); - Pointer_group_interface (this, "items-worth-living").add_element (n); - -} - -void -Hara_kiri_group_spanner::after_line_breaking () -{ - SCM worth = get_elt_pointer ("items-worth-living"); - /* - worth == self_scm is a stupid way to signal that we're done. - */ - if (gh_pair_p (worth)) - return; - - Link_array<Score_element> childs = Axis_group_interface (this).get_children (); - for (int i = 0; i < childs.size (); i++) - { - Score_element* s = childs[i]; - - if ( line_l () != s->line_l ()) - programming_error ("Killing other children too"); - s->suicide (); - } - - /* - very appropriate name here :-) - */ - suicide (); -} - - - -/* - We can't rely on offsets and dimensions of elements in a hara-kiri - group. Use a callback to make sure that hara-kiri has been done - before asking for offsets. */ -Real -Hara_kiri_group_spanner::force_hara_kiri_callback (Score_element const *elt, Axis a) -{ - while (elt && !dynamic_cast<Hara_kiri_group_spanner const*> (elt)) - elt = elt->parent_l(a); - - if (elt) - { - Hara_kiri_group_spanner const * seppuku = dynamic_cast<Hara_kiri_group_spanner const*> (elt); - - ((Hara_kiri_group_spanner*)seppuku)->after_line_breaking (); - } - - return 0.0; -} diff --git a/lily/include/hara-kiri-group-spanner.hh b/lily/include/hara-kiri-group-spanner.hh new file mode 100644 index 0000000000..476a18a915 --- /dev/null +++ b/lily/include/hara-kiri-group-spanner.hh @@ -0,0 +1,41 @@ +/* + hara-kiri-vertical-group-spanner.hh -- declare Har_kiri_vertical_group_spanner + + source file of the GNU LilyPond music typesetter + + (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org> +*/ + + +#ifndef HARA_KIRI_VERTICAL_GROUP_SPANNER_HH +#define HARA_KIRI_VERTICAL_GROUP_SPANNER_HH + +#include "spanner.hh" + +/** + As Vertical_group_spanner, but keep track of interesting items. If + we don't contain any interesting items after linebreaking, then + gracefully commit suicide. Objective: don't disgrace Lily by + typesetting empty lines in orchestral scores. + + properties: + + items-worth-living -- list of interesting items. If empty in a particular system, + clear this line + +*/ +class Hara_kiri_group_spanner : public Spanner +{ +public: + static Real force_hara_kiri_callback (Score_element const* , Axis); + Hara_kiri_group_spanner (SCM); + SCM member_after_line_breaking (); + static SCM after_line_breaking (SCM); + + void add_interesting_item (Item* n); + + VIRTUAL_COPY_CONS(Score_element); +}; + + +#endif // HARA_KIRI_VERTICAL_GROUP_SPANNER_HH diff --git a/lily/include/hara-kiri-vertical-group-spanner.hh b/lily/include/hara-kiri-vertical-group-spanner.hh index abda869a39..65296f8106 100644 --- a/lily/include/hara-kiri-vertical-group-spanner.hh +++ b/lily/include/hara-kiri-vertical-group-spanner.hh @@ -1,39 +1,2 @@ -/* - hara-kiri-vertical-group-spanner.hh -- declare Har_kiri_vertical_group_spanner - source file of the GNU LilyPond music typesetter - - (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org> -*/ - - -#ifndef HARA_KIRI_VERTICAL_GROUP_SPANNER_HH -#define HARA_KIRI_VERTICAL_GROUP_SPANNER_HH - -#include "spanner.hh" - -/** - As Vertical_group_spanner, but keep track of interesting items. If - we don't contain any interesting items after linebreaking, then - gracefully commit suicide. Objective: don't disgrace Lily by - typesetting empty lines in orchestral scores. - - properties: - - items-worth-living -- list of interesting items. If empty in a particular system, - clear this line - -*/ -class Hara_kiri_group_spanner : public Spanner -{ -public: - static Real force_hara_kiri_callback (Score_element const* , Axis); - Hara_kiri_group_spanner (SCM); - virtual void after_line_breaking (); - void add_interesting_item (Item* n); -protected: - VIRTUAL_COPY_CONS(Score_element); -}; - - -#endif // HARA_KIRI_VERTICAL_GROUP_SPANNER_HH +#error |