Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31887
Modified Files:
AbstractTool.java
Log Message:
added zoom on mouse button 2 and refactured listeners
Index: AbstractTool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** AbstractTool.java 4 Aug 2005 10:49:56 -0000 1.5
--- AbstractTool.java 5 Aug 2005 10:59:18 -0000 1.6
***************
*** 16,20 ****
import net.sourceforge.bprocessor.gl.GLView;
- import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
--- 16,19 ----
***************
*** 43,53 ****
/** An vertex counter */
! private static long vertexNum = 0;
/** An edge counter */
! private static long edgeNum = 0;
/** An surface counter */
! private static long surfaceNum = 0;
/** The snap variable */
--- 42,52 ----
/** An vertex counter */
! private static long vertexNum = 1;
/** An edge counter */
! private static long edgeNum = 1;
/** An surface counter */
! private static long surfaceNum = 1;
/** The snap variable */
***************
*** 73,77 ****
this.glv = glv;
! timer = new Timer(10, null);
timer.start();
moveAction = new CameraMoveTimer(this, glv);
--- 72,76 ----
this.glv = glv;
! timer = new Timer(40, null);
timer.start();
moveAction = new CameraMoveTimer(this, glv);
***************
*** 103,106 ****
--- 102,113 ----
} else if (e.getKeyCode() == KeyEvent.VK_W) {
glv.changeTool(Tool.DRAW_TOOL);
+ } else if (e.getKeyCode() == KeyEvent.VK_E) {
+ glv.getView().setAlignVertex(null);
+ glv.getView().setSnapVertex(null);
+ glv.changeTool(Tool.MOVE_TOOL);
+ } else if (e.getKeyCode() == KeyEvent.VK_R) {
+ glv.getView().setAlignVertex(null);
+ glv.getView().setSnapVertex(null);
+ glv.changeTool(Tool.EXTRUSION_TOOL);
}
glv.repaint();
***************
*** 300,304 ****
* @return The new Edge
*/
! protected Edge createEdge(Vertex to, Vertex from) {
Edge e = new Edge("E" + edgeNum);
edgeNum++;
--- 307,311 ----
* @return The new Edge
*/
! protected Edge createEdge(Vertex from, Vertex to) {
Edge e = new Edge("E" + edgeNum);
edgeNum++;
***************
*** 314,317 ****
--- 321,332 ----
/**
+ * Remove a edge for good
+ * @param e Edge to remove
+ */
+ protected void removeEdge(Edge e) {
+ EdgeFacade.getInstance().remove(e);
+ }
+
+ /**
* Updates the edge
* @param e The edge to update
***************
*** 361,430 ****
*/
protected abstract void released(MouseEvent e);
-
- /**
- * Carama move timer class
- */
- private class CameraMoveTimer implements ActionListener {
- /** The calling mouselistener */
- private AbstractTool at;
-
- /** The current GLView */
- private GLView glv;
-
- /**
- * The Constructor
- * @param at the abstract tool
- * @param glv the GLView
- */
- public CameraMoveTimer(AbstractTool at, GLView glv) {
- this.at = at;
- this.glv = glv;
- }
-
- /**
- * executed every time camaraMove is sceduled
- * @param e The ActionEvent
- */
- public void actionPerformed(ActionEvent e) {
- View v = glv.getView();
- v.translateRotationX(at.getdy());
- v.translateRotationY(at.getdx());
- glv.repaint();
- }
- }
-
- /**
- * Camara zoom timer
- */
- private class CameraZoomTimer implements ActionListener {
- /** The calling mouselistener */
- private AbstractTool at;
-
- /** The current GLView */
- private GLView glv;
-
- /**
- * The Constructor
- * @param at the abstract tool
- * @param glv the GLView
- */
- public CameraZoomTimer(AbstractTool at, GLView glv) {
- this.at = at;
- this.glv = glv;
- }
-
- /**
- * executed every time camaraMove is sceduled
- * @param e The ActionEvent
- */
- public void actionPerformed(ActionEvent e) {
- View v = glv.getView();
- if (at.getdy() > 0) {
- v.zoom(0.9);
- } else {
- v.zoom(1.0);
- }
- glv.repaint();
- }
- }
}
--- 376,378 ----
|