--- gigedit/trunk/src/gigedit/regionchooser.cpp 2014/06/12 16:12:55 2627 +++ gigedit/trunk/src/gigedit/regionchooser.cpp 2015/06/12 17:57:52 2773 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2014 Andreas Persson + * Copyright (C) 2006-2015 Andreas Persson * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -29,6 +29,7 @@ #include #include "global.h" +#include "Settings.h" #define REGION_BLOCK_HEIGHT 30 #define KEYBOARD_HEIGHT 40 @@ -515,8 +516,16 @@ void RegionChooser::update_after_move(int pos) { instrument_struct_to_be_changed_signal.emit(instrument); - region->SetKeyRange(pos, pos + region->KeyRange.high - - region->KeyRange.low); + const int range = region->KeyRange.high - region->KeyRange.low; + const int diff = pos - int(region->KeyRange.low); + region->SetKeyRange(pos, pos + range); + if (Settings::singleton()->moveRootNoteWithRegionMoved) { + for (int i = 0; i < 256; ++i) { + gig::DimensionRegion* dimrgn = region->pDimensionRegions[i]; + if (!dimrgn || !dimrgn->pSample || !dimrgn->PitchTrack) continue; + dimrgn->UnityNote += diff; + } + } regions.update(instrument); instrument_changed.emit(); instrument_struct_changed_signal.emit(instrument); @@ -538,6 +547,14 @@ } } + // left mouse button double click + if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { + if (event->y < REGION_BLOCK_HEIGHT) { + // show dimension manager dialog for this region + manage_dimensions(); + } + } + if (event->y >= REGION_BLOCK_HEIGHT) return true; if (event->type == GDK_BUTTON_PRESS && event->button == 3) { gig::Region* r = get_region(k); @@ -613,6 +630,13 @@ return 0; } +void RegionChooser::set_region(gig::Region* region) { + this->region = region; + queue_draw(); + region_selected(); + dimensionManager.set_region(region); +} + void RegionChooser::motion_resize_region(int x, int y) { const int w = get_width() - 1;