Changeset 125
- Timestamp:
- 07/03/08 19:05:00 (16 years ago)
- Location:
- trunk/src/org/expeditee/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameGraphics.java
r124 r125 789 789 for (Rectangle r : damagedAreas) { 790 790 if (clip == null) clip = new Area(r); 791 clip.add(new Area(r));791 else clip.add(new Area(r)); 792 792 } 793 793 damagedAreas.clear(); 794 } else return; // nothing to render 794 795 } else if (MessageBay.isDirty()) { 796 // Paint dirty message bay 797 Graphics dg = _DisplayGraphics.create(); 798 MessageBay.refresh(true, dg, Item.DEFAULT_BACKGROUND); 799 return; 800 } 795 801 } 796 802 … … 813 819 // Paint message bay 814 820 MessageBay.refresh(useInvalidation, dg, Item.DEFAULT_BACKGROUND); 815 821 816 822 dg.dispose(); 817 823 } -
trunk/src/org/expeditee/gui/MessageBay.java
r122 r125 78 78 _messageLink.setOffset(0, -FrameGraphics.getMaxFrameSize().height); 79 79 _messageLink.setMaxSize(FrameGraphics.getMaxFrameSize()); 80 _messageLink.setPosition(FrameGraphics.getMaxFrameSize().width - MESSAGE_LINK_Y_OFFSET,81 MESSAGE_LINK_X);82 80 81 updateLink(); 82 initBuffer(); 83 83 } 84 84 … … 113 113 return _messages; 114 114 } 115 116 public static boolean isDirty() { 117 return !_dirtyAreas.isEmpty(); 118 } 119 120 public static void invalidateFullBay() { 121 _dirtyAreas.clear(); 122 addDirtyArea(new Rectangle(0, FrameGraphics.getMaxFrameSize().height, 123 _messageBuffer.getWidth(), _messageBuffer.getHeight())); 124 } 125 126 private static void initBuffer() { 127 if (_messageBuffer == null) { 128 GraphicsEnvironment ge = GraphicsEnvironment 129 .getLocalGraphicsEnvironment(); 130 _messageBuffer = ge.getDefaultScreenDevice() 131 .getDefaultConfiguration().createCompatibleVolatileImage( 132 FrameGraphics.getMaxFrameSize().width, 133 (FrameGraphics.isAudienceMode() ? 0 : MESSAGE_BUFFER_HEIGHT)); 134 } 135 } 136 137 138 private static boolean isLinkInitialized = false; 139 140 private static void updateLink() { 141 142 if (!isLinkInitialized && FrameGraphics.getMaxFrameSize().width > 0) { 143 // set up 'Messages' link on the right hand side 144 _messageLink.setPosition(FrameGraphics.getMaxFrameSize().width - MESSAGE_LINK_Y_OFFSET, 145 MESSAGE_LINK_X); 146 _messageLink.setOffset(0, -FrameGraphics.getMaxFrameSize().height); 147 isLinkInitialized = true; 148 149 150 } else { 151 _messageLink.setPosition(FrameGraphics.getMaxFrameSize().width - MESSAGE_LINK_Y_OFFSET, 152 MESSAGE_LINK_X); 153 } 154 } 155 156 115 157 116 158 /** … … 129 171 Graphics g, Color background) { 130 172 173 if (FrameGraphics.getMaxFrameSize().width <= 0) return; 174 131 175 Area clip = null; 176 132 177 if (useInvalidation) { // build clip 133 134 178 135 179 if (!_dirtyAreas.isEmpty()) { 136 180 137 181 for (Rectangle r : _dirtyAreas) { 182 r.y = (r.y < 0) ? 0 : r.y; 183 r.x = (r.x < 0) ? 0 : r.x; 138 184 if (clip == null) clip = new Area(r); 139 clip.add(new Area(r));185 else clip.add(new Area(r)); 140 186 } 141 187 142 188 } else return; // nothing to render 143 144 189 145 190 } 146 191 … … 152 197 // Now repaint to screen 153 198 if (!FrameGraphics.isAudienceMode()) { 154 g.setClip(clip); 199 200 // Translate clip to messagebox coords 201 //clip.transform(t) // TODO 202 //g.setClip(clip); 203 155 204 g.drawImage(_messageBuffer, 0, FrameGraphics.getMaxFrameSize().height, null); 156 205 } … … 159 208 160 209 private static void updateBuffer(Color background, Area clip) { 161 162 if (_messageBuffer == null) { 163 GraphicsEnvironment ge = GraphicsEnvironment 164 .getLocalGraphicsEnvironment(); 165 _messageBuffer = ge.getDefaultScreenDevice() 166 .getDefaultConfiguration().createCompatibleVolatileImage( 167 FrameGraphics.getMaxFrameSize().width, 168 (FrameGraphics.isAudienceMode() ? 0 : MESSAGE_BUFFER_HEIGHT)); 169 } 170 210 211 initBuffer(); 212 171 213 Graphics2D g = _messageBuffer.createGraphics(); 172 214 173 215 g.setClip(clip); 174 216 175 217 g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, 176 218 RenderingHints.VALUE_TEXT_ANTIALIAS_ON); … … 187 229 } 188 230 189 if (_messageLink.getLink() != null && 190 (clip == null || _messageLink.isInDrawingArea(clip))) 231 if (//_messageLink.getLink() != null 232 //&& 233 (clip == null || _messageLink.isInDrawingArea(clip))) { 191 234 FrameGraphics.PaintItem(g, _messageLink); 235 } 192 236 193 237 g.dispose(); … … 205 249 System.out.println(message); 206 250 assert (message != null); 207 251 252 // Invalidate whole area 253 invalidateFullBay(); 254 208 255 if (_supressMessages) 209 256 return; … … 217 264 if (_creator == null) { 218 265 _creator = new FrameCreator(MESSAGES_FRAMESET_NAME, true); 219 220 // set up 'Messages' link on the right hand side 221 _messageLink.setPosition(FrameGraphics.getMaxFrameSize().width - MESSAGE_LINK_Y_OFFSET, 222 MESSAGE_LINK_X); 223 _messageLink.setOffset(0, -FrameGraphics.getMaxFrameSize().height); 224 } 266 } 267 268 // set up 'Messages' link on the right hand side 269 updateLink(); 225 270 226 271 // if the message slots have not all been used yet
Note:
See TracChangeset
for help on using the changeset viewer.