6be971ca735a21ec0eb246514fe7dbe300b522f7
[ardour.git] / gtk2_ardour / sfdb_ui.h
1 /*
2     Copyright (C) 2005 Paul Davis 
3     Written by Taybin Rutkin
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19
20 */
21
22 #ifndef __ardour_sfdb_ui_h__
23 #define __ardour_sfdb_ui_h__
24
25 #include <string>
26 #include <vector>
27
28 #include <sndfile.h>
29
30 #include <sigc++/signal.h>
31
32 #include <gtkmm/box.h>
33 #include <gtkmm/button.h>
34 #include <gtkmm/checkbutton.h>
35 #include <gtkmm/dialog.h>
36 #include <gtkmm/entry.h>
37 #include <gtkmm/filechooserwidget.h>
38 #include <gtkmm/frame.h>
39 #include <gtkmm/label.h>
40 #include <gtkmm/liststore.h>
41 #include <gtkmm/treeview.h>
42
43 #include <ardour/session.h>
44
45 #include "ardour_dialog.h"
46
47 class SoundFileBox : public Gtk::VBox
48 {
49   public:
50     SoundFileBox (ARDOUR::Session* session);
51     virtual ~SoundFileBox () {};
52
53     bool update (std::string filename);
54
55   protected:
56     struct LabelModelColumns : public Gtk::TreeModel::ColumnRecord
57     {
58     public:
59       Gtk::TreeModelColumn<std::string> field;
60       Gtk::TreeModelColumn<std::string> data;
61
62       LabelModelColumns() { add(field); add(data); }
63     };
64
65     LabelModelColumns label_columns;
66     
67     SF_INFO sf_info;
68
69     pid_t current_pid;
70
71     Gtk::Label label;
72     Gtk::Label path;
73     Gtk::Entry path_entry;
74     Gtk::Label length;
75     Gtk::Label format;
76     Gtk::Label channels;
77     Gtk::Label samplerate;
78
79     Gtk::TreeView field_view;
80     Glib::RefPtr<Gtk::ListStore> fields;
81     std::string selected_field;
82
83     Gtk::Frame border_frame;
84
85     Gtk::VBox main_box;
86     Gtk::VBox path_box;
87     Gtk::HBox top_box;
88     Gtk::HBox bottom_box;
89
90     Gtk::Button play_btn;
91     Gtk::Button stop_btn;
92     Gtk::Button add_field_btn;
93     Gtk::Button remove_field_btn;
94
95  //   void fields_refiller (Gtk::CList &clist);
96     int setup_labels (std::string filename);
97     void setup_fields ();
98
99     void play_btn_clicked ();
100     void stop_btn_clicked ();
101     void add_field_clicked ();
102     void remove_field_clicked ();
103
104     void field_selected ();
105     void audition_status_changed (bool state);
106 };
107
108 class SoundFileBrowser : public ArdourDialog
109 {
110   public:
111     SoundFileBrowser (std::string title);
112     virtual ~SoundFileBrowser () {}; 
113
114   protected:
115     Gtk::FileChooserWidget chooser;
116     SoundFileBox preview;
117
118     void update_preview ();
119 };
120
121 class SoundFileChooser : public SoundFileBrowser
122 {
123   public:
124     SoundFileChooser (std::string title);
125     virtual ~SoundFileChooser () {};
126
127     std::string get_filename () {return chooser.get_filename();};
128 };
129
130 class SoundFileOmega : public SoundFileBrowser
131 {
132   public:
133     SoundFileOmega (std::string title);
134     virtual ~SoundFileOmega () {};
135
136     sigc::signal<void, std::vector<std::string>, bool> Embedded;
137     sigc::signal<void, std::vector<std::string>, bool> Imported;
138
139   protected:
140     Gtk::Button embed_btn;
141     Gtk::Button import_btn;
142     Gtk::CheckButton split_check;
143
144     void embed_clicked ();
145     void import_clicked ();
146 };
147
148 #endif // __ardour_sfdb_ui_h__