X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fbundle_env_msvc.cc;h=864f9d82882cc6d1c77bfbd966598e5d073b14ac;hb=62937ea1a658786f7615258bfe77af096c73123b;hp=d2c85b79353f2d29e1d411b8390b7fe78e138a0a;hpb=2044c12b7b8ced90073c494b4af6f049e6c6020b;p=ardour.git diff --git a/gtk2_ardour/bundle_env_msvc.cc b/gtk2_ardour/bundle_env_msvc.cc index d2c85b7935..864f9d8288 100644 --- a/gtk2_ardour/bundle_env_msvc.cc +++ b/gtk2_ardour/bundle_env_msvc.cc @@ -18,6 +18,7 @@ */ #include "bundle_env.h" +#include "i18n.h" #include #include @@ -28,7 +29,9 @@ #include #include -#include +#include "pbd/gstdio_compat.h" + +#include #include "ardour/ardour.h" #include "ardour/search_paths.h" @@ -83,7 +86,7 @@ std::string ret; if (0 == pExeRoot) { pExeRoot = g_build_filename("C:\\", "Program Files", PROGRAM_NAME, 0); } - + if (pExeRoot) { gchar tmp[PATH_MAX+1]; gchar* p; @@ -158,6 +161,13 @@ bool succeeded = false; // Replace our token with the drive letter (and colon) for the user's Windows volume str_replace_with = get_windows_drive_volume_letter(); + // Replace the first occurrence of our token with the required string + i->erase(token_begin, ((token_end+1)-token_begin)); + i->insert(token_begin, str_replace_with); + } else if (0 == str_to_replace.compare("$(LOCALCACHEDIR)")){ + // Replace our token with the path to our Ardour cache directory + str_replace_with = user_cache_directory(); + // Replace the first occurrence of our token with the required string i->erase(token_begin, ((token_end+1)-token_begin)); i->insert(token_begin, str_replace_with); @@ -176,7 +186,7 @@ bool succeeded = false; i->insert(token_begin, str_replace_with); } else { error = true; - cerr << "ERROR: unknown environment variable" << endl; + cerr << _("ERROR: unknown environment variable") << endl; } } } @@ -209,7 +219,7 @@ bool succeeded = false; succeeded = false; } } else { - cerr << "ERROR: Could not open config file '" << str_file_to_fix << "'" << endl; + cerr << _("ERROR: Could not open config file '") << str_file_to_fix << "'" << endl; } return succeeded; @@ -222,20 +232,20 @@ string fonts_conf_file; #ifdef DEBUG fonts_conf_file = get_module_folder(); - + if (!fonts_conf_file.empty()) { fonts_conf_file += "\\"; fonts_conf_file += PROGRAM_NAME; fonts_conf_file += FONTS_CONF_LOCATION; #else - if (PBD::find_file_in_search_path (ARDOUR::ardour_config_search_path(), "fonts.conf", fonts_conf_file)) { + if (PBD::find_file (ARDOUR::ardour_config_search_path(), "fonts.conf", fonts_conf_file)) { #endif Glib::setenv ("FONTCONFIG_FILE", fonts_conf_file, true); if (0 == fixup_config_file (fonts_conf_file)) - cerr << "ERROR: processing error for 'fonts.conf' file" << endl; + cerr << _("ERROR: processing error for 'fonts.conf' file") << endl; } else { - cerr << "ERROR: Malformed module folder (fonts.conf)" << endl; + cerr << _("ERROR: Malformed module folder (fonts.conf)") << endl; } } @@ -247,7 +257,7 @@ string pango_modules_file; #if defined(DEBUG) || defined(RDC_BUILD) // Make sure we pick up the debuggable DLLs !!! pango_modules_file = get_module_folder(); - + if (!pango_modules_file.empty()) { pango_modules_file += "\\"; pango_modules_file += PROGRAM_NAME; @@ -261,7 +271,7 @@ string pango_modules_file; #endif pango_modules_path.resize (pango_modules_path.size()-14); // Remove "/pango.modules" from the end #else - if (PBD::find_file_in_search_path (ARDOUR::ardour_config_search_path(), "pango.modules", pango_modules_file)) { + if (PBD::find_file (ARDOUR::ardour_config_search_path(), "pango.modules", pango_modules_file)) { Glib::ustring pango_modules_path = pango_modules_file; pango_modules_path.resize (pango_modules_path.size()-14); // Remove "/pango.modules" from the end @@ -271,9 +281,9 @@ string pango_modules_file; Glib::setenv ("PANGO_MODULE_PATH", Glib::filename_from_utf8(pango_modules_path), true); if (0 == fixup_config_file (pango_modules_file)) - cerr << "ERROR: processing error for 'pango.modules' file" << endl; + cerr << _("ERROR: processing error for 'pango.modules' file") << endl; } else { - cerr << "ERROR: Malformed module folder (pango.modules)" << endl; + cerr << _("ERROR: Malformed module folder (pango.modules)") << endl; } } @@ -285,21 +295,21 @@ string gdk_pixbuf_loaders_file; #if defined(DEBUG) || defined(RDC_BUILD) // Make sure we pick up the debuggable DLLs !!! gdk_pixbuf_loaders_file = get_module_folder(); - + if (!gdk_pixbuf_loaders_file.empty()) { gdk_pixbuf_loaders_file += "\\"; gdk_pixbuf_loaders_file += PROGRAM_NAME; gdk_pixbuf_loaders_file += PIXBUFLOADERS_CONF_LOCATION; #else - if (PBD::find_file_in_search_path (ARDOUR::ardour_config_search_path(), "gdk-pixbuf.loaders", gdk_pixbuf_loaders_file)) { + if (PBD::find_file (ARDOUR::ardour_config_search_path(), "gdk-pixbuf.loaders", gdk_pixbuf_loaders_file)) { #endif // Set an environment variable so we can find our pixbuf modules. Glib::setenv ("GDK_PIXBUF_MODULE_FILE", Glib::filename_from_utf8(gdk_pixbuf_loaders_file), true); if (0 == fixup_config_file (gdk_pixbuf_loaders_file)) - cerr << "ERROR: processing error for 'gdk-pixbuf.loaders' file" << endl; + cerr << _("ERROR: processing error for 'gdk-pixbuf.loaders' file") << endl; } else { - cerr << "ERROR: Malformed module folder (gdk-pixbuf.loaders)" << endl; + cerr << _("ERROR: Malformed module folder (gdk-pixbuf.loaders)") << endl; } } @@ -311,27 +321,27 @@ string clearlooks_la_file; #if defined(DEBUG) || defined(RDC_BUILD) // Make sure we pick up the debuggable DLLs !!! clearlooks_la_file = get_module_folder(); - + if (!clearlooks_la_file.empty()) { clearlooks_la_file += "\\"; clearlooks_la_file += PROGRAM_NAME; clearlooks_la_file += CLEARLOOKS_CONF_LOCATION; #else - if (PBD::find_file_in_search_path (ARDOUR::ardour_config_search_path(), "libclearlooks.la", clearlooks_la_file)) { + if (PBD::find_file (ARDOUR::ardour_config_search_path(), "libclearlooks.la", clearlooks_la_file)) { #endif // Set an environment variable so we can find our clearlooks engine. // Note that this requires a modified version of libgtk (gtkthemes.c) Glib::setenv ("GTK_THEME_ENGINE_FILE", Glib::filename_from_utf8(clearlooks_la_file).c_str(), true); if (0 == fixup_config_file (clearlooks_la_file)) - cerr << "ERROR: processing error for 'clearlooks.la' file" << endl; + cerr << _("ERROR: processing error for 'clearlooks.la' file") << endl; } else { - cerr << "ERROR: Malformed module folder (clearlooks.la)" << endl; + cerr << _("ERROR: Malformed module folder (clearlooks.la)") << endl; } } void -fixup_bundle_environment (int argc, char* argv[], const char** localedir) +fixup_bundle_environment (int argc, char* argv[], string & localedir) { std::string exec_path = argv[0]; std::string dir_path = Glib::path_get_dirname (exec_path); @@ -401,6 +411,10 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir) Glib::setenv ("LADSPA_PATH", path, true); + // Next, set up 'SUIL_MODULE_DIR' + Glib::setenv ("SUIL_MODULE_DIR", Glib::build_filename(ardour_dll_directory(), "suil"), true); + + // Next, set up 'VAMP_PATH' cstr = getenv ("VAMP_PATH"); if (cstr) { @@ -434,6 +448,9 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir) path = windows_search_path().to_string(); path += "\\locale"; Glib::setenv ("GTK_LOCALEDIR", path, true); + + // and return the same path to our caller + localedir = path; } @@ -450,8 +467,8 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir) Glib::setenv ("GTK_PATH", path, true); - // Unset GTK_RC_FILES so that we only load the RC files that we define - Glib::unsetenv ("GTK_RC_FILES"); + // Unset GTK2_RC_FILES so that we only load the RC files that we define + Glib::unsetenv ("GTK2_RC_FILES"); // and set a '$HOME' environment variable. This variable changes the value returned @@ -462,12 +479,35 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir) } fixup_fonts_config(); - fixup_pango_config(); fixup_clearlooks_config(); + +#ifdef DLL_PIXBUF_LOADERS fixup_pixbuf_loaders_config(); +#endif +#ifdef DLL_PANGO_MODULES + fixup_pango_config(); +#endif } -void load_custom_fonts() +void load_custom_fonts() { + std::string ardour_mono_file; + + if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) { + cerr << _("Cannot find ArdourMono TrueType font") << endl; + } + + FcConfig *config = FcInitLoadConfigAndFonts(); + FcBool ret = FcConfigAppFontAddFile(config, reinterpret_cast(ardour_mono_file.c_str())); + + if (ret == FcFalse) { + cerr << _("Cannot load ArdourMono TrueType font.") << endl; + } + + ret = FcConfigSetCurrent(config); + + if (ret == FcFalse) { + cerr << _("Failed to set fontconfig configuration.") << endl; + } }