Package info.textgrid.lab.noteeditor.mei2013

Examples of info.textgrid.lab.noteeditor.mei2013.Score


            handleScoreChild(endingChildForm, saveAllVariants));
      }
      return ending;
    } else if (childForm instanceof ScoreDefForm) {
      ScoreDefForm contentForm = (ScoreDefForm) childForm;
      ScoreDef contentNode = (ScoreDef) contentForm.getMeiNode();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.setStaffGrp((StaffGrp) handleScoreChild(
            contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof StaffGroupForm) {
      StaffGroupForm contentForm = (StaffGroupForm) childForm;
      StaffGrp contentNode = (StaffGrp) contentForm.getMeiNode();
      contentNode.getInstrDevesAndGrpSymsAndStaffDeves().clear();
      if(contentForm.getChildren().size() == 0) {
        //an empty staffGrp is not allowed and is being cut
        return null;
      }
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getInstrDevesAndGrpSymsAndStaffDeves().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof StaffDefForm) {
      StaffDefForm contentForm = (StaffDefForm) childForm;
      StaffDef contentNode = (StaffDef) contentForm.getMeiNode();
      contentNode.getMensursAndProportsAndClefGrps().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getMensursAndProportsAndClefGrps().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof MeasureForm) {
      MeasureForm measureForm = (MeasureForm) childForm;
      Measure measureNode = (Measure) measureForm.getMeiNode();
      measureNode.getAnnotsAndSlursAndTupletSpen().clear();
      for (BasicElement measureChildForm : measureForm.getChildren()) {
        measureNode.getAnnotsAndSlursAndTupletSpen().add(
            handleScoreChild(measureChildForm, saveAllVariants));
      }
      return measureNode;
    } else if (childForm instanceof StaffForm) {
      StaffForm contentForm = (StaffForm) childForm;
      Staff contentNode = (Staff) contentForm.getMeiNode();
      contentNode.getSbsAndSymbolsAndOrigs().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getSbsAndSymbolsAndOrigs().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof AppForm) {
      AppForm contentForm = (AppForm) childForm;
      App contentNode = (App) contentForm.getMeiNode();
      contentNode.getRdgs().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getRdgs().add(
            (Rdg) handleScoreChild(contentChildForm,
                saveAllVariants));
      }
      if (contentNode.isSetRdgs() && contentNode.getRdgs().isEmpty())
        contentNode.unsetRdgs();
      if (contentNode.isSetN() && contentNode.getN().isEmpty())
        contentNode.setN(null);
      if (!saveAllVariants) {
        for (BasicElement contentChildForm : contentForm.getChildren()) {
          if(contentChildForm instanceof ReadingForm && ((ReadingForm)contentChildForm).isActive() ) {
            MeiNode parentMeiNode = contentForm.getParent().getMeiNode();
            for(BasicElement grandChild : ((ReadingForm)contentChildForm).getChildren()){
              MeiNodeNavigator.addMeiNodeAsChild(parentMeiNode, grandChild.getMeiNode());
            }           
          }
        }
        return null;

      }
      return contentNode;
    } else if (childForm instanceof ReadingForm) {
      Rdg contentNode;
      ReadingForm contentForm = (ReadingForm) childForm;
      if (!saveAllVariants && !contentForm.isActive()) {
        // ignore this very reading
        return null;
      }
      contentNode = (Rdg) contentForm.getMeiNode();
      contentNode.getSources().clear();
      for (SourceBindingWrapper sbw : contentForm
          .getSourceBindingWrappers()) { // insert the wrapped sources
        contentNode.getSources().add(sbw.getSource().getId());
      }
      if (contentNode.getSources().isEmpty())
        contentNode.unsetSources();
      contentNode.getMRestsAndKeySigsAndProports().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getMRestsAndKeySigsAndProports().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof LayerForm) {
      LayerForm contentForm = (LayerForm) childForm;
      Layer contentNode = (Layer) contentForm.getMeiNode();
      contentNode.getBarLinesAndSyllablesAndGaps().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getBarLinesAndSyllablesAndGaps().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof ChordGroupForm) {
      ChordGroupForm contentForm = (ChordGroupForm) childForm;
      Chord contentNode = (Chord) contentForm.getMeiNode();
      contentNode.getRestoresAndArticsAndUnclears().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getRestoresAndArticsAndUnclears().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      if(contentNode.getArtics().isEmpty()) {
        contentNode.unsetArtics();
      }
      return contentNode;
    } else if (childForm instanceof BeamGroupForm) {
      BeamGroupForm contentForm = (BeamGroupForm) childForm;
      Beam contentNode = (Beam) contentForm.getMeiNode();
      contentNode.getFTremsAndChordsAndDamages().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getFTremsAndChordsAndDamages().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof NoteForm) {
      NoteForm contentForm = (NoteForm) childForm;
      Note contentNode = (Note) contentForm.getMeiNode();
      if (contentNode.getArtics().isEmpty())
        contentNode.unsetArtics();
      return contentNode;
    } else if (childForm instanceof RestForm) {
      RestForm contentForm = (RestForm) childForm;
      Rest contentNode = (Rest) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof MRestForm) {
      MRestForm contentForm = (MRestForm) childForm;
      MRest contentNode = (MRest) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof SpaceForm) {
      SpaceForm contentForm = (SpaceForm) childForm;
      Space contentNode = (Space) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof DynamForm) {
      DynamForm contentForm = (DynamForm) childForm;
      Dynam contentNode = (Dynam) contentForm.getMeiNode();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getContent().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof TieForm) {
      TieForm contentForm = (TieForm) childForm;
View Full Code Here


  private static BasicElement handleStaffGrp(StaffGrp staffGrp,
      BasicElement parentForm) {
    ScoreDefForm scoreDefForm = (ScoreDefForm) MeiNodeNavigator
        .findAncestorForm(ScoreDefForm.class, parentForm);
    ScoreDef scoreDef = (ScoreDef)scoreDefForm.getMeiNode();
    StaffGroupForm staffGroupForm = new StaffGroupForm();
    staffGroupForm.setParent(parentForm);
    staffGroupForm.setMeiNode(staffGrp);
    for (MeiNode child : staffGrp.getInstrDevesAndGrpSymsAndStaffDeves()) {
      if (child instanceof StaffDef) {
        StaffDef staffDef = (StaffDef) child;
        if (null == staffDef.getMeterCount()) {
          if (null != scoreDef.getMeterCount()) {
            staffDef.setMeterCount(scoreDef.getMeterCount());
          } else {
            staffDef.setMeterCount(
                StringConstants.STRING_EMPTY
                    + GraphicalConstants.DEFAULT_METER_COUNT);
          }
        }
        if (null == staffDef.getMeterUnit()) {
          if (null != scoreDef.getMeterUnit()) {
            staffDef.setMeterUnit(scoreDef.getMeterUnit());
          } else {
            staffDef.setMeterUnit(new BigDecimal(
                StringConstants.STRING_EMPTY
                    + GraphicalConstants.DEFAULT_METER_UNIT));
          }
        }
        if (null == scoreDef.getMeterSym()) {
          if (null != staffDef.getMeterSym()) {
            staffDef.setMeterSym(scoreDef.getMeterSym());
          } else {
            staffDef.setMeterSym(HelperMethods
                .convertStringToSign(GraphicalConstants.DEFAULT_METER_SYM));
          }
        }
View Full Code Here

    Body body = new Body();
    Mdiv mdiv = new Mdiv();
    Score score = new Score();
    ScoreDef scoreDef = createScoreDef(stavesCount);
    score.getGapsAndSbsAndCorrs().add(scoreDef);
    Section section = new Section();
    Measure measureFirst = new Measure();
    Staff staffFirst = new Staff();
    Layer layerFirst = new Layer();
    staffFirst.getSbsAndSymbolsAndOrigs().add(layerFirst);
    measureFirst.getAnnotsAndSlursAndTupletSpen().add(staffFirst);
    for (int stavesIter = 1; stavesIter < stavesCount; stavesIter++) {
      Staff staff = new Staff();
      Layer layer = new Layer();
      staff.getSbsAndSymbolsAndOrigs().add(layer);
      measureFirst.getAnnotsAndSlursAndTupletSpen().add(staff);
    }
    section.getUnclearsAndSbsAndApps().add(measureFirst);

    for (int measureIter = 1; measureIter < measureCount; measureIter++) {
      Measure measure = new Measure();
      for (int stavesIter = 0; stavesIter < stavesCount; stavesIter++) {
        Staff staff = new Staff();
        Layer layer = new Layer();
        staff.getSbsAndSymbolsAndOrigs().add(layer);
        measure.getAnnotsAndSlursAndTupletSpen().add(staff);
      }
      section.getUnclearsAndSbsAndApps().add(measure);
    }
    score.getGapsAndSbsAndCorrs().add(section);
    mdiv.setScore(score);
    body.getMdivs().add(mdiv);
    music.setBody(body);
View Full Code Here

    tpd.setDescription(MusicMessages.MEI_documentation_generic_n);
    descriptors.add(tpd);
  }
 
  private void createDefaultSection() {
    setMeiNode(new Section());
  }
View Full Code Here

  private static MeiNode handleScoreChild(BasicElement childForm,
      boolean saveAllVariants) {
    if (childForm instanceof SectionForm) {
      SectionForm sectionForm = (SectionForm) childForm;
      Section section = (Section) sectionForm.getMeiNode();
      section.getUnclearsAndSbsAndApps().clear();
      for (BasicElement sectionChildForm : sectionForm.getChildren()) {
        section.getUnclearsAndSbsAndApps().add(
            handleScoreChild(sectionChildForm, saveAllVariants));
      }
      return section;
    } else if (childForm instanceof EndingForm) {
      EndingForm endingForm = (EndingForm) childForm;
View Full Code Here

   * @param endPoint
   */
  public static void renderSlur(Graphics graphics, SlurForm slurForm,
      Point startPoint, Point endPoint) {
    graphics.setForegroundColor(calculateVariantColor(slurForm));
    Slur slurNode = (Slur) slurForm.getMeiNode();
    boolean isAbove = true;
    if (slurNode.isSetCurvedir()) {
      isAbove = slurNode.getCurvedir().equalsIgnoreCase(
          GraphicalConstants.PROPCOMBO_STRING_ARRAY_CURVEDIR[0]);
    }
    if (startPoint != null
        && endPoint != null
        && (isVisibleArea(MusicPlugin.getDefault().getActiveEditor()
View Full Code Here

    getSlur().unsetLayers();
    getSlur().getLayers().add(new BigInteger(StringConstants.STRING_EMPTY + newLayer));
  }

  private void createDefaultSlur() {
    Slur slur = new Slur();
    setMeiNode(slur);
  }
View Full Code Here

          noteTieEndpoint);
    }
  }

  private void processSlur(Graphics graphics, SlurForm slurForm) {
    Slur slurNode = (Slur) slurForm.getMeiNode();
    String startId = slurNode.getStartid();
    String endId = slurNode.getEndid();
   
//    System.out.println(startId + "  " + endId);
   
    if (startId != null
        && endId != null
View Full Code Here

      TieForm contentForm = (TieForm) childForm;
      Tie contentNode = (Tie) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof SlurForm) {
      SlurForm contentForm = (SlurForm) childForm;
      Slur contentNode = (Slur) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof FermataForm) {
      FermataForm contentForm = (FermataForm) childForm;
      Fermata contentNode = (Fermata) contentForm.getMeiNode();
      return contentNode;
View Full Code Here

    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    Button btnCreateSource = new Button(container, SWT.NONE);
    btnCreateSource.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        Source newSource = new Source();
        newSource.setId("Source_" + (table.getItemCount() + 1)); //$NON-NLS-1$
        SourceBindingWrapper sourceBindingWrapper = new SourceBindingWrapper(newSource);
        writableList.add(sourceBindingWrapper);
        tableViewer.setSelection(new StructuredSelection(sourceBindingWrapper));
      }
    });
View Full Code Here

TOP

Related Classes of info.textgrid.lab.noteeditor.mei2013.Score

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.