Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ebe777bdc5 | |||
| 3b5cacb8ad | |||
| db7d297dbc | |||
| 2f9abf7629 | |||
| b6063d2fed |
@@ -1 +1 @@
|
||||
version=0.3.1
|
||||
version=0.3.2
|
||||
|
||||
BIN
resources/uk/co/majenko/audiobookrecorder/icons/manuscript.png
Normal file
BIN
resources/uk/co/majenko/audiobookrecorder/icons/manuscript.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -36,6 +36,9 @@ import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
|
||||
public class AudiobookRecorder extends JFrame {
|
||||
|
||||
// Settings - tweakable
|
||||
@@ -75,6 +78,7 @@ public class AudiobookRecorder extends JFrame {
|
||||
JMenuItem toolsMerge;
|
||||
JMenuItem toolsArchive;
|
||||
JMenuItem toolsCoverArt;
|
||||
JMenuItem toolsManuscript;
|
||||
JMenuItem toolsOptions;
|
||||
|
||||
JMenuItem helpAbout;
|
||||
@@ -289,6 +293,13 @@ public class AudiobookRecorder extends JFrame {
|
||||
}
|
||||
});
|
||||
|
||||
toolsManuscript = new JMenuItem("Import Manuscript...");
|
||||
toolsManuscript.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
loadManuscript();
|
||||
}
|
||||
});
|
||||
|
||||
toolsOptions = new JMenuItem("Options");
|
||||
toolsOptions.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -299,6 +310,7 @@ public class AudiobookRecorder extends JFrame {
|
||||
toolsMenu.add(toolsMerge);
|
||||
toolsMenu.add(toolsArchive);
|
||||
toolsMenu.add(toolsCoverArt);
|
||||
toolsMenu.add(toolsManuscript);
|
||||
toolsMenu.addSeparator();
|
||||
toolsMenu.add(toolsOptions);
|
||||
|
||||
@@ -560,11 +572,11 @@ public class AudiobookRecorder extends JFrame {
|
||||
controlsTop.add(attention);
|
||||
|
||||
controlsTop.add(Box.createHorizontalGlue());
|
||||
controlsTop.add(new JLabel("Post gap:"));
|
||||
controlsTop.add(new JLabel(" Post gap:"));
|
||||
controlsTop.add(postSentenceGap);
|
||||
controlsTop.add(new JLabel("ms"));
|
||||
controlsTop.add(new JLabel("ms "));
|
||||
|
||||
controlsTop.add(new JLabel("Gain:"));
|
||||
controlsTop.add(new JLabel(" Gain:"));
|
||||
controlsTop.add(gainPercent);
|
||||
controlsTop.add(new JLabel("%"));
|
||||
|
||||
@@ -770,12 +782,27 @@ public class AudiobookRecorder extends JFrame {
|
||||
mainScroll = new JScrollPane();
|
||||
|
||||
notesArea = new JTextArea();
|
||||
notesArea.setFont(new Font("Monospaced", Font.PLAIN, 10));
|
||||
notesScroll = new JScrollPane();
|
||||
notesScroll.setViewportView(notesArea);
|
||||
|
||||
mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mainScroll, notesScroll);
|
||||
centralPanel.add(mainSplit, BorderLayout.CENTER);
|
||||
|
||||
mainSplit.addPropertyChangeListener(new PropertyChangeListener() {
|
||||
public void propertyChange(PropertyChangeEvent ev) {
|
||||
if (ev.getPropertyName().equals("dividerLocation")) {
|
||||
if ((bookTreeModel != null) && (book != null)) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
bookTreeModel.reload(book);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
setTitle("AudioBook Recorder");
|
||||
|
||||
@@ -783,10 +810,17 @@ public class AudiobookRecorder extends JFrame {
|
||||
|
||||
bindKeys(centralPanel);
|
||||
|
||||
mainSplit.setResizeWeight(0.8d);
|
||||
|
||||
pack();
|
||||
mainSplit.setDividerLocation(0.8d);
|
||||
setVisible(true);
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
mainSplit.setDividerLocation(0.8d);
|
||||
}
|
||||
});
|
||||
|
||||
String lastBook = Options.get("path.last-book");
|
||||
|
||||
if (lastBook != null && !lastBook.equals("")) {
|
||||
@@ -3661,4 +3695,33 @@ public class AudiobookRecorder extends JFrame {
|
||||
return notesArea.getText();
|
||||
}
|
||||
|
||||
public void openManuscript() {
|
||||
if (book == null) return;
|
||||
File ms = book.getManuscript();
|
||||
if (ms == null) return;
|
||||
try {
|
||||
Desktop.getDesktop().open(ms);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadManuscript() {
|
||||
if (book == null) return;
|
||||
|
||||
JFileChooser jc = new JFileChooser();
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("Document Files", "doc", "docx", "pdf", "odt");
|
||||
jc.addChoosableFileFilter(filter);
|
||||
jc.setFileFilter(filter);
|
||||
jc.setDialogTitle("Select manuscript");
|
||||
int r = jc.showOpenDialog(this);
|
||||
|
||||
if (r == JFileChooser.APPROVE_OPTION) {
|
||||
File src = jc.getSelectedFile();
|
||||
if (src.exists()) {
|
||||
book.setManuscript(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
String genre;
|
||||
String comment;
|
||||
String ACX;
|
||||
String manuscript;
|
||||
|
||||
String defaultEffect = "none";
|
||||
|
||||
@@ -63,6 +64,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
genre = getTextNode(root, "genre");
|
||||
comment = getTextNode(root, "comment");
|
||||
ACX = getTextNode(root, "acx");
|
||||
manuscript = getTextNode(root, "manuscript");
|
||||
|
||||
AudiobookRecorder.window.setNotes(getTextNode(root, "notes"));
|
||||
|
||||
@@ -183,8 +185,12 @@ public class Book extends DefaultMutableTreeNode {
|
||||
}
|
||||
}
|
||||
|
||||
public File getBookPath() {
|
||||
return new File(Options.get("path.storage"), name);
|
||||
}
|
||||
|
||||
public void renameBook(String newName) {
|
||||
File oldDir = new File(Options.get("path.storage"), name);
|
||||
File oldDir = getBookPath();
|
||||
File newDir = new File(Options.get("path.storage"), newName);
|
||||
|
||||
if (newDir.exists()) {
|
||||
@@ -298,6 +304,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
root.appendChild(makeTextNode(doc, "comment", comment));
|
||||
root.appendChild(makeTextNode(doc, "genre", genre));
|
||||
root.appendChild(makeTextNode(doc, "acx", ACX));
|
||||
root.appendChild(makeTextNode(doc, "manuscript", manuscript));
|
||||
|
||||
root.appendChild(makeTextNode(doc, "notes", AudiobookRecorder.window.getNotes()));
|
||||
|
||||
@@ -333,7 +340,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
|
||||
public static Element makeTextNode(Document doc, String name, String text) {
|
||||
Element node = doc.createElement(name);
|
||||
Text tnode = doc.createTextNode(text);
|
||||
Text tnode = doc.createTextNode(text == null ? "" : text);
|
||||
node.appendChild(tnode);
|
||||
return node;
|
||||
}
|
||||
@@ -367,4 +374,24 @@ public class Book extends DefaultMutableTreeNode {
|
||||
defaultEffect = eff;
|
||||
}
|
||||
|
||||
public void setManuscript(File f) {
|
||||
manuscript = f.getName();
|
||||
File dst = new File(getBookPath(), manuscript);
|
||||
|
||||
try {
|
||||
Files.copy(f.toPath(), dst.toPath());
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public File getManuscript() {
|
||||
if (manuscript == null) return null;
|
||||
if (manuscript.equals("")) return null;
|
||||
File f = new File(getBookPath(), manuscript);
|
||||
if (f.exists()) {
|
||||
return f;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class BookTreeRenderer extends DefaultTreeCellRenderer {
|
||||
}
|
||||
|
||||
if (s.isLocked()) {
|
||||
ret.setForeground(new Color(0x00, 0x80, 0xFF));
|
||||
ret.setForeground(new Color(0x30, 0xb0, 0xFF));
|
||||
icn.add(Overlays.locked, OverlayIcon.BOTTOM_LEFT);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,4 +38,5 @@ public class Icons {
|
||||
static public final ImageIcon docut = new ImageIcon(Icons.class.getResource("icons/do-cut.png"));
|
||||
static public final ImageIcon playto = new ImageIcon(Icons.class.getResource("icons/play-to.png"));
|
||||
static public final ImageIcon disable = new ImageIcon(Icons.class.getResource("icons/disable-effects.png"));
|
||||
static public final ImageIcon manuscript = new ImageIcon(Icons.class.getResource("icons/manuscript.png"));
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ public class MainToolBar extends JToolBar {
|
||||
JButtonSpacePlay playtoSentence;
|
||||
JButtonSpacePlay stopPlaying;
|
||||
JButtonSpacePlay eq;
|
||||
JButtonSpacePlay openManuscript;
|
||||
JToggleButtonSpacePlay mic;
|
||||
|
||||
JComboBox<String> playbackSpeed;
|
||||
@@ -171,6 +172,15 @@ public class MainToolBar extends JToolBar {
|
||||
playbackSpeed.setSelectedIndex(1);
|
||||
add(playbackSpeed);
|
||||
|
||||
addSeparator();
|
||||
openManuscript = new JButtonSpacePlay(Icons.manuscript, "Open Manuscript", new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
root.openManuscript();
|
||||
}
|
||||
});
|
||||
add(openManuscript);
|
||||
|
||||
|
||||
setFloatable(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user