/* $Id: SaveLineSegmentsAndDscCompileAction.java 367 2011-09-29 18:16:25Z shayashi $ */
package smart_gs.swingui.toolbar.action;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import smart_gs.logical.Spread;
import smart_gs.swingui.AbstractGSWindow;
import smart_gs.util.DSCFileMaker;

public class SaveLineSegmentsAndDscCompileAction implements ActionListener {
	
	private AbstractGSWindow gsWindow;
	private Spread spread;
	public SaveLineSegmentsAndDscCompileAction(AbstractGSWindow gsWindow){
		this.gsWindow = gsWindow;
	}
	public SaveLineSegmentsAndDscCompileAction(Spread spread){
		this.spread = spread;
	}
	public void dscCompile(){
		String folderPath = Spread.DSC_FOLDER_PATH+spread.getSpreadDirParent().getPath();
		String filename = spread.getFileNameWithoutExtension();
		String filetype = spread.getFileNameExtension();
		new DSCFileMaker(spread).saveLineSegmentsAndDscCompile(folderPath, filename, filetype);
	}
	public void actionPerformed(ActionEvent e) {
		this.spread = this.gsWindow.getSpread();
		this.dscCompile();
	}
}
