/[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 2663 by schoenebeck, Wed Jul 2 23:53:21 2014 UTC revision 2841 by persson, Sun Aug 30 10:00:49 2015 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2014 Andreas Persson   * Copyright (C) 2006-2015 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 29  Line 29 
29  #include <gtkmm/dialog.h>  #include <gtkmm/dialog.h>
30    
31  #include "global.h"  #include "global.h"
32    #include "Settings.h"
33    
34  #define REGION_BLOCK_HEIGHT             30  #define REGION_BLOCK_HEIGHT             30
35  #define KEYBOARD_HEIGHT                 40  #define KEYBOARD_HEIGHT                 40
# Line 54  gig::Region* SortedRegions::first() { Line 55  gig::Region* SortedRegions::first() {
55  }  }
56    
57  gig::Region* SortedRegions::next() {  gig::Region* SortedRegions::next() {
58      region_iterator++;      ++region_iterator;
59      return region_iterator == regions.end() ? 0 : *region_iterator;      return region_iterator == regions.end() ? 0 : *region_iterator;
60  }  }
61    
# Line 343  void RegionChooser::draw_regions(const C Line 344  void RegionChooser::draw_regions(const C
344          layout->set_spacing(10);          layout->set_spacing(10);
345          Gdk::Cairo::set_source_rgba(cr, red);                  Gdk::Cairo::set_source_rgba(cr, red);        
346          // get the text dimensions          // get the text dimensions
         Pango::Rectangle rect = layout->get_logical_extents();  
347          int text_width, text_height;          int text_width, text_height;
348          layout->get_pixel_size(text_width, text_height);          layout->get_pixel_size(text_width, text_height);
349          cr->move_to(0, (REGION_BLOCK_HEIGHT - text_height) / 2);          cr->move_to(0, (REGION_BLOCK_HEIGHT - text_height) / 2);
# Line 515  void RegionChooser::update_after_resize( Line 515  void RegionChooser::update_after_resize(
515  void RegionChooser::update_after_move(int pos)  void RegionChooser::update_after_move(int pos)
516  {  {
517      instrument_struct_to_be_changed_signal.emit(instrument);      instrument_struct_to_be_changed_signal.emit(instrument);
518      region->SetKeyRange(pos, pos + region->KeyRange.high -      const int range = region->KeyRange.high - region->KeyRange.low;
519                          region->KeyRange.low);      const int diff  = pos - int(region->KeyRange.low);
520        region->SetKeyRange(pos, pos + range);
521        if (Settings::singleton()->moveRootNoteWithRegionMoved) {
522            for (int i = 0; i < 256; ++i) {
523                gig::DimensionRegion* dimrgn = region->pDimensionRegions[i];
524                if (!dimrgn || !dimrgn->pSample || !dimrgn->PitchTrack) continue;
525                dimrgn->UnityNote += diff;
526            }
527        }
528      regions.update(instrument);      regions.update(instrument);
529      instrument_changed.emit();      instrument_changed.emit();
530      instrument_struct_changed_signal.emit(instrument);      instrument_struct_changed_signal.emit(instrument);
# Line 621  gig::Region* RegionChooser::get_region(i Line 629  gig::Region* RegionChooser::get_region(i
629      return 0;      return 0;
630  }  }
631    
632    void RegionChooser::set_region(gig::Region* region) {
633        this->region = region;
634        queue_draw();
635        region_selected();
636        dimensionManager.set_region(region);
637    }
638    
639  void RegionChooser::motion_resize_region(int x, int y)  void RegionChooser::motion_resize_region(int x, int y)
640  {  {
641      const int w = get_width() - 1;      const int w = get_width() - 1;

Legend:
Removed from v.2663  
changed lines
  Added in v.2841

  ViewVC Help
Powered by ViewVC