home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware 1 2 the Maxx
/
sw_1.zip
/
sw_1
/
DBASE
/
DBX112.ZIP
/
FIXUP.PRG
< prev
next >
Wrap
Text File
|
1992-04-07
|
11KB
|
316 lines
* Program...: FIXUP.PRG
* Author....: David A. Kennedy
* Date......: 01/04/92
* Notes.....: This code is provided for users who don't have IDL, ProClip,
* or Overlay() libraries. If you do have one of the libraries,
* be sure to delete all the replacement functions below. Using
* this code AS IS will result in 100% Clipper code.
*
* Revised...: 02/24/92, ver 1.10 - rewrote NEWCOLOR() in straight Clipper
*
*****************************************************************************
*
function kbd_alt()
*
* Replacement for IDL 2.11 function of the same name.
*
* If you have FUNCky, use "return KBDSTAT(8)".
*
* If you have NANFOR.LIB, use "return FT_ALT()".
*
return (.F.)
*
*****************************************************************************
*
function alldrives()
*
* Replacement for ProClip 4.0 function of the same name.
*
* If you have IDL 2.11, use "return DRV_LETTERS()".
*
* If you have FUNCky, use "return DRIVESTR()".
*
* If you have NANFOR.LIB, you may want to make repeated calls to FT_EXIST()
* (for A:-Z:), which would work even better than ProClip/IDL but would be
* MUCH slower the first time the function is called:
*
* static vcDrives := nil
* *
* local vnTemp
* *
* if vcDrives=nil
* for vnTemp=65 to 90 && A: - Z:
* if FT_EXIST(asc(vnTemp)+':')
* vcDrives := vcDrives+asc(vnTemp)
* endif
* next
* endif
* return (vcDrives)
*
return 'ABCDEF' && fake it
*
*****************************************************************************
*
function dosargs(vnDummy)
*
* Replacement for ProClip 4.0 function of the same name.
*
* If you have NANFOR.LIB, use "return FT_ORIGIN()", although ProClip can
* return all the command line parameters.
*
* Warning: FT_ORIGIN() apparently contains a bug, since on my machine
* (Compaq 386+DOS 3.31+QEMM 6.01) I get garbage as a return value!
*
* The following code will not work properly if dbMAX is not run from the
* current path or if the .EXE is renamed! The program will not be able to
* find the .INI/.ENV/help files and therefore you will need to run the
* program using a batch file containing the lines:
*
* @ECHO OFF
* CD\DBMAX (or wherever .EXE is located)
* DBX %1 %2 %3 %4 %5 %6 %7
*
return curpath()+'DBX.EXE' && see CURPATH() below
*
*****************************************************************************
*
function clock(vcMode)
*
* Replacement for ProClip 4.0 function of the same name (vcMode="on" or
* "off").
*
* If you have IDL 2.11, you can use CLOCK(), but IDL's clock will crash your
* PC if you bomb the program without turning the clock off, unlike ProClip.
*
* If you have FUNCky, use:
*
* if vcMode='on'
* CLOCK12(0,72)
* else
* UNCLOCK()
* endif
* return ''
*
return ''
*
*****************************************************************************
*
function curpath(vcDrive)
*
* Replacement for ProClip 4.0 function of the same name.
*
* If you have FUNCky, use "return CURDIR()".
*
* If you have NANFOR.LIB or IDL 2.11, use:
*
* if vcDrive=nil
* vcDrive := CURDRIVE() && IDL 2.11
* -or-
* vcDrive := FT_DEFAULT() && NANFOR.LIB
* endif
* return vcDrive+':\'+iif(empty(curdir(vcDrive)),'',curdir(vcDrive)+'\')
*
if vcDrive=nil
*
* Set the default to drive C: or whatever drive that the .EXE is on! If
* not set to the proper drive, the .INI/.ENV/help files will not be found!
*
vcDrive := 'C'
endif
*
return vcDrive+':\'+iif(empty(curdir(vcDrive)),'',curdir(vcDrive)+'\')
*
*****************************************************************************
*
function flipcolor(vcColor)
*
* Replacement for ProClip 4.0 function of the same name.
*
* If you have NANFOR.LIB, use "return FT_INVCLR(vcColor)"
*
return (vcColor) && fake it
*
*****************************************************************************
*
function getcolor()
*
* Replacement for ProClip 4.0 function of the same name (this function is
* used only to get the color of the DOS screen).
*
* If you have IDL 2.11, use "return ATT2COLOR(SCR_GETATT())".
*
return '+w/b' && fake it (SETCOLOR() will NOT work)
*
*****************************************************************************
*
function isptr(vnPort)
*
* Replacement for ProClip 4.0 function of the same name.
*
* If you have IDL 2.11, use "return ISPRINTER(vnPort)" or
* "return (LPT_STAT(vnPort)=0)".
*
* If you have FUNCky, use "return ISPRINTER(vnPort)" or
* or "return ISLPT(vnPort)" or "return (PRNSTATUS(vnPort)=0)".
*
* If you have NANFOR.LIB, use "return FT_ISPRINT('LPT'+str(vnPort,1,0))"
*
return iif(vnPort=1,isprinter(),.F.)
*
*****************************************************************************
*
function newcolor(vnTop,vnLeft,vnBottom,vnRight,vcColor)
*
* Replacement for ProClip 4.0 function of the same name.
*
* If you have IDL 2.11, use
* "return SCR_SETATT(COLOR2ATT(vcColor),vnTop,vnLeft,vnBottom,vnRight)"
*
*
* If you have NANFOR.LIB, you can use the following (based on the 5.0 code
* detailed below):
*
* static vaColors := {'N ','B ','G ','BG |GB ','R ','RB |BR ','RG |GR ',;
* 'W ','+N |N+ ','+B |B+ ','+G |G+ ','+BG|+GB|BG+|GB+',;
* '+R |R+ ','+RB|+BR|RB+|BR+','+RG|+GR|RG+|GR+','+W |W+ '}
* local vnFG := vnBG := 0
* local vcFG,vcBG
* *
* * use only the foreground color
* *
* vcColor := upper(iif(','$vcColor,substr(vcColor,1,at(',',vcColor)-1),vcColor))
* *
* vcFG := padr(left(vcColor,at('/',vcColor)-1),3)
* vcBG := padr(substr(vcColor,at('/',vcColor)+1),3)
* vnFG := ascan(vaColors,{|x| vcFG$x})-1
* vnBG := ascan(vaColors,{|x| vcBG$x})-1
* *
* return FT_SETATTR(vnTop,vnLeft,vnBottom,vnRight,vnFG+vnBG*16)
*
* -or- (NOTE: hard-coded colors!)
*
* local vnTemp,vnColor := 23
* *
* if vcColor=vcShadow
* vnColor := 7
* elseif vcColor=vcHotKey
* vnColor := 62
* endif
* return FT_SETATTR(vnTop,vnLeft,vnBottom,vnRight,vnColor)
*
*
* If you really want to use Clipper, be aware that the following code is slow.
*
* Clipper 5.0 can revise background colors, but vcColor will have to be
* translated into a number. To calculate the number, add the foreground
* color number to 16 times the background color number. Add 128 to make the
* foreground blink or for bright backgrounds if BLINK is OFF.
*
* For improved performance, instead of making the numeric calculations, you
* can check vcColor. If vcColor equals the shadow color, force the
* attribute to be 7, otherwise, force it to be something else.
*
* Foreground/Background Foreground colors only
* ========================= =======================================
* black = 0 red = 4 dark grey = 8 bright red = 12
* blue = 1 magenta = 5 bright blue = 9 bright magenta = 13
* green = 2 brown = 6 bright green = 10 yellow = 14
* cyan = 3 dim white = 7 bright cyan = 11 bright white = 15
*
* static vaColors := {'N ','B ','G ','BG |GB ','R ','RB |BR ','RG |GR ',;
* 'W ','+N |N+ ','+B |B+ ','+G |G+ ','+BG|+GB|BG+|GB+',;
* '+R |R+ ','+RB|+BR|RB+|BR+','+RG|+GR|RG+|GR+','+W |W+ '}
* *
* local vnFG := vnBG := 0
* local vcFG,vcBG,vcScreen,vnTemp
* *
* * use only the foreground color
* *
* vcColor := upper(iif(','$vcColor,substr(vcColor,1,at(',',vcColor)-1),vcColor))
* *
* vcFG := padr(left(vcColor,at('/',vcColor)-1),3)
* vcBG := padr(substr(vcColor,at('/',vcColor)+1),3)
* vnFG := ascan(vaColors,{|x| vcFG$x})-1
* vnBG := ascan(vaColors,{|x| vcBG$x})-1
* *
* vcScreen := savescreen(vnBottom,vnLeft,vnBottom,vnRight)
* for vnTemp=2 to len(vcScreen) step 2
* vcScreen := stuff(vcScreen,vnTemp,1,chr(vnFG+vnBG*16))
* next
* restscreen(vnBottom,vnLeft,vnBottom,vnRight,vcScreen)
* *
* if vlType
* vcScreen := savescreen(vnTop,vnRight-1,vnBottom,vnRight)
* for vnTemp=2 to len(vcScreen) step 2
* vcScreen := stuff(vcScreen,vnTemp,1,chr(vnColor))
* next
* restscreen(vnTop,vnRight-1,vnBottom,vnRight,vcScreen)
* endif
* return (nil)
*
* -or- (NOTE: hard-coded colors!)
* (comment out all but RETURN for max speed)
*
local vnColor := 23 && 23 = 7+(16*1) = 'w/b'
local vlType := .T. && .T. means you're doing a shadow; .F., a hotkey
local vcScreen,vnTemp
*
do case
case vcColor=vcShadow && vcShadow is shadow color
vnColor := 7 && 7 = w/n
*
case vcColor=vcHotKey && vcHotKey is hot key color
vnColor := 62 && 62 = 14+(16*3) = +rg/bg
vlType := .F. && not doing a shadow!
*
otherwise
*
* In this case, newcolor() is intended to "low-light" the browse window
* (w/b) to show it is inactive. You can change the code to do the low-
* lighting (must do a filled box), but it will be very slow. If you
* don't low-light, when browsing two databases on screen it may be
* difficult to tell which window is active. Try setting the color to
* w/b and drawing an unfilled box as a compromise.
*
return (nil)
endcase
*
vcScreen := savescreen(vnBottom,vnLeft,vnBottom,vnRight)
for vnTemp=2 to len(vcScreen) step 2
vcScreen := stuff(vcScreen,vnTemp,1,chr(vnColor))
next
restscreen(vnBottom,vnLeft,vnBottom,vnRight,vcScreen)
*
if vlType
vcScreen := savescreen(vnTop,vnRight-1,vnBottom,vnRight)
for vnTemp=2 to len(vcScreen) step 2
vcScreen := stuff(vcScreen,vnTemp,1,chr(vnColor))
next
restscreen(vnTop,vnRight-1,vnBottom,vnRight,vcScreen)
endif
return (nil)
*
*****************************************************************************
*
function overlay(vcProg,vnDummy,vcDummy1,vcDummy2)
*
* Fakes Overlay 3.5 function of the same name, used to shell to DOS and to
* run the hypertext help program).
*
* A better way to do this could be to
*
* 1) use the new Blinker 2.0 swap function, or
*
* 2) use SET CLIPPER=X:nn and a RUN (the HELP program requires 55K or so
* plus DOS needs anything from about 30K to 40K (DOS 5.0 may need over
* 100K)). If you don't need to run anything too large, don't bother
* with the X:nn parameter.
*
if empty(vcProg)
run command
else
run (vcProg)
endif
*
return (nil)