sfdb almost done.

git-svn-id: svn://localhost/trunk/ardour2@60 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Taybin Rutkin 2005-10-13 03:48:57 +00:00
parent 3b91a592be
commit fe83d9b77e
8 changed files with 110 additions and 45 deletions

View file

@ -112,7 +112,7 @@ AddRouteDialog::AddRouteDialog ()
add (*vb2); 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)); ok_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 0));
cancel_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 1)); cancel_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 1));
} }

View file

@ -502,7 +502,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
Gtk::CheckMenuItem *locations_dialog_check; Gtk::CheckMenuItem *locations_dialog_check;
Gtk::CheckMenuItem *big_clock_check; Gtk::CheckMenuItem *big_clock_check;
Gtk::CheckMenuItem *tempo_editor_check; Gtk::CheckMenuItem *tempo_editor_check;
// Gtk::CheckMenuItem *sfdb_check; Gtk::CheckMenuItem *sfdb_check;
Gtk::CheckMenuItem *options_window_check; Gtk::CheckMenuItem *options_window_check;
/* <CMT Additions> */ /* <CMT Additions> */
@ -673,6 +673,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI
AddRouteDialog *add_route_dialog; AddRouteDialog *add_route_dialog;
void add_route_dialog_done (int status); void add_route_dialog_done (int status);
/* SoundFile Browser */
void toggle_sound_file_browser ();
/* Keyboard Handling */ /* Keyboard Handling */
Keyboard* keyboard; Keyboard* keyboard;

View file

@ -26,13 +26,14 @@
#include <ardour/session.h> #include <ardour/session.h>
#include "ardour_ui.h" #include "ardour_ui.h"
#include "mixer_ui.h"
#include "meter_bridge.h"
#include "connection_editor.h" #include "connection_editor.h"
#include "public_editor.h"
#include "option_editor.h"
#include "location_ui.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 "route_params_ui.h"
#include "sfdb_ui.h"
#include "i18n.h" #include "i18n.h"
@ -416,3 +417,16 @@ ARDOUR_UI::route_params_hiding ()
{ {
route_params_check->set_active (false); 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);
}
}

View 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_("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_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_("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)); 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)); act = register_toggle_action (common_actions, X_("ToggleInspector"), _("Track/Bus Inspector"), mem_fun(*this, &ARDOUR_UI::toggle_route_params_window));

View file

@ -1899,13 +1899,10 @@ Editor::import_audio (bool as_tracks)
str = _("Import selected to region list"); 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(); sfdb.run();
if (result == Gtk::RESULT_ACCEPTED) {
do_import(sfdb.get_filenames, sfdb.get_split(), as_tracks);
}
} }
void void
@ -2033,9 +2030,10 @@ Editor::embed_audio ()
return; 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 void
@ -2158,13 +2156,13 @@ Editor::embed_sndfile (string path, bool split, bool multiple_files, bool& check
void void
Editor::insert_sndfile (bool as_tracks) 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; sigc::connection c;
string str; string str;
if (as_tracks) { 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"); str = _("Insert selected as new tracks");
} else { } else {
@ -2179,12 +2177,12 @@ Editor::insert_sndfile (bool as_tracks)
return; 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"); str = _("Insert selected");
} }
sfdb.run (str, false); // sfdb.run (str, false);
c.disconnect (); // c.disconnect ();
} }
void void

View file

@ -1291,15 +1291,13 @@ OptionEditor::raid_path_changed ()
void void
OptionEditor::click_browse_clicked () OptionEditor::click_browse_clicked ()
{ {
SoundFileChooser sfdb (_("Choose Click"), false, false); SoundFileChooser sfdb (_("Choose Click"));
int result = sfdb.run (); int result = sfdb.run ();
if (result != Gtk::RESPONSE_ACCEPT) { if (result == Gtk::RESPONSE_OK) {
return; click_chosen(sfdb.get_filename());
} }
click_chosen(sfdb.get_filename());
} }
void void
@ -1312,15 +1310,13 @@ OptionEditor::click_chosen (string path)
void void
OptionEditor::click_emphasis_browse_clicked () OptionEditor::click_emphasis_browse_clicked ()
{ {
SoundFileChooser sfdb (_("Click Emphasis"), false, false); SoundFileChooser sfdb (_("Choose Click Emphasis"));
int result = sfdb.run (); int result = sfdb.run ();
if (result != Gtk::RESPONSE_ACCEPT) { if (result == Gtk::RESPONSE_OK) {
return; click_emphasis_chosen (sfdb.get_filename());
} }
click_emphasis_chosen (sfdb.get_filename());
} }
void void

View file

@ -1,4 +1,54 @@
#include <gtkmm/box.h>
#include <gtkmm/stock.h>
#include <ardour/audio_library.h>
#include "sfdb_ui.h" #include "sfdb_ui.h"
#include "i18n.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());
}

View file

@ -4,7 +4,11 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <sigc++/signal.h>
#include <gtkmm/box.h>
#include <gtkmm/button.h> #include <gtkmm/button.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/dialog.h> #include <gtkmm/dialog.h>
#include <gtkmm/filechooserwidget.h> #include <gtkmm/filechooserwidget.h>
@ -12,38 +16,37 @@ class SoundFileBrowser : public Gtk::Dialog
{ {
public: public:
SoundFileBrowser (std::string title); SoundFileBrowser (std::string title);
virtual ~SoundFileBrowser (); virtual ~SoundFileBrowser () {}
protected: protected:
Gtk::FileChooserWidget* chooser; Gtk::FileChooserWidget chooser;
Gtk::Button* ok_btn;
}; };
class SoundFileChooser : public SoundFileBrowser class SoundFileChooser : public SoundFileBrowser
{ {
public: public:
SoundFileChooser (std::string title); SoundFileChooser (std::string title);
virtual ~SoundFileChooser (); virtual ~SoundFileChooser () {};
std::string get_filename (); std::string get_filename () {return chooser.get_filename();};
protected:
Gtk::Button* open_btn;
}; };
class SoundFileOmega : public SoundFileChooser class SoundFileOmega : public SoundFileBrowser
{ {
public: public:
SoundFileOmega (std::string title); SoundFileOmega (std::string title);
virtual ~SoundFileOmega (); virtual ~SoundFileOmega () {};
std::vector<std::string> get_filenames(); sigc::signal<void, std::vector<std::string>, bool> Embedded;
bool get_split(); sigc::signal<void, std::vector<std::string>, bool> Imported;
protected: protected:
Gtk::Button* insert_btn; Gtk::Button embed_btn;
Gtk::Button* import_btn; Gtk::Button import_btn;
} Gtk::CheckButton split_check;
void embed_clicked ();
void import_clicked ();
};
#endif // __ardour_sfdb_ui_h__ #endif // __ardour_sfdb_ui_h__