Added attention flag

This commit is contained in:
2018-10-04 00:26:16 +01:00
parent 498247c793
commit ced0aaa597
6 changed files with 44 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

After

Width:  |  Height:  |  Size: 1023 B

View File

@@ -75,6 +75,7 @@ public class AudiobookRecorder extends JFrame {
JSpinner postSentenceGap;
JCheckBox locked;
JCheckBox attention;
JButtonSpacePlay reprocessAudioFFT;
JButtonSpacePlay reprocessAudioPeak;
@@ -402,9 +403,29 @@ public class AudiobookRecorder extends JFrame {
bookTreeModel.reload(selectedSentence);
}
});
controlsTop.add(locked);
attention = new JCheckBox("Flag for attention");
attention.setFocusable(false);
attention.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JCheckBox c = (JCheckBox)e.getSource();
if (c.isSelected()) {
if (selectedSentence != null) {
selectedSentence.setAttentionFlag(true);
}
} else {
if (selectedSentence != null) {
selectedSentence.setAttentionFlag(false);
}
}
bookTreeModel.reload(selectedSentence);
}
});
controlsTop.add(attention);
controlsTop.add(Box.createHorizontalGlue());
controlsTop.add(new JLabel("Post gap:"));
controlsTop.add(postSentenceGap);
@@ -1287,6 +1308,7 @@ public class AudiobookRecorder extends JFrame {
prefs.setProperty(String.format("%s.sentence.%08d.start-offset", keybase, i), Integer.toString(snt.getStartOffset()));
prefs.setProperty(String.format("%s.sentence.%08d.end-offset", keybase, i), Integer.toString(snt.getEndOffset()));
prefs.setProperty(String.format("%s.sentence.%08d.locked", keybase, i), snt.isLocked() ? "true" : "false");
prefs.setProperty(String.format("%s.sentence.%08d.attention", keybase, i), snt.getAttentionFlag() ? "true" : "false");
i++;
}
}
@@ -1394,6 +1416,7 @@ public class AudiobookRecorder extends JFrame {
sampleWaveform.setAltMarkers(s.getStartCrossing(), s.getEndCrossing());
postSentenceGap.setValue(s.getPostGap());
locked.setSelected(s.isLocked());
attention.setSelected(s.getAttentionFlag());
postSentenceGap.setEnabled(!s.isLocked());
reprocessAudioFFT.setEnabled(!s.isLocked());
@@ -1403,6 +1426,7 @@ public class AudiobookRecorder extends JFrame {
sampleWaveform.clearData();
postSentenceGap.setValue(0);
locked.setSelected(false);
attention.setSelected(false);
}
}
});
@@ -1441,6 +1465,7 @@ public class AudiobookRecorder extends JFrame {
s.setStartOffset(Utils.s2i(prefs.getProperty(String.format("chapter.audition.sentence.%08d.start-offset", i))));
s.setEndOffset(Utils.s2i(prefs.getProperty(String.format("chapter.audition.sentence.%08d.end-offset", i))));
s.setLocked(Utils.s2b(prefs.getProperty(String.format("chapter.audition.sentence.%08d.locked", i))));
s.setAttentionFlag(Utils.s2b(prefs.getProperty(String.format("chapter.audition.sentence.%08d.attention", i))));
bookTreeModel.insertNodeInto(s, c, c.getChildCount());
}
@@ -1459,6 +1484,7 @@ public class AudiobookRecorder extends JFrame {
s.setStartOffset(Utils.s2i(prefs.getProperty(String.format("chapter.open.sentence.%08d.start-offset", i))));
s.setEndOffset(Utils.s2i(prefs.getProperty(String.format("chapter.open.sentence.%08d.end-offset", i))));
s.setLocked(Utils.s2b(prefs.getProperty(String.format("chapter.open.sentence.%08d.locked", i))));
s.setAttentionFlag(Utils.s2b(prefs.getProperty(String.format("chapter.open.sentence.%08d.attention", i))));
bookTreeModel.insertNodeInto(s, c, c.getChildCount());
}
@@ -1483,6 +1509,7 @@ public class AudiobookRecorder extends JFrame {
s.setStartOffset(Utils.s2i(prefs.getProperty(String.format("chapter.%04d.sentence.%08d.start-offset", cno, i))));
s.setEndOffset(Utils.s2i(prefs.getProperty(String.format("chapter.%04d.sentence.%08d.end-offset", cno, i))));
s.setLocked(Utils.s2b(prefs.getProperty(String.format("chapter.%04d.sentence.%08d.locked", cno, i))));
s.setAttentionFlag(Utils.s2b(prefs.getProperty(String.format("chapter.%04d.sentence.%08d.attention", cno, i))));
bookTreeModel.insertNodeInto(s, c, c.getChildCount());
}
}
@@ -1502,6 +1529,7 @@ public class AudiobookRecorder extends JFrame {
s.setStartOffset(Utils.s2i(prefs.getProperty(String.format("chapter.close.sentence.%08d.start-offset", i))));
s.setEndOffset(Utils.s2i(prefs.getProperty(String.format("chapter.close.sentence.%08d.end-offset", i))));
s.setLocked(Utils.s2b(prefs.getProperty(String.format("chapter.close.sentence.%08d.locked", i))));
s.setAttentionFlag(Utils.s2b(prefs.getProperty(String.format("chapter.close.sentence.%08d.attention", i))));
bookTreeModel.insertNodeInto(s, c, c.getChildCount());
}

View File

@@ -11,8 +11,11 @@ public class BookTreeRenderer extends DefaultTreeCellRenderer {
if (value instanceof Sentence) {
Sentence s = (Sentence)value;
if (s.isLocked()) {
ret.setForeground(new Color(0x20, 0x00, 0x00));
if (s.getAttentionFlag()) {
ret.setForeground(new Color(0xFF, 0xFF, 0x00));
ret.setIcon(Icons.attention);
} else if (s.isLocked()) {
ret.setForeground(new Color(0x00, 0x80, 0x00));
ret.setIcon(Icons.locked);
} else if (s.getStartOffset() == 0) {
ret.setIcon(Icons.important);

View File

@@ -31,4 +31,5 @@ public class Icons {
static public final ImageIcon zoomIn = new ImageIcon(Icons.class.getResource("icons/zoom-in.png"));
static public final ImageIcon zoomOut = new ImageIcon(Icons.class.getResource("icons/zoom-out.png"));
static public final ImageIcon dollar = new ImageIcon(Icons.class.getResource("icons/dollar.png"));
static public final ImageIcon attention = new ImageIcon(Icons.class.getResource("icons/attention.png"));
}

View File

@@ -32,6 +32,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
boolean recording;
boolean inSample;
boolean attention = false;
TargetDataLine line;
AudioInputStream inputStream;
@@ -732,4 +733,12 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
sentence.updateCrossings();
return sentence;
}
public void setAttentionFlag(boolean f) {
attention = f;
}
public boolean getAttentionFlag() {
return attention;
}
}