Search in sources :

Example 6 with DesignEditorTransition

use of edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition in project cogtool by cogtool.

the class DesignEditorMouseState method handleMousePressed.

// dealWithMouseDoubleClicked
protected void handleMousePressed(int filter) {
    if (filter == StructureViewUIModel.NO_LABEL) {
        ResizeThumb thumb = ui.getResizeAtXY(mouseDownX, mouseDownY);
        if (thumb != null) {
            hitTransition = (DesignEditorTransition) thumb.getData();
            selection.setSelectedTransition(hitTransition);
            if (thumb.thumbType == DesignEditorUI.SOURCE) {
                setMouseState(PotentialChangeSource);
            } else {
                setMouseState(PotentialChangeTarget);
            }
            return;
        }
    }
    IFigure target = ui.structureView.getFigureAtXY(mouseDownX, mouseDownY, filter);
    if (target instanceof DesignEditorTransition) {
        hitTransition = (DesignEditorTransition) target;
        if ((mouseDownState & InputEvent.SHIFT) != 0) {
            setMouseState(PotentialToggleTransition);
        } else {
            setMouseState(PotentialSelectTransition);
        }
    } else if (target instanceof GraphicalSource<?>) {
        potentialTransitionSource = (GraphicalSource<?>) target;
        setMouseState(PotentialCreatingTransition);
    // drag creates arrow
    } else if (target instanceof DesignEditorFrame) {
        DesignEditorFrame frameFigure = (DesignEditorFrame) target;
        Frame frame = frameFigure.getFrame();
        if ((mouseDownState & InputEvent.SHIFT) != 0) {
            setMouseState(PotentialTogglingSelection);
        } else if ((mouseDownState & platformDuplicateModifierKey()) != 0) {
            if (!selection.isFrameSelected(frame)) {
                selection.setSelectedFrame(frameFigure);
            }
            setMouseState(PotentialDuplicatingFrame);
        } else {
            if (selection.isFrameSelected(frame)) {
                setMouseState(PotentialMovingSelection);
            } else {
                selection.setSelectedFrame(frameFigure);
                setMouseState(PotentialMovingFrame);
            }
        }
    } else {
        // out in space
        if ((mouseDownState & InputEvent.SHIFT) != 0) {
            setMouseState(PotentialTogglingSelection);
        } else {
            selection.deselectAll();
            setMouseState(PotentialSelectingFrames);
        }
    }
}
Also used : DesignEditorFrame(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame) Frame(edu.cmu.cs.hcii.cogtool.model.Frame) ResizeThumb(edu.cmu.cs.hcii.cogtool.view.ResizeThumb) DesignEditorFrame(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame) DesignEditorTransition(edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition) GraphicalSource(edu.cmu.cs.hcii.cogtool.uimodel.GraphicalSource) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

DesignEditorTransition (edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorTransition)6 DesignEditorFrame (edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame)3 Transition (edu.cmu.cs.hcii.cogtool.model.Transition)2 IFigure (org.eclipse.draw2d.IFigure)2 DoubleRectangle (edu.cmu.cs.hcii.cogtool.model.DoubleRectangle)1 Frame (edu.cmu.cs.hcii.cogtool.model.Frame)1 TransitionSelectionChange (edu.cmu.cs.hcii.cogtool.ui.DesignEditorSelectionState.TransitionSelectionChange)1 GraphicalSource (edu.cmu.cs.hcii.cogtool.uimodel.GraphicalSource)1 AlertHandler (edu.cmu.cs.hcii.cogtool.util.AlertHandler)1 InteractionDrawingEditor (edu.cmu.cs.hcii.cogtool.view.InteractionDrawingEditor)1 ResizeThumb (edu.cmu.cs.hcii.cogtool.view.ResizeThumb)1 EventObject (java.util.EventObject)1 Iterator (java.util.Iterator)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1