Remove the ART_ID workaround

This commit is contained in:
Robin Dunn
2020-09-10 13:48:26 -07:00
parent 4b9b8ad93e
commit 8b839328d4

View File

@@ -52,37 +52,6 @@ def run():
# deprecated and removed
c.find('Insert').ignore()
# TEMPORARY WORKAROUND: The following will likely not be needed after an update to the
# newest wxWidgets master...
#
# In C++ the art constants are actually macros that create a wxString on the fly, and
# that doesn't work in the generated wrapper code because it tries to take the address
# of the ID, but in reality it's a temporary object. So we'll create a new set of
# globals which are actual global variables.
artConsts = list()
newConsts = list()
newConsts_cpp = list()
for item in module:
if isinstance(item, etgtools.GlobalVarDef):
if item.type in ['wxArtClient', 'wxArtID']:
artConsts.append(item)
# Make a new GlobalVarDef with the wx-less name as a wxString
name = old_name = item.name
name = name.replace('wx', '')
gvd = etgtools.GlobalVarDef(type=item.type, name=name)
newConsts.append(gvd)
# add some c++ code to implement that new constant
newConsts_cpp.append('{} {}({});'.format(item.type, name, old_name))
# Now remove the old, add the new, and insert the c++ code
for item in artConsts:
module.items.remove(item)
for item in newConsts:
module.items.insert(0, item)
module.addCppCode('\n'.join(newConsts_cpp))
#-----------------------------------------------------------------
tools.doCommonTweaks(module)