Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 59913 Details for
Bug 19602
[Printing] Line numbers aren't printed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
patch line labels
patch.txt (text/plain), 3.17 KB, created by
Felipe Heidrich
on 2007-02-27 14:03:00 EST
(
hide
)
Description:
patch line labels
Filename:
MIME Type:
Creator:
Felipe Heidrich
Created:
2007-02-27 14:03:00 EST
Size:
3.17 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java,v >retrieving revision 1.350 >diff -u -r1.350 StyledText.java >--- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java 14 Feb 2007 00:14:43 -0000 1.350 >+++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java 27 Feb 2007 18:53:59 -0000 >@@ -445,11 +445,24 @@ > printLayout.setFont(printerFont); > } > if (printOptions.printLineNumbers) { >+ int numberingWidth = 0; > int count = endLine - startLine + 1; >- StringBuffer buffer = new StringBuffer("0"); >- while ((count /= 10) > 0) buffer.append("0"); >- printLayout.setText(buffer.toString()); >- int numberingWidth = printLayout.getBounds().width + printMargin; >+ String[] lineLabels = printOptions.lineLabels; >+ if (lineLabels != null) { >+ for (int i = startLine; i < Math.min(count, lineLabels.length); i++) { >+ if (lineLabels[i] != null) { >+ printLayout.setText(lineLabels[i]); >+ int lineWidth = printLayout.getBounds().width; >+ numberingWidth = Math.max(numberingWidth, lineWidth); >+ } >+ } >+ } else { >+ StringBuffer buffer = new StringBuffer("0"); >+ while ((count /= 10) > 0) buffer.append("0"); >+ printLayout.setText(buffer.toString()); >+ numberingWidth = printLayout.getBounds().width; >+ } >+ numberingWidth += printMargin; > if (numberingWidth > width) numberingWidth = width; > paintX += numberingWidth; > width -= numberingWidth; >@@ -595,7 +608,16 @@ > FontMetrics metrics = layout.getLineMetrics(0); > printLayout.setAscent(metrics.getAscent() + metrics.getDescent()); > printLayout.setDescent(metrics.getDescent()); >- printLayout.setText(String.valueOf(index)); >+ String[] lineLabels = printOptions.lineLabels; >+ if (lineLabels != null) { >+ if (0 <= index && index < lineLabels.length && lineLabels[index] != null) { >+ printLayout.setText(lineLabels[index]); >+ } else { >+ printLayout.setText(""); >+ } >+ } else { >+ printLayout.setText(String.valueOf(index)); >+ } > int paintX = x - printMargin - printLayout.getBounds().width; > printLayout.draw(gc, paintX, y); > printLayout.setAscent(-1); >Index: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextPrintOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextPrintOptions.java,v >retrieving revision 1.9 >diff -u -r1.9 StyledTextPrintOptions.java >--- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextPrintOptions.java 20 Jul 2006 19:43:40 -0000 1.9 >+++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextPrintOptions.java 27 Feb 2007 18:53:59 -0000 >@@ -91,5 +91,11 @@ > */ > public boolean printLineNumbers = false; > >+ /** >+ * Line labels. >+ * >+ * @since 3.3 >+ */ >+ public String[] lineLabels = null; > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 19602
:
26998
|
34574
|
34575
|
34576
|
34577
| 59913 |
80953