part two of allow markup to be used in BoolOption items in an option editor
[ardour.git] / gtk2_ardour / ardour_ui.cc
index ff65a683e01700c34586698f075f6be56b91929c..5846fa577fb88073a2ba14f8861065124d9b3532 100644 (file)
@@ -35,6 +35,8 @@
 #include <iostream>
 
 #include <sys/resource.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
 
 #include <gtkmm/messagedialog.h>
 #include <gtkmm/accelmap.h>
@@ -129,7 +131,7 @@ sigc::signal<void>      ARDOUR_UI::RapidScreenUpdate;
 sigc::signal<void>      ARDOUR_UI::SuperRapidScreenUpdate;
 sigc::signal<void, framepos_t, bool, framepos_t> ARDOUR_UI::Clock;
 
-ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
+ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
 
        : Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp)
 
@@ -165,7 +167,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
        , _feedback_exists (false)
 
 {
-       Gtkmm2ext::init();
+       Gtkmm2ext::init(localedir);
 
        about = 0;
        splash = 0;
@@ -264,16 +266,13 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
        /* lets get this party started */
 
        try {
-               if (ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization)) {
+               if (ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization, localedir)) {
                        throw failed_constructor ();
                }
 
                setup_gtk_ardour_enums ();
                setup_profile ();
 
-               GainMeter::setup_slider_pix ();
-               RouteTimeAxisView::setup_slider_pix ();
-               ProcessorEntry::setup_slider_pix ();
                SessionEvent::create_per_thread_pool ("GUI", 512);
 
        } catch (failed_constructor& err) {
@@ -662,8 +661,14 @@ ARDOUR_UI::check_memory_locking ()
                struct rlimit limits;
                int64_t ram;
                long pages, page_size;
-
-               if ((page_size = sysconf (_SC_PAGESIZE)) < 0 ||(pages = sysconf (_SC_PHYS_PAGES)) < 0) {
+#ifdef __FreeBSD__
+               size_t pages_len=sizeof(pages);
+               if ((page_size = getpagesize()) < 0 ||
+                               sysctlbyname("hw.availpages", &pages, &pages_len, NULL, 0))
+#else
+               if ((page_size = sysconf (_SC_PAGESIZE)) < 0 ||(pages = sysconf (_SC_PHYS_PAGES)) < 0)
+#endif
+               {
                        ram = 0;
                } else {
                        ram = (int64_t) pages * (int64_t) page_size;
@@ -683,8 +688,14 @@ ARDOUR_UI::check_memory_locking ()
                                                  "This might cause %1 to run out of memory before your system "
                                                  "runs out of memory. \n\n"
                                                  "You can view the memory limit with 'ulimit -l', "
-                                                 "and it is normally controlled by /etc/security/limits.conf"),
-                                               PROGRAM_NAME).c_str());
+                                                 "and it is normally controlled by %2"),
+                                               PROGRAM_NAME).c_str(), 
+#ifdef __FreeBSD__
+                                       X_("/etc/login.conf")
+#else
+                                       X_(" /etc/security/limits.conf")
+#endif
+                                       );
 
                                msg.set_default_response (RESPONSE_OK);
 
@@ -1177,6 +1188,7 @@ ARDOUR_UI::redisplay_recent_sessions ()
 
                row[recent_session_columns.visible_name] = Glib::path_get_basename (fullpath);
                row[recent_session_columns.fullpath] = fullpath;
+               row[recent_session_columns.tip] = Glib::Markup::escape_text (fullpath);
 
                if (state_file_names.size() > 1) {
 
@@ -1190,11 +1202,12 @@ ARDOUR_UI::redisplay_recent_sessions ()
 
                                child_row[recent_session_columns.visible_name] = *i2;
                                child_row[recent_session_columns.fullpath] = fullpath;
+                               child_row[recent_session_columns.tip] = Glib::Markup::escape_text (fullpath);
                        }
                }
        }
 
-       recent_session_display.set_tooltip_column(1); // recent_session_columns.fullpath
+       recent_session_display.set_tooltip_column(1); // recent_session_columns.tip
        recent_session_display.set_model (recent_session_model);
 }
 
@@ -1382,11 +1395,7 @@ ARDOUR_UI::session_add_mixed_track (const ChanCount& input, const ChanCount& out
                tracks = _session->new_midi_track (input, output, instrument, ARDOUR::Normal, route_group, how_many, name_template);
                
                if (tracks.size() != how_many) {
-                       if (how_many == 1) {
-                               error << _("could not create a new mixed track") << endmsg;
-                       } else {
-                               error << string_compose (_("could not create %1 new mixed tracks"), how_many) << endmsg;
-                       }
+                       error << string_compose(P_("could not create %1 new mixed track", "could not create %1 new mixed tracks", how_many), how_many) << endmsg;
                }
        }
 
@@ -1963,8 +1972,9 @@ JACK, reconnect and save the session."), PROGRAM_NAME);
 
        MessageDialog msg (*editor, msgstr);
        pop_back_splash (msg);
+       msg.set_keep_above (true);
        msg.run ();
-
+       
        if (free_reason) {
                free (const_cast<char*> (reason));
        }
@@ -2889,8 +2899,7 @@ ARDOUR_UI::hide_splash ()
 }
 
 void
-ARDOUR_UI::display_cleanup_results (ARDOUR::CleanupReport& rep, const gchar* list_title,
-                                   const string& plural_msg, const string& singular_msg)
+ARDOUR_UI::display_cleanup_results (ARDOUR::CleanupReport& rep, const gchar* list_title, const bool msg_delete)
 {
        size_t removed;
 
@@ -2972,10 +2981,26 @@ require some unused files to continue to exist."));
                space_adjusted = truncf((float)rep.space / (1000.0 * 1000 * 1000.0));
        }
 
-       if (removed > 1) {
-               txt.set_markup (string_compose (plural_msg, removed, Glib::Markup::escape_text (dead_directory), space_adjusted, bprefix, PROGRAM_NAME));
+       if (msg_delete) {
+               txt.set_markup (string_compose (P_("\
+The following file was deleted from %2,\n\
+releasing %3 %4bytes of disk space", "\
+The following %1 files were deleted from %2,\n\
+releasing %3 %4bytes of disk space", removed),
+                                       removed, Glib::Markup::escape_text (dead_directory), space_adjusted, bprefix, PROGRAM_NAME));
        } else {
-               txt.set_markup (string_compose (singular_msg, removed, Glib::Markup::escape_text (dead_directory), space_adjusted, bprefix, PROGRAM_NAME));
+               txt.set_markup (string_compose (P_("\
+The following file was not in use and \n\
+has been moved to: %2\n\n\
+After a restart of %5\n\n\
+<span face=\"mono\">Session -> Clean-up -> Flush Wastebasket</span>\n\n\
+will release an additional %3 %4bytes of disk space.\n", "\
+The following %1 files were not in use and \n\
+have been moved to: %2\n\n\
+After a restart of %5\n\n\
+<span face=\"mono\">Session -> Clean-up -> Flush Wastebasket</span>\n\n\
+will release an additional %3 %4bytes of disk space.\n", removed),
+                                       removed, Glib::Markup::escape_text (dead_directory), space_adjusted, bprefix, PROGRAM_NAME));
        }
 
        dhbox.pack_start (*dimage, true, false, 5);
@@ -3069,22 +3094,7 @@ Clean-up will move all unused files to a \"dead\" location."));
        editor->finish_cleanup ();
 
        checker.hide();
-       display_cleanup_results (rep,
-                                _("Cleaned Files"),
-                                _("\
-The following %1 files were not in use and \n\
-have been moved to: %2\n\n\
-After a restart of %5\n\n\
-<span face=\"mono\">Session -> Clean-up -> Flush Wastebasket</span>\n\n\
-will release an additional %3 %4bytes of disk space.\n"),
-                                _("\
-The following file was not in use and \n\
-has been moved to: %2\n\n\
-After a restart of %5\n\n\
-<span face=\"mono\">Session -> Clean-up -> Flush Wastebasket</span>\n\n\
-will release an additional %3 %4bytes of disk space.\n"
-                                        ));
-
+       display_cleanup_results (rep, _("Cleaned Files"), false);
 }
 
 void
@@ -3101,12 +3111,7 @@ ARDOUR_UI::flush_trash ()
                return;
        }
 
-       display_cleanup_results (rep,
-                                _("deleted file"),
-                                _("The following %1 files were deleted from %2,\n\
-releasing %3 %4bytes of disk space"),
-                                _("The following file was deleted from %2,\n\
-releasing %3 %4bytes of disk space"));
+       display_cleanup_results (rep, _("deleted file"), true);
 }
 
 void
@@ -3350,8 +3355,8 @@ ARDOUR_UI::pending_state_dialog ()
        Image* image = new Image (Stock::DIALOG_QUESTION, ICON_SIZE_DIALOG);
        ArdourDialog dialog (_("Crash Recovery"), true);
        Label  message (string_compose (_("\
-This session appears to have been in\n\
-middle of recording when ardour or\n\
+This session appears to have been in the\n\
+middle of recording when %1 or\n\
 the computer was shutdown.\n\
 \n\
 %1 can recover any captured audio for\n\
@@ -3381,7 +3386,7 @@ int
 ARDOUR_UI::sr_mismatch_dialog (framecnt_t desired, framecnt_t actual)
 {
        HBox* hbox = new HBox();
-       Image* image = new Image (Stock::DIALOG_QUESTION, ICON_SIZE_DIALOG);
+       Image* image = new Image (Stock::DIALOG_WARNING, ICON_SIZE_DIALOG);
        ArdourDialog dialog (_("Sample Rate Mismatch"), true);
        Label  message (string_compose (_("\
 This session was created with a sample rate of %1 Hz, but\n\