sfdb almost done.
authorTaybin Rutkin <taybin@taybin.com>
Thu, 13 Oct 2005 03:48:57 +0000 (03:48 +0000)
committerTaybin Rutkin <taybin@taybin.com>
Thu, 13 Oct 2005 03:48:57 +0000 (03:48 +0000)
git-svn-id: svn://localhost/trunk/ardour2@60 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/add_route_dialog.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/option_editor.cc
gtk2_ardour/sfdb_ui.cc
gtk2_ardour/sfdb_ui.h

index f1ec91f636ce3568963736fd90b6f181e8cd1163..b70c76b3ca6955ae348bcea231497cdc8f07a73a 100644 (file)
@@ -112,7 +112,7 @@ AddRouteDialog::AddRouteDialog ()
 
        add (*vb2);
 
-       // delete_event.connect (mem_fun(*this, &ArdourDialog::wm_close_event));
+       // signal_delete_event().connect (mem_fun(*this, &ArdourDialog::wm_close_event));
        ok_button.signal_clicked().connect (bind (mem_fun(*this,  &ArdourDialog::stop), 0));
        cancel_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 1));
 }
index 0bfc5cc7ea71f6ba704e4e92e70d2ea73aefec27..c835303de7cc662ca3f42c3b766969c3b08306cc 100644 (file)
@@ -502,7 +502,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        Gtk::CheckMenuItem *locations_dialog_check;
        Gtk::CheckMenuItem *big_clock_check;
        Gtk::CheckMenuItem *tempo_editor_check;
-//     Gtk::CheckMenuItem *sfdb_check;
+       Gtk::CheckMenuItem *sfdb_check;
        Gtk::CheckMenuItem *options_window_check;
        
        /* <CMT Additions> */
@@ -672,6 +672,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI
 
        AddRouteDialog *add_route_dialog;
        void add_route_dialog_done (int status);
+
+       /* SoundFile Browser */
+       void toggle_sound_file_browser ();
        
        /* Keyboard Handling */
        
index 0babbec25bb9f23e9a7fa97f7c297e95fdcda634..0af47c0c198cb7e08aca0ff079af1bfe46a991e7 100644 (file)
 #include <ardour/session.h>
 
 #include "ardour_ui.h"
-#include "mixer_ui.h"
-#include "meter_bridge.h"
 #include "connection_editor.h"
-#include "public_editor.h"
-#include "option_editor.h"
 #include "location_ui.h"
+#include "meter_bridge.h"
+#include "mixer_ui.h"
+#include "option_editor.h"
+#include "public_editor.h"
 #include "route_params_ui.h"
+#include "sfdb_ui.h"
 
 #include "i18n.h"
 
@@ -416,3 +417,16 @@ ARDOUR_UI::route_params_hiding ()
 {
        route_params_check->set_active (false);
 }
+
+void
+ARDOUR_UI::toggle_sound_file_browser ()
+{
+       if (sfdb_check->get_active()) {
+               SoundFileBrowser sfdb(_("Sound File Browser"));
+
+               sfdb_check->signal_toggled().connect (bind (mem_fun (sfdb, &Gtk::Dialog::response), Gtk::RESPONSE_CANCEL));
+               sfdb.run();
+               sfdb_check->set_active(false);
+       }
+}
+
index f801c1f93b372a394f8a086ae5449e2af02326a7..aa162d1d92c0a177e671644513a403bf7fc452c9 100644 (file)
@@ -148,6 +148,7 @@ ARDOUR_UI::install_actions ()
 
        register_action (common_actions, X_("GotoEditor"), _("Editor"),  mem_fun(*this, &ARDOUR_UI::goto_editor_window));
        register_action (common_actions, X_("GotoMixer"), _("Mixer"),  mem_fun(*this, &ARDOUR_UI::goto_mixer_window));
+       register_toggle_action (common_actions, X_("ToggleSoundFileBrowser"), _("Sound File Browser"), mem_fun(*this, &ARDOUR_UI::toggle_sound_file_browser));
        register_toggle_action (common_actions, X_("ToggleOptionsEditor"), _("Options Editor"), mem_fun(*this, &ARDOUR_UI::toggle_options_window));
        register_toggle_action (common_actions, X_("ToggleAudioLibrary"), _("Audio Library"), mem_fun(*this, &ARDOUR_UI::toggle_sfdb_window));
        act = register_toggle_action (common_actions, X_("ToggleInspector"), _("Track/Bus Inspector"), mem_fun(*this, &ARDOUR_UI::toggle_route_params_window));
index 30b25c55edcf7644ff339f0c7320fd3335fbb1b3..e7c81e694e2f68a990e8fff5a8d5fd6d578582b3 100644 (file)
@@ -1899,13 +1899,10 @@ Editor::import_audio (bool as_tracks)
                str = _("Import selected to region list");
        }
 
-       SoundFileChooser sfdb (str, true, true);
+       SoundFileOmega sfdb (str);
+       sfdb.Imported.connect (bind (mem_fun (*this, &Editor::do_import), as_tracks));
 
-       int result = sfdb.run();
-
-       if (result == Gtk::RESULT_ACCEPTED) {
-               do_import(sfdb.get_filenames, sfdb.get_split(), as_tracks);
-       }
+       sfdb.run();
 }
 
 void
@@ -2033,9 +2030,10 @@ Editor::embed_audio ()
                return;
        }
 
-       SoundFileSelector sfdb (_("Add to External Region list"), true, true);
+       SoundFileOmega sfdb (_("Add to External Region list"));
+       sfdb.Embedded.connect (mem_fun (*this, &Editor::do_embed_sndfiles));
 
-       int result = sfdb.run ();
+       sfdb.run ();
 }
 
 void
@@ -2158,13 +2156,13 @@ Editor::embed_sndfile (string path, bool split, bool multiple_files, bool& check
 void
 Editor::insert_sndfile (bool as_tracks)
 {
-       SoundFileSelector& sfdb (ARDOUR_UI::instance()->get_sfdb_window());
+//     SoundFileSelector& sfdb (ARDOUR_UI::instance()->get_sfdb_window());
        sigc::connection c;
        string str;
 
        if (as_tracks) {
 
-               c = sfdb.Action.connect (mem_fun(*this, &Editor::insert_paths_as_new_tracks));
+//             c = sfdb.Action.connect (mem_fun(*this, &Editor::insert_paths_as_new_tracks));
                str = _("Insert selected as new tracks");
 
        } else {
@@ -2179,12 +2177,12 @@ Editor::insert_sndfile (bool as_tracks)
                        return;
                }
 
-               c = sfdb.Action.connect (bind (mem_fun(*this, &Editor::do_insert_sndfile), pos));
+//             c = sfdb.Action.connect (bind (mem_fun(*this, &Editor::do_insert_sndfile), pos));
                str = _("Insert selected");
        }
 
-       sfdb.run (str, false);
-       c.disconnect ();
+//     sfdb.run (str, false);
+//     c.disconnect ();
 }
 
 void
index 92719b9803c3238dd2c3e4856799c02d8745d3f8..cb4488fe033c241320325edad37ccf5f02855693 100644 (file)
@@ -1291,15 +1291,13 @@ OptionEditor::raid_path_changed ()
 void
 OptionEditor::click_browse_clicked ()
 {
-       SoundFileChooser sfdb (_("Choose Click"), false, false);
+       SoundFileChooser sfdb (_("Choose Click"));
        
        int result = sfdb.run ();
 
-       if (result != Gtk::RESPONSE_ACCEPT) {
-               return;
+       if (result == Gtk::RESPONSE_OK) {
+               click_chosen(sfdb.get_filename());
        }
-
-       click_chosen(sfdb.get_filename());
 }
 
 void
@@ -1312,15 +1310,13 @@ OptionEditor::click_chosen (string path)
 void
 OptionEditor::click_emphasis_browse_clicked ()
 {
-       SoundFileChooser sfdb (_("Click Emphasis"), false, false);
+       SoundFileChooser sfdb (_("Choose Click Emphasis"));
 
        int result = sfdb.run ();
 
-       if (result != Gtk::RESPONSE_ACCEPT) {
-               return;
+       if (result == Gtk::RESPONSE_OK) {
+               click_emphasis_chosen (sfdb.get_filename());
        }
-
-       click_emphasis_chosen (sfdb.get_filename());
 }
 
 void
index fcb6d3d8e4703a4b0b9599aaf74bfe50d79c4307..adf0167095b30087ebdfc0c6f981fd532cb1547a 100644 (file)
@@ -1,4 +1,54 @@
+#include <gtkmm/box.h>
+#include <gtkmm/stock.h>
+
+#include <ardour/audio_library.h>
+
 #include "sfdb_ui.h"
 
 #include "i18n.h"
 
+SoundFileBrowser::SoundFileBrowser (std::string title)
+       :
+       Gtk::Dialog(title, false),
+       chooser(Gtk::FILE_CHOOSER_ACTION_OPEN)
+{
+       get_vbox()->pack_start(chooser);
+}
+
+SoundFileChooser::SoundFileChooser (std::string title)
+       :
+       SoundFileBrowser(title)
+{
+       add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
+       add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+}
+
+SoundFileOmega::SoundFileOmega (std::string title)
+       :
+       SoundFileBrowser(title),
+       embed_btn (_("Embed")),
+       import_btn (_("Import")),
+       split_check (_("Split Channels"))
+{
+       get_action_area()->pack_start(embed_btn);
+       get_action_area()->pack_start(import_btn);
+       add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
+
+       chooser.set_extra_widget(split_check);
+
+       embed_btn.signal_clicked().connect (mem_fun (*this, &SoundFileOmega::embed_clicked));
+       import_btn.signal_clicked().connect (mem_fun (*this, &SoundFileOmega::import_clicked));
+}
+
+void
+SoundFileOmega::embed_clicked ()
+{
+       Embedded (chooser.get_filenames(), split_check.get_active());
+}
+
+void
+SoundFileOmega::import_clicked ()
+{
+       Imported (chooser.get_filenames(), split_check.get_active());
+}
+
index fda3c1d94e1ba2940d0fa10573747afcebf152bc..26ce3c15b3ad7959478cadf373fd70c1e9e23871 100644 (file)
@@ -4,7 +4,11 @@
 #include <string>
 #include <vector>
 
+#include <sigc++/signal.h>
+
+#include <gtkmm/box.h>
 #include <gtkmm/button.h>
+#include <gtkmm/checkbutton.h>
 #include <gtkmm/dialog.h>
 #include <gtkmm/filechooserwidget.h>
 
@@ -12,38 +16,37 @@ class SoundFileBrowser : public Gtk::Dialog
 {
   public:
     SoundFileBrowser (std::string title);
-    virtual ~SoundFileBrowser ();
+    virtual ~SoundFileBrowser () {}
 
   protected:
-    Gtk::FileChooserWidget* chooser;
-
-    Gtk::Button* ok_btn;
+    Gtk::FileChooserWidget chooser;
 };
 
 class SoundFileChooser : public SoundFileBrowser
 {
   public:
     SoundFileChooser (std::string title);
-    virtual ~SoundFileChooser ();
-
-    std::string get_filename ();
+    virtual ~SoundFileChooser () {};
 
-  protected:
-    Gtk::Button* open_btn;
+    std::string get_filename () {return chooser.get_filename();};
 };
 
-class SoundFileOmega : public SoundFileChooser
+class SoundFileOmega : public SoundFileBrowser
 {
   public:
     SoundFileOmega (std::string title);
-    virtual ~SoundFileOmega ();
+    virtual ~SoundFileOmega () {};
 
-    std::vector<std::string> get_filenames();
-    bool get_split();
+    sigc::signal<void, std::vector<std::string>, bool> Embedded;
+    sigc::signal<void, std::vector<std::string>, bool> Imported;
 
   protected:
-    Gtk::Button* insert_btn;
-    Gtk::Button* import_btn;
-}
+    Gtk::Button embed_btn;
+    Gtk::Button import_btn;
+    Gtk::CheckButton split_check;
+
+    void embed_clicked ();
+    void import_clicked ();
+};
 
 #endif // __ardour_sfdb_ui_h__