Added chapter and book level resetting of post gaps
This commit is contained in:
@@ -1187,6 +1187,14 @@ public class AudiobookRecorder extends JFrame {
|
||||
}
|
||||
});
|
||||
|
||||
JMenuObject resetChapterGaps = new JMenuObject("Reset post gaps", c, new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JMenuObject o = (JMenuObject)e.getSource();
|
||||
Chapter c = (Chapter)o.getObject();
|
||||
c.resetPostGaps();
|
||||
}
|
||||
});
|
||||
|
||||
JMenuObject moveUp = new JMenuObject("Move Up", c, new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JMenuObject o = (JMenuObject)e.getSource();
|
||||
@@ -1354,6 +1362,7 @@ public class AudiobookRecorder extends JFrame {
|
||||
|
||||
menu.add(convertAll);
|
||||
menu.add(normalizeAll);
|
||||
menu.add(resetChapterGaps);
|
||||
menu.addSeparator();
|
||||
menu.add(moveUp);
|
||||
menu.add(moveDown);
|
||||
@@ -1442,6 +1451,17 @@ public class AudiobookRecorder extends JFrame {
|
||||
});
|
||||
menu.add(editData);
|
||||
|
||||
JMenuObject resetBookGaps = new JMenuObject("Reset all post gaps", book, new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
for (Enumeration ch = book.children(); ch.hasMoreElements();) {
|
||||
Chapter chap = (Chapter)ch.nextElement();
|
||||
chap.resetPostGaps();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
menu.add(resetBookGaps);
|
||||
|
||||
menu.show(bookTree, e.getX(), e.getY());
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ public class BookTreeRenderer extends DefaultTreeCellRenderer {
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
|
||||
JLabel ret = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
|
||||
ret.setIconTextGap(0);
|
||||
ret.setBorder(new EmptyBorder(0, 0, 0, 0));
|
||||
if (value instanceof Sentence) {
|
||||
Sentence s = (Sentence)value;
|
||||
|
||||
|
||||
@@ -232,5 +232,11 @@ public class Chapter extends DefaultMutableTreeNode {
|
||||
return out;
|
||||
}
|
||||
|
||||
public void resetPostGaps() {
|
||||
for (Enumeration s = children(); s.hasMoreElements();) {
|
||||
Sentence snt = (Sentence)s.nextElement();
|
||||
snt.resetPostGap();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1269,4 +1269,20 @@ public class Sentence extends DefaultMutableTreeNode implements Cacheable {
|
||||
}
|
||||
postGapType = t;
|
||||
}
|
||||
|
||||
public void resetPostGap() {
|
||||
if (postGapType == null) {
|
||||
postGapType = "sentence";
|
||||
}
|
||||
if (postGapType.equals("continuation")) {
|
||||
setPostGap(Options.getInteger("catenation.short-sentence"));
|
||||
} else if (postGapType.equals("paragraph")) {
|
||||
setPostGap(Options.getInteger("catenation.post-paragraph"));
|
||||
} else if (postGapType.equals("section")) {
|
||||
setPostGap(Options.getInteger("catenation.post-section"));
|
||||
} else {
|
||||
setPostGap(Options.getInteger("catenation.post-sentence"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user