Skip to content

Commit

Permalink
Merge pull request #11 from Airell/FileTypeIssue
Browse files Browse the repository at this point in the history
File type issue fixed when opening with the 'all type'
  • Loading branch information
Airell authored Dec 16, 2019
2 parents f0b8642 + e402568 commit b593c81
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 10 deletions.
54 changes: 53 additions & 1 deletion nomad/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,60 @@ Nomad - Nord Modular Editor
---------------------------

Copyright (C) 2006 Christian Schneider, Marcus Andersson
Copyright (C) 2019 Ian Hoogeboom


Version 0.4.working.
--------------------

new features / improvements:
- made the .pch file type the default open and save service

bugs fixed:
- opening the file with the 'all type' gave a service error


Version 0.4.20191212
--------------------

First 0.4 version release

new features / improvements:
- updated the icon and splash screen to read to identify the 0.4 version


Version 0.4.0beta
--------------------

Beta version, not released

new features / improvements:
- changed the name of the enum variables and used the enum class
- added coremidi4j for later macOS versions MIDI
- updated the sac and jar bundler library
- probably forgot some other changes to make it work again...

bugs fixed:
- make MIDI work again on macOS

other:
- moving older projects to separate archive location in the project
- moving unused WaldorfMiniworks4Pole code to separate archive location in the project
- many more cleanup...


Version 0.3.2-pre
-----------------

Preview release

bugs fixed:
- empty module pane problem
- invalid MidiPlug problem
- no popups on modules/connectors shown

The 0.3 and 0.2 version page can be found on: http://nmedit.sf.net

http://nmedit.sf.net

Version 0.2.2-pre
-----------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2006 Christian Schneider
/* Copyright (C) 2006 Christian Schneider, 2019 Ian Hoogeboom
*
* This file is part of Nomad.
*
Expand All @@ -16,9 +16,9 @@
* along with Nomad; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

/*
* Created on Nov 23, 2006
* Updated on Dec 16, 2019
*/
package net.sf.nmedit.nomad.core;

Expand Down Expand Up @@ -539,8 +539,15 @@ public void fileSave(boolean saveAs)
(saveAs && fs.isSaveOperationSupported(d))
|| ((!saveAs)&&fs.isDirectSaveOperationSupported(d));

if (add)
chooser.addChoosableFileFilter(fs.getFileFilter());
if (add) {
// chooser.addChoosableFileFilter(fs.getFileFilter());
// setFileFilter also add's it, otherwise you will get two entries.
// set the NmFileChooser as default
if (fs.getFileFilter().getExtension().contentEquals("pch"))
chooser.setFileFilter(fs.getFileFilter());
else
chooser.addChoosableFileFilter(fs.getFileFilter());
}
}

File sfile = d.getFile();
Expand Down Expand Up @@ -569,7 +576,7 @@ public void fileSave(boolean saveAs)
}
else
{
JOptionPane.showMessageDialog(mainWindow, "Could not find service to save file.");
JOptionPane.showMessageDialog(mainWindow, "Unknown file type.");
}
}

Expand Down Expand Up @@ -607,7 +614,7 @@ public void fileOpen()

if (service == null)
{
JOptionPane.showMessageDialog(mainWindow, "Could not find service to open file.");
JOptionPane.showMessageDialog(mainWindow, "Unknown file type.");
return;
}
Runnable run = new Runnable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2006 Christian Schneider
/* Copyright (C) 2006 Christian Schneider, 2019 Ian Hoogeboom
*
* This file is part of Nomad.
*
Expand All @@ -16,6 +16,10 @@
* along with Nomad; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

/*
* Updated on Dec 16, 2019
*/
package net.sf.nmedit.nomad.core.service.fileService;

import java.io.File;
Expand All @@ -37,14 +41,26 @@ public static void addChoosableFileFilters(JFileChooser chooser)
{
FileService service = i.next();
if (service.isOpenFileOperationSupported())
chooser.addChoosableFileFilter(service.getFileFilter());
// setFileFilter also add's it, otherwise you will get two entries.
// set the NmFileChooser as default
if (service.getFileFilter().getExtension().contentEquals("pch"))
chooser.setFileFilter(service.getFileFilter());
else
chooser.addChoosableFileFilter(service.getFileFilter());
}
}

public static FileService lookupFileService(JFileChooser chooser)
{
FileFilter fileFilter = chooser.getFileFilter();
return (fileFilter == null) ? null : lookupFileService(fileFilter);

FileService service = (fileFilter == null) ? null : lookupFileService(fileFilter);

// if the service == null, the 'all types' filter is probably choosen, try the FileService based on file type
if (service == null)
service = lookupFileService(chooser.getSelectedFiles()[0]);

return service;
}

private static FileService lookupFileService(FileFilter fileFilter)
Expand Down

0 comments on commit b593c81

Please sign in to comment.