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

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

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

revision 1831 by persson, Tue Feb 3 19:38:19 2009 UTC revision 1898 by persson, Sun May 10 09:35:56 2009 UTC
# Line 175  void RegionChooser::on_note_on_event(int Line 175  void RegionChooser::on_note_on_event(int
175  }  }
176    
177  void RegionChooser::on_note_off_event(int key, int velocity) {  void RegionChooser::on_note_off_event(int key, int velocity) {
178      if (is_black_key(key))      if (is_black_key(key)) {
179          draw_region(key, key+1, black);          draw_region(key, key+1, black);
180      else      } else {
181          draw_region(key, key+1, white);          draw_region(key, key+1, key >= 21 && key <= 108 ? white : grey1);
182        }
183      m_VirtKeybOffVelocityLabel.set_text(ToString(velocity));      m_VirtKeybOffVelocityLabel.set_text(ToString(velocity));
184  }  }
185    
# Line 677  bool RegionChooser::on_motion_notify_eve Line 678  bool RegionChooser::on_motion_notify_eve
678          event->y < REGION_BLOCK_HEIGHT + KEYBOARD_HEIGHT)          event->y < REGION_BLOCK_HEIGHT + KEYBOARD_HEIGHT)
679      {      {
680          const int k = int(event->x / (get_width() - 1) * 128.0);          const int k = int(event->x / (get_width() - 1) * 128.0);
681          int velocity = (event->y >= REGION_BLOCK_HEIGHT + KEYBOARD_HEIGHT - 1) ? 127 :          if (k != currentActiveKey) {
682                         int(float(event->y - REGION_BLOCK_HEIGHT) / float(KEYBOARD_HEIGHT) * 128.0f) + 1;              int velocity =
683          if (velocity <= 0) velocity = 1;                  (event->y >= REGION_BLOCK_HEIGHT + KEYBOARD_HEIGHT - 1) ? 127 :
684          keyboard_key_released_signal.emit(currentActiveKey, velocity);                  int(float(event->y - REGION_BLOCK_HEIGHT) /
685          currentActiveKey = k;                      float(KEYBOARD_HEIGHT) * 128.0f) + 1;
686          keyboard_key_hit_signal.emit(k, velocity);              if (velocity <= 0) velocity = 1;
687                keyboard_key_released_signal.emit(currentActiveKey, velocity);
688                currentActiveKey = k;
689                keyboard_key_hit_signal.emit(k, velocity);
690            }
691      }      }
692    
693      if (resize.active) {      if (resize.active) {

Legend:
Removed from v.1831  
changed lines
  Added in v.1898

  ViewVC Help
Powered by ViewVC