Improved book rendering in tree
This commit is contained in:
@@ -10,6 +10,7 @@ public class AGC implements Effect {
|
||||
double attack;
|
||||
|
||||
public AGC(double c, double a, double d, double l) {
|
||||
Debug.trace();
|
||||
ceiling = c;
|
||||
attack = a;
|
||||
decay = d;
|
||||
@@ -18,14 +19,17 @@ public class AGC implements Effect {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
Debug.trace();
|
||||
return "AGC (Ceiling = " + ceiling + " attack = " + attack + " decay = " + decay + " limit = " + limit;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Debug.trace();
|
||||
return getName();
|
||||
}
|
||||
|
||||
public void process(double[][] samples) {
|
||||
Debug.trace();
|
||||
gain = 1d;
|
||||
for (int i = 0; i < samples[Sentence.LEFT].length; i++) {
|
||||
double absSampleLeft = Math.abs(samples[Sentence.LEFT][i]) * gain;
|
||||
@@ -55,14 +59,17 @@ public class AGC implements Effect {
|
||||
}
|
||||
|
||||
public void init(double sr) {
|
||||
Debug.trace();
|
||||
gain = 1d;
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
Debug.trace();
|
||||
System.out.println(toString());
|
||||
}
|
||||
|
||||
public ArrayList<Effect> getChildEffects() {
|
||||
Debug.trace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.awt.*;
|
||||
public class AboutPanel extends JPanel {
|
||||
|
||||
public AboutPanel() {
|
||||
Debug.trace();
|
||||
setLayout(new BorderLayout());
|
||||
JLabel icon = new JLabel(Icons.appIcon);
|
||||
add(icon, BorderLayout.WEST);
|
||||
|
||||
@@ -5,21 +5,26 @@ import java.util.ArrayList;
|
||||
public class Amplifier implements Effect {
|
||||
double gain;
|
||||
public Amplifier() {
|
||||
Debug.trace();
|
||||
gain = 1.0d;
|
||||
}
|
||||
public Amplifier(double g) {
|
||||
Debug.trace();
|
||||
gain = g;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
Debug.trace();
|
||||
return "Amplifier (" + gain + ")";
|
||||
}
|
||||
|
||||
public ArrayList<Effect> getChildEffects() {
|
||||
Debug.trace();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void process(double[][] samples) {
|
||||
Debug.trace();
|
||||
for (int i = 0; i < samples[Sentence.LEFT].length; i++) {
|
||||
samples[Sentence.LEFT][i] *= gain;
|
||||
samples[Sentence.RIGHT][i] *= gain;
|
||||
@@ -27,21 +32,26 @@ public class Amplifier implements Effect {
|
||||
}
|
||||
|
||||
public double getGain() {
|
||||
Debug.trace();
|
||||
return gain;
|
||||
}
|
||||
|
||||
public void setGain(double g) {
|
||||
Debug.trace();
|
||||
gain = g;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Debug.trace();
|
||||
return getName();
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
Debug.trace();
|
||||
System.out.println(toString());
|
||||
}
|
||||
|
||||
public void init(double sf) {
|
||||
Debug.trace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2244,13 +2244,14 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
||||
ImageIcon i = new ImageIcon(cf.getAbsolutePath());
|
||||
Image ri = Utils.getScaledImage(i.getImage(), 22, 22);
|
||||
book.setIcon(new ImageIcon(ri));
|
||||
bookTreeModel.reload(book);
|
||||
} else {
|
||||
book.setIcon(Icons.book);
|
||||
}
|
||||
bookTreeModel.reload(book);
|
||||
|
||||
bookTree.expandPath(new TreePath(book.getPath()));
|
||||
|
||||
statusLabel.setText("Noise floor: " + getNoiseFloorDB() + "dB");
|
||||
book.setIcon(Icons.book);
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
@@ -37,6 +37,7 @@ public class Biquad implements Effect {
|
||||
double sampleFrequency;
|
||||
|
||||
public Biquad() {
|
||||
Debug.trace();
|
||||
type = Lowpass;
|
||||
a0 = 1.0d;
|
||||
a1 = 0.0d;
|
||||
@@ -54,6 +55,7 @@ public class Biquad implements Effect {
|
||||
}
|
||||
|
||||
public Biquad(int type, double Fc, double Q, double peakGainDB) {
|
||||
Debug.trace();
|
||||
setBiquad(type, Fc, Q, peakGainDB);
|
||||
lz1 = 0.0;
|
||||
lz2 = 0.0;
|
||||
@@ -63,26 +65,31 @@ public class Biquad implements Effect {
|
||||
}
|
||||
|
||||
public void setType(int typei) {
|
||||
Debug.trace();
|
||||
type = typei;
|
||||
calcBiquad();
|
||||
}
|
||||
|
||||
public void setQ(double Qi) {
|
||||
Debug.trace();
|
||||
Q = Qi;
|
||||
calcBiquad();
|
||||
}
|
||||
|
||||
public void setFc(double Fci) {
|
||||
Debug.trace();
|
||||
Fc = Fci;
|
||||
calcBiquad();
|
||||
}
|
||||
|
||||
public void setPeakGain(double peakGainDB) {
|
||||
Debug.trace();
|
||||
peakGain = peakGainDB;
|
||||
calcBiquad();
|
||||
}
|
||||
|
||||
public void setBiquad(int typei, double Fci, double Qi, double peakGainDB) {
|
||||
Debug.trace();
|
||||
type = typei;
|
||||
Q = Qi;
|
||||
Fc = Fci;
|
||||
@@ -90,6 +97,7 @@ public class Biquad implements Effect {
|
||||
}
|
||||
|
||||
public void process(double[][] samples) {
|
||||
Debug.trace();
|
||||
lz1 = 0d;
|
||||
lz2 = 0d;
|
||||
rz1 = 0d;
|
||||
@@ -111,6 +119,7 @@ public class Biquad implements Effect {
|
||||
}
|
||||
|
||||
public void init(double sf) {
|
||||
Debug.trace();
|
||||
sampleFrequency = sf;
|
||||
lz1 = 0d;
|
||||
lz2 = 0d;
|
||||
@@ -120,6 +129,7 @@ public class Biquad implements Effect {
|
||||
}
|
||||
|
||||
void calcBiquad() {
|
||||
Debug.trace();
|
||||
|
||||
double norm;
|
||||
double V = Math.pow(10, Math.abs(peakGain) / 20.0);
|
||||
@@ -221,6 +231,7 @@ public class Biquad implements Effect {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
Debug.trace();
|
||||
String n = "Biquad Filter (";
|
||||
switch (type) {
|
||||
case Lowpass: n += "Lowpass"; break;
|
||||
@@ -242,14 +253,17 @@ public class Biquad implements Effect {
|
||||
}
|
||||
|
||||
public ArrayList<Effect> getChildEffects() {
|
||||
Debug.trace();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Debug.trace();
|
||||
return getName();
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
Debug.trace();
|
||||
System.out.println(toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
public class Book extends DefaultMutableTreeNode {
|
||||
public class Book extends BookTreeNode {
|
||||
|
||||
String name;
|
||||
String author;
|
||||
@@ -39,13 +39,15 @@ public class Book extends DefaultMutableTreeNode {
|
||||
int channels;
|
||||
int resolution;
|
||||
|
||||
String notes = null;
|
||||
|
||||
ImageIcon icon;
|
||||
|
||||
Properties prefs;
|
||||
|
||||
public Book(Properties p, String bookname) {
|
||||
super(bookname);
|
||||
|
||||
Debug.trace();
|
||||
prefs = p;
|
||||
name = bookname;
|
||||
AudiobookRecorder.window.setTitle("AudioBook Recorder :: " + name); // This should be in the load routine!!!!
|
||||
@@ -53,12 +55,13 @@ public class Book extends DefaultMutableTreeNode {
|
||||
|
||||
public Book(Element root) {
|
||||
super(getTextNode(root, "title"));
|
||||
|
||||
Debug.trace();
|
||||
name = getTextNode(root, "title");
|
||||
AudiobookRecorder.window.setTitle("AudioBook Recorder :: " + name); // This should be in the load routine!!!!
|
||||
}
|
||||
|
||||
public void loadBookXML(Element root, DefaultTreeModel model) {
|
||||
Debug.trace();
|
||||
name = getTextNode(root, "title");
|
||||
author = getTextNode(root, "author");
|
||||
genre = getTextNode(root, "genre");
|
||||
@@ -67,6 +70,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
manuscript = getTextNode(root, "manuscript");
|
||||
|
||||
AudiobookRecorder.window.setBookNotes(getTextNode(root, "notes"));
|
||||
notes = getTextNode(root, "notes");
|
||||
|
||||
Element settings = getNode(root, "settings");
|
||||
Element audioSettings = getNode(settings, "audio");
|
||||
@@ -92,6 +96,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public static Element getNode(Element r, String n) {
|
||||
Debug.trace();
|
||||
NodeList nl = r.getElementsByTagName(n);
|
||||
if (nl == null) return null;
|
||||
if (nl.getLength() == 0) return null;
|
||||
@@ -99,35 +104,40 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public static String getTextNode(Element r, String n) {
|
||||
Debug.trace();
|
||||
return getTextNode(r, n, "");
|
||||
}
|
||||
|
||||
public static String getTextNode(Element r, String n, String d) {
|
||||
Debug.trace();
|
||||
Element node = getNode(r, n);
|
||||
if (node == null) return d;
|
||||
return node.getTextContent();
|
||||
}
|
||||
|
||||
public void setAuthor(String a) { author = a; }
|
||||
public void setGenre(String g) { genre = g; }
|
||||
public void setComment(String c) { comment = c; }
|
||||
public void setACX(String c) { ACX = c; }
|
||||
public void setAuthor(String a) { Debug.trace(); author = a; }
|
||||
public void setGenre(String g) { Debug.trace(); genre = g; }
|
||||
public void setComment(String c) { Debug.trace(); comment = c; }
|
||||
public void setACX(String c) { Debug.trace(); ACX = c; }
|
||||
|
||||
public String getAuthor() { return author; }
|
||||
public String getGenre() { return genre; }
|
||||
public String getComment() { return comment; }
|
||||
public String getACX() { if (ACX == null) return ""; return ACX; }
|
||||
public String getAuthor() { Debug.trace(); return author; }
|
||||
public String getGenre() { Debug.trace(); return genre; }
|
||||
public String getComment() { Debug.trace(); return comment; }
|
||||
public String getACX() { Debug.trace(); if (ACX == null) return ""; return ACX; }
|
||||
|
||||
public Chapter getClosingCredits() {
|
||||
Debug.trace();
|
||||
return getChapterById("close");
|
||||
}
|
||||
|
||||
public Chapter getOpeningCredits() {
|
||||
Debug.trace();
|
||||
return getChapterById("open");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Chapter getChapterById(String id) {
|
||||
Debug.trace();
|
||||
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||
Object ob = (Object)o.nextElement();
|
||||
if (ob instanceof Chapter) {
|
||||
@@ -141,6 +151,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public Chapter getLastChapter() {
|
||||
Debug.trace();
|
||||
Chapter cc = getClosingCredits();
|
||||
if (cc == null) return null;
|
||||
Chapter c = (Chapter)getChildBefore(cc);
|
||||
@@ -150,11 +161,13 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public Chapter getChapter(int n) {
|
||||
Debug.trace();
|
||||
if (n == 0) return null;
|
||||
return (Chapter)getChildAt(n);
|
||||
}
|
||||
|
||||
public Chapter addChapter() {
|
||||
Debug.trace();
|
||||
Chapter lc = getLastChapter();
|
||||
if (lc == null) return new Chapter("1", "Chapter 1");
|
||||
try {
|
||||
@@ -170,18 +183,22 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
Debug.trace();
|
||||
return name;
|
||||
}
|
||||
|
||||
public ImageIcon getIcon() {
|
||||
Debug.trace();
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(ImageIcon i) {
|
||||
Debug.trace();
|
||||
icon = i;
|
||||
}
|
||||
|
||||
public void setUserObject(Object o) {
|
||||
Debug.trace();
|
||||
if (o instanceof String) {
|
||||
String newName = (String)o;
|
||||
if (newName.equals(name)) return;
|
||||
@@ -190,10 +207,12 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public File getBookPath() {
|
||||
Debug.trace();
|
||||
return new File(Options.get("path.storage"), name);
|
||||
}
|
||||
|
||||
public void renameBook(String newName) {
|
||||
Debug.trace();
|
||||
File oldDir = getBookPath();
|
||||
File newDir = new File(Options.get("path.storage"), newName);
|
||||
|
||||
@@ -214,11 +233,13 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Debug.trace();
|
||||
return name;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void renumberChapters() {
|
||||
Debug.trace();
|
||||
int id = 1;
|
||||
|
||||
for (Enumeration c = children(); c.hasMoreElements();) {
|
||||
@@ -230,41 +251,48 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
}
|
||||
|
||||
public int getSampleRate() { return sampleRate; }
|
||||
public void setSampleRate(int sr) { sampleRate = sr; }
|
||||
public int getChannels() { return channels; }
|
||||
public void setChannels(int c) { channels = c; }
|
||||
public int getResolution() { return resolution; }
|
||||
public void setResolution(int r) { resolution = r; }
|
||||
public int getSampleRate() { Debug.trace(); return sampleRate; }
|
||||
public void setSampleRate(int sr) { Debug.trace(); sampleRate = sr; }
|
||||
public int getChannels() { Debug.trace(); return channels; }
|
||||
public void setChannels(int c) { Debug.trace(); channels = c; }
|
||||
public int getResolution() { Debug.trace(); return resolution; }
|
||||
public void setResolution(int r) { Debug.trace(); resolution = r; }
|
||||
|
||||
public AudioFormat getAudioFormat() {
|
||||
Debug.trace();
|
||||
return new AudioFormat(getSampleRate(), getResolution(), getChannels(), true, false);
|
||||
}
|
||||
|
||||
public String get(String key) {
|
||||
Debug.trace();
|
||||
if (prefs.getProperty(key) == null) { return Options.get(key); }
|
||||
return prefs.getProperty(key);
|
||||
}
|
||||
|
||||
public Integer getInteger(String key) {
|
||||
Debug.trace();
|
||||
if (prefs.getProperty(key) == null) { return Options.getInteger(key); }
|
||||
return Utils.s2i(prefs.getProperty(key));
|
||||
}
|
||||
|
||||
public void set(String key, String value) {
|
||||
Debug.trace();
|
||||
prefs.setProperty(key, value);
|
||||
}
|
||||
|
||||
public void set(String key, Integer value) {
|
||||
Debug.trace();
|
||||
prefs.setProperty(key, "" + value);
|
||||
}
|
||||
|
||||
public File getBookFolder() {
|
||||
Debug.trace();
|
||||
File dir = new File(Options.get("path.storage"), name);
|
||||
return dir;
|
||||
}
|
||||
|
||||
public ArrayList<String> getUsedEffects() {
|
||||
Debug.trace();
|
||||
|
||||
ArrayList<String> out = new ArrayList<String>();
|
||||
|
||||
@@ -285,6 +313,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public void purgeBackups() {
|
||||
Debug.trace();
|
||||
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||
Object ob = (Object)o.nextElement();
|
||||
if (ob instanceof Chapter) {
|
||||
@@ -295,6 +324,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public Document buildDocument() throws ParserConfigurationException {
|
||||
Debug.trace();
|
||||
DocumentBuilderFactory dbFactory =
|
||||
DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||
@@ -343,6 +373,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public static Element makeTextNode(Document doc, String name, String text) {
|
||||
Debug.trace();
|
||||
Element node = doc.createElement(name);
|
||||
Text tnode = doc.createTextNode(text == null ? "" : text);
|
||||
node.appendChild(tnode);
|
||||
@@ -350,6 +381,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public static Element makeTextNode(Document doc, String name, Integer text) {
|
||||
Debug.trace();
|
||||
Element node = doc.createElement(name);
|
||||
Text tnode = doc.createTextNode(Integer.toString(text));
|
||||
node.appendChild(tnode);
|
||||
@@ -357,6 +389,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public static Element makeTextNode(Document doc, String name, Double text) {
|
||||
Debug.trace();
|
||||
Element node = doc.createElement(name);
|
||||
Text tnode = doc.createTextNode(String.format("%.8f", text));
|
||||
node.appendChild(tnode);
|
||||
@@ -364,6 +397,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public static Element makeTextNode(Document doc, String name, Boolean text) {
|
||||
Debug.trace();
|
||||
Element node = doc.createElement(name);
|
||||
Text tnode = doc.createTextNode(text ? "true" : "false");
|
||||
node.appendChild(tnode);
|
||||
@@ -371,14 +405,17 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public String getDefaultEffect() {
|
||||
Debug.trace();
|
||||
return defaultEffect;
|
||||
}
|
||||
|
||||
public void setDefaultEffect(String eff) {
|
||||
Debug.trace();
|
||||
defaultEffect = eff;
|
||||
}
|
||||
|
||||
public void setManuscript(File f) {
|
||||
Debug.trace();
|
||||
manuscript = f.getName();
|
||||
File dst = new File(getBookPath(), manuscript);
|
||||
|
||||
@@ -390,6 +427,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
|
||||
public File getManuscript() {
|
||||
Debug.trace();
|
||||
if (manuscript == null) return null;
|
||||
if (manuscript.equals("")) return null;
|
||||
File f = new File(getBookPath(), manuscript);
|
||||
@@ -398,4 +436,17 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onSelect() {
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String n) {
|
||||
notes = n;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public class BookInfoPanel extends JPanel {
|
||||
|
||||
public BookInfoPanel(String t, String a, String g, String c, String x) {
|
||||
super();
|
||||
Debug.trace();
|
||||
setLayout(new GridBagLayout());
|
||||
GridBagConstraints con = new GridBagConstraints();
|
||||
|
||||
@@ -69,12 +70,13 @@ public class BookInfoPanel extends JPanel {
|
||||
|
||||
}
|
||||
|
||||
public String getTitle() { return title.getText(); }
|
||||
public String getAuthor() { return author.getText(); }
|
||||
public String getGenre() { return genre.getText(); }
|
||||
public String getComment() { return comment.getText(); }
|
||||
public String getTitle() { Debug.trace(); return title.getText(); }
|
||||
public String getAuthor() { Debug.trace(); return author.getText(); }
|
||||
public String getGenre() { Debug.trace(); return genre.getText(); }
|
||||
public String getComment() { Debug.trace(); return comment.getText(); }
|
||||
|
||||
public String getACX() {
|
||||
Debug.trace();
|
||||
Pattern p = Pattern.compile("\\/titleview\\/([A-Z0-9]{14})");
|
||||
Matcher m = p.matcher(acx.getText());
|
||||
if (m.find()) {
|
||||
@@ -84,10 +86,10 @@ public class BookInfoPanel extends JPanel {
|
||||
return acx.getText();
|
||||
}
|
||||
|
||||
public void setTitle(String t) { title.setText(t); }
|
||||
public void setAuthor(String a) { author.setText(a); }
|
||||
public void setGenre(String g) { genre.setText(g); }
|
||||
public void setComment(String c) { comment.setText(c); }
|
||||
public void setACX(String a) { acx.setText(a); }
|
||||
public void setTitle(String t) { Debug.trace(); title.setText(t); }
|
||||
public void setAuthor(String a) { Debug.trace(); author.setText(a); }
|
||||
public void setGenre(String g) { Debug.trace(); genre.setText(g); }
|
||||
public void setComment(String c) { Debug.trace(); comment.setText(c); }
|
||||
public void setACX(String a) { Debug.trace(); acx.setText(a); }
|
||||
|
||||
}
|
||||
|
||||
@@ -145,7 +145,33 @@ public class BookTreeRenderer extends DefaultTreeCellRenderer {
|
||||
p.setOpaque(false);
|
||||
return p;
|
||||
} else if (value instanceof Book) {
|
||||
ret.setIcon(((Book)value).getIcon());
|
||||
Book b = (Book)value;
|
||||
|
||||
JPanel p = new JPanel();
|
||||
p.setLayout(new GridBagLayout());
|
||||
GridBagConstraints ctx = new GridBagConstraints();
|
||||
|
||||
ctx.gridx = 0;
|
||||
ctx.gridy = 0;
|
||||
ctx.fill = GridBagConstraints.HORIZONTAL;
|
||||
ctx.anchor = GridBagConstraints.LINE_START;
|
||||
ctx.weightx = 1.0d;
|
||||
|
||||
ret.setIcon(b.getIcon());
|
||||
p.add(ret, ctx);
|
||||
|
||||
JLabel author = new JLabel(b.getAuthor());
|
||||
ctx.gridy++;
|
||||
author.setBorder(new EmptyBorder(0, 27, 0, 0));
|
||||
Font f = author.getFont();
|
||||
Font nf = f.deriveFont(Font.ITALIC, (int)(f.getSize() * 0.75));
|
||||
author.setFont(nf);
|
||||
author.setForeground(author.getForeground().darker());
|
||||
p.add(author, ctx);
|
||||
|
||||
p.setOpaque(false);
|
||||
return p;
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Chapter extends BookTreeNode {
|
||||
|
||||
public Chapter(String i, String chaptername) {
|
||||
super(chaptername);
|
||||
|
||||
Debug.trace();
|
||||
id = i;
|
||||
name = chaptername;
|
||||
preGap = Options.getInteger("catenation.pre-chapter");
|
||||
@@ -46,7 +46,7 @@ public class Chapter extends BookTreeNode {
|
||||
}
|
||||
|
||||
public Chapter(Element root, DefaultTreeModel model) {
|
||||
|
||||
Debug.trace();
|
||||
name = Book.getTextNode(root, "name");
|
||||
id = root.getAttribute("id");
|
||||
preGap = Utils.s2i(Book.getTextNode(root, "pre-gap"));
|
||||
@@ -65,24 +65,29 @@ public class Chapter extends BookTreeNode {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
Debug.trace();
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String i) {
|
||||
Debug.trace();
|
||||
id = i;
|
||||
}
|
||||
|
||||
public Sentence getLastSentence() {
|
||||
Debug.trace();
|
||||
DefaultMutableTreeNode ls = getLastLeaf();
|
||||
if (ls instanceof Sentence) return (Sentence)ls;
|
||||
return null;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Debug.trace();
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setUserObject(Object o) {
|
||||
Debug.trace();
|
||||
if (o instanceof String) {
|
||||
String so = (String)o;
|
||||
name = so;
|
||||
@@ -90,26 +95,32 @@ public class Chapter extends BookTreeNode {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
Debug.trace();
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String n) {
|
||||
Debug.trace();
|
||||
name = n;
|
||||
}
|
||||
|
||||
public void setPreGap(int g) {
|
||||
Debug.trace();
|
||||
preGap = g;
|
||||
}
|
||||
|
||||
public int getPreGap() {
|
||||
Debug.trace();
|
||||
return preGap;
|
||||
}
|
||||
|
||||
public void setPostGap(int g) {
|
||||
Debug.trace();
|
||||
postGap = g;
|
||||
}
|
||||
|
||||
public int getPostGap() {
|
||||
Debug.trace();
|
||||
return postGap;
|
||||
}
|
||||
|
||||
@@ -117,6 +128,7 @@ public class Chapter extends BookTreeNode {
|
||||
public void exportChapter(ProgressDialog exportDialog) throws
|
||||
FileNotFoundException, IOException, InputFormatException, NotSupportedException,
|
||||
EncoderException, UnsupportedTagException, InvalidDataException {
|
||||
Debug.trace();
|
||||
|
||||
if (getChildCount() == 0) return;
|
||||
|
||||
@@ -235,6 +247,7 @@ public class Chapter extends BookTreeNode {
|
||||
}
|
||||
|
||||
public double getChapterLength() {
|
||||
Debug.trace();
|
||||
double totalTime = Options.getInteger("audio.recording.pre-chapter") / 1000d;
|
||||
for (Enumeration s = children(); s.hasMoreElements();) {
|
||||
Sentence sentence = (Sentence)s.nextElement();
|
||||
@@ -249,6 +262,7 @@ public class Chapter extends BookTreeNode {
|
||||
}
|
||||
|
||||
public ArrayList<String> getUsedEffects() {
|
||||
Debug.trace();
|
||||
|
||||
ArrayList<String> out = new ArrayList<String>();
|
||||
|
||||
@@ -266,6 +280,7 @@ public class Chapter extends BookTreeNode {
|
||||
}
|
||||
|
||||
public void resetPostGaps() {
|
||||
Debug.trace();
|
||||
for (Enumeration s = children(); s.hasMoreElements();) {
|
||||
Sentence snt = (Sentence)s.nextElement();
|
||||
snt.resetPostGap();
|
||||
@@ -273,6 +288,7 @@ public class Chapter extends BookTreeNode {
|
||||
}
|
||||
|
||||
public void purgeBackups() {
|
||||
Debug.trace();
|
||||
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||
Object ob = (Object)o.nextElement();
|
||||
if (ob instanceof Sentence) {
|
||||
@@ -283,6 +299,7 @@ public class Chapter extends BookTreeNode {
|
||||
}
|
||||
|
||||
public Element getChapterXML(Document doc) {
|
||||
Debug.trace();
|
||||
Element chapterNode = doc.createElement("chapter");
|
||||
chapterNode.setAttribute("id", id);
|
||||
chapterNode.appendChild(Book.makeTextNode(doc, "name", name));
|
||||
@@ -305,18 +322,22 @@ public class Chapter extends BookTreeNode {
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
Debug.trace();
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String t) {
|
||||
Debug.trace();
|
||||
notes = t;
|
||||
}
|
||||
|
||||
public void onSelect() {
|
||||
Debug.trace();
|
||||
AudiobookRecorder.window.setChapterNotes(notes);
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
Debug.trace();
|
||||
double len = 0;
|
||||
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||
Object ob = (Object)o.nextElement();
|
||||
|
||||
Reference in New Issue
Block a user