Update layout.cpp

Use the measure's own method that finds out if there is a previous measure to determine whether this is the first measure.