Mercurial > projects > dwt-mac
diff dwt/widgets/Tracker.d @ 123:63a09873578e
Fixed compile errors
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Thu, 15 Jan 2009 23:08:54 +0100 |
parents | c7f7f4d7091a |
children |
line wrap: on
line diff
--- a/dwt/widgets/Tracker.d Wed Dec 31 21:01:13 2008 +0100 +++ b/dwt/widgets/Tracker.d Thu Jan 15 23:08:54 2009 +0100 @@ -15,7 +15,7 @@ import dwt.dwthelper.utils; - + import dwt.DWT; import dwt.DWTException; import dwt.events.ControlListener; @@ -79,10 +79,10 @@ bool inEvent = false; NSWindow window; int oldX, oldY; - + /* - * The following values mirror step sizes on Windows - */ + * The following values mirror step sizes on Windows + */ const static int STEPSIZE_SMALL = 1; const static int STEPSIZE_LARGE = 9; @@ -246,7 +246,7 @@ Point adjustResizeCursor (bool movePointer) { if (bounds is null) return null; int newX, newY; - + if ((cursorOrientation & DWT.LEFT) !is 0) { newX = bounds.x; } else if ((cursorOrientation & DWT.RIGHT) !is 0) { @@ -254,7 +254,7 @@ } else { newX = bounds.x + bounds.width / 2; } - + if ((cursorOrientation & DWT.UP) !is 0) { newY = bounds.y; } else if ((cursorOrientation & DWT.DOWN) !is 0) { @@ -262,7 +262,7 @@ } else { newY = bounds.y + bounds.height / 2; } - + /* * Convert to screen coordinates if needed */ @@ -274,11 +274,11 @@ if (movePointer) { display.setCursorLocation(newX, newY); } - + /* - * If the client has not provided a custom cursor then determine - * the appropriate resize cursor. - */ + * If the client has not provided a custom cursor then determine + * the appropriate resize cursor. + */ if (clientCursor is null) { Cursor newCursor = null; switch (cursorOrientation) { @@ -316,7 +316,7 @@ } resizeCursor = newCursor; } - + return new Point (newX, newY); } @@ -482,11 +482,11 @@ sendEvent (DWT.Resize, event); inEvent = false; /* - * It is possible (but unlikely), that application - * code could have disposed the widget in the move - * event. If this happens, return false to indicate - * that the tracking has failed. - */ + * It is possible (but unlikely), that application + * code could have disposed the widget in the move + * event. If this happens, return false to indicate + * that the tracking has failed. + */ if (isDisposed ()) { cancelled = true; return; @@ -529,11 +529,11 @@ sendEvent (DWT.Move, event); inEvent = false; /* - * It is possible (but unlikely), that application - * code could have disposed the widget in the move - * event. If this happens, return false to indicate - * that the tracking has failed. - */ + * It is possible (but unlikely), that application + * code could have disposed the widget in the move + * event. If this happens, return false to indicate + * that the tracking has failed. + */ if (isDisposed ()) { cancelled = true; return; @@ -578,7 +578,7 @@ void key (NSEvent nsEvent) { //TODO send event -// if (!sendKeyEvent (DWT.KeyDown, theEvent)) return OS.noErr; + // if (!sendKeyEvent (DWT.KeyDown, theEvent)) return OS.noErr; NSUInteger modifierFlags = nsEvent.modifierFlags(); int stepSize = (modifierFlags & OS.NSControlKeyMask) !is 0 ? STEPSIZE_SMALL : STEPSIZE_LARGE; int xChange = 0, yChange = 0; @@ -624,11 +624,11 @@ sendEvent (DWT.Resize, event); inEvent = false; /* - * It is possible (but unlikely) that application - * code could have disposed the widget in the move - * event. If this happens return false to indicate - * that the tracking has failed. - */ + * It is possible (but unlikely) that application + * code could have disposed the widget in the move + * event. If this happens return false to indicate + * that the tracking has failed. + */ if (isDisposed ()) { cancelled = true; return; @@ -666,11 +666,11 @@ sendEvent (DWT.Move, event); inEvent = false; /* - * It is possible (but unlikely) that application - * code could have disposed the widget in the move - * event. If this happens return false to indicate - * that the tracking has failed. - */ + * It is possible (but unlikely) that application + * code could have disposed the widget in the move + * event. If this happens return false to indicate + * that the tracking has failed. + */ if (isDisposed ()) { cancelled = true; return; @@ -773,13 +773,13 @@ frame.x = frame.y = 0; NSBezierPath.fillRect(frame); window.orderFrontRegardless(); - + drawRectangles (window, rectangles, false); /* - * If exactly one of UP/DOWN is specified as a style then set the cursor - * orientation accordingly (the same is done for LEFT/RIGHT styles below). - */ + * If exactly one of UP/DOWN is specified as a style then set the cursor + * orientation accordingly (the same is done for LEFT/RIGHT styles below). + */ int vStyle = style & (DWT.UP | DWT.DOWN); if (vStyle is DWT.UP || vStyle is DWT.DOWN) { cursorOrientation |= vStyle; @@ -813,7 +813,7 @@ oldX = cursorPos.x; oldY = cursorPos.y; } - + /* Tracker behaves like a Dialog with its own OS event loop. */ while (tracking && !cancelled) { NSAutoreleasePool pool = cast(NSAutoreleasePool)(new NSAutoreleasePool()).alloc().init(); @@ -831,16 +831,16 @@ mouse(event); break; case OS.NSKeyDown: -// case OS.NSKeyUp: + // case OS.NSKeyUp: case OS.NSFlagsChanged: key(event); break; default: } /* - * Don't dispatch mouse and key events in general, EXCEPT once this - * tracker has finished its work. - */ + * Don't dispatch mouse and key events in general, EXCEPT once this + * tracker has finished its work. + */ bool dispatch = true; if (!(tracking && !cancelled)) { switch (type) { @@ -943,9 +943,9 @@ if (bounds is null) return false; bool orientationInit = false; /* - * If the cursor orientation has not been set in the orientation of - * this change then try to set it here. - */ + * If the cursor orientation has not been set in the orientation of + * this change then try to set it here. + */ if (xChange < 0 && ((style & DWT.LEFT) !is 0) && ((cursorOrientation & DWT.RIGHT) is 0)) { if ((cursorOrientation & DWT.LEFT) is 0) { cursorOrientation |= DWT.LEFT; @@ -1056,10 +1056,10 @@ for (int i = 0; i < rectangles.length; i++) { Rectangle proportion = proportions[i]; newRects[i] = new Rectangle ( - proportion.x * bounds.width / 100 + bounds.x, - proportion.y * bounds.height / 100 + bounds.y, - proportion.width * bounds.width / 100, - proportion.height * bounds.height / 100); + proportion.x * bounds.width / 100 + bounds.x, + proportion.y * bounds.height / 100 + bounds.y, + proportion.width * bounds.width / 100, + proportion.height * bounds.height / 100); } rectangles = newRects; return orientationInit;