Section Bars

Bars utility functions.

Summary

ConstantTypeSummary
BAR_STATE_AFTER_PRINT_REGIONintBar state visibility: not visible, after last printed bar
BAR_STATE_BEFORE_PRINT_REGIONintBar state visibility: not visible, before first printed bar
BAR_STATE_MULTI_FIRSTintBar visibility state: visible, first bar of a multi-rest or multi-repeat.
BAR_STATE_MULTI_LASTintBar visibility state: not visible, last bar of a multi-rest or multi-repeat.
BAR_STATE_MULTI_MIDDLEintBar visibility state: not visible, inside (but not last bar of) a multi-rest or multi-repeat.
BAR_STATE_UNDEFINEDintBar visibility state: undefined: should not happen.
BAR_STATE_VISIBLEintBar visibility state: normal, visible.
Return typeFunction and summary
intDontSplitTwoAndFourRepeats(Score score, int firstBar, int lastBar)
In current view, avoid split (end of line) in the middle of %2 and %4 bar-repeats.
tableGetBarVisibilityState(Score score, int firstBar, int lastBar)
Get the visibility state of all bars between firstBar and lastBar.
 TargetHideBarNumbers(Score score)
Hide bar numbers at bar that display a rehearsal mark, for all views.
 TargetSplitMultiRests(Score score)
Split multi-rests at all visible rehearsal marks, for all views.

Constants

int BAR_STATE_UNDEFINED

Bar visibility state: undefined: should not happen.

int BAR_STATE_VISIBLE

Bar visibility state: normal, visible.

int BAR_STATE_MULTI_FIRST

Bar visibility state: visible, first bar of a multi-rest or multi-repeat.

int BAR_STATE_MULTI_MIDDLE

Bar visibility state: not visible, inside (but not last bar of) a multi-rest or multi-repeat.

int BAR_STATE_MULTI_LAST

Bar visibility state: not visible, last bar of a multi-rest or multi-repeat.

int BAR_STATE_BEFORE_PRINT_REGION

Bar state visibility: not visible, before first printed bar

int BAR_STATE_AFTER_PRINT_REGION

Bar state visibility: not visible, after last printed bar

Functions

TargetSplitMultiRests(Score score)

Split multi-rests at all visible rehearsal marks, for all views.

The property is set to the previous bar.

ParameterTypeDefaultDescription
scoreScore score

TargetHideBarNumbers(Score score)

Hide bar numbers at bar that display a rehearsal mark, for all views.

Common practice in orchestral score, rehearsal marks are framed big bar numbers, so no need to display regular bar numbers at these bars.

ParameterTypeDefaultDescription
scoreScore score

GetBarVisibilityState(Score score, int firstBar, int lastBar)

Get the visibility state of all bars between firstBar and lastBar.

Bars can be invisible if out of print region, in the middle or at the end of a multi-rest.

ParameterTypeDefaultDescription
scoreScore score
firstBarint1 
lastBarintscore.NumberOfBars 
Return
table: A table of bar number to int value:
  • BAR_STATE_VISIBLE: normal bar, visible,
  • BAR_STATE_MULTI_FIRST: visible, first bar of a multi-rest or multi-repeat,
  • BAR_STATE_MULTI_MIDDLE: not visible, inside (but not last bar of) a multi-rest or multi-repeat,
  • BAR_STATE_MULTI_LAST: not visible, last bar of a multi-rest or multi-repeat,
  • BAR_STATE_BEFORE_PRINT_REGION: not visible, before first printed bar,
  • BAR_STATE_AFTER_PRINT_REGION: not visible, after last printed bar,
  • BAR_STATE_UNDEFINED: should never happen because calculation is made by switching to Page mode if necessary.
Example


 local first,last = 10,35
 local bsv = GetBarVisibilityState(FrontScore(), first, last)
 for i=first,last do
    if bsv[i] == BAR_STATE_MULTI_LAST then
      -- set force display bar number after a multi-rest
      FrontScore().GetGlobalBarSetting(i+1).IsForcedDisplay = true
    end
    FrontScore().Update()
 end

DontSplitTwoAndFourRepeats(Score score, int firstBar, int lastBar)

In current view, avoid split (end of line) in the middle of %2 and %4 bar-repeats.

Set global bar settings : DontBreakLine = true, EndOfLine = false, EndOfPage = false.

ParameterTypeDefaultDescription
scoreScore score
firstBarint1First bar where %2 and %4 are searched
lastBarintscore.NumberOfBarsLast bar where %2 and %4 are searched
Return
int: Number of modified bars