Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11810/src/net/sourceforge/bprocessor/gl/view
Modified Files:
ViewToolbarFactory.java View.java
Log Message:
grid on/off button added to toolbar
Index: ViewToolbarFactory.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/ViewToolbarFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ViewToolbarFactory.java 28 Jun 2007 00:13:31 -0000 1.2
--- ViewToolbarFactory.java 3 Sep 2007 11:22:32 -0000 1.3
***************
*** 59,62 ****
--- 59,90 ----
but.setMnemonic(KeyEvent.VK_F8);
+ but = tb.registerAction(new ViewGrid(glv));
+ but.setToolTipText("Grid");
+ but.setSelected(true);
+ }
+
+
+ class ViewGrid extends AbstractAction {
+ private GLView glv;
+
+ ViewGrid(GLView glv) {
+ this.glv = glv;
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ URL url = cl.getResource("Bgrid.gif");
+ ImageIcon im = new ImageIcon(url);
+ putValue(Action.SMALL_ICON, im);
+ }
+
+ /** {@inheritDoc} */
+ public void actionPerformed(ActionEvent event) {
+ JToggleButton button = (JToggleButton) event.getSource();
+ glv.getView();
+ if (button.isSelected()) {
+ glv.getView().enableGrid();
+ } else {
+ glv.getView().disableGrid();
+ }
+ glv.repaint();
+ }
}
Index: View.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v
retrieving revision 1.227
retrieving revision 1.228
diff -C2 -d -r1.227 -r1.228
*** View.java 31 Aug 2007 12:25:11 -0000 1.227
--- View.java 3 Sep 2007 11:22:32 -0000 1.228
***************
*** 321,324 ****
--- 321,327 ----
*/
private boolean stipple;
+
+ /** grid enabled */
+ private boolean gridEnabled;
/** The mode of selecting. Either edges or surfaces */
***************
*** 504,507 ****
--- 507,511 ----
constructorColor = CONSTRUCTOR_COLOR;
noneColor = NONE_COLOR;
+ gridEnabled = true;
tempConstructors = new HashSet<Constructor>();
tempEdges = new HashSet<Edge>();
***************
*** 607,610 ****
--- 611,628 ----
}
+ /**
+ * Enable grid
+ *
+ */
+ public void enableGrid() {
+ gridEnabled = true;
+ }
+
+ /**
+ * Disable grid
+ */
+ public void disableGrid() {
+ gridEnabled = false;
+ }
/**
***************
*** 1011,1015 ****
}
}
! grid(Project.getInstance().getActiveCoordinateSystem());
drawConstructorPlanes();
}
--- 1029,1035 ----
}
}
! if (gridEnabled) {
! grid(Project.getInstance().getActiveCoordinateSystem());
! }
drawConstructorPlanes();
}
|