Changeset 814


Ignore:
Timestamp:
02/03/14 16:02:35 (10 years ago)
Author:
jts21
Message:

Automatically reposition anchored items when resizing them, and when F12 (refresh) is pressed if shift is down

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r778 r814  
    15341534                return newItemText;
    15351535        }
     1536       
     1537        private static boolean refreshAnchors(Collection<Item> items) {
     1538                boolean bReparse = false;
     1539               
     1540                for(Item i : items) {
     1541                        Float anchorLeft   = i.getAnchorLeft();
     1542                        Float anchorRight  = i.getAnchorRight();
     1543                        Float anchorTop    = i.getAnchorTop();
     1544                        Float anchorBottom = i.getAnchorBottom();
     1545       
     1546                       
     1547                        if (anchorLeft != null) {
     1548                                i.setAnchorLeft(anchorLeft);
     1549                                if (i.hasVector()) {
     1550                                        bReparse = true;
     1551                                }
     1552                        }
     1553                       
     1554                        if (anchorRight != null) {
     1555                                i.setAnchorRight(anchorRight);
     1556                                if (i.hasVector()) {
     1557                                        bReparse = true;
     1558                                }
     1559                        }
     1560                       
     1561                        if (anchorTop != null) {
     1562                                i.setAnchorTop(anchorTop);
     1563                                if (i.hasVector()) {
     1564                                        bReparse = true;
     1565                                }
     1566                        }
     1567                       
     1568                        if (anchorBottom != null) {
     1569                                i.setAnchorBottom(anchorBottom);
     1570                                if (i.hasVector()) {
     1571                                        bReparse = true;
     1572                                }
     1573                        }
     1574                }
     1575                return bReparse;
     1576        }
    15361577
    15371578        /**
     
    15681609                                // scale the entire frame
    15691610                                ScaleFrameset.scaleFrame(DisplayIO.getCurrentFrame(), (float) (diff > 0 ? 1.1 : 0.909090909));
     1611                                DisplayIO.getCurrentFrame().refreshSize();
    15701612                                FrameKeyboardActions.Refresh();
    15711613                                // MessageBay.displayMessage("Can not resize the frame name");
     
    16951737                                }
    16961738                        }
     1739                        // refresh anchored items
     1740                if(refreshAnchors(toSize)) {
     1741                        FrameUtils.Parse(DisplayIO.getCurrentFrame(), false);
     1742                }
    16971743                        // notify widgets they were resized
    16981744                        for(InteractiveWidget iw : widgets) {
     
    17551801                if (toSet != null)
    17561802                        toSet.getParent().setChanged(true);
     1803               
     1804                // refresh anchored items
     1805                if(refreshAnchors(toSize)) {
     1806                        FrameUtils.Parse(DisplayIO.getCurrentFrame(), false);
     1807                }
    17571808
    17581809                // notify widgets they were resized
     
    21612212        public static void Refresh() {
    21622213                Frame currentFrame = DisplayIO.getCurrentFrame();
     2214               
     2215                if(FrameMouseActions.isShiftDown()) {
     2216                        currentFrame.refreshSize();
     2217                }
    21632218
    21642219                // Refresh widgets that use its self as a data source
Note: See TracChangeset for help on using the changeset viewer.