[archstudio-commits] svn commit: r7071 - in /calico/branches/mitchnick2/ics/uci/edu/Calico/UI: MouseInputHandler.java components/palettes/Palettes.java

archstudio-commits-owner at uci.edu archstudio-commits-owner at uci.edu
Fri May 2 13:27:04 PDT 2008


Author: nmangano
Date: Fri May  2 13:27:03 2008
New Revision: 7071

Log:
Fixed open and closing bug for palettes, and also fixed bug that caused scr=
aps to not return to their original position when added to the palette.

Modified:
    calico/branches/mitchnick2/ics/uci/edu/Calico/UI/MouseInputHandler.java
    calico/branches/mitchnick2/ics/uci/edu/Calico/UI/components/palettes/Pa=
lettes.java

Modified: calico/branches/mitchnick2/ics/uci/edu/Calico/UI/MouseInputHandle=
r.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- calico/branches/mitchnick2/ics/uci/edu/Calico/UI/MouseInputHandler.java=
 (original)
+++ calico/branches/mitchnick2/ics/uci/edu/Calico/UI/MouseInputHandler.java=
 Fri May  2 13:27:03 2008
@@ -172,7 +172,8 @@
 				int[] scrapsToRaise =3D new int[lastEvent().occludingScraps.size()];
 				for (int i =3D 0; i < lastEvent().occludingScraps.size(); i++) {
 					scrapsToRaise[i] =3D lastEvent().occludingScraps.get(i).getModel().id;
-					dragCoords.put(Integer.valueOf(lastEvent().occludingScraps.get(i).get=
Model().id), e.getPosition());
+					dragCoords.put(Integer.valueOf(lastEvent().occludingScraps.get(i).get=
Model().id), =

+							ScrapController.getMidPoint(lastEvent().occludingScraps.get(i).getM=
odel()));
 				}
 				canvas.applyAction(new ScrapsRaised(scrapsToRaise));
 				canvas.moveToFront(painter, null);
@@ -439,6 +440,7 @@
 						}
 						else
 						{
+							//Nick: Mitch, when is this line ever called?
 							bar.showHide();
 						}
 					}
@@ -453,6 +455,10 @@
 						cache =3D bar;
 						if(bar.isInHiddenMode)
 						{
+							bar.showHide(); //opens here
+						}
+						else if (!bar.isInHiddenMode && bar.getIndex(e.getCanvasPosition()) =
=3D=3D Palettes.PULL_HANDLE)
+						{
 							bar.showHide();
 						}
 						if(e.isRightMouseButton())
@@ -481,10 +487,11 @@
 							{
 								bar.registerScrap(scraps, e.getCanvasPosition());
 							}
+							/*
 							else
 							{
-								bar.showHide();
-							}
+								bar.showHide(); //closes it on startup
+							}*/
 						}
 =

 					} else {

Modified: calico/branches/mitchnick2/ics/uci/edu/Calico/UI/components/palet=
tes/Palettes.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- calico/branches/mitchnick2/ics/uci/edu/Calico/UI/components/palettes/Pa=
lettes.java (original)
+++ calico/branches/mitchnick2/ics/uci/edu/Calico/UI/components/palettes/Pa=
lettes.java Fri May  2 13:27:03 2008
@@ -34,6 +34,8 @@
  */
 public class Palettes extends CalicoComponent implements CalicoActionListe=
ner {
 =

+	public static int PULL_HANDLE =3D -2;
+	=

 	int row, col;
 	CellContents[] cellContents;
 	Image[] cellImages;
@@ -546,7 +548,7 @@
 	public void registerScrap(ArrayList<ScrapPainter> scraps, Point2D p) {
 		int cIndex =3D getIndex(p);
 		=

-		if (cIndex =3D=3D -1)
+		if (cIndex < 0)
 			return;
 			=

 			=

@@ -631,7 +633,7 @@
 		int index =3D getIndex(p);
 		=

 		int index2 =3D getIndex(dest,true);
-		if(index2 !=3D -1 )
+		if(index2 > -1 )
 		{
 			if(isCellEmpty(index2))
 			{
@@ -653,7 +655,7 @@
 			}
 			return new CellContents();
 		}
-		else if(index=3D=3D-1)
+		else if(index < 0)
 		{
 			return new CellContents();
 		}
@@ -715,6 +717,11 @@
 		=

 		//alg: create a rect, check if it's in it, then move on to next rect.
 		Rectangle2D rect;
+		//check if it's the handle, and if it is, return the constant
+		rect =3D new Rectangle2D.Double( getBounds().x, getBounds().y, nameWidth=
, getBounds().height);
+		if (rect.contains(p))
+			return PULL_HANDLE;
+		=

 		for (int r =3D 0; r < row; r++) {
 			for (int c =3D 0; c < col; c++) {
 				rect =3D new Rectangle2D.Double(	(getBounds().x+nameWidth) + cellWidth=
*c,
@@ -730,6 +737,8 @@
 			}
 		}
 		=

+		/*
+		//Nick: So this code right seems really random from my point of view, an=
d is causing problems.
 		if(!isOuterMove)
 		{
 			if(!isInHiddenMode)
@@ -741,6 +750,7 @@
 		{
 			showHide();
 		}
+		*/
 		=

 		return -1;
 	}




More information about the archstudio-commits mailing list