--- gigedit/trunk/src/gigedit/gigedit.cpp 2007/10/21 15:32:36 1456 +++ gigedit/trunk/src/gigedit/gigedit.cpp 2008/02/02 08:18:19 1656 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Andreas Persson + * Copyright (C) 2007, 2008 Andreas Persson * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -20,6 +20,7 @@ #include "gigedit.h" #include +#include #include "mainwindow.h" #include "global.h" @@ -39,6 +40,8 @@ GigEditState(GigEdit* parent) : parent(parent) { } void run(gig::Instrument* pInstrument); + MainWindow* window; + private: // simple condition variable abstraction @@ -71,7 +74,6 @@ Cond open; Cond close; gig::Instrument* instrument; - MainWindow* window; void open_window(); void close_window(); @@ -130,8 +132,11 @@ ); } -} +} // namespace +GigEdit::GigEdit() { + state = NULL; +} int GigEdit::run(int argc, char* argv[]) { init_app(); @@ -148,10 +153,24 @@ init_app(); GigEditState state(this); + this->state = &state; state.run(pInstrument); + this->state = NULL; return 0; } +void GigEdit::on_note_on_event(int key, int velocity) { + if (!this->state) return; + GigEditState* state = (GigEditState*) this->state; + state->window->signal_note_on().emit(key, velocity); +} + +void GigEdit::on_note_off_event(int key, int velocity) { + if (!this->state) return; + GigEditState* state = (GigEditState*) this->state; + state->window->signal_note_off().emit(key, velocity); +} + sigc::signal& GigEdit::signal_file_structure_to_be_changed() { return file_structure_to_be_changed_signal; }