X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=gtk2_ardour%2Fexport_file_notebook.cc;h=54c0f628c7cf6fabad1d95bce3175aaa0310c088;hb=dd8c5f9144470433bbedf932fcff65fc9630402b;hp=5961715d835450972221db171c08fa6cf4d07fe7;hpb=aae367b63c9b619db1e40f27dc334c6987219481;p=ardour.git diff --git a/gtk2_ardour/export_file_notebook.cc b/gtk2_ardour/export_file_notebook.cc index 5961715d83..54c0f628c7 100644 --- a/gtk2_ardour/export_file_notebook.cc +++ b/gtk2_ardour/export_file_notebook.cc @@ -22,10 +22,12 @@ #include "ardour/export_format_specification.h" +#include "gui_thread.h" #include "utils.h" #include "i18n.h" using namespace ARDOUR; +using namespace PBD; ExportFileNotebook::ExportFileNotebook () : page_counter (1) @@ -33,7 +35,7 @@ ExportFileNotebook::ExportFileNotebook () : /* Last page */ new_file_button.set_image (*Gtk::manage (new Gtk::Image (::get_icon("add")))); - new_file_button.set_label (_(" Click here to add another format")); + new_file_button.set_label (_("Add another format")); new_file_button.set_alignment (0, 0.5); new_file_button.set_relief (Gtk::RELIEF_NONE); @@ -87,7 +89,17 @@ ExportFileNotebook::sync_with_manager () CriticalSelectionChanged (); } -Glib::ustring +void +ExportFileNotebook::update_example_filenames() +{ + int i = 0; + FilePage * page; + while ((page = dynamic_cast (get_nth_page (i++)))) { + page->update_example_filename(); + } +} + +std::string ExportFileNotebook::get_nth_format_name (uint32_t n) { FilePage * page; @@ -196,14 +208,16 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, tab_close_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*parent, &ExportFileNotebook::remove_file_page), this)); - profile_manager->FormatListChanged.connect (format_connection, boost::bind (&ExportFormatSelector::update_format_list, &format_selector)); + profile_manager->FormatListChanged.connect (format_connection, invalidator (*this), boost::bind (&ExportFormatSelector::update_format_list, &format_selector), gui_context()); format_selector.FormatEdited.connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::save_format_to_manager)); format_selector.FormatRemoved.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::remove_format_profile)); format_selector.NewFormat.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::get_new_format)); - format_selector.CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::update_tab_label)); - filename_selector.CriticalSelectionChanged.connect (CriticalSelectionChanged.make_slot()); + format_selector.CriticalSelectionChanged.connect ( + sigc::mem_fun (*this, &ExportFileNotebook::FilePage::critical_selection_changed)); + filename_selector.CriticalSelectionChanged.connect ( + sigc::mem_fun (*this, &ExportFileNotebook::FilePage::critical_selection_changed)); /* Tab widget */ @@ -215,6 +229,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, tab_widget.pack_end (tab_close_alignment, false, false, 0); tab_widget.show_all_children (); update_tab_label (); + update_example_filename(); /* Done */ @@ -231,13 +246,13 @@ ExportFileNotebook::FilePage::set_remove_sensitive (bool value) tab_close_button.set_sensitive (value); } -Glib::ustring +std::string ExportFileNotebook::FilePage::get_format_name () const { if (format_state && format_state->format) { return format_state->format->name(); } - return "No format!"; + return _("No format!"); } void @@ -249,6 +264,32 @@ ExportFileNotebook::FilePage::save_format_to_manager (FormatPtr format) void ExportFileNotebook::FilePage::update_tab_label () { - tab_label.set_text (string_compose ("Format %1: %2", tab_number, get_format_name())); + tab_label.set_text (string_compose (_("Format %1: %2"), tab_number, get_format_name())); +} + +void +ExportFileNotebook::FilePage::update_example_filename() +{ + if (profile_manager) { + + std::string example; + if (format_state->format) { + example = profile_manager->get_sample_filename_for_format ( + filename_state->filename, format_state->format); + } + + if (example != "") { + filename_selector.set_example_filename(Glib::path_get_basename (example)); + } else { + filename_selector.set_example_filename(""); + } + } +} + +void +ExportFileNotebook::FilePage::critical_selection_changed () +{ + update_tab_label(); + update_example_filename(); CriticalSelectionChanged(); }