start of a nominal debug tracing system, with 64 bits available for flags; track...
authorPaul Davis <paul@linuxaudiosystems.com>
Sat, 24 Oct 2009 13:26:26 +0000 (13:26 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sat, 24 Oct 2009 13:26:26 +0000 (13:26 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5902 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/opts.cc
gtk2_ardour/route_time_axis.cc

index 5d95c4e8a96f8eaf2c702279b563418106fff2ec..917d2a49d798824b6a4a6c9cc2c0e77147a1b14f 100644 (file)
 */
 
 #include <getopt.h>
+#include <string.h>
 #include <iostream>
 #include <cstdlib>
 
+#include "ardour/debug.h"
 #include "ardour/session.h"
 
 #include "opts.h"
@@ -54,6 +56,7 @@ print_help (const char *execname)
             << _("  -b, --bindings                   Print all possible keyboard binding names\n")
             << _("  -c, --name <name>                Use a specific jack client name, default is ardour\n")
             << _("  -d, --disable-plugins            Disable all plugins in an existing session\n")
+            << _("  -D, --debug <options>            Set debug flags. Use \"-D list\" to see available options\n")
             << _("  -n, --show-splash                Show splash screen\n")
             << _("  -m, --menus file                 Use \"file\" for Ardour menus\n")
             << _("  -N, --new session-name           Create a new session from the command line\n")
@@ -71,10 +74,47 @@ print_help (const char *execname)
 
 }
 
+static void
+list_debug_options ()
+{
+       cerr << _("The following debug options are available. Their use is case-insensitive.\n\n");
+       cerr << "\tMidiSourceIO\n";
+}
+
+static int
+parse_debug_options (const char* str)
+{
+       char* p;
+       char* sp;
+       uint64_t bits = 0;
+       char* copy = strdup (str);
+
+       p = strtok_r (copy, ",", &sp);
+
+       while (p) {
+               if (strcasecmp (p, "list") == 0) {
+                       list_debug_options ();
+                       free (copy);
+                       return 1;
+               }
+
+               if (strcasecmp (p, "midisourceio") == 0) {
+                       bits |= ARDOUR::DEBUG::MidiSourceIO;
+               }
+
+               p = strtok_r (0, ",", &sp);
+       }
+       
+       free (copy);
+       ARDOUR::set_debug_bits (bits);
+       return 0;
+}
+
+
 int
 ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
 {
-       const char *optstring = "U:hSbvVnOdc:C:m:N:k:p:E:";
+       const char *optstring = "bc:C:dD:hk:E:m:N:nOp:SU:vV";
        const char *execname = strrchr (argv[0], '/');
 
        if (getenv ("ARDOUR_SAE")) {
@@ -92,6 +132,7 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
                { "version", 0, 0, 'v' },
                { "help", 0, 0, 'h' },
                { "bindings", 0, 0, 'b' },
+               { "debug", 1, 0, 'D' },
                { "show-splash", 0, 0, 'n' },
                { "menus", 1, 0, 'm' },
                { "name", 1, 0, 'c' },
@@ -134,6 +175,12 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
                        ARDOUR::Session::set_disable_all_loaded_plugins (true);
                        break;
 
+               case 'D':
+                       if (parse_debug_options (optarg)) {
+                               exit (0);
+                       }
+                       break;
+                       
                case 'm':
                        menus_file = optarg;
                        break;
index e21e1f734a5e3e7ecced258c3f5ab0b222149f7e..cc39c6fb807ed612a476e1fa20309d643adc6cd2 100644 (file)
@@ -123,6 +123,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
        playlist_menu = 0;
        playlist_action_menu = 0;
        automation_action_menu = 0;
+       mode_menu = 0;
        _view = 0;
 
        if (!_route->is_hidden()) {