remove timebar canvas item from markers
[ardour.git] / gtk2_ardour / main.cc
index 4b9136626a1ae5617aadb14413e27d92ad36a302..5dd3695dc9036b9fdb0209c49b873b61b60e3cc2 100644 (file)
@@ -57,6 +57,9 @@
 
 #include "i18n.h"
 
+#ifdef COMPILER_MSVC
+#include <fcntl.h> // Needed for '_fmode'
+#endif
 
 using namespace std;
 using namespace Gtk;
@@ -138,24 +141,38 @@ sigpipe_handler (int /*signal*/)
        }
 }
 
-#ifdef WINDOWS_VST_SUPPORT
-#ifndef PLATFORM_WINDOWS
+#if (defined(COMPILER_MSVC) && defined(NDEBUG) && !defined(RDC_BUILD))
+/*
+ *  Release build with MSVC uses ardour_main()
+ */
+int ardour_main (int argc, char *argv[])
+
+#elif (defined WINDOWS_VST_SUPPORT && !defined PLATFORM_WINDOWS)
+
+// prototype for function in windows_vst_plugin_ui.cc
 extern int windows_vst_gui_init (int* argc, char** argv[]);
-#endif
 
 /* this is called from the entry point of a wine-compiled
    executable that is linked against gtk2_ardour built
    as a shared library.
 */
 extern "C" {
+
 int ardour_main (int argc, char *argv[])
+
 #else
 int main (int argc, char *argv[])
 #endif
 {
+#ifdef COMPILER_MSVC
+       // Essential!!  Make sure that any files used by Ardour
+       //              will be created or opened in BINARY mode!
+       _fmode = O_BINARY;
+#endif
+
        fixup_bundle_environment (argc, argv, &localedir);
 
-       load_custom_fonts(); /* needs to happend before any gtk and pango init calls */
+       load_custom_fonts(); /* needs to happen before any gtk and pango init calls */
 
        if (!Glib::thread_supported()) {
                Glib::thread_init();
@@ -165,17 +182,15 @@ int main (int argc, char *argv[])
        gtk_set_locale ();
 #endif
 
-#ifdef WINDOWS_VST_SUPPORT
-#ifndef PLATFORM_WINDOWS
-       /* this does some magic that is needed to make GTK and Wine's own
-          X11 client interact properly.
-       */
+#if (defined WINDOWS_VST_SUPPORT && !defined PLATFORM_WINDOWS)
+       /* this does some magic that is needed to make GTK and X11 client interact properly.
+        * the platform dependent code is in windows_vst_plugin_ui.cc
+        */
        windows_vst_gui_init (&argc, &argv);
 #endif
-#endif
 
 #ifdef ENABLE_NLS
-       cerr << "bnd txt domain [" << PACKAGE << "] to " << localedir << endl;
+       cerr << "bind txt domain [" << PACKAGE << "] to " << localedir << endl;
 
        (void) bindtextdomain (PACKAGE, localedir);
        /* our i18n translations are all in UTF-8, so make sure
@@ -201,6 +216,16 @@ int main (int argc, char *argv[])
 #endif
 
        if (parse_opts (argc, argv)) {
+#if (defined(COMPILER_MSVC) && defined(NDEBUG) && !defined(RDC_BUILD))
+        // Since we don't ordinarily have access to stdout and stderr with
+        // an MSVC app, let the user know we encountered a parsing error.
+        Gtk::Main app(&argc, &argv); // Calls 'gtk_init()'
+
+        Gtk::MessageDialog dlgReportParseError (_("\n   Ardour could not understand your command line      "),
+                                                      false, MESSAGE_ERROR, BUTTONS_CLOSE, true);
+        dlgReportParseError.set_title (_("An error was encountered while launching Ardour"));
+               dlgReportParseError.run ();
+#endif
                exit (1);
        }
 
@@ -263,7 +288,6 @@ int main (int argc, char *argv[])
 
        return 0;
 }
-#ifdef WINDOWS_VST_SUPPORT
-} // end of extern C block
+#if (defined WINDOWS_VST_SUPPORT && !defined PLATFORM_WINDOWS)
+} // end of extern "C" block
 #endif
-