Skip to content

Commit

Permalink
Fixed enabled/disabled status of OSM menu items in Maps menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernie Jenny committed Apr 19, 2017
1 parent f0787b7 commit b6bce59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/ika/gui/MainWindow.form
Original file line number Diff line number Diff line change
Expand Up @@ -1816,7 +1816,7 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,119,0,0,4,39"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,119,0,0,4,-48"/>
</AuxValues>

<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
Expand Down Expand Up @@ -3534,7 +3534,7 @@
</Property>
<Property name="opaque" type="boolean" value="false"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[160, 136]"/>
<Dimension value="[250, 136]"/>
</Property>
</Properties>
<Constraints>
Expand Down
31 changes: 13 additions & 18 deletions src/ika/gui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,11 @@ private void updateMapsMenu() {
removeOSMMenuItem.setEnabled(isUsingOSM);
correctOSMMisalignmentBugMenuItem.setEnabled(isUsingOSM && hasNewPoints);
showOSMGraticuleCheckBoxMenuItem.setEnabled(isUsingOSM);
showOSMGraticuleCheckBoxMenuItem.setSelected(osm.isShowGraticule());
showOSMGraticuleCheckBoxMenuItem.setSelected(isUsingOSM && osm.isShowGraticule());
showOSMPolarCirclesCheckBoxMenuItem.setEnabled(isUsingOSM);
showOSMPolarCirclesCheckBoxMenuItem.setSelected(osm.isShowPolarCircles());
showOSMPolarCirclesCheckBoxMenuItem.setSelected(isUsingOSM && osm.isShowPolarCircles());
showOSMTropicsCheckBoxMenuItem.setEnabled(isUsingOSM);
showOSMTropicsCheckBoxMenuItem.setSelected(osm.isShowTropics());
showOSMTropicsCheckBoxMenuItem.setSelected(isUsingOSM && osm.isShowTropics());

removeNewRasterImageMenuItem.setEnabled(manager.getNewMap() != null);
removeOldRasterImageMenuItem.setEnabled(manager.getOldMap() != null);
Expand Down Expand Up @@ -2424,7 +2424,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
transformationInfoTextArea.setFocusable(false);
transformationInfoTextArea.setMinimumSize(new java.awt.Dimension(200, 21));
transformationInfoTextArea.setOpaque(false);
transformationInfoTextArea.setPreferredSize(new java.awt.Dimension(160, 136));
transformationInfoTextArea.setPreferredSize(new java.awt.Dimension(250, 136));
transformationInfoPanel.add(transformationInfoTextArea, java.awt.BorderLayout.CENTER);

gridBagConstraints = new java.awt.GridBagConstraints();
Expand Down Expand Up @@ -4391,6 +4391,7 @@ private boolean saveProject(String path) {
FileOutputStream fileStream = new FileOutputStream(path);
fileStream.write(serializedManager);
} catch (Exception e) {
Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, e);
JOptionPane.showMessageDialog(this, "An error occured. "
+ "The file could not be saved.\n"
+ "Please try saving the file to another location.",
Expand Down Expand Up @@ -5572,11 +5573,10 @@ private void exportLinkedPointsInPixelsMenuItemActionPerformed(java.awt.event.Ac
}//GEN-LAST:event_exportLinkedPointsInPixelsMenuItemActionPerformed

private void saveProjectMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveProjectMenuItemActionPerformed

// ask for file path if the document has never been saved or if its
// path is invalid.
if (this.filePath == null || !new java.io.File(this.filePath).exists()) {
this.filePath = FileUtils.askFile(this, "Save Project", false);
if (filePath == null || !new java.io.File(filePath).exists()) {
filePath = FileUtils.askFile(this, "Save Project", false);
}

if (filePath == null) {
Expand All @@ -5585,16 +5585,11 @@ private void saveProjectMenuItemActionPerformed(java.awt.event.ActionEvent evt)
// Don't move this to saveProject(). The path with the correct extension
// has to be stored.
String extension = ika.mapanalyst.ApplicationInfo.getDocumentExtension();
this.filePath = ika.utils.FileUtils.forceFileNameExtension(this.filePath, extension);
if (this.filePath == null) // path is not valid
{
return;
}

// the user canceled if filePath is still null
if (this.filePath != null) {
this.saveProject(this.filePath);
this.cleanDirty();
filePath = ika.utils.FileUtils.forceFileNameExtension(filePath, extension);
// the user canceled if filePath is null
if (filePath != null) {
saveProject(filePath);
cleanDirty();
String fileName = FileUtils.getFileNameWithoutExtension(filePath);
setTitle(fileName + (Sys.isWindows() ? " - MapAnalyst" : ""));
MainWindow.updateAllMenusOfAllWindows();
Expand All @@ -5606,7 +5601,7 @@ private void saveProjectAsMenuItemActionPerformed(java.awt.event.ActionEvent evt
// 'save as': don't store the path to the file in this.filePath
String ext = ApplicationInfo.getDocumentExtension();
String fileName = exportFileName(ext);
String path = FileUtils.askFile(this, "Save Copy of Project", fileName, false, ext);
String path = FileUtils.askFile(this, "Save Copy of Project", fileName, false, ext);
if (path != null) {
saveProject(path);
}
Expand Down

0 comments on commit b6bce59

Please sign in to comment.