1 |
/* |
/* |
2 |
* Copyright (C) 2006-2015 Andreas Persson |
* Copyright (C) 2006-2016 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 |
244 |
buttonSelectSample(UNICODE_LEFT_ARROW + " " + _("Select Sample")), |
buttonSelectSample(UNICODE_LEFT_ARROW + " " + _("Select Sample")), |
245 |
update_model(0) |
update_model(0) |
246 |
{ |
{ |
247 |
|
// make synthesis parameter page tabs scrollable |
248 |
|
// (workaround for GTK3: default theme uses huge tabs which breaks layout) |
249 |
|
set_scrollable(); |
250 |
|
|
251 |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
connect(eEG1PreAttack, &gig::DimensionRegion::EG1PreAttack); |
252 |
connect(eEG1Attack, &gig::DimensionRegion::EG1Attack); |
connect(eEG1Attack, &gig::DimensionRegion::EG1Attack); |
253 |
connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1); |
connect(eEG1Decay1, &gig::DimensionRegion::EG1Decay1); |
454 |
firstRowInBlock = 0; |
firstRowInBlock = 0; |
455 |
|
|
456 |
addHeader(_("Mandatory Settings")); |
addHeader(_("Mandatory Settings")); |
457 |
addString(_("Sample"), lSample, wSample); |
addString(_("Sample"), lSample, wSample, buttonNullSampleReference); |
458 |
|
buttonNullSampleReference->set_label("X"); |
459 |
|
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.")); |
460 |
|
buttonNullSampleReference->signal_clicked().connect( |
461 |
|
sigc::mem_fun(*this, &DimRegionEdit::nullOutSampleReference) |
462 |
|
); |
463 |
//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); |
464 |
#ifdef OLD_TOOLTIPS |
#ifdef OLD_TOOLTIPS |
465 |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
tooltips.set_tip(*wSample, _("Drag & drop a sample here")); |
844 |
rowno++; |
rowno++; |
845 |
} |
} |
846 |
|
|
847 |
|
void DimRegionEdit::addString(const char* labelText, Gtk::Label*& label, |
848 |
|
Gtk::Entry*& widget, Gtk::Button*& button) |
849 |
|
{ |
850 |
|
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
851 |
|
label->set_alignment(Gtk::ALIGN_START); |
852 |
|
|
853 |
|
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
854 |
|
Gtk::FILL, Gtk::SHRINK); |
855 |
|
|
856 |
|
widget = new Gtk::Entry(); |
857 |
|
button = new Gtk::Button(); |
858 |
|
|
859 |
|
Gtk::HBox* hbox = new Gtk::HBox; |
860 |
|
hbox->pack_start(*widget); |
861 |
|
hbox->pack_start(*button, Gtk::PACK_SHRINK); |
862 |
|
|
863 |
|
table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1, |
864 |
|
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
865 |
|
|
866 |
|
rowno++; |
867 |
|
} |
868 |
|
|
869 |
Gtk::Label* DimRegionEdit::addHeader(const char* text) |
Gtk::Label* DimRegionEdit::addHeader(const char* text) |
870 |
{ |
{ |
871 |
if (firstRowInBlock < rowno - 1) |
if (firstRowInBlock < rowno - 1) |
1500 |
if (d->pSample) d->pSample->LoopPlayCount = value; |
if (d->pSample) d->pSample->LoopPlayCount = value; |
1501 |
} |
} |
1502 |
|
|
1503 |
|
void DimRegionEdit::nullOutSampleReference() { |
1504 |
|
if (!dimregion) return; |
1505 |
|
gig::Sample* oldref = dimregion->pSample; |
1506 |
|
if (!oldref) return; |
1507 |
|
|
1508 |
|
dimreg_to_be_changed_signal.emit(dimregion); |
1509 |
|
|
1510 |
|
// in case currently assigned sample is a stereo one, then remove both |
1511 |
|
// references (expected to be due to a "stereo dimension") |
1512 |
|
gig::DimensionRegion* d[2] = { dimregion, NULL }; |
1513 |
|
if (oldref->Channels == 2) { |
1514 |
|
gig::Region* region = dimregion->GetParent(); |
1515 |
|
{ |
1516 |
|
int stereo_bit = 0; |
1517 |
|
int bitcount = 0; |
1518 |
|
for (int dim = 0 ; dim < region->Dimensions ; dim++) { |
1519 |
|
if (region->pDimensionDefinitions[dim].dimension == gig::dimension_samplechannel) { |
1520 |
|
stereo_bit = 1 << bitcount; |
1521 |
|
break; |
1522 |
|
} |
1523 |
|
bitcount += region->pDimensionDefinitions[dim].bits; |
1524 |
|
} |
1525 |
|
|
1526 |
|
if (stereo_bit) { |
1527 |
|
int dimregno; |
1528 |
|
for (dimregno = 0 ; dimregno < region->DimensionRegions ; dimregno++) { |
1529 |
|
if (region->pDimensionRegions[dimregno] == dimregion) { |
1530 |
|
break; |
1531 |
|
} |
1532 |
|
} |
1533 |
|
d[0] = region->pDimensionRegions[dimregno & ~stereo_bit]; |
1534 |
|
d[1] = region->pDimensionRegions[dimregno | stereo_bit]; |
1535 |
|
} |
1536 |
|
} |
1537 |
|
} |
1538 |
|
|
1539 |
|
if (d[0]) d[0]->pSample = NULL; |
1540 |
|
if (d[1]) d[1]->pSample = NULL; |
1541 |
|
|
1542 |
|
// update UI elements |
1543 |
|
set_dim_region(dimregion); |
1544 |
|
|
1545 |
|
sample_ref_changed_signal.emit(oldref, NULL); |
1546 |
|
dimreg_changed_signal.emit(dimregion); |
1547 |
|
} |
1548 |
|
|
1549 |
void DimRegionEdit::onButtonSelectSamplePressed() { |
void DimRegionEdit::onButtonSelectSamplePressed() { |
1550 |
if (!dimregion) return; |
if (!dimregion) return; |
1551 |
if (!dimregion->pSample) return; |
if (!dimregion->pSample) return; |