home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / colorset.prg < prev    next >
Text File  |  1993-10-14  |  2KB  |  82 lines

  1. /*
  2.  * File......: COLORSET.PRG
  3.  * Author....: Martin Colloby
  4.  * BBS.......: The Dark Knight Returns
  5.  * Net/Node..: 050/069
  6.  * User Name.: Martin Colloby
  7.  * Date......: 18/4/93
  8.  * Revision..: 1.0
  9.  *
  10.  * This is an original work by Martin Colloby and is placed in the public
  11.  * domain.
  12.  *
  13.  * Modification history:
  14.  * ---------------------
  15.  *
  16.  * $Log$
  17.  *
  18.  */
  19.  
  20.  
  21. /*  $DOC$
  22.  *  $FUNCNAME$
  23.  *      GT_COLORSET()
  24.  *  $CATEGORY$
  25.  *      Video
  26.  *  $ONELINER$
  27.  *      Change/return the colour setting
  28.  *  $SYNTAX$
  29.  *      GT_ColorSet( nColorNum , cNewColor )
  30.  *  $ARGUMENTS$
  31.  *      nColorNum - Colour number to be addressed
  32.  *      cNewColor - Optional new colour string
  33.  *  $RETURNS$
  34.  *      The current colour setting
  35.  *  $DESCRIPTION$
  36.  *      Returns the current setting of the given colour area.
  37.  *      If cNewColor is passed, the given colour setting is changed to
  38.  *      cNewColor.
  39.  *      GT_LIB.CH contains #define values for the available colour areas.
  40.  *  $EXAMPLES$
  41.  *      Change the first colour setting to "W+/R" :
  42.  *
  43.  *          nColour := GT_ColorSet( 1 , "W+/R" )
  44.  *  $SEEALSO$
  45.  *
  46.  *  $INCLUDE$
  47.  *      GT_LIB.CH
  48.  *  $END$
  49.  */
  50.  
  51. *
  52. FUNCTION GT_ColorSet( nColorNum , cNewColor )
  53.  
  54. /*****************************************************************************
  55.  Purpose - Change the current colour setting
  56.  Returns - The previous colour setting
  57.  Author  - Martin Colloby
  58.  Edited  - 29/7/92 by Log - Added C_REVERSE colour - "B/W"
  59.            24/9/92 by Log - Changed return parameter to a numeric
  60. ******************************************************************************
  61.  Parameters - nColorNum - Colour number to change to
  62.               cNewColor - New colour string for array
  63.  Privates   - None
  64.  Locals     - cCurrent  - Current color setting as a string
  65.  Externals  - None
  66. *****************************************************************************/
  67.  
  68. STATIC aColors := { "W+/B", "BG+/B", "GR+/B", "R/B", "W+/BG", "W+/R", "G+/B", "B/W" }
  69.  
  70. LOCAL cCurrent := ""
  71.  
  72. /* Change applicable color setting if second parameter was passed */
  73. IF cNewColor != NIL
  74.    aColors[nColorNum] := cNewColor
  75. ENDIF
  76.  
  77. * Get the current color setting
  78. cCurrent := SET( _SET_COLOR , aColors[nColorNum] )
  79.  
  80. RETURN ASCAN( aColors , SUBSTR( cCurrent , 1 , AT( "," , cCurrent ) - 1 ) )
  81. *
  82.