Start of sfdb_v3.

git-svn-id: svn://localhost/trunk/ardour2@58 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Taybin Rutkin 2005-10-12 20:06:20 +00:00
parent 192c6a9c16
commit abb086738c
10 changed files with 60 additions and 1944 deletions

View file

@ -39,7 +39,6 @@ gtkardour.Merge ([
libraries['libgnomecanvas2'],
libraries['xml'],
libraries['soundtouch'],
libraries['raptor'],
libraries['samplerate'],
libraries['jack']
])
@ -118,7 +117,6 @@ imageframe_view.cc
io_selector.cc
keyboard.cc
keyboard_target.cc
library_ui.cc
location_ui.cc
main.cc
marker.cc
@ -151,6 +149,7 @@ route_params_ui.cc
route_redirect_selection.cc
route_ui.cc
selection.cc
sfdb_ui.cc
send_ui.cc
streamview.cc
tempo_dialog.cc

View file

@ -80,7 +80,6 @@ using namespace Gtk;
using namespace sigc;
ARDOUR_UI *ARDOUR_UI::theArdourUI = 0;
SoundFileSelector* ARDOUR_UI::sfdb_window = 0;
sigc::signal<void,bool> ARDOUR_UI::Blink;
sigc::signal<void> ARDOUR_UI::RapidScreenUpdate;
@ -846,7 +845,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
meter_bridge = 0;
option_editor = 0;
location_ui = 0;
sfdb_window = 0;
new_session_window = 0;
open_session_selector = 0;
have_configure_timeout = false;

View file

@ -70,7 +70,7 @@ class OptionEditor;
class Mixer_UI;
class ConnectionEditor;
class RouteParams_UI;
class SoundFileSelector;
class SoundFileChooser;
class About;
class AddRouteDialog;
class NewSessionDialog;
@ -154,9 +154,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void toggle_connection_editor ();
void toggle_route_params_window ();
void toggle_tempo_window ();
void toggle_sfdb_window ();
SoundFileSelector& get_sfdb_window();
gint32 select_diskstream (GdkEventButton *ev);
@ -279,8 +276,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
Gtk::Table transport_table;
Gtk::Table option_table;
static SoundFileSelector* sfdb_window;
int setup_windows ();
void setup_session_menu ();
void setup_transport ();
@ -507,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> */
@ -663,7 +658,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void big_clock_hiding ();
void route_params_hiding ();
void connection_editor_hiding ();
void sfdb_hiding ();
void option_hiding ();
/* Various options */

View file

@ -417,38 +417,3 @@ ARDOUR_UI::route_params_hiding ()
{
route_params_check->set_active (false);
}
SoundFileSelector&
ARDOUR_UI::get_sfdb_window ()
{
if (sfdb_window == 0) {
sfdb_window = new SoundFileSelector ();
sfdb_window->Hiding.connect (mem_fun(*this, &ARDOUR_UI::sfdb_hiding));
sfdb_window->hide_all ();
}
return *sfdb_window;
}
void
ARDOUR_UI::toggle_sfdb_window ()
{
get_sfdb_window ();
if (sfdb_window->within_hiding()) {
return;
}
if (sfdb_window->is_visible ()) {
sfdb_window->hide_all ();
} else {
sfdb_window->show_all ();
sfdb_window->hide_import_stuff();
}
}
void
ARDOUR_UI::sfdb_hiding ()
{
sfdb_check->set_active (false);
}

File diff suppressed because it is too large Load diff

View file

@ -1,316 +0,0 @@
/*
Copyright (C) 1999-2002 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_library_ui_h__
#define __ardour_library_ui_h__
#include <map>
#include <string>
#include <list>
#include <sys/stat.h>
#include <sys/types.h>
#include <sigc++/signal.h>
#include <gtkmm/label.h>
#include <gtkmm/entry.h>
#include <gtkmm/box.h>
#include <gtkmm/button.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/treeview.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/fileselection.h>
#include <gtkmm/notebook.h>
#include <gtkmm2ext/selector.h>
#include <ardour/region.h>
#include "ardour_dialog.h"
using std::string;
using std::map;
struct RowTaggedString {
RowTaggedString (int r, string s)
: row (r), str (s) {}
int32_t row;
string str;
};
class SoundFileBox : public Gtk::VBox
{
public:
/**
@variable uri is the path name of string.
@variable metadata whether to show the user-added fields from sfdb.
*/
SoundFileBox (string uri, bool metadata);
~SoundFileBox ();
sigc::signal<void, string, bool> file_chosen;
private:
string uri;
bool metadata;
SF_INFO* sf_info;
char* playcmd;
pid_t current_pid;
Gtk::Label label;
Gtk::Label path;
Gtk::Entry path_entry;
Gtk::Label length;
Gtk::Label format;
Gtk::Label channels;
Gtk::Label samplerate;
Gtkmm2ext::Selector fields;
string selected_field;
Gtk::Frame border_frame;
Gtk::VBox main_box;
Gtk::HBox top_box;
Gtk::HBox bottom_box;
Gtk::Button play_btn;
Gtk::Button stop_btn;
Gtk::Button add_field_btn;
Gtk::Button remove_field_btn;
static void _fields_refiller (Gtk::TreeView &list, void* arg);
void fields_refiller (Gtk::TreeView);
int setup_labels (string uri);
void setup_fields ();
void play_btn_clicked ();
void stop_btn_clicked ();
void add_field_clicked ();
void remove_field_clicked ();
void field_selected (Gtkmm2ext::Selector *selector,
Gtkmm2ext::Selector::Result *re);
void field_chosen (Gtkmm2ext::Selector *selector,
Gtkmm2ext::Selector::Result *re);
void audition_status_changed (bool state);
};
class SearchSounds : public ArdourDialog
{
public:
SearchSounds ();
~SearchSounds ();
sigc::signal<void, string, bool> file_chosen;
private:
Gtk::Button find_btn;
Gtk::RadioButton and_rbtn;
Gtk::RadioButton or_rbtn;
Gtkmm2ext::Selector fields;
string selected_field;
Gtk::VBox main_box;
Gtk::HBox rbtn_box;
Gtk::HBox bottom_box;
static void _fields_refiller (Gtk::TreeView&, void* arg);
void fields_refiller (Gtk::TreeView&);
void setup_fields ();
void field_selected (Gtkmm2ext::Selector *selector,
Gtkmm2ext::Selector::Result *re);
void find_btn_clicked ();
void file_found (string uri, bool multi);
};
class SearchResults : public ArdourDialog
{
public:
SearchResults (std::map<std::string,std::string> field_values, bool and_search);
~SearchResults ();
sigc::signal<void, std::string, bool> file_chosen;
private:
std::map<std::string,std::string> search_info;
bool search_and;
std::string selection;
Gtk::VBox main_box;
Gtk::HBox hbox;
Gtk::HBox import_box;
Gtk::Button import_btn;
Gtk::CheckButton multichan_check;
SoundFileBox* info_box;
Gtkmm2ext::Selector results;
static void _results_refiller (Gtk::TreeView &list, void* arg);
void results_refiller (Gtk::TreeView&);
void import_clicked ();
void result_chosen (Gtkmm2ext::Selector *selector,
Gtkmm2ext::Selector::Result *re);
};
class LibraryTree : public Gtk::VBox
{
public:
LibraryTree ();
~LibraryTree ();
sigc::signal<void, std::string, bool> file_chosen;
sigc::signal<void> group_selected;
sigc::signal<void, std::string> member_selected;
sigc::signal<void> member_deselected;
sigc::signal<void> deselected;
std::list<std::string> selection;
void clear_selection ();
private:
std::map<std::string, Gtk::TreeViewColumn> uri_mapping;
std::map<std::string, std::string> uri_parent; // this ugly, but necessary
std::string current_member;
std::string current_group;
Gtk::HBox hbox;
Gtk::VBox framed_box;
Gtk::HBox btn_box_top;
Gtk::HBox btn_box_bottom;
Gtk::ScrolledWindow scroll;
Gtk::TreeView tree;
Gtk::Button add_btn;
Gtk::Button remove_btn;
Gtk::Button find_btn;
Gtk::Button folder_btn;
Gtk::FileSelection files_select;
void file_ok_clicked ();
void file_cancel_clicked ();
void add_btn_clicked ();
void folder_btn_clicked ();
void remove_btn_clicked ();
void find_btn_clicked ();
void file_found (std::string uri, bool multi);
void cb_group_select (Gtk::TreeViewColumn&, std::string uri);
void cb_member_select (Gtk::TreeViewColumn&, std::string uri);
void cb_member_deselect (Gtk::TreeViewColumn&, std::string uri);
void populate ();
void subpopulate (Gtk::TreeView&, std::string group);
void added_group (std::string, std::string);
void removed_group (std::string);
void added_member (std::string, std::string);
void removed_member (std::string);
void cancel_import_clicked ();
};
class SoundFileBrowser : public Gtk::VBox {
public:
SoundFileBrowser ();
~SoundFileBrowser ();
sigc::signal<void> group_selected;
sigc::signal<void, std::string> member_selected;
sigc::signal<void> member_deselected;
sigc::signal<void> deselected;
list<RowTaggedString> selection;
void clear_selection ();
private:
std::string current_member;
std::string current_group;
Gtk::FileSelection fs_selector;
Gtk::TreeView* file_list;
void dir_list_selected(gint row, gint col, GdkEvent* ev);
void file_list_selected(gint row, gint col, GdkEvent* ev);
void file_list_deselected(gint row, gint col, GdkEvent* ev);
std::string safety_check_file(std::string file);
};
class SoundFileSelector : public ArdourDialog {
public:
/**
@variable action the name given to the action button
@variable import is action button sensitive
@variable multi does splitting the region by channel make sense here
@variable persist should this LibraryTree be hidden or deleted when closed
*/
SoundFileSelector ();
~SoundFileSelector ();
void run (std::string action, bool split_makes_sense, bool hide_after_action = false);
void get_result (vector<std::string>& paths, bool& split);
void hide_import_stuff();
sigc::signal<void,vector<std::string>,bool> Action;
private:
bool multiable;
bool hide_after_action;
bool sfdb;
void import_btn_clicked ();
void sfdb_group_selected();
void browser_group_selected();
void member_selected(std::string member, bool sfdb);
void member_deselected(bool sfdb);
void sfdb_deselected();
void page_switched(Gtk::Notebook_Helpers::Page* page, guint page_num);
Gtk::HBox main_box;
Gtk::VBox vbox;
Gtk::Notebook notebook;
Gtk::Label sfdb_label;
Gtk::Label fs_label;
SoundFileBrowser sf_browser;
LibraryTree sfdb_tree;
Gtk::HBox import_box;
Gtk::Button import_btn;
Gtk::CheckButton split_channels;
Gtk::CheckButton resample_check;
SoundFileBox* info_box;
};
#endif // __ardour_library_ui_h__

View file

@ -32,7 +32,7 @@
#include "ardour_ui.h"
#include "io_selector.h"
#include "gain_meter.h"
#include "library_ui.h"
#include "sfdb_ui.h"
#include "utils.h"
#include "editing.h"
#include "option_editor.h"
@ -43,6 +43,7 @@ using namespace ARDOUR;
using namespace Gtk;
using namespace Editing;
using namespace Gtkmm2ext;
using namespace std;
static const gchar *psync_strings[] = {
N_("Internal"),
@ -1290,24 +1291,20 @@ OptionEditor::raid_path_changed ()
void
OptionEditor::click_browse_clicked ()
{
SoundFileSelector& sfdb (ARDOUR_UI::instance()->get_sfdb_window());
sigc::connection c = sfdb.Action.connect (mem_fun(*this, &OptionEditor::click_chosen));
SoundFileChooser sfdb (_("Choose Click"), false);
sfdb.run (_("Use as click"), false, true);
c.disconnect ();
}
int result = sfdb.run ();
void
OptionEditor::click_chosen (vector<string> paths, bool ignore)
{
string path;
if (!paths.empty()) {
path = paths.front();
} else {
if (result != Gtk::RESPONSE_ACCEPT) {
return;
}
click_chosen(sfdb.get_filename());
}
void
OptionEditor::click_chosen (string path)
{
click_path_entry.set_text (path);
click_sound_changed ();
}
@ -1315,25 +1312,20 @@ OptionEditor::click_chosen (vector<string> paths, bool ignore)
void
OptionEditor::click_emphasis_browse_clicked ()
{
SoundFileSelector& sfdb (ARDOUR_UI::instance()->get_sfdb_window());
sigc::connection c = sfdb.Action.connect (mem_fun(*this, &OptionEditor::click_emphasis_chosen));
SoundFileChooser sfdb (_("Click Emphasis"), false);
sfdb.run (_("Use as click emphasis"), false, true);
c.disconnect ();
int result = sfdb.run ();
}
void
OptionEditor::click_emphasis_chosen (vector<string> paths, bool ignore)
{
string path;
if (!paths.empty()) {
path = paths.front();
} else {
if (result != Gtk::RESPONSE_ACCEPT) {
return;
}
click_emphasis_chosen (sfdb.get_filename());
}
void
OptionEditor::click_emphasis_chosen (std::string path)
{
click_emphasis_path_entry.set_text (path);
click_emphasis_sound_changed ();
}

View file

@ -192,7 +192,7 @@ class OptionEditor : public ArdourDialog
MidiIndex = 2
};
std::map<MIDI::Port*,vector<Gtk::RadioButton*> > port_toggle_buttons;
std::map<MIDI::Port*,std::vector<Gtk::RadioButton*> > port_toggle_buttons;
/* Click */
@ -209,8 +209,8 @@ class OptionEditor : public ArdourDialog
void setup_click_editor ();
void clear_click_editor ();
void click_chosen (vector<string> paths, bool ignore);
void click_emphasis_chosen (vector<string> paths, bool ignore);
void click_chosen (std::string paths);
void click_emphasis_chosen (std::string paths);
void click_browse_clicked ();
void click_emphasis_browse_clicked ();
@ -284,7 +284,7 @@ class OptionEditor : public ArdourDialog
void debug_keyboard_clicked ();
void speed_quieten_clicked ();
void fixup_combo_size (Gtk::ComboBox&, vector<string>& strings);
void fixup_combo_size (Gtk::ComboBox&, std::vector<std::string>& strings);
};
#endif /* __gtk_ardour_option_editor_h__ */

16
gtk2_ardour/sfdb_ui.cc Normal file
View file

@ -0,0 +1,16 @@
#include "sfdb_ui.h"
#include "i18n.h"
SoundFileChooser::SoundFileChooser (std::string title,
bool split_makes_sense)
:
Gtk::FileChooserDialog(title)
{
}
SoundFileChooser::~SoundFileChooser ()
{
}

17
gtk2_ardour/sfdb_ui.h Normal file
View file

@ -0,0 +1,17 @@
#ifndef __ardour_sfdb_ui_h__
#define __ardour_sfdb_ui_h__
#include <string>
#include <gtkmm/filechooserdialog.h>
#include <ardour/audio_library.h>
class SoundFileChooser : public Gtk::FileChooserDialog
{
public:
SoundFileChooser (std::string title, bool split_makes_sense);
virtual ~SoundFileChooser ();
};
#endif // __ardour_sfdb_ui_h__