Changeset 687


Ignore:
Timestamp:
01/13/14 11:30:53 (10 years ago)
Author:
jts21
Message:

Better help text for widgets

File:
1 edited

Legend:

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

    r686 r687  
    1919                item,
    2020                line,
    21                 text
     21                text,
     22                widget
    2223        };
    2324       
     
    3839        private static final String dragString = "d";
    3940       
    40         private static final String commandPadding = "     ";
    41         private static final String padding = "                  ";
     41        private static final String commandPadding = "       ";
     42        private static final String padding = "                   ";
    4243       
    4344        private static final String command(int mod, int button, boolean drag) {
    44                 String cmd = (drag ? dragString : "") + modifiers[mod] + buttons[button];
    45                 return commandPadding.substring(cmd.length()) + cmd + separatorString;
     45                String cmd = (drag ? dragString : "") + modifiers[mod] + buttons[button] + separatorString;
     46                return commandPadding.substring(cmd.length()) + cmd;
    4647        }
    4748       
     
    5253        private static final String left(Context context, int mod, int other) {
    5354                switch(context) {
     55                case widget: return "Left click widget";
    5456                case background:
    5557                if((mod & (control | shift)) != 0) return "Go forward";
     
    6365        private static final String middle(Context context, int mod, int other) {
    6466                switch(context) {
     67                case widget: return "Middle click widget";
    6568                case background:
    6669                if((other & cursor) != 0) return "Place item(s)";
     
    7982        private static final String right(Context context, int mod, int other) {
    8083                switch(context) {
     84                case widget: return "Right click widget";
    8185                case background:
    8286                        if((other & cursor) != 0) return "Stamp item(s)";
     
    97101        private static final String left_right(Context context, int mod, int other) {
    98102                switch(context) {
     103                case widget: return null;
    99104                default:
    100105                        if((other & cursor) == 0) return "Extract attributes";
     
    106111    private static final String middle_right(Context context, int mod, int other) {
    107112                switch(context) {
     113                case widget: return null;
    108114                case text:
    109115                        if((other & cursor) != 0 && FrameUtils.getCurrentItem() instanceof Text) return "Swap text";
     
    118124        private static final String drag_left(Context context, int mod, int other) {
    119125                switch(context) {
     126                case widget: return null;
    120127                case background:
    121128                        if((mod & shift) != 0 && (other & cursor) == 0) return "Drag to pan";
     
    130137        private static final String drag_middle(Context context, int mod, int other) {
    131138                switch(context) {
     139                case widget: return null;
    132140                case text:
    133141                        if((other & cursor) == 0) return "Cut region";
     
    138146        private static final String drag_right(Context context, int mod, int other) {
    139147                switch(context) {
     148                case widget: return null;
    140149                case line:
    141150                        return "Extrude shape";
     
    174183                                }
    175184                                }
    176                                 context = Context.item;
     185                                if(iw != null) {
     186                                        context = Context.widget;
     187                                } else {
     188                                        context = Context.item;
     189                                }
    177190                        } else {
    178191                                context = Context.background;
     
    183196                String status = "";
    184197               
    185                 if(iw != null) {
    186                        
    187                         status = " Widget: " + iw.getName() + "\n (widgets have their own individual input handling)";
    188                        
    189                 } else {
    190                
    191                 String l =  left(context, mod, other);
    192                 String m =  middle(context, mod, other);
    193                 String r =  right(context, mod, other);
    194                 String lr = left_right(context, mod, other);
    195                 String lm = left_middle(context, mod, other);
    196                 String mr = middle_right(context, mod, other);
    197                 String dl = drag_left(context, mod, other);
    198                 String dm = drag_middle(context, mod, other);
    199                 String dr = drag_right(context, mod, other);
    200                
    201                 if(l != null)  status += command(mod, left) + l + padding.substring(l.length());
    202                 if(m != null)  status += command(mod, middle) + m + padding.substring(m.length());
    203                 if(r != null)  status += command(mod, right) + r + padding.substring(r.length());
    204                 if(lm != null) status += command(mod, left | middle) + lm + padding.substring(lm.length());
    205                 if(lr != null) status += command(mod, left | right) + lr + padding.substring(lr.length());
    206                 if(mr != null) status += command(mod, middle | right) + mr + padding.substring(mr.length());
    207                 if(dl != null || dm != null || dr != null) status += "\n";
    208                 if(dl != null) status += command(mod, left, true) + dl + padding.substring(dl.length());
    209                 if(dm != null) status += command(mod, middle, true) + dm + padding.substring(dm.length());
    210                 if(dr != null) status += command(mod, right, true) + dr + padding.substring(dr.length());
    211                
    212                 }
     198               
     199                String l =  left(context, mod, other);
     200                String m =  middle(context, mod, other);
     201                String r =  right(context, mod, other);
     202                String lr = left_right(context, mod, other);
     203                String lm = left_middle(context, mod, other);
     204                String mr = middle_right(context, mod, other);
     205                String dl = drag_left(context, mod, other);
     206                String dm = drag_middle(context, mod, other);
     207                String dr = drag_right(context, mod, other);
     208               
     209                if(l != null)  status += command(mod, left) + l + padding.substring(l.length());
     210                if(m != null)  status += command(mod, middle) + m + padding.substring(m.length());
     211                if(r != null)  status += command(mod, right) + r + padding.substring(r.length());
     212                if(lm != null) status += command(mod, left | middle) + lm + padding.substring(lm.length());
     213                if(lr != null) status += command(mod, left | right) + lr + padding.substring(lr.length());
     214                if(mr != null) status += command(mod, middle | right) + mr + padding.substring(mr.length());
     215                if(dl != null || dm != null || dr != null || iw != null) status += "\n";
     216                if(dl != null) status += command(mod, left, true) + dl + padding.substring(dl.length());
     217                if(dm != null) status += command(mod, middle, true) + dm + padding.substring(dm.length());
     218                if(dr != null) status += command(mod, right, true) + dr + padding.substring(dr.length());
     219                if(iw != null) status += commandPadding + "Widget: " + iw.getClass().getSimpleName();
     220               
    213221               
    214222                MessageBay.setStatus(status);
Note: See TracChangeset for help on using the changeset viewer.