<commit_before>import java.awt.Color;
import java.awt.Desktop;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.net.URI;
import java.util.List;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ColorPicker;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.Pagination;
import javafx.scene.control.Separator;
import javafx.scene.control.Slider;
import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;

import javax.swing.JFileChooser;

import com.itextpdf.text.BaseColor;
import com.itextpdf.text.DocumentException;

public class Controller {

	@FXML
	private TextField inputField;
	@FXML
	private TextField outputField;
	@FXML
	private Button convertButton;
	@FXML
	private ImageView previewPage;
	@FXML
	private Slider spacingslider;
	@FXML
	private ColorPicker ColorChooser;
	@FXML
	private Button leftPage;
	@FXML
	private Button rightPage;
	@FXML
	private Label pageCounter;
	@FXML
	private Label maxPages;
	@FXML
	private Button BasicMode;
	@FXML
	private ImageView Cover;
	@FXML
	private Label BasicLabel;
	@FXML
	private Label PDFcomplete;
	@FXML
	private Button Back;
	@FXML
	private Button openPDF;
	@FXML
	private ImageView pdfLogo;
	@FXML
	private Separator separator;
	@FXML
	private Separator middle_separator;
	@FXML
	private Pagination previewPagination;
	@FXML
	private Button tablature;
	@FXML
	private Label instructions;
	@FXML
	private TextField destinationFolder;
	@FXML
	private ComboBox choosePDF;
	@FXML
	private CheckBox selected;
	@FXML
	private CheckBox converted;
	@FXML
	private Button openFolder;
	@FXML
	private ImageView checkConvert; 
	@FXML
	private ImageView checkSelect;
	@FXML
	private Button convertMultiple;
	@FXML
	private ColorPicker titleColor;
	@FXML
	private ColorPicker subtitleColor;
	@FXML
	private TextField titleField;
	@FXML
	private TextField subtitleField;
	
	public void openPDF() throws IOException{
				
		if (Desktop.isDesktopSupported()) {
		    File myFile = new File((String) choosePDF.getValue());
		    
		    //GUI.dir.indexOf(myFile);
		    Desktop.getDesktop().open(myFile);
		}
	}
	public void openFolder() throws IOException{
		
		if (Desktop.isDesktopSupported()) {
			
			String directoryname = (String) choosePDF.getValue();
		    File myFile = new File(directoryname.substring(0,directoryname.lastIndexOf('\\')+1));
		    Desktop.getDesktop().open(myFile);
		}
	}
	public void openWebsite() throws IOException{
		
		if (Desktop.isDesktopSupported()) {
		    String htmlFile = "https://docs.google.com/document/d/1c9ieJbA7ZBDRBE2fL4T_ZOh1aMUGF1Iuo86CKayG7Kg/edit";
		    
		    //GUI.dir.indexOf(myFile);
		    Desktop.getDesktop().browse(URI.create(htmlFile));
		}
		
	}
	
	public void advancedPDF() throws IOException{
		
		if (Desktop.isDesktopSupported()) {
		    File myFile = new File(GUI.outputPath);
		    
		    //GUI.dir.indexOf(myFile);
		    Desktop.getDesktop().open(myFile);
		}
		
	}
	
	public void advancedFolder() throws IOException{
		
		if (Desktop.isDesktopSupported()) {
			
			String directoryname = GUI.outputPath;
		    File myFile = new File(directoryname.substring(0,directoryname.lastIndexOf('\\')+1));
		    Desktop.getDesktop().open(myFile);
		}		
	}
	
	
	public void showBasic(){
				
		pdfLogo.setVisible(false);
		BasicMode.setVisible(false);
		BasicLabel.setVisible(false);
		
		tablature.setVisible(true);
		convertMultiple.setVisible(true);
		choosePDF.setVisible(true);
		openPDF.setVisible(true);
		openFolder.setVisible(true);

	}
		
	public void browse() throws IOException, DocumentException {
		
		// file chooser
		FileChooser fileChooser = new FileChooser();
		fileChooser.setTitle("Open Text File");
		
		File file = fileChooser.showOpenDialog(GUI.main);
		
		inputField.setText(file.getPath());
		outputField.setText(file.getPath().substring(file.getPath().lastIndexOf('\\') + 1,file.getPath().length() - 4));
		destinationFolder.setText(file.getPath().substring(0,file.getPath().lastIndexOf('\\') + 1));
	    
		String outputPath = destinationFolder.getText() + outputField.getText() + ".pdf";
		
		previewPage.setImage(PDFPreview.previewPDFDocumentInImage(new Tablature(file.getPath(),outputPath)));
		ColorChooser.setValue(javafx.scene.paint.Color.BLACK);
		titleColor.setValue(javafx.scene.paint.Color.BLACK);
		subtitleColor.setValue(javafx.scene.paint.Color.BLACK);
		
		//pageCounter.setText(Integer.toString(1));
		//	maxPages.setText(Integer.toString(PDFPreview.getMaxPage()));
			
		//leftPage.setVisible(true);
		//	leftPage.setDisable(true);
		//	rightPage.setVisible(true);
			
		//	if(PDFPreview.getCurrentPage() == PDFPreview.getMaxPage()){
		//		rightPage.setDisable(true);
			
	//	}
		
		// enable the user to press the convert button
		
	//	convertButton.setDisable(false);
	}	<commit_msg>spacing slider now defaults to the value from the input file<commit_after>import java.awt.Color;
import java.awt.Desktop;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.net.URI;
import java.util.List;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ColorPicker;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.Pagination;
import javafx.scene.control.Separator;
import javafx.scene.control.Slider;
import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;

import javax.swing.JFileChooser;

import com.itextpdf.text.BaseColor;
import com.itextpdf.text.DocumentException;

public class Controller {

	@FXML
	private TextField inputField;
	@FXML
	private TextField outputField;
	@FXML
	private Button convertButton;
	@FXML
	private ImageView previewPage;
	@FXML
	private Slider spacingslider;
	@FXML
	private ColorPicker ColorChooser;
	@FXML
	private Button leftPage;
	@FXML
	private Button rightPage;
	@FXML
	private Label pageCounter;
	@FXML
	private Label maxPages;
	@FXML
	private Button BasicMode;
	@FXML
	private ImageView Cover;
	@FXML
	private Label BasicLabel;
	@FXML
	private Label PDFcomplete;
	@FXML
	private Button Back;
	@FXML
	private Button openPDF;
	@FXML
	private ImageView pdfLogo;
	@FXML
	private Separator separator;
	@FXML
	private Separator middle_separator;
	@FXML
	private Pagination previewPagination;
	@FXML
	private Button tablature;
	@FXML
	private Label instructions;
	@FXML
	private TextField destinationFolder;
	@FXML
	private ComboBox choosePDF;
	@FXML
	private CheckBox selected;
	@FXML
	private CheckBox converted;
	@FXML
	private Button openFolder;
	@FXML
	private ImageView checkConvert; 
	@FXML
	private ImageView checkSelect;
	@FXML
	private Button convertMultiple;
	@FXML
	private ColorPicker titleColor;
	@FXML
	private ColorPicker subtitleColor;
	@FXML
	private TextField titleField;
	@FXML
	private TextField subtitleField;
	
	public void openPDF() throws IOException{
				
		if (Desktop.isDesktopSupported()) {
		    File myFile = new File((String) choosePDF.getValue());
		    
		    //GUI.dir.indexOf(myFile);
		    Desktop.getDesktop().open(myFile);
		}
	}
	public void openFolder() throws IOException{
		
		if (Desktop.isDesktopSupported()) {
			
			String directoryname = (String) choosePDF.getValue();
		    File myFile = new File(directoryname.substring(0,directoryname.lastIndexOf('\\')+1));
		    Desktop.getDesktop().open(myFile);
		}
	}
	public void openWebsite() throws IOException{
		
		if (Desktop.isDesktopSupported()) {
		    String htmlFile = "https://docs.google.com/document/d/1c9ieJbA7ZBDRBE2fL4T_ZOh1aMUGF1Iuo86CKayG7Kg/edit";
		    
		    //GUI.dir.indexOf(myFile);
		    Desktop.getDesktop().browse(URI.create(htmlFile));
		}
		
	}
	
	public void advancedPDF() throws IOException{
		
		if (Desktop.isDesktopSupported()) {
		    File myFile = new File(GUI.outputPath);
		    
		    //GUI.dir.indexOf(myFile);
		    Desktop.getDesktop().open(myFile);
		}
		
	}
	
	public void advancedFolder() throws IOException{
		
		if (Desktop.isDesktopSupported()) {
			
			String directoryname = GUI.outputPath;
		    File myFile = new File(directoryname.substring(0,directoryname.lastIndexOf('\\')+1));
		    Desktop.getDesktop().open(myFile);
		}		
	}
	
	
	public void showBasic(){
				
		pdfLogo.setVisible(false);
		BasicMode.setVisible(false);
		BasicLabel.setVisible(false);
		
		tablature.setVisible(true);
		convertMultiple.setVisible(true);
		choosePDF.setVisible(true);
		openPDF.setVisible(true);
		openFolder.setVisible(true);

	}
		
	public void browse() throws IOException, DocumentException {
		
		// file chooser
		FileChooser fileChooser = new FileChooser();
		fileChooser.setTitle("Open Text File");
		
		File file = fileChooser.showOpenDialog(GUI.main);
		
		inputField.setText(file.getPath());
		outputField.setText(file.getPath().substring(file.getPath().lastIndexOf('\\') + 1,file.getPath().length() - 4));
		destinationFolder.setText(file.getPath().substring(0,file.getPath().lastIndexOf('\\') + 1));
	    
		String outputPath = destinationFolder.getText() + outputField.getText() + ".pdf";
		
		
		Tablature tab = new Tablature(file.getPath(), outputPath);
		spacingslider.setValue(tab.getSpacing());
		previewPage.setImage(PDFPreview.previewPDFDocumentInImage(tab));
		ColorChooser.setValue(javafx.scene.paint.Color.BLACK);
		titleColor.setValue(javafx.scene.paint.Color.BLACK);
		subtitleColor.setValue(javafx.scene.paint.Color.BLACK);
		
		//pageCounter.setText(Integer.toString(1));
		//	maxPages.setText(Integer.toString(PDFPreview.getMaxPage()));
			
		//leftPage.setVisible(true);
		//	leftPage.setDisable(true);
		//	rightPage.setVisible(true);
			
		//	if(PDFPreview.getCurrentPage() == PDFPreview.getMaxPage()){
		//		rightPage.setDisable(true);
			
	//	}
		
		// enable the user to press the convert button
		
	//	convertButton.setDisable(false);
	}	
{'fraction_non_alphanumeric': 0.11279926335174954, 'fraction_numerical': 0.0034990791896869246, 'mean_word_length': 4.546986721144025, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4077382', 'n_tokens_mistral': 3865, 'n_tokens_neox': 3497, 'n_words': 693}