diff --git a/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java b/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java index ad037c1..828c9e2 100644 --- a/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java +++ b/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java @@ -68,6 +68,7 @@ import javax.swing.JTree; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.SwingUtilities; +import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; @@ -139,6 +140,7 @@ public class AudiobookRecorder extends JFrame implements DocumentListener { JMenuItem toolsArchive; JMenuItem toolsCoverArt; JMenuItem toolsManuscript; + JMenuItem toolsReloadEffects; JMenuItem toolsOptions; JMenuItem helpAbout; @@ -372,6 +374,18 @@ public class AudiobookRecorder extends JFrame implements DocumentListener { loadManuscript(); } }); + + toolsReloadEffects = new JMenuItem("Reload effects"); + toolsReloadEffects.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Debug.trace(); + queueJob(new Runnable() { + public void run() { + loadEffects(); + } + }); + } + }); toolsOptions = new JMenuItem("Options"); toolsOptions.addActionListener(new ActionListener() { @@ -385,6 +399,7 @@ public class AudiobookRecorder extends JFrame implements DocumentListener { toolsMenu.add(toolsArchive); toolsMenu.add(toolsCoverArt); toolsMenu.add(toolsManuscript); + toolsMenu.add(toolsReloadEffects); toolsMenu.addSeparator(); toolsMenu.add(toolsOptions); @@ -2210,11 +2225,11 @@ public class AudiobookRecorder extends JFrame implements DocumentListener { bookTree.setEditable(true); bookTree.setUI(new CustomTreeUI(mainScroll)); + TreeCellRenderer renderer = new BookTreeRenderer(); try { - bookTree.setCellRenderer(new BookTreeRenderer()); + bookTree.setCellRenderer(renderer); } catch (Exception ex) { - ex.printStackTrace(); - bookTree.setCellRenderer(new BookTreeRenderer()); + bookTree.setCellRenderer(renderer); } InputMap im = bookTree.getInputMap(JComponent.WHEN_FOCUSED); diff --git a/src/uk/co/majenko/audiobookrecorder/Book.java b/src/uk/co/majenko/audiobookrecorder/Book.java index aa83e92..3f40cbb 100644 --- a/src/uk/co/majenko/audiobookrecorder/Book.java +++ b/src/uk/co/majenko/audiobookrecorder/Book.java @@ -155,12 +155,7 @@ public class Book extends BookTreeNode { public Chapter getLastChapter() { Debug.trace(); - Chapter cc = getClosingCredits(); - if (cc == null) return null; - Chapter c = (Chapter)getChildBefore(cc); - if (c == null) return null; - if (c.getId().equals("open")) return null; - return c; + return (Chapter)getLastLeaf(); } public Chapter getChapter(int n) { @@ -453,6 +448,8 @@ public class Book extends BookTreeNode { Debug.trace(); SwingUtilities.invokeLater(new Runnable() { public void run() { + if (AudiobookRecorder.window == null) return; + if (AudiobookRecorder.window.bookTreeModel == null) return; AudiobookRecorder.window.bookTreeModel.reload(Book.this); } }); diff --git a/src/uk/co/majenko/audiobookrecorder/MainToolBar.java b/src/uk/co/majenko/audiobookrecorder/MainToolBar.java index 1ffaa89..07ecf84 100644 --- a/src/uk/co/majenko/audiobookrecorder/MainToolBar.java +++ b/src/uk/co/majenko/audiobookrecorder/MainToolBar.java @@ -19,7 +19,6 @@ public class MainToolBar extends JToolBar { JButtonSpacePlay playonSentence; JButtonSpacePlay playtoSentence; JButtonSpacePlay stopPlaying; - JButtonSpacePlay eq; JButtonSpacePlay openManuscript; JToggleButtonSpacePlay mic; @@ -102,16 +101,6 @@ public class MainToolBar extends JToolBar { }); add(stopPlaying); - addSeparator(); - eq = new JButtonSpacePlay(Icons.eq, "Reload Effects", new ActionListener() { - public void actionPerformed(ActionEvent e) { - root.loadEffects(); - CacheManager.purgeCache(); - } - }); - - add(eq); - addSeparator(); mic = new JToggleButtonSpacePlay(Icons.mic, "Enable / disable microphone", new ActionListener() { diff --git a/src/uk/co/majenko/audiobookrecorder/Options.java b/src/uk/co/majenko/audiobookrecorder/Options.java index 9f233aa..7968cc2 100644 --- a/src/uk/co/majenko/audiobookrecorder/Options.java +++ b/src/uk/co/majenko/audiobookrecorder/Options.java @@ -388,7 +388,7 @@ public class Options extends JDialog { enableParsing = addCheckBox(optionsPanel, "Enable automatic speech-to-text (**SLOW**)", getBoolean("process.sphinx"), "This will automatically start recognising the speech in every sentence you record. This can really slow down recording though so it's recommended to leave it turned off and do your recognition afterwards as a batch operation."); speechCommand = addTextField(optionsPanel, "Speech to text command (must take 1 filename parameter):", get("process.command"), "This specifies what command to run to recognize the speech. This command must take only one parameter, which is the full path of the WAV file. It should return (on standard output) the recognised speech."); - workerThreads = addSpinner(optionsPanel, "Worker threads:", 1, 100, 1, getInteger("process.threads"), "", "How many concurrent threads to run when processing speech. This should ideally be no more than the number of CPU cores you have in your computer."); + workerThreads = addSpinner(optionsPanel, "Worker threads:", 1, 100, 1, getInteger("process.threads"), "", "How many concurrent threads to run when processing speech. This should ideally be no more than the number of CPU cores you have in your computer minus one."); addSeparator(optionsPanel);