Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.122, 1.123
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2006-07-26 14:41:26
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20228/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: added a path to the currently active space. Click one of the spacenames in the path, and it becomes the active space. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** View.java 24 Jul 2006 13:42:34 -0000 1.122 --- View.java 26 Jul 2006 14:41:12 -0000 1.123 *************** *** 437,442 **** bg.add(but); but.setToolTipText("Wireframe"); ! but.setMnemonic(KeyEvent.VK_F7); ! } --- 437,441 ---- bg.add(but); but.setToolTipText("Wireframe"); ! but.setMnemonic(KeyEvent.VK_F7); } *************** *** 459,463 **** gl = gld.getGL(); glu = gld.getGLU(); ! int[] maxplanes = new int[1]; gl.glGetIntegerv(GL.GL_MAX_CLIP_PLANES, maxplanes); --- 458,462 ---- gl = gld.getGL(); glu = gld.getGLU(); ! int[] maxplanes = new int[1]; gl.glGetIntegerv(GL.GL_MAX_CLIP_PLANES, maxplanes); *************** *** 596,601 **** gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPopMatrix(); - } gl.glPopMatrix(); if (hitdetection) { --- 595,619 ---- gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPopMatrix(); } + + //Drawing the space path + gl.glMatrixMode(GL.GL_PROJECTION); + gl.glPushMatrix(); + gl.glLoadIdentity(); + if (hitdetection) { + int[] viewport = new int[] {0, 0, (int)width, (int)height}; + glu.gluPickMatrix(x, viewport[3] - y, 5, 5, viewport); + } + glu.gluOrtho2D(0, width, 0, height); + gl.glMatrixMode(GL.GL_MODELVIEW); + gl.glPushMatrix(); + gl.glLoadIdentity(); + drawSpacePath(hitdetection); + gl.glMatrixMode(GL.GL_PROJECTION); + gl.glPopMatrix(); + gl.glMatrixMode(GL.GL_MODELVIEW); + gl.glPopMatrix(); + + gl.glPopMatrix(); if (hitdetection) { *************** *** 827,831 **** gl.glDisable(GL.GL_DEPTH_TEST); - { Iterator it = onTopEntities.iterator(); --- 845,848 ---- *************** *** 834,838 **** } } ! } --- 851,902 ---- } } ! } ! ! /** ! * Draw the space path ! * @param selection wherther or not we are drawing for selection ! */ ! private void drawSpacePath(boolean selection) { ! Space active = Project.getInstance().getActiveSpace(); ! Space world = Project.getInstance().world(); ! LinkedList path = new LinkedList(); ! path.add(active); ! while (active != world) { ! active = active.getOwner(); ! path.addFirst(active); ! } ! String name = ""; ! Iterator it = path.iterator(); ! if (it.hasNext()) { ! Space sp = (Space)it.next(); ! name = sp.getName(); ! int sepLength = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_10, " >> ");; ! int length = 0; ! int nameLength = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_10, name); ! if (selection) { ! drawClickBox(5 + length, height - 15, 0.5, ! nameLength, 10, sp); ! } ! length = nameLength; ! while (it.hasNext()) { ! sp = (Space)it.next(); ! name = name + " >> " + sp.getName(); ! length += sepLength; ! nameLength = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_10, sp.getName()); ! if (selection) { ! drawClickBox(5 + length, height - 15, 0.5, ! nameLength, 10, sp); ! } ! length += nameLength; ! } ! } ! if (!selection) { ! gl.glColor3d(1.0, 0.0, 0.0); ! gl.glPushMatrix(); ! gl.glTranslated(5, height - 15, 0.5); ! gl.glRasterPos2i(0, 0); ! glut.glutBitmapString(gl, GLUT.BITMAP_HELVETICA_10, name); ! gl.glPopMatrix(); ! } } *************** *** 1465,1470 **** } - - if (clickable) { //Name must be "front" --- 1529,1532 ---- *************** *** 1486,1490 **** } //draw the front domain name - if (frontDomain == null) { gl.glColor3d(0.2 + fcb, 0.2 + fcb, 0.2 + fcb); --- 1548,1551 ---- *************** *** 1494,1500 **** gl.glColor3d(0.8 + fcb, 0.2 + fcb, 0.4 + fcb); } - drawString(frontTextAnchor.getX(), frontTextAnchor.getY(), frontName); - double bcb = 0; if (backLabelSelect) { --- 1555,1559 ---- *************** *** 1540,1544 **** */ private void drawClickBox(double x, double y, double z, ! int width, int height, String name) { pushName(gl, name); gl.glBegin(GL.GL_POLYGON); --- 1599,1603 ---- */ private void drawClickBox(double x, double y, double z, ! int width, int height, Object name) { pushName(gl, name); gl.glBegin(GL.GL_POLYGON); |