home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / news / 770 / fastgt15 / fastgtde / gtuser.prg < prev    next >
Text File  |  1994-03-11  |  7KB  |  225 lines

  1.  
  2. #include "FastGT.ch"
  3.  
  4.  
  5. // **************************************************************
  6. //
  7. // This function draws a 3D window
  8. //
  9. // (C) 1992-93 Manu Roibal
  10. //
  11. Function GTBox( nTop, nLeft, nBottom, nRight, cColor )
  12. Local cOldColor := SetColor( cColor )
  13. Local lMouse    := MouseCursor( MOUSE_OFF )
  14.  
  15.     Scroll( nTop, nLeft, nBottom, nRight )
  16.  
  17.     SetColor( cOldColor )
  18.  
  19.     nBottom++                           // convert to graphic coordinates
  20.     nRight++
  21.     nLeft   := nLeft   *  8 + 4
  22.     nRight  := nRight  *  8 - 5
  23.     nTop    := nTop    * 16 + 4
  24.     nBottom := nBottom * 16 - 5
  25.  
  26.     VESABox(  nTop - 4, nLeft - 4, nBottom + 4, nRight + 4,  7 )
  27.     VESABox(  nTop - 3, nLeft - 3, nBottom + 3, nRight + 3, 15 )
  28.     VESABox(  nTop - 2, nLeft - 2, nBottom + 2, nRight + 2, 15 )
  29.     VESABox(  nTop - 1, nLeft - 1, nBottom + 1, nRight + 1,  7 )
  30.     VESABox(  nTop,     nLeft,     nBottom,     nRight,      0 )
  31.  
  32.     MouseCursor( lMouse )
  33.  
  34. Return( Nil )
  35.  
  36.  
  37.  
  38.  
  39. // **************************************************************
  40. //
  41. // This function draws a win3 window
  42. //
  43. // (C) 1992-93 Manu Roibal
  44. //
  45. Function GTWinBox( nY1, nX1, nY2, nX2, cColor, cTittle )
  46. Local nPy1, nPx1, nPy2, nPx2, nCentre
  47. Local lMouse    := MouseCursor( MOUSE_OFF )
  48.  
  49.     GTBox( nY1, nX1, nY2, nX2, cColor )
  50.  
  51.     nPy1 := nY1 * 16 + 5        // convert to graphic coordinates
  52.     nPy2 := ( nY1 + 1 ) * 16
  53.     nPx1 := nX1 * 8  + 5
  54.     nPx2 := nX2 * 8  + 2
  55.  
  56.     VESASetArea( nPy1, nPx1 + 12, nPy2, nPx2, 1 )
  57.     VESASetArea( nPy1, nPx1, nPy2, nPx1 + 11, 15 )
  58.  
  59.     VESABox( nPy1 + 5, nPx1 + 3, nPy2 - 4, nPx1 + 10,  8 )
  60.     VESABox( nPy1 + 4, nPx1 + 2, nPy2 - 5, nPx1 +  9,  0 )
  61.  
  62.     VESASetArea( nPy1 + 5, nPx1 + 3, nPy2 - 6, nPx1 +  8, 15 )
  63.  
  64.     VESALine( nPy2, nPx1, nPy2, nPx2, 0 )
  65.     VESALine( nPy1 - 1, nPx1 + 13, nPy1 - 1, nPx2, 3 )
  66.     VESALine( nPy1 - 1, nPx1 + 13, nPy2 - 1, nPx1 + 13, 3 )
  67.  
  68.     nCentre = ( nX1 + ( nX2 - nX1 ) / 2 - Len( cTittle ) / 2 ) * 8
  69.  
  70.     VESAWriteAt( nPy1 + 2, nCentre, cTittle, 15, 1, FONT_SMALL )
  71.  
  72.     MouseCursor( lMouse )
  73.  
  74. Return( Nil )
  75.  
  76.  
  77.  
  78. // **************************************************************
  79. //
  80. // This function draws a win3 style buttom
  81. //
  82. // (C) 1992-93 Manu Roibal
  83. //
  84. Function DrawButtom( nY, nX, cMessage, lStatus )
  85. Local nPy  := nY * 16
  86. Local nPx  := nX * 8
  87. Local nLen := Len( cMessage ) + 2
  88. Local lMouse    := MouseCursor( MOUSE_OFF )
  89.  
  90.     lStatus := If( lStatus == Nil, .T., lStatus )
  91.  
  92.     VESABox( nPy, nPx, nPy + 15, nPx + nLen * 8 + 7,  0 )
  93.  
  94.     VESASetArea( nPy + 1, nPx + 1, nPy + 14, nPx + nLen * 8 + 6, 15 )
  95.  
  96.     If lStatus
  97.       VESASetArea( nPy + 13, nPx + 2, nPy + 13, nPx + nLen * 8 + 6, 7 )
  98.       VESASetArea( nPy + 14, nPx + 1, nPy + 14, nPx + nLen * 8 + 6, 7 )
  99.       VESASetArea( nPy +  2, nPx + nLen * 8 + 5, nPy + 13, nPx + nLen * 8 + 5, 7 )
  100.       VESASetArea( nPy +  1, nPx + nLen * 8 + 6, nPy + 14, nPx + nLen * 8 + 6, 7 )
  101.       VESAWriteAt( nPy + 4, nPx + 10, cMessage, 0, 15, FONT_SMALL )
  102.     Else
  103.       VESASetArea( nPy + 1, nPx + 1, nPy +  1, nPx + nLen * 8 + 6, 7 )
  104.       VESASetArea( nPy + 1, nPx + 1, nPy + 14, nPx + 1,            7 )
  105.       VESAWriteAt( nPy + 6, nPx + 12, cMessage, 0, 15, FONT_SMALL )
  106.     EndIf
  107.  
  108.     MouseCursor( lMouse )
  109.  
  110. Return( { nY, nX, cMessage } )
  111.  
  112.  
  113.  
  114. // **************************************************************
  115. //
  116. // This function pushs a win3 style buttom
  117. //
  118. // (C) 1992-93 Manu Roibal
  119. //
  120. Function PushButtom( hButtom )
  121.     DrawButtom( hButtom[ 1 ], hButtom[ 2 ], hButtom[ 3 ], .F. )
  122.     Inkey( .2 )
  123.     DrawButtom( hButtom[ 1 ], hButtom[ 2 ], hButtom[ 3 ], .T. )
  124. Return( Nil )
  125.  
  126.  
  127.  
  128. // **************************************************************
  129. //
  130. // This function draws an icon
  131. //
  132. // (C) 1992-93 Manu Roibal
  133. //
  134. Function DrawIcon( hIcon, lMode )
  135. Local nInc   := If( lMode == Nil .Or. lMode,  0,  1 )
  136. Local nRow   := hIcon[ 1 ]
  137. Local nCol   := hIcon[ 2 ]
  138. Local nColor := If( lMode == Nil .Or. lMode,  8,  7 )
  139. Local lMouse := MouseCursor( MOUSE_OFF )
  140.  
  141.     VESASetArea( nRow -  2, nCol - 2,  nRow -  1, nCol + 33, 7 )
  142.  
  143.     VESALine( nRow -  1, nCol + 32, nRow + 33, nCol + 32, nColor )
  144.     VESALine( nRow -  2, nCol + 33, nRow + 33, nCol + 33, 8 )
  145.  
  146.     VESASetArea( nRow -  2, nCol - 2,  nRow + 33, nCol -  1, 7 )
  147.  
  148.     VESALine( nRow + 32, nCol -  1, nRow + 32, nCol + 32, nColor )
  149.     VESALine( nRow + 33, nCol -  2, nRow + 33, nCol + 33, 8 )
  150.  
  151.     VESAShowIcon( nRow + nInc, nCol + nInc, hIcon[ 3 ] )
  152.  
  153.     MouseCursor( lMouse )
  154.  
  155. Return( Nil )
  156.  
  157.  
  158.  
  159.  
  160. // **************************************************************
  161. //
  162. // This function search the VESA mode to use
  163. //
  164. // (C) 1992-93 Manu Roibal
  165. //
  166. Function SearchMode()
  167. Local nMode
  168. Local aModes := { 261, 259, 257, 256 }
  169. Local nInd   := 1
  170. Local nBorra
  171.     While ( nInd < Len( aModes ) + 1 ) .And. ( nMode == Nil )
  172.       VESAMode( aModes[ nInd ] )
  173.       nBorra := VESAMode()
  174.       If ( nBorra == aModes[ nInd ] )
  175.         nMode := Len( aModes ) - nInd
  176.       EndIf
  177.       nInd++
  178.     End
  179. Return( nMode )
  180.  
  181.  
  182.  
  183.  
  184. // **************************************************************
  185. //
  186. // This function draws a bar
  187. //
  188. // (C) 1992-93 Manu Roibal
  189. //
  190. Function DrawBar( nY, nX, nHigh, nWeight, nShadow, nColor, nColShadow )
  191. Local nInd
  192. Local lMouse := MouseCursor( MOUSE_OFF )
  193.     For nInd := 1 To nWeight + 1
  194.       VESALine( nY, nX + nInd, nY - nHigh, nX + nInd, nColor )
  195.     Next
  196.     For nInd := 1 To nShadow
  197.       VESALine( nY - nInd,         nX + nWeight + nInd, nY - nHigh - nInd, nX + nWeight + nInd, nColShadow )
  198.       VESALine( nY - nHigh - nInd, nX + nInd,           nY - nHigh - nInd, nX + nWeight + nInd, nColShadow )
  199.     Next
  200.     MouseCursor( lMouse )
  201. Return( Nil )
  202.  
  203.  
  204.  
  205.  
  206. // **************************************************************
  207. //
  208. // This function draws a 3D box for write strings
  209. //
  210. // (C) 1992-93 Manu Roibal
  211. //
  212. Function UserBox( nY, nX, nLen, nColor1, nColor2 )
  213. Local nX2
  214. Local lMouse := MouseCursor( MOUSE_OFF )
  215.     nY  *= 16          // convert text coordinates to graphic coordinates
  216.     nX  *= 8           // a character is a 8x16 pixels
  217.     nX2 := nX + nLen * 8
  218.     VESALine( nY,      nX,      nY + 15, nX,      nColor1 )
  219.     VESALine( nY,      nX2 - 1, nY + 15, nX2 - 1, nColor2 )
  220.     VESALine( nY + 15, nX,      nY + 15, nX2 - 1, nColor2 )
  221.     VESALine( nY,      nX,      nY,      nX2 - 1, nColor1 )
  222.     MouseCursor( lMouse )
  223. Return( Nil )
  224.  
  225.