/* $Id: ShowLinesActionListener.java 511 2012-06-20 01:58:48Z shayashi $ */
package smart_gs.swingui.toolbar.action;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import smart_gs.debugprint.Debugprint;
import smart_gs.drawing_tool.ImageLabel;
import smart_gs.smleditor.swingui.GSEditor;
import smart_gs.swingui.AbstractGSWindow;
import smart_gs.swingui.WorkspaceWindow;

public class ShowLinesActionListener implements ActionListener {

	private AbstractGSWindow parent;

	public ShowLinesActionListener(AbstractGSWindow parent) {
		this.parent = parent;
	}

	public void actionPerformed(ActionEvent e) {
		if (this.parent.getSpreadCanvas() == null ) return;
		ImageLabel.Show mode = this.parent.getSpreadCanvas().imageLabel.getLineSegShowingMode();
		this.parent.getSpreadCanvas().imageLabel.stepLineSegShowingMode(mode);
		
//		Debugprint.message("current show-line mode: " + this.parent.getSpreadCanvas().imageLabel.getLineSegShowingMode());
		if(parent instanceof WorkspaceWindow) {
			WorkspaceWindow.getInstance().repaint();
		} else if (parent instanceof GSEditor) {
			parent.repaint();
		}
	}

}
