[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ToolFactory.java, 1.110, 1.111 Tool.j
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2010-12-01 11:52:34
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28529/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java Tool.java Log Message: Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** ToolFactory.java 1 Dec 2010 10:28:04 -0000 1.110 --- ToolFactory.java 1 Dec 2010 11:52:26 -0000 1.111 *************** *** 168,172 **** "Biconselecttool2.gif", "Sensor Select")); ! viewingset.add(registerTool(Tool.FOUR, four, "four.png", "Mold ~ Four Weeks")); --- 168,172 ---- "Biconselecttool2.gif", "Sensor Select")); ! viewingset.add(registerTool("four", four, "four.png", "Mold ~ Four Weeks")); *************** *** 187,191 **** modellingset.add(addSeparator(2)); ! modellingset.add(registerTool(Tool.FINAL_MOVE_TOOL, moving, "Biconmovetool.gif", "Move")); modellingset.add(registerTool(Tool.ROTATION_TOOL, rotation, "rotation-icon.png", "Rotate")); --- 187,191 ---- modellingset.add(addSeparator(2)); ! modellingset.add(registerTool(Tool.MOVE_TOOL, moving, "Biconmovetool.gif", "Move")); modellingset.add(registerTool(Tool.ROTATION_TOOL, rotation, "rotation-icon.png", "Rotate")); *************** *** 197,201 **** modellingset.add(addSeparator(10)); ! modellingset.add(registerTool(Tool.ALT_RECT_TOOL, rectangle, "Biconaltrect.gif", "Rectangle")); modellingset.add(registerTool(Tool.ARC_TOOL, arc, "Barc.gif", "Arc")); --- 197,201 ---- modellingset.add(addSeparator(10)); ! modellingset.add(registerTool(Tool.RECT_TOOL, rectangle, "Biconaltrect.gif", "Rectangle")); modellingset.add(registerTool(Tool.ARC_TOOL, arc, "Barc.gif", "Arc")); *************** *** 223,227 **** modellingset.add(addSeparator(10)); ! Action orthoAction = new ToolAction(editor, 0, "Borto.gif") { public void actionPerformed(ActionEvent agr0) { Camera cam = Project.getInstance().getCurrentCamera(); --- 223,227 ---- modellingset.add(addSeparator(10)); ! Action orthoAction = new ToolAction(editor, "orthographic", "Borto.gif") { public void actionPerformed(ActionEvent agr0) { Camera cam = Project.getInstance().getCurrentCamera(); *************** *** 237,241 **** }; ! Action perspAction = new ToolAction(editor, 0, "Bpers.gif") { public void actionPerformed(ActionEvent agr0) { Camera cam = Project.getInstance().getCurrentCamera(); --- 237,241 ---- }; ! Action perspAction = new ToolAction(editor, "perspective", "Bpers.gif") { public void actionPerformed(ActionEvent agr0) { Camera cam = Project.getInstance().getCurrentCamera(); *************** *** 249,253 **** }; ! Action topAction = new ToolAction(editor, 0, "xyicon.png") { public void actionPerformed(ActionEvent arg0) { Camera.makeTop(Project.getInstance().getCurrentCamera()); --- 249,253 ---- }; ! Action topAction = new ToolAction(editor, "top", "xyicon.png") { public void actionPerformed(ActionEvent arg0) { Camera.makeTop(Project.getInstance().getCurrentCamera()); *************** *** 257,261 **** }; modellingset.add(Toolbar.getInstance().registerPushButtonAction(topAction, "Top")); ! Action zoomAction = new ToolAction(editor, 0, "Biconzomeall.gif") { public void actionPerformed(ActionEvent agr0) { double aspect = editor.getView().getAspect(); --- 257,261 ---- }; modellingset.add(Toolbar.getInstance().registerPushButtonAction(topAction, "Top")); ! Action zoomAction = new ToolAction(editor, "zoom", "Biconzomeall.gif") { public void actionPerformed(ActionEvent agr0) { double aspect = editor.getView().getAspect(); *************** *** 291,295 **** { { ! Action action = new ToolAction(editor, 0, "backwardicon.gif") { public void actionPerformed(ActionEvent arg0) { Project.getInstance().backward(); --- 291,295 ---- { { ! Action action = new ToolAction(editor, "backward", "backwardicon.gif") { public void actionPerformed(ActionEvent arg0) { Project.getInstance().backward(); *************** *** 300,304 **** { ! Action action = new ToolAction(editor, 0, "forwardicon.gif") { public void actionPerformed(ActionEvent arg0) { Project.getInstance().forward(); --- 300,304 ---- { ! Action action = new ToolAction(editor, "forward", "forwardicon.gif") { public void actionPerformed(ActionEvent arg0) { Project.getInstance().forward(); *************** *** 314,318 **** JToggleButton viewing; { ! Action action = new ToolAction(editor, 0, "modellingicon.gif") { public void actionPerformed(ActionEvent event) { modelling(); --- 314,318 ---- JToggleButton viewing; { ! Action action = new ToolAction(editor, "modelling", "modellingicon.gif") { public void actionPerformed(ActionEvent event) { modelling(); *************** *** 325,329 **** } { ! Action action = new ToolAction(editor, 0, "viewingicon.gif") { public void actionPerformed(ActionEvent event) { viewing(); --- 325,329 ---- } { ! Action action = new ToolAction(editor, "viewing", "viewingicon.gif") { public void actionPerformed(ActionEvent event) { viewing(); *************** *** 390,395 **** return get(Tool.SELECT_TOOL); } - - /** --- 390,393 ---- *************** *** 402,407 **** */ public JToggleButton registerTool(int key, Tool tool, String iconname, String tooltip) { tools.put(String.valueOf(key), tool); ! ToolAction action = new ToolAction(editor, key, iconname); JToggleButton button = Toolbar.getInstance().registerAction(action); button.setToolTipText(tooltip); --- 400,417 ---- */ public JToggleButton registerTool(int key, Tool tool, String iconname, String tooltip) { + return registerTool(String.valueOf(key), tool, iconname, tooltip); + } + + /** + * Register Tool + * @param key Key + * @param tool Tool + * @param iconname Icon name + * @param tooltip Tool tip + * @return Button + */ + public JToggleButton registerTool(String key, Tool tool, String iconname, String tooltip) { tools.put(String.valueOf(key), tool); ! ToolAction action = new ToolAction(editor, String.valueOf(key), iconname); JToggleButton button = Toolbar.getInstance().registerAction(action); button.setToolTipText(tooltip); *************** *** 411,414 **** --- 421,425 ---- } + /** * *************** *** 422,431 **** /** ! * Get the tool i if it is a legal tool ! * @param i The tool number ! * @return The tool */ ! public Tool get(int i) { ! Tool next = (Tool) tools.get(String.valueOf(i)); applyTool(next); return next; --- 433,442 ---- /** ! * ! * @param key String ! * @return Tool */ ! public Tool get(String key) { ! Tool next = (Tool) tools.get(key); applyTool(next); return next; *************** *** 444,453 **** private void applyTool(Tool next) { ! if (next != null) { ! previousTool = currentTool; ! currentTool = next; ! if (currentTool != null) { ! JToggleButton button = (JToggleButton)buttons.get(currentTool); ! button.setSelected(true); } } --- 455,466 ---- private void applyTool(Tool next) { ! if (next != currentTool) { ! if (next != null) { ! previousTool = currentTool; ! currentTool = next; ! if (currentTool != null) { ! JToggleButton button = (JToggleButton)buttons.get(currentTool); ! button.setSelected(true); ! } } } *************** *** 468,472 **** /** key */ ! private int key; /** --- 481,485 ---- /** key */ ! private String key; /** *************** *** 476,480 **** * @param iconname Iconname */ ! public ToolAction(Editor editor, int key, String iconname) { this.editor = editor; this.key = key; --- 489,493 ---- * @param iconname Iconname */ ! public ToolAction(Editor editor, String key, String iconname) { this.editor = editor; this.key = key; Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Tool.java 26 Nov 2010 14:20:27 -0000 1.43 --- Tool.java 1 Dec 2010 11:52:26 -0000 1.44 *************** *** 21,88 **** */ public interface Tool extends MouseListener, MouseMotionListener, KeyListener, MouseWheelListener { - /** The prevoius tool (the tool used before this one) */ - public static final int PREVIOUS_TOOL = -1; /** The select tool */ ! public static final int SELECT_TOOL = 0; /** The move tool */ ! public static final int MOVE_TOOL = 1; ! /** The extrude tool */ ! public static final int EXTRUSION_TOOL = 2; /** The pencil tool */ ! public static final int PENCIL_TOOL = 3; /** The Clipping tool */ ! public static final int CLIP_TOOL = 4; /** The Camera tool */ ! public static final int CAMERA_TOOL = 5; /** The Tape Measure tool */ ! public static final int TAPE_MEASURE_TOOL = 6; ! /** The Fly tool */ ! public static final int FLY_TOOL = 7; ! /** The walk tool */ ! public static final int WALK_TOOL = 8; /** The Rotation tool */ ! public static final int ROTATION_TOOL = 9; /** The Eraser tool */ ! public static final int ERASER_TOOL = 10; /** The Arc tool */ ! public static final int ARC_TOOL = 11; /** The Rect tool */ ! public static final int RECT_TOOL = 12; /** The Protractor tool */ ! public static final int PROTRACTOR_TOOL = 13; /** The Constructor tool */ ! public static final int CONSTRUCTOR_TOOL = 14; /** The controlled extrude tool */ ! public static final int EXTEND_TOOL = 15; /** The Offset tool */ ! public static final int OFFSET_TOOL = 16; ! /** The Alternative Rect tool */ ! public static final int ALT_RECT_TOOL = 17; ! /** The controlled move tool */ ! public static final int CONTROLLED_MOVE_TOOL = 18; ! /** the alternative pecnil tool */ ! public static final int ALT_PENCIL_TOOL = 19; /** the tool for creating relation between elements */ ! public static final int RELATION_TOOL = 20; /** the tool for focusing on objects */ ! public static final int FOCUS_TOOL = 21; ! /** the tool for alternative moving of objects */ ! public static final int ALT_MOVE_TOOL = 22; ! /** the tool for alternative moving of edges */ ! public static final int EDGE_MOVE_TOOL = 23; ! /** the final tool to move them all */ ! public static final int FINAL_MOVE_TOOL = 24; /** the drag tool */ ! public static final int PAN_TOOL = 25; /** the zoom tool */ ! public static final int ZOOM_TOOL = 26; /** the zoom tool */ ! public static final int ASSIGN_TOOL = 27; /** the zoom tool */ ! public static final int SPACE_SELECT = 28; ! ! /** the FOUR tool */ ! public static final int FOUR = 29; /** --- 21,70 ---- */ public interface Tool extends MouseListener, MouseMotionListener, KeyListener, MouseWheelListener { /** The select tool */ ! public static final String SELECT_TOOL = "select"; /** The move tool */ ! public static final String MOVE_TOOL = "move"; ! /** The extrusion tool */ ! public static final String EXTRUSION_TOOL = "extrusion"; ! /** The pencil tool */ ! public static final String PENCIL_TOOL = "pencil"; /** The Clipping tool */ ! public static final String CLIP_TOOL = "clip"; /** The Camera tool */ ! public static final String CAMERA_TOOL = "camera"; ! /** The Tape Measure tool */ ! public static final String TAPE_MEASURE_TOOL = "tapemeasure"; ! /** The Rotation tool */ ! public static final String ROTATION_TOOL = "rotation"; /** The Eraser tool */ ! public static final String ERASER_TOOL = "eraser"; /** The Arc tool */ ! public static final String ARC_TOOL = "arc"; /** The Rect tool */ ! public static final String RECT_TOOL = "rect"; /** The Protractor tool */ ! public static final String PROTRACTOR_TOOL = "protractor"; /** The Constructor tool */ ! public static final String CONSTRUCTOR_TOOL = "constructor"; /** The controlled extrude tool */ ! public static final String EXTEND_TOOL = "extend"; /** The Offset tool */ ! public static final String OFFSET_TOOL = "offset"; /** the tool for creating relation between elements */ ! public static final String RELATION_TOOL = "relation"; /** the tool for focusing on objects */ ! public static final String FOCUS_TOOL = "focus"; /** the drag tool */ ! public static final String PAN_TOOL = "pan"; /** the zoom tool */ ! public static final String ZOOM_TOOL = "zooming"; /** the zoom tool */ ! public static final String ASSIGN_TOOL = "assign"; /** the zoom tool */ ! public static final String SPACE_SELECT = "space-select"; /** |