Skip to content

Commit

Permalink
More for #338
Browse files Browse the repository at this point in the history
  • Loading branch information
berndmoos committed Nov 18, 2022
1 parent d179944 commit c0729a6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
Expand Up @@ -31,13 +31,20 @@ public final class ItConverter {
public ItConverter() {
}

/** converts the given basic transcription with the given tier format table to an interlinear text object */
/** converts the given basic transcription with the given tier format table to an interlinear text object
* @param t
* @param tft
* @return */
public static InterlinearText BasicTranscriptionToInterlinearText(BasicTranscription t, TierFormatTable tft){
return BasicTranscriptionToInterlinearText(t,tft,0);
}

/** converts the given basic transcription with the given tier format table to an interlinear text object,
* starts the count of timeline items at the specified value */
* starts the count of timeline items at the specified value
* @param t
* @param tft
* @param timelineStart
* @return */
public static InterlinearText BasicTranscriptionToInterlinearText(BasicTranscription t, TierFormatTable tft, int timelineStart){
InterlinearText result = new InterlinearText();
formats = TierFormatTableToFormats(tft);
Expand Down
Expand Up @@ -6,6 +6,8 @@

package org.exmaralda.partitureditor.partiture.editActions;

import java.util.ArrayList;
import java.util.List;
import org.exmaralda.partitureditor.jexmaralda.convert.ItConverter;
import org.exmaralda.partitureditor.jexmaralda.BasicTranscription;
import org.exmaralda.partitureditor.partiture.*;
Expand Down Expand Up @@ -47,7 +49,31 @@ private void copyHTML(){
}
return;
}
BasicTranscription newTranscription = table.getCurrentSelectionAsNewTranscription();
//BasicTranscription newTranscription = table.getCurrentSelectionAsNewTranscription();
int startR = 0; int endR = table.getModel().getNumRows();
int startC = 0; int endC = table.getModel().getNumColumns();
if ((table.selectionStartRow >=0) && (table.selectionEndRow>=0) && (table.selectionStartCol>=0) && (table.selectionEndCol>=0)){
// some arbitrary area is selected
startR = table.selectionStartRow; endR = table.selectionEndRow+1;
startC = table.selectionStartCol; endC = table.selectionEndCol+1;
} else if ((table.selectionStartCol<0) && (table.selectionStartRow>=0) && (table.selectionEndRow>=0)){
// one or several complete rows are selected
startR = table.selectionStartRow; endR = table.selectionEndRow+1;
} else if ((table.selectionStartRow<0) && (table.selectionStartCol>=0) && (table.selectionEndCol>=0)){
startC = table.selectionStartCol; endC = table.selectionEndCol+1;
}
List<Integer> rowList = new ArrayList<>();

for (int r=startR; r<endR; r++){
if (table.isRowVisible(r)){
rowList.add(r);
}
}
int[] rowArray = new int[rowList.size()];
for (int i=0; i<rowArray.length; i++){
rowArray[i] = rowList.get(i);
}
BasicTranscription newTranscription = table.getModel().getPartOfTranscription(rowArray, startC, endC);
int timelineStart = table.selectionStartCol;
org.exmaralda.partitureditor.interlinearText.InterlinearText it =
ItConverter.BasicTranscriptionToInterlinearText(newTranscription, table.getModel().getTierFormatTable(), timelineStart);
Expand Down
Expand Up @@ -10,6 +10,8 @@
import org.exmaralda.partitureditor.partiture.*;
import java.awt.event.KeyEvent;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import static java.awt.event.ActionEvent.ALT_MASK;
import org.exmaralda.common.helpers.Internationalizer;

/**
Expand Down Expand Up @@ -59,6 +61,8 @@ public EditMenu(PartitureTableWithActions t) {
copyTextMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

copyHTMLMenuItem = this.add(table.copyHTMLAction);
copyHTMLMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK+ActionEvent.SHIFT_MASK));


pasteMenuItem = this.add(table.pasteAction);
pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Expand Down

0 comments on commit c0729a6

Please sign in to comment.