[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool Tool.java, 1.39, 1.40 ToolFactory.jav
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Michael L. <he...@us...> - 2007-11-28 10:39:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5554/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java ToolFactory.java SpaceTool.java CreateSpaceActionListener.java Log Message: split of select and assign Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** SpaceTool.java 21 Nov 2007 21:10:41 -0000 1.95 --- SpaceTool.java 28 Nov 2007 10:39:21 -0000 1.96 *************** *** 15,19 **** import java.net.URL; import java.util.Collection; - import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; --- 15,18 ---- *************** *** 33,36 **** --- 32,36 ---- import net.sourceforge.bprocessor.gl.Editor; + import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gui.PopupMenu; import net.sourceforge.bprocessor.gui.actions.SpaceMenuAction; *************** *** 62,65 **** --- 62,81 ---- } + + /** + * {@inheritDoc} + */ + protected void moved(MouseEvent e) { + findTarget(e); + if (target != null) { + if (target instanceof Surface) { + editor.getView().makeTarget(target); + } + } else { + editor.getView().makeTarget(null); + } + + } + /** * Invoked when a mouse button has been pressed on a component. *************** *** 135,162 **** private JPopupMenu seperatorPopup() { JPopupMenu sepPop = new JPopupMenu(); ! Iterator<Geometric> selIt = new HashSet<Geometric>(Selection.primary()).iterator(); ! if (selIt.hasNext()) { ! Object o = selIt.next(); ! if (o instanceof Surface) { ! Surface surface = (Surface)o; ! JMenuItem shift = new JMenuItem("Shift spaces"); ! ActionListener shiftListener = new ShiftActionListener(surface); ! shift.addActionListener(shiftListener); ! JMenuItem copy = new JMenuItem("Copy space assignment"); ! ActionListener copyListener = new CopyActionListener(surface, editor.getView()); ! copy.addActionListener(copyListener); ! JMenuItem paste = new JMenuItem("Paste space assignment"); ! ActionListener pasteListener = new PasteActionListener(surface, editor.getView()); ! paste.addActionListener(pasteListener); ! ! sepPop.add(shift); ! sepPop.add(copy); ! sepPop.add(paste); ! sepPop.pack(); ! return sepPop; } } ! log.warn("Seperator popup menu has no surface"); ! return sepPop; } --- 151,186 ---- private JPopupMenu seperatorPopup() { JPopupMenu sepPop = new JPopupMenu(); ! Surface surface = null; ! { ! Selection selection = Selection.primary(); ! Object candidate = null; ! if (selection.size() == 0) { ! candidate = View.getLastSurface(); ! } else { ! candidate = selection.iterator().next(); ! } ! if (candidate instanceof Surface) { ! surface = (Surface) candidate; } } ! if (surface != null) { ! JMenuItem shift = new JMenuItem("Shift spaces"); ! ActionListener shiftListener = new ShiftActionListener(surface); ! shift.addActionListener(shiftListener); ! JMenuItem copy = new JMenuItem("Copy space assignment"); ! ActionListener copyListener = new CopyActionListener(surface, editor.getView()); ! copy.addActionListener(copyListener); ! JMenuItem paste = new JMenuItem("Paste space assignment"); ! ActionListener pasteListener = new PasteActionListener(surface, editor.getView()); ! paste.addActionListener(pasteListener); ! ! sepPop.add(shift); ! sepPop.add(copy); ! sepPop.add(paste); ! sepPop.pack(); ! return sepPop; ! } else { ! return null; ! } } *************** *** 171,183 **** ! Iterator<Geometric> selIt = new HashSet<Geometric>(Selection.primary()).iterator(); Surface surface = null; Space space = null; ! if (selIt.hasNext()) { ! Object o = selIt.next(); ! if (o instanceof Surface) { ! surface = (Surface)o; } if (surface != null) { --- 195,217 ---- ! Surface surface = null; Space space = null; ! { ! Selection selection = Selection.primary(); ! Object candidate = null; ! if (selection.size() == 0) { ! candidate = View.getLastSurface(); ! } else { ! candidate = selection.iterator().next(); } + if (candidate instanceof Surface) { + surface = (Surface) candidate; + } + } + + + if (surface != null) { if (surface != null) { Index: CreateSpaceActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CreateSpaceActionListener.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** CreateSpaceActionListener.java 21 Nov 2007 09:21:17 -0000 1.22 --- CreateSpaceActionListener.java 28 Nov 2007 10:39:21 -0000 1.23 *************** *** 61,64 **** --- 61,65 ---- surface.changed(); AttributeView.instance().display(space); + Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** ToolFactory.java 19 Nov 2007 19:56:05 -0000 1.93 --- ToolFactory.java 28 Nov 2007 10:39:21 -0000 1.94 *************** *** 60,64 **** /** select tool */ ! private SpaceTool select; /** Alternate Move Tool */ --- 60,66 ---- /** select tool */ ! private AbstractTool select; ! ! private AbstractTool assign; /** Alternate Move Tool */ *************** *** 182,186 **** Cursor zoomCursor = Toolkit.getDefaultToolkit().createCustomCursor(zoomImage, new Point(7, 8), "Zoom"); ! select = new SpaceTool(editor, null); pencil = new Pencil(editor, pencilcursor); eraser = new EraserTool(editor, pencilcursor); --- 184,189 ---- Cursor zoomCursor = Toolkit.getDefaultToolkit().createCustomCursor(zoomImage, new Point(7, 8), "Zoom"); ! select = new SelectTool(editor, null); ! assign = new SpaceTool(editor, null); pencil = new Pencil(editor, pencilcursor); eraser = new EraserTool(editor, pencilcursor); *************** *** 206,209 **** --- 209,213 ---- this.registerTool(Tool.SELECT_TOOL, select, "Biconselecttool.gif", "Select"); selBut.setMnemonic(KeyEvent.VK_Q); + registerTool(Tool.ASSIGN_TOOL, assign, "Biconassigntool.gif", "Assign"); JToggleButton pencilBut = this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Tool.java 21 Nov 2007 09:21:17 -0000 1.39 --- Tool.java 28 Nov 2007 10:39:21 -0000 1.40 *************** *** 77,80 **** --- 77,82 ---- /** the zoom tool */ public static final int ZOOM_TOOL = 26; + /** the zoom tool */ + public static final int ASSIGN_TOOL = 27; /** |