public static void editIntonationsFile(){
	if(editingTunings){
	    return;
	}
	editingTunings = true;
	catchKeyboard = false;
	final JFrame editframe = new JFrame(programName+" - "+tuningfilename);
	editframe.setVisible(false);
	editframe.addFocusListener(blockKeysFocusListener);
	editframe.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

	final JTextArea jTextArea = new JTextArea();//200,70);
	jTextArea.addFocusListener(blockKeysFocusListener);
	File textfile = new File(jarPath+tuningfilename);
	final StringContainer text = new StringContainer();
	try{
	    text.string = new Scanner( new File(jarPath+tuningfilename) ).useDelimiter("\\A").next();
	} catch (Exception e){
	    displayerror("Error opening tuning file");
	    return;
	}
	jTextArea.setText(text.string);
	jTextArea.setCaretPosition(0);
	jTextArea.getDocument().addDocumentListener(new DocumentListener(){
		public void insertUpdate(DocumentEvent e){
		    changed(e);
		}
		public void removeUpdate(DocumentEvent e){
		    changed(e);
		}
		public void changedUpdate(DocumentEvent e){
		    changed(e);
		}
		public void changed(DocumentEvent e){
		    editframe.setTitle(programName+" - *"+tuningfilename);
		}
	    });


	final StringContainer origText = new StringContainer(text.string);

	final Container editcontentPane = editframe.getContentPane();
	JPanel contentPanel = new JPanel(new BorderLayout());
	//contentPanel.setLayout(new BoxLayout(contentPanel,BoxLayout.Y_AXIS));
	editcontentPane.add(contentPanel);
	editcontentPane.addFocusListener(blockKeysFocusListener);


	JPanel buttonPanel = new JPanel(new FlowLayout());
	buttonPanel.addFocusListener(blockKeysFocusListener);
	contentPanel.add(buttonPanel,BorderLayout.PAGE_START);
	JButton saveButton = new JButton("Save Tunings");
	saveButton.addFocusListener(blockKeysFocusListener);

	saveButton.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent e){
		    text.string = jTextArea.getText();
		    try (PrintStream out = new PrintStream(new FileOutputStream(jarPath+tuningfilename))) {
			    out.print(text.string);
			    origText.string = text.string;
			} catch (Exception ea) {
			displayerror("Unable to save file");
		    }
		    editframe.setTitle(programName+" - "+tuningfilename);
		    Object[] tuningselection = jTunings.getSelectedObjects();
		    loadTuningSchemes();
		    populatejTunings();
		    jTunings.setSelectedItem(tuningselection[0]);
		    changeLiveTuning();
		}
	    });

	buttonPanel.add(saveButton);
	// /*
	// final JButton cancelButton = new JButton("Cancel");
	// cancelButton.addActionListener(new ActionListener(){
	// 	public void actionPerformed(ActionEvent e){
	// 	    if(!jTextArea.getText().equals(origText)){
	// 		int answer = JOptionPane.showConfirmDialog(editframe,"Are you sure you want to close the editor without saving your changes?","Closing Editor",JOptionPane.YES_NO_OPTION);
	// 		if(answer > 0)
	// 		    return;
	// 	    }
	// 	    editframe.setVisible(false);
	// 	    editframe.dispose();
	// 	    catchKeyboard = true;
	// 	}
	//     });
	// */
	editframe.addWindowListener(new WindowAdapter(){
		@Override
		public void windowClosing(WindowEvent e){
		    if(!jTextArea.getText().equals(origText.string)){
			int answer = JOptionPane.showConfirmDialog(editframe,"Are you sure you want to close the editor without saving your changes?","Closing Editor",JOptionPane.YES_NO_OPTION);
			if(answer > 0)
			    return;
		    }
		    editframe.setVisible(false);
		    editframe.dispose();
		    editingTunings = false;
		    catchKeyboard = true;
		}
	    });
	//buttonPanel.add(cancelButton);
	JButton resetButton = new JButton("Reset to default tunings");
	resetButton.addFocusListener(blockKeysFocusListener);

	resetButton.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent e){
		    int answer = JOptionPane.showConfirmDialog(editframe,"This will reset the tuning schemes file to the way it was when you first ran this program, deleting any changes you have made.  Are you sure you want to do this?","Restoring default tuning schemes file",JOptionPane.YES_NO_OPTION);
		    if(answer == 0){
			overwriteCopyFileFromJar(tuningfilename,false);
			try{
			    text.string = new Scanner( new File(jarPath+tuningfilename) ).useDelimiter("\\A").next();
			} catch (Exception ea){
			    displayerror("Error opening tuning file");
			    text.string = origText.string;
			}
			jTextArea.setText(text.string);
			jTextArea.setCaretPosition(0);
		    }
		}
	    });
	buttonPanel.add(resetButton);
	
	

	JScrollPane jScrollPane = new JScrollPane(jTextArea);
	jScrollPane.addFocusListener(blockKeysFocusListener);

	contentPanel.add(jScrollPane,BorderLayout.CENTER);

	//	jScrollPane.setBounds(0,0,800,500);
	//jScrollPane.setSize(800,500);

	editframe.setPreferredSize(new Dimension(450,500));
	editframe.pack();
	editframe.setVisible(true);
	
    }