Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to modify Beautify tool's default values?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00993929
Message ID:
00994149
Views:
31
>I want to know how can I modify the Beautify tool's default values. I've seen than there's a file called beautify.prg, but I can't find how to assign it default values to Beautify tool.
*-- Sample code with the information for directly calling Beatify.app
Local cinputfile, coptions, coutputfile, obopt

cinputfile = 'viewcode.prg'

*-- Beautify options object
obopt = CreateObject('beautyfyopt')
obopt.keywordcap = 2
obopt.identspace = 2

*-- Get the string of options
coptions = obopt.GetOptionsStr()
*-- Call beautify.app
coutputfile = Beautify(cinputfile, coptions)

*-- View the result of beautify (temporary file)
Modify command (coutputfile)
Return

*-- Define the options required by beautify.app
Define Class BeautyfyOpt As Custom

  *-- 1-Upper case, 2-Lowercase, 3-Match first, 4-Nochange
  symbolscap = 3

  *-- 1-Uppercase, 2-Lower case, 3-Mixed Case, 4-No change
  keywordcap = 3

  identspace = 4

  *-- 1-tabs, 2-space, 3-nochange
  typeofident = 2

  identcomments = .f.
  identcontinuation = .t.
  extraidentproc = .f.
  extraidentdocase = .f.

  Function GetOptionsStr
    Local cstropt

    cstropt = Replicate(chr(0), 36)

    cstropt = stuff(cstropt, 1, 1, chr(this.symbolscap))
    cstropt = stuff(cstropt,  5, 1, chr(this.keywordcap))
    cstropt = stuff(cstropt,  9, 1, chr(this.identspace))
    cstropt = stuff(cstropt, 13, 1, chr(this.typeofident))
    cstropt = stuff(cstropt, 21, 1, chr(iif(this.identcomments,1,0)))
    cstropt = stuff(cstropt, 25, 1, chr(iif(this.identcontinuation,1,0)))
    cstropt = stuff(cstropt, 29, 1, chr(iif(this.extraidentproc,1,0)))
    cstropt = stuff(cstropt, 33, 1, chr(iif(this.extraidentdocase,1,0)))

    Return cstropt
  EndFunc

EndDefine

Just an opinion... Not a fact.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform