From 4ef78bcae9cb502769f3ff7051b92381b9093e9f Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 21 Jun 2000 16:36:07 +0200 Subject: [PATCH] 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 --- lily/hara-kiri-group-spanner.cc | 80 +++++++++++++++++++ lily/hara-kiri-vertical-group-spanner.cc | 78 ------------------ lily/include/hara-kiri-group-spanner.hh | 41 ++++++++++ .../hara-kiri-vertical-group-spanner.hh | 39 +-------- 4 files changed, 122 insertions(+), 116 deletions(-) create mode 100644 lily/hara-kiri-group-spanner.cc create mode 100644 lily/include/hara-kiri-group-spanner.hh 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 + Han-Wen Nienhuys +*/ + +#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 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 (elt)) + elt = elt->parent_l(a); + + if (elt) + { + Hara_kiri_group_spanner const * seppuku = dynamic_cast (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 - Han-Wen Nienhuys -*/ - -#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 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 (elt)) - elt = elt->parent_l(a); - - if (elt) - { - Hara_kiri_group_spanner const * seppuku = dynamic_cast (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 +*/ + + +#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 -*/ - - -#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 -- 2.39.2