Пример #1
0
        /** This is a utility function to return the screen X position of
         * a left-positioned symbol (as defined by isLeftPositioned()).
         * This finds the hotspot of the next symbol in the time slice
         * which isLeftPositioned() (or the hotspot of the time slice itself
         * if there are no more) and subtracts from its X value
         * the (measure width - 10) / (the measure symbol count - 1).
         */
        protected int findLeftPositionedX()
        {
            FinalPoint nextHotspot = null;

            for (int i = getIndex() + 1; i < getParentTimeSlice().getMusicSymbolCount(); ++i)
            {
                MusicSymbol nextSymbol = getParentTimeSlice().getMusicSymbol(i);
                if (nextSymbol.isLeftPositionedSymbol())
                {
                    nextHotspot = nextSymbol.getScreenHotspot();
                    break;
                }
            }
            if (nextHotspot == null)
            {
                // No next left positioned symbol, so use the time slice
                nextHotspot = getParentTimeSlice().getScreenHotspot();
            }

            MeasureStartTimeSlice measure = getParentTimeSlice().getParentMeasureStart();

            // Note that we know measure.getSymbolCount() is at least one
            return(nextHotspot.x -
                   (measure.getWidth() - 10) / (measure.getSymbolCount() - 1));
        }