Added book/chapter/phrase notes area tabs
This commit is contained in:
@@ -3,6 +3,7 @@ package uk.co.majenko.audiobookrecorder;
|
|||||||
import javax.sound.sampled.*;
|
import javax.sound.sampled.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.*;
|
import javax.swing.event.*;
|
||||||
|
import javax.swing.text.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
@@ -40,7 +41,7 @@ import org.w3c.dom.Element;
|
|||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
|
|
||||||
public class AudiobookRecorder extends JFrame {
|
public class AudiobookRecorder extends JFrame implements DocumentListener {
|
||||||
|
|
||||||
// Settings - tweakable
|
// Settings - tweakable
|
||||||
|
|
||||||
@@ -106,8 +107,17 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
public Waveform sampleWaveform;
|
public Waveform sampleWaveform;
|
||||||
JScrollBar sampleScroll;
|
JScrollBar sampleScroll;
|
||||||
JSplitPane mainSplit;
|
JSplitPane mainSplit;
|
||||||
JTextArea notesArea;
|
|
||||||
JScrollPane notesScroll;
|
JTabbedPane notesTabs;
|
||||||
|
|
||||||
|
JTextArea bookNotesArea;
|
||||||
|
JScrollPane bookNotesScroll;
|
||||||
|
|
||||||
|
JTextArea chapterNotesArea;
|
||||||
|
JScrollPane chapterNotesScroll;
|
||||||
|
|
||||||
|
JTextArea sentenceNotesArea;
|
||||||
|
JScrollPane sentenceNotesScroll;
|
||||||
|
|
||||||
JSpinner postSentenceGap;
|
JSpinner postSentenceGap;
|
||||||
JSpinner gainPercent;
|
JSpinner gainPercent;
|
||||||
@@ -641,10 +651,9 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
centralPanel.getActionMap().put("startRecord", new AbstractAction() {
|
centralPanel.getActionMap().put("startRecord", new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (!getLock()) return;
|
if (!getLock()) return;
|
||||||
if (getFocusOwner() == notesArea) {
|
if (getFocusOwner() == bookNotesArea) { freeLock(); return; }
|
||||||
freeLock();
|
if (getFocusOwner() == chapterNotesArea) { freeLock(); return; }
|
||||||
return;
|
if (getFocusOwner() == sentenceNotesArea) { freeLock(); return; }
|
||||||
}
|
|
||||||
if (bookTree.isEditing()) {
|
if (bookTree.isEditing()) {
|
||||||
freeLock();
|
freeLock();
|
||||||
return;
|
return;
|
||||||
@@ -660,10 +669,9 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
centralPanel.getActionMap().put("startRecordShort", new AbstractAction() {
|
centralPanel.getActionMap().put("startRecordShort", new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (!getLock()) return;
|
if (!getLock()) return;
|
||||||
if (getFocusOwner() == notesArea) {
|
if (getFocusOwner() == bookNotesArea) { freeLock(); return; }
|
||||||
freeLock();
|
if (getFocusOwner() == chapterNotesArea) { freeLock(); return; }
|
||||||
return;
|
if (getFocusOwner() == sentenceNotesArea) { freeLock(); return; }
|
||||||
}
|
|
||||||
if (bookTree.isEditing()) {
|
if (bookTree.isEditing()) {
|
||||||
freeLock();
|
freeLock();
|
||||||
return;
|
return;
|
||||||
@@ -679,10 +687,9 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
centralPanel.getActionMap().put("startRecordNewPara", new AbstractAction() {
|
centralPanel.getActionMap().put("startRecordNewPara", new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (!getLock()) return;
|
if (!getLock()) return;
|
||||||
if (getFocusOwner() == notesArea) {
|
if (getFocusOwner() == bookNotesArea) { freeLock(); return; }
|
||||||
freeLock();
|
if (getFocusOwner() == chapterNotesArea) { freeLock(); return; }
|
||||||
return;
|
if (getFocusOwner() == sentenceNotesArea) { freeLock(); return; }
|
||||||
}
|
|
||||||
if (bookTree.isEditing()) {
|
if (bookTree.isEditing()) {
|
||||||
freeLock();
|
freeLock();
|
||||||
return;
|
return;
|
||||||
@@ -698,10 +705,9 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
centralPanel.getActionMap().put("startRecordNewSection", new AbstractAction() {
|
centralPanel.getActionMap().put("startRecordNewSection", new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (!getLock()) return;
|
if (!getLock()) return;
|
||||||
if (getFocusOwner() == notesArea) {
|
if (getFocusOwner() == bookNotesArea) { freeLock(); return; }
|
||||||
freeLock();
|
if (getFocusOwner() == chapterNotesArea) { freeLock(); return; }
|
||||||
return;
|
if (getFocusOwner() == sentenceNotesArea) { freeLock(); return; }
|
||||||
}
|
|
||||||
if (bookTree.isEditing()) {
|
if (bookTree.isEditing()) {
|
||||||
freeLock();
|
freeLock();
|
||||||
return;
|
return;
|
||||||
@@ -717,10 +723,9 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
centralPanel.getActionMap().put("startRerecord", new AbstractAction() {
|
centralPanel.getActionMap().put("startRerecord", new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (!getLock()) return;
|
if (!getLock()) return;
|
||||||
if (getFocusOwner() == notesArea) {
|
if (getFocusOwner() == bookNotesArea) { freeLock(); return; }
|
||||||
freeLock();
|
if (getFocusOwner() == chapterNotesArea) { freeLock(); return; }
|
||||||
return;
|
if (getFocusOwner() == sentenceNotesArea) { freeLock(); return; }
|
||||||
}
|
|
||||||
if (bookTree.isEditing()) {
|
if (bookTree.isEditing()) {
|
||||||
freeLock();
|
freeLock();
|
||||||
return;
|
return;
|
||||||
@@ -735,9 +740,9 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
});
|
});
|
||||||
centralPanel.getActionMap().put("stopRecord", new AbstractAction() {
|
centralPanel.getActionMap().put("stopRecord", new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (getFocusOwner() == notesArea) {
|
if (getFocusOwner() == bookNotesArea) { return; }
|
||||||
return;
|
if (getFocusOwner() == chapterNotesArea) { return; }
|
||||||
}
|
if (getFocusOwner() == sentenceNotesArea) { return; }
|
||||||
if (bookTree.isEditing()) return;
|
if (bookTree.isEditing()) return;
|
||||||
stopLock();
|
stopLock();
|
||||||
stopRecording();
|
stopRecording();
|
||||||
@@ -746,9 +751,9 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
});
|
});
|
||||||
centralPanel.getActionMap().put("deleteLast", new AbstractAction() {
|
centralPanel.getActionMap().put("deleteLast", new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (getFocusOwner() == notesArea) {
|
if (getFocusOwner() == bookNotesArea) { return; }
|
||||||
return;
|
if (getFocusOwner() == chapterNotesArea) { return; }
|
||||||
}
|
if (getFocusOwner() == sentenceNotesArea) { return; }
|
||||||
if (bookTree.isEditing()) return;
|
if (bookTree.isEditing()) return;
|
||||||
deleteLastRecording();
|
deleteLastRecording();
|
||||||
}
|
}
|
||||||
@@ -756,9 +761,9 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
|
|
||||||
centralPanel.getActionMap().put("startStopPlayback", new AbstractAction() {
|
centralPanel.getActionMap().put("startStopPlayback", new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (getFocusOwner() == notesArea) {
|
if (getFocusOwner() == bookNotesArea) { return; }
|
||||||
return;
|
if (getFocusOwner() == chapterNotesArea) { return; }
|
||||||
}
|
if (getFocusOwner() == sentenceNotesArea) { return; }
|
||||||
if (bookTree.isEditing()) return;
|
if (bookTree.isEditing()) return;
|
||||||
if (playing == null) {
|
if (playing == null) {
|
||||||
playSelectedSentence();
|
playSelectedSentence();
|
||||||
@@ -770,9 +775,9 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
|
|
||||||
centralPanel.getActionMap().put("startPlaybackFrom", new AbstractAction() {
|
centralPanel.getActionMap().put("startPlaybackFrom", new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (getFocusOwner() == notesArea) {
|
if (getFocusOwner() == bookNotesArea) { return; }
|
||||||
return;
|
if (getFocusOwner() == chapterNotesArea) { return; }
|
||||||
}
|
if (getFocusOwner() == sentenceNotesArea) { return; }
|
||||||
if (bookTree.isEditing()) return;
|
if (bookTree.isEditing()) return;
|
||||||
if (playing == null) {
|
if (playing == null) {
|
||||||
playFromSelectedSentence();
|
playFromSelectedSentence();
|
||||||
@@ -782,12 +787,30 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
|
|
||||||
mainScroll = new JScrollPane();
|
mainScroll = new JScrollPane();
|
||||||
|
|
||||||
notesArea = new JTextArea();
|
bookNotesArea = new JTextArea();
|
||||||
notesArea.setFont(new Font("Monospaced", Font.PLAIN, 10));
|
bookNotesArea.setFont(new Font("Monospaced", Font.PLAIN, 10));
|
||||||
notesScroll = new JScrollPane();
|
bookNotesScroll = new JScrollPane();
|
||||||
notesScroll.setViewportView(notesArea);
|
bookNotesScroll.setViewportView(bookNotesArea);
|
||||||
|
|
||||||
mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mainScroll, notesScroll);
|
chapterNotesArea = new JTextArea();
|
||||||
|
chapterNotesArea.setFont(new Font("Monospaced", Font.PLAIN, 10));
|
||||||
|
chapterNotesArea.getDocument().addDocumentListener(this);
|
||||||
|
chapterNotesScroll = new JScrollPane();
|
||||||
|
chapterNotesScroll.setViewportView(chapterNotesArea);
|
||||||
|
|
||||||
|
sentenceNotesArea = new JTextArea();
|
||||||
|
sentenceNotesArea.setFont(new Font("Monospaced", Font.PLAIN, 10));
|
||||||
|
sentenceNotesArea.getDocument().addDocumentListener(this);
|
||||||
|
sentenceNotesScroll = new JScrollPane();
|
||||||
|
sentenceNotesScroll.setViewportView(sentenceNotesArea);
|
||||||
|
|
||||||
|
notesTabs = new JTabbedPane();
|
||||||
|
|
||||||
|
notesTabs.add("Book", bookNotesScroll);
|
||||||
|
notesTabs.add("Chapter", chapterNotesScroll);
|
||||||
|
notesTabs.add("Phrase", sentenceNotesScroll);
|
||||||
|
|
||||||
|
mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mainScroll, notesTabs);
|
||||||
centralPanel.add(mainSplit, BorderLayout.CENTER);
|
centralPanel.add(mainSplit, BorderLayout.CENTER);
|
||||||
|
|
||||||
mainSplit.addPropertyChangeListener(new PropertyChangeListener() {
|
mainSplit.addPropertyChangeListener(new PropertyChangeListener() {
|
||||||
@@ -2011,6 +2034,11 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
bookTree.addTreeSelectionListener(new TreeSelectionListener() {
|
bookTree.addTreeSelectionListener(new TreeSelectionListener() {
|
||||||
public void valueChanged(TreeSelectionEvent e) {
|
public void valueChanged(TreeSelectionEvent e) {
|
||||||
DefaultMutableTreeNode n = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
DefaultMutableTreeNode n = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
||||||
|
if (n instanceof BookTreeNode) {
|
||||||
|
BookTreeNode btn = (BookTreeNode)n;
|
||||||
|
btn.onSelect();
|
||||||
|
}
|
||||||
|
|
||||||
if (n instanceof Sentence) {
|
if (n instanceof Sentence) {
|
||||||
Sentence s = (Sentence)n;
|
Sentence s = (Sentence)n;
|
||||||
selectedSentence = s;
|
selectedSentence = s;
|
||||||
@@ -2178,6 +2206,11 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
bookTree.addTreeSelectionListener(new TreeSelectionListener() {
|
bookTree.addTreeSelectionListener(new TreeSelectionListener() {
|
||||||
public void valueChanged(TreeSelectionEvent e) {
|
public void valueChanged(TreeSelectionEvent e) {
|
||||||
DefaultMutableTreeNode n = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
DefaultMutableTreeNode n = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
||||||
|
if (n instanceof BookTreeNode) {
|
||||||
|
BookTreeNode btn = (BookTreeNode)n;
|
||||||
|
btn.onSelect();
|
||||||
|
}
|
||||||
|
|
||||||
if (n instanceof Sentence) {
|
if (n instanceof Sentence) {
|
||||||
Sentence s = (Sentence)n;
|
Sentence s = (Sentence)n;
|
||||||
selectedSentence = s;
|
selectedSentence = s;
|
||||||
@@ -3729,12 +3762,28 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
System.err.println("Effects Enabled: " + b);
|
System.err.println("Effects Enabled: " + b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotes(String text) {
|
public void setBookNotes(String text) {
|
||||||
notesArea.setText(text);
|
bookNotesArea.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNotes() {
|
public void setChapterNotes(String text) {
|
||||||
return notesArea.getText();
|
chapterNotesArea.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSentenceNotes(String text) {
|
||||||
|
sentenceNotesArea.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBookNotes() {
|
||||||
|
return bookNotesArea.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChapterNotes() {
|
||||||
|
return chapterNotesArea.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSentenceNotes() {
|
||||||
|
return sentenceNotesArea.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openManuscript() {
|
public void openManuscript() {
|
||||||
@@ -3766,4 +3815,74 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//* DocumentListener
|
||||||
|
|
||||||
|
public void changedUpdate(DocumentEvent e) {
|
||||||
|
javax.swing.text.Document doc = e.getDocument();
|
||||||
|
if (doc == chapterNotesArea.getDocument()) {
|
||||||
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
||||||
|
if (selectedNode instanceof Sentence) {
|
||||||
|
selectedNode = (DefaultMutableTreeNode)selectedNode.getParent();
|
||||||
|
}
|
||||||
|
if (! (selectedNode instanceof Chapter)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Chapter c = (Chapter)selectedNode;
|
||||||
|
c.setNotes(chapterNotesArea.getText());
|
||||||
|
} else if (doc == sentenceNotesArea.getDocument()) {
|
||||||
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
||||||
|
if (! (selectedNode instanceof Sentence)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Sentence s = (Sentence)selectedNode;
|
||||||
|
s.setNotes(sentenceNotesArea.getText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeUpdate(DocumentEvent e) {
|
||||||
|
javax.swing.text.Document doc = e.getDocument();
|
||||||
|
if (doc == chapterNotesArea.getDocument()) {
|
||||||
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
||||||
|
if (selectedNode instanceof Sentence) {
|
||||||
|
selectedNode = (DefaultMutableTreeNode)selectedNode.getParent();
|
||||||
|
}
|
||||||
|
if (! (selectedNode instanceof Chapter)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Chapter c = (Chapter)selectedNode;
|
||||||
|
c.setNotes(chapterNotesArea.getText());
|
||||||
|
} else if (doc == sentenceNotesArea.getDocument()) {
|
||||||
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
||||||
|
if (! (selectedNode instanceof Sentence)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Sentence s = (Sentence)selectedNode;
|
||||||
|
s.setNotes(sentenceNotesArea.getText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertUpdate(DocumentEvent e) {
|
||||||
|
javax.swing.text.Document doc = e.getDocument();
|
||||||
|
if (doc == chapterNotesArea.getDocument()) {
|
||||||
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
||||||
|
if (selectedNode instanceof Sentence) {
|
||||||
|
selectedNode = (DefaultMutableTreeNode)selectedNode.getParent();
|
||||||
|
}
|
||||||
|
if (! (selectedNode instanceof Chapter)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Chapter c = (Chapter)selectedNode;
|
||||||
|
c.setNotes(chapterNotesArea.getText());
|
||||||
|
} else if (doc == sentenceNotesArea.getDocument()) {
|
||||||
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)bookTree.getLastSelectedPathComponent();
|
||||||
|
if (! (selectedNode instanceof Sentence)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Sentence s = (Sentence)selectedNode;
|
||||||
|
s.setNotes(sentenceNotesArea.getText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DocumentListener *//
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
ACX = getTextNode(root, "acx");
|
ACX = getTextNode(root, "acx");
|
||||||
manuscript = getTextNode(root, "manuscript");
|
manuscript = getTextNode(root, "manuscript");
|
||||||
|
|
||||||
AudiobookRecorder.window.setNotes(getTextNode(root, "notes"));
|
AudiobookRecorder.window.setBookNotes(getTextNode(root, "notes"));
|
||||||
|
|
||||||
Element settings = getNode(root, "settings");
|
Element settings = getNode(root, "settings");
|
||||||
Element audioSettings = getNode(settings, "audio");
|
Element audioSettings = getNode(settings, "audio");
|
||||||
@@ -306,7 +306,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
root.appendChild(makeTextNode(doc, "acx", ACX));
|
root.appendChild(makeTextNode(doc, "acx", ACX));
|
||||||
root.appendChild(makeTextNode(doc, "manuscript", manuscript));
|
root.appendChild(makeTextNode(doc, "manuscript", manuscript));
|
||||||
|
|
||||||
root.appendChild(makeTextNode(doc, "notes", AudiobookRecorder.window.getNotes()));
|
root.appendChild(makeTextNode(doc, "notes", AudiobookRecorder.window.getBookNotes()));
|
||||||
|
|
||||||
Element settingsNode = doc.createElement("settings");
|
Element settingsNode = doc.createElement("settings");
|
||||||
root.appendChild(settingsNode);
|
root.appendChild(settingsNode);
|
||||||
|
|||||||
20
src/uk/co/majenko/audiobookrecorder/BookTreeNode.java
Normal file
20
src/uk/co/majenko/audiobookrecorder/BookTreeNode.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
|
||||||
|
public abstract class BookTreeNode extends DefaultMutableTreeNode {
|
||||||
|
|
||||||
|
public BookTreeNode(String t) {
|
||||||
|
super(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookTreeNode() {
|
||||||
|
super("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void setNotes(String t);
|
||||||
|
public abstract String getNotes();
|
||||||
|
|
||||||
|
public abstract void onSelect();
|
||||||
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ import org.w3c.dom.Node;
|
|||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
import org.w3c.dom.Text;
|
import org.w3c.dom.Text;
|
||||||
|
|
||||||
public class Chapter extends DefaultMutableTreeNode {
|
public class Chapter extends BookTreeNode {
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
String id;
|
String id;
|
||||||
@@ -34,6 +34,8 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
int preGap;
|
int preGap;
|
||||||
int postGap;
|
int postGap;
|
||||||
|
|
||||||
|
String notes;
|
||||||
|
|
||||||
public Chapter(String i, String chaptername) {
|
public Chapter(String i, String chaptername) {
|
||||||
super(chaptername);
|
super(chaptername);
|
||||||
|
|
||||||
@@ -50,6 +52,8 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
preGap = Utils.s2i(Book.getTextNode(root, "pre-gap"));
|
preGap = Utils.s2i(Book.getTextNode(root, "pre-gap"));
|
||||||
postGap = Utils.s2i(Book.getTextNode(root, "post-gap"));
|
postGap = Utils.s2i(Book.getTextNode(root, "post-gap"));
|
||||||
|
|
||||||
|
notes = Book.getTextNode(root, "notes");
|
||||||
|
|
||||||
Element sentencesNode = Book.getNode(root, "sentences");
|
Element sentencesNode = Book.getNode(root, "sentences");
|
||||||
NodeList sentences = sentencesNode.getElementsByTagName("sentence");
|
NodeList sentences = sentencesNode.getElementsByTagName("sentence");
|
||||||
|
|
||||||
@@ -284,6 +288,7 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
chapterNode.appendChild(Book.makeTextNode(doc, "name", name));
|
chapterNode.appendChild(Book.makeTextNode(doc, "name", name));
|
||||||
chapterNode.appendChild(Book.makeTextNode(doc, "pre-gap", preGap));
|
chapterNode.appendChild(Book.makeTextNode(doc, "pre-gap", preGap));
|
||||||
chapterNode.appendChild(Book.makeTextNode(doc, "post-gap", postGap));
|
chapterNode.appendChild(Book.makeTextNode(doc, "post-gap", postGap));
|
||||||
|
chapterNode.appendChild(Book.makeTextNode(doc, "notes", notes));
|
||||||
|
|
||||||
Element sentencesNode = doc.createElement("sentences");
|
Element sentencesNode = doc.createElement("sentences");
|
||||||
chapterNode.appendChild(sentencesNode);
|
chapterNode.appendChild(sentencesNode);
|
||||||
@@ -299,4 +304,16 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
return chapterNode;
|
return chapterNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNotes() {
|
||||||
|
return notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotes(String t) {
|
||||||
|
notes = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSelect() {
|
||||||
|
AudiobookRecorder.window.setChapterNotes(notes);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,10 +41,11 @@ import org.w3c.dom.Document;
|
|||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Text;
|
import org.w3c.dom.Text;
|
||||||
|
|
||||||
public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
public class Sentence extends BookTreeNode implements Cacheable {
|
||||||
|
|
||||||
String text;
|
String text;
|
||||||
String id;
|
String id;
|
||||||
|
String notes;
|
||||||
int postGap;
|
int postGap;
|
||||||
int startOffset = 0;
|
int startOffset = 0;
|
||||||
int endOffset = 0;
|
int endOffset = 0;
|
||||||
@@ -179,6 +180,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
super("");
|
super("");
|
||||||
id = root.getAttribute("id");
|
id = root.getAttribute("id");
|
||||||
text = Book.getTextNode(root, "text");
|
text = Book.getTextNode(root, "text");
|
||||||
|
notes = Book.getTextNode(root, "notes");
|
||||||
setUserObject(text);
|
setUserObject(text);
|
||||||
setPostGap(Utils.s2i(Book.getTextNode(root, "post-gap")));
|
setPostGap(Utils.s2i(Book.getTextNode(root, "post-gap")));
|
||||||
setStartOffset(Utils.s2i(Book.getTextNode(root, "start-offset")));
|
setStartOffset(Utils.s2i(Book.getTextNode(root, "start-offset")));
|
||||||
@@ -348,7 +350,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
intens = null;
|
intens = null;
|
||||||
samples = null;
|
samples = null;
|
||||||
processed = true;
|
processed = true;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void autoTrimSamplePeak() {
|
public void autoTrimSamplePeak() {
|
||||||
@@ -405,6 +407,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
if (endOffset >= samples.length) endOffset = samples.length-1;
|
if (endOffset >= samples.length) endOffset = samples.length-1;
|
||||||
updateCrossings(useRaw);
|
updateCrossings(useRaw);
|
||||||
processed = true;
|
processed = true;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
@@ -414,6 +417,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
public void setText(String t) {
|
public void setText(String t) {
|
||||||
overrideText = null;
|
overrideText = null;
|
||||||
text = t;
|
text = t;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getText() {
|
public String getText() {
|
||||||
@@ -461,6 +465,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
if (o instanceof String) {
|
if (o instanceof String) {
|
||||||
String so = (String)o;
|
String so = (String)o;
|
||||||
text = so;
|
text = so;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,6 +525,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
if (startOffset != o) {
|
if (startOffset != o) {
|
||||||
startOffset = o;
|
startOffset = o;
|
||||||
crossStartOffset = -1;
|
crossStartOffset = -1;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,6 +541,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
if (endOffset != o) {
|
if (endOffset != o) {
|
||||||
endOffset = o;
|
endOffset = o;
|
||||||
crossEndOffset = -1;
|
crossEndOffset = -1;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,6 +622,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
|
|
||||||
public void setLocked(boolean l) {
|
public void setLocked(boolean l) {
|
||||||
locked = l;
|
locked = l;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLocked() {
|
public boolean isLocked() {
|
||||||
@@ -717,6 +725,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
|
|
||||||
public void setAttentionFlag(boolean f) {
|
public void setAttentionFlag(boolean f) {
|
||||||
attention = f;
|
attention = f;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getAttentionFlag() {
|
public boolean getAttentionFlag() {
|
||||||
@@ -1316,6 +1325,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
CacheManager.removeFromCache(this);
|
CacheManager.removeFromCache(this);
|
||||||
}
|
}
|
||||||
effectChain = key;
|
effectChain = key;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEffectChain() {
|
public String getEffectChain() {
|
||||||
@@ -1342,6 +1352,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
postGapType = t;
|
postGapType = t;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetPostGap() {
|
public void resetPostGap() {
|
||||||
@@ -1410,6 +1421,7 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
sentenceNode.appendChild(Book.makeTextNode(doc, "gaptype", getPostGapType()));
|
sentenceNode.appendChild(Book.makeTextNode(doc, "gaptype", getPostGapType()));
|
||||||
sentenceNode.appendChild(Book.makeTextNode(doc, "samples", getSampleSize()));
|
sentenceNode.appendChild(Book.makeTextNode(doc, "samples", getSampleSize()));
|
||||||
sentenceNode.appendChild(Book.makeTextNode(doc, "processed", isProcessed()));
|
sentenceNode.appendChild(Book.makeTextNode(doc, "processed", isProcessed()));
|
||||||
|
sentenceNode.appendChild(Book.makeTextNode(doc, "notes", getNotes()));
|
||||||
return sentenceNode;
|
return sentenceNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1419,7 +1431,19 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
|||||||
|
|
||||||
public void setProcessed(boolean p) {
|
public void setProcessed(boolean p) {
|
||||||
processed = p;
|
processed = p;
|
||||||
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNotes(String n) {
|
||||||
|
notes = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNotes() {
|
||||||
|
return notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSelect() {
|
||||||
|
AudiobookRecorder.window.setSentenceNotes(notes);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user