package smart_gs.swingui.toolbar.action;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import smart_gs.drawing_tool.ImageLabel;
import smart_gs.drawing_tool.drawing_mode.LineSegEditorDefaultMode;
import smart_gs.logical.Preference;
import smart_gs.smleditor.swingui.GSEditorFrame;
import smart_gs.smleditor.swingui.LineSegEditor;


public class LineSegEditorActionListener implements ActionListener {

	private GSEditorFrame parent;
	public LineSegEditorActionListener (GSEditorFrame parent) {
		this.parent = parent;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if(Preference.getInstance().isEnabledLineSegmentEditor()){
			ImageLabel.setLineVisible(true);
			if (parent.getSpread() == null) return;
			LineSegEditor editor = new LineSegEditor(parent.getSpread());
			editor.setMode(LineSegEditorDefaultMode.getInstance());
			editor.setVisible(true);
		}
	}
}

