Skip to content

Commit

Permalink
Reordering file menu
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaskelly committed Mar 13, 2020
1 parent 1628b86 commit b6b5aa2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
11 changes: 10 additions & 1 deletion DelvEdit/src/com/interrupt/dungeoneer/editor/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileFilter;
import java.util.Timer;
Expand All @@ -38,6 +39,8 @@ public enum EditorMode { Carve, Paint };
public ActionListener saveAction;
public ActionListener saveAsAction;
public ActionListener openAction;
public ActionListener exitAction;

public ActionListener rotateLeftAction;
public ActionListener rotateRightAction;
public ActionListener playAction;
Expand Down Expand Up @@ -89,7 +92,7 @@ public enum EditorMode { Carve, Paint };
public Editor() {

frame = new JFrame("DelvEdit");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE | JFrame.EXIT_ON_CLOSE);

Graphics.DisplayMode defaultMode = LwjglApplicationConfiguration.getDesktopDisplayMode();

Expand Down Expand Up @@ -302,6 +305,12 @@ else if(file.endsWith(".bin")) {
}
};

exitAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
}
};

rotateLeftAction = new ActionListener() {
public void actionPerformed(ActionEvent event) {
editorFrame.level.rotate90();
Expand Down
7 changes: 5 additions & 2 deletions DelvEdit/src/com/interrupt/dungeoneer/editor/ui/EditorUi.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,13 @@ public void actionPerformed(ActionEvent event) {
// make the menu bar
menuBar = new Scene2dMenuBar(smallSkin);
menuBar.addItem(new MenuItem("File", smallSkin)
.addItem(new MenuItem("Save", smallSkin, editor.saveAction).setAccelerator(new MenuAccelerator(Keys.S, true, false)))
.addItem(new MenuItem("Save As...", smallSkin, editor.saveAsAction).setAccelerator(new MenuAccelerator(Keys.S, true, true)))
.addItem(new MenuItem("New", smallSkin, newWindowAction).setAccelerator(new MenuAccelerator(Keys.N, true, false)))
.addItem(new MenuItem("Open", smallSkin, editor.openAction).setAccelerator(new MenuAccelerator(Keys.O, true, false)))
.addSeparator()
.addItem(new MenuItem("Save", smallSkin, editor.saveAction).setAccelerator(new MenuAccelerator(Keys.S, true, false)))
.addItem(new MenuItem("Save As...", smallSkin, editor.saveAsAction).setAccelerator(new MenuAccelerator(Keys.S, true, true)))
.addSeparator()
.addItem(new MenuItem("Exit", smallSkin, editor.exitAction))
);

menuBar.addItem(new MenuItem("Edit", smallSkin)
Expand Down

0 comments on commit b6b5aa2

Please sign in to comment.