/[svn]/gigedit/trunk/src/gigedit/gigedit.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/gigedit.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1456 by persson, Sun Oct 21 15:32:36 2007 UTC revision 1660 by schoenebeck, Sun Feb 3 00:19:55 2008 UTC
# Line 1  Line 1 
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
# Line 20  Line 20 
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"
# Line 39  public: Line 40  public:
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
# Line 71  private: Line 74  private:
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();
# Line 128  void connect_signals(GigEdit* gigedit, M Line 130  void connect_signals(GigEdit* gigedit, M
130      mainwindow->signal_sample_ref_changed().connect(      mainwindow->signal_sample_ref_changed().connect(
131          gigedit->signal_sample_ref_changed().make_slot()          gigedit->signal_sample_ref_changed().make_slot()
132      );      );
133        mainwindow->signal_keyboard_key_hit().connect(
134            gigedit->signal_keyboard_key_hit().make_slot()
135        );
136        mainwindow->signal_keyboard_key_released().connect(
137            gigedit->signal_keyboard_key_released().make_slot()
138        );
139  }  }
140    
141  }  } // namespace
142    
143    GigEdit::GigEdit() {
144        state = NULL;
145    }
146    
147  int GigEdit::run(int argc, char* argv[]) {  int GigEdit::run(int argc, char* argv[]) {
148      init_app();      init_app();
# Line 148  int GigEdit::run(gig::Instrument* pInstr Line 159  int GigEdit::run(gig::Instrument* pInstr
159      init_app();      init_app();
160    
161      GigEditState state(this);      GigEditState state(this);
162        this->state = &state;
163      state.run(pInstrument);      state.run(pInstrument);
164        this->state = NULL;
165      return 0;      return 0;
166  }  }
167    
168    void GigEdit::on_note_on_event(int key, int velocity) {
169        if (!this->state) return;
170        GigEditState* state = (GigEditState*) this->state;
171        state->window->signal_note_on().emit(key, velocity);
172    }
173    
174    void GigEdit::on_note_off_event(int key, int velocity) {
175        if (!this->state) return;
176        GigEditState* state = (GigEditState*) this->state;
177        state->window->signal_note_off().emit(key, velocity);
178    }
179    
180  sigc::signal<void, gig::File*>& GigEdit::signal_file_structure_to_be_changed() {  sigc::signal<void, gig::File*>& GigEdit::signal_file_structure_to_be_changed() {
181      return file_structure_to_be_changed_signal;      return file_structure_to_be_changed_signal;
182  }  }
# Line 188  sigc::signal<void, gig::Sample*/*old*/, Line 213  sigc::signal<void, gig::Sample*/*old*/,
213      return sample_ref_changed_signal;      return sample_ref_changed_signal;
214  }  }
215    
216    sigc::signal<void, int/*key*/, int/*velocity*/>& GigEdit::signal_keyboard_key_hit() {
217        return keyboard_key_hit_signal;
218    }
219    
220    sigc::signal<void, int/*key*/, int/*velocity*/>& GigEdit::signal_keyboard_key_released() {
221        return keyboard_key_released_signal;
222    }
223    
224  Glib::StaticMutex GigEditState::mutex = GLIBMM_STATIC_MUTEX_INIT;  Glib::StaticMutex GigEditState::mutex = GLIBMM_STATIC_MUTEX_INIT;
225  Glib::Dispatcher* GigEditState::dispatcher = 0;  Glib::Dispatcher* GigEditState::dispatcher = 0;

Legend:
Removed from v.1456  
changed lines
  Added in v.1660

  ViewVC Help
Powered by ViewVC