• R/O
  • SSH
  • HTTPS

copper: Commit


Commit MetaInfo

Revision1559 (tree)
Time2018-05-19 11:27:23
Authormiyabe

Log Message

(empty log message)

Change Summary

Incremental Difference

--- solutions/CopperReaderFX/trunk/src/main/net/zamasoft/reader/Constants.java (revision 1558)
+++ solutions/CopperReaderFX/trunk/src/main/net/zamasoft/reader/Constants.java (revision 1559)
@@ -25,7 +25,7 @@
2525 /**
2626 * バージョン番号。
2727 */
28- public static final String VERSION = "1.4.0";
28+ public static final String VERSION = "1.2.0";
2929
3030 /**
3131 * 表紙プレビューのバッファの描画サイズ。
--- solutions/CopperReaderFX/trunk/src/main/net/zamasoft/reader/messages.xml (revision 1558)
+++ solutions/CopperReaderFX/trunk/src/main/net/zamasoft/reader/messages.xml (revision 1559)
@@ -15,10 +15,10 @@
1515 <entry key="failOnLoadMessage">ファイルが有効なEPUBファイルではない可能性があります。</entry>
1616 <entry key="failOnTrush">本を削除できません。ファイルが使用中の可能性があります。</entry>
1717 <entry key="confirm">確認</entry>
18-<entry key="emptyTrush">ゴミ箱を空にしますか?</entry>
1918 <entry key="error">エラー</entry>
2019 <entry key="failOnWebSearch">検索文字列が長過ぎます</entry>
2120 <entry key="failOnWebSearchMessage">Web検索は100文字までです。(現在{0}文字)</entry>
21+<entry key="confirmDelete">書籍を削除します。よろしいですか?</entry>
2222
2323 <entry key="search">検索</entry>
2424 <entry key="textSize">文字の大きさ</entry>
@@ -59,7 +59,7 @@
5959 <entry key="appConfig">この設定をアプリの初期設定とする</entry>
6060 <entry key="yes">はい</entry>
6161 <entry key="no">いいえ</entry>
62-<entry key="trush">ゴミ箱</entry>
62+<entry key="delete">削除</entry>
6363 <entry key="addBookmark">しおりをはさむ</entry>
6464 <entry key="brightness">明るさ</entry>
6565 <entry key="displayRequired">スリープしない</entry>
@@ -70,6 +70,7 @@
7070 <entry key="portraitFlip">縦反転</entry>
7171 <entry key="landscapeFlip">横反転</entry>
7272 <entry key="zoom">ズーム</entry>
73+<entry key="noBooks">該当するコンテンツはありません。</entry>
7374
7475 <entry key="marker">マーカー</entry>
7576 <entry key="bookmark">しおり</entry>
--- solutions/CopperReaderFX/trunk/src/main/net/zamasoft/reader/shelf/BookPane.java (revision 1558)
+++ solutions/CopperReaderFX/trunk/src/main/net/zamasoft/reader/shelf/BookPane.java (revision 1559)
@@ -32,6 +32,8 @@
3232 private final Canvas canvas;
3333
3434 private final Label label;
35+
36+ private boolean selected;
3537
3638 public BookPane(final ShelfItem book) {
3739 this.book = book;
@@ -76,6 +78,15 @@
7678 });
7779 }
7880 }
81+
82+ public void setSelected(boolean selected) {
83+ this.selected = selected;
84+ this.update();
85+ }
86+
87+ public boolean getSelected() {
88+ return this.selected;
89+ }
7990
8091 private void drawCover(Image image, GraphicsContext g) {
8192 double y = Constants.THUMB_HEIGHT - image.getHeight();
@@ -88,5 +99,10 @@
8899 g.drawImage(image, 0, y + 20);
89100 g.setFill(Color.BLACK);
90101 g.strokeRect(0, 20, Constants.THUMB_WIDTH, Constants.THUMB_HEIGHT);
102+
103+ if (this.selected) {
104+ g.setFill(new Color(1, 1, 1, 0.5));
105+ g.fillRect(0, 0, Constants.THUMB_WIDTH, Constants.THUMB_HEIGHT + 20);
106+ }
91107 }
92108 }
--- solutions/CopperReaderFX/trunk/src/main/net/zamasoft/reader/shelf/BooksController.java (revision 1558)
+++ solutions/CopperReaderFX/trunk/src/main/net/zamasoft/reader/shelf/BooksController.java (revision 1559)
@@ -1,7 +1,9 @@
11 package net.zamasoft.reader.shelf;
22
3+import java.io.IOException;
34 import java.util.Arrays;
45 import java.util.Comparator;
6+import java.util.Iterator;
57 import java.util.List;
68 import java.util.concurrent.ExecutorService;
79 import java.util.concurrent.LinkedBlockingQueue;
@@ -8,6 +10,7 @@
810 import java.util.concurrent.ThreadFactory;
911 import java.util.concurrent.ThreadPoolExecutor;
1012 import java.util.concurrent.TimeUnit;
13+import java.util.logging.Level;
1114 import java.util.logging.Logger;
1215
1316 import javafx.application.Platform;
@@ -248,53 +251,43 @@
248251 public BookPane addBook(final ShelfItem book, final boolean replace) {
249252 final BookPane bookPane = new BookPane(book);
250253
251- new Object() {
252- {
253- bookPane.setOnMouseEntered(new EventHandler<MouseEvent>() {
254- public void handle(MouseEvent ev) {
255- // マウスがかぶったらプレビュー
256- shelf.previewBook(bookPane);
257- ev.consume();
258- }
259- });
260- bookPane.setOnMouseExited(new EventHandler<MouseEvent>() {
261- public void handle(MouseEvent ev) {
262- // マウスが離れたらプレビューを消す
263- shelf.hidePreviewBook();
264- ev.consume();
265- }
266- });
254+ bookPane.setOnMouseEntered(new EventHandler<MouseEvent>() {
255+ public void handle(MouseEvent ev) {
256+ // マウスがかぶったらプレビュー
257+ shelf.previewBook(bookPane);
258+ ev.consume();
259+ }
260+ });
261+ bookPane.setOnMouseExited(new EventHandler<MouseEvent>() {
262+ public void handle(MouseEvent ev) {
263+ // マウスが離れたらプレビューを消す
264+ shelf.hidePreviewBook();
265+ ev.consume();
266+ }
267+ });
267268
268- bookPane.setOnMouseClicked(new EventHandler<MouseEvent>() {
269- public void handle(MouseEvent ev) {
270- if (!ev.getButton().equals(MouseButton.PRIMARY) || ev.getClickCount() >= 2) {
271- return;
272- }
269+ bookPane.setOnMouseClicked(new EventHandler<MouseEvent>() {
270+ public void handle(MouseEvent ev) {
271+ if (!ev.getButton().equals(MouseButton.PRIMARY)) {
272+ ev.consume();
273+ return;
274+ }
273275
274- if (ev.getX() - Constants.THUMB_WIDTH < -48 || ev.getY() - Constants.THUMB_HEIGHT - 20 < -48) {
275- ReaderApplication.getInstance().getMainController().openBook(bookPane.book, shelf);
276- bookPane.update();
277- return;
276+ if (ev.getClickCount() == 1) {
277+ bookPane.setSelected(!bookPane.getSelected());
278+ shelf.toolbarController.update();
279+ return;
280+ }
281+
282+ if (ev.getClickCount() >= 2) {
283+ ReaderApplication.getInstance().getMainController().openBook(bookPane.book, shelf);
284+ bookPane.update();
285+ ev.consume();
286+ return;
287+ }
288+ }
289+ });
278290
279- }
280- }
281- });
282-
283- // ドラッグの開始
284- bookPane.setOnDragDetected(new EventHandler<MouseEvent>() {
285- public void handle(MouseEvent event) {
286- /*
287- * Dragboard db = bookPane .startDragAndDrop(TransferMode.ANY);
288- *
289- * ClipboardContent content = new ClipboardContent();
290- * content.putFiles(Arrays.asList(book.getFile())); db.setContent(content);
291- */
292-
293- event.consume();
294- }
295- });
296- }
297- };
298291 ObservableList<Node> list = box.getChildren();
299292 boolean replaced = false;
300293 if (replace) {
@@ -309,6 +302,17 @@
309302 }
310303 return bookPane;
311304 }
305+
306+ public boolean hasSelectedBook() {
307+ ObservableList<Node> list = box.getChildren();
308+ for (Node node : list) {
309+ BookPane pane = (BookPane) node;
310+ if (pane.getSelected()) {
311+ return true;
312+ }
313+ }
314+ return false;
315+ }
312316
313317 public BookPane getSameBookPane(ShelfItem item) {
314318 ObservableList<Node> list = box.getChildren();
@@ -322,17 +326,21 @@
322326 }
323327
324328 /**
325- * 本の除去。
329+ * 選択した本の削除j。
326330 *
327331 * @param book
328332 */
329- public void removeBook(ShelfItem book) {
333+ public void deleteBooks() {
330334 ObservableList<Node> list = this.box.getChildren();
331- for (int i = 0; i < list.size(); ++i) {
332- BookPane pane = (BookPane) list.get(i);
333- if (pane.book == book) {
334- list.remove(i);
335- return;
335+ for (Iterator<Node> i = list.iterator(); i.hasNext();) {
336+ BookPane pane = (BookPane)i.next();
337+ if (pane.getSelected()) {
338+ try {
339+ pane.book.dispose();
340+ i.remove();
341+ } catch (IOException e) {
342+ LOG.log(Level.WARNING, "削除できませんでした。", e);
343+ }
336344 }
337345 }
338346 }
--- solutions/CopperReaderFX/trunk/src/main/net/zamasoft/reader/shelf/ToolBarController.java (revision 1558)
+++ solutions/CopperReaderFX/trunk/src/main/net/zamasoft/reader/shelf/ToolBarController.java (revision 1559)
@@ -60,6 +60,9 @@
6060 private Button addButton;
6161
6262 @FXML
63+ private Button deleteButton;
64+
65+ @FXML
6366 private Button fullScreenButton;
6467
6568 @FXML
@@ -122,6 +125,7 @@
122125 this.addButton.setDisable(false);
123126 this.reloadButton.setDisable(false);
124127 this.sortButton.setDisable(false);
128+ this.deleteButton.setDisable(!this.shelf.userBoard.booksController.hasSelectedBook());
125129
126130 this.sortCombo.getSelectionModel().selectedIndexProperty().removeListener(this.combol);
127131 this.sortCombo.setVisible(false);
@@ -191,8 +195,23 @@
191195 Constants.MESSAGES.getString("failOnLoadMessage"), false);
192196 }
193197 }
198+
194199
195200 /**
201+ * ファイルの削除。
202+ *
203+ * @param e
204+ */
205+ @FXML
206+ private void deleteAction(ActionEvent ev) {
207+ if (!AlertController.showDialog(Constants.MESSAGES.getString("confirm"),
208+ Constants.MESSAGES.getString("confirmDelete"), true)) {
209+ return;
210+ }
211+ this.shelf.userBoard.booksController.deleteBooks();
212+ }
213+
214+ /**
196215 * 検索。
197216 *
198217 * @param e
Show on old repository browser