Changeset 78:4ac9946b9fb5
- Timestamp:
- 05/24/08 02:33:56 (6 months ago)
- Files:
-
- dwtx/jface/fieldassist/FieldDecorationRegistry.d (modified) (6 diffs)
- dwtx/jface/resource/ColorRegistry.d (modified) (2 diffs)
- dwtx/jface/resource/JFaceResources.d (modified) (2 diffs)
- dwtx/ui/forms/FormColors.d (modified) (1 diff)
- dwtx/ui/forms/widgets/SharedScrolledComposite.d (modified) (2 diffs)
- dwtx/ui/internal/forms/MessageManager.d (modified) (1 diff)
- dwtx/ui/internal/forms/widgets/FormTextModel.d (modified) (12 diffs)
- dwtx/ui/internal/forms/widgets/FormUtil.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwtx/jface/fieldassist/FieldDecorationRegistry.d
r42 r78 106 106 * Declare images and decorations immediately. 107 107 */ 108 static this() {108 private static void static_this(FieldDecorationRegistry reg) { 109 109 ImageRegistry imageRegistry = JFaceResources.getImageRegistry(); 110 110 … … 129 129 // Define the standard decorations. Some do not have standard 130 130 // descriptions. Use null in these cases. 131 getDefault()131 reg 132 132 .registerFieldDecoration( 133 133 DEC_CONTENT_PROPOSAL, … … 136 136 IMG_DEC_FIELD_CONTENT_PROPOSAL, imageRegistry); 137 137 138 getDefault().registerFieldDecoration(138 reg.registerFieldDecoration( 139 139 DEC_ERROR, 140 140 JFaceResources … … 142 142 IMG_DEC_FIELD_ERROR, imageRegistry); 143 143 144 getDefault().registerFieldDecoration(144 reg.registerFieldDecoration( 145 145 DEC_ERROR_QUICKFIX, 146 146 JFaceResources … … 148 148 IMG_DEC_FIELD_ERROR_QUICKFIX, imageRegistry); 149 149 150 getDefault().registerFieldDecoration(DEC_WARNING, null,150 reg.registerFieldDecoration(DEC_WARNING, null, 151 151 IMG_DEC_FIELD_WARNING, imageRegistry); 152 152 153 getDefault().registerFieldDecoration(DEC_INFORMATION, null,153 reg.registerFieldDecoration(DEC_INFORMATION, null, 154 154 IMG_DEC_FIELD_INFO, imageRegistry); 155 155 156 getDefault()156 reg 157 157 .registerFieldDecoration( 158 158 DEC_REQUIRED, … … 233 233 public static FieldDecorationRegistry getDefault() { 234 234 if (defaultInstance is null) { 235 defaultInstance = new FieldDecorationRegistry(); 235 synchronized(FieldDecorationRegistry.classinfo){ 236 if (defaultInstance is null) { 237 defaultInstance = new FieldDecorationRegistry(); 238 static_this(defaultInstance); 239 } 240 } 236 241 } 237 242 return defaultInstance; dwtx/jface/resource/ColorRegistry.d
r72 r78 183 183 184 184 Assert.isNotNull(symbolicName); 185 auto result1 = stringToColor.get(symbolicName);185 auto result1 = ( stringToColor.containsKey(symbolicName) ? stringToColor.get(symbolicName) : null ); 186 186 if (result1 !is null) { 187 187 return result1; … … 190 190 Color color = null; 191 191 192 auto result = stringToRGB.get(symbolicName);192 auto result = ( stringToRGB.containsKey(symbolicName) ? stringToRGB.get(symbolicName) : null ); 193 193 if (result is null) { 194 194 return null; dwtx/jface/resource/JFaceResources.d
r72 r78 38 38 import dwt.dwthelper.ResourceBundle; 39 39 import tango.text.convert.Format; 40 import tango.util.log.Trace; 40 41 /** 41 42 * Utility methods to access JFace-specific resources. … … 228 229 reg = mgr; 229 230 toQuery_ = d; 231 Trace.formatln( " {} {}", d, reg ); 230 232 registries.add(d, reg); 231 233 } dwtx/ui/forms/FormColors.d
r75 r78 259 259 public Color createColor(String key, int r, int g, int b) { 260 260 Color c = new Color(display, r, g, b); 261 Color prevC = cast(Color) colorRegistry.get(key);261 Color prevC = cast(Color) (colorRegistry.containsKey(key) ? colorRegistry.get(key) : null ); 262 262 if (prevC !is null) 263 263 prevC.dispose(); dwtx/ui/forms/widgets/SharedScrolledComposite.d
r75 r78 231 231 } 232 232 233 private void handleScheduleReflow(bool flushCache) { 234 if (!isDisposed()) 235 reflow(flushCache); 236 reflowPending = false; 237 } 233 238 private void scheduleReflow(bool flushCache) { 234 239 if (delayedReflow) { … … 237 242 return; 238 243 } 239 getDisplay().asyncExec( dgRunnable( (bool flushCache) { 240 if (!isDisposed()) 241 reflow(flushCache); 242 reflowPending = false; 243 }, flushCache)); 244 getDisplay().asyncExec( dgRunnable( &handleScheduleReflow, flushCache)); 244 245 reflowPending = true; 245 246 } else dwtx/ui/internal/forms/MessageManager.d
r76 r78 101 101 } 102 102 103 private static String[] SINGLE_MESSAGE_SUMMARY_KEYS; 104 private static String[] MULTIPLE_MESSAGE_SUMMARY_KEYS; 105 106 static this(){ 107 SINGLE_MESSAGE_SUMMARY_KEYS = [ 108 Messages.MessageManager_sMessageSummary, 109 Messages.MessageManager_sMessageSummary, 110 Messages.MessageManager_sWarningSummary, 111 Messages.MessageManager_sErrorSummary ]; 112 113 MULTIPLE_MESSAGE_SUMMARY_KEYS = [ 114 Messages.MessageManager_pMessageSummary, 115 Messages.MessageManager_pMessageSummary, 116 Messages.MessageManager_pWarningSummary, 117 Messages.MessageManager_pErrorSummary ]; 103 private static String[] SINGLE_MESSAGE_SUMMARY_KEYS_; 104 private static String[] SINGLE_MESSAGE_SUMMARY_KEYS(){ 105 if( SINGLE_MESSAGE_SUMMARY_KEYS_ is null ){ 106 synchronized(MessageManager.classinfo){ 107 if( SINGLE_MESSAGE_SUMMARY_KEYS_ is null ){ 108 SINGLE_MESSAGE_SUMMARY_KEYS_ = [ 109 Messages.MessageManager_sMessageSummary, 110 Messages.MessageManager_sMessageSummary, 111 Messages.MessageManager_sWarningSummary, 112 Messages.MessageManager_sErrorSummary ]; 113 } 114 } 115 } 116 return SINGLE_MESSAGE_SUMMARY_KEYS_; 117 } 118 119 private static String[] MULTIPLE_MESSAGE_SUMMARY_KEYS_; 120 private static String[] MULTIPLE_MESSAGE_SUMMARY_KEYS(){ 121 if( MULTIPLE_MESSAGE_SUMMARY_KEYS_ is null ){ 122 synchronized(MessageManager.classinfo){ 123 if( MULTIPLE_MESSAGE_SUMMARY_KEYS_ is null ){ 124 MULTIPLE_MESSAGE_SUMMARY_KEYS_ = [ 125 Messages.MessageManager_pMessageSummary, 126 Messages.MessageManager_pMessageSummary, 127 Messages.MessageManager_pWarningSummary, 128 Messages.MessageManager_pErrorSummary ]; 129 } 130 } 131 } 132 return MULTIPLE_MESSAGE_SUMMARY_KEYS_; 118 133 } 119 134 dwtx/ui/internal/forms/widgets/FormTextModel.d
r75 r78 20 20 import dwtx.ui.internal.forms.widgets.ImageSegment; 21 21 import dwtx.ui.internal.forms.widgets.ObjectSegment; 22 import dwtx.ui.internal.forms.widgets.SWTUtil; 22 23 23 24 import dwt.DWT; … … 26 27 import dwt.dwthelper.utils; 27 28 import dwt.dwthelper.InputStream; 28 pragma(msg,"FIXME temp type "~__FILE__); 29 public class FormTextModel { 30 public static const String BOLD_FONT_ID = "f.____bold"; //$NON-NLS-1$ 31 public this() ; 32 public Paragraph[] getParagraphs() ; 33 public String getAccessibleText() ; 34 public void parseTaggedText(String taggedText, bool expandURLs) ; 35 public void parseInputStream(InputStream is_, bool expandURLs) ; 36 public void parseRegularText(String regularText, bool convertURLs) ; 37 public HyperlinkSettings getHyperlinkSettings() ; 38 public void setHyperlinkSettings(HyperlinkSettings settings) ; 39 IFocusSelectable[] getFocusSelectableSegments() ; 40 public IHyperlinkSegment getHyperlink(int index) ; 41 public IHyperlinkSegment findHyperlinkAt(int x, int y) ; 42 public int getHyperlinkCount() ; 43 public int indexOf(IHyperlinkSegment link) ; 44 public ParagraphSegment findSegmentAt(int x, int y) ; 45 public void clearCache(String fontId) ; 46 public IFocusSelectable getSelectedSegment() ; 47 public int getSelectedSegmentIndex() ; 48 public bool linkExists(IHyperlinkSegment link) ; 49 public bool traverseFocusSelectableObjects(bool next) ; 50 public IFocusSelectable getNextFocusSegment(bool next) ; 51 public bool restoreSavedLink() ; 52 public void selectLink(IHyperlinkSegment link) ; 53 public void select(IFocusSelectable selectable) ; 54 public bool hasFocusSegments() ; 55 public void dispose() ; 56 public bool isWhitespaceNormalized() ; 57 public void setWhitespaceNormalized(bool whitespaceNormalized) ; 58 } 59 60 /++ 29 61 30 static import tango.text.xml.Document; 62 31 import tango.util.collection.ArraySeq; … … 114 83 return sbuf.toString(); 115 84 } 116 85 public void parseTaggedText(String taggedText, bool expandURLs) { 86 implMissing(__FILE__,__LINE__); 87 } 88 public void parseInputStream(InputStream is_, bool expandURLs) { 89 implMissing(__FILE__,__LINE__); 90 } 91 /++ 117 92 /* 118 93 * @see ITextModel#parse(String) … … 367 342 } 368 343 } 369 344 ++/ 370 345 private void appendText(String value, StringBuffer buf, int[] spaceCounter) { 371 346 if (!whitespaceNormalized) 372 347 buf.append(value); 373 348 else { 374 for (int j = 0; j < value.length (); j++) {349 for (int j = 0; j < value.length; j++) { 375 350 char c = value.charAt(j); 376 351 if (c is ' ' || c is '\t') { … … 402 377 return buf.toString(); 403 378 } 404 379 /++ 405 380 private String getSingleNodeText(Node node) { 406 381 return getNormalizedText(node.getNodeValue()); … … 546 521 colorId); 547 522 } 548 523 ++/ 549 524 public void parseRegularText(String regularText, bool convertURLs) { 550 525 reset(); … … 559 534 int pstart = 0; 560 535 561 for (int i = 0; i < regularText.length (); i++) {536 for (int i = 0; i < regularText.length; i++) { 562 537 char c = regularText.charAt(i); 563 538 if (p is null) { … … 582 557 public HyperlinkSettings getHyperlinkSettings() { 583 558 // #132723 cannot have null settings 584 if (hyperlinkSettings isnull)559 if (hyperlinkSettings is null) 585 560 hyperlinkSettings = new HyperlinkSettings(SWTUtil.getStandardDisplay()); 586 561 return hyperlinkSettings; … … 609 584 for (int j = 0; j < segments.length; j++) { 610 585 if (null !is cast(IFocusSelectable)segments[j] ) 611 result ~= segments[j];586 result ~= cast(IFocusSelectable)segments[j]; 612 587 } 613 588 } … … 682 657 683 658 public bool linkExists(IHyperlinkSegment link) { 684 if (selectableSegments isnull)659 if (selectableSegments is null) 685 660 return false; 686 661 for (int i=0; i<selectableSegments.length; i++) { … … 744 719 return; 745 720 for (int i = 0; i < selectables.length; i++) { 746 if ( selectables[i].equals(selectable)) {721 if ((cast(Object)selectables[i]).opEquals(cast(Object)selectable)) { 747 722 selectedSegmentIndex = i; 748 723 break; … … 780 755 } 781 756 } 782 ++/dwtx/ui/internal/forms/widgets/FormUtil.d
r77 r78 48 48 49 49 public static const int DONE = 0; 50 50 char[] text; 51 static BreakIterator inst; 51 52 public static BreakIterator getWordInstance() { 52 // TODO Auto-generated method stub 53 return null; 54 } 53 if( inst is null ){ 54 inst = new BreakIterator; 55 } 56 return inst; 57 } 58 uint last = 0; 55 59 56 60 public void setText(String text) { 57 // TODO Auto-generated method stub 58 59 } 60 61 this.text = text; 62 last = 0; 63 } 61 64 public int first() { 62 65 // TODO Auto-generated method stub 63 return 0;66 return text.length > 0 ? 1 : 0; 64 67 } 65 68 66 69 public int next() { 67 70 // TODO Auto-generated method stub 68 return 0; 71 last++; 72 if( last >= text.length ){ 73 return DONE; 74 } 75 return last; 69 76 } 70 77 … … 431 438 FormUtil.scrollPage(scomp, false); 432 439 break; 440 default: 433 441 } 434 442 }
