jfig.commands
Class ResizeTextCommand

java.lang.Object
  extended byjfig.commands.Command
      extended byjfig.commands.ResizeTextCommand

public class ResizeTextCommand
extends Command

resize or modify a text object's attributes.

On each mouse click, the text font size is increased (normal click) or decreased (shift+click, middle click) by one step, in the order { 6, 8, 9, 10, 11, 12, 14, 15, 17, 18, 20, 22, 24, 27, 30, 35, 40 } points. For each right click, the text attributes are toggled between { normal, bold, italic }.


Field Summary
 int ENLARGE
           
protected  int fontIndex
           
protected  int fontSize
           
static int[] fontSizeTable
           
protected  int mode
           
protected  int n_points
           
protected  FigText object
           
protected  int oldFontIndex
           
protected  int oldFontSize
           
 int SHRINK
           
 int TOGGLE
           
 
Fields inherited from class jfig.commands.Command
editor, objectCanvas, ready
 
Constructor Summary
ResizeTextCommand(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 array-wrapped reference to the text object (to be) resized by this command.
 void mousePressed(FigCanvasEvent evt)
          select the object to move (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

n_points

protected int n_points

object

protected FigText object

fontSize

protected int fontSize

oldFontSize

protected int oldFontSize

fontIndex

protected int fontIndex

oldFontIndex

protected int oldFontIndex

mode

protected int mode

ENLARGE

public final int ENLARGE
See Also:
Constant Field Values

SHRINK

public final int SHRINK
See Also:
Constant Field Values

TOGGLE

public final int TOGGLE
See Also:
Constant Field Values

fontSizeTable

public static final int[] fontSizeTable
Constructor Detail

ResizeTextCommand

public ResizeTextCommand(FigBasicEditor editor,
                         FigCanvas objectCanvas)
Method Detail

getModifiedObjects

public FigObject[] getModifiedObjects()
return an array-wrapped reference to the text object (to be) resized by this command. The text object reference may be null.

Overrides:
getModifiedObjects in class Command

execute

public void execute()
Description copied from class: Command
execute the current editor command

This method is empty for class Command.

Overrides:
execute in class Command

undo

public void undo()
Description copied from class: Command
undo this 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.

Overrides:
undo in class Command

mousePressed

public void mousePressed(FigCanvasEvent evt)
select the object to move (at position startPoint) and its new position (endPoint).

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 removed.

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 moved as soon as the users clicks on a position different from the startPoint.

Overrides:
mousePressed in class Command

getDescription

public java.lang.String getDescription()
Description copied from class: Command
one-line description of this command

return a one-line desription of this command, e.g. to label the undo/redo buttons, if any

Overrides:
getDescription in class Command

toString

public java.lang.String toString()
Description copied from class: Command
return a (possibly verbose) description of this Command object

Overrides:
toString in class Command