450 |
firstRowInBlock = 0; |
firstRowInBlock = 0; |
451 |
|
|
452 |
addHeader(_("Mandatory Settings")); |
addHeader(_("Mandatory Settings")); |
453 |
addString(_("Sample"), lSample, wSample); |
addString(_("Sample"), lSample, wSample, buttonNullSampleReference); |
454 |
|
buttonNullSampleReference->set_label("X"); |
455 |
|
buttonNullSampleReference->set_tooltip_text(_("Remove current sample reference (NULL reference). This can be used to define a \"silent\" case where no sample shall be played.")); |
456 |
|
buttonNullSampleReference->signal_clicked().connect( |
457 |
|
sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference) |
458 |
|
); |
459 |
//TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false); |
//TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false); |
460 |
#ifdef OLD_TOOLTIPS |
#ifdef OLD_TOOLTIPS |
461 |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
840 |
rowno++; |
rowno++; |
841 |
} |
} |
842 |
|
|
843 |
|
void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label, |
844 |
|
Gtk::Entry*& widget, Gtk::Button*& button) |
845 |
|
{ |
846 |
|
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
847 |
|
label->set_alignment(Gtk::ALIGN_START); |
848 |
|
|
849 |
|
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
850 |
|
Gtk::FILL, Gtk::SHRINK); |
851 |
|
|
852 |
|
widget = new Gtk::Entry(); |
853 |
|
button = new Gtk::Button(); |
854 |
|
|
855 |
|
Gtk::HBox* hbox = new Gtk::HBox; |
856 |
|
hbox->pack_start(*widget); |
857 |
|
hbox->pack_start(*button, Gtk::PACK_SHRINK); |
858 |
|
|
859 |
|
table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1, |
860 |
|
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
861 |
|
|
862 |
|
rowno++; |
863 |
|
} |
864 |
|
|
865 |
Gtk::Label* DimRegionEdit::addHeader(const char* text) |
Gtk::Label* DimRegionEdit::addHeader(const char* text) |
866 |
{ |
{ |
867 |
if (firstRowInBlock < rowno - 1) |
if (firstRowInBlock < rowno - 1) |
1496 |
if (d->pSample) d->pSample->LoopPlayCount = value; |
if (d->pSample) d->pSample->LoopPlayCount = value; |
1497 |
} |
} |
1498 |
|
|
1499 |
|
void DimRegionEdit::nullOutSampleReference() { |
1500 |
|
if (!dimregion) return; |
1501 |
|
gig::Sample* oldref = dimregion->pSample; |
1502 |
|
if (!oldref) return; |
1503 |
|
|
1504 |
|
dimreg_to_be_changed_signal.emit(dimregion); |
1505 |
|
|
1506 |
|
// in case currently assigned sample is a stereo one, then remove both |
1507 |
|
// references (expected to be due to a "stereo dimension") |
1508 |
|
gig::DimensionRegion* d[2] = { dimregion, NULL }; |
1509 |
|
if (oldref->Channels == 2) { |
1510 |
|
gig::Region* region = dimregion->GetParent(); |
1511 |
|
int stereo_bit = 0; |
1512 |
|
{ |
1513 |
|
int bitcount = 0; |
1514 |
|
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
1515 |
|
if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) { |
1516 |
|
stereo_bit = 1 << bitcount; |
1517 |
|
break; |
1518 |
|
} |
1519 |
|
bitcount += region->pDimensionDefinitions[dim].bits; |
1520 |
|
} |
1521 |
|
|
1522 |
|
if (stereo_bit) { |
1523 |
|
int dimregno; |
1524 |
|
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
1525 |
|
if (region->pDimensionRegions[dimregno] == dimregion) { |
1526 |
|
break; |
1527 |
|
} |
1528 |
|
} |
1529 |
|
d[0] = region->pDimensionRegions[dimregno & ~stereo_bit]; |
1530 |
|
d[1] = region->pDimensionRegions[dimregno | stereo_bit]; |
1531 |
|
} |
1532 |
|
} |
1533 |
|
} |
1534 |
|
|
1535 |
|
if (d[0]) d[0]->pSample = NULL; |
1536 |
|
if (d[1]) d[1]->pSample = NULL; |
1537 |
|
|
1538 |
|
// update UI elements |
1539 |
|
set_dim_region(dimregion); |
1540 |
|
|
1541 |
|
sample_ref_changed_signal.emit(oldref, NULL); |
1542 |
|
dimreg_changed_signal.emit(dimregion); |
1543 |
|
} |
1544 |
|
|
1545 |
void DimRegionEdit::onButtonSelectSamplePressed() { |
void DimRegionEdit::onButtonSelectSamplePressed() { |
1546 |
if (!dimregion) return; |
if (!dimregion) return; |
1547 |
if (!dimregion->pSample) return; |
if (!dimregion->pSample) return; |