[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: EXPERIMENTAL: put a reminder of the mm rest on the last page at the
From: |
hanwenn |
Subject: |
Re: EXPERIMENTAL: put a reminder of the mm rest on the last page at the top. (issue 553400043 by address@hidden) |
Date: |
Fri, 24 Jan 2020 11:29:56 -0800 |
Reviewers: Dan Eble,
Message:
I'm not asking for anyone to review. It's context to the other change
about multi-measure-rests.
It's also a demonstration of why I want to get away from rietveld,
because it doesn't handle dependent changes.
Description:
EXPERIMENTAL: put a reminder of the mm rest on the last page at the top.
Introduces grob MultiMeasureRestReminder, controlled by
createMultiMeasureRestReminders.
TODO:
* regtest
* a nicer layout of the reminder (use a mmrest-like symbol?)
* more structured positioning and extent routines for the grob.
(the grob should be ignored for pure computations.)
Set page breaking properties in the System grob
* Record system rank within page in rank-on-page property
* Record page number in page-number property
lily/page-breaking: pass vector by reference
lily: fix some type conversion warnings
Document why System::rank_type is int16
Documentation: fix typo in German spacing.itely file
Documentation: fix typos in tool naming
Please review this at https://codereview.appspot.com/553400043/
Affected files (+71, -18 lines):
M Documentation/contributor/administration.itexi
M Documentation/contributor/introduction.itexi
M Documentation/de/notation/spacing.itely
M lily/break-substitution.cc
M lily/include/page-breaking.hh
M lily/include/system.hh
M lily/lookup.cc
M lily/multi-measure-rest-engraver.cc
M lily/page-breaking.cc
M lily/page-spacing-result.cc
M lily/pointer-group-interface.cc
M lily/quote-iterator.cc
M lily/stem.cc
M scm/define-context-properties.scm
M scm/define-grob-properties.scm
M scm/define-grobs.scm
Index: Documentation/contributor/administration.itexi
diff --git a/Documentation/contributor/administration.itexi
b/Documentation/contributor/administration.itexi
index
9af951ee8e6602429b58974a2f7ad33f4fb51194..2ac03ee2d5f4b5ccc7feaf028559a3e2356b1ddf
100644
--- a/Documentation/contributor/administration.itexi
+++ b/Documentation/contributor/administration.itexi
@@ -788,9 +788,9 @@ savannah bug tracker?
(prep: 1 hour. discuss: 5 hours)
@item @strong{Patch review tool}:
-Reitveld is inconvenient in some respects: it requires a google
+Rietveld is inconvenient in some respects: it requires a google
account, and there's no way to see all patches relating to
-lilypond. Should we switch to something like gerritt?
+lilypond. Should we switch to something like gerrit?
@uref{https://sourceforge.net/p/testlilyissues/issues/1184/}
(prep: 5 hours. discuss: 15 hours)
Index: Documentation/contributor/introduction.itexi
diff --git a/Documentation/contributor/introduction.itexi
b/Documentation/contributor/introduction.itexi
index
ed6f2cf8291899218ed4c55d2023982dd091e306..9306da6c6512d862d0b28438c04e7f3aef9a6339
100644
--- a/Documentation/contributor/introduction.itexi
+++ b/Documentation/contributor/introduction.itexi
@@ -117,7 +117,7 @@ currently hosted by Sourceforge.
@end example
@item @strong{patch review}:
-Reitveld -- the collaborative code review tool.
+Rietveld -- the collaborative code review tool.
@example
@uref{https://codereview.appspot.com}
Index: Documentation/de/notation/spacing.itely
diff --git a/Documentation/de/notation/spacing.itely
b/Documentation/de/notation/spacing.itely
index
c4c8aea68f041d78fdad7fb9f0bd3f84c0b134f8..375135872c3e971d705d940bd14c7570bf00fdf4
100644
--- a/Documentation/de/notation/spacing.itely
+++ b/Documentation/de/notation/spacing.itely
@@ -184,7 +184,7 @@ welcher immer auf oberster Ebene der Datei geschrieben
werden muss, und
@example
\paper @{
- #(set-paper-size "tabliod")
+ #(set-paper-size "tabloid")
@}
@end example
Index: lily/break-substitution.cc
diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc
index
901f6b0ceb188bcf470b8333ec825d0761aaf3a6..8f30d3ff4776709d10e7261974c73a698afefd68
100644
--- a/lily/break-substitution.cc
+++ b/lily/break-substitution.cc
@@ -113,11 +113,11 @@ again:
}
else if (scm_is_vector (src))
{
- int len = scm_c_vector_length (src);
+ size_t len = scm_c_vector_length (src);
SCM nv = scm_c_make_vector (len, SCM_UNDEFINED);
- for (int i = 0; i < len; i++)
+ for (size_t i = 0; i < len; i++)
{
- SCM si = scm_from_int (i);
+ SCM si = scm_from_int ((int)i);
scm_vector_set_x (nv, si,
do_break_substitution (scm_vector_ref (src, si)));
}
@@ -254,6 +254,10 @@ struct Substitution_entry
{
Grob *grob_;
+ /* The all-elements array inside the System is large. To save
+ memory, we assume there will not be more than 32k systems, and use
+ int16 for the indices, to save some space.
+ */
System::rank_type left_;
System::rank_type right_;
@@ -303,7 +307,7 @@ bool
Spanner::fast_substitute_grob_array (SCM sym,
Grob_array *grob_array)
{
- int len = grob_array->size ();
+ vsize len = grob_array->size ();
if (grob_array->ordered ())
return false;
Index: lily/include/page-breaking.hh
diff --git a/lily/include/page-breaking.hh b/lily/include/page-breaking.hh
index
51e776194fbe73a6b06d96212d7e2a8c75efa87f..dca91aae1af9cacd7c7b916eb824f9dccd706ab0
100644
--- a/lily/include/page-breaking.hh
+++ b/lily/include/page-breaking.hh
@@ -142,7 +142,7 @@ protected:
vsize next_system (Break_position const &break_pos) const;
- SCM make_pages (vector<vsize> lines_per_page, SCM lines);
+ SCM make_pages (const vector<vsize> &lines_per_page, SCM lines);
vsize min_system_count (vsize start, vsize end);
vsize max_system_count (vsize start, vsize end);
Index: lily/include/system.hh
diff --git a/lily/include/system.hh b/lily/include/system.hh
index
29128c3519d0c860044e0836160fc60f79e2d42d..d1f1d7d12f170ba3c74d4e2076767b00ae38c463
100644
--- a/lily/include/system.hh
+++ b/lily/include/system.hh
@@ -36,6 +36,7 @@
class System : public Spanner
{
public:
+ // See Substitution_entry.
typedef int16_t rank_type;
private:
Index: lily/lookup.cc
diff --git a/lily/lookup.cc b/lily/lookup.cc
index
c7b8cafcc39dcda4204804e03201755dcce20768..117fe96d609b1f283dc11cbb8b4605aba8035d0e
100644
--- a/lily/lookup.cc
+++ b/lily/lookup.cc
@@ -311,7 +311,7 @@ Lookup::round_filled_polygon (vector<Offset> const &points,
for (vsize i = 0; i < points.size (); i++)
{
- int i0 = i;
+ int i0 = (int) i;
int i1 = (i + 1) % points.size ();
int i2 = (i + 2) % points.size ();
Offset p0 = points[i0];
Index: lily/multi-measure-rest-engraver.cc
diff --git a/lily/multi-measure-rest-engraver.cc
b/lily/multi-measure-rest-engraver.cc
index
0e8d694cd5a342a5156b350f2cd8a4fc4ea987df..9c07409ed98d661b6180f37e3303dd9ca0603dcd
100644
--- a/lily/multi-measure-rest-engraver.cc
+++ b/lily/multi-measure-rest-engraver.cc
@@ -142,7 +142,7 @@ Multi_measure_rest_engraver::initialize_grobs ()
Spanner *sp = make_spanner ("MultiMeasureRestScript", e->self_scm
());
make_script_from_event (sp, context (),
e->get_property ("articulation-type"),
- i);
+ int(i));
SCM dir = e->get_property ("direction");
if (is_direction (dir))
sp->set_property ("direction", dir);
@@ -239,10 +239,16 @@ Multi_measure_rest_engraver::process_music ()
if (grobs_initialized ())
{
int curr_measure = scm_to_int (get_property ("internalBarNumber"));
- set_measure_count (curr_measure - start_measure_);
+ int count = curr_measure - start_measure_;
+ set_measure_count (count);
if (last_command_item_)
add_bound_item_to_grobs (last_command_item_);
reset_grobs ();
+
+ if (scm_to_bool (get_property("createMultiMeasureRestReminders"))) {
+ Item *reminder = make_item ("MultiMeasureRestReminder", SCM_EOL);
+ reminder->set_property ("measure-count", scm_from_int (count));
+ }
}
}
@@ -291,6 +297,7 @@ ADD_TRANSLATOR (Multi_measure_rest_engraver,
"MultiMeasureRest "
"MultiMeasureRestNumber "
"MultiMeasureRestText "
+ "MultiMeasureRestReminder "
"MultiMeasureRestScript ",
/* read */
@@ -298,6 +305,7 @@ ADD_TRANSLATOR (Multi_measure_rest_engraver,
"restNumberThreshold "
"currentCommandColumn "
"measurePosition "
+ "createMultiMeasureRestReminders ",
"whichBar ",
/* write */
Index: lily/page-breaking.cc
diff --git a/lily/page-breaking.cc b/lily/page-breaking.cc
index
2378f173630ce5380463f52565caf6dbe548f9ab..c2610945008524c99730a3ced380fac4bcea5a7d
100644
--- a/lily/page-breaking.cc
+++ b/lily/page-breaking.cc
@@ -584,9 +584,8 @@ Page_breaking::draw_page (SCM systems, SCM configuration,
int page_num, bool las
return page;
}
-// TODO: pass lines_per_page by const reference
SCM
-Page_breaking::make_pages (vector<vsize> lines_per_page, SCM systems)
+Page_breaking::make_pages (const vector<vsize> &lines_per_page, SCM systems)
{
if (scm_is_null (systems))
return SCM_EOL;
@@ -619,6 +618,18 @@ Page_breaking::make_pages (vector<vsize> lines_per_page,
SCM systems)
bool rag = ragged () || (bookpart_last_page && ragged_last ());
SCM line_count = scm_from_size_t (lines_per_page[i]);
SCM lines = scm_list_head (systems, line_count);
+
+ int rank_on_page = 0;
+ for (SCM l = lines; scm_is_pair (l); l = scm_cdr (l))
+ {
+ System *sys = unsmob<System> (scm_car (l));
+ if (sys) {
+ sys->set_property ("rank-on-page", scm_from_int (rank_on_page));
+ sys->set_property ("page-number", scm_from_int (page_num));
+ rank_on_page++;
+ }
+ }
+
vsize fn_lines = Page_layout_problem::get_footnote_count (lines);
Page_layout_problem::add_footnotes_to_lines (lines,
reset_footnotes_on_new_page ? 0 : footnote_count, book_);
Index: lily/page-spacing-result.cc
diff --git a/lily/page-spacing-result.cc b/lily/page-spacing-result.cc
index
106c7e882295df3f1e99f0fc7971f888acf65d15..bfb25286912ac8229cba54977d89904d53063dcd
100644
--- a/lily/page-spacing-result.cc
+++ b/lily/page-spacing-result.cc
@@ -41,7 +41,7 @@ Page_spacing_result::average_force () const
for (vsize i = 0; i < page_count (); i++)
average_force += force_[i];
- average_force /= page_count ();
+ average_force /= Real (page_count ());
return average_force;
}
Index: lily/pointer-group-interface.cc
diff --git a/lily/pointer-group-interface.cc b/lily/pointer-group-interface.cc
index
266fa25ceb7f888d301e1c615aebb3358f59cdbb..68c0b61872e2949b2d0e9f1f45818ff5f577ff1f
100644
--- a/lily/pointer-group-interface.cc
+++ b/lily/pointer-group-interface.cc
@@ -27,7 +27,7 @@ int
Pointer_group_interface::count (Grob *me, SCM sym)
{
Grob_array *arr = unsmob<Grob_array> (me->internal_get_object (sym));
- return arr ? arr->size () : 0;
+ return arr ? int (arr->size ()) : 0;
}
void
Index: lily/quote-iterator.cc
diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc
index
2056cce77074a5acaf675d657279eba862cc3060..2e4481ea8475ab8098da3b2536667aabfdc7c4aa
100644
--- a/lily/quote-iterator.cc
+++ b/lily/quote-iterator.cc
@@ -101,7 +101,7 @@ int
binsearch_scm_vector (SCM vec, SCM key, bool (*is_less) (SCM a, SCM b))
{
int lo = 0;
- int hi = scm_c_vector_length (vec);
+ int hi = int (scm_c_vector_length (vec));
/* binary search */
do
Index: lily/stem.cc
diff --git a/lily/stem.cc b/lily/stem.cc
index
2a0f6fef8426ec8896bd1cb7a863fd8110771d9e..2a4e9055218ad5e356660a2d3aea991e03094884
100644
--- a/lily/stem.cc
+++ b/lily/stem.cc
@@ -91,7 +91,7 @@ Stem::get_beaming (Grob *me, Direction d)
SCM lst = index_get_cell (pair, d);
- int len = scm_ilength (lst); // -1 for dotted lists!
+ int len = int (scm_ilength (lst)); // -1 for dotted lists!
return max (len, 0);
}
Index: scm/define-context-properties.scm
diff --git a/scm/define-context-properties.scm
b/scm/define-context-properties.scm
index
2d0368a9c476aa0bb0fd96f9365664225d3dc529..b2b56f9c3f203af3189a59fa22e7e21dc2f6b6b1
100644
--- a/scm/define-context-properties.scm
+++ b/scm/define-context-properties.scm
@@ -239,6 +239,8 @@ piano staff.")
percent repeats.")
(createKeyOnClefChange ,boolean? "Print a key signature whenever
the clef is changed.")
+ (createMultiMeasureRestReminders ,boolean? "Add a reminder at the
+top of the page of the last multi measure rest on the preceding page.")
(createSpacing ,boolean? "Create @code{StaffSpacing} objects?
Should be set for staves.")
(crescendoSpanner ,symbol? "The type of spanner to be used for
Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index
ce88925313194e622f00429419aa7f6da2572a88..a7e5a576c83d9fe37fe7b809fd3bff9756e4ce98
100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -785,6 +785,7 @@ break at a column with a negative penalty.")
(page-break-permission ,symbol? "Instructs the page breaker on
whether to put a page break at this column. Can be @code{force} or
@code{allow}.")
+ (page-number ,number? "Page number on which this system ends up.")
(page-turn-penalty ,number? "Penalty for a page turn at this
column. This affects the choices of the page breaker; it avoids a
page turn at a column with a positive penalty and prefers a page turn
@@ -820,6 +821,7 @@ horizontal edges.")
;;;
;;; r
;;;
+ (rank-on-page ,number? "0-based index of the system on a page.")
(ratio ,number? "Parameter for slur shape. The higher this
number, the quicker the slur attains its @code{height-limit}.")
(remove-empty ,boolean? "If set, remove group if it contains no
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index
2b86397c4c989c7655e7664424187e36dfe5359a..12e3b903ff8a1647d3cce2e16c08dd47d8b93523
100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1601,6 +1601,31 @@
side-position-interface
text-interface))))))
+ (MultiMeasureRestReminder
+ . (
+ (break-align-symbols . (left-edge staff-bar))
+ (non-musical . #t)
+ (break-visibility . ,begin-of-line-visible)
+ (X-extent . (0 . 0))
+ (Y-extent . (0 . 0))
+ (staff-position . 8)
+ (stencil . ,ly:text-interface::print)
+ (text . ,(lambda (grob)
+ (let*
+ ((r (ly:grob-property (ly:grob-system grob)
'rank-on-page)))
+ (display (ly:format "rank ~a" r))
+ (if (< 0 r)
+ (begin
+ (ly:grob-suicide! grob)
+ "")
+ (ly:format "(~a)" (ly:grob-property grob
'measure-count))))))
+ (Y-offset . ,staff-symbol-referencer::callback)
+ (meta . ((class . Item)
+ (interfaces . (font-interface
+ multi-measure-interface
+ outside-staff-interface
+ text-interface))))
+ ))
(MultiMeasureRestText
. (
(direction . ,UP)