1995-01-30 11:53:55 +00:00
|
|
|
# Scan <Controls.h>, generating ctlgen.py.
|
1998-04-17 14:07:56 +00:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
|
|
|
|
sys.path.append(BGENDIR)
|
1995-01-30 11:53:55 +00:00
|
|
|
|
|
|
|
from scantools import Scanner
|
1996-04-12 16:26:59 +00:00
|
|
|
from bgenlocations import TOOLBOXDIR
|
1995-01-30 11:53:55 +00:00
|
|
|
|
|
|
|
def main():
|
|
|
|
input = "Controls.h"
|
|
|
|
output = "ctlgen.py"
|
1996-04-12 16:26:59 +00:00
|
|
|
defsoutput = TOOLBOXDIR + "Controls.py"
|
1995-01-30 11:53:55 +00:00
|
|
|
scanner = MyScanner(input, output, defsoutput)
|
|
|
|
scanner.scan()
|
|
|
|
scanner.close()
|
|
|
|
print "=== Done scanning and generating, now doing 'import ctlsupport' ==="
|
|
|
|
import ctlsupport
|
|
|
|
print "=== Done. It's up to you to compile Ctlmodule.c ==="
|
|
|
|
|
|
|
|
class MyScanner(Scanner):
|
|
|
|
|
|
|
|
def destination(self, type, name, arglist):
|
|
|
|
classname = "Function"
|
|
|
|
listname = "functions"
|
|
|
|
if arglist:
|
|
|
|
t, n, m = arglist[0]
|
1995-06-06 12:55:40 +00:00
|
|
|
if t in ("ControlHandle", "ControlRef") and m == "InMode":
|
1995-01-30 11:53:55 +00:00
|
|
|
classname = "Method"
|
|
|
|
listname = "methods"
|
|
|
|
return classname, listname
|
|
|
|
|
1998-02-20 16:02:09 +00:00
|
|
|
def writeinitialdefs(self):
|
|
|
|
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
|
|
|
|
self.defsfile.write("from TextEdit import *\n")
|
|
|
|
self.defsfile.write("from QuickDraw import *\n")
|
|
|
|
self.defsfile.write("\n")
|
|
|
|
|
1995-01-30 11:53:55 +00:00
|
|
|
def makeblacklistnames(self):
|
|
|
|
return [
|
1996-10-01 10:46:46 +00:00
|
|
|
'DisposeControl', # Generated manually
|
1995-01-30 11:53:55 +00:00
|
|
|
'KillControls', # Implied by close of dialog
|
|
|
|
'SetCtlAction',
|
1998-02-20 16:02:09 +00:00
|
|
|
'kControlBevelButtonCenterPopupGlyphTag', # Constant with funny definition
|
|
|
|
'kControlProgressBarIndeterminateTag', # ditto
|
|
|
|
# The following are unavailable for static 68k (appearance manager)
|
|
|
|
'GetBevelButtonMenuValue',
|
|
|
|
'SetBevelButtonMenuValue',
|
|
|
|
'GetBevelButtonMenuHandle',
|
|
|
|
'SetBevelButtonTransform',
|
|
|
|
'SetBevelButtonGraphicAlignment',
|
|
|
|
'SetBevelButtonTextAlignment',
|
|
|
|
'SetBevelButtonTextPlacement',
|
|
|
|
'SetImageWellTransform',
|
|
|
|
'GetTabContentRect',
|
|
|
|
'SetTabEnabled',
|
|
|
|
'SetDisclosureTriangleLastValue',
|
1995-01-30 11:53:55 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
def makeblacklisttypes(self):
|
|
|
|
return [
|
|
|
|
'ProcPtr',
|
1995-06-06 12:55:40 +00:00
|
|
|
'ControlActionUPP',
|
1998-02-20 16:02:09 +00:00
|
|
|
'ControlButtonContentInfoPtr',
|
|
|
|
'Ptr',
|
1995-01-30 11:53:55 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
def makerepairinstructions(self):
|
|
|
|
return [
|
|
|
|
([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
|
|
|
|
[("InBuffer", "*", "*")]),
|
|
|
|
|
|
|
|
([("void", "*", "OutMode"), ("long", "*", "InMode"),
|
|
|
|
("long", "*", "OutMode")],
|
|
|
|
[("VarVarOutBuffer", "*", "InOutMode")]),
|
|
|
|
|
|
|
|
# For TrackControl
|
|
|
|
([("ProcPtr", "actionProc", "InMode")],
|
|
|
|
[("FakeType('(ControlActionUPP)0')", "*", "*")]),
|
1995-06-06 12:55:40 +00:00
|
|
|
([("ControlActionUPP", "actionProc", "InMode")],
|
|
|
|
[("FakeType('(ControlActionUPP)0')", "*", "*")]),
|
1995-01-30 11:53:55 +00:00
|
|
|
|
|
|
|
([("ControlHandle", "*", "OutMode")],
|
|
|
|
[("ExistingControlHandle", "*", "*")]),
|
1995-06-06 12:55:40 +00:00
|
|
|
([("ControlRef", "*", "OutMode")], # Ditto, for Universal Headers
|
|
|
|
[("ExistingControlHandle", "*", "*")]),
|
1995-01-30 11:53:55 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|