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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1138 - (hide annotations) (download) (as text)
Sat Mar 31 09:33:40 2007 UTC (17 years, 1 month ago) by persson
File MIME type: text/x-c++hdr
File size: 7152 byte(s)
* reworked instrument properties dialog - properties can now be edited
* code cleanup: removed the pointer to member usage in paramedit as it
  just made things more complicated

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 1138 StringEntry eName;
67     BoolEntry eIsDrum;
68     NumEntryTemp<uint16_t> eMIDIBank;
69     NumEntryTemp<uint32_t> eMIDIProgram;
70     NumEntryGain eAttenuation;
71     BoolEntryPlus6 eGainPlus6;
72     NumEntryTemp<uint16_t> eEffectSend;
73     NumEntryTemp<int16_t> eFineTune;
74     NumEntryTemp<uint16_t> ePitchbendRange;
75     BoolEntry ePianoReleaseMode;
76     NoteEntry eDimensionKeyRangeLow;
77     NoteEntry eDimensionKeyRangeHigh;
78     int rowno;
79     void add_prop(LabelWidget& prop);
80     void key_range_low_changed();
81     void key_range_high_changed();
82 persson 1052 };
83    
84     class LoadDialog : public Gtk::Dialog {
85     public:
86 persson 1100 LoadDialog(const Glib::ustring& title, Gtk::Window& parent);
87 persson 1052 void set_fraction(float fraction) { progressBar.set_fraction(fraction); }
88     protected:
89     Gtk::ProgressBar progressBar;
90     };
91    
92     class Loader : public sigc::trackable {
93     public:
94     Loader(const char* filename);
95     void launch();
96     Glib::Dispatcher& signal_progress();
97     Glib::Dispatcher& signal_finished();
98     void progress_callback(float fraction);
99     float get_progress();
100     const char* filename;
101     gig::File* gig;
102    
103     private:
104     Glib::Thread* thread;
105     void thread_function();
106     Glib::Dispatcher finished_dispatcher;
107     Glib::Dispatcher progress_dispatcher;
108     Glib::Mutex progressMutex;
109     float progress;
110     };
111    
112     class MainWindow : public Gtk::Window {
113     public:
114     MainWindow();
115     virtual ~MainWindow();
116 persson 1100 void load_file(const char* name);
117 persson 1052
118     protected:
119     Glib::RefPtr<Gtk::ActionGroup> actionGroup;
120     Glib::RefPtr<Gtk::UIManager> uiManager;
121    
122     RegionChooser m_RegionChooser;
123     DimRegionChooser m_DimRegionChooser;
124    
125     PropDialog propDialog;
126     InstrumentProps instrumentProps;
127    
128 schoenebeck 1069 void on_instrument_selection_change(int index);
129 persson 1052 void on_sel_change();
130     void region_changed();
131     void dimreg_changed();
132     void on_loader_progress();
133     void on_loader_finished();
134    
135     class ModelColumns : public Gtk::TreeModel::ColumnRecord {
136     public:
137 persson 1104 ModelColumns() {
138     add(m_col_name);
139     add(m_col_instr);
140 persson 1052 }
141    
142 persson 1104 Gtk::TreeModelColumn<Glib::ustring> m_col_name;
143     Gtk::TreeModelColumn<gig::Instrument*> m_col_instr;
144 schoenebeck 1080 } m_Columns;
145 persson 1052
146     Gtk::VBox m_VBox;
147     Gtk::HPaned m_HPaned;
148    
149     Gtk::ScrolledWindow m_ScrolledWindow;
150 persson 1100
151 persson 1052 Gtk::TreeView m_TreeView;
152     Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
153    
154 schoenebeck 1080 class SamplesModel : public Gtk::TreeModel::ColumnRecord {
155     public:
156     SamplesModel() {
157     add(m_col_name);
158     add(m_col_sample);
159 schoenebeck 1084 add(m_col_group);
160 schoenebeck 1080 }
161    
162     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
163 schoenebeck 1082 Gtk::TreeModelColumn<gig::Sample*> m_col_sample;
164     Gtk::TreeModelColumn<gig::Group*> m_col_group;
165 schoenebeck 1080 } m_SamplesModel;
166 persson 1088
167 schoenebeck 1096 class SamplesTreeStore : public Gtk::TreeStore {
168     public:
169     static Glib::RefPtr<SamplesTreeStore> create(const SamplesModel& columns) {
170     return Glib::RefPtr<SamplesTreeStore>( new SamplesTreeStore(columns) );
171     }
172     protected:
173     SamplesTreeStore(const SamplesModel& columns) : Gtk::TreeStore(columns) {}
174     };
175    
176 persson 1088 Gtk::ScrolledWindow m_ScrolledWindowSamples;
177 schoenebeck 1080 Gtk::TreeView m_TreeViewSamples;
178 schoenebeck 1096 Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel;
179 schoenebeck 1080
180 persson 1100 DimRegionEdit dimreg_edit;
181    
182 persson 1052 Gtk::Notebook m_Notebook;
183 schoenebeck 1080 Gtk::Notebook m_TreeViewNotebook;
184 persson 1052
185 schoenebeck 1087 struct SampleImportItem {
186 persson 1100 gig::Sample* gig_sample; // pointer to the gig::Sample to
187     // which the sample data should be
188     // imported to
189     Glib::ustring sample_path; // file name of the sample to be
190     // imported
191 schoenebeck 1087 };
192     std::list<SampleImportItem> m_SampleImportQueue;
193    
194 persson 1052
195     void on_action_file_new();
196     void on_action_file_open();
197     void on_action_file_save();
198     void on_action_file_save_as();
199     void on_action_file_properties();
200 persson 1100 void show_instr_props();
201 persson 1052 void on_action_help_about();
202    
203 schoenebeck 1082 // sample right-click popup actions
204     void on_sample_treeview_button_release(GdkEventButton* button);
205     void on_action_sample_properties();
206     void on_action_add_group();
207     void on_action_add_sample();
208     void on_action_remove_sample();
209    
210 schoenebeck 1101 void on_action_add_instrument();
211     void on_action_remove_instrument();
212    
213 persson 1052 LoadDialog* load_dialog;
214     Loader* loader;
215     void load_gig(gig::File* gig, const char* filename);
216    
217     gig::File* file;
218    
219     void on_button_release(GdkEventButton* button);
220 persson 1100 void on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
221     Gtk::SelectionData& selection_data, guint, guint);
222     void on_sample_label_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context,
223     int, int,
224     const Gtk::SelectionData& selection_data,
225     guint, guint time);
226     void sample_name_changed(const Gtk::TreeModel::Path& path,
227     const Gtk::TreeModel::iterator& iter);
228     void instrument_name_changed(const Gtk::TreeModel::Path& path,
229     const Gtk::TreeModel::iterator& iter);
230 persson 1052
231 schoenebeck 1087 void __import_queued_samples();
232 schoenebeck 1101 void __clear();
233 schoenebeck 1087
234 persson 1100 Gtk::Menu* popup_menu;
235 persson 1052 };
236    
237     #endif

  ViewVC Help
Powered by ViewVC