/[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 1225 by schoenebeck, Sun Jun 10 10:56:11 2007 UTC revision 1336 by schoenebeck, Sun Sep 9 21:31:20 2007 UTC
# Line 31  RegionChooser::RegionChooser() Line 31  RegionChooser::RegionChooser()
31  {  {
32      Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();      Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();
33    
     black = Gdk::Color("black");  
     white = Gdk::Color("white");  
34      red = Gdk::Color("#8070ff");      red = Gdk::Color("#8070ff");
35      blue = Gdk::Color("#c098ff");      grey1 = Gdk::Color("#b0b0b0");
     green = Gdk::Color("#a088ff");  
     grey1 = Gdk::Color("red");  
36    
     colormap->alloc_color(black);  
     colormap->alloc_color(white);  
37      colormap->alloc_color(red);      colormap->alloc_color(red);
     colormap->alloc_color(blue);  
     colormap->alloc_color(green);  
38      colormap->alloc_color(grey1);      colormap->alloc_color(grey1);
39      instrument = 0;      instrument = 0;
40      region = 0;      region = 0;
41      resize.active = false;      resize.active = false;
42        move.active = false;
43      cursor_is_resize = false;      cursor_is_resize = false;
44      h1 = 20;      h1 = 20;
45      width = 800;      width = 800;
# Line 86  RegionChooser::RegionChooser() Line 79  RegionChooser::RegionChooser()
79      add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK |      add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK |
80                 Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK);                 Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK);
81    
82      dimensionManager.articulation_changed_signal.connect(      dimensionManager.region_to_be_changed_signal.connect(
83          sigc::mem_fun(*this, &RegionChooser::on_dimension_manager_changed)          region_to_be_changed_signal.make_slot()
84        );
85        dimensionManager.region_changed_signal.connect(
86            region_changed_signal.make_slot()
87        );
88        dimensionManager.region_changed_signal.connect(
89            sigc::hide(
90                sigc::mem_fun(*this, &RegionChooser::on_dimension_manager_changed)
91            )
92      );      );
93  }  }
94    
# Line 117  bool RegionChooser::on_expose_event(GdkE Line 118  bool RegionChooser::on_expose_event(GdkE
118      Glib::RefPtr<const Gdk::GC> black = get_style()->get_black_gc();      Glib::RefPtr<const Gdk::GC> black = get_style()->get_black_gc();
119      Glib::RefPtr<const Gdk::GC> white = get_style()->get_white_gc();      Glib::RefPtr<const Gdk::GC> white = get_style()->get_white_gc();
120    
121        Glib::RefPtr<Pango::Context> context = get_pango_context();
122        Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create(context);
123    
124      window->draw_rectangle(black, false, 0, h1, w, h - 1);      window->draw_rectangle(black, false, 0, h1, w, h - 1);
125      window->draw_rectangle(white, true, 1, h1 + 1, w - 1, h - 2);      gc->set_foreground(grey1);
126        int x1 = int(w * 20.5 / 128.0 + 0.5);
127        int x2 = int(w * 109.5 / 128.0 + 0.5);
128        window->draw_rectangle(gc, true, 1, h1 + 1,
129                               x1 - 1, h - 2);
130        window->draw_rectangle(white, true, x1 + 1, h1 + 1, x2 - x1 - 1, h - 2);
131        window->draw_rectangle(gc, true, x2 + 1, h1 + 1,
132                               w - x2 - 1, h - 2);
133        int octave = -1;
134      for (int i = 0 ; i < 128 ; i++) {      for (int i = 0 ; i < 128 ; i++) {
135          int note = (i + 3) % 12;          int note = (i + 3) % 12;
136          int x = int(w * i / 128.0 + 0.5);          int x = int(w * i / 128.0 + 0.5);
# Line 132  bool RegionChooser::on_expose_event(GdkE Line 144  bool RegionChooser::on_expose_event(GdkE
144          } else if (note == 3 || note == 8) {          } else if (note == 3 || note == 8) {
145              window->draw_line(black, x, h1 + 1, x, h1 + h);              window->draw_line(black, x, h1 + 1, x, h1 + h);
146          }          }
147            if (note == 3) {
148                char buf[30];
149                sprintf(buf, "<span size=\"x-small\">%d</span>", octave);
150                layout->set_markup(buf);
151                Pango::Rectangle rectangle = layout->get_logical_extents();
152                double text_w = double(rectangle.get_width()) / Pango::SCALE;
153                double text_h = double(rectangle.get_height()) / Pango::SCALE;
154                double x2 = w * (i + 0.75) / 128.0;
155                window->draw_layout(black, int(x2 - text_w / 2 + 1),
156                                    int(h1 + h - text_h + 0.5), layout);
157                octave++;
158            }
159      }      }
160    
161      if (instrument) {      if (instrument) {
162          int i = 0;          int i = 0;
163          gig::Region *nextRegion;          gig::Region *next_region;
164          int x3 = -1;          int x3 = -1;
165          for (gig::Region *r = instrument->GetFirstRegion() ;          for (gig::Region *r = instrument->GetFirstRegion() ;
166               r ;               r ;
167               r = nextRegion) {               r = next_region) {
168    
169              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);
170              nextRegion = instrument->GetNextRegion();              next_region = instrument->GetNextRegion();
171              if (!nextRegion || r->KeyRange.high + 1 != nextRegion->KeyRange.low) {              if (!next_region || r->KeyRange.high + 1 != next_region->KeyRange.low) {
172                  int x2 = int(w * (r->KeyRange.high + 1) / 128.0 + 0.5);                  int x2 = int(w * (r->KeyRange.high + 1) / 128.0 + 0.5);
173                  window->draw_line(black, x3, 0, x2, 0);                  window->draw_line(black, x3, 0, x2, 0);
174                  window->draw_line(black, x3, h1 - 1, x2, h1 - 1);                  window->draw_line(black, x3, h1 - 1, x2, h1 - 1);
# Line 223  void RegionChooser::set_instrument(gig:: Line 247  void RegionChooser::set_instrument(gig::
247      this->instrument = instrument;      this->instrument = instrument;
248      region = instrument ? instrument->GetFirstRegion() : 0;      region = instrument ? instrument->GetFirstRegion() : 0;
249      queue_draw();      queue_draw();
250      sel_changed_signal.emit();      region_selected();
251  }  }
252    
253  bool RegionChooser::on_button_release_event(GdkEventButton* event)  bool RegionChooser::on_button_release_event(GdkEventButton* event)
# Line 233  bool RegionChooser::on_button_release_ev Line 257  bool RegionChooser::on_button_release_ev
257          resize.active = false;          resize.active = false;
258    
259          if (resize.mode == resize.moving_high_limit) {          if (resize.mode == resize.moving_high_limit) {
260              resize.region->KeyRange.high = resize.pos - 1;              if (resize.region->KeyRange.high != resize.pos - 1) {
261                    instrument_struct_to_be_changed_signal.emit(instrument);
262                    resize.region->SetKeyRange(
263                        resize.region->KeyRange.low, // low
264                        resize.pos - 1 // high
265                    );
266                    instrument_changed.emit();
267                    instrument_struct_changed_signal.emit(instrument);
268                }
269          } else if (resize.mode == resize.moving_low_limit) {          } else if (resize.mode == resize.moving_low_limit) {
270              resize.region->KeyRange.low = resize.pos;              if (resize.region->KeyRange.low != resize.pos) {
271                    instrument_struct_to_be_changed_signal.emit(instrument);
272                    resize.region->SetKeyRange(
273                        resize.pos, // low
274                        resize.region->KeyRange.high // high
275                    );
276                    instrument_changed.emit();
277                    instrument_struct_changed_signal.emit(instrument);
278                }
279          }          }
280    
281          if (!is_in_resize_zone(event->x, event->y) && cursor_is_resize) {          if (!is_in_resize_zone(event->x, event->y) && cursor_is_resize) {
282              get_window()->set_cursor();              get_window()->set_cursor();
283              cursor_is_resize = false;              cursor_is_resize = false;
284          }          }
285        } else if (move.active) {
286            get_window()->pointer_ungrab(event->time);
287            move.active = false;
288    
289            if (move.pos) {
290                instrument_struct_to_be_changed_signal.emit(instrument);
291                region->SetKeyRange(
292                    region->KeyRange.low  + move.pos,
293                    region->KeyRange.high + move.pos
294                );
295                instrument_struct_changed_signal.emit(instrument);
296            }
297    
298            if (is_in_resize_zone(event->x, event->y)) {
299                get_window()->set_cursor(Gdk::Cursor(Gdk::SB_H_DOUBLE_ARROW));
300                cursor_is_resize = true;
301            }
302      }      }
303      return true;      return true;
304  }  }
# Line 257  bool RegionChooser::on_button_press_even Line 314  bool RegionChooser::on_button_press_even
314          if (r) {          if (r) {
315              region = r;              region = r;
316              queue_draw();              queue_draw();
317              sel_changed_signal.emit();              region_selected();
318              popup_menu_inside_region->popup(event->button, event->time);              popup_menu_inside_region->popup(event->button, event->time);
319          } else {          } else {
320              new_region_pos = k;              new_region_pos = k;
# Line 265  bool RegionChooser::on_button_press_even Line 322  bool RegionChooser::on_button_press_even
322          }          }
323      } else {      } else {
324          if (is_in_resize_zone(event->x, event->y)) {          if (is_in_resize_zone(event->x, event->y)) {
             Gdk::Cursor double_arrow(Gdk::SB_H_DOUBLE_ARROW);  
325              get_window()->pointer_grab(false,              get_window()->pointer_grab(false,
326                                         Gdk::BUTTON_RELEASE_MASK |                                         Gdk::BUTTON_RELEASE_MASK |
327                                         Gdk::POINTER_MOTION_MASK |                                         Gdk::POINTER_MOTION_MASK |
328                                         Gdk::POINTER_MOTION_HINT_MASK,                                         Gdk::POINTER_MOTION_HINT_MASK,
329                                         double_arrow, event->time);                                         Gdk::Cursor(Gdk::SB_H_DOUBLE_ARROW), event->time);
330              resize.active = true;              resize.active = true;
331          } else {          } else {
332              gig::Region* r = get_region(k);              gig::Region* r = get_region(k);
333              if (r) {              if (r) {
334                  region = r;                  region = r;
335                  queue_draw();                  queue_draw();
336                  sel_changed_signal.emit();                  region_selected();
337    
338                    get_window()->pointer_grab(false,
339                                               Gdk::BUTTON_RELEASE_MASK |
340                                               Gdk::POINTER_MOTION_MASK |
341                                               Gdk::POINTER_MOTION_HINT_MASK,
342                                               Gdk::Cursor(Gdk::FLEUR), event->time);
343                    move.active = true;
344                    move.from_x = event->x;
345                    move.pos = 0;
346              }              }
347          }          }
348      }      }
# Line 286  bool RegionChooser::on_button_press_even Line 351  bool RegionChooser::on_button_press_even
351    
352  gig::Region* RegionChooser::get_region(int key)  gig::Region* RegionChooser::get_region(int key)
353  {  {
354        gig::Region* prev_region = 0;
355        gig::Region* next_region;
356      for (gig::Region *r = instrument->GetFirstRegion() ; r ;      for (gig::Region *r = instrument->GetFirstRegion() ; r ;
357           r = instrument->GetNextRegion()) {           r = next_region) {
358            next_region = instrument->GetNextRegion();
359    
360          if (key < r->KeyRange.low) return 0;          if (key < r->KeyRange.low) return 0;
361          if (key <= r->KeyRange.high) return r;          if (key <= r->KeyRange.high) {
362                move.touch_left = prev_region && prev_region->KeyRange.high + 1 == r->KeyRange.low;
363                move.touch_right = next_region && r->KeyRange.high + 1 == next_region->KeyRange.low;
364                return r;
365            }
366            prev_region = r;
367      }      }
368      return 0;      return 0;
369  }  }
370    
371  bool RegionChooser::on_motion_notify_event(GdkEventMotion* event)  void RegionChooser::motion_resize_region(int x, int y)
372  {  {
373      const int w = width - 1;      const int w = width - 1;
374      Glib::RefPtr<Gdk::Window> window = get_window();      Glib::RefPtr<Gdk::Window> window = get_window();
     int x, y;  
     Gdk::ModifierType state = Gdk::ModifierType(0);  
     window->get_pointer(x, y, state);  
     if (resize.active) {  
         int k = int(double(x) / w * 128.0 + 0.5);  
375    
376          if (k < resize.min) k = resize.min;      int k = int(double(x) / w * 128.0 + 0.5);
         else if (k > resize.max) k = resize.max;  
377    
378          if (k != resize.pos) {      if (k < resize.min) k = resize.min;
379              if (resize.mode == resize.undecided) {      else if (k > resize.max) k = resize.max;
380                  if (k < resize.pos) {  
381                      // edit high limit of prev_region      if (k != resize.pos) {
382                      resize.max = resize.region->KeyRange.low;          if (resize.mode == resize.undecided) {
383                      resize.region = resize.prev_region;              if (k < resize.pos) {
384                      resize.mode = resize.moving_high_limit;                  // edit high limit of prev_region
385                  } else {                  resize.max = resize.region->KeyRange.low;
386                      // edit low limit of region                  resize.region = resize.prev_region;
387                      resize.min = resize.prev_region->KeyRange.high + 1;                  resize.mode = resize.moving_high_limit;
388                      resize.mode = resize.moving_low_limit;              } else {
389                  }                  // edit low limit of region
390                    resize.min = resize.prev_region->KeyRange.high + 1;
391                    resize.mode = resize.moving_low_limit;
392                }
393            }
394            Glib::RefPtr<const Gdk::GC> black = get_style()->get_black_gc();
395            Glib::RefPtr<const Gdk::GC> white = get_style()->get_white_gc();
396            if (region == resize.region) {
397                gc->set_foreground(red);
398                white = gc;
399            }
400            Glib::RefPtr<const Gdk::GC> bg = get_style()->get_bg_gc(Gtk::STATE_NORMAL);
401            int prevx = int(w * resize.pos / 128.0 + 0.5);
402            x = int(w * k / 128.0 + 0.5);
403    
404            if (resize.mode == resize.moving_high_limit) {
405                if (k > resize.pos) {
406                    window->draw_rectangle(white, true, prevx, 1, x - prevx, h1 - 2);
407                    window->draw_line(black, prevx, 0, x, 0);
408                    window->draw_line(black, prevx, h1 - 1, x, h1 - 1);
409                } else {
410                    int xx = ((resize.pos == resize.max && resize.max != 128) ? 1 : 0);
411                    window->draw_rectangle(bg, true, x + 1, 0, prevx - x - xx, h1);
412              }              }
413              Glib::RefPtr<const Gdk::GC> black = get_style()->get_black_gc();          } else {
414              Glib::RefPtr<const Gdk::GC> white = get_style()->get_white_gc();              if (k < resize.pos) {
415              if (region == resize.region) {                  window->draw_rectangle(white, true, x + 1, 1, prevx - x, h1 - 2);
416                  gc->set_foreground(red);                  window->draw_line(black, x, 0, prevx, 0);
417                  white = gc;                  window->draw_line(black, x, h1 - 1, prevx, h1 - 1);
418              }              } else {
419              Glib::RefPtr<const Gdk::GC> bg = get_style()->get_bg_gc(Gtk::STATE_NORMAL);                  int xx = ((resize.pos == resize.min && resize.min != 0) ? 1 : 0);
420              int prevx = int(w * resize.pos / 128.0 + 0.5);                  window->draw_rectangle(bg, true, prevx + xx, 0, x - prevx - xx, h1);
421              x = int(w * k / 128.0 + 0.5);              }
422            }
423              if (resize.mode == resize.moving_high_limit) {          window->draw_line(black, x, 1, x, h1 - 2);
424                  if (k > resize.pos) {          resize.pos = k;
425                      window->draw_rectangle(white, true, prevx, 1, x - prevx, h1 - 2);      }
426                      window->draw_line(black, prevx, 0, x, 0);  }
427                      window->draw_line(black, prevx, h1 - 1, x, h1 - 1);  
428    void RegionChooser::motion_move_region(int x, int y)
429    {
430        const int w = width - 1;
431        Glib::RefPtr<Gdk::Window> window = get_window();
432    
433        int k = int(double(x - move.from_x) / w * 128.0 + 0.5);
434        if (k == move.pos) return;
435        int new_k;
436        bool new_touch_left;
437        bool new_touch_right;
438        int a = 0;
439        if (k > move.pos) {
440            for (gig::Region* r = instrument->GetFirstRegion() ; ;
441                 r = instrument->GetNextRegion()) {
442                if (r != region) {
443                    int b = r ? r->KeyRange.low : 128;
444    
445                    // gap: from a to b (not inclusive b)
446    
447                    if (region->KeyRange.high + move.pos >= b) {
448                        // not found the current gap yet, just continue
449                  } else {                  } else {
450                      int xx = ((resize.pos == resize.max && resize.max != 128) ? 1 : 0);  
451                      window->draw_rectangle(bg, true, x + 1, 0, prevx - x - xx, h1);                      if (a > region->KeyRange.low + k) {
452                            // this gap is too far to the right, break
453                            break;
454                        }
455    
456                        int newhigh = std::min(region->KeyRange.high + k, b - 1);
457                        int newlo = newhigh - (region->KeyRange.high - region->KeyRange.low);
458    
459                        if (newlo >= a) {
460                            // yes it fits - it's a candidate
461                            new_k = newlo - region->KeyRange.low;
462                            new_touch_left = a > 0 && a == newlo;
463                            new_touch_right = b < 128 && newhigh + 1 == b;
464                        }
465                  }                  }
466              } else {                  if (!r) break;
467                  if (k < resize.pos) {                  a = r->KeyRange.high + 1;
468                      window->draw_rectangle(white, true, x + 1, 1, prevx - x, h1 - 2);              }
469                      window->draw_line(black, x, 0, prevx, 0);          }
470                      window->draw_line(black, x, h1 - 1, prevx, h1 - 1);      } else {
471            for (gig::Region* r = instrument->GetFirstRegion() ; ;
472                 r = instrument->GetNextRegion()) {
473                if (r != region) {
474                    int b = r ? r->KeyRange.low : 128;
475    
476                    // gap from a to b (not inclusive b)
477    
478                    if (region->KeyRange.high + k >= b) {
479                        // not found the current gap yet, just continue
480                  } else {                  } else {
481                      int xx = ((resize.pos == resize.min && resize.min != 0) ? 1 : 0);  
482                      window->draw_rectangle(bg, true, prevx + xx, 0, x - prevx - xx, h1);                      if (a > region->KeyRange.low + move.pos) {
483                            // this gap is too far to the right, break
484                            break;
485                        }
486    
487                        int newlo = std::max(region->KeyRange.low + k, a);
488                        int newhigh = newlo + (region->KeyRange.high - region->KeyRange.low);
489    
490                        if (newhigh < b) {
491                            // yes it fits - break as the first one is the best
492                            new_k = newlo - region->KeyRange.low;
493                            new_touch_left = a > 0 && a == newlo;
494                            new_touch_right = b < 128 && newhigh + 1 == b;
495                            break;
496                        }
497                  }                  }
498                    if (!r) break;
499                    a = r->KeyRange.high + 1;
500              }              }
             window->draw_line(black, x, 1, x, h1 - 2);  
             resize.pos = k;  
501          }          }
502        }
503        k = new_k;
504        if (k == move.pos) return;
505    
506        Glib::RefPtr<const Gdk::GC> bg = get_style()->get_bg_gc(Gtk::STATE_NORMAL);
507        int prevx = int(w * (move.pos + region->KeyRange.low) / 128.0 + 0.5);
508        x = int(w * (k + region->KeyRange.low) / 128.0 + 0.5);
509        int prevx2 = int(w * (move.pos + region->KeyRange.high + 1) / 128.0 + 0.5);
510        int x2 = int(w * (k + region->KeyRange.high + 1) / 128.0 + 0.5);
511        Glib::RefPtr<const Gdk::GC> black = get_style()->get_black_gc();
512        gc->set_foreground(red);
513    
514        if (!new_touch_left) window->draw_line(black, x, 1, x, h1 - 2);
515        if (!new_touch_right) window->draw_line(black, x2, 1, x2, h1 - 2);
516    
517        if (k > move.pos) {
518            window->draw_rectangle(bg, true, prevx + (move.touch_left ? 1 : 0), 0,
519                                   std::min(x, prevx2 + 1 - (move.touch_right ? 1 : 0)) -
520                                   (prevx + (move.touch_left ? 1 : 0)), h1);
521    
522            window->draw_line(black, std::max(x, prevx2 + 1), 0, x2, 0);
523            window->draw_line(black, std::max(x, prevx2 + 1), h1 - 1, x2, h1 - 1);
524            window->draw_rectangle(gc, true, std::max(x + 1, prevx2), 1,
525                                   x2 - std::max(x + 1, prevx2), h1 - 2);
526        } else {
527            window->draw_rectangle(bg, true, std::max(x2 + 1, prevx + (move.touch_left ? 1 : 0)), 0,
528                                   prevx2 + 1 - (move.touch_right ? 1 : 0) -
529                                   std::max(x2 + 1, prevx + (move.touch_left ? 1 : 0)), h1);
530    
531            window->draw_line(black, x, 0, std::min(x2, prevx - 1), 0);
532            window->draw_line(black, x, h1 - 1, std::min(x2, prevx - 1), h1 - 1);
533    
534            window->draw_rectangle(gc, true, x + 1, 1, std::min(x2 - 1, prevx) - x, h1 - 2);
535        }
536    
537        move.pos = k;
538        move.touch_left = new_touch_left;
539        move.touch_right = new_touch_right;
540    }
541    
542    
543    bool RegionChooser::on_motion_notify_event(GdkEventMotion* event)
544    {
545        Glib::RefPtr<Gdk::Window> window = get_window();
546        int x, y;
547        Gdk::ModifierType state = Gdk::ModifierType(0);
548        window->get_pointer(x, y, state);
549    
550        if (resize.active) {
551            motion_resize_region(x, y);
552        } else if (move.active) {
553            motion_move_region(x, y);
554      } else {      } else {
555          if (is_in_resize_zone(x, y)) {          if (is_in_resize_zone(x, y)) {
556              if (!cursor_is_resize) {              if (!cursor_is_resize) {
557                  Gdk::Cursor double_arrow(Gdk::SB_H_DOUBLE_ARROW);                  window->set_cursor(Gdk::Cursor(Gdk::SB_H_DOUBLE_ARROW));
                 window->set_cursor(double_arrow);  
558                  cursor_is_resize = true;                  cursor_is_resize = true;
559              }              }
560          } else if (cursor_is_resize) {          } else if (cursor_is_resize) {
# Line 418  bool RegionChooser::is_in_resize_zone(do Line 616  bool RegionChooser::is_in_resize_zone(do
616      return false;      return false;
617  }  }
618    
619  sigc::signal<void> RegionChooser::signal_sel_changed()  sigc::signal<void> RegionChooser::signal_region_selected()
620    {
621        return region_selected;
622    }
623    
624    sigc::signal<void> RegionChooser::signal_instrument_changed()
625  {  {
626      return sel_changed_signal;      return instrument_changed;
627  }  }
628    
629  void RegionChooser::show_region_properties()  void RegionChooser::show_region_properties()
# Line 450  void RegionChooser::show_region_properti Line 653  void RegionChooser::show_region_properti
653    
654  void RegionChooser::add_region()  void RegionChooser::add_region()
655  {  {
656      gig::Region* r;      instrument_struct_to_be_changed_signal.emit(instrument);
     for (r = instrument->GetFirstRegion() ; r ; r = instrument->GetNextRegion()) {  
         if (r->KeyRange.low > new_region_pos) break;  
     }  
657    
658      region = instrument->AddRegion();      region = instrument->AddRegion();
659      region->KeyRange.low = region->KeyRange.high = new_region_pos;      region->SetKeyRange(new_region_pos, new_region_pos);
660    
661        instrument_struct_changed_signal.emit(instrument);
662    
     instrument->MoveRegion(region, r);  
663      queue_draw();      queue_draw();
664      sel_changed_signal.emit();      region_selected();
665        instrument_changed();
666  }  }
667    
668  void RegionChooser::delete_region()  void RegionChooser::delete_region()
669  {  {
670        instrument_struct_to_be_changed_signal.emit(instrument);
671      instrument->DeleteRegion(region);      instrument->DeleteRegion(region);
672        instrument_struct_changed_signal.emit(instrument);
673    
674      region = 0;      region = 0;
675      queue_draw();      queue_draw();
676      sel_changed_signal.emit();      region_selected();
677        instrument_changed();
678  }  }
679    
680  void RegionChooser::manage_dimensions()  void RegionChooser::manage_dimensions()
# Line 479  void RegionChooser::manage_dimensions() Line 685  void RegionChooser::manage_dimensions()
685  }  }
686    
687  void RegionChooser::on_dimension_manager_changed() {  void RegionChooser::on_dimension_manager_changed() {
688      sel_changed_signal.emit();      region_selected();
689        instrument_changed();
690    }
691    
692    sigc::signal<void, gig::Instrument*> RegionChooser::signal_instrument_struct_to_be_changed() {
693        return instrument_struct_to_be_changed_signal;
694    }
695    
696    sigc::signal<void, gig::Instrument*> RegionChooser::signal_instrument_struct_changed() {
697        return instrument_struct_changed_signal;
698    }
699    
700    sigc::signal<void, gig::Region*> RegionChooser::signal_region_to_be_changed() {
701        return region_to_be_changed_signal;
702    }
703    
704    sigc::signal<void, gig::Region*> RegionChooser::signal_region_changed_signal() {
705        return region_changed_signal;
706  }  }

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

  ViewVC Help
Powered by ViewVC