|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jfig.commands.Command jfig.commands.CopyObjectCommand
copy jfig objects.
CopyCommand allows the user to copy objects in the jfig editor, including all their attributes.
Use the middle mouse button (or "alt"+"left") for x/y-restricted copies, or the right mouse button to cancel a copy operation.
Field Summary | |
protected FigObject |
clone
|
protected int |
dx
|
protected int |
dy
|
protected java.awt.Point |
endPoint
|
protected int |
n_points
|
protected boolean |
restricted
|
protected FigObject |
source
|
protected java.awt.Point |
startPoint
|
Fields inherited from class jfig.commands.Command |
editor, objectCanvas, ready |
Constructor Summary | |
CopyObjectCommand(FigBasicEditor editor,
FigCanvas objectCanvas)
|
Method Summary | |
void |
execute()
execute the current editor command |
java.lang.String |
getDescription()
one-line description of this command |
FigObject[] |
getModifiedObjects()
return an FigObject array of length 2 with the following entries: the object at index 0 is the original (source) object or null, the object at index 1 is the copied (clone) object or null. |
void |
mousePressed(FigCanvasEvent evt)
select the object to copy (at position startPoint) and its new position (endPoint). |
java.lang.String |
toString()
return a (possibly verbose) description of this Command object |
void |
undo()
undo this command |
Methods inherited from class jfig.commands.Command |
cancel, isReady, message, notifyEditor, statusMessage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int n_points
protected FigObject source
protected FigObject clone
protected java.awt.Point startPoint
protected java.awt.Point endPoint
protected int dx
protected int dy
protected boolean restricted
Constructor Detail |
public CopyObjectCommand(FigBasicEditor editor, FigCanvas objectCanvas)
Method Detail |
public FigObject[] getModifiedObjects()
getModifiedObjects
in class Command
public void execute()
Command
This method is empty for class Command.
execute
in class Command
public void undo()
Command
Try to undo this command as far as possible. Don't try to undo() a command that has never been execute()d before. This method is empty for class Command.
undo
in class Command
public void mousePressed(FigCanvasEvent evt)
To allow for selection of stacked objects at/near startPoint, we use the following algorithm: First, we simply use editor.findObjectAt() to find the topmost object (if any) at or near startPoint. If an object is found, its corners are highlighted, while all other object markers are recopyd.
If the user clicks again on/near startPoint - and with the SHIFT-key hold down, the editor.findNextObjectAt() method is called repeatedly, to find the next objects.
The selected object is copied as soon as the users clicks on a position different from the startPoint.
If the "middle" mouse button is pressed (or use "ALT"+"left" button), the CopyCommand restricts the target position to allow for directly horizontal/vertical copies.
mousePressed
in class Command
public java.lang.String getDescription()
Command
return a one-line desription of this command, e.g. to label the undo/redo buttons, if any
getDescription
in class Command
public java.lang.String toString()
Command
toString
in class Command
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |