Skip to content

Commit

Permalink
#470 and #417: Smaller corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
berndmoos committed Apr 21, 2024
1 parent 8b679fb commit f90c07c
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 26 deletions.
62 changes: 42 additions & 20 deletions src/org/exmaralda/exakt/exmaraldaSearch/swing/EXAKT.java
Original file line number Diff line number Diff line change
Expand Up @@ -885,28 +885,50 @@ public SearchResultInterface getSelectedSearchResult(){
}

private void openPartiturEditorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openPartiturEditorButtonActionPerformed
// 21-04-2024: new for #417
SearchResultInterface searchResult = getSelectedSearchResult();
if (searchResult==null){
String message = "No search result selected in active KWIC panel ";
JOptionPane.showMessageDialog(partiturPanel, message);
return;
}
String filename = searchResult.getSearchableSegmentLocator().getCorpusComponentFilename();
String timeID = searchResult.getAdditionalData()[2];
String pathToBT = determineBTPath(filename);
if (pathToBT==null){
String message = "Could not determine basic transcription for " + filename;
JOptionPane.showMessageDialog(partiturPanel, message);
return;
try {
// 21-04-2024: new for #417
SimpleSearchResult searchResult = (SimpleSearchResult)getSelectedSearchResult();
if (searchResult==null){
String message = "No search result selected in active KWIC panel ";
JOptionPane.showMessageDialog(this.tabbedPane, message);
return;
}
SegmentedTranscription st = getTranscriptionForSearchResult(searchResult);
String filename = searchResult.getSearchableSegmentLocator().getCorpusComponentFilename();
BasicTranscription bt = st.toBasicTranscription();
String tierID = searchResult.getAdditionalData()[0];
Tier tier = bt.getBody().getTierWithID(tierID);
String timeID = searchResult.getAdditionalData()[2];

if (!(searchResult instanceof AnnotationSearchResult)){
// find the exact startpoint
int count = 0;
int s = searchResult.getOriginalMatchStart();
while (count + tier.getEventAtStartPoint(timeID).getDescription().length() <= s){
count+=tier.getEventAtStartPoint(timeID).getDescription().length();
timeID = tier.getEventAtStartPoint(timeID).getEnd();
}
}


String pathToBT = determineBTPath(filename);
if (pathToBT==null){
String message = "Could not determine basic transcription for " + filename;
JOptionPane.showMessageDialog(this.tabbedPane, message);
return;
}

String[] args = {
pathToBT,
timeID
};
PartiturEditor.main(args);
} catch (SAXException | JexmaraldaException ex) {
Logger.getLogger(EXAKT.class.getName()).log(Level.SEVERE, null, ex);
String message = "Error opening Partitur-Editor " + ex.getMessage();
JOptionPane.showMessageDialog(this.tabbedPane, message);
}

String[] args = {
pathToBT,
timeID
};
PartiturEditor.main(args);

}//GEN-LAST:event_openPartiturEditorButtonActionPerformed

// 21-04-2024: new for #417
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
</xsl:when>
<xsl:otherwise>
<!-- WORD -->
<xsl:analyze-string select="text()" regex="[\(\) …\.\?!,–—\-=]">
<xsl:analyze-string select="text()" regex="[\(\) …\.\?!,–—\-=&quot;]">
<xsl:matching-substring>
<nts n="INEL:ip">
<xsl:attribute name="id" select="concat('nts_', $ID, '_', position())"></xsl:attribute>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ public class GotoDialog extends javax.swing.JDialog {

PartitureTableWithActions partitur;

/** Creates new form GotoDialog */
/** Creates new form GotoDialog
* @param parent
* @param modal
* @param p */
public GotoDialog(java.awt.Frame parent, boolean modal, PartitureTableWithActions p) {
super(parent, modal);
initComponents();
Expand Down Expand Up @@ -62,7 +65,7 @@ private void apply() {
JOptionPane.showMessageDialog(this, "Could not parse time string");
}
} else {
int col = ((Integer)(timelineItemSpinner.getValue())).intValue();
int col = ((Integer)(timelineItemSpinner.getValue()));
partitur.makeColumnVisible(col);
}
}
Expand Down
15 changes: 13 additions & 2 deletions src/org/exmaralda/partitureditor/partiture/PartiturEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package org.exmaralda.partitureditor.partiture;

//import com.apple.eawt.ApplicationEvent;
import com.klg.jclass.table.JCTableEnum;
import java.awt.BorderLayout;
import java.awt.HeadlessException;
import java.awt.desktop.OpenFilesEvent;
Expand Down Expand Up @@ -56,6 +57,8 @@ public class PartiturEditor extends javax.swing.JFrame
org.exmaralda.exakt.search.swing.KWICTableListener
{


boolean wasCalledFromOutside = false;

/** the table component containing the partitur */
private final PartitureTableWithActions table;
Expand Down Expand Up @@ -281,7 +284,12 @@ private boolean exitForm(java.awt.event.WindowEvent evt) {
System.out.println("Application terminated. ");
System.out.println(new java.util.Date().toString());
System.out.println("________________________");
System.exit(0);
if (this.wasCalledFromOutside){
// new for #417: if I do System.exit, EXAKT will also quit
dispose();
} else {
System.exit(0);
}
}
return proceed;
}
Expand Down Expand Up @@ -327,7 +335,10 @@ public void run() {
// 21-04-2024: new for #417
String tliID = args[1];
int column = pe.table.getModel().getColumnNumber(tliID);
pe.table.makeColumnVisible(column);
pe.table.setNewSelection(-1, column, false);
pe.table.traverse(JCTableEnum.TRAVERSE_RIGHT);
pe.table.setLeftColumn(column);
pe.wasCalledFromOutside = true;
}

//pe.table.transcriptionChanged = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public class GotoAction extends org.exmaralda.partitureditor.partiture.AbstractT

GotoDialog dialog;

/** Creates a new instance of ChopAudioAction */
/** Creates a new instance of ChopAudioAction
* @param t */
public GotoAction(PartitureTableWithActions t) {
super("Go to...", t);
dialog = new GotoDialog(t.parent, true, t);
Expand Down

0 comments on commit f90c07c

Please sign in to comment.