2
0
Эх сурвалжийг харах

Added a special inspection mode for the case where we want to just find a component with a drag action. Previously the targeted component could just ignore the drag.

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7210 8c9fc860-2736-0410-a75d-ab315db34111
skoster 8 жил өмнө
parent
commit
aa26d30d1b

+ 7 - 1
source/WMComponents.Mod

@@ -166,6 +166,8 @@ TYPE
 	ToggleEditMode* = POINTER TO RECORD
 		recursion*: Recursion;
 	END;
+	
+	FindComponentMode* = POINTER TO RECORD END;
 
 	Event* = RECORD
 	END;
@@ -2094,7 +2096,11 @@ TYPE
 						END
 					ELSIF msg.msgSubType = Messages.MsgDragDropped THEN
 						IF (msg.ext # NIL) THEN
-							IF (msg.ext(WM.DragInfo).data # NIL) & (msg.ext(WM.DragInfo).data IS ToggleEditMode) THEN
+							IF (msg.ext(WM.DragInfo).data # NIL) & (msg.ext(WM.DragInfo).data IS FindComponentMode) THEN
+								IF msg.ext(WM.DragInfo).onAccept # NIL THEN 
+									msg.ext(WM.DragInfo).onAccept(po, msg.ext(WM.DragInfo));
+								END;
+							ELSIF (msg.ext(WM.DragInfo).data # NIL) & (msg.ext(WM.DragInfo).data IS ToggleEditMode) THEN
 								SetEditMode(~editMode.Get(), msg.ext(WM.DragInfo).data(ToggleEditMode).recursion # Recursion.None);
 								Invalidate;
 							ELSIF editMode.Get() THEN

+ 3 - 3
source/WMInspector.Mod

@@ -985,7 +985,7 @@ TYPE
 		PROCEDURE PointerDown(x, y : LONGINT; keys : SET);
 		VAR
 			img,icon: WMGraphics.Image; canvas, iconCanvas: WMGraphics.BufferCanvas; color: LONGINT;
-			r: WMRectangles.Rectangle;
+			r: WMRectangles.Rectangle; data: WMComponents.FindComponentMode;
 		BEGIN
 			IF 0 IN keys THEN
 				r := GetClientRect();
@@ -994,8 +994,8 @@ TYPE
 				Raster.Create(img, 30,30, Raster.BGRA8888);
 				NEW(canvas,img);
 				canvas.Fill(WMRectangles.MakeRect(0, 0, 30,30), color , WMGraphics.ModeSrcOverDst);
-
-				IF StartDrag(NIL, img, 0,0,Accept,Accept) THEN
+				NEW(data);
+				IF StartDrag(data, img, 0,0,Accept,Accept) THEN
 				END;
 			END
 		END PointerDown;