Skip to content

Commit

Permalink
fix: 新規ファイル、開く前に変更していた場合のチェックを追加しました
Browse files Browse the repository at this point in the history
  • Loading branch information
fourthline committed Mar 2, 2014
1 parent 22e1e60 commit 0b06f9c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
20 changes: 15 additions & 5 deletions src/fourthline/mabiicco/ActionDispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,18 @@ public void actionPerformed(ActionEvent e) {
mmlSeqView.pauseTickPosition();
mainFrame.enableNoplayItems();
} else if (command.equals(FILE_OPEN)) {
openMMLFileAction();
if (checkCloseModifiedFileState()) {
openMMLFileAction();
}
} else if (command.equals(NEW_FILE)) {
newMMLFileAction();
if (checkCloseModifiedFileState()) {
newMMLFileAction();
}
} else if (command.equals(RELOAD_FILE)) {
reloadMMLFileAction();
} else if (command.equals(QUIT)) {
// 閉じる前に、変更が保存されていなければダイアログ表示する.
if (checkQuitModifiedFileState()) {
if (checkCloseModifiedFileState()) {
System.exit(0);
}
} else if (command.equals(ADD_TRACK)) {
Expand Down Expand Up @@ -144,7 +148,12 @@ public void reloadMMLFileAction() {
}

if (openedFile != null) {
openMMLFile(openedFile);
if (fileState.isModified()) {
int status = JOptionPane.showConfirmDialog(mainFrame, "いままでの変更が破棄されますが、よろしいですか?", "", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (status == JOptionPane.YES_OPTION) {
openMMLFile(openedFile);
}
}
}
}

Expand Down Expand Up @@ -200,6 +209,7 @@ private void saveMMLFileAction() {
@Override
public void run() {
showDialogSaveFile();
notifyUpdateFileState();
}
});
}
Expand Down Expand Up @@ -245,7 +255,7 @@ private boolean showDialogSaveFile() {
* ファイルの変更状態をみて、アプリケーション終了ができるかどうかをチェックする.
* @return 終了できる状態であれば、trueを返す.
*/
private boolean checkQuitModifiedFileState() {
private boolean checkCloseModifiedFileState() {
if (!fileState.isModified()) {
// 保存が必要な変更なし.
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/fourthline/mabiicco/ui/TrackPropertyPanel.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 たんらる
* Copyright (C) 2013-2014 たんらる
*/

package fourthline.mabiicco.ui;
Expand Down Expand Up @@ -47,7 +47,7 @@ private void initialize() {
trackNameField = new JTextField();
trackNameField.setBounds(100, 36, 200, 19);
// TODO: 日本語を入力したとき、再生時にCPU負荷がかかる問題あり.
trackNameField.setEditable(false);
trackNameField.setEditable(true);
add(trackNameField);
trackNameField.setColumns(10);

Expand Down

0 comments on commit 0b06f9c

Please sign in to comment.