add new swedish translation
[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 <sigc++/signal.h>
29
30 #include <gtkmm/box.h>
31 #include <gtkmm/button.h>
32 #include <gtkmm/checkbutton.h>
33 #include <gtkmm/dialog.h>
34 #include <gtkmm/entry.h>
35 #include <gtkmm/filechooserwidget.h>
36 #include <gtkmm/comboboxtext.h>
37 #include <gtkmm/frame.h>
38 #include <gtkmm/label.h>
39 #include <gtkmm/liststore.h>
40 #include <gtkmm/treeview.h>
41
42 #include <ardour/session.h>
43 #include <ardour/audiofilesource.h>
44
45 #include "ardour_dialog.h"
46 #include "editing.h"
47
48 class SoundFileBox : public Gtk::VBox
49 {
50   public:
51     SoundFileBox ();
52     virtual ~SoundFileBox () {};
53
54     void set_session (ARDOUR::Session* s);
55     bool setup_labels (std::string filename);
56
57   protected:
58         ARDOUR::Session* _session;
59         std::string path;
60
61     struct LabelModelColumns : public Gtk::TreeModel::ColumnRecord
62     {
63     public:
64       Gtk::TreeModelColumn<std::string> field;
65       Gtk::TreeModelColumn<std::string> data;
66
67       LabelModelColumns() { add(field); add(data); }
68     };
69
70     LabelModelColumns label_columns;
71     
72     ARDOUR::SoundFileInfo sf_info;
73
74     pid_t current_pid;
75
76     Gtk::Label length;
77     Gtk::Label format;
78     Gtk::Label channels;
79     Gtk::Label samplerate;
80
81     Gtk::TreeView field_view;
82     Glib::RefPtr<Gtk::ListStore> fields;
83     std::string selected_field;
84
85     Gtk::Frame border_frame;
86
87     Gtk::VBox main_box;
88     Gtk::VBox path_box;
89     Gtk::HBox top_box;
90     Gtk::HBox bottom_box;
91
92     Gtk::Button play_btn;
93     Gtk::Button stop_btn;
94     Gtk::Button add_field_btn;
95     Gtk::Button remove_field_btn;
96
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         void field_edited (const Glib::ustring&, const Glib::ustring&);
104         void delete_row (const Gtk::TreeModel::iterator& iter);
105
106     void field_selected ();
107     void audition_status_changed (bool state);
108 };
109
110 class SoundFileBrowser : public ArdourDialog
111 {
112   public:
113     SoundFileBrowser (std::string title, ARDOUR::Session* _s = 0);
114     virtual ~SoundFileBrowser () {}; 
115
116     virtual void set_session (ARDOUR::Session*);
117
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, ARDOUR::Session* _s = 0);
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, ARDOUR::Session* _s);
138     virtual ~SoundFileOmega () {};
139
140     /* these are returned by the Dialog::run() method. note
141        that builtin GTK responses are all negative, leaving
142        positive values for application-defined responses.
143     */
144
145     const static int ResponseImport = 1;
146     const static int ResponseEmbed = 2;
147
148     std::vector<Glib::ustring> get_paths ();
149     bool get_split ();
150
151     void set_mode (Editing::ImportMode);
152     Editing::ImportMode get_mode ();
153
154   protected:
155     Gtk::CheckButton  split_check;
156     Gtk::ComboBoxText mode_combo;
157
158     void mode_changed ();
159
160     static std::vector<std::string> mode_strings;
161 };
162
163 #endif // __ardour_sfdb_ui_h__