Skip to content

Commit

Permalink
Improve image export dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
mmyers committed Jun 18, 2024
1 parent 75a3436 commit 83277ba
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
32 changes: 16 additions & 16 deletions EU3_Scenario_Editor/src/editor/EditorUI.form
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="reloadMenuItem">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+R"/>
</Property>
<Property name="text" type="java.lang.String" value="Force a reload of all data"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="reloadMenuItemActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="false"/>
</AuxValues>
</MenuItem>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator7">
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="exportImageMenuItem">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
Expand Down Expand Up @@ -118,6 +102,22 @@
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
</MenuItem>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator7">
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="reloadMenuItem">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+R"/>
</Property>
<Property name="text" type="java.lang.String" value="Force a reload of all data"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="reloadMenuItemActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="false"/>
</AuxValues>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="viewMenu">
Expand Down
19 changes: 11 additions & 8 deletions EU3_Scenario_Editor/src/editor/EditorUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,6 @@ private void initComponents() {
showCountryHistButton = new javax.swing.JButton();
javax.swing.JMenuBar menuBar = new javax.swing.JMenuBar();
javax.swing.JMenu fileMenu = new javax.swing.JMenu();
reloadMenuItem = new javax.swing.JMenuItem();
javax.swing.JPopupMenu.Separator jSeparator7 = new javax.swing.JPopupMenu.Separator();
exportImageMenuItem = new javax.swing.JMenuItem();
javax.swing.JPopupMenu.Separator jSeparator8 = new javax.swing.JPopupMenu.Separator();
exitMenuItem = new javax.swing.JMenuItem();
Expand All @@ -424,6 +422,8 @@ private void initComponents() {
goToProvMenuItem = new javax.swing.JMenuItem();
javax.swing.JSeparator jSeparator3 = new javax.swing.JSeparator();
setDateMenuItem = new javax.swing.JMenuItem();
javax.swing.JPopupMenu.Separator jSeparator7 = new javax.swing.JPopupMenu.Separator();
reloadMenuItem = new javax.swing.JMenuItem();
viewMenu = new javax.swing.JMenu();
helpMenu = new javax.swing.JMenu();
aboutMenuItem = new javax.swing.JMenuItem();
Expand Down Expand Up @@ -543,12 +543,6 @@ private void initComponents() {
fileMenu.setMnemonic('F');
fileMenu.setText("File");

reloadMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_DOWN_MASK));
reloadMenuItem.setText("Force a reload of all data");
reloadMenuItem.addActionListener(formListener);
fileMenu.add(reloadMenuItem);
fileMenu.add(jSeparator7);

exportImageMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_DOWN_MASK));
exportImageMenuItem.setText("Export map as image...");
exportImageMenuItem.addActionListener(formListener);
Expand Down Expand Up @@ -579,6 +573,12 @@ private void initComponents() {

setDateMenuItem.setAction(setDateAction);
toolsMenu.add(setDateMenuItem);
toolsMenu.add(jSeparator7);

reloadMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_DOWN_MASK));
reloadMenuItem.setText("Force a reload of all data");
reloadMenuItem.addActionListener(formListener);
toolsMenu.add(reloadMenuItem);

menuBar.add(toolsMenu);

Expand Down Expand Up @@ -958,6 +958,9 @@ private void mapPanelMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {//GEN-
private void exportImageMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportImageMenuItemActionPerformed
JFileChooser chooser = new JFileChooser();
chooser.setDialogType(JFileChooser.SAVE_DIALOG);
chooser.setDialogTitle("Choose an image file to export the map");
chooser.setApproveButtonText("Export");
chooser.setSelectedFile(new java.io.File("export.png"));
chooser.setFileFilter(new FileNameExtensionFilter("JPG or PNG files", "jpg", "jpeg", "png"));

if (chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
Expand Down

0 comments on commit 83277ba

Please sign in to comment.