Set version 1.3.0, update about.

This commit is contained in:
Andrew Lalis 2023-07-09 21:57:20 -04:00
parent 9ae48ec944
commit cfb70b14e8
5 changed files with 52 additions and 10 deletions

View File

@ -5,9 +5,11 @@ This application was developed in order to make the production of written books
## Using Block Book Binder ## Using Block Book Binder
To get started, look for the [**Releases**](https://github.com/andrewlalis/BlockBookBinder/releases) section on this page, and find the latest release. Download the executable JAR file and you're ready to go. Simply paste some plain text into the _Source_ panel on the right-hand side, and press the button _Convert to Book_ to process that text into a series of pages which will appear on the left-hand side. To get started, look for the [**Releases**](https://github.com/andrewlalis/BlockBookBinder/releases) section on this page, and find the latest release. Download the executable JAR file, and make sure you have Java version 17 or higher installed to run it.
Once you're happy with how the pages are formatted, you can click the _Export_ button to begin exporting pages to your clipboard. Once you give an affirmative response to the confirmation popup that appears, the first page will be loaded into your clipboard. You can then use `CTRL + V` to paste the page into your book. Each time you do, the program will take about a second to load the next page into your clipboard, so that you can paste it without even having to leave your game. Start the program, and you'll be greeted with a window that has **Book Preview** and **Source Text** panels. Enter the text you'd like to work with into the **Source Text** panel. In the top menu under **Book**, you'll find a **Clean Source** button, which will remove extra whitespace from the text to make it more friendly for Minecraft's cramped style. You'll also find **Compile from Source**, which will compile your source text into a book in the **Book Preview** panel.
Once you're happy with how the pages are formatted, you can click the **Export to Minecraft** button to begin exporting pages to your clipboard.
## Demo Video on YouTube ## Demo Video on YouTube
https://youtu.be/Mu7Hv1na7Sw https://youtu.be/Mu7Hv1na7Sw

View File

@ -6,7 +6,7 @@
<groupId>nl.andrewlalis</groupId> <groupId>nl.andrewlalis</groupId>
<artifactId>BlockBookBinder</artifactId> <artifactId>BlockBookBinder</artifactId>
<version>1.3.0-SNAPSHOT</version> <version>1.3.0</version>
<properties> <properties>
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>

View File

@ -1,14 +1,27 @@
package nl.andrewlalis.blockbookbinder.control.source; package nl.andrewlalis.blockbookbinder.control.source;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import nl.andrewlalis.blockbookbinder.BlockBookBinder;
import nl.andrewlalis.blockbookbinder.view.SourceTextPanel;
import javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.prefs.Preferences;
public class ImportSourceAction extends AbstractAction { public class ImportSourceAction extends AbstractAction {
@Getter @Getter
private static final ImportSourceAction instance = new ImportSourceAction(); private static final ImportSourceAction instance = new ImportSourceAction();
@Setter
private SourceTextPanel sourceTextPanel;
public ImportSourceAction() { public ImportSourceAction() {
super("Import Source"); super("Import Source");
this.putValue(SHORT_DESCRIPTION, "Import source text from a file."); this.putValue(SHORT_DESCRIPTION, "Import source text from a file.");
@ -16,6 +29,24 @@ public class ImportSourceAction extends AbstractAction {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Preferences prefs = Preferences.userNodeForPackage(BlockBookBinder.class);
String dir = prefs.get("source-import-dir", ".");
JFileChooser fileChooser = new JFileChooser(dir);
fileChooser.setFileFilter(new FileNameExtensionFilter("Text files", ".txt"));
fileChooser.setAcceptAllFileFilterUsed(true);
fileChooser.setMultiSelectionEnabled(false);
final Component parent = SwingUtilities.getWindowAncestor((Component) e.getSource());
int result = fileChooser.showOpenDialog(parent);
if (result == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
try {
Path filePath = file.toPath();
sourceTextPanel.setSourceText(Files.readString(filePath));
prefs.put("source-import-dir", filePath.getParent().toAbsolutePath().toString());
} catch (IOException exc) {
exc.printStackTrace();
JOptionPane.showMessageDialog(parent, "Failed to read file:\n" + exc.getMessage(), "Read Failed", JOptionPane.ERROR_MESSAGE);
}
}
} }
} }

View File

@ -44,14 +44,13 @@ public class MainFrame extends JFrame {
BookPreviewPanel bookPreviewPanel = new BookPreviewPanel(); BookPreviewPanel bookPreviewPanel = new BookPreviewPanel();
doublePanel.add(bookPreviewPanel); doublePanel.add(bookPreviewPanel);
CompileFromSourceAction.getInstance().setBookPreviewPanel(bookPreviewPanel); CompileFromSourceAction.getInstance().setBookPreviewPanel(bookPreviewPanel);
CompileFromSourceAction.getInstance().setBookPreviewPanel(bookPreviewPanel);
ExportBookToMinecraftAction.getInstance().setBookPreviewPanel(bookPreviewPanel); ExportBookToMinecraftAction.getInstance().setBookPreviewPanel(bookPreviewPanel);
SourceTextPanel sourceTextPanel = new SourceTextPanel(); SourceTextPanel sourceTextPanel = new SourceTextPanel();
doublePanel.add(sourceTextPanel); doublePanel.add(sourceTextPanel);
CompileFromSourceAction.getInstance().setSourceTextPanel(sourceTextPanel); CompileFromSourceAction.getInstance().setSourceTextPanel(sourceTextPanel);
CompileFromSourceAction.getInstance().setSourceTextPanel(sourceTextPanel);
CleanSourceAction.getInstance().setSourceTextPanel(sourceTextPanel); CleanSourceAction.getInstance().setSourceTextPanel(sourceTextPanel);
ImportSourceAction.getInstance().setSourceTextPanel(sourceTextPanel);
mainPanel.add(doublePanel, BorderLayout.CENTER); mainPanel.add(doublePanel, BorderLayout.CENTER);
@ -70,7 +69,6 @@ public class MainFrame extends JFrame {
JMenu bookMenu = new JMenu("Book"); JMenu bookMenu = new JMenu("Book");
bookMenu.add(CompileFromSourceAction.getInstance()); bookMenu.add(CompileFromSourceAction.getInstance());
bookMenu.add(CompileFromSourceAction.getInstance());
bookMenu.add(CleanSourceAction.getInstance()); bookMenu.add(CleanSourceAction.getInstance());
bookMenu.add(ExportBookToMinecraftAction.getInstance()); bookMenu.add(ExportBookToMinecraftAction.getInstance());
menuBar.add(bookMenu); menuBar.add(bookMenu);

View File

@ -9,15 +9,15 @@
<h1>About BlockBookBinder</h1> <h1>About BlockBookBinder</h1>
<p> <p>
The <em>BlockBookBinder</em> is a simple application that gives you the power to write books faster than ever before! All you need to do is copy and paste some text into the <em>Source</em> panel on the right-hand side of the application, and click <strong>Convert to Book</strong>. Your text will be transformed so that it can fit onto written books in Minecraft, and you can preview the book in the <em>Book Preview</em> panel on the left-hand side of the application, using the navigation buttons below. The <em>BlockBookBinder</em> is a simple application that gives you the power to write books faster than ever before! All you need to do is copy and paste some text into the <em>Source</em> panel on the right-hand side of the application, and click <strong>Compile from Source</strong>. Your text will be transformed so that it can fit onto written books in Minecraft, and you can preview the book in the <em>Book Preview</em> panel on the left-hand side of the application, using the navigation buttons below.
</p> </p>
<p><em> <p><em>
Note that your text might benefit from the <strong>Clean</strong> functionality, where extra new-line and other unnecessary whitespace characters are removed so that the text can be better compressed into Minecraft's limited format. Note that your text might benefit from the <strong>Clean Source</strong> functionality, where extra new-line and other unnecessary whitespace characters are removed so that the text can be better compressed into Minecraft's limited format.
</em></p> </em></p>
<p> <p>
Once you've prepared a book and you want to actually copy it into Minecraft, click on <strong>Export to Book</strong>. This will open up a popup with a few different buttons: Once you've prepared a book and you want to actually copy it into Minecraft, click on <strong>Export to Minecraft</strong>. This will open up a popup with a few different buttons:
</p> </p>
<ul> <ul>
@ -38,6 +38,17 @@
When all pages have been exported, you'll be prompted with a little popup, after which the export popup closes and you have the option to export again, or simply close the application if you're done. When all pages have been exported, you'll be prompted with a little popup, after which the export popup closes and you have the option to export again, or simply close the application if you're done.
</p> </p>
<h3>Troubleshooting</h3>
<p>
This program works by hijacking your PC's input system to automatically transfer text to the system's clipboard, and then paste it by pressing <em>CTRL+V</em> for you. Because of the nature of such applications, there's no guarantee that this process will work on every computer. Here are some tips to try and get things working.
</p>
<ul>
<li>Try to increase the auto-paste delay to 1 second or more, if you notice some pages being skipped during the export process.</li>
<li>If the automated approach fails, you can always select and copy each page from the book preview.</li>
</ul>
<hr> <hr>
<p> <p>