From 426d3d8207881b3e84ea8e770ec7118f04c57771 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 29 Sep 2011 15:22:11 +0000 Subject: 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 --- gtk2_ardour/ardour3_ui_dark.rc.in | 6 ++-- gtk2_ardour/ardour3_ui_light.rc.in | 6 ++-- gtk2_ardour/wscript | 72 +++++++++++++++++++++++++++++++++----- 3 files changed, 69 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/ardour3_ui_dark.rc.in b/gtk2_ardour/ardour3_ui_dark.rc.in index b425c9980e..0846c2d6ce 100644 --- a/gtk2_ardour/ardour3_ui_dark.rc.in +++ b/gtk2_ardour/ardour3_ui_dark.rc.in @@ -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 diff --git a/gtk2_ardour/ardour3_ui_light.rc.in b/gtk2_ardour/ardour3_ui_light.rc.in index fa9d0bda1f..edc75c5a89 100644 --- a/gtk2_ardour/ardour3_ui_light.rc.in +++ b/gtk2_ardour/ardour3_ui_light.rc.in @@ -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 diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index dd7d2f544b..8f1468c600 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -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 = [] -- cgit v1.2.3