1 |
/* |
/* |
2 |
* Copyright (C) 2007 Andreas Persson |
* Copyright (C) 2007, 2008 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
20 |
#include "gigedit.h" |
#include "gigedit.h" |
21 |
|
|
22 |
#include <gtkmm/main.h> |
#include <gtkmm/main.h> |
23 |
|
#include <glibmm/main.h> |
24 |
#include "mainwindow.h" |
#include "mainwindow.h" |
25 |
|
|
26 |
#include "global.h" |
#include "global.h" |
40 |
GigEditState(GigEdit* parent) : parent(parent) { } |
GigEditState(GigEdit* parent) : parent(parent) { } |
41 |
void run(gig::Instrument* pInstrument); |
void run(gig::Instrument* pInstrument); |
42 |
|
|
43 |
|
MainWindow* window; |
44 |
|
|
45 |
private: |
private: |
46 |
|
|
47 |
// simple condition variable abstraction |
// simple condition variable abstraction |
74 |
Cond open; |
Cond open; |
75 |
Cond close; |
Cond close; |
76 |
gig::Instrument* instrument; |
gig::Instrument* instrument; |
|
MainWindow* window; |
|
77 |
|
|
78 |
void open_window(); |
void open_window(); |
79 |
void close_window(); |
void close_window(); |
132 |
); |
); |
133 |
} |
} |
134 |
|
|
135 |
} |
} // namespace |
136 |
|
|
137 |
|
GigEdit::GigEdit() { |
138 |
|
state = NULL; |
139 |
|
} |
140 |
|
|
141 |
int GigEdit::run(int argc, char* argv[]) { |
int GigEdit::run(int argc, char* argv[]) { |
142 |
init_app(); |
init_app(); |
153 |
init_app(); |
init_app(); |
154 |
|
|
155 |
GigEditState state(this); |
GigEditState state(this); |
156 |
|
this->state = &state; |
157 |
state.run(pInstrument); |
state.run(pInstrument); |
158 |
|
this->state = NULL; |
159 |
return 0; |
return 0; |
160 |
} |
} |
161 |
|
|
162 |
|
void GigEdit::on_note_on_event(int key, int velocity) { |
163 |
|
if (!this->state) return; |
164 |
|
GigEditState* state = (GigEditState*) this->state; |
165 |
|
state->window->signal_note_on().emit(key, velocity); |
166 |
|
} |
167 |
|
|
168 |
|
void GigEdit::on_note_off_event(int key, int velocity) { |
169 |
|
if (!this->state) return; |
170 |
|
GigEditState* state = (GigEditState*) this->state; |
171 |
|
state->window->signal_note_off().emit(key, velocity); |
172 |
|
} |
173 |
|
|
174 |
sigc::signal<void, gig::File*>& GigEdit::signal_file_structure_to_be_changed() { |
sigc::signal<void, gig::File*>& GigEdit::signal_file_structure_to_be_changed() { |
175 |
return file_structure_to_be_changed_signal; |
return file_structure_to_be_changed_signal; |
176 |
} |
} |