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
  // row      , startIndex
  public void adjustSection(
      int index, int newMeasure, boolean isPhrase, boolean usePreviousStyleChecked) {
    // System.out.println("1 records = " + records);

    // Do not move first record
    // Its phrase value can be set in place

    if (newMeasure <= 0) return;

    if (index > 0 && newMeasure <= getSectionMeasure(index - 1)) return;

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

    if (newMeasure > endTemp) return;

    SectionRecord record = records.get(index);
    // gets the start measure # of the section
    // if user wants to change start index to what it is already -_-
    if (getSectionMeasure(index) == newMeasure) {
      record.setIsPhrase(isPhrase);
      if (usePreviousStyleChecked) record.setUsePreviousStyle();
      return;
    }

    String styleName = usePreviousStyleChecked ? Style.USE_PREVIOUS_STYLE : record.getStyleName();
    deleteSection(index);
    addSection(styleName, measureToSlotIndex(newMeasure), isPhrase);
  }