Added attention flag
This commit is contained in:
BIN
resources/uk/co/majenko/audiobookrecorder/icons/attention.png
Normal file
BIN
resources/uk/co/majenko/audiobookrecorder/icons/attention.png
Normal file
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 |
@@ -75,6 +75,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
|
|
||||||
JSpinner postSentenceGap;
|
JSpinner postSentenceGap;
|
||||||
JCheckBox locked;
|
JCheckBox locked;
|
||||||
|
JCheckBox attention;
|
||||||
|
|
||||||
JButtonSpacePlay reprocessAudioFFT;
|
JButtonSpacePlay reprocessAudioFFT;
|
||||||
JButtonSpacePlay reprocessAudioPeak;
|
JButtonSpacePlay reprocessAudioPeak;
|
||||||
@@ -402,9 +403,29 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
bookTreeModel.reload(selectedSentence);
|
bookTreeModel.reload(selectedSentence);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
controlsTop.add(locked);
|
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(Box.createHorizontalGlue());
|
||||||
controlsTop.add(new JLabel("Post gap:"));
|
controlsTop.add(new JLabel("Post gap:"));
|
||||||
controlsTop.add(postSentenceGap);
|
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.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.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.locked", keybase, i), snt.isLocked() ? "true" : "false");
|
||||||
|
prefs.setProperty(String.format("%s.sentence.%08d.attention", keybase, i), snt.getAttentionFlag() ? "true" : "false");
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1394,6 +1416,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
sampleWaveform.setAltMarkers(s.getStartCrossing(), s.getEndCrossing());
|
sampleWaveform.setAltMarkers(s.getStartCrossing(), s.getEndCrossing());
|
||||||
postSentenceGap.setValue(s.getPostGap());
|
postSentenceGap.setValue(s.getPostGap());
|
||||||
locked.setSelected(s.isLocked());
|
locked.setSelected(s.isLocked());
|
||||||
|
attention.setSelected(s.getAttentionFlag());
|
||||||
|
|
||||||
postSentenceGap.setEnabled(!s.isLocked());
|
postSentenceGap.setEnabled(!s.isLocked());
|
||||||
reprocessAudioFFT.setEnabled(!s.isLocked());
|
reprocessAudioFFT.setEnabled(!s.isLocked());
|
||||||
@@ -1403,6 +1426,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
sampleWaveform.clearData();
|
sampleWaveform.clearData();
|
||||||
postSentenceGap.setValue(0);
|
postSentenceGap.setValue(0);
|
||||||
locked.setSelected(false);
|
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.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.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.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());
|
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.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.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.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());
|
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.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.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.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());
|
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.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.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.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());
|
bookTreeModel.insertNodeInto(s, c, c.getChildCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ public class BookTreeRenderer extends DefaultTreeCellRenderer {
|
|||||||
if (value instanceof Sentence) {
|
if (value instanceof Sentence) {
|
||||||
Sentence s = (Sentence)value;
|
Sentence s = (Sentence)value;
|
||||||
|
|
||||||
if (s.isLocked()) {
|
if (s.getAttentionFlag()) {
|
||||||
ret.setForeground(new Color(0x20, 0x00, 0x00));
|
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);
|
ret.setIcon(Icons.locked);
|
||||||
} else if (s.getStartOffset() == 0) {
|
} else if (s.getStartOffset() == 0) {
|
||||||
ret.setIcon(Icons.important);
|
ret.setIcon(Icons.important);
|
||||||
|
|||||||
@@ -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 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 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 dollar = new ImageIcon(Icons.class.getResource("icons/dollar.png"));
|
||||||
|
static public final ImageIcon attention = new ImageIcon(Icons.class.getResource("icons/attention.png"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
boolean recording;
|
boolean recording;
|
||||||
|
|
||||||
boolean inSample;
|
boolean inSample;
|
||||||
|
boolean attention = false;
|
||||||
|
|
||||||
TargetDataLine line;
|
TargetDataLine line;
|
||||||
AudioInputStream inputStream;
|
AudioInputStream inputStream;
|
||||||
@@ -732,4 +733,12 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
sentence.updateCrossings();
|
sentence.updateCrossings();
|
||||||
return sentence;
|
return sentence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAttentionFlag(boolean f) {
|
||||||
|
attention = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getAttentionFlag() {
|
||||||
|
return attention;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user