Example #1
0
  // markermarkermarker
  public void adjustEndOfSection(
      int index, int endIndex, boolean isPhrase, boolean usePreviousStyleChecked) {
    // *
    if (endIndex <= 0) return;

    SectionRecord record = records.get(index);

    int endTemp = (index + 1 < size()) ? getSectionMeasure(index + 1) - 1 : measures();

    int nextSectionEnd = (index + 2 < size()) ? getSectionMeasure(index + 2) - 1 : measures();

    if (index < size() - 1 && endIndex >= nextSectionEnd) return;

    if (endIndex < getSectionMeasure(index)) return;

    // if user wants to change end index to what it is already -_-
    if (endIndex == endTemp) {
      record.setIsPhrase(isPhrase);
      if (usePreviousStyleChecked) record.setUsePreviousStyle();
      return;
    }

    String styleName = usePreviousStyleChecked ? Style.USE_PREVIOUS_STYLE : record.getStyleName();

    if (size() <= 1) return;
    if (index < size() - 1) {
      SectionRecord nextRecord = records.get(index + 1);
      nextRecord.setIndex(measureToSlotIndex(endIndex + 1));
    }
    // */

  }
Example #2
0
  public void deleteSection(int index) {
    if (size() <= 1) return;
    SectionRecord fillSpot = null;
    if (index == 0) fillSpot = records.get(1);

    if (index < size() - 1) {
      SectionRecord nextRecord = records.get(index + 1);
      if (nextRecord.usePreviousStyle()) nextRecord.setStyleName(records.get(index).getStyleName());
    }

    ListIterator<SectionRecord> k = records.listIterator(index);
    k.next();

    int newStartIndex = getSectionMeasure(index);

    k.remove();

    if (fillSpot != null) {
      fillSpot.setIndex(measureToSlotIndex(newStartIndex));
    }
  }