Include some batch operations with spacers

• Sep 19, 2019 - 18:35
Reported version
3.2
Type
Functional
Frequency
Once
Severity
S5 - Suggestion
Reproducibility
Always
Status
active
Regression
No
Workaround
No
Project

Sometimes one needs to add spacers to all or a goup of staves in order to increase uniformly the distance between staves. An example, when hiding empty staves and in a given page there is no room for an extra system. Currently one must select the staves one by one and add the spacer.
It would be nice to be able to select all the required staves and double click the spacer from the palette to insert all the spacers at once.

Once the spacers have been added, one needs to select them all so that with single change in the inspector, the correct distance can be achieved. Currently one has to select them one by one since spacers are not listed in the selection filter.
It would be interesting that such filter were available.

Combining both features, it would be easy to change the stave distance in a few steps.

See https://musescore.org/en/comment/946382#comment-946382


Comments

The following patch accomplishes the first part of this suggestion.

diff --git a/mscore/palette.cpp b/mscore/palette.cpp
index e2393e00b..91ec429dc 100644
--- a/mscore/palette.cpp
+++ b/mscore/palette.cpp
@@ -555,7 +555,6 @@ void Palette::applyPaletteElement(Element* element, Qt::KeyboardModifiers modifi
             if (element->type() == ElementType::BAR_LINE
                 || element->type() == ElementType::MARKER
                 || element->type() == ElementType::JUMP
-                || element->type() == ElementType::SPACER
                 || element->type() == ElementType::VBOX
                 || element->type() == ElementType::HBOX
                 || element->type() == ElementType::TBOX
@@ -578,6 +577,15 @@ void Palette::applyPaletteElement(Element* element, Qt::KeyboardModifiers modifi
                               break;
                         }
                   }
+            else if (element->isSpacer()) {
+                  Measure* m = sel.startSegment()->measure();
+                  for (int staffIdx = sel.staffStart(); staffIdx < sel.staffEnd(); ++staffIdx) {
+                        QRectF r = m->staffabbox(staffIdx);
+                        QPointF pt(r.x() + r.width() * .5, r.y() + r.height() * .5);
+                        pt += m->system()->page()->pos();
+                        applyDrop(score, viewer, m, element, modifiers, pt);
+                        }
+                  }
             else if (element->type() == ElementType::LAYOUT_BREAK) {
                   LayoutBreak* breakElement = static_cast<LayoutBreak*>(element);
                   score->cmdToggleLayoutBreak(breakElement->layoutBreakType());

I'd like to point out that you can right-click on a spacer and choose "Select->More...", tick the "Same system" box, and press "Ok", and all spacers in that system will be selected. Then you can use the Inspector to adjust the heights of all of the selected spacers at once. If you want to select all spacers in all systems, you can simply right-click on a spacer and choose "Select->All Similar Elements".

Up until recently, adding or resizing a staff spacer caused a full relayout. See #293877: Adding or dragging spacers causes a full re-layout. With MuseScore 3.3 Beta, this is no longer an issue.