2c43fb1aa744fb9978cfa2ecb76b25a0faf87835
[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 ();
51     virtual ~SoundFileBox () {};
52
53     bool update (std::string filename);
54         void set_session (ARDOUR::Session* s);
55
56   protected:
57         ARDOUR::Session* _session;
58
59     struct LabelModelColumns : public Gtk::TreeModel::ColumnRecord
60     {
61     public:
62       Gtk::TreeModelColumn<std::string> field;
63       Gtk::TreeModelColumn<std::string> data;
64
65       LabelModelColumns() { add(field); add(data); }
66     };
67
68     LabelModelColumns label_columns;
69     
70     SF_INFO sf_info;
71
72     pid_t current_pid;
73
74     Gtk::Label label;
75     Gtk::Label path;
76     Gtk::Entry path_entry;
77     Gtk::Label length;
78     Gtk::Label format;
79     Gtk::Label channels;
80     Gtk::Label samplerate;
81
82     Gtk::TreeView field_view;
83     Glib::RefPtr<Gtk::ListStore> fields;
84     std::string selected_field;
85
86     Gtk::Frame border_frame;
87
88     Gtk::VBox main_box;
89     Gtk::VBox path_box;
90     Gtk::HBox top_box;
91     Gtk::HBox bottom_box;
92
93     Gtk::Button play_btn;
94     Gtk::Button stop_btn;
95     Gtk::Button add_field_btn;
96     Gtk::Button remove_field_btn;
97
98  //   void fields_refiller (Gtk::CList &clist);
99     int setup_labels (std::string filename);
100     void setup_fields ();
101
102     void play_btn_clicked ();
103     void stop_btn_clicked ();
104     void add_field_clicked ();
105     void remove_field_clicked ();
106
107     void field_selected ();
108     void audition_status_changed (bool state);
109 };
110
111 class SoundFileBrowser : public ArdourDialog
112 {
113   public:
114     SoundFileBrowser (std::string title);
115     virtual ~SoundFileBrowser () {}; 
116
117         virtual void set_session (ARDOUR::Session*);
118   protected:
119     Gtk::FileChooserWidget chooser;
120     SoundFileBox preview;
121
122     void update_preview ();
123 };
124
125 class SoundFileChooser : public SoundFileBrowser
126 {
127   public:
128     SoundFileChooser (std::string title);
129     virtual ~SoundFileChooser () {};
130
131     std::string get_filename () {return chooser.get_filename();};
132 };
133
134 class SoundFileOmega : public SoundFileBrowser
135 {
136   public:
137     SoundFileOmega (std::string title);
138     virtual ~SoundFileOmega () {};
139
140     sigc::signal<void, std::vector<std::string>, bool> Embedded;
141     sigc::signal<void, std::vector<std::string>, bool> Imported;
142
143   protected:
144     Gtk::Button embed_btn;
145     Gtk::Button import_btn;
146     Gtk::CheckButton split_check;
147
148     void embed_clicked ();
149     void import_clicked ();
150 };
151
152 #endif // __ardour_sfdb_ui_h__