- Timestamp:
- 01/30/19 13:02:05 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/DisplayController.java
r1182 r1216 28 28 import java.util.function.BooleanSupplier; 29 29 30 import org.expeditee.auth.gui.MailBay; 30 31 import org.expeditee.core.Clip; 31 32 import org.expeditee.core.Colour; … … 117 118 private static boolean _audienceMode = false; 118 119 120 /** Whether we are currently displaying mail mode whilst not in audience mode */ 121 private static boolean _mailMode = false; 122 119 123 /** Whether we are currently displaying in x-ray mode. */ 120 124 private static boolean _xrayMode = false; … … 232 236 public static void setTextCursor(Text text, int cursorMovement, 233 237 boolean newSize, boolean isShiftDown, boolean isCtrlDown, 234 boolean allowClearSelection) 235 { 238 boolean allowClearSelection) { 236 239 237 240 int size = Math.round(text.getSize()); … … 243 246 Point newMouse = text.moveCursor(cursorMovement, DisplayController.getFloatMouseX(), EcosystemManager.getInputManager().getCursorPosition().getY(), isShiftDown, isCtrlDown); 244 247 245 if( 246 247 248 if( isCtrlDown || 249 (DisplayController.getFloatMouseX() <= newMouse.getX() && newMouse.getX() <= DisplayController.getFloatMouseX() + 1) || 250 (DisplayController.getFloatMouseX() > newMouse.getX() && cursorMovement == Text.RIGHT)) 248 251 { 249 252 if(cursorMovement == Text.RIGHT && !MagneticConstraints.getInstance().rightBorderHit(text)) { … … 1152 1155 requestRefresh(false); 1153 1156 } 1157 1158 /** 1159 * If Mail Mode is on, this method will toggle it to be off, or vice-versa. 1160 * This results in the Frame being re-parsed and repainted. 1161 */ 1162 public static void ToggleMailMode() { 1163 Frame current = DisplayController.getCurrentFrame(); 1164 1165 // Turn off x-ray mode if it's on 1166 if (_xrayMode) { 1167 ToggleXRayMode(); 1168 } 1169 1170 _mailMode = !_mailMode; 1171 1172 refreshPaintAreas(); 1173 FrameUtils.Parse(current); 1174 updateTitle(); 1175 requestRefresh(false); 1176 } 1177 1178 /** 1179 * Turns Mail Mode off. 1180 * This results in the Frame being re-parsed and repainted. 1181 */ 1182 public static void DisableMailMode() { 1183 Frame current = DisplayController.getCurrentFrame(); 1184 1185 // Turn off x-ray mode if it's on 1186 if (_xrayMode) { 1187 ToggleXRayMode(); 1188 } 1189 1190 _mailMode = false; 1191 1192 refreshPaintAreas(); 1193 FrameUtils.Parse(current); 1194 updateTitle(); 1195 requestRefresh(false); 1196 } 1154 1197 1155 1198 /** … … 1184 1227 return _audienceMode; 1185 1228 } 1229 1230 /** Whether mail mode is currently on. */ 1231 public static boolean isMailMode() { 1232 return _mailMode; 1233 } 1186 1234 1187 1235 /** Whether x-ray mode is currently on. */ … … 1258 1306 if (ItemUtils.isVisible(damagedItem)) { 1259 1307 invalidateArea(AxisAlignedBoxBounds.getEnclosing(toRepaint)); 1260 } else if (MessageBay.isMessageItem(damagedItem)) { 1308 } else if (!_mailMode && MessageBay.isMessageItem(damagedItem)) { 1309 invalidateArea(AxisAlignedBoxBounds.getEnclosing(toRepaint).translate(0, getMessageBayPaintArea().getMinY())); 1310 } else if (_mailMode && MailBay.isPreviewMailItem(damagedItem)) { 1261 1311 invalidateArea(AxisAlignedBoxBounds.getEnclosing(toRepaint).translate(0, getMessageBayPaintArea().getMinY())); 1262 1312 } … … 1343 1393 } 1344 1394 1345 // Paint message bay1346 1395 if (!isAudienceMode()) { 1347 Clip messageBayClip = null; 1348 1349 AxisAlignedBoxBounds messageBayPaintArea = getMessageBayPaintArea(); 1350 if (useInvalidation) { 1351 messageBayClip = clip.clone().intersectWith(messageBayPaintArea); 1352 if (!messageBayClip.isFullyClipped()) { 1353 messageBayClip = new Clip(messageBayClip.getBounds().translate(0, -messageBayPaintArea.getMinY())); 1354 } 1355 } 1356 1357 Image image = null; 1358 if (!useInvalidation || !messageBayClip.isFullyClipped()) { 1359 image = MessageBay.getImage(messageBayClip, messageBayPaintArea.getSize()); 1360 } 1361 1362 if (image != null) { 1363 g.drawImage(image, messageBayPaintArea.getTopLeft(), messageBayPaintArea.getSize()); 1396 if (!isMailMode()) { 1397 // Paint message bay 1398 paintMessageBay(useInvalidation, clip, g); 1399 } else { 1400 // Paint mail bay 1401 paintMailBay(useInvalidation, clip, g); 1364 1402 } 1365 1403 } … … 1378 1416 return true; 1379 1417 } 1380 1418 1419 private static void paintMessageBay(boolean useInvalidation, Clip clip, GraphicsManager g) { 1420 Clip messageBayClip = null; 1421 1422 AxisAlignedBoxBounds messageBayPaintArea = getMessageBayPaintArea(); 1423 if (useInvalidation) { 1424 messageBayClip = clip.clone().intersectWith(messageBayPaintArea); 1425 if (!messageBayClip.isFullyClipped()) { 1426 messageBayClip = new Clip(messageBayClip.getBounds().translate(0, -messageBayPaintArea.getMinY())); 1427 } 1428 } 1429 1430 Image image = null; 1431 if (!useInvalidation || !messageBayClip.isFullyClipped()) { 1432 image = MessageBay.getImage(messageBayClip, messageBayPaintArea.getSize()); 1433 } 1434 1435 if (image != null) { 1436 g.drawImage(image, messageBayPaintArea.getTopLeft(), messageBayPaintArea.getSize()); 1437 } 1438 } 1439 1440 private static void paintMailBay(boolean useInvalidation, Clip clip, GraphicsManager g) { 1441 Clip mailBayClip = null; 1442 1443 AxisAlignedBoxBounds mailBayPaintArea = getMessageBayPaintArea(); 1444 if (useInvalidation) { 1445 mailBayClip = clip.clone().intersectWith(mailBayPaintArea); 1446 if (!mailBayClip.isFullyClipped()) { 1447 mailBayClip = new Clip(mailBayClip.getBounds().translate(0, -mailBayPaintArea.getMinY())); 1448 } 1449 } 1450 1451 Image image = null; 1452 if (!useInvalidation || !mailBayClip.isFullyClipped()) { 1453 image = MailBay.getImage(mailBayClip, mailBayPaintArea.getSize()); 1454 } 1455 1456 if (image != null) { 1457 g.drawImage(image, mailBayPaintArea.getTopLeft(), mailBayPaintArea.getSize()); 1458 } 1459 } 1460 1381 1461 /** Draws the two frame images to the display and puts the separator line between them. */ 1382 1462 private static void paintTwinFrames(Image leftFrameImage, Image rightFrameImage)
Note:
See TracChangeset
for help on using the changeset viewer.