13
0

stop asking GTK to do include-processing of RC files, since it can't, and get waf to do it at build time

git-svn-id: svn://localhost/ardour2/branches/3.0@10161 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-09-29 15:22:11 +00:00
parent 29902b5731
commit 426d3d8207
3 changed files with 69 additions and 15 deletions

View File

@ -342,6 +342,6 @@ style "inspector_processor_list" = "processor_list"
base[SELECTED] = { 0.3, 0.3, 0.3 }
}
include "ardour3_dark_fonts.rc"
include "ardour3_dark_styles.rc"
include "ardour3_widgets.rc"
##include ardour3_dark_fonts.rc
##include ardour3_dark_styles.rc
##include ardour3_widgets.rc

View File

@ -350,6 +350,6 @@ style "inspector_processor_list" = "processor_list"
base[SELECTED] = { 0.3, 0.3, 0.3 }
}
include "ardour3_light_fonts.rc"
include "ardour3_light_styles.rc"
include "ardour3_widgets.rc"
##include ardour3_light_fonts.rc
##include ardour3_light_styles.rc
##include ardour3_widgets.rc

View File

@ -276,6 +276,46 @@ def set_winegcc(self):
self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
self.env.CC = 'winegcc'
#pre-processor-like operation to merge GTK RC files
re_spaces = re.compile("\s+")
def _doPyp(infileName):
"""
Does the main work of preprocessing.
Takes 'infileName' as a filename, opens and processes it,
and returns the processed file as a string
Note - this works recursively.
"""
outStr = ''
if infileName == '-':
fd = sys.stdin
else:
fd = file(infileName)
inLines = fd.readlines()
if fd != sys.stdin:
fd.close()
for line in inLines:
bits = re_spaces.split(line)
if bits[0] == '##include':
incName = bits[1]
# assume included file comes from same place as source file
incName = os.path.join (os.path.dirname (infileName), incName);
outStr += _doPyp(incName)
else:
outStr += line
# done
return outStr
def include_processor(task):
infileName = task.inputs[0].srcpath(task.env)
outfileName = task.outputs[0].bldpath(task.env)
fdOut = file (outfileName, "w")
fdOut.write (_doPyp(infileName))
fdOut.close ()
def build_color_scheme(path, prefix):
f = open (path, 'r')
color_scheme = ''
@ -469,44 +509,58 @@ def build(bld):
obj = bld.new_task_gen('subst')
obj.source = [ 'ardour3_ui_dark.rc.in' ]
obj.target = 'ardour3_ui_dark.rc'
obj.target = 'ardour3_ui_dark.rc.pre'
obj.dict = dark_rc_subst_dict
obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
obj.install_path = None
obj = bld.new_task_gen('subst')
obj.source = [ 'ardour3_ui_light.rc.in' ]
obj.target = 'ardour3_ui_light.rc'
obj.target = 'ardour3_ui_light.rc.pre'
obj.dict = light_rc_subst_dict
obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
obj.install_path = None
obj = bld.new_task_gen('subst')
obj.source = [ 'ardour3_styles.rc.in' ]
obj.target = 'ardour3_dark_styles.rc'
obj.dict = dark_rc_subst_dict
obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
obj.install_path = None
obj = bld.new_task_gen('subst')
obj.source = [ 'ardour3_styles.rc.in' ]
obj.target = 'ardour3_light_styles.rc'
obj.dict = light_rc_subst_dict
obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
obj.install_path = None
obj = bld.new_task_gen('subst')
obj.source = [ 'ardour3_fonts.rc.in' ]
obj.target = 'ardour3_dark_fonts.rc'
obj.dict = dark_rc_subst_dict
obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
obj.install_path = None
obj = bld.new_task_gen('subst')
obj.source = [ 'ardour3_fonts.rc.in' ]
obj.target = 'ardour3_light_fonts.rc'
obj.dict = light_rc_subst_dict
obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
obj.install_path = None
obj = bld.new_task_gen('copy')
obj.source = [ 'ardour3_widget_list.rc' ]
obj.target = 'ardour3_widgets.rc'
obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
obj.install_path = None
bld.use_the_magic()
bld (
rule = include_processor,
source = 'ardour3_ui_dark.rc.pre',
target = 'ardour3_ui_dark.rc'
)
bld (
rule = include_processor,
source = 'ardour3_ui_light.rc.pre',
target = 'ardour3_ui_light.rc'
)
# Menus
menus_argv = []