fix a-eq grid layout
[ardour.git] / gtk2_ardour / export_filename_selector.cc
index 1ecbc2cf1ebb87c9c0548d0f44f05186f929e596..e16f527a9ce553ccaa44be0302af9f616f77767c 100644 (file)
 
 #include <gtkmm/messagedialog.h>
 
+#include "pbd/openuri.h"
 #include "export_filename_selector.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace ARDOUR;
 
@@ -36,6 +37,7 @@ ExportFilenameSelector::ExportFilenameSelector () :
 
        path_label (_("Folder:"), Gtk::ALIGN_LEFT),
        browse_button (_("Browse")),
+       open_button (_("Open Folder")),
 
        example_filename_label ("", Gtk::ALIGN_LEFT),
        _require_timespan (false)
@@ -48,11 +50,11 @@ ExportFilenameSelector::ExportFilenameSelector () :
        pack_start (example_filename_label, false, false, 12);
 
        include_hbox.pack_start (session_checkbox, false, false, 3);
-       include_hbox.pack_start (timespan_checkbox, false, false, 3);
        include_hbox.pack_start (label_label, false, false, 3);
        include_hbox.pack_start (label_entry, false, false, 3);
        include_hbox.pack_start (revision_checkbox, false, false, 3);
        include_hbox.pack_start (revision_spinbutton, false, false, 3);
+       include_hbox.pack_start (timespan_checkbox, false, false, 3);
        include_hbox.pack_start (date_format_combo, false, false, 3);
        include_hbox.pack_start (time_format_combo, false, false, 3);
 
@@ -61,6 +63,7 @@ ExportFilenameSelector::ExportFilenameSelector () :
        path_hbox.pack_start (path_label, false, false, 3);
        path_hbox.pack_start (path_entry, true, true, 3);
        path_hbox.pack_start (browse_button, false, false, 3);
+       path_hbox.pack_start (open_button, false, false, 3); // maybe Mixbus only ?
 
        path_entry.set_activates_default ();
 
@@ -104,6 +107,7 @@ ExportFilenameSelector::ExportFilenameSelector () :
        revision_spinbutton.signal_value_changed().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_revision_value));
 
        browse_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFilenameSelector::open_browse_dialog));
+       open_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFilenameSelector::open_folder));
 }
 
 ExportFilenameSelector::~ExportFilenameSelector ()
@@ -303,7 +307,17 @@ ExportFilenameSelector::update_timespan_sensitivity ()
                        && !filename->include_format_name) {
                implicit = true;
        }
-       timespan_checkbox.set_inconsistent (implicit);
+
+       // remember prev state, force enable if implicit active.
+       if (implicit && !timespan_checkbox.get_inconsistent()) {
+               timespan_checkbox.set_inconsistent (true);
+               filename->include_timespan = true;
+       }
+       else if (!implicit && timespan_checkbox.get_inconsistent()) {
+               filename->include_timespan = timespan_checkbox.get_active();
+               timespan_checkbox.set_inconsistent (false);
+       }
+
 }
 
 void
@@ -312,6 +326,9 @@ ExportFilenameSelector::change_timespan_selection ()
        if (!filename) {
                return;
        }
+       if (timespan_checkbox.get_inconsistent()) {
+               return;
+       }
 
        filename->include_timespan = timespan_checkbox.get_active();
        CriticalSelectionChanged();
@@ -353,6 +370,18 @@ ExportFilenameSelector::change_revision_value ()
        CriticalSelectionChanged();
 }
 
+void
+ExportFilenameSelector::open_folder ()
+{
+       const std::string& dir (path_entry.get_text());
+       if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR|Glib::FILE_TEST_EXISTS)) {
+               Gtk::MessageDialog msg (string_compose (_("%1: this is not a valid directory/folder."), dir));
+               msg.run ();
+               return;
+       }
+       PBD::open_folder (dir);
+}
+
 void
 ExportFilenameSelector::open_browse_dialog ()
 {