[Imagetools-commit] SF.net SVN: imagetools:[3] trunk/imagetools/src/net/codebuilders/desktop/ image
Status: Beta
Brought to you by:
cmarcum
|
From: <cm...@us...> - 2009-04-05 23:17:55
|
Revision: 3
http://imagetools.svn.sourceforge.net/imagetools/?rev=3&view=rev
Author: cmarcum
Date: 2009-04-05 23:17:40 +0000 (Sun, 05 Apr 2009)
Log Message:
-----------
Added readyToCrop boolean and getter/setter methods so we can see if we can crop yet. Added mouseReleased method to crop listener to set the boolean.
Modified Paths:
--------------
trunk/imagetools/src/net/codebuilders/desktop/imagetools/ImageArea.java
Modified: trunk/imagetools/src/net/codebuilders/desktop/imagetools/ImageArea.java
===================================================================
--- trunk/imagetools/src/net/codebuilders/desktop/imagetools/ImageArea.java 2009-04-05 23:13:33 UTC (rev 2)
+++ trunk/imagetools/src/net/codebuilders/desktop/imagetools/ImageArea.java 2009-04-05 23:17:40 UTC (rev 3)
@@ -87,6 +87,11 @@
*/
private Point2D pointSelection;
+ /**
+ * Ready to crop, usually after rectangle selection
+ */
+ private boolean readyToCrop;
+
// var to hold current mouse listener
private int mouseEvtType;
// constants for mouse events
@@ -131,6 +136,7 @@
gpAnnotate = new GradientPaint(0.0f, 0.0f, Color.red, 1.0f, 1.0f, Color.white,
true);
+ this.readyToCrop = false;
// Install a mouse listener that sets things up for a selection drag.
// setup crop by default
// this.setupCropMouseListeners();
@@ -200,6 +206,7 @@
repaint();
}
+ setReadyToCrop(false);
return succeeded;
}
@@ -395,6 +402,23 @@
repaint();
}
+
+ // TEST to crop on release or fire event
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ System.out.println("Mouse released.");
+
+ // check for rectangle
+ if (srcx != destx || srcy != desty) {
+ setReadyToCrop(true);
+ System.out.println("Ready to crop.");
+ } else {
+ System.out.println("Not ready to crop.");
+ }
+
+ }
+
+
};
this.addMouseListener(ml);
@@ -419,6 +443,8 @@
repaint();
}
+
+
};
addMouseMotionListener(mml);
@@ -598,4 +624,18 @@
}
+
+ /**
+ * @return the readyToCrop
+ */
+ public boolean isReadyToCrop() {
+ return readyToCrop;
+ }
+
+ /**
+ * @param readyToCrop the readyToCrop to set
+ */
+ public void setReadyToCrop(boolean readyToCrop) {
+ this.readyToCrop = readyToCrop;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|