/[svn]/gigedit/trunk/src/mainwindow.h
ViewVC logotype

Annotation of /gigedit/trunk/src/mainwindow.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1117 - (hide annotations) (download) (as text)
Sat Mar 24 13:05:58 2007 UTC (17 years, 1 month ago) by persson
File MIME type: text/x-c++hdr
File size: 6939 byte(s)
* added +6dB parameter to DimRegionEdit
* preparations for improved instrument properties dialog

1 persson 1052 /* -*- c++ -*-
2     * Copyright (C) 2006, 2007 Andreas Persson
3     *
4     * This program is free software; you can redistribute it and/or
5     * modify it under the terms of the GNU General Public License as
6     * published by the Free Software Foundation; either version 2, or (at
7     * your option) any later version.
8     *
9     * This program is distributed in the hope that it will be useful, but
10     * WITHOUT ANY WARRANTY; without even the implied warranty of
11     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12     * General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * along with program; see the file COPYING. If not, write to the Free
16     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17     * 02110-1301 USA.
18     */
19    
20     #ifndef GIGEDIT_MAINWINDOW_H
21     #define GIGEDIT_MAINWINDOW_H
22    
23     #include <gig.h>
24    
25     #include <gtkmm/actiongroup.h>
26     #include <gtkmm/buttonbox.h>
27     #include <gtkmm/dialog.h>
28     #include <gtkmm/liststore.h>
29     #include <gtkmm/paned.h>
30     #include <gtkmm/progressbar.h>
31     #include <gtkmm/scrolledwindow.h>
32     #include <gtkmm/treestore.h>
33     #include <gtkmm/uimanager.h>
34     #include <gtkmm/window.h>
35    
36 schoenebeck 1082 #include <sstream>
37    
38 persson 1052 #include "regionchooser.h"
39     #include "dimregionchooser.h"
40 persson 1100 #include "dimregionedit.h"
41 persson 1052
42     class MainWindow;
43    
44     class PropDialog : public Gtk::Window {
45     public:
46     PropDialog();
47     void set_info(DLS::Info* info);
48     protected:
49     Gtk::Table table;
50     Gtk::Label label[16];
51     Gtk::Entry entry[16];
52     };
53    
54     class InstrumentProps : public Gtk::Window {
55     public:
56     InstrumentProps();
57     void set_instrument(gig::Instrument* instrument);
58     protected:
59     Gtk::VBox vbox;
60     Gtk::HButtonBox buttonBox;
61     Gtk::Button quitButton;
62     Gtk::Table table;
63     Gtk::Label label[10];
64     Gtk::Entry entry[8];
65     Gtk::CheckButton check[2];
66 persson 1117 NumEntryX<uint16_t, gig::Instrument> eMIDIBank;
67     NumEntryX<uint32_t, gig::Instrument> eMIDIProgram;
68     NumEntryTemp<int32_t, gig::Instrument> eAttenuation;
69     NumEntryTemp<uint16_t, gig::Instrument> eEffectSend;
70     NumEntryTemp<int16_t, gig::Instrument> eFineTune;
71     BoolEntry<gig::Instrument> ePianoReleaseMode;
72 persson 1052 };
73    
74     class LoadDialog : public Gtk::Dialog {
75     public:
76 persson 1100 LoadDialog(const Glib::ustring& title, Gtk::Window& parent);
77 persson 1052 void set_fraction(float fraction) { progressBar.set_fraction(fraction); }
78     protected:
79     Gtk::ProgressBar progressBar;
80     };
81    
82     class Loader : public sigc::trackable {
83     public:
84     Loader(const char* filename);
85     void launch();
86     Glib::Dispatcher& signal_progress();
87     Glib::Dispatcher& signal_finished();
88     void progress_callback(float fraction);
89     float get_progress();
90     const char* filename;
91     gig::File* gig;
92    
93     private:
94     Glib::Thread* thread;
95     void thread_function();
96     Glib::Dispatcher finished_dispatcher;
97     Glib::Dispatcher progress_dispatcher;
98     Glib::Mutex progressMutex;
99     float progress;
100     };
101    
102     class MainWindow : public Gtk::Window {
103     public:
104     MainWindow();
105     virtual ~MainWindow();
106 persson 1100 void load_file(const char* name);
107 persson 1052
108     protected:
109     Glib::RefPtr<Gtk::ActionGroup> actionGroup;
110     Glib::RefPtr<Gtk::UIManager> uiManager;
111    
112     RegionChooser m_RegionChooser;
113     DimRegionChooser m_DimRegionChooser;
114    
115     PropDialog propDialog;
116     InstrumentProps instrumentProps;
117    
118 schoenebeck 1069 void on_instrument_selection_change(int index);
119 persson 1052 void on_sel_change();
120     void region_changed();
121     void dimreg_changed();
122     void on_loader_progress();
123     void on_loader_finished();
124    
125     class ModelColumns : public Gtk::TreeModel::ColumnRecord {
126     public:
127 persson 1104 ModelColumns() {
128     add(m_col_name);
129     add(m_col_instr);
130 persson 1052 }
131    
132 persson 1104 Gtk::TreeModelColumn<Glib::ustring> m_col_name;
133     Gtk::TreeModelColumn<gig::Instrument*> m_col_instr;
134 schoenebeck 1080 } m_Columns;
135 persson 1052
136     Gtk::VBox m_VBox;
137     Gtk::HPaned m_HPaned;
138    
139     Gtk::ScrolledWindow m_ScrolledWindow;
140 persson 1100
141 persson 1052 Gtk::TreeView m_TreeView;
142     Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
143    
144 schoenebeck 1080 class SamplesModel : public Gtk::TreeModel::ColumnRecord {
145     public:
146     SamplesModel() {
147     add(m_col_name);
148     add(m_col_sample);
149 schoenebeck 1084 add(m_col_group);
150 schoenebeck 1080 }
151    
152     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
153 schoenebeck 1082 Gtk::TreeModelColumn<gig::Sample*> m_col_sample;
154     Gtk::TreeModelColumn<gig::Group*> m_col_group;
155 schoenebeck 1080 } m_SamplesModel;
156 persson 1088
157 schoenebeck 1096 class SamplesTreeStore : public Gtk::TreeStore {
158     public:
159     static Glib::RefPtr<SamplesTreeStore> create(const SamplesModel& columns) {
160     return Glib::RefPtr<SamplesTreeStore>( new SamplesTreeStore(columns) );
161     }
162     protected:
163     SamplesTreeStore(const SamplesModel& columns) : Gtk::TreeStore(columns) {}
164     };
165    
166 persson 1088 Gtk::ScrolledWindow m_ScrolledWindowSamples;
167 schoenebeck 1080 Gtk::TreeView m_TreeViewSamples;
168 schoenebeck 1096 Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel;
169 schoenebeck 1080
170 persson 1100 DimRegionEdit dimreg_edit;
171    
172 persson 1052 Gtk::Notebook m_Notebook;
173 schoenebeck 1080 Gtk::Notebook m_TreeViewNotebook;
174 persson 1052
175 schoenebeck 1087 struct SampleImportItem {
176 persson 1100 gig::Sample* gig_sample; // pointer to the gig::Sample to
177     // which the sample data should be
178     // imported to
179     Glib::ustring sample_path; // file name of the sample to be
180     // imported
181 schoenebeck 1087 };
182     std::list<SampleImportItem> m_SampleImportQueue;
183    
184 persson 1052
185     void on_action_file_new();
186     void on_action_file_open();
187     void on_action_file_save();
188     void on_action_file_save_as();
189     void on_action_file_properties();
190 persson 1100 void show_instr_props();
191 persson 1052 void on_action_help_about();
192    
193 schoenebeck 1082 // sample right-click popup actions
194     void on_sample_treeview_button_release(GdkEventButton* button);
195     void on_action_sample_properties();
196     void on_action_add_group();
197     void on_action_add_sample();
198     void on_action_remove_sample();
199    
200 schoenebeck 1101 void on_action_add_instrument();
201     void on_action_remove_instrument();
202    
203 persson 1052 LoadDialog* load_dialog;
204     Loader* loader;
205     void load_gig(gig::File* gig, const char* filename);
206    
207     gig::File* file;
208    
209     void on_button_release(GdkEventButton* button);
210 persson 1100 void on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
211     Gtk::SelectionData& selection_data, guint, guint);
212     void on_sample_label_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context,
213     int, int,
214     const Gtk::SelectionData& selection_data,
215     guint, guint time);
216     void sample_name_changed(const Gtk::TreeModel::Path& path,
217     const Gtk::TreeModel::iterator& iter);
218     void instrument_name_changed(const Gtk::TreeModel::Path& path,
219     const Gtk::TreeModel::iterator& iter);
220 persson 1052
221 schoenebeck 1087 void __import_queued_samples();
222 schoenebeck 1101 void __clear();
223 schoenebeck 1087
224 persson 1100 Gtk::Menu* popup_menu;
225 persson 1052 };
226    
227     #endif

  ViewVC Help
Powered by ViewVC