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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1101 - (hide annotations) (download) (as text)
Sat Mar 17 17:46:09 2007 UTC (15 years, 8 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 6579 byte(s)
* implemented creating a new .gig file
  (Menu->File->New)
* implemented adding a new instrument
  (right-click popup in instruments treeview)
* implemented removing an instrument
  (right-click popup in instruments treeview)

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

  ViewVC Help
Powered by ViewVC