Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-03-14 21:08:44 +0000
committerslewis2008-03-14 21:08:44 +0000
commite59e1e920d5c035875e2e832cf91568346ebe6cc (patch)
treecf35b3bc99b4b3dd41e1d2d0094bab9701d5128e
parent1b9b6bfe8652606c21c3667eda254c5d17cd6af8 (diff)
downloadorg.eclipse.ecf-e59e1e920d5c035875e2e832cf91568346ebe6cc.tar.gz
org.eclipse.ecf-e59e1e920d5c035875e2e832cf91568346ebe6cc.tar.xz
org.eclipse.ecf-e59e1e920d5c035875e2e832cf91568346ebe6cc.zip
Fix for screen capture dialog image capture, sizing issues, and handling multiple simultaneous senders
-rw-r--r--framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ScreenCaptureConfirmationDialog.java24
-rw-r--r--framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ScreenCaptureJob.java8
-rw-r--r--framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ShowImageShell.java25
3 files changed, 26 insertions, 31 deletions
diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ScreenCaptureConfirmationDialog.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ScreenCaptureConfirmationDialog.java
index 49efcb06c..105c33585 100644
--- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ScreenCaptureConfirmationDialog.java
+++ b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ScreenCaptureConfirmationDialog.java
@@ -20,9 +20,8 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
public class ScreenCaptureConfirmationDialog extends Dialog {
@@ -62,30 +61,15 @@ public class ScreenCaptureConfirmationDialog extends Dialog {
}
protected Control createDialogArea(Composite parent) {
- parent = (Composite) super.createDialogArea(parent);
final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setLayout(new FillLayout());
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(width, height));
composite.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.drawImage(image, 0, 0);
}
});
- return parent;
- }
-
- protected Point getInitialSize() {
- final Point point = super.getInitialSize();
- if (point.x < width) {
- if (point.y < height) {
- return new Point(width, height);
- }
- return new Point(width, point.y);
- }
- if (point.y < height) {
- return new Point(point.x, height);
- }
- return new Point(point.x, point.y);
+ return composite;
}
public boolean close() {
diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ScreenCaptureJob.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ScreenCaptureJob.java
index 6c800dc4b..4892dc4d9 100644
--- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ScreenCaptureJob.java
+++ b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ScreenCaptureJob.java
@@ -52,20 +52,20 @@ public class ScreenCaptureJob extends UIJob {
public IStatus runInUIThread(IProgressMonitor monitor) {
final Display display = getDisplay();
final GC context = new GC(display);
- final Image image = new Image(display, display.getBounds());
- context.copyArea(image, 0, 0);
+ final Rectangle displayBounds = display.getBounds();
+ final Image image = new Image(display, displayBounds);
+ context.copyArea(image, displayBounds.x, displayBounds.y);
context.dispose();
final Shell shell = new Shell(display, SWT.NO_TRIM);
shell.setLayout(new FillLayout());
- shell.setBounds(display.getBounds());
+ shell.setBounds(displayBounds);
final GC gc = new GC(shell);
shell.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
gc.drawImage(image, 0, 0);
}
});
-
shell.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
if (e.character == SWT.ESC)
diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ShowImageShell.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ShowImageShell.java
index 086617fa1..39e566022 100644
--- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ShowImageShell.java
+++ b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/screencapture/ShowImageShell.java
@@ -17,6 +17,7 @@ import java.util.*;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -30,12 +31,9 @@ public class ShowImageShell {
ImageWrapper imageWrapper;
List imageData;
- public ShowImageShell(Display display, ID senderID, ImageWrapper imageWrapper, final DisposeListener disposeListener) {
+ public ShowImageShell(Display display, ID senderID, final DisposeListener disposeListener) {
this.shell = new Shell(display);
this.senderID = senderID;
- this.imageWrapper = imageWrapper;
- this.shell.setBounds(0, 0, imageWrapper.width, imageWrapper.height);
- this.imageData = new ArrayList();
this.shell.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
disposeListener.widgetDisposed(e);
@@ -46,12 +44,25 @@ public class ShowImageShell {
});
}
- public void setText(String text) {
- shell.setText(text);
+ public void initialize(String text, ImageWrapper iw) {
+ if (shell != null) {
+ shell.setText(text);
+ this.imageWrapper = iw;
+ Rectangle shellBounds = shell.getBounds();
+ this.shell.setBounds(shell.computeTrim(shellBounds.x, shellBounds.y, imageWrapper.width, imageWrapper.height));
+ this.imageData = new ArrayList();
+ }
}
public void open() {
- shell.open();
+ if (shell != null)
+ shell.open();
+ }
+
+ public Display getDisplay() {
+ if (shell == null)
+ return null;
+ return shell.getDisplay();
}
public void close() {

Back to the top