Back to index

wims  3.65+svn20090927
Public Member Functions | Private Attributes | Static Private Attributes
fr.ove.openmath.jome.ctrlview.bidim.GraphicContext Class Reference

The graphic context of each part of the formula to display. More...

Collaboration diagram for fr.ove.openmath.jome.ctrlview.bidim.GraphicContext:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GraphicContext ()
 The default constructor.
 GraphicContext (Font font, Color foregroundColor, Color backgroundColor, Color selectionColor)
 The Constructor.
 GraphicContext (GraphicContext gc)
 The constructor by copy.
Font getFont ()
 Returns the font used in the graphic context.
int getSizeRef ()
 Returns the reference size of the font.
Color getForegroundColor ()
 Returns the color used by the graphic context.
Color getBackgroundColor ()
 Returns the background for the display.
Color getSelectionColor ()
 Returns the color used in the graphic context to hilight the selection.
void setFont (Font font)
 Sets a new font to the context.
void setForegroundColor (Color foregroundColor)
 Sets a new color to the context.
void setBackgroundColor (Color backgroundColor)
 Sets a new background color for the display.
void setSelectionColor (Color selectionColor)
 Sets a new selection color to the context.
Font scaleFont (int nbTime)
 Scales the current font.

Private Attributes

Font font
 The font used.
int sizeRef
 The size of the font used.
Color foregroundColor
 The color used to display the part of the formula.
Color backgroundColor
 The color used to display the background of the formula.
int nbTime = 0
 How many times the scale factor is apply to reduce the font size.

Static Private Attributes

static Color selectionColor
 The color used to hilight the selected part.

Detailed Description

The graphic context of each part of the formula to display.

Author:
1998 DIRAT Laurent
Version:
1.0 22/06/98

Definition at line 39 of file GraphicContext.java.


Constructor & Destructor Documentation

The default constructor.


The default is :

  • a Times New Roman font, regular, with a size of 14
  • the foreground color set to black
  • the background color set to white
  • the selection color set to yellow

Definition at line 80 of file GraphicContext.java.

                            {
        this(new Font("Times New Roman", Font.PLAIN, 14), Color.black, Color.white, Color.yellow);
    }
fr.ove.openmath.jome.ctrlview.bidim.GraphicContext.GraphicContext ( Font  font,
Color  foregroundColor,
Color  backgroundColor,
Color  selectionColor 
) [inline]

The Constructor.

Parameters:
fontthe font used to display all the text elements.
colorthe color used to display all the text elements.
backgroundthe color used as background for the display.
selectionColorthe color of all the selected elements.

Definition at line 92 of file GraphicContext.java.

The constructor by copy.

Parameters:
gcthe graphic context to copy.

Definition at line 104 of file GraphicContext.java.

                                             {
        font = gc.getFont();
        sizeRef = gc.getSizeRef();
        foregroundColor = gc.getForegroundColor();
        backgroundColor = gc.getBackgroundColor();
        selectionColor = gc.getSelectionColor();
    }

Here is the call graph for this function:


Member Function Documentation

Returns the background for the display.

Definition at line 138 of file GraphicContext.java.

                                      {
        return backgroundColor;
    }

Here is the caller graph for this function:

Returns the font used in the graphic context.

Definition at line 117 of file GraphicContext.java.

                          {
        return font;
    }

Here is the caller graph for this function:

Returns the color used by the graphic context.

Definition at line 131 of file GraphicContext.java.

                                      {
        return foregroundColor;
    }

Here is the caller graph for this function:

Returns the color used in the graphic context to hilight the selection.

Returns:
the color.

Definition at line 146 of file GraphicContext.java.

                                     {
        return selectionColor;
    }

Here is the caller graph for this function:

Returns the reference size of the font.

Definition at line 124 of file GraphicContext.java.

                            {
        return sizeRef;
    }

Here is the caller graph for this function:

Scales the current font.

Parameters:
nbTimehow many the scale factor is applied.
Returns:
the font scaled.

Definition at line 190 of file GraphicContext.java.

                                      {
        if (this.nbTime != nbTime) {
            String name = font.getName();
            int style = font.getStyle();
            int size = sizeRef;
            
            this.nbTime = nbTime;
            
            for (int i = 0; i < nbTime; i++) {
                size = (int) Math.round( ((float) size) * 0.7f );
                if (size < 10)
                    break;
            }
            
            size = (size < 10) ? 10 : size;
            
            font = new Font(name, style, size);
        }
        
        return font;
    }

Here is the caller graph for this function:

Sets a new background color for the display.

Parameters:
backgroundthe color used as background for the display.

Definition at line 173 of file GraphicContext.java.

Here is the caller graph for this function:

Sets a new font to the context.

Parameters:
fontthe new font.

Definition at line 156 of file GraphicContext.java.

                                   {
        this.font = font;
        sizeRef = font.getSize();
    }

Here is the caller graph for this function:

Sets a new color to the context.

Parameters:
colorthe new color.

Definition at line 165 of file GraphicContext.java.

Here is the caller graph for this function:

Sets a new selection color to the context.

Parameters:
selectionColorthe new color.

Definition at line 181 of file GraphicContext.java.

Here is the caller graph for this function:


Member Data Documentation

The color used to display the background of the formula.

Definition at line 58 of file GraphicContext.java.

The font used.

Definition at line 43 of file GraphicContext.java.

The color used to display the part of the formula.

Definition at line 53 of file GraphicContext.java.

How many times the scale factor is apply to reduce the font size.

Definition at line 68 of file GraphicContext.java.

The color used to hilight the selected part.

Definition at line 63 of file GraphicContext.java.

The size of the font used.

Definition at line 48 of file GraphicContext.java.


The documentation for this class was generated from the following file: