Changeset 390


Ignore:
Timestamp:
11/17/08 15:43:36 (16 years ago)
Author:
ra33
Message:

Added auto colour wheel... when drawing rectangles...
Fixed computeTree bug
Added TDFC for rectangles.

Location:
trunk/src/org/expeditee
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Misc.java

    r376 r390  
    760760                                Node node = myParser.parse(formula);
    761761                                Object result = myParser.evaluate(node);
    762                                 text.setText(result.toString());
     762                                text.setText(result.toString(), true);
    763763                                text.setFormula(formulaFullCase);
    764764                                if (text.isFloating()) {
  • trunk/src/org/expeditee/actions/Simple.java

    r376 r390  
    11701170                                        Text textItem = (Text) context.getPointers().getVariable(
    11711171                                                        tokens[1]).getValue();
    1172                                         textItem.setText(newText);
     1172                                        textItem.setText(newText, true);
    11731173                                } else
    11741174                                        throw new Exception("Unsupported setItem command: "
     
    13861386                                        t = (Text) context.getPointers().getVariable(tokens[1])
    13871387                                                        .getValue();
    1388                                         t.setText(log);
     1388                                        t.setText(log, true);
    13891389                                } else if (tokens[0].equals("getframeitemcount")) {
    13901390                                        String frameVar = DEFAULT_FRAME;
     
    24552455
    24562456                        pause(context.getPrimitives().getDoubleValue(lengthVar));
    2457                 } else if (tokens[0].equals("glidecursorto")) {
     2457                } else if (tokens[0].equals("waitforagent")) {
     2458                        while(DefaultAgent.isAgentRunning()){
     2459                                Thread.sleep(100);
     2460                        }
     2461                }else if (tokens[0].equals("glidecursorto")) {
    24582462                        assertMinParametreCount(tokens, 2);
    24592463                        int finalX = (int) context.getPrimitives().getIntegerValue(
  • trunk/src/org/expeditee/agents/Agent.java

    r179 r390  
    1212 */
    1313public interface Agent extends Runnable {
    14 
     14       
    1515        /**
    1616         * This method should always be called before calling process(). The Frame
  • trunk/src/org/expeditee/agents/ComputeTree.java

    r247 r390  
    3838                // Search for @Compute frame tag
    3939                String computeTag = null;
     40               
     41                //TODO can speed this up by using frame.hasAnnotations
    4042                for (Item i : frame.getItems()) {
    4143                        if (_stop)
     
    109111                                }
    110112                        }
     113                       
     114                        if(value.equals(Double.NaN))
     115                                continue;
    111116
    112117                        if (value != null) {
  • trunk/src/org/expeditee/agents/DefaultAgent.java

    r313 r390  
    1818 */
    1919public abstract class DefaultAgent implements Agent {
     20        public static int AGENTS_RUNNING = 0;
     21       
    2022        public static final String CLIPBOARD = "Clipboard";
    2123
     
    4547
    4648        public DefaultAgent(String delay) {
    47                 super();
     49                this();
    4850                try {
    4951                        _delay = (int) (Double.parseDouble(delay) * 1000);
     
    5456        public DefaultAgent() {
    5557                super();
     58                AGENTS_RUNNING++;
     59        }
     60       
     61        public static boolean isAgentRunning() {
     62                return AGENTS_RUNNING > 0;
    5663        }
    5764
     
    101108
    102109                _running = false;
     110                AGENTS_RUNNING--;
    103111
    104112                FrameGraphics.requestRefresh(true);
  • trunk/src/org/expeditee/gui/DisplayIO.java

    r376 r390  
    531531                        }
    532532                }
    533                 frame.refreshItemPermissions(Permission.full);
     533                frame.reset();
    534534                FrameMouseActions.getInstance().refreshHighlights();
    535535                FrameGraphics.refresh(false);
  • trunk/src/org/expeditee/gui/Frame.java

    r376 r390  
    131131        private Collection<Item> _vectorItems = new LinkedHashSet<Item>();
    132132
     133        private Text _dotTemplate = UserSettings.DotTemplate.copy();
     134
    133135        /**
    134136         * Default constructor, nothing is set.
    135137         */
    136138        public Frame() {
     139        }
     140
     141        public void reset() {
     142                refreshItemPermissions(Permission.full);
     143
     144                resetDot();
     145        }
     146       
     147        private void resetDot() {
     148                _dotTemplate.setColor(Item.COLOR_WHEEL[1]);
     149                _dotTemplate.setFillColor(Item.FILL_COLOR_WHEEL[0]);
     150        }
     151
     152        public void nextDot() {
     153                _dotTemplate.setFillColor(ColorUtils.getNextColor(_dotTemplate
     154                                .getFillColor(), Item.FILL_COLOR_WHEEL, null));
     155                _dotTemplate.setColor(ColorUtils.getNextColor(_dotTemplate.getColor(),
     156                                Item.COLOR_WHEEL, null));
     157               
     158                if(_dotTemplate.getColor().equals(Color.white)){
     159                        resetDot();
     160                }
    137161        }
    138162
     
    219243        }
    220244
    221         //private static int updateCount = 0;
     245        // private static int updateCount = 0;
    222246
    223247        /**
     
    229253         */
    230254        public void notifyObservers(boolean bRecalculate) {
    231                 if(bRecalculate){
     255                if (bRecalculate) {
    232256                        recalculate();
    233257                }
     
    241265                Collection<FrameObserver> observersCopy = new LinkedList<FrameObserver>(
    242266                                _observers);
    243                 //System.out.println(++updateCount + " update");
     267                // System.out.println(++updateCount + " update");
    244268
    245269                for (FrameObserver fl : observersCopy) {
     
    15081532                                getNextItemID());
    15091533
    1510                 Item template = getTemplate(UserSettings.DotTemplate,
    1511                                 ItemUtils.TAG_DOT_TEMPLATE);
     1534                Item template = getTemplate(_dotTemplate, ItemUtils.TAG_DOT_TEMPLATE);
    15121535                float thickness = template.getThickness();
    15131536                if (thickness > 0)
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r376 r390  
    693693                                assert (widgetLink != null);
    694694                                clicked = widgetLink;
     695                        } else {
     696                                for (Item i : _lastClickedIn) {
     697                                        /*
     698                                         * Find the first linked item or the first unlinked Dot This
     699                                         * code assumes that items are are ordered from top to bottom.
     700                                         * TODO make sure the list will always be ordered correctly!!
     701                                         */
     702                                        if (i.hasLink() || i instanceof Dot){
     703                                                clicked = i;
     704                                                break;
     705                                        }
     706                                }
    695707                        }
    696708
     
    13861398                                                copies.add(d[i]);
    13871399                                        }
     1400                                       
     1401                                        current.nextDot();
    13881402
    13891403                                        // create lines
     
    15131527                        }
    15141528
    1515                         DisplayIO.setTextCursor(_lastRanged, Text.NONE, false, e.isShiftDown(), e.isControlDown(), false);
     1529                        DisplayIO.setTextCursor(_lastRanged, Text.NONE, false, e
     1530                                        .isShiftDown(), e.isControlDown(), false);
    15161531                        FrameGraphics.Repaint();
    15171532                        return;
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r376 r390  
    766766                AttributeValuePair avp = new AttributeValuePair(item.getText());
    767767                assert (avp != null);
    768                
     768
    769769                if (avp.hasPair()) {
    770770                        item.setLink(avp.getValue());
     
    984984                                                        }
    985985                                                        Frame overlayFrame = null;
    986                                                        
     986
    987987                                                        Frame current = DisplayIO.getCurrentFrame();
    988988                                                        if (current != null) {
    989989                                                                for (Overlay o : current.getOverlays()) {
    990                                                                         if (o.Frame.getName().equalsIgnoreCase(link))
     990                                                                        if (o.Frame.getName()
     991                                                                                        .equalsIgnoreCase(link))
    991992                                                                                overlayFrame = o.Frame;
    992993                                                                }
    993994                                                        }
    994                                                         if (overlayFrame == null) overlayFrame = FrameIO.LoadFrame(link);
    995                                                        
     995                                                        if (overlayFrame == null)
     996                                                                overlayFrame = FrameIO.LoadFrame(link);
     997
    996998                                                        // get level if specified
    997999                                                        String level = new AttributeValuePair(i.getText())
     
    11061108                toParse.addAllOverlays(overlays);
    11071109                toParse.addAllVectors(vectors);
    1108                
     1110
    11091111        }
    11101112
     
    12941296
    12951297                // Brook: enclosed widgets are to be fully enclosed, never partially
     1298                /*
     1299                 * MIKE says: but doesnt this mean that widgets are treated differently
     1300                 * from ALL other object which only need to be partially enclosed to be
     1301                 * picked up
     1302                 */
    12961303                List<InteractiveWidget> enclosedWidgets = new LinkedList<InteractiveWidget>();
    12971304                for (Item i : enclosed) {
     
    14591466
    14601467                yPos += spacing;
    1461                 profile.addText(xPos, yPos, "@HomeFrame", null,
    1462                                 profile.getName());
     1468                profile.addText(xPos, yPos, "@HomeFrame", null, profile.getName());
    14631469                yPos += spacing;
    14641470                String defaultFrameName = profile.getFramesetName() + "0";
    1465                 profile.addText(xPos, yPos, "@DefaultFrame", null,
    1466                                 defaultFrameName);
     1471                profile.addText(xPos, yPos, "@DefaultFrame", null, defaultFrameName);
    14671472                yPos += spacing;
    14681473
  • trunk/src/org/expeditee/io/Conversion.java

    r362 r390  
    481481        public static Object[] Convert(Method method, String value, Object current) {
    482482
     483                if(method == null) {
     484                        System.out.println("Error converting null method");
     485                        return null;
     486                }
     487               
    483488                String name = method.getName();
    484489                Class[] types = method.getParameterTypes();
  • trunk/src/org/expeditee/io/KMSReader.java

    r348 r390  
    493493                        } else {
    494494                                Method toRun = _ItemTags.get("" + tag.charAt(0));
    495                                 if (toRun == null)
     495                                if (toRun == null){
    496496                                        System.out.println("Error accessing tag method: "
    497497                                                        + tag.charAt(0));
     498                                       
     499                                }
    498500                                Object[] vals;
    499501                                if (last.length() > 0)
  • trunk/src/org/expeditee/items/Item.java

    r376 r390  
    26772677
    26782678        public String getText() {
    2679                 return toString();
     2679                return "@" + getClass().getSimpleName() + ":" + getID();
    26802680        }
    26812681
  • trunk/src/org/expeditee/items/Text.java

    r376 r390  
    267267        @Override
    268268        public void setText(String text) {
     269                setText(text, false);
     270        }
     271       
     272        public void setText(String text, Boolean clearCache) {
    269273                // if (_text != null && text.length() < _text.length())
    270274                invalidateAll();
     
    272276
    273277                /*
    274                  * Adding the lines below remove formulas when moving in and out of XRay
     278                 * Always clearingCach remove formulas when moving in and out of XRay
    275279                 * mode
    276280                 */
    277                 // Reset properties
    278                 // setProcessedText(null);
    279                 // setFormula(null);
     281                if(clearCache){
     282                        clearCache();
     283                }               
     284                       
    280285                rebuild(true);
    281286                invalidateAll();
Note: See TracChangeset for help on using the changeset viewer.