Changeset 697


Ignore:
Timestamp:
01/15/14 17:31:30 (10 years ago)
Author:
jts21
Message:

Fixes/improvements to Help text

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

Legend:

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

    r427 r697  
    88import java.util.LinkedHashSet;
    99import java.util.LinkedList;
     10import java.util.List;
    1011import java.util.Map;
    1112
     13import org.expeditee.items.Dot;
    1214import org.expeditee.items.Item;
     15import org.expeditee.items.Line;
    1316import org.expeditee.items.Text;
    1417
     
    167170                _cursor.addAll(cursor);
    168171        }
     172       
     173        public static boolean hasMultipleVisibleItems() {
     174                List<Item> toCount = new LinkedList<Item>(getInstance());
     175                int c = 0;
     176                while(!toCount.isEmpty()) {
     177                        Item i = toCount.remove(0);
     178                        if(i.isVisible()) {
     179                                toCount.removeAll(i.getAllConnected()); // treat polygons as a single item
     180                                if(c++ > 0) return true;
     181                        }
     182                }
     183                return false;
     184        }
     185       
     186        public static boolean isDrawingPolyLine() {
     187                List<Item> tmp = getInstance();
     188                return tmp.size() == 2 && tmp.get(0) instanceof Dot && tmp.get(1) instanceof Line;
     189        }
    169190}
  • trunk/src/org/expeditee/gui/Help.java

    r687 r697  
    33import java.util.Collection;
    44
     5import org.expeditee.items.Dot;
    56import org.expeditee.items.Item;
    67import org.expeditee.items.Line;
     8import org.expeditee.items.Picture;
    79import org.expeditee.items.Text;
    810import org.expeditee.items.widgets.InteractiveWidget;
     
    1820                background,
    1921                item,
     22                polygon,
    2023                line,
     24                dot,
    2125                text,
     26                image,
    2227                widget
    2328        };
     
    3237       
    3338        // other
    34         private static final int panning = 1, action = 2, cursor = 4;
     39        private static final int panning = 1, action = 2, link = 4, cursor = 8;
    3540       
    3641        // separator between command and description
     
    4045       
    4146        private static final String commandPadding = "       ";
    42         private static final String padding = "                   ";
     47        private static final String padding = "                    ";
    4348       
    4449        private static final String command(int mod, int button, boolean drag) {
     
    5762                if((mod & (control | shift)) != 0) return "Go forward";
    5863                return "Go back";
     64       
    5965                default:
    6066                        if((other & action) != 0 && (mod & control) == 0) return "Run action";
    61                         return "Follow link";
     67                        if((other & link) != 0) return "Follow link";
     68                        return "Create link";
    6269                }
    6370        }
     
    6774                case widget: return "Middle click widget";
    6875                case background:
    69                 if((other & cursor) != 0) return "Place item(s)";
     76                if((other & cursor) != 0) return FreeItems.hasMultipleVisibleItems() ? "Place items" : "Place item";
    7077                return "Create arrow";
    7178                case line:
    7279                        if((mod & shift) != 0) return "Extend shape";
    73                 case text:
    74                         if((other & cursor) != 0 && FrameUtils.getCurrentItem() instanceof Text) return "Merge text";
    75                 default:
    76                         if((other & cursor) != 0) return "Place item(s)";
     80                case dot:
     81                        if((mod & shift) != 0) return "Pickup unconstrained";
     82                case text:
     83                        if((other & cursor) != 0 && FreeItems.getInstance().size() == 1 && FreeItems.textOnlyAttachedToCursor()) return "Merge text";
     84                default:
     85                        if((other & cursor) != 0) return FreeItems.hasMultipleVisibleItems() ? "Place items" : "Place item";
    7786                if((mod & shift) != 0) return "Create arrow";
    78                         return "Pickup";
     87                        return "Pickup item";
    7988                }
    8089        }
     
    8493                case widget: return "Right click widget";
    8594                case background:
    86                         if((other & cursor) != 0) return "Stamp item(s)";
     95                        if((other & cursor) != 0) {
     96                                if(FreeItems.isDrawingPolyLine()) return "Continue poly-line";
     97                                return FreeItems.hasMultipleVisibleItems() ? "Stamp items" : "Stamp item";
     98                        }
    8799                        return "Create rectangle";
    88100                case line:
    89101                        if((mod & shift) != 0) return "Add line";
    90102                default:
    91                         if((other & cursor) != 0) return "Stamp item(s)";
     103                        if((other & cursor) != 0) return FreeItems.hasMultipleVisibleItems() ? "Stamp items" : "Stamp item";
    92104                        if((mod & shift) != 0) return "Create rectangle";
    93                         return "Copy";
     105                        if(context == Context.polygon) return "Copy enclosed items";
     106                        return "Copy item";
    94107                }
    95108        }
     
    103116                case widget: return null;
    104117                default:
    105                         if((other & cursor) == 0) return "Extract attributes";
     118                        if((other & cursor) == 0 && (context != Context.polygon)) return "Extract attributes";
    106119                case background:
    107120                        return "Auto format";
     
    113126                case widget: return null;
    114127                case text:
    115                         if((other & cursor) != 0 && FrameUtils.getCurrentItem() instanceof Text) return "Swap text";
    116                         break;
    117                 case background:
    118                         if((other & cursor) == 0) return "Undo";
     128                        if((other & cursor) != 0 && FreeItems.getInstance().size() == 1 && FreeItems.textOnlyAttachedToCursor()) return "Swap text";
     129                        break;
     130                case background:
     131                        if((other & cursor) == 0) return "Undo last delete";
    119132                        break;
    120133                }
     
    126139                case widget: return null;
    127140                case background:
    128                         if((mod & shift) != 0 && (other & cursor) == 0) return "Drag to pan";
    129                         break;
    130                 case text:
    131                         if((other & cursor) == 0) return "Select region";
     141                        if((mod & shift) != 0 && (other & cursor) == 0 && (other & panning) != 0) return "Drag to pan";
     142                        break;
     143                case text:
     144                        if((other & cursor) == 0) return "Select text region";
    132145                        break;
    133146                }
     
    139152                case widget: return null;
    140153                case text:
    141                         if((other & cursor) == 0) return "Cut region";
     154                        if((other & cursor) == 0) return "Cut text region";
    142155                }
    143156                return null;
     
    147160                switch(context) {
    148161                case widget: return null;
     162                case image:
     163                        return "Crop image";
    149164                case line:
    150165                        return "Extrude shape";
    151166                case text:
    152                         if((other & cursor) == 0) return "Copy region";
     167                        if((other & cursor) == 0) return "Copy text region";
    153168                }
    154169                return null;
     
    166181                        } else if(current instanceof Text) {
    167182                                context = Context.text;
    168                         } else {
     183                        } else if(current instanceof Picture) {
     184                                context = Context.image;
     185                        } else if(current instanceof Dot ) {
     186                                context = Context.dot;
     187                        }else {
    169188                                context = Context.item;
    170189                        }
     
    186205                                        context = Context.widget;
    187206                                } else {
    188                                         context = Context.item;
     207                                        context = Context.polygon;
    189208                                }
    190209                        } else {
     
    193212                }
    194213                int mod = (FrameMouseActions.isControlDown() ? control : 0) | (FrameMouseActions.isShiftDown() ? shift : 0);
    195                 int other = (ExperimentalFeatures.MousePan.get() ? panning : 0) | (current != null && current.hasAction() ? action : 0) | (FreeItems.itemsAttachedToCursor() ? cursor : 0);
     214                int other = (ExperimentalFeatures.MousePan.get() ? panning : 0) |
     215                                (current != null && current.hasAction() ? action : 0)|
     216                                (current != null && current.hasLink() ? link : 0) |
     217                                (FreeItems.itemsAttachedToCursor() ? cursor : 0);
    196218                String status = "";
    197219               
  • trunk/src/org/expeditee/items/XRayable.java

    r665 r697  
    169169        public String getFillPattern() {
    170170                return _source.getFillPattern();
     171        }
     172       
     173        @Override
     174        public boolean hasLink() {
     175                return getLink() != null;
    171176        }
    172177       
Note: See TracChangeset for help on using the changeset viewer.