Changeset 686
- Timestamp:
- 01/13/14 11:07:18 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Help.java
r685 r686 1 1 package org.expeditee.gui; 2 3 import java.util.Collection; 2 4 3 5 import org.expeditee.items.Item; 4 6 import org.expeditee.items.Line; 5 7 import org.expeditee.items.Text; 8 import org.expeditee.items.widgets.InteractiveWidget; 9 import org.expeditee.items.widgets.WidgetCorner; 10 import org.expeditee.items.widgets.WidgetEdge; 6 11 import org.expeditee.settings.experimental.ExperimentalFeatures; 7 12 … … 10 15 11 16 // contexts 12 private static final int background = 0, item = 1, line = 2, text = 3; 17 private static enum Context { 18 background, 19 item, 20 line, 21 text 22 }; 13 23 14 24 // mouse buttons … … 40 50 } 41 51 42 private static final String left( int context, int mod, int other) {52 private static final String left(Context context, int mod, int other) { 43 53 switch(context) { 44 54 case background: … … 51 61 } 52 62 53 private static final String middle( int context, int mod, int other) {63 private static final String middle(Context context, int mod, int other) { 54 64 switch(context) { 55 65 case background: … … 67 77 } 68 78 69 private static final String right( int context, int mod, int other) {79 private static final String right(Context context, int mod, int other) { 70 80 switch(context) { 71 81 case background: … … 81 91 } 82 92 83 private static final String left_middle( int context, int mod, int other) {84 return null; 85 } 86 87 private static final String left_right( int context, int mod, int other) {93 private static final String left_middle(Context context, int mod, int other) { 94 return null; 95 } 96 97 private static final String left_right(Context context, int mod, int other) { 88 98 switch(context) { 89 99 default: … … 94 104 } 95 105 96 private static final String middle_right(int context, int mod, int other) {106 private static final String middle_right(Context context, int mod, int other) { 97 107 switch(context) { 98 108 case text: … … 106 116 } 107 117 108 private static final String drag_left( int context, int mod, int other) {118 private static final String drag_left(Context context, int mod, int other) { 109 119 switch(context) { 110 120 case background: … … 118 128 } 119 129 120 private static final String drag_middle( int context, int mod, int other) {130 private static final String drag_middle(Context context, int mod, int other) { 121 131 switch(context) { 122 132 case text: … … 126 136 } 127 137 128 private static final String drag_right( int context, int mod, int other) {138 private static final String drag_right(Context context, int mod, int other) { 129 139 switch(context) { 130 140 case line: … … 139 149 public static void updateStatus() { 140 150 Item current = FrameUtils.getCurrentItem(); 141 int context; 151 Collection<Item> currents; 152 Context context; 153 InteractiveWidget iw = null; 142 154 if(current != null) { 143 155 if(current instanceof Line) { 144 context = line;156 context = Context.line; 145 157 } else if(current instanceof Text) { 146 context = text;158 context = Context.text; 147 159 } else { 148 context = item;160 context = Context.item; 149 161 } 150 } else if(FrameUtils.getCurrentItems() != null) {151 context = item;152 162 } else { 153 context = background; 163 currents = FrameUtils.getCurrentItems(); 164 if(currents != null) { 165 if(currents.size() >= 4) { 166 for(Item i : currents) { 167 if (i instanceof WidgetCorner) { 168 iw = ((WidgetCorner) i).getWidgetSource(); 169 break; 170 } else if (i instanceof WidgetEdge) { 171 iw = ((WidgetEdge) i).getWidgetSource(); 172 break; 173 } 174 } 175 } 176 context = Context.item; 177 } else { 178 context = Context.background; 179 } 154 180 } 155 181 int mod = (FrameMouseActions.isControlDown() ? control : 0) | (FrameMouseActions.isShiftDown() ? shift : 0); … … 157 183 String status = ""; 158 184 159 String l = left(context, mod, other); 160 String m = middle(context, mod, other); 161 String r = right(context, mod, other); 162 String lr = left_right(context, mod, other); 163 String lm = left_middle(context, mod, other); 164 String mr = middle_right(context, mod, other); 165 String dl = drag_left(context, mod, other); 166 String dm = drag_middle(context, mod, other); 167 String dr = drag_right(context, mod, other); 185 if(iw != null) { 186 187 status = " Widget: " + iw.getName() + "\n (widgets have their own individual input handling)"; 188 189 } else { 168 190 169 if(l != null) status += command(mod, left) + l + padding.substring(l.length()); 170 if(m != null) status += command(mod, middle) + m + padding.substring(m.length()); 171 if(r != null) status += command(mod, right) + r + padding.substring(r.length()); 172 if(lm != null) status += command(mod, left | middle) + lm + padding.substring(lm.length()); 173 if(lr != null) status += command(mod, left | right) + lr + padding.substring(lr.length()); 174 if(mr != null) status += command(mod, middle | right) + mr + padding.substring(mr.length()); 175 if(dl != null || dm != null || dr != null) status += "\n"; 176 if(dl != null) status += command(mod, left, true) + dl + padding.substring(dl.length()); 177 if(dm != null) status += command(mod, middle, true) + dm + padding.substring(dm.length()); 178 if(dr != null) status += command(mod, right, true) + dr + padding.substring(dr.length()); 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 } 179 213 180 214 MessageBay.setStatus(status);
Note:
See TracChangeset
for help on using the changeset viewer.