Field

Changeset 147:777ab2eb85c2

Show
Ignore:
Timestamp:
08/08/2008 12:22:12 AM (4 months ago)
Author:
marc@e0.local
branch:
default
Message:

misc small UI fixes from Boston / Hyposurface visit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • development/java/field/core/persistance/FluidPersistence.java

    r140 r147  
    9696                                                        // to 
    9797                                                        // guess 
    98                                                         // what 
     98                                                        // whatq 
    9999                                                        // kind 
    100100                                                        // of 
  • development/java/field/core/plugins/SimpleConstraints.java

    r126 r147  
    3939                { 
    4040                        super(fireOn, inside, control); 
    41                       this.oy = oy; 
    42                       this.ox = ox; 
     41//                    this.oy = oy; 
     42//                    this.ox = ox; 
    4343                        Rect oldParentFrame = inside.getFrame(null); 
    4444                        Rect oldFrame = control.getFrame(null); 
     
    4646                        this.height = (float) oldFrame.h; 
    4747 
    48                         this.x = (float) ((oldFrame.x-oldParentFrame.x)/oldParentFrame.w); 
    49                         this.y = (float) ((oldFrame.y-oldParentFrame.y)/oldParentFrame.h); 
    50  
    51                         Rect newFrame = new Rect(oldParentFrame.x + x * oldParentFrame.w - ox, oldParentFrame.y + y * oldParentFrame.h - oy, width, height); 
     48//                      this.x = (float) ((oldFrame.x-oldParentFrame.x)/oldParentFrame.w); 
     49//                      this.y = (float) ((oldFrame.y-oldParentFrame.y)/oldParentFrame.h); 
     50 
     51                        this.x = 1; 
     52                        this.y = 0; 
     53                        this.ox = -(float) (-ox+oldFrame.x-oldParentFrame.x-oldParentFrame.w); 
     54                        this.oy = -(float) (-oy+oldFrame.y-oldParentFrame.y); 
     55                         
     56                        Rect newFrame = new Rect(5+oldParentFrame.x + x * oldParentFrame.w - ox, oldParentFrame.y + y * oldParentFrame.h - oy, width, height); 
    5257                        new iVisualElementOverrides.MakeDispatchProxy().getOverrideProxyFor(control).shouldChangeFrame(control, newFrame, oldFrame, true); 
    5358                } 
  • development/java/field/core/plugins/drawing/SplineComputingOverride.java

    r145 r147  
    130130                        if (e == null) 
    131131                                return; 
     132                        if (e.equals("")) 
     133                                return; 
    132134 
    133135                        Ref<PythonScriptingSystem> refPss = new Ref<PythonScriptingSystem>(null); 
     
    987989        @Override 
    988990        public VisitCode shouldChangeFrame(iVisualElement source, Rect newFrame, Rect oldFrame, boolean now) { 
     991                 
     992                 
    989993                if (source == forElement) { 
     994                        System.out.println(" should change frame from <"+oldFrame+" -> "+newFrame+">"); 
    990995                        new VisualElementProperty<Rect>("oldFrame_").set(source, source, oldFrame); 
    991996                } 
  • development/java/field/core/plugins/drawing/TextLayoutGroup.java

    r145 r147  
    3535import field.math.linalg.Vector2; 
    3636import field.math.linalg.Vector4; 
     37import field.math.util.HungarianConvience2; 
    3738import field.namespace.generic.Generics.Triple; 
    38 import field.util.HungarianConvience2; 
    3939 
    4040/** 
  • development/java/field/core/windowing/GLComponentWindow.java

    r146 r147  
    205205                                        // a 
    206206                                        // mouse 
    207                                         // event! 
     207                                        // event 
     208                                        // ! 
    208209                                        final MouseEvent me = new MouseEvent(arg0.getComponent(), MouseEvent.MOUSE_CLICKED, arg0.getWhen(), arg0.getModifiers(), (int) currentWindow.currentMouse.x, (int) currentWindow.currentMouse.y, 1, false); 
    209210 
     
    751752                }; 
    752753 
    753                 frame.addFocusListener(new FocusListener() { 
    754  
    755                         public void focusGained(FocusEvent e) { 
    756                                 System.out.println(" frame has focus, requesting that the canvas gets some focus"); 
    757                                 canvas.requestFocus(); 
    758                         } 
    759  
    760                         public void focusLost(FocusEvent e) { 
    761                         } 
    762                 }); 
    763  
    764754                canvas.setAutoSwapBufferMode(false); 
    765755 
     
    11411131 
    11421132        public void transformMouseEvent(MouseEvent arg0) { 
     1133 
    11431134                Vector2 at = floatResMouseEvents.get(arg0); 
    11441135                if (at == null) { 
     
    11531144                ReflectionTools.illegalSetObject(arg0, "y", Math.round(at.y * sy + ty)); 
    11541145 
    1155                 floatResMouseEvents.put(arg0, new Vector2(at.x * sx + tx, at.y * sy + ty)); 
     1146                Vector2 a = new Vector2(at.x * sx + tx, at.y * sy + ty); 
     1147 
     1148                floatResMouseEvents.put(arg0, a); 
    11561149        } 
    11571150 
     
    11851178 
    11861179        public void untransformMouseEvent(MouseEvent arg0) { 
     1180 
    11871181                Vector2 at = floatResMouseEvents.get(arg0); 
    11881182                if (at == null) { 
     
    12521246                gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA); 
    12531247 
    1254                 // iVisualElementOverrides.MakeDispatchProxy.dispatchForwardCount 
     1248                // iVisualElementOverrides.MakeDispatchProxy. 
     1249                // dispatchForwardCount 
    12551250                // = 0; 
    1256                 // iVisualElementOverrides.MakeDispatchProxy.dispatchBackwardCount 
     1251                // iVisualElementOverrides.MakeDispatchProxy. 
     1252                // dispatchBackwardCount 
    12571253                // = 0; 
    12581254 
     
    12901286 
    12911287                // masterProgram = 
    1292                 // (BasicCGProgram.fromFile("content/shaders/glComponentWindow_master.cg", 
     1288                // (BasicCGProgram.fromFile( 
     1289                // "content/shaders/glComponentWindow_master.cg" 
     1290                // , 
    12931291                // false)); 
    12941292                masterProgram = new BasicGLSLangProgram("content/shaders/glComponentVertex.glslang", "content/shaders/glComponentGLSLangFragment.glslang"); 
  • development/java/field/core/windowing/components/DraggableComponent.java

    r140 r147  
    176176                        arg0.consume(); 
    177177 
     178                        System.out.println(" computing currentResize :"+arg0.getX()+" "+arg0.getY()+" (( "+bounds+" ))"); 
     179                         
    178180                        currentResize.clear(); 
    179181                        if (arg0.getX() - getX() < zone) 
     
    488490                                } 
    489491                        } else { 
     492                                 
    490493 
    491494                                dragger.mousePressed(arg0); 
     
    500503                                                        d.deselectAll(); 
    501504                                        } 
    502                                         System.out.println(" adding to selection"); 
    503505                                        for (SelectionGroup<iComponent> d : getSelectionGroups()) 
    504506                                                d.addToSelection(DraggableComponent.this); 
  • development/java/field/core/windowing/components/PlainDraggableComponent.java

    r86 r147  
    177177                        this.dirty = true; 
    178178                        if (getInside() != null) getInside().requestRedisplay(); 
     179 
     180                        for (SelectionGroup g : getMarkingGroups()) { 
     181                                g.register(this); 
     182                                if (marked) 
     183                                        g.addToSelection(this); 
     184                        } 
     185 
    179186                } 
    180187 
  • development/java/field/core/windowing/components/RootComponent.java

    r85 r147  
    8686                public void mouseDragged(MouseEvent arg0) { 
    8787 
    88                         float lx = RootComponent.this.getX(); 
    89                         float ly = RootComponent.this.getY(); 
    90  
    91                         GLComponentWindow.getCurrentWindow(RootComponent.this).untransformMouseEvent(arg0); 
     88                        float lx = RootComponent.this.getX(); 
     89                        float ly = RootComponent.this.getY(); 
     90 
     91                        //GLComponentWindow.getCurrentWindow(RootComponent.this).untransformMouseEvent(arg0); 
    9292 
    9393                        Vector2 mv = GLComponentWindow.mousePositionForEvent(arg0); 
     
    9999                        for (SelectionGroup<iComponent> s : selectionGroups) { 
    100100                                for (iComponent d : s.getSelection()) { 
    101                                         if (d != RootComponent.this) 
    102                                         { 
     101                                        if (d != RootComponent.this) { 
    103102                                                handled = true; 
    104 //                                              d.handleResize(currentResize, dx, dy); 
     103                                                // d 
     104                                                // . 
     105                                                // handleResize 
     106                                                // ( 
     107                                                // currentResize 
     108                                                // , 
     109                                                // dx 
     110                                                // , 
     111                                                // dy 
     112                                                // ) 
     113                                                // ; 
    105114                                        } 
    106115                                } 
    107116                        } 
    108                         if (handled) return; 
     117                        if (handled) 
     118                                return; 
    109119 
    110120                        GLComponentWindow.getCurrentWindow(RootComponent.this).transformMouseEvent(arg0); 
     
    113123 
    114124                        GLComponentWindow.getCurrentWindow(RootComponent.this).untransformMouseEvent(arg0); 
    115                         // need to rexpress lx in light of the potentially new 
     125                        // need to rexpress lx in light 
     126                        // of the potentially new 
    116127                        // viewport scale 
    117128                        mv = GLComponentWindow.mousePositionForEvent(arg0); 
    118129 
    119                         float lx2 = RootComponent.this.getX(); 
    120                         float ly2 = RootComponent.this.getY(); 
     130                        float lx2 = RootComponent.this.getX(); 
     131                        float ly2 = RootComponent.this.getY(); 
    121132 
    122133                        lastX = (mv.x) - (lx2 - lx); 
    123134                        lastY = (mv.y) - (ly2 - ly); 
     135                         
     136                        GLComponentWindow.getCurrentWindow(RootComponent.this).transformMouseEvent(arg0); 
     137 
    124138 
    125139                } 
     
    129143 
    130144                public void mouseExited(MouseEvent arg0) { 
    131                         // GLComponentWindow.getCurrentWindow(RootComponent.this).getCanvas().setCursor(Cursor.getDefaultCursor()); 
     145                        // GLComponentWindow. 
     146                        // getCurrentWindow 
     147                        // (RootComponent 
     148                        // .this).getCanvas 
     149                        // ().setCursor(Cursor 
     150                        // .getDefaultCursor()); 
    132151                } 
    133152 
     
    175194                public void mousePressed(MouseEvent arg0) { 
    176195 
    177  
    178                         // if ((arg0.getModifiers() & MouseEvent.SHIFT_MASK) == 
    179                         // 0) for (SelectionGroup<Draggable> d : 
     196                        // if ((arg0.getModifiers() & 
     197                        // MouseEvent.SHIFT_MASK) == 
     198                        // 0) for 
     199                        // (SelectionGroup<Draggable> d 
     200                        // : 
    180201                        // selectionGroups) 
    181202                        // d.deselectAll(); 
    182                         // for (SelectionGroup<Draggable> d : selectionGroups) 
    183                         // d.addToSelection(WindowResizingComponent.this); 
     203                        // for 
     204                        // (SelectionGroup<Draggable> d 
     205                        // : selectionGroups) 
     206                        // d.addToSelection( 
     207                        // WindowResizingComponent 
     208                        // .this); 
    184209                        // 
    185210                        // setSelected(true); 
     
    206231                        float ly = RootComponent.this.getY(); 
    207232 
    208                         GLComponentWindow.getCurrentWindow(RootComponent.this).untransformMouseEvent(arg0); 
     233                        //GLComponentWindow.getCurrentWindow(RootComponent.this).untransformMouseEvent(arg0); 
    209234 
    210235                        float xxx = GLComponentWindow.mousePositionForEvent(arg0).x; 
    211                         float yyy= GLComponentWindow.mousePositionForEvent(arg0).y; 
    212  
    213                         downX = lastX = xxx+ 0 * lx; 
     236                        float yyy = GLComponentWindow.mousePositionForEvent(arg0).y; 
     237 
     238                        downX = lastX = xxx + 0 * lx; 
    214239                        downY = lastY = yyy + 0 * ly; 
    215240                } 
     
    356381                        } 
    357382 
    358                         // lets try and translate around the center of the 
     383                        // lets try and translate around 
     384                        // the center of the 
    359385                        // window 
    360386 
     
    362388                        int windowHeight = GLComponentWindow.getCurrentWindow(this).getFrame().getHeight(); 
    363389 
    364                         // the center of the window in transformed coords is: 
     390                        // the center of the window in 
     391                        // transformed coords is: 
    365392 
    366393                        float transformedCenterX = GLComponentWindow.getCurrentWindow(this).getXTranslation() + windowWidth * GLComponentWindow.getCurrentWindow(this).getXScale() / 2; 
    367394                        float transformedCenterY = GLComponentWindow.getCurrentWindow(this).getYTranslation() + windowHeight * GLComponentWindow.getCurrentWindow(this).getXScale() / 2; 
    368395 
    369                         // and we want this to remain constant dispite the 
     396                        // and we want this to remain 
     397                        // constant dispite the 
    370398                        // change in scale 
    371399 
    372                         // currently, it's uniform scale only 
     400                        // currently, it's uniform scale 
     401                        // only 
    373402                        GLComponentWindow.getCurrentWindow(this).setXScale(Math.min(20, Math.max(0.05f, GLComponentWindow.getCurrentWindow(this).getXScale() * sy))); 
    374403                        GLComponentWindow.getCurrentWindow(this).setYScale(Math.min(20, Math.max(0.05f, GLComponentWindow.getCurrentWindow(this).getYScale() * sy))); 
     
    389418        // atX and atY in window coordinates 
    390419        public void handleResize(Set<Resize> currentResize, float dx, float dy, float atX, float atY) { 
    391  
    392  
    393420 
    394421                if (currentResize.contains(Resize.translate)) 
     
    431458                        } 
    432459 
    433                         // lets try and translate around the center of the 
     460                        // lets try and translate around 
     461                        // the center of the 
    434462                        // window 
    435463 
     
    437465                        int windowHeight = GLComponentWindow.getCurrentWindow(this).getFrame().getHeight(); 
    438466 
    439                         // the center of the window in transformed coords is: 
     467                        // the center of the window in 
     468                        // transformed coords is: 
    440469 
    441470                        float transformedCenterX = GLComponentWindow.getCurrentWindow(this).getXTranslation() + atX * GLComponentWindow.getCurrentWindow(this).getXScale(); 
    442471                        float transformedCenterY = GLComponentWindow.getCurrentWindow(this).getYTranslation() + atY * GLComponentWindow.getCurrentWindow(this).getXScale(); 
    443472 
    444                         // and we want this to remain constant dispite the 
     473                        // and we want this to remain 
     474                        // constant dispite the 
    445475                        // change in scale 
    446476 
    447                         // currently, it's uniform scale only 
     477                        // currently, it's uniform scale 
     478                        // only 
    448479                        GLComponentWindow.getCurrentWindow(this).setXScale(Math.min(100, Math.max(0.01f, GLComponentWindow.getCurrentWindow(this).getXScale() * sy))); 
    449480                        GLComponentWindow.getCurrentWindow(this).setYScale(Math.min(100, Math.max(0.01f, GLComponentWindow.getCurrentWindow(this).getYScale() * sy))); 
     
    522553                        inside.requestRedisplay(); 
    523554                } 
    524                 System.out.println(" is <"+arg0+"> consumed ? <"+arg0.isConsumed()+">"); 
    525555 
    526556                if (arg0.isConsumed()) 
     
    530560                updateBounds(); 
    531561                dragger.mouseDragged(arg0); 
     562                GLComponentWindow.getCurrentWindow(this).transformMouseEvent(arg0); 
    532563        } 
    533564 
     
    544575                updateBounds(); 
    545576                dragger.mouseEntered(arg0); 
     577                GLComponentWindow.getCurrentWindow(this).transformMouseEvent(arg0); 
    546578        } 
    547579 
     
    558590                updateBounds(); 
    559591                dragger.mouseExited(arg0); 
     592                GLComponentWindow.getCurrentWindow(this).transformMouseEvent(arg0); 
    560593        } 
    561594 
     
    572605                updateBounds(); 
    573606                dragger.mouseMoved(arg0); 
     607                GLComponentWindow.getCurrentWindow(this).transformMouseEvent(arg0); 
    574608        } 
    575609 
     
    580614                        inside.requestRedisplay(); 
    581615                } 
    582                  
    583                 System.out.println(" mouse pressed inside root component, peers are <"+mousePeers+">"); 
    584                  
     616 
     617 
    585618                if (arg0.isConsumed()) 
    586619                        return; 
    587620                GLComponentWindow.getCurrentWindow(this).untransformMouseEvent(arg0); 
    588  
    589                 if (arg0.isPopupTrigger()) { 
    590  
    591                         // assemble and present menu 
    592  
    593                         LinkedHashMap<String, iUpdateable> items = new LinkedHashMap<String, iUpdateable>(); 
    594                         overrides.menuItemsFor(null, items); 
    595  
    596                         JPopupMenu menu = new SmallMenu().createMenu(items); 
    597  
    598                         // 
    599                         Ref<GLComponentWindow> ref = new Ref<GLComponentWindow>(null); 
    600                         overrides.getProperty(null, iVisualElement.enclosingFrame, ref); 
    601                         if (ref.get() != null) { 
    602                                 menu.show(ref.get().getCanvas(), (int) ref.get().getCurrentMouseInWindowCoordinates().x, (int) ref.get().getCurrentMouseInWindowCoordinates().y); 
     621                try { 
     622                        if (arg0.isPopupTrigger()) { 
     623 
     624                                // assemble and 
     625                                // present menu 
     626 
     627                                LinkedHashMap<String, iUpdateable> items = new LinkedHashMap<String, iUpdateable>(); 
     628                                overrides.menuItemsFor(null, items); 
     629 
     630                                JPopupMenu menu = new SmallMenu().createMenu(items); 
     631 
     632                                // 
     633                                Ref<GLComponentWindow> ref = new Ref<GLComponentWindow>(null); 
     634                                overrides.getProperty(null, iVisualElement.enclosingFrame, ref); 
     635                                if (ref.get() != null) { 
     636                                        menu.show(ref.get().getCanvas(), (int) ref.get().getCurrentMouseInWindowCoordinates().x, (int) ref.get().getCurrentMouseInWindowCoordinates().y); 
     637                                } else { 
     638                                } 
    603639                        } else { 
    604                         } 
    605                 } else { 
    606  
    607                         updateBounds(); 
    608                         this.inside = inside
    609                         dragger.mousePressed(arg0); 
    610                         ox = arg0.getX(); 
    611                         oy = arg0.getY(); 
    612  
    613                         if (!selected && hasFocus) { 
    614                                 if ((arg0.getModifiers() & MouseEvent.SHIFT_MASK) == 0) 
     640 
     641                               updateBounds(); 
     642                                this.inside = inside; 
     643                               dragger.mousePressed(arg0); 
     644                               ox = arg0.getX()
     645                               oy = arg0.getY(); 
     646 
     647                               if (!selected && hasFocus) { 
     648                                        if ((arg0.getModifiers() & MouseEvent.SHIFT_MASK) == 0) 
     649                                               for (SelectionGroup<iComponent> d : selectionGroups) 
     650                                                       d.deselectAll(); 
    615651                                        for (SelectionGroup<iComponent> d : selectionGroups) 
    616                                                 d.deselectAll(); 
    617                                 for (SelectionGroup<iComponent> d : selectionGroups) 
    618                                         d.addToSelection(RootComponent.this); 
    619                                 RootComponent.this.setSelected(true); 
    620                                 justSelected = true; 
    621                         } else 
    622                                 justSelected = false; 
     652                                                d.addToSelection(RootComponent.this); 
     653                                        RootComponent.this.setSelected(true); 
     654                                        justSelected = true; 
     655                                } else 
     656                                        justSelected = false; 
     657                        } 
     658                } finally { 
     659                        GLComponentWindow.getCurrentWindow(this).transformMouseEvent(arg0); 
     660 
    623661                } 
    624662        } 
     
    654692                } 
    655693                dragger.mouseReleased(arg0); 
     694                GLComponentWindow.getCurrentWindow(this).transformMouseEvent(arg0); 
    656695        } 
    657696