summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2003-08-12 18:29:29 +0000
committerSilenio Quarti <silenio>2003-08-12 18:29:29 +0000
commitf3b7fba4d5b00aff73e93946515c0a614041198a (patch)
tree46c6d24b6ea6f9f70d7ba362a8cb56714aa51783
parent63d6f189c5fce0a63def15c1edf14e84d34f6f55 (diff)
downloadeclipse.platform.swt-f3b7fba4d5b00aff73e93946515c0a614041198a.tar.gz
eclipse.platform.swt-f3b7fba4d5b00aff73e93946515c0a614041198a.tar.xz
eclipse.platform.swt-f3b7fba4d5b00aff73e93946515c0a614041198a.zip
fixing line style
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java28
2 files changed, 12 insertions, 17 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
index 7e5128e48f..b7c6b4c12b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
@@ -107,7 +107,6 @@ public class OS {
public static final int LSBFirst = 0;
public static final int LeaveNotify = 8;
public static final int LeaveWindowMask = 1 << 5;
- public static final int LineDoubleDash = 0x2;
public static final int LineOnOffDash = 0x1;
public static final int LineSolid = 0x0;
public static final int MSBFirst = 1;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
index c768ab4dbc..aeb023903b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
@@ -2473,31 +2473,30 @@ public void setForeground (Color color) {
public void setLineStyle(int lineStyle) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
int xDisplay = data.display;
- XGCValues values = new XGCValues ();
- OS.XGetGCValues (xDisplay, handle, OS.GCLineWidth, values);
+ int line_style = OS.LineOnOffDash;
switch (lineStyle) {
case SWT.LINE_SOLID:
- data.lineStyle = lineStyle;
- OS.XSetLineAttributes(xDisplay, handle, values.line_width, OS.LineSolid, OS.CapButt, OS.JoinMiter);
- return;
+ line_style = OS.LineSolid;
+ break;
case SWT.LINE_DASH:
- OS.XSetDashes(xDisplay,handle,0, new byte[] {6, 2},2);
+ OS.XSetDashes(xDisplay, handle, 0, new byte[]{6, 2}, 2);
break;
case SWT.LINE_DOT:
- OS.XSetDashes(xDisplay,handle,0, new byte[] {3, 1},2);
+ OS.XSetDashes(xDisplay, handle, 0, new byte[]{3, 1}, 2);
break;
case SWT.LINE_DASHDOT:
- OS.XSetDashes(xDisplay,handle,0, new byte[] {6, 2, 3, 1},4);
+ OS.XSetDashes(xDisplay, handle, 0, new byte[]{6, 2, 3, 1}, 4);
break;
case SWT.LINE_DASHDOTDOT:
- OS.XSetDashes(xDisplay,handle,0, new byte[] {6, 2, 3, 1, 3, 1},6);
+ OS.XSetDashes(xDisplay, handle, 0, new byte[]{6, 2, 3, 1, 3, 1}, 6);
break;
default:
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
data.lineStyle = lineStyle;
- OS.XSetLineAttributes(xDisplay, handle, values.line_width, OS.LineOnOffDash, OS.CapButt, OS.JoinMiter);
-
+ XGCValues values = new XGCValues();
+ OS.XGetGCValues(xDisplay, handle, OS.GCLineWidth, values);
+ OS.XSetLineAttributes(xDisplay, handle, values.line_width, line_style, OS.CapButt, OS.JoinMiter);
}
/**
* Sets the width that will be used when drawing lines
@@ -2513,11 +2512,8 @@ public void setLineStyle(int lineStyle) {
*/
public void setLineWidth(int width) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (data.lineStyle == SWT.LINE_SOLID) {
- OS.XSetLineAttributes(data.display, handle, width, OS.LineSolid, OS.CapButt, OS.JoinMiter);
- } else {
- OS.XSetLineAttributes(data.display, handle, width, OS.LineDoubleDash, OS.CapButt, OS.JoinMiter);
- }
+ int line_style = data.lineStyle == SWT.LINE_SOLID ? OS.LineSolid : OS.LineOnOffDash;
+ OS.XSetLineAttributes(data.display, handle, width, line_style, OS.CapButt, OS.JoinMiter);
}
/**
* If the argument is <code>true</code>, puts the receiver