Changeset 128
- Timestamp:
- 07/04/08 17:30:09 (16 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/DisplayIO.java
r121 r128 335 335 return; 336 336 337 // Remove any popups that are showing on the current frame 338 PopupManager.hideAllPopups(); 339 337 340 if (_TwinFrames) { 338 341 if (_CurrentFrames[0] == null) { -
trunk/src/org/expeditee/gui/FrameGraphics.java
r125 r128 2 2 3 3 import java.awt.Color; 4 import java.awt.Component;5 import java.awt.Container;6 4 import java.awt.Dimension; 7 5 import java.awt.EventQueue; … … 10 8 import java.awt.GraphicsEnvironment; 11 9 import java.awt.Image; 12 import java.awt.Point;13 10 import java.awt.Rectangle; 14 11 import java.awt.RenderingHints; … … 21 18 import java.util.LinkedList; 22 19 import java.util.List; 23 24 import javax.swing.JComponent;25 import javax.swing.JPopupMenu;26 import javax.swing.SwingUtilities;27 20 28 21 import org.expeditee.items.Circle; … … 429 422 PaintNonLinesNonPicture(bg, freeItemsToPaint); 430 423 431 // BROOK: Ensure popups are repainted432 if ( Browser._theBrowser != null)433 repaintPopups(Browser._theBrowser.getLayeredPane(), bg);424 // Repaint popups / drags... 425 if (isActualFrame) 426 PopupManager.paintLayeredPane(bg, clip); 434 427 435 428 bg.dispose(); 436 429 } 437 430 431 432 438 433 return toPaint.getBuffer(); 439 434 } … … 698 693 } 699 694 700 private static void repaintPopups(Container parent, Graphics g) { 701 for (Component c : parent.getComponents()) { 702 if (c instanceof JPopupMenu && ((JPopupMenu) c).isVisible()) { 703 Point p = SwingUtilities.convertPoint(c, c.getLocation(), 704 Browser._theBrowser.getContentPane()); 705 706 c.setIgnoreRepaint(true); 707 ((JComponent)c).setDoubleBuffered(false); 708 g.translate(p.x, p.y); 709 c.paint(g); 710 g.translate(-p.x, -p.y); 711 } else if (c instanceof Container 712 && c != Browser._theBrowser.getContentPane()) { 713 repaintPopups((Container) c, g); 714 } 715 } 716 } 717 695 718 696 public static int getMode() { 719 697 return _Mode; … … 805 783 damagedAreas.clear(); 806 784 } 807 //System.out.println("FULLSCREEN REFRESH"); // TODO: REMOVE785 System.out.println("FULLSCREEN REFRESH"); // TODO: REMOVE 808 786 } 809 787 -
trunk/src/org/expeditee/gui/FrameMouseActions.java
r121 r128 228 228 // System.out.println("MousePressed " + e.getX() + "," + e.getY() + " " 229 229 // + e.getWhen()); 230 231 // Auto-hide popups when user clicks into expeditee world 232 PopupManager.hideAllPopups(); 230 233 231 234 // TODO WHY DID I NOT COMMENT THIS LINE!! MIKE SAYS … … 2674 2677 return Math.round(MouseY); 2675 2678 } 2679 2680 public static Item getlastHighlightedItem() { 2681 return _lastHighlightedItem; 2682 } 2676 2683 } -
trunk/src/org/expeditee/gui/MouseEventRouter.java
r74 r128 15 15 import javax.swing.SwingUtilities; 16 16 17 import org.expeditee.items.I nteractiveWidget;17 import org.expeditee.items.Item; 18 18 19 19 /** … … 65 65 */ 66 66 private void routeMouseEvent(MouseEvent e) { 67 67 68 68 // First convert the point to expeditee space 69 69 Point containerPoint = SwingUtilities.convertPoint(e.getComponent(), e … … 88 88 // whether an expeditee item is currently picked up 89 89 boolean forwardToExpiditee = false; 90 boolean isOverPopup = PopupManager.isPointOverPopup(containerPoint); 91 if (isOverPopup && FreeItems.getInstance().isEmpty()) { 92 // Popups have highest preference 93 // forwardToExpiditee = false... 90 94 91 95 // Note: all frame.content pane events belong to expeditee 92 if (e.getSource() == _contentPane96 } else if (e.getSource() == _contentPane 93 97 || e.getSource() == Browser._theBrowser 94 || Frame.itemAttachedToCursor()) {98 || !FreeItems.getInstance().isEmpty()) { 95 99 forwardToExpiditee = true; 96 100 } else if (DisplayIO.getCurrentFrame() != null) { // is mouse over … … 113 117 if (forwardToExpiditee) { 114 118 115 // If forwarding to Expiditee ensure that widgets highlighting116 // is enabled117 // do give visual feedback yo users such that Expiditee has118 // focus.119 InteractiveWidget.enableExepiteeHighlighting(true);120 121 119 // Ensure that underlying widgets don't get the event 122 120 e.consume(); … … 175 173 // highlighted 176 174 // to give visual feedback yo users such that swing has focus. 177 InteractiveWidget.enableExepiteeHighlighting(false); 175 Item i = FrameMouseActions.getlastHighlightedItem(); 176 if (i != null && i.getHighlightMode() != Item.HighlightMode.None) { 177 FrameGraphics.changeHighlightMode(i, Item.HighlightMode.None); 178 } 178 179 179 180 // Also bring expideditee behaviour to swing: Auto-focus on … … 187 188 } 188 189 } 190 // Auto-hide popups when user click on something other other than 191 // a popup - and is not a on a popup invoker 192 } else if (!isOverPopup && e.getID() == MouseEvent.MOUSE_PRESSED && 193 !PopupManager.isInvoker(e.getComponent())) { 194 PopupManager.hideAllPopups(); 189 195 } 190 196 } -
trunk/src/org/expeditee/items/InteractiveWidget.java
r127 r128 957 957 } 958 958 959 private static boolean _isExepiteeHighlightingEnabled = true;960 961 /**962 * Enables/Disables highlighting of all widgets - if the enable value has963 * changed the current frame will repaint.964 *965 * The purpose of this is so that widgets can have an extra context: no966 * expeditee highlighting if focus is on a swing componant.967 *968 * @param enable969 * Set to true to enable painting, false to disable painting.970 */971 public static void enableExepiteeHighlighting(boolean enable) {972 if (_isExepiteeHighlightingEnabled != enable) {973 _isExepiteeHighlightingEnabled = enable;974 FrameGraphics.Repaint();975 }976 }977 978 public static boolean isExpediteeHighlightingEnabled() {979 return _isExepiteeHighlightingEnabled;980 }981 982 959 /** 983 960 * Removes this widget from the parent frame or free space … … 1009 986 } 1010 987 1011 1012 988 } -
trunk/src/org/expeditee/items/WidgetCorner.java
r121 r128 10 10 11 11 private InteractiveWidget _widgetSource; 12 public static final float BORDER_THICKNESS = 2.0f; 12 13 13 14 WidgetCorner(int x, int y, int id, InteractiveWidget widgetSource) { 14 15 super(x, y, id); 15 16 16 super.setThickness( 2.0f);17 super.setThickness(BORDER_THICKNESS); 17 18 18 19 if (widgetSource == null) throw new NullPointerException("widgetSource"); … … 65 66 @Override 66 67 public void paint(Graphics2D g) { 67 if (InteractiveWidget.isExpediteeHighlightingEnabled()) { // only paint if flag is set to true 68 69 // For fixed widgets, always have corner selected with connected context 70 HighlightMode tmp = _mode; // save mode 71 if (_mode == HighlightMode.Normal && _widgetSource.isFixedSize()) { 72 _mode = HighlightMode.Connected; // draw as connected context for fixed widgets 73 } 74 super.paint(g); 75 _mode = tmp; // restore mode 68 // For fixed widgets, always have corner selected with connected context 69 HighlightMode tmp = _mode; // save mode 70 if (_mode == HighlightMode.Normal && _widgetSource.isFixedSize()) { 71 _mode = HighlightMode.Connected; // draw as connected context for fixed widgets 76 72 } 73 super.paint(g); 74 _mode = tmp; // restore mode 77 75 } 78 76
Note:
See TracChangeset
for help on using the changeset viewer.