From fcb9d354ea8eee2073250b571441ebcab604a9e2 Mon Sep 17 00:00:00 2001 From: berndmoos Date: Thu, 18 Apr 2024 14:42:37 +0200 Subject: [PATCH] #466: Many small changes, mainly for status bars --- .../partitureditor/jexmaralda/BasicBody.java | 43 ++++++++--- .../partitureditor/jexmaralda/Timeline.java | 40 +++++++--- .../jexmaraldaswing/BookmarksDialog.form | 3 +- .../jexmaraldaswing/BookmarksDialog.java | 4 +- .../jexmaraldaswing/EditTierOrderDialog.form | 6 ++ .../jexmaraldaswing/EditTierOrderDialog.java | 43 +++++++---- .../jexmaraldaswing/InterpolationDialog.form | 41 +++++++++- .../jexmaraldaswing/InterpolationDialog.java | 38 ++++++--- .../RecordingsListCellRenderer.java | 2 - .../jexmaraldaswing/TierListCellRenderer.java | 77 +++++++++++++++++++ .../jexmaraldaswing/TierListModel.java | 41 ++++++++++ .../jexmaraldaswing/TierSelectionDialog.java | 1 - .../BasicTranscriptionTableModel.java | 61 +++++++++------ .../partiture/PartitureTableWithActions.java | 5 +- .../eventActions/DeleteEventAction.java | 1 + .../eventActions/DeleteEventsAction.java | 2 + .../eventActions/DoubleSplitAction.java | 2 + .../eventActions/EditEventAction.java | 1 + .../eventActions/ExtendLeftAction.java | 11 ++- .../eventActions/ExtendRightAction.java | 11 +-- .../partiture/eventActions/MergeAction.java | 2 + .../eventActions/MoveEventAction.java | 4 +- .../eventActions/MoveLeftAction.java | 11 +-- .../eventActions/MoveRightAction.java | 11 +-- .../eventActions/ShiftLeftAction.java | 11 +-- .../eventActions/ShiftRightAction.java | 11 +-- .../eventActions/ShrinkLeftAction.java | 11 +-- .../eventActions/ShrinkRightAction.java | 11 +-- .../partiture/eventActions/SplitAction.java | 11 +-- .../eventActions/SplitLongEventAction.java | 4 +- .../partiture/tierActions/AddTierAction.java | 5 +- .../tierActions/ChangeTierOrderAction.java | 8 +- .../partiture/tierActions/EditTierAction.java | 7 +- .../partiture/tierActions/HideTierAction.java | 1 + .../tierActions/InsertTierAction.java | 5 +- .../tierActions/MoveTierUpAction.java | 6 +- .../tierActions/RemoveEmptyEventsAction.java | 6 +- .../tierActions/RemoveTierAction.java | 3 + .../tierActions/ShowAllTiersAction.java | 5 +- .../timelineActions/AddBookmarkAction.java | 2 + .../timelineActions/AnchorTimelineAction.java | 1 + .../CompleteTimelineAction.java | 7 +- .../ConfirmTimelineItemAction.java | 2 + .../EditTimelineItemAction.java | 2 + .../InsertTimelineItemAction.java | 2 + .../MakeTimelineConsistentAction.java | 7 +- .../timelineActions/RemoveAllGapsAction.java | 7 +- .../timelineActions/RemoveGapAction.java | 2 + .../RemoveInterpolatedTimesAction.java | 7 +- .../timelineActions/RemoveTimesAction.java | 2 + .../RemoveUnusedTimelineItemsAction.java | 6 +- .../ShiftAbsoluteTimesAction.java | 4 +- .../timelineActions/SmoothTimelineAction.java | 7 +- 53 files changed, 480 insertions(+), 144 deletions(-) create mode 100644 src/org/exmaralda/partitureditor/jexmaraldaswing/TierListCellRenderer.java create mode 100644 src/org/exmaralda/partitureditor/jexmaraldaswing/TierListModel.java diff --git a/src/org/exmaralda/partitureditor/jexmaralda/BasicBody.java b/src/org/exmaralda/partitureditor/jexmaralda/BasicBody.java index caf425ed..d8884c2f 100644 --- a/src/org/exmaralda/partitureditor/jexmaralda/BasicBody.java +++ b/src/org/exmaralda/partitureditor/jexmaralda/BasicBody.java @@ -42,12 +42,18 @@ public BasicBody makeCopy(){ return result; } - public void smoothTimeline() { - smoothTimeline(0.1); + public int smoothTimeline() { + return smoothTimeline(0.1); } - public void smoothTimeline(double THRESHHOLD) { + /** + * + * @param THRESHHOLD + * @return + */ + public int smoothTimeline(double THRESHHOLD) { //double THRESHHOLD = 0.1; + int count=0; Map tliMappings = new HashMap<>(); Timeline tl = getCommonTimeline(); tl.completeTimes(); @@ -95,7 +101,10 @@ public void smoothTimeline(double THRESHHOLD) { } for (String id : tliMappings.keySet()){ tl.removeTimelineItemWithID(id); + count++; } + + return count; } @@ -338,7 +347,9 @@ public String[] makeCanonicalTierOrder(String[] speakerIDs){ return StringUtilities.stringVectorToArray(result); } - /** reorders the tiers according to the order in the specified array */ + /** reorders the tiers according to the order in the specified array + * @param tierIDs + * @throws org.exmaralda.partitureditor.jexmaralda.JexmaraldaException */ public void reorderTiers(String[] tierIDs) throws JexmaraldaException{ BasicBody result = new BasicBody(); result.setCommonTimeline(this.getCommonTimeline()); @@ -358,7 +369,7 @@ public void reorderTiers(String[] tierIDs) throws JexmaraldaException{ * @return */ public String getLastUsedTimelineItem() { - HashSet allEndIDs = new HashSet(); + HashSet allEndIDs = new HashSet<>(); for (int pos=0; pos usedIDs = new HashMap<>(); for (String allID : allIDs) { usedIDs.put(allID, ""); } @@ -389,24 +401,28 @@ public void removeUnusedTimelineItems(int selectionStartCol, int selectionEndCol String id = getCommonTimeline().getTimelineItemAt(pos).getID(); if (!usedIDs.containsKey(id)){ getCommonTimeline().removeTimelineItemAt(pos); + countRemoved++; pos--; } } if (getCommonTimeline().getNumberOfTimelineItems()==0){ getCommonTimeline().addTimelineItem(); } + return countRemoved; } /** removes all timeline items that are not the start or end point of - * at least one event */ - public void removeUnusedTimelineItems(){ + * at least one event + * @return */ + public int removeUnusedTimelineItems(){ + int countRemoved = 0; String[] allIDs = {""}; for (int pos=0; pos usedIDs = new HashMap<>(); for (String allID : allIDs) { usedIDs.put(allID, ""); } @@ -417,12 +433,14 @@ public void removeUnusedTimelineItems(){ if (!usedIDs.containsKey(id)){ //System.out.println("Removing tli " + id); getCommonTimeline().removeTimelineItemAt(pos); + countRemoved++; pos--; } } if (getCommonTimeline().getNumberOfTimelineItems()==0){ getCommonTimeline().addTimelineItem(); } + return countRemoved; } /** returns true if [a) the specified timeline item does not have an absolute time assigned] and @@ -460,14 +478,17 @@ public void removeGap(String tli){ } /** remove all gaps in the transcription */ - public void removeAllGaps(){ + public int removeAllGaps(){ + int count=0; for (int pos=0; pos=0){ @@ -331,11 +331,13 @@ public boolean makeConsistent(){ // changed again 22-06-2009: don't mistreat the first TLI! if ((pos>0) && (currentTime<=minTime)) { getTimelineItemAt(pos).setTime(-0.1); - result=true; - } else {minTime = currentTime;} + count++; + } else { + minTime = currentTime; + } } } - return result; + return count; } public String[] getInconsistencies(){ @@ -383,17 +385,19 @@ public void completeTimes(){ /** interpolates the timeline * @param linear - * @param bt */ - public void completeTimes(boolean linear, BasicTranscription bt){ - completeTimes(linear, bt, true); + * @param bt + * @return */ + public int completeTimes(boolean linear, BasicTranscription bt){ + return completeTimes(linear, bt, true); } /** interpolates the timeline * @param linear * @param bt - * @param reinterpolate */ - public void completeTimes(boolean linear, BasicTranscription bt, boolean reinterpolate){ + * @param reinterpolate + * @return */ + public int completeTimes(boolean linear, BasicTranscription bt, boolean reinterpolate){ - if (getNumberOfTimelineItems()==0) {return;} + if (getNumberOfTimelineItems()==0) {return 0;} // added 12-03-2015: force linear if we do not have tiers of type t linear = linear || bt.getBody().getTiersOfType("t").length==0; @@ -407,6 +411,8 @@ public void completeTimes(boolean linear, BasicTranscription bt, boolean reinter // Make sure the absolute times are consistent makeConsistent(); + + int countChanged = 0; // Make sure first and last timeline items have absolute time value TimelineItem tli = getTimelineItemAt(getNumberOfTimelineItems()-1); if (tli.getTime()<0){ @@ -420,11 +426,13 @@ public void completeTimes(boolean linear, BasicTranscription bt, boolean reinter tli.setTime(time); tli.setType("intp"); } + countChanged++; } tli = getTimelineItemAt(0); if (tli.getTime()<0){ tli.setTime(0); tli.setType("intp"); + countChanged++; } @@ -440,6 +448,7 @@ public void completeTimes(boolean linear, BasicTranscription bt, boolean reinter TimelineItem tli2 = getTimelineItemAt(lookupID(id2)); tli.setTime(tli1.getTime()+(tli2.getTime()-tli1.getTime())/(lookupID(id2)-lookupID(id1))); tli.setType("intp"); + countChanged++; } } } else { @@ -497,6 +506,8 @@ public void completeTimes(boolean linear, BasicTranscription bt, boolean reinter double time = tli1.getTime()+(tli2.getTime()-tli1.getTime())*proportion; tli.setTime(time); tli.setType("intp"); + countChanged++; + } //System.out.println("================="); @@ -505,17 +516,22 @@ public void completeTimes(boolean linear, BasicTranscription bt, boolean reinter } } } + + return countChanged; } /** remove absolute times that have been interpolated */ - public void removeInterpolatedTimes(){ + public int removeInterpolatedTimes(){ + int count=0; for (int pos=0; pos=0) && (tli.getType().equals("intp"))){ tli.setTime(-1); + count++; } } + return count; } public void removeTimes() { diff --git a/src/org/exmaralda/partitureditor/jexmaraldaswing/BookmarksDialog.form b/src/org/exmaralda/partitureditor/jexmaraldaswing/BookmarksDialog.form index 4cb2992e..c458520b 100644 --- a/src/org/exmaralda/partitureditor/jexmaraldaswing/BookmarksDialog.form +++ b/src/org/exmaralda/partitureditor/jexmaraldaswing/BookmarksDialog.form @@ -7,6 +7,7 @@ + @@ -49,7 +50,7 @@ - + diff --git a/src/org/exmaralda/partitureditor/jexmaraldaswing/BookmarksDialog.java b/src/org/exmaralda/partitureditor/jexmaraldaswing/BookmarksDialog.java index 30436561..48d71a6e 100644 --- a/src/org/exmaralda/partitureditor/jexmaraldaswing/BookmarksDialog.java +++ b/src/org/exmaralda/partitureditor/jexmaraldaswing/BookmarksDialog.java @@ -34,7 +34,7 @@ public BookmarksDialog(java.awt.Frame parent, boolean modal, Timeline tl) { super(parent, modal); timeline = tl; initComponents(); - allBookmarks = tl.getAllBookmarks(); + allBookmarks = timeline.getAllBookmarks(); for (int pos=0; pos + + + @@ -81,6 +84,9 @@ + + + diff --git a/src/org/exmaralda/partitureditor/jexmaraldaswing/EditTierOrderDialog.java b/src/org/exmaralda/partitureditor/jexmaraldaswing/EditTierOrderDialog.java index 2042fdde..0b3c0d8b 100644 --- a/src/org/exmaralda/partitureditor/jexmaraldaswing/EditTierOrderDialog.java +++ b/src/org/exmaralda/partitureditor/jexmaraldaswing/EditTierOrderDialog.java @@ -7,9 +7,9 @@ package org.exmaralda.partitureditor.jexmaraldaswing; import org.exmaralda.common.helpers.Internationalizer; -import org.exmaralda.partitureditor.jexmaralda.TierDescriptions; import org.exmaralda.partitureditor.jexmaralda.BasicTranscription; import java.util.*; +import org.exmaralda.partitureditor.jexmaralda.Tier; /** * * @author Thomas @@ -17,8 +17,9 @@ */ public class EditTierOrderDialog extends JEscapeDialog { - private final javax.swing.DefaultListModel tiersListModel; + private final TierListModel tiersListModel; private String[] tierOrder; + BasicTranscription copyBT; /** Creates new form EditTierOrderDialog * @param parent @@ -26,14 +27,17 @@ public class EditTierOrderDialog extends JEscapeDialog { * @param transcription */ public EditTierOrderDialog(java.awt.Frame parent,boolean modal, BasicTranscription transcription) { super (parent, modal); - tierOrder = transcription.getBody().getAllTierIDs(); + copyBT = transcription.makeCopy(); + tiersListModel = new TierListModel(copyBT); + /*tierOrder = transcription.getBody().getAllTierIDs(); tiersListModel = new javax.swing.DefaultListModel(); TierDescriptions td = new TierDescriptions(transcription); for (String tierOrder1 : tierOrder) { String listEntry = tierOrder1 + " (" + td.getTierDescriptionForTierID(tierOrder1) + ")"; tiersListModel.addElement(listEntry); - } + }*/ initComponents (); + tiersList.setCellRenderer(new TierListCellRenderer(copyBT)); this.getRootPane().setDefaultButton(okButton); pack (); Internationalizer.internationalizeDialogToolTips(this); @@ -85,6 +89,7 @@ public void valueChanged(javax.swing.event.ListSelectionEvent evt) { moveButtonPanel.setLayout(new javax.swing.BoxLayout(moveButtonPanel, javax.swing.BoxLayout.Y_AXIS)); + upButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/exmaralda/folker/tangoicons/tango-icon-theme-0.8.1/16x16/actions/go-up.png"))); // NOI18N upButton.setText("Up"); upButton.setMaximumSize(new java.awt.Dimension(107, 27)); upButton.setMinimumSize(new java.awt.Dimension(107, 27)); @@ -96,6 +101,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); moveButtonPanel.add(upButton); + downButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/exmaralda/folker/tangoicons/tango-icon-theme-0.8.1/16x16/actions/go-down.png"))); // NOI18N downButton.setText("Down"); downButton.setMaximumSize(new java.awt.Dimension(107, 27)); downButton.setMinimumSize(new java.awt.Dimension(107, 27)); @@ -145,8 +151,10 @@ private void okButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIR // Add your handling code here: Vector result = new Vector(); for (int pos=0; pos +
@@ -11,6 +11,7 @@ + @@ -22,12 +23,12 @@ - + - + @@ -47,6 +48,22 @@ + + + + + + + + + + + + + + + + @@ -55,9 +72,25 @@ + + + + + + + + + + + + + + + + - + diff --git a/src/org/exmaralda/partitureditor/jexmaraldaswing/InterpolationDialog.java b/src/org/exmaralda/partitureditor/jexmaraldaswing/InterpolationDialog.java index 692db159..5a22a4f8 100644 --- a/src/org/exmaralda/partitureditor/jexmaraldaswing/InterpolationDialog.java +++ b/src/org/exmaralda/partitureditor/jexmaraldaswing/InterpolationDialog.java @@ -40,28 +40,42 @@ public boolean getLinearInterpolation(){ private void initComponents() { buttonGroup = new javax.swing.ButtonGroup(); - jPanel1 = new javax.swing.JPanel(); + mainPanel = new javax.swing.JPanel(); characterRadioButton = new javax.swing.JRadioButton(); + characterLabel = new javax.swing.JLabel(); linearRadioButton = new javax.swing.JRadioButton(); - jPanel2 = new javax.swing.JPanel(); + lienarLabel = new javax.swing.JLabel(); + okCancelPanel = new javax.swing.JPanel(); okButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Interpolation"); - jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS)); + mainPanel.setLayout(new javax.swing.BoxLayout(mainPanel, javax.swing.BoxLayout.Y_AXIS)); buttonGroup.add(characterRadioButton); characterRadioButton.setSelected(true); characterRadioButton.setText("Character Count Interpolation (clever)"); - jPanel1.add(characterRadioButton); + mainPanel.add(characterRadioButton); + + characterLabel.setFont(new java.awt.Font("Segoe UI", 2, 12)); // NOI18N + characterLabel.setForeground(javax.swing.UIManager.getDefaults().getColor("Actions.Blue")); + characterLabel.setText("Calculates missing time values
on the basis of character counts in the corresponding events"); + characterLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 20, 20, 1)); + mainPanel.add(characterLabel); buttonGroup.add(linearRadioButton); linearRadioButton.setText("Linear Interpolation (fast)"); - jPanel1.add(linearRadioButton); + mainPanel.add(linearRadioButton); + + lienarLabel.setFont(new java.awt.Font("Segoe UI", 2, 12)); // NOI18N + lienarLabel.setForeground(javax.swing.UIManager.getDefaults().getColor("Actions.Blue")); + lienarLabel.setText("Calculates missing time values
through linear interpolation between existing time values"); + lienarLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 20, 20, 1)); + mainPanel.add(lienarLabel); - getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); + getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER); okButton.setText("OK"); okButton.setMaximumSize(new java.awt.Dimension(65, 23)); @@ -72,7 +86,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); - jPanel2.add(okButton); + okCancelPanel.add(okButton); cancelButton.setText("Cancel"); cancelButton.addActionListener(new java.awt.event.ActionListener() { @@ -80,9 +94,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); - jPanel2.add(cancelButton); + okCancelPanel.add(cancelButton); - getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH); + getContentPane().add(okCancelPanel, java.awt.BorderLayout.SOUTH); pack(); }// //GEN-END:initComponents @@ -116,11 +130,13 @@ public void windowClosing(java.awt.event.WindowEvent e) { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup; private javax.swing.JButton cancelButton; + private javax.swing.JLabel characterLabel; private javax.swing.JRadioButton characterRadioButton; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; + private javax.swing.JLabel lienarLabel; private javax.swing.JRadioButton linearRadioButton; + private javax.swing.JPanel mainPanel; private javax.swing.JButton okButton; + private javax.swing.JPanel okCancelPanel; // End of variables declaration//GEN-END:variables } diff --git a/src/org/exmaralda/partitureditor/jexmaraldaswing/RecordingsListCellRenderer.java b/src/org/exmaralda/partitureditor/jexmaraldaswing/RecordingsListCellRenderer.java index 21c3b674..308471a4 100644 --- a/src/org/exmaralda/partitureditor/jexmaraldaswing/RecordingsListCellRenderer.java +++ b/src/org/exmaralda/partitureditor/jexmaraldaswing/RecordingsListCellRenderer.java @@ -4,9 +4,7 @@ */ package org.exmaralda.partitureditor.jexmaraldaswing; -import java.awt.Color; import java.awt.Component; -import java.awt.Font; import java.io.File; import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; diff --git a/src/org/exmaralda/partitureditor/jexmaraldaswing/TierListCellRenderer.java b/src/org/exmaralda/partitureditor/jexmaraldaswing/TierListCellRenderer.java new file mode 100644 index 00000000..3e9a2bea --- /dev/null +++ b/src/org/exmaralda/partitureditor/jexmaraldaswing/TierListCellRenderer.java @@ -0,0 +1,77 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package org.exmaralda.partitureditor.jexmaraldaswing; + +import java.awt.Color; +import java.awt.Component; +import java.io.File; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.BorderFactory; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.ListCellRenderer; +import javax.swing.border.Border; +import org.exmaralda.partitureditor.jexmaralda.BasicTranscription; +import org.exmaralda.partitureditor.jexmaralda.JexmaraldaException; +import org.exmaralda.partitureditor.jexmaralda.Tier; + +/** + * + * @author bernd + */ +public class TierListCellRenderer implements ListCellRenderer { + + DefaultListCellRenderer dflcr = new DefaultListCellRenderer(); + + BasicTranscription transcription; + + public TierListCellRenderer(BasicTranscription bt) { + transcription = bt; + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + Tier tier = (Tier)value; + JLabel resultLabel = (JLabel) dflcr.getListCellRendererComponent(list, tier.getDisplayName(), index, isSelected, cellHasFocus); + + String displayName = tier.getDisplayName(); + if (displayName==null){ + displayName = tier.getDescription(transcription.getHead().getSpeakertable()); + } + + String speakerLabel = "---"; + if (tier.getSpeaker()!=null){ + try { + speakerLabel = transcription.getHead().getSpeakertable().getSpeakerWithID(tier.getSpeaker()).getAbbreviation(); + } catch (JexmaraldaException ex) { + Logger.getLogger(TierListCellRenderer.class.getName()).log(Level.SEVERE, null, ex); + } + } + + String html = ""; + if (tier.getType().equals("t")) html+=""; + html+=""; + html+=displayName; + String color = "gray"; + if (isSelected) color="lightGray"; + html+=""; + if (tier.getType().equals("t")) html+=""; + html+="
"; + html+=speakerLabel + " [" + tier.getSpeaker() + "]" + " / " + tier.getCategory() + " [" + tier.getID() + "]"; + html+=""; + + Border outerBorder = BorderFactory.createMatteBorder(1, 0, 1, 0, Color.GRAY); + Border innerBorder = BorderFactory.createEmptyBorder(5,5,5,5); + Border combinedBorder = BorderFactory.createCompoundBorder(outerBorder, innerBorder); + resultLabel.setBorder(combinedBorder); + resultLabel.setText(html); + return resultLabel; + + } +} + diff --git a/src/org/exmaralda/partitureditor/jexmaraldaswing/TierListModel.java b/src/org/exmaralda/partitureditor/jexmaraldaswing/TierListModel.java new file mode 100644 index 00000000..f052a345 --- /dev/null +++ b/src/org/exmaralda/partitureditor/jexmaraldaswing/TierListModel.java @@ -0,0 +1,41 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package org.exmaralda.partitureditor.jexmaraldaswing; + +import javax.swing.AbstractListModel; +import org.exmaralda.partitureditor.jexmaralda.BasicTranscription; + +/** + * + * @author bernd + */ +public class TierListModel extends AbstractListModel { + + BasicTranscription basicTranscription; + + public TierListModel(BasicTranscription basicTranscription) { + this.basicTranscription = basicTranscription; + } + + + + + + @Override + public int getSize() { + return basicTranscription.getBody().getNumberOfTiers(); + } + + @Override + public Object getElementAt(int index) { + return basicTranscription.getBody().getTierAt(index); + } + + void swap(int i, int j) { + basicTranscription.getBody().swapTiers(i, j); + this.fireContentsChanged(this, i, j); + } + +} diff --git a/src/org/exmaralda/partitureditor/jexmaraldaswing/TierSelectionDialog.java b/src/org/exmaralda/partitureditor/jexmaraldaswing/TierSelectionDialog.java index 6190d89d..ec02afcb 100644 --- a/src/org/exmaralda/partitureditor/jexmaraldaswing/TierSelectionDialog.java +++ b/src/org/exmaralda/partitureditor/jexmaraldaswing/TierSelectionDialog.java @@ -10,7 +10,6 @@ import org.exmaralda.partitureditor.jexmaralda.JexmaraldaException; import org.exmaralda.partitureditor.jexmaralda.BasicTranscription; import javax.swing.*; -import org.exmaralda.partitureditor.jexmaralda.*; /** * diff --git a/src/org/exmaralda/partitureditor/partiture/BasicTranscriptionTableModel.java b/src/org/exmaralda/partitureditor/partiture/BasicTranscriptionTableModel.java index 9caf843e..6ac0699c 100644 --- a/src/org/exmaralda/partitureditor/partiture/BasicTranscriptionTableModel.java +++ b/src/org/exmaralda/partitureditor/partiture/BasicTranscriptionTableModel.java @@ -642,7 +642,9 @@ public void moveRight(int row, int col){ } /** moves the corresponding cell one column to the right - or: shifts the corresponding event backwards in the timeline */ + or: shifts the corresponding event backwards in the timeline + * @param row + * @param col */ public void moveLeft (int row, int col){ Tier tier = transcription.getBody().getTierAt(row); String tli = transcription.getBody().getCommonTimeline().getTimelineItemAt(col).getID(); @@ -968,38 +970,45 @@ public int[] insertInterval(double start, double end, double tolerance) { /** throws out all timeline items whose absolute - * time values do not fit into a monotonously increasing sequence */ - public void makeTimelineConsistent(){ - transcription.getBody().getCommonTimeline().makeConsistent(); - fireColumnLabelsChanged(); + * time values do not fit into a monotonously increasing sequence + * @return */ + public int makeTimelineConsistent(){ + int count = transcription.getBody().getCommonTimeline().makeConsistent(); + fireColumnLabelsChanged(); + return count; } /** removes all timeline items that are neither the start nor the - * end point of any event */ - public void removeUnusedTimelineItems(){ + * end point of any event + * @return */ + public int removeUnusedTimelineItems(){ int before = transcription.getBody().getCommonTimeline().getNumberOfTimelineItems(); - transcription.getBody().removeUnusedTimelineItems(); + int countRemoved = transcription.getBody().removeUnusedTimelineItems(); int after = transcription.getBody().getCommonTimeline().getNumberOfTimelineItems(); if (before!=after){ fireDataReset(); } + return countRemoved; } - public void removeUnusedTimelineItems(int selectionStartCol, int selectionEndCol) { + public int removeUnusedTimelineItems(int selectionStartCol, int selectionEndCol) { int before = transcription.getBody().getCommonTimeline().getNumberOfTimelineItems(); - transcription.getBody().removeUnusedTimelineItems(selectionStartCol, selectionEndCol); + int countRemoved = transcription.getBody().removeUnusedTimelineItems(selectionStartCol, selectionEndCol); int after = transcription.getBody().getCommonTimeline().getNumberOfTimelineItems(); if (before!=after){ fireDataReset(); } + return countRemoved; } /** removes the absolute time values that have come about - * by interpolation */ - public void removeInterpolatedTimes(){ - transcription.getBody().getCommonTimeline().removeInterpolatedTimes(); + * by interpolation + * @return */ + public int removeInterpolatedTimes(){ + int count = transcription.getBody().getCommonTimeline().removeInterpolatedTimes(); fireColumnLabelsChanged(); + return count; } public void removeTimes() { @@ -1021,7 +1030,7 @@ public void editTimelineItem(int col, TimelineItem newTimelineItem){ public void editBookmark(int col, TimelineItem newTimelineItem){ TimelineItem tli = transcription.getBody().getCommonTimeline().getTimelineItemAt(col); tli.setBookmark(newTimelineItem.getBookmark()); - fireColumnLabelChanged(col); + fireColumnLabelChanged(col); } public void confirmTimelineItems(int startCol, int endCol) { @@ -1038,10 +1047,12 @@ public void completeTimeline(){ completeTimeline(true); } - /** interpolates absolute time values on the timeline */ - public void completeTimeline(boolean linear){ - transcription.getBody().getCommonTimeline().completeTimes(linear, getTranscription()); + /** interpolates absolute time values on the timeline + * @param linear */ + public int completeTimeline(boolean linear){ + int countChanged = transcription.getBody().getCommonTimeline().completeTimes(linear, getTranscription()); fireColumnLabelsChanged(); + return countChanged; } public void anchorTimeline(double first, double last) { @@ -1066,7 +1077,8 @@ public void scaleTimes(double factor) { } - /** removes the gap at the specified position */ + /** removes the gap at the specified position + * @param col */ public void removeGap(int col){ String tli = transcription.getBody().getCommonTimeline().getTimelineItemAt(col).getID(); transcription.getBody().removeGap(tli); @@ -1074,15 +1086,18 @@ public void removeGap(int col){ fireSelectionChanged(0,col,false); } - /** removes all gaps from the transcription */ - public void removeAllGaps(){ - transcription.getBody().removeAllGaps(); + /** removes all gaps from the transcription + * @return */ + public int removeAllGaps(){ + int count = transcription.getBody().removeAllGaps(); fireDataReset(); + return count; } - public void smoothTimeline(double threshhold) { - transcription.getBody().smoothTimeline(threshhold); + public int smoothTimeline(double threshhold) { + int count = transcription.getBody().smoothTimeline(threshhold); fireDataReset(); + return count; } diff --git a/src/org/exmaralda/partitureditor/partiture/PartitureTableWithActions.java b/src/org/exmaralda/partitureditor/partiture/PartitureTableWithActions.java index cb1d1833..c51d57a6 100644 --- a/src/org/exmaralda/partitureditor/partiture/PartitureTableWithActions.java +++ b/src/org/exmaralda/partitureditor/partiture/PartitureTableWithActions.java @@ -965,6 +965,7 @@ public void insertPause() { editor.replaceSelection(pauseText); // new 17-11-2017: issue #122 editor.requestFocus(); + status("Inserted pause [" + selectionStartRow + "/" + selectionStartCol + "]"); } else { // 1. find the nn tier Tier nn_t = null; @@ -1024,7 +1025,9 @@ public void insertPause() { nn_t.addEvent(newEvent); int row = getModel().getTranscription().getBody().lookupID(nn_t.getID()); - getModel().fireEventAdded(row, col1, col2); + getModel().fireEventAdded(row, col1, col2); + status("Inserted pause in new event [" + row + "/" + col1 + "]"); + makeColumnVisible(col1+1); setNewSelection(row, col1, true); diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/DeleteEventAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/DeleteEventAction.java index 63d1eb9c..8cbd6001 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/DeleteEventAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/DeleteEventAction.java @@ -61,6 +61,7 @@ private void deleteEvent(){ // end undo information } table.getModel().deleteEvent(table.selectionStartRow, table.selectionStartCol); + table.status("Deleted event [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); } } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/DeleteEventsAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/DeleteEventsAction.java index 27671967..37188f6c 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/DeleteEventsAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/DeleteEventsAction.java @@ -71,6 +71,8 @@ private void deleteEvents(){ table.selectionStartCol, table.selectionEndCol ); + table.status("Deleted events [" + table.selectionStartRow + "-" + table.selectionEndRow + "/" + table.selectionStartCol + "-" + table.selectionEndCol + "]"); + } } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/DoubleSplitAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/DoubleSplitAction.java index e93b104c..6a8b5557 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/DoubleSplitAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/DoubleSplitAction.java @@ -61,6 +61,8 @@ private void doubleSplit(){ // end undo information } table.getModel().doubleSplit(table.selectionStartRow, table.selectionStartCol, pos1, pos2); + table.status("Double split event [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); + } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/EditEventAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/EditEventAction.java index 8674a503..f503bda2 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/EditEventAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/EditEventAction.java @@ -48,6 +48,7 @@ private void editEvent(){ boolean done = table.getModel().editEvent(table.selectionStartRow, table.selectionStartCol, table.parent, table.generalPurposeFontName); if (done){ table.addUndo(undoEditCellInfo); + table.status("Edited event [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); } } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/ExtendLeftAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/ExtendLeftAction.java index 3d596bf9..93422593 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/ExtendLeftAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/ExtendLeftAction.java @@ -18,13 +18,19 @@ */ public class ExtendLeftAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of ExtendLeftAction */ + /** Creates a new instance of ExtendLeftAction + * @param t + * @param icon */ public ExtendLeftAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Extend to the left", icon, t); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control shift LEFT")); } - + /** + * + * @param actionEvent + */ + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("extendLeftAction!"); extendLeft(); @@ -45,6 +51,7 @@ private void extendLeft(){ // end undo information } table.getModel().extendLeft(table.selectionStartRow, table.selectionStartCol); + table.status("Left extended event [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/ExtendRightAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/ExtendRightAction.java index c4349e97..df169fa5 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/ExtendRightAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/ExtendRightAction.java @@ -7,12 +7,8 @@ package org.exmaralda.partitureditor.partiture.eventActions; import org.exmaralda.partitureditor.partiture.*; -import org.exmaralda.partitureditor.jexmaralda.*; -import org.exmaralda.partitureditor.jexmaraldaswing.*; import javax.swing.Action; import javax.swing.KeyStroke; -import java.awt.event.KeyEvent; -import java.awt.Toolkit; import org.exmaralda.partitureditor.partiture.undo.UndoInformation; @@ -22,13 +18,16 @@ */ public class ExtendRightAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of ExtendRightAction */ + /** Creates a new instance of ExtendRightAction + * @param t + * @param icon */ public ExtendRightAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Extend to the right", icon, t); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control shift RIGHT")); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("extendRightAction!"); extendRight(); @@ -48,6 +47,8 @@ private void extendRight(){ // end undo information } table.getModel().extendRight(table.selectionStartRow, table.selectionStartCol); + table.status("Right extended event [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); + } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/MergeAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/MergeAction.java index 4e5652fb..bec22c0a 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/MergeAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/MergeAction.java @@ -49,6 +49,8 @@ private void merge(){ // end undo information } table.getModel().merge(table.selectionStartRow, table.selectionEndRow, table.selectionStartCol, table.selectionEndCol); + table.status("Merged events [" + table.selectionStartRow + "-" + table.selectionEndRow + "/" + table.selectionStartCol + "-" + table.selectionEndCol + "]"); + int r = table.selectionStartRow; int c = table.selectionStartCol; if (table.AUTO_REMOVE_UNUSED_TLI){ diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/MoveEventAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/MoveEventAction.java index d91fd956..3d4cd51a 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/MoveEventAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/MoveEventAction.java @@ -65,7 +65,9 @@ private void move(){ // end undo information } try { - table.getModel().moveToTier(sourceTierID, targetTierID, startID, endID); + table.getModel().moveToTier(sourceTierID, targetTierID, startID, endID); + table.status("Moved event [" + table.selectionStartRow + "/" + table.selectionStartCol + "] from " + sourceTierID + " to " + targetTierID); + } catch (JexmaraldaException ex) { Logger.getLogger(MoveEventAction.class.getName()).log(Level.SEVERE, null, ex); } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/MoveLeftAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/MoveLeftAction.java index d1c52117..c041fae8 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/MoveLeftAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/MoveLeftAction.java @@ -7,12 +7,8 @@ package org.exmaralda.partitureditor.partiture.eventActions; import org.exmaralda.partitureditor.partiture.*; -import org.exmaralda.partitureditor.jexmaralda.*; -import org.exmaralda.partitureditor.jexmaraldaswing.*; import javax.swing.Action; import javax.swing.KeyStroke; -import java.awt.event.KeyEvent; -import java.awt.Toolkit; import org.exmaralda.partitureditor.partiture.undo.UndoInformation; /** @@ -21,13 +17,16 @@ */ public class MoveLeftAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of MoveLeftAction */ + /** Creates a new instance of MoveLeftAction + * @param t + * @param icon */ public MoveLeftAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Move to the left", icon, t); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control LEFT")); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("moveLeftAction!"); moveLeft(); @@ -48,6 +47,8 @@ private void moveLeft(){ // end undo information } table.getModel().moveLeft(table.selectionStartRow, table.selectionStartCol); + table.status("Moved event left [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); + } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/MoveRightAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/MoveRightAction.java index 38b53fb7..964a327e 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/MoveRightAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/MoveRightAction.java @@ -7,12 +7,8 @@ package org.exmaralda.partitureditor.partiture.eventActions; import org.exmaralda.partitureditor.partiture.*; -import org.exmaralda.partitureditor.jexmaralda.*; -import org.exmaralda.partitureditor.jexmaraldaswing.*; import javax.swing.Action; import javax.swing.KeyStroke; -import java.awt.event.KeyEvent; -import java.awt.Toolkit; import org.exmaralda.partitureditor.partiture.undo.UndoInformation; /** @@ -21,13 +17,16 @@ */ public class MoveRightAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of MoveRightAction */ + /** Creates a new instance of MoveRightAction + * @param t + * @param icon */ public MoveRightAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Move to the right", icon, t); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control RIGHT")); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("moveRightAction!"); moveRight(); @@ -47,6 +46,8 @@ private void moveRight(){ // end undo information } table.getModel().moveRight(table.selectionStartRow, table.selectionStartCol); + table.status("Moved event right [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); + } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/ShiftLeftAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/ShiftLeftAction.java index 823999ee..5db15c4c 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/ShiftLeftAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/ShiftLeftAction.java @@ -7,12 +7,8 @@ package org.exmaralda.partitureditor.partiture.eventActions; import org.exmaralda.partitureditor.partiture.*; -import org.exmaralda.partitureditor.jexmaralda.*; -import org.exmaralda.partitureditor.jexmaraldaswing.*; import javax.swing.Action; import javax.swing.KeyStroke; -import java.awt.event.KeyEvent; -import java.awt.Toolkit; import org.exmaralda.partitureditor.partiture.undo.UndoInformation; /** @@ -21,13 +17,16 @@ */ public class ShiftLeftAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of ShiftLeftAction */ + /** Creates a new instance of ShiftLeftAction + * @param t + * @param icon */ public ShiftLeftAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Shift characters to the left", icon, t); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control shift L")); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("shiftLeftAction!"); shiftLeft(); @@ -49,6 +48,8 @@ private void shiftLeft(){ //// end undo information } table.getModel().shiftLeft(table.selectionStartRow, table.selectionStartCol, pos); + table.status("Shifted characters left [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); + } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/ShiftRightAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/ShiftRightAction.java index 14681c54..c5209d41 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/ShiftRightAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/ShiftRightAction.java @@ -7,12 +7,8 @@ package org.exmaralda.partitureditor.partiture.eventActions; import org.exmaralda.partitureditor.partiture.*; -import org.exmaralda.partitureditor.jexmaralda.*; -import org.exmaralda.partitureditor.jexmaraldaswing.*; import javax.swing.Action; import javax.swing.KeyStroke; -import java.awt.event.KeyEvent; -import java.awt.Toolkit; import org.exmaralda.partitureditor.partiture.undo.UndoInformation; /** @@ -21,13 +17,16 @@ */ public class ShiftRightAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of ShiftRightAction */ + /** Creates a new instance of ShiftRightAction + * @param t + * @param icon */ public ShiftRightAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Shift characters to the right", icon, t); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control shift R")); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("shiftRightAction!"); shiftRight(); @@ -48,6 +47,8 @@ private void shiftRight(){ // end undo information } table.getModel().shiftRight(table.selectionStartRow, table.selectionStartCol, pos); + table.status("Shifted characters right [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); + } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/ShrinkLeftAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/ShrinkLeftAction.java index a1fba005..e7e2dacf 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/ShrinkLeftAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/ShrinkLeftAction.java @@ -7,12 +7,8 @@ package org.exmaralda.partitureditor.partiture.eventActions; import org.exmaralda.partitureditor.partiture.*; -import org.exmaralda.partitureditor.jexmaralda.*; -import org.exmaralda.partitureditor.jexmaraldaswing.*; import javax.swing.Action; import javax.swing.KeyStroke; -import java.awt.event.KeyEvent; -import java.awt.Toolkit; import org.exmaralda.partitureditor.partiture.undo.UndoInformation; /** @@ -21,13 +17,16 @@ */ public class ShrinkLeftAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of ShrinkLeftAction */ + /** Creates a new instance of ShrinkLeftAction + * @param t + * @param icon */ public ShrinkLeftAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Shrink on the left", icon, t); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control alt LEFT")); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("shrinkLeftAction!"); shrinkLeft(); @@ -48,6 +47,8 @@ private void shrinkLeft(){ // end undo information } table.getModel().shrinkLeft(table.selectionStartRow, table.selectionStartCol); + table.status("Shrunk event left [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); + } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/ShrinkRightAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/ShrinkRightAction.java index 92d9d5fc..4813740b 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/ShrinkRightAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/ShrinkRightAction.java @@ -7,12 +7,8 @@ package org.exmaralda.partitureditor.partiture.eventActions; import org.exmaralda.partitureditor.partiture.*; -import org.exmaralda.partitureditor.jexmaralda.*; -import org.exmaralda.partitureditor.jexmaraldaswing.*; import javax.swing.Action; import javax.swing.KeyStroke; -import java.awt.event.KeyEvent; -import java.awt.Toolkit; import org.exmaralda.partitureditor.partiture.undo.UndoInformation; /** @@ -21,13 +17,16 @@ */ public class ShrinkRightAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of ShrinkRightAction */ + /** Creates a new instance of ShrinkRightAction + * @param t + * @param icon */ public ShrinkRightAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Shrink on the right", icon, t); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control alt RIGHT")); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("shrinkRightAction!"); shrinkRight(); @@ -47,6 +46,8 @@ private void shrinkRight(){ // end undo information } table.getModel().shrinkRight(table.selectionStartRow, table.selectionStartCol); + table.status("Shrunk event right [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); + } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/SplitAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/SplitAction.java index 54c8a799..cdc4474d 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/SplitAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/SplitAction.java @@ -7,12 +7,8 @@ package org.exmaralda.partitureditor.partiture.eventActions; import org.exmaralda.partitureditor.partiture.*; -import org.exmaralda.partitureditor.jexmaralda.*; -import org.exmaralda.partitureditor.jexmaraldaswing.*; import javax.swing.Action; import javax.swing.KeyStroke; -import java.awt.event.KeyEvent; -import java.awt.Toolkit; import org.exmaralda.partitureditor.partiture.undo.UndoInformation; /** @@ -21,13 +17,16 @@ */ public class SplitAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of SplitAction */ + /** Creates a new instance of SplitAction + * @param t + * @param icon */ public SplitAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Split", icon, t); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control 2")); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("splitAction!"); split(); @@ -49,6 +48,8 @@ private void split(){ // end undo information } table.getModel().split(table.selectionStartRow, table.selectionStartCol, pos, table.parent); + table.status("Split event [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); + } diff --git a/src/org/exmaralda/partitureditor/partiture/eventActions/SplitLongEventAction.java b/src/org/exmaralda/partitureditor/partiture/eventActions/SplitLongEventAction.java index 41acb8ef..dd1c09fb 100644 --- a/src/org/exmaralda/partitureditor/partiture/eventActions/SplitLongEventAction.java +++ b/src/org/exmaralda/partitureditor/partiture/eventActions/SplitLongEventAction.java @@ -62,7 +62,9 @@ private void splitLongEvent(){ // end undo information } int splitPosition = dialog.getCursorPosition(); - table.getModel().split(table.selectionStartRow, table.selectionStartCol, splitPosition, table.parent); + table.getModel().split(table.selectionStartRow, table.selectionStartCol, splitPosition, table.parent); + table.status("Split long event [" + table.selectionStartRow + "/" + table.selectionStartCol + "]"); + } } catch (JexmaraldaException ex) { diff --git a/src/org/exmaralda/partitureditor/partiture/tierActions/AddTierAction.java b/src/org/exmaralda/partitureditor/partiture/tierActions/AddTierAction.java index 35ef3956..575d1819 100644 --- a/src/org/exmaralda/partitureditor/partiture/tierActions/AddTierAction.java +++ b/src/org/exmaralda/partitureditor/partiture/tierActions/AddTierAction.java @@ -20,7 +20,9 @@ */ public class AddTierAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of AddTierAction */ + /** Creates a new instance of AddTierAction + * @param t + * @param icon */ public AddTierAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Add tier...", icon, t); this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); @@ -61,6 +63,7 @@ private void addTier(){ } } table.getModel().addTier(newTier); + table.status("Added tier: " + newTier.getDisplayName()); } } diff --git a/src/org/exmaralda/partitureditor/partiture/tierActions/ChangeTierOrderAction.java b/src/org/exmaralda/partitureditor/partiture/tierActions/ChangeTierOrderAction.java index ef1a6649..709c6301 100644 --- a/src/org/exmaralda/partitureditor/partiture/tierActions/ChangeTierOrderAction.java +++ b/src/org/exmaralda/partitureditor/partiture/tierActions/ChangeTierOrderAction.java @@ -8,8 +8,6 @@ import org.exmaralda.partitureditor.jexmaraldaswing.EditTierOrderDialog; import org.exmaralda.partitureditor.partiture.*; -import org.exmaralda.partitureditor.jexmaralda.*; -import org.exmaralda.partitureditor.jexmaraldaswing.*; import org.exmaralda.partitureditor.partiture.undo.UndoInformation; /** @@ -18,11 +16,14 @@ */ public class ChangeTierOrderAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of ChangeTierOrderAction */ + /** Creates a new instance of ChangeTierOrderAction + * @param t + * @param icon */ public ChangeTierOrderAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Change tier order...", icon, t); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("changeTierOrderAction!"); table.commitEdit(true); @@ -40,6 +41,7 @@ private void changeTierOrder(){ table.addUndo(undoInfo); } table.getModel().changeTierOrder(dialog.getTierOrder()); + table.status("Tier order changed"); } } diff --git a/src/org/exmaralda/partitureditor/partiture/tierActions/EditTierAction.java b/src/org/exmaralda/partitureditor/partiture/tierActions/EditTierAction.java index 9ae889ba..ab75032b 100644 --- a/src/org/exmaralda/partitureditor/partiture/tierActions/EditTierAction.java +++ b/src/org/exmaralda/partitureditor/partiture/tierActions/EditTierAction.java @@ -9,7 +9,6 @@ import org.exmaralda.partitureditor.jexmaraldaswing.EditTierDialog; import org.exmaralda.partitureditor.partiture.*; import org.exmaralda.partitureditor.jexmaralda.*; -import org.exmaralda.partitureditor.jexmaraldaswing.*; import org.exmaralda.partitureditor.partiture.undo.UndoInformation; /** @@ -18,11 +17,14 @@ */ public class EditTierAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of EditTierAction */ + /** Creates a new instance of EditTierAction + * @param t + * @param icon */ public EditTierAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Tier properties...", icon, t); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("editTierAction!"); table.commitEdit(true); @@ -42,6 +44,7 @@ private void editTier(){ table.addUndo(undoInfo); } table.getModel().editTier(table.selectionStartRow, dialog.getTier()); + table.status("Tier " + dialog.getTier().getDisplayName() + " edited"); } } diff --git a/src/org/exmaralda/partitureditor/partiture/tierActions/HideTierAction.java b/src/org/exmaralda/partitureditor/partiture/tierActions/HideTierAction.java index b3ccb749..2222484a 100644 --- a/src/org/exmaralda/partitureditor/partiture/tierActions/HideTierAction.java +++ b/src/org/exmaralda/partitureditor/partiture/tierActions/HideTierAction.java @@ -35,6 +35,7 @@ private void hideTier(){ table.hideRow(row); } table.getModel().fireAreaChanged(0, table.getModel().getNumColumns()); + table.status("Tiers [" + table.selectionStartRow + "-" + table.selectionEndRow + "] hidden"); } diff --git a/src/org/exmaralda/partitureditor/partiture/tierActions/InsertTierAction.java b/src/org/exmaralda/partitureditor/partiture/tierActions/InsertTierAction.java index 488aea64..2acc9062 100644 --- a/src/org/exmaralda/partitureditor/partiture/tierActions/InsertTierAction.java +++ b/src/org/exmaralda/partitureditor/partiture/tierActions/InsertTierAction.java @@ -21,7 +21,9 @@ */ public class InsertTierAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of InsertTierAction */ + /** Creates a new instance of InsertTierAction + * @param t + * @param icon */ public InsertTierAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Insert tier...", icon, t); this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_I, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); @@ -61,6 +63,7 @@ private void insertTier(){ } } table.getModel().insertTier(newTier, row); + table.status("Inserted tier: " + newTier.getDisplayName()); if (row<=table.getFrameEndPosition()){ table.setFrameEndPosition(table.getFrameEndPosition()+1); } diff --git a/src/org/exmaralda/partitureditor/partiture/tierActions/MoveTierUpAction.java b/src/org/exmaralda/partitureditor/partiture/tierActions/MoveTierUpAction.java index 5d195529..c39c10c3 100644 --- a/src/org/exmaralda/partitureditor/partiture/tierActions/MoveTierUpAction.java +++ b/src/org/exmaralda/partitureditor/partiture/tierActions/MoveTierUpAction.java @@ -16,12 +16,15 @@ */ public class MoveTierUpAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of MoveTierUpAction */ + /** Creates a new instance of MoveTierUpAction + * @param t + * @param icon */ public MoveTierUpAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Move tier upwards", icon, t); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control UP")); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("moveTierUpAction!"); table.commitEdit(true); @@ -37,6 +40,7 @@ private void moveTierUp(){ table.addUndo(undoInfo); } table.getModel().moveTierUp(table.selectionStartRow); + table.status("Tier " + table.selectionStartRow + " moved up"); } diff --git a/src/org/exmaralda/partitureditor/partiture/tierActions/RemoveEmptyEventsAction.java b/src/org/exmaralda/partitureditor/partiture/tierActions/RemoveEmptyEventsAction.java index f84b7259..88e75433 100644 --- a/src/org/exmaralda/partitureditor/partiture/tierActions/RemoveEmptyEventsAction.java +++ b/src/org/exmaralda/partitureditor/partiture/tierActions/RemoveEmptyEventsAction.java @@ -15,11 +15,13 @@ */ public class RemoveEmptyEventsAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of RemoveEmptyEventsAction */ + /** Creates a new instance of RemoveEmptyEventsAction + * @param t */ public RemoveEmptyEventsAction(PartitureTableWithActions t) { super("Remove empty events", t); } + @Override public void actionPerformed(java.awt.event.ActionEvent actionEvent) { System.out.println("removeEmptyEventsAction!"); table.commitEdit(true); @@ -33,6 +35,8 @@ private void removeEmptyEvents(){ table.addUndo(undoInfo); } table.getModel().removeEmptyEvents(table.selectionStartRow); + table.status("Empty events in tiers " + table.selectionStartRow + " removed"); + } } diff --git a/src/org/exmaralda/partitureditor/partiture/tierActions/RemoveTierAction.java b/src/org/exmaralda/partitureditor/partiture/tierActions/RemoveTierAction.java index e14b1fb9..9fa19c49 100644 --- a/src/org/exmaralda/partitureditor/partiture/tierActions/RemoveTierAction.java +++ b/src/org/exmaralda/partitureditor/partiture/tierActions/RemoveTierAction.java @@ -49,6 +49,7 @@ private void removeTier(){ if (!aSeriesOfRowsIsSelected){ int row = table.selectionStartRow; table.getModel().removeTier(row); + table.status("Tier " + row + " removed"); if (row <= table.getFrameEndPosition()){ table.setFrameEndPosition(table.getFrameEndPosition()-1); table.getModel().fireRowLabelsFormatChanged(); @@ -58,11 +59,13 @@ private void removeTier(){ int firstRow = table.selectionStartRow; int lastRow = table.selectionEndRow; table.getModel().removeTiers(firstRow, lastRow); + table.status("Tiers " + firstRow + "-" + lastRow + " removed"); if (firstRow <= table.getFrameEndPosition()){ table.setFrameEndPosition(table.getFrameEndPosition() - (Math.min(table.getFrameEndPosition(), lastRow) - firstRow +1)); table.getModel().fireRowLabelsFormatChanged(); } } + } } diff --git a/src/org/exmaralda/partitureditor/partiture/tierActions/ShowAllTiersAction.java b/src/org/exmaralda/partitureditor/partiture/tierActions/ShowAllTiersAction.java index 51d2e82f..6c7a8577 100644 --- a/src/org/exmaralda/partitureditor/partiture/tierActions/ShowAllTiersAction.java +++ b/src/org/exmaralda/partitureditor/partiture/tierActions/ShowAllTiersAction.java @@ -14,7 +14,9 @@ */ public class ShowAllTiersAction extends org.exmaralda.partitureditor.partiture.AbstractTableAction { - /** Creates a new instance of ShowAllTiersAction */ + /** Creates a new instance of ShowAllTiersAction + * @param t + * @param icon */ public ShowAllTiersAction(PartitureTableWithActions t, javax.swing.ImageIcon icon) { super("Show all tiers", icon, t); } @@ -27,6 +29,7 @@ public void actionPerformed(java.awt.event.ActionEvent actionEvent) { for (int i=0; i