Ignore:
Timestamp:
04/15/14 12:56:30 (10 years ago)
Author:
bln4
Message:

Added Magnetic Constraints

Magnetic Constraints are a new type of constraint between items; particularly text. Items can have their neighbours set (for example: who is to my right) and then have custom actions run when a item and its neighbour interact in a defined way. For example: one text item grows enough for hits its right neighbour; so its right neighbour moves over to compensate.
Files changed: org.expeditee.{ gui.DisplayIO, io.DefaultFrameReader, io.DefaultFrameWriter, items.Item, items.Text }

Added ability to have 'delayed' properties on items. With the invention of Magnetic Constraints it was found that the saving and loading of properties now required (greatly benifited from) a way to set a property after all items have been loaded in; rather than as the perticular item was being loaded in. This is that ability.

Files changed: org.expeditee.io.{ DefaultFrameReader, ExpReader }

Let through some non letter characters as names of properties. The tokens ',', '', and '_' have been used as property names to describe neighbors. In order to do this the isValidLine(String) method was altered to let these through. This is not the ideal solution, and should be looked at later.

Files changed: org.expeditee.io.ExpReader

Bug fix: setting a custom title support was added previously. If a custom title had been set the title was: [Your Custom Title] ~ [Expeditee Title]. However the tildas where showing up even without a custom title set. This is now fixed.

File:
1 edited

Legend:

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

    r730 r906  
    2626import org.expeditee.items.Picture;
    2727import org.expeditee.items.Text;
     28import org.expeditee.items.MagneticConstraint.MagneticConstraints;
    2829import org.expeditee.settings.UserSettings;
    2930import org.expeditee.stats.SessionStats;
     
    157158                                .getFloatMouseX(), FrameMouseActions.MouseY, isShiftDown,
    158159                                isCtrlDown);
     160                               
     161                if(isCtrlDown || DisplayIO.getFloatMouseX() + 1 >= newMouse.x && DisplayIO.getFloatMouseX() <= newMouse.x) {
     162                        if(cursorMovement == Text.RIGHT && !MagneticConstraints.getInstance().rightBorderHit(text)) {
     163                                MagneticConstraints.getInstance().endOfLineHit(text);
     164                        } else {
     165                                if(cursorMovement == Text.LEFT && !MagneticConstraints.getInstance().leftBorderHit(text)) {
     166                                        MagneticConstraints.getInstance().startOfLineHit(text);
     167                                }
     168                        }
     169                        newMouse.x = DisplayIO.getFloatMouseX();
     170                        newMouse.y = DisplayIO.getFloatMouseY();
     171                }               
    159172
    160173                if (!newSize && cursorType == Item.TEXT_CURSOR) {
     
    577590                        title.append(" [").append(SessionStats.getShortStats()).append(']');
    578591
    579                 _Browser.setTitle(DisplayIO.title + " ~~~ " + title.toString());
     592                if(DisplayIO.title != "")
     593                        _Browser.setTitle(DisplayIO.title + " ~~~ " + title.toString());
     594                else _Browser.setTitle(title.toString());
    580595        }
    581596       
Note: See TracChangeset for help on using the changeset viewer.