sfdb displays file info.
[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         void set_session (ARDOUR::Session* s);
54     bool setup_labels (std::string filename);
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 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     void setup_fields ();
97
98     void play_btn_clicked ();
99     void stop_btn_clicked ();
100     void add_field_clicked ();
101     void remove_field_clicked ();
102
103     void field_selected ();
104     void audition_status_changed (bool state);
105 };
106
107 class SoundFileBrowser : public ArdourDialog
108 {
109   public:
110     SoundFileBrowser (std::string title);
111     virtual ~SoundFileBrowser () {}; 
112
113         virtual void set_session (ARDOUR::Session*);
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__