/[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 1336 by schoenebeck, Sun Sep 9 21:31:20 2007 UTC revision 1660 by schoenebeck, Sun Feb 3 00:19:55 2008 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006, 2007 Andreas Persson   * Copyright (C) 2006-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 18  Line 18 
18   */   */
19    
20  #include "regionchooser.h"  #include "regionchooser.h"
21    #include <algorithm>
22  #include <gdkmm/cursor.h>  #include <gdkmm/cursor.h>
23  #include <gtkmm/stock.h>  #include <gtkmm/stock.h>
24  #include <gtkmm/spinbutton.h>  #include <gtkmm/spinbutton.h>
25  #include <gtkmm/dialog.h>  #include <gtkmm/dialog.h>
 #include <libintl.h>  
26  #include <math.h>  #include <math.h>
27    
28  #define _(String) gettext(String)  #include "global.h"
29    
30    #define REGION_BLOCK_HEIGHT             20
31    #define KEYBOARD_HEIGHT                 40
32    
33    void SortedRegions::update(gig::Instrument* instrument) {
34        // Usually, the regions in a gig file are ordered after their key
35        // range, but there are files where they are not. The
36        // RegionChooser code needs a sorted list of regions.
37        regions.clear();
38        if (instrument) {
39            for (gig::Region *r = instrument->GetFirstRegion() ;
40                 r ;
41                 r = instrument->GetNextRegion()) {
42                regions.push_back(r);
43            }
44            sort(regions.begin(), regions.end(), *this);
45        }
46    }
47    
48    gig::Region* SortedRegions::first() {
49        region_iterator = regions.begin();
50        return region_iterator == regions.end() ? 0 : *region_iterator;
51    }
52    
53    gig::Region* SortedRegions::next() {
54        region_iterator++;
55        return region_iterator == regions.end() ? 0 : *region_iterator;
56    }
57    
58    
59    
60  RegionChooser::RegionChooser()  RegionChooser::RegionChooser()
61  {  {
# Line 33  RegionChooser::RegionChooser() Line 63  RegionChooser::RegionChooser()
63    
64      red = Gdk::Color("#8070ff");      red = Gdk::Color("#8070ff");
65      grey1 = Gdk::Color("#b0b0b0");      grey1 = Gdk::Color("#b0b0b0");
66        activeKeyColor = Gdk::Color("#ff0000");
67        white = Gdk::Color("#ffffff");
68        black = Gdk::Color("#000000");
69    
70      colormap->alloc_color(red);      colormap->alloc_color(red);
71      colormap->alloc_color(grey1);      colormap->alloc_color(grey1);
72        colormap->alloc_color(activeKeyColor);
73        colormap->alloc_color(white);
74        colormap->alloc_color(black);
75      instrument = 0;      instrument = 0;
76      region = 0;      region = 0;
77      resize.active = false;      resize.active = false;
78      move.active = false;      move.active = false;
79      cursor_is_resize = false;      cursor_is_resize = false;
80      h1 = 20;      h1 = REGION_BLOCK_HEIGHT;
     width = 800;  
81    
82      actionGroup = Gtk::ActionGroup::create();      actionGroup = Gtk::ActionGroup::create();
83      actionGroup->add(Gtk::Action::create("Properties",      actionGroup->add(Gtk::Action::create("Properties",
# Line 90  RegionChooser::RegionChooser() Line 125  RegionChooser::RegionChooser()
125              sigc::mem_fun(*this, &RegionChooser::on_dimension_manager_changed)              sigc::mem_fun(*this, &RegionChooser::on_dimension_manager_changed)
126          )          )
127      );      );
128        keyboard_key_hit_signal.connect(
129            sigc::mem_fun(*this, &RegionChooser::on_note_on_event)
130        );
131        keyboard_key_released_signal.connect(
132            sigc::mem_fun(*this, &RegionChooser::on_note_off_event)
133        );
134  }  }
135    
136  RegionChooser::~RegionChooser()  RegionChooser::~RegionChooser()
137  {  {
138  }  }
139    
140    void RegionChooser::on_note_on_event(int key, int velocity) {
141        draw_region(key, key+1, activeKeyColor);
142    }
143    
144    void RegionChooser::on_note_off_event(int key, int velocity) {
145        if (is_black_key(key))
146            draw_region(key, key+1, black);
147        else
148            draw_region(key, key+1, white);
149    }
150    
151  void RegionChooser::on_realize()  void RegionChooser::on_realize()
152  {  {
153      // We need to call the base on_realize()      // We need to call the base on_realize()
# Line 111  bool RegionChooser::on_expose_event(GdkE Line 163  bool RegionChooser::on_expose_event(GdkE
163  {  {
164      Glib::RefPtr<Gdk::Window> window = get_window();      Glib::RefPtr<Gdk::Window> window = get_window();
165      window->clear();      window->clear();
166      const int h = 40;      const int h = KEYBOARD_HEIGHT;
167      const int w = width - 1;      const int w = get_width() - 1;
168      const int bh = int(h * 0.55);      const int bh = int(h * 0.55);
169    
170      Glib::RefPtr<const Gdk::GC> black = get_style()->get_black_gc();      Glib::RefPtr<const Gdk::GC> black = get_style()->get_black_gc();
171      Glib::RefPtr<const Gdk::GC> white = get_style()->get_white_gc();      Glib::RefPtr<const Gdk::GC> white = get_style()->get_white_gc();
172    
     Glib::RefPtr<Pango::Context> context = get_pango_context();  
     Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create(context);  
   
173      window->draw_rectangle(black, false, 0, h1, w, h - 1);      window->draw_rectangle(black, false, 0, h1, w, h - 1);
174      gc->set_foreground(grey1);      gc->set_foreground(grey1);
175      int x1 = int(w * 20.5 / 128.0 + 0.5);      int x1 = int(w * 20.5 / 128.0 + 0.5);
# Line 130  bool RegionChooser::on_expose_event(GdkE Line 179  bool RegionChooser::on_expose_event(GdkE
179      window->draw_rectangle(white, true, x1 + 1, h1 + 1, x2 - x1 - 1, h - 2);      window->draw_rectangle(white, true, x1 + 1, h1 + 1, x2 - x1 - 1, h - 2);
180      window->draw_rectangle(gc, true, x2 + 1, h1 + 1,      window->draw_rectangle(gc, true, x2 + 1, h1 + 1,
181                             w - x2 - 1, h - 2);                             w - x2 - 1, h - 2);
     int octave = -1;  
182      for (int i = 0 ; i < 128 ; i++) {      for (int i = 0 ; i < 128 ; i++) {
183          int note = (i + 3) % 12;          int note = (i + 3) % 12;
184          int x = int(w * i / 128.0 + 0.5);          int x = int(w * i / 128.0 + 0.5);
# Line 144  bool RegionChooser::on_expose_event(GdkE Line 192  bool RegionChooser::on_expose_event(GdkE
192          } else if (note == 3 || note == 8) {          } else if (note == 3 || note == 8) {
193              window->draw_line(black, x, h1 + 1, x, h1 + h);              window->draw_line(black, x, h1 + 1, x, h1 + h);
194          }          }
195          if (note == 3) {          if (note == 3) draw_digit(i);
             char buf[30];  
             sprintf(buf, "<span size=\"x-small\">%d</span>", octave);  
             layout->set_markup(buf);  
             Pango::Rectangle rectangle = layout->get_logical_extents();  
             double text_w = double(rectangle.get_width()) / Pango::SCALE;  
             double text_h = double(rectangle.get_height()) / Pango::SCALE;  
             double x2 = w * (i + 0.75) / 128.0;  
             window->draw_layout(black, int(x2 - text_w / 2 + 1),  
                                 int(h1 + h - text_h + 0.5), layout);  
             octave++;  
         }  
196      }      }
197    
198      if (instrument) {      if (instrument) {
199          int i = 0;          int i = 0;
200          gig::Region *next_region;          gig::Region *next_region;
201          int x3 = -1;          int x3 = -1;
202          for (gig::Region *r = instrument->GetFirstRegion() ;          for (gig::Region *r = regions.first() ; r ; r = next_region) {
              r ;  
              r = next_region) {  
203    
204              if (x3 < 0) x3 = int(w * (r->KeyRange.low) / 128.0 + 0.5);              if (x3 < 0) x3 = int(w * (r->KeyRange.low) / 128.0 + 0.5);
205              next_region = instrument->GetNextRegion();              next_region = regions.next();
206              if (!next_region || r->KeyRange.high + 1 != next_region->KeyRange.low) {              if (!next_region || r->KeyRange.high + 1 != next_region->KeyRange.low) {
207                  int x2 = int(w * (r->KeyRange.high + 1) / 128.0 + 0.5);                  int x2 = int(w * (r->KeyRange.high + 1) / 128.0 + 0.5);
208                  window->draw_line(black, x3, 0, x2, 0);                  window->draw_line(black, x3, 0, x2, 0);
# Line 179  bool RegionChooser::on_expose_event(GdkE Line 214  bool RegionChooser::on_expose_event(GdkE
214              i++;              i++;
215          }          }
216    
217          for (gig::Region *r = instrument->GetFirstRegion() ;          for (gig::Region *r = regions.first() ; r ; r = regions.next()) {
              r ;  
              r = instrument->GetNextRegion()) {  
218              int x = int(w * (r->KeyRange.low) / 128.0 + 0.5);              int x = int(w * (r->KeyRange.low) / 128.0 + 0.5);
219              window->draw_line(black, x, 1, x, h1 - 2);              window->draw_line(black, x, 1, x, h1 - 2);
220          }          }
# Line 200  bool RegionChooser::on_expose_event(GdkE Line 233  bool RegionChooser::on_expose_event(GdkE
233  void RegionChooser::on_size_request(GtkRequisition* requisition)  void RegionChooser::on_size_request(GtkRequisition* requisition)
234  {  {
235      *requisition = GtkRequisition();      *requisition = GtkRequisition();
236      requisition->height = 40 + 20;      requisition->height = KEYBOARD_HEIGHT + REGION_BLOCK_HEIGHT;
237      requisition->width = 500;      requisition->width = 500;
238  }  }
239    
240    bool RegionChooser::is_black_key(int key) {
241        const int note = (key + 3) % 12;
242        return note == 1 || note == 4 || note == 6 || note == 9 || note == 11;
243    }
244    
245    void RegionChooser::draw_digit(int key) {
246        const int h = KEYBOARD_HEIGHT;
247        const int w = get_width() - 1;
248        Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create(get_pango_context());
249        char buf[30];
250        sprintf(buf, "<span size=\"8000\">%d</span>", key / 12 - 1);
251        layout->set_markup(buf);
252        Pango::Rectangle rectangle = layout->get_logical_extents();
253        double text_w = double(rectangle.get_width()) / Pango::SCALE;
254        double text_h = double(rectangle.get_height()) / Pango::SCALE;
255        double x = w * (key + 0.75) / 128.0;
256        get_window()->draw_layout(get_style()->get_black_gc(), int(x - text_w / 2 + 1),
257                                  int(h1 + h - text_h + 0.5), layout);
258    }
259    
 // not used  
260  void RegionChooser::draw_region(int from, int to, const Gdk::Color& color)  void RegionChooser::draw_region(int from, int to, const Gdk::Color& color)
261  {  {
262      const int h = 40;      const int h = KEYBOARD_HEIGHT;
263      const int w = width;      const int w = get_width() - 1;
264      const int bh = int(h * 0.55);      const int bh = int(h * 0.55);
265    
266      Glib::RefPtr<Gdk::Window> window = get_window();      Glib::RefPtr<Gdk::Window> window = get_window();
# Line 220  void RegionChooser::draw_region(int from Line 271  void RegionChooser::draw_region(int from
271          int x = int(w * i / 128.0 + 0.5) + 1;          int x = int(w * i / 128.0 + 0.5) + 1;
272          int x2 = int(w * (i + 1.5) / 128.0 + 0.5);          int x2 = int(w * (i + 1.5) / 128.0 + 0.5);
273          int x3 = int(w * (i + 1) / 128.0 + 0.5);          int x3 = int(w * (i + 1) / 128.0 + 0.5);
274          int x4 = int(w * (i - 0.5) / 128 + 0.5) + 1;          int x4 = int(w * (i - 0.5) / 128.0 + 0.5);
275          int w1 = x3 - x;          int w1 = x3 - x;
276          switch (note) {          switch (note) {
277          case 0: case 5: case 10:          case 0: case 5: case 10:
278              window->draw_rectangle(gc, true, x, h1 + 1, w1, bh);              window->draw_rectangle(gc, true, x, h1 + 1, w1, bh);
279              window->draw_rectangle(gc, true, x4, h1 + bh + 1, x2 - x4, h - bh - 2);              window->draw_rectangle(gc, true, x4 + 1, h1 + bh + 1, x2 - x4 - 1, h - bh - 2);
280              break;              break;
281          case 2: case 7:          case 2: case 7:
282              window->draw_rectangle(gc, true, x, h1 + 1, w1, bh);              window->draw_rectangle(gc, true, x, h1 + 1, w1, bh);
283              window->draw_rectangle(gc, true, x4, h1 + bh + 1, x3 - x4, h - bh - 2);              window->draw_rectangle(gc, true, x4 + 1, h1 + bh + 1, x3 - x4 - 1, h - bh - 2);
284              break;              break;
285          case 3: case 8:          case 3: case 8:
286              window->draw_rectangle(gc, true, x, h1 + 1, w1, bh);              window->draw_rectangle(gc, true, x, h1 + 1, w1, bh);
287              window->draw_rectangle(gc, true, x, h1 + bh + 1, x2 - x, h - bh - 2);              window->draw_rectangle(gc, true, x, h1 + bh + 1, x2 - x, h - bh - 2);
288                if (note == 3) draw_digit(i);
289              break;              break;
290          default:          default:
291              window->draw_rectangle(gc, true, x, h1 + 1, w1, bh - 1);              window->draw_rectangle(gc, true, x, h1 + 1, w1, bh - 1);
# Line 245  void RegionChooser::draw_region(int from Line 297  void RegionChooser::draw_region(int from
297  void RegionChooser::set_instrument(gig::Instrument* instrument)  void RegionChooser::set_instrument(gig::Instrument* instrument)
298  {  {
299      this->instrument = instrument;      this->instrument = instrument;
300      region = instrument ? instrument->GetFirstRegion() : 0;      regions.update(instrument);
301        region = regions.first();
302      queue_draw();      queue_draw();
303      region_selected();      region_selected();
304  }  }
305    
306  bool RegionChooser::on_button_release_event(GdkEventButton* event)  bool RegionChooser::on_button_release_event(GdkEventButton* event)
307  {  {
308        const int k = int(event->x / (get_width() - 1) * 128.0);
309    
310        if (event->type == GDK_BUTTON_RELEASE) {
311            if (event->y >= REGION_BLOCK_HEIGHT) {
312                int velocity = (event->y >= REGION_BLOCK_HEIGHT + KEYBOARD_HEIGHT - 1) ? 127 :
313                               int(float(event->y - REGION_BLOCK_HEIGHT) / float(KEYBOARD_HEIGHT) * 128.0f) + 1;
314                keyboard_key_released_signal.emit(k, velocity);
315            }
316        }
317    
318      if (resize.active) {      if (resize.active) {
319          get_window()->pointer_ungrab(event->time);          get_window()->pointer_ungrab(event->time);
320          resize.active = false;          resize.active = false;
# Line 263  bool RegionChooser::on_button_release_ev Line 326  bool RegionChooser::on_button_release_ev
326                      resize.region->KeyRange.low, // low                      resize.region->KeyRange.low, // low
327                      resize.pos - 1 // high                      resize.pos - 1 // high
328                  );                  );
329                    regions.update(instrument);
330                  instrument_changed.emit();                  instrument_changed.emit();
331                  instrument_struct_changed_signal.emit(instrument);                  instrument_struct_changed_signal.emit(instrument);
332              }              }
# Line 273  bool RegionChooser::on_button_release_ev Line 337  bool RegionChooser::on_button_release_ev
337                      resize.pos, // low                      resize.pos, // low
338                      resize.region->KeyRange.high // high                      resize.region->KeyRange.high // high
339                  );                  );
340                    regions.update(instrument);
341                  instrument_changed.emit();                  instrument_changed.emit();
342                  instrument_struct_changed_signal.emit(instrument);                  instrument_struct_changed_signal.emit(instrument);
343              }              }
# Line 292  bool RegionChooser::on_button_release_ev Line 357  bool RegionChooser::on_button_release_ev
357                  region->KeyRange.low  + move.pos,                  region->KeyRange.low  + move.pos,
358                  region->KeyRange.high + move.pos                  region->KeyRange.high + move.pos
359              );              );
360                regions.update(instrument);
361                instrument_changed.emit();
362              instrument_struct_changed_signal.emit(instrument);              instrument_struct_changed_signal.emit(instrument);
363          }          }
364    
# Line 307  bool RegionChooser::on_button_press_even Line 374  bool RegionChooser::on_button_press_even
374  {  {
375      if (!instrument) return true;      if (!instrument) return true;
376    
377      int k = int(event->x / (width - 1) * 128.0);      const int k = int(event->x / (get_width() - 1) * 128.0);
378    
379        if (event->type == GDK_BUTTON_PRESS) {
380            if (event->y >= REGION_BLOCK_HEIGHT) {
381                int velocity = (event->y >= REGION_BLOCK_HEIGHT + KEYBOARD_HEIGHT - 1) ? 127 :
382                               int(float(event->y - REGION_BLOCK_HEIGHT) / float(KEYBOARD_HEIGHT) * 128.0f) + 1;
383                keyboard_key_hit_signal.emit(k, velocity);
384            }
385        }
386    
387        if (event->y >= REGION_BLOCK_HEIGHT) return true;
388      if (event->type == GDK_BUTTON_PRESS && event->button == 3) {      if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
389          gig::Region* r = get_region(k);          gig::Region* r = get_region(k);
390          if (r) {          if (r) {
# Line 353  gig::Region* RegionChooser::get_region(i Line 429  gig::Region* RegionChooser::get_region(i
429  {  {
430      gig::Region* prev_region = 0;      gig::Region* prev_region = 0;
431      gig::Region* next_region;      gig::Region* next_region;
432      for (gig::Region *r = instrument->GetFirstRegion() ; r ;      for (gig::Region *r = regions.first() ; r ; r = next_region) {
433           r = next_region) {          next_region = regions.next();
         next_region = instrument->GetNextRegion();  
434    
435          if (key < r->KeyRange.low) return 0;          if (key < r->KeyRange.low) return 0;
436          if (key <= r->KeyRange.high) {          if (key <= r->KeyRange.high) {
# Line 370  gig::Region* RegionChooser::get_region(i Line 445  gig::Region* RegionChooser::get_region(i
445    
446  void RegionChooser::motion_resize_region(int x, int y)  void RegionChooser::motion_resize_region(int x, int y)
447  {  {
448      const int w = width - 1;      const int w = get_width() - 1;
449      Glib::RefPtr<Gdk::Window> window = get_window();      Glib::RefPtr<Gdk::Window> window = get_window();
450    
451      int k = int(double(x) / w * 128.0 + 0.5);      int k = int(double(x) / w * 128.0 + 0.5);
# Line 427  void RegionChooser::motion_resize_region Line 502  void RegionChooser::motion_resize_region
502    
503  void RegionChooser::motion_move_region(int x, int y)  void RegionChooser::motion_move_region(int x, int y)
504  {  {
505      const int w = width - 1;      const int w = get_width() - 1;
506      Glib::RefPtr<Gdk::Window> window = get_window();      Glib::RefPtr<Gdk::Window> window = get_window();
507    
508      int k = int(double(x - move.from_x) / w * 128.0 + 0.5);      int k = int(double(x - move.from_x) / w * 128.0 + 0.5);
# Line 437  void RegionChooser::motion_move_region(i Line 512  void RegionChooser::motion_move_region(i
512      bool new_touch_right;      bool new_touch_right;
513      int a = 0;      int a = 0;
514      if (k > move.pos) {      if (k > move.pos) {
515          for (gig::Region* r = instrument->GetFirstRegion() ; ;          for (gig::Region* r = regions.first() ; ; r = regions.next()) {
              r = instrument->GetNextRegion()) {  
516              if (r != region) {              if (r != region) {
517                  int b = r ? r->KeyRange.low : 128;                  int b = r ? r->KeyRange.low : 128;
518    
# Line 468  void RegionChooser::motion_move_region(i Line 542  void RegionChooser::motion_move_region(i
542              }              }
543          }          }
544      } else {      } else {
545          for (gig::Region* r = instrument->GetFirstRegion() ; ;          for (gig::Region* r = regions.first() ; ; r = regions.next()) {
              r = instrument->GetNextRegion()) {  
546              if (r != region) {              if (r != region) {
547                  int b = r ? r->KeyRange.low : 128;                  int b = r ? r->KeyRange.low : 128;
548    
# Line 567  bool RegionChooser::on_motion_notify_eve Line 640  bool RegionChooser::on_motion_notify_eve
640  }  }
641    
642  bool RegionChooser::is_in_resize_zone(double x, double y) {  bool RegionChooser::is_in_resize_zone(double x, double y) {
643      const int w = width - 1;      const int w = get_width() - 1;
644    
645      if (instrument && y >= 0 && y <= h1) {      if (instrument && y >= 0 && y <= h1) {
646          gig::Region* prev_region = 0;          gig::Region* prev_region = 0;
647          gig::Region* next_region;          gig::Region* next_region;
648          for (gig::Region* r = instrument->GetFirstRegion() ; r ; r = next_region) {          for (gig::Region* r = regions.first(); r ; r = next_region) {
649              next_region = instrument->GetNextRegion();              next_region = regions.next();
650    
651              int lo = int(w * (r->KeyRange.low) / 128.0 + 0.5);              int lo = int(w * (r->KeyRange.low) / 128.0 + 0.5);
652              if (x <= lo - 2) break;              if (x <= lo - 2) break;
# Line 589  bool RegionChooser::is_in_resize_zone(do Line 662  bool RegionChooser::is_in_resize_zone(do
662                      resize.mode = resize.undecided;                      resize.mode = resize.undecided;
663                      resize.min = prev_region->KeyRange.low + 1;                      resize.min = prev_region->KeyRange.low + 1;
664                      resize.prev_region = prev_region;                      resize.prev_region = prev_region;
665                      return true;                      return resize.min != resize.max;
666                  }                  }
667    
668                  // edit low limit                  // edit low limit
669                  resize.mode = resize.moving_low_limit;                  resize.mode = resize.moving_low_limit;
670                  resize.min = prev_region ? prev_region->KeyRange.high + 1 : 0;                  resize.min = prev_region ? prev_region->KeyRange.high + 1 : 0;
671                  return true;                  return resize.min != resize.max;
672              }              }
673              if (!next_region || r->KeyRange.high + 1 != next_region->KeyRange.low) {              if (!next_region || r->KeyRange.high + 1 != next_region->KeyRange.low) {
674                  int hi = int(w * (r->KeyRange.high + 1) / 128.0 + 0.5);                  int hi = int(w * (r->KeyRange.high + 1) / 128.0 + 0.5);
# Line 607  bool RegionChooser::is_in_resize_zone(do Line 680  bool RegionChooser::is_in_resize_zone(do
680                      resize.mode = resize.moving_high_limit;                      resize.mode = resize.moving_high_limit;
681                      resize.min = r->KeyRange.low + 1;                      resize.min = r->KeyRange.low + 1;
682                      resize.max = next_region ? next_region->KeyRange.low : 128;                      resize.max = next_region ? next_region->KeyRange.low : 128;
683                      return true;                      return resize.min != resize.max;
684                  }                  }
685              }              }
686              prev_region = r;              prev_region = r;
# Line 616  bool RegionChooser::is_in_resize_zone(do Line 689  bool RegionChooser::is_in_resize_zone(do
689      return false;      return false;
690  }  }
691    
692  sigc::signal<void> RegionChooser::signal_region_selected()  sigc::signal<void>& RegionChooser::signal_region_selected()
693  {  {
694      return region_selected;      return region_selected;
695  }  }
696    
697  sigc::signal<void> RegionChooser::signal_instrument_changed()  sigc::signal<void>& RegionChooser::signal_instrument_changed()
698  {  {
699      return instrument_changed;      return instrument_changed;
700  }  }
# Line 659  void RegionChooser::add_region() Line 732  void RegionChooser::add_region()
732      region->SetKeyRange(new_region_pos, new_region_pos);      region->SetKeyRange(new_region_pos, new_region_pos);
733    
734      instrument_struct_changed_signal.emit(instrument);      instrument_struct_changed_signal.emit(instrument);
735        regions.update(instrument);
736    
737      queue_draw();      queue_draw();
738      region_selected();      region_selected();
# Line 670  void RegionChooser::delete_region() Line 744  void RegionChooser::delete_region()
744      instrument_struct_to_be_changed_signal.emit(instrument);      instrument_struct_to_be_changed_signal.emit(instrument);
745      instrument->DeleteRegion(region);      instrument->DeleteRegion(region);
746      instrument_struct_changed_signal.emit(instrument);      instrument_struct_changed_signal.emit(instrument);
747        regions.update(instrument);
748    
749      region = 0;      region = 0;
750      queue_draw();      queue_draw();
# Line 689  void RegionChooser::on_dimension_manager Line 764  void RegionChooser::on_dimension_manager
764      instrument_changed();      instrument_changed();
765  }  }
766    
767  sigc::signal<void, gig::Instrument*> RegionChooser::signal_instrument_struct_to_be_changed() {  sigc::signal<void, gig::Instrument*>& RegionChooser::signal_instrument_struct_to_be_changed() {
768      return instrument_struct_to_be_changed_signal;      return instrument_struct_to_be_changed_signal;
769  }  }
770    
771  sigc::signal<void, gig::Instrument*> RegionChooser::signal_instrument_struct_changed() {  sigc::signal<void, gig::Instrument*>& RegionChooser::signal_instrument_struct_changed() {
772      return instrument_struct_changed_signal;      return instrument_struct_changed_signal;
773  }  }
774    
775  sigc::signal<void, gig::Region*> RegionChooser::signal_region_to_be_changed() {  sigc::signal<void, gig::Region*>& RegionChooser::signal_region_to_be_changed() {
776      return region_to_be_changed_signal;      return region_to_be_changed_signal;
777  }  }
778    
779  sigc::signal<void, gig::Region*> RegionChooser::signal_region_changed_signal() {  sigc::signal<void, gig::Region*>& RegionChooser::signal_region_changed_signal() {
780      return region_changed_signal;      return region_changed_signal;
781  }  }
782    
783    sigc::signal<void, int/*key*/, int/*velocity*/>& RegionChooser::signal_keyboard_key_hit() {
784        return keyboard_key_hit_signal;
785    }
786    
787    sigc::signal<void, int/*key*/, int/*velocity*/>& RegionChooser::signal_keyboard_key_released() {
788        return keyboard_key_released_signal;
789    }

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

  ViewVC Help
Powered by ViewVC