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 56153 Details for
Bug 165169
Scrollbar issues on image attachment preview
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]
Another patch
clipboard33555.txt (text/plain), 4.60 KB, created by
Willian Mitsuda
on 2006-12-24 21:16:25 EST
(
hide
)
Description:
Another patch
Filename:
MIME Type:
Creator:
Willian Mitsuda
Created:
2006-12-24 21:16:25 EST
Size:
4.60 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.tasks.ui >Index: src/org/eclipse/mylar/internal/tasks/ui/wizards/PreviewAttachmentPage.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/src/org/eclipse/mylar/internal/tasks/ui/wizards/PreviewAttachmentPage.java,v >retrieving revision 1.4 >diff -u -r1.4 PreviewAttachmentPage.java >--- src/org/eclipse/mylar/internal/tasks/ui/wizards/PreviewAttachmentPage.java 2 Dec 2006 14:06:15 -0000 1.4 >+++ src/org/eclipse/mylar/internal/tasks/ui/wizards/PreviewAttachmentPage.java 25 Dec 2006 02:12:05 -0000 >@@ -27,6 +27,7 @@ > import org.eclipse.swt.events.DisposeListener; > import org.eclipse.swt.events.PaintEvent; > import org.eclipse.swt.events.PaintListener; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.layout.GridData; >@@ -54,6 +55,8 @@ > > private static HashMap<String, String> imageTypes; > >+ private ScrolledComposite scrolledComposite; >+ > static { > textTypes = new HashMap<String, String>(); > imageTypes = new HashMap<String, String>(); >@@ -129,30 +132,39 @@ > } > > private void createImagePreview(Composite composite, LocalAttachment attachment) { >- final Image image = new Image(composite.getDisplay(), attachment.getFilePath()); >- final ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL >- | SWT.BORDER); >+ // Uses double buffering to paint the image; there was a weird behavior >+ // with transparent images and flicker with large images >+ Image originalImage = new Image(composite.getDisplay(), attachment.getFilePath()); >+ final Image bufferedImage = new Image(composite.getDisplay(), originalImage.getBounds()); >+ GC gc = new GC(bufferedImage); >+ gc.setBackground(composite.getBackground()); >+ gc.fillRectangle(originalImage.getBounds()); >+ gc.drawImage(originalImage, 0, 0); >+ gc.dispose(); >+ originalImage.dispose(); >+ >+ scrolledComposite = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); > scrolledComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); > scrolledComposite.setExpandHorizontal(true); > scrolledComposite.setExpandVertical(true); > > Composite canvasComposite = new Composite(scrolledComposite, SWT.NONE); > canvasComposite.setLayout(GridLayoutFactory.fillDefaults().create()); >- Canvas canvas = new Canvas(canvasComposite, SWT.NONE); >- final Rectangle imgSize = image.getBounds(); >+ Canvas canvas = new Canvas(canvasComposite, SWT.NO_BACKGROUND); >+ final Rectangle imgSize = bufferedImage.getBounds(); > canvas.setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, true).hint( > imgSize.width, imgSize.height).create()); > canvas.addPaintListener(new PaintListener() { > > public void paintControl(PaintEvent e) { >- e.gc.drawImage(image, 0, 0); >+ e.gc.drawImage(bufferedImage, 0, 0); > } > > }); > canvas.addDisposeListener(new DisposeListener() { > > public void widgetDisposed(DisposeEvent e) { >- image.dispose(); >+ bufferedImage.dispose(); > } > > }); >@@ -163,22 +175,27 @@ > > @Override > public void controlResized(ControlEvent e) { >- Rectangle clientArea = scrolledComposite.getClientArea(); >- >- ScrollBar hBar = scrolledComposite.getHorizontalBar(); >- hBar.setMinimum(1); >- hBar.setMaximum(clientArea.width - imgSize.width); >- hBar.setPageIncrement(hBar.getThumb()); >- hBar.setIncrement(10); >- >- ScrollBar vBar = scrolledComposite.getVerticalBar(); >- vBar.setMinimum(0); >- vBar.setMaximum(clientArea.height - imgSize.height); >- vBar.setPageIncrement(vBar.getThumb()); >- vBar.setIncrement(10); >+ adjustScrollbars(imgSize); > } > > }); >+ adjustScrollbars(imgSize); >+ } >+ >+ private void adjustScrollbars(Rectangle imgSize) { >+ Rectangle clientArea = scrolledComposite.getClientArea(); >+ >+ ScrollBar hBar = scrolledComposite.getHorizontalBar(); >+ hBar.setMinimum(0); >+ hBar.setMaximum(imgSize.width - 1); >+ hBar.setPageIncrement(clientArea.width); >+ hBar.setIncrement(10); >+ >+ ScrollBar vBar = scrolledComposite.getVerticalBar(); >+ vBar.setMinimum(0); >+ vBar.setMaximum(imgSize.height - 1); >+ vBar.setPageIncrement(clientArea.height); >+ vBar.setIncrement(10); > } > > private void createGenericPreview(Composite composite, LocalAttachment attachment) { >@@ -193,4 +210,5 @@ > label.setLayoutData(new GridData(GridData.FILL_BOTH)); > label.setText(message); > } >+ > }
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 165169
:
54517
|
54518
|
54758
|
54759
| 56153 |
56154