257 |
sigc::mem_fun(*this, &MainWindow::on_sample_label_drop_drag_data_received) |
sigc::mem_fun(*this, &MainWindow::on_sample_label_drop_drag_data_received) |
258 |
); |
); |
259 |
dimreg_edit.signal_dimreg_changed().connect( |
dimreg_edit.signal_dimreg_changed().connect( |
260 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::hide(sigc::mem_fun(*this, &MainWindow::file_changed))); |
261 |
m_RegionChooser.signal_instrument_changed().connect( |
m_RegionChooser.signal_instrument_changed().connect( |
262 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
263 |
m_DimRegionChooser.signal_region_changed().connect( |
m_DimRegionChooser.signal_region_changed().connect( |
264 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
265 |
instrumentProps.signal_instrument_changed().connect( |
instrumentProps.signal_instrument_changed().connect( |
266 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
267 |
|
|
268 |
|
dimreg_edit.signal_dimreg_to_be_changed().connect( |
269 |
|
dimreg_to_be_changed_signal.make_slot()); |
270 |
|
dimreg_edit.signal_dimreg_changed().connect( |
271 |
|
dimreg_changed_signal.make_slot()); |
272 |
|
dimreg_edit.signal_sample_ref_changed().connect( |
273 |
|
sample_ref_changed_signal.make_slot()); |
274 |
|
|
275 |
|
m_RegionChooser.signal_instrument_struct_to_be_changed().connect( |
276 |
|
sigc::hide( |
277 |
|
sigc::bind( |
278 |
|
file_structure_to_be_changed_signal.make_slot(), |
279 |
|
sigc::ref(this->file) |
280 |
|
) |
281 |
|
) |
282 |
|
); |
283 |
|
m_RegionChooser.signal_instrument_struct_changed().connect( |
284 |
|
sigc::hide( |
285 |
|
sigc::bind( |
286 |
|
file_structure_changed_signal.make_slot(), |
287 |
|
sigc::ref(this->file) |
288 |
|
) |
289 |
|
) |
290 |
|
); |
291 |
|
m_RegionChooser.signal_region_to_be_changed().connect( |
292 |
|
region_to_be_changed_signal.make_slot()); |
293 |
|
m_RegionChooser.signal_region_changed_signal().connect( |
294 |
|
region_changed_signal.make_slot()); |
295 |
|
|
296 |
file = 0; |
file = 0; |
297 |
file_is_changed = false; |
file_is_changed = false; |
298 |
|
|
563 |
if (!file_has_name) return file_save_as(); |
if (!file_has_name) return file_save_as(); |
564 |
|
|
565 |
std::cout << "Saving file\n" << std::flush; |
std::cout << "Saving file\n" << std::flush; |
566 |
|
file_structure_to_be_changed_signal.emit(this->file); |
567 |
try { |
try { |
568 |
file->Save(); |
file->Save(); |
569 |
if (file_is_changed) { |
if (file_is_changed) { |
571 |
file_is_changed = false; |
file_is_changed = false; |
572 |
} |
} |
573 |
} catch (RIFF::Exception e) { |
} catch (RIFF::Exception e) { |
574 |
|
file_structure_changed_signal.emit(this->file); |
575 |
Glib::ustring txt = "Could not save file: " + e.Message; |
Glib::ustring txt = "Could not save file: " + e.Message; |
576 |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
577 |
msg.run(); |
msg.run(); |
579 |
} |
} |
580 |
std::cout << "Saving file done\n" << std::flush; |
std::cout << "Saving file done\n" << std::flush; |
581 |
__import_queued_samples(); |
__import_queued_samples(); |
582 |
|
file_structure_changed_signal.emit(this->file); |
583 |
return true; |
return true; |
584 |
} |
} |
585 |
|
|
612 |
dialog.set_current_name(Glib::filename_display_basename(filename)); |
dialog.set_current_name(Glib::filename_display_basename(filename)); |
613 |
|
|
614 |
if (dialog.run() == Gtk::RESPONSE_OK) { |
if (dialog.run() == Gtk::RESPONSE_OK) { |
615 |
|
file_structure_to_be_changed_signal.emit(this->file); |
616 |
try { |
try { |
617 |
std::string filename = dialog.get_filename(); |
std::string filename = dialog.get_filename(); |
618 |
if (!Glib::str_has_suffix(filename, ".gig")) { |
if (!Glib::str_has_suffix(filename, ".gig")) { |
626 |
file_has_name = true; |
file_has_name = true; |
627 |
file_is_changed = false; |
file_is_changed = false; |
628 |
} catch (RIFF::Exception e) { |
} catch (RIFF::Exception e) { |
629 |
|
file_structure_changed_signal.emit(this->file); |
630 |
Glib::ustring txt = "Could not save file: " + e.Message; |
Glib::ustring txt = "Could not save file: " + e.Message; |
631 |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
632 |
msg.run(); |
msg.run(); |
633 |
return false; |
return false; |
634 |
} |
} |
635 |
__import_queued_samples(); |
__import_queued_samples(); |
636 |
|
file_structure_changed_signal.emit(this->file); |
637 |
return true; |
return true; |
638 |
} |
} |
639 |
return false; |
return false; |
1279 |
pSample; pSample = group->GetNextSample()) { |
pSample; pSample = group->GetNextSample()) { |
1280 |
members.push_back(pSample); |
members.push_back(pSample); |
1281 |
} |
} |
1282 |
|
// notify everybody that we're going to remove these samples |
1283 |
|
samples_to_be_removed_signal.emit(members); |
1284 |
// delete the group in the .gig file including the |
// delete the group in the .gig file including the |
1285 |
// samples that belong to the group |
// samples that belong to the group |
1286 |
file->DeleteGroup(group); |
file->DeleteGroup(group); |
1287 |
|
// notify that we're done with removal |
1288 |
|
samples_removed_signal.emit(); |
1289 |
// if sample(s) were just previously added, remove |
// if sample(s) were just previously added, remove |
1290 |
// them from the import queue |
// them from the import queue |
1291 |
for (std::list<gig::Sample*>::iterator member = members.begin(); |
for (std::list<gig::Sample*>::iterator member = members.begin(); |
1302 |
} |
} |
1303 |
file_changed(); |
file_changed(); |
1304 |
} else if (sample) { |
} else if (sample) { |
1305 |
|
// notify everybody that we're going to remove this sample |
1306 |
|
std::list<gig::Sample*> lsamples; |
1307 |
|
lsamples.push_back(sample); |
1308 |
|
samples_to_be_removed_signal.emit(lsamples); |
1309 |
// remove sample from the .gig file |
// remove sample from the .gig file |
1310 |
file->DeleteSample(sample); |
file->DeleteSample(sample); |
1311 |
|
// notify that we're done with removal |
1312 |
|
samples_removed_signal.emit(); |
1313 |
// if sample was just previously added, remove it from |
// if sample was just previously added, remove it from |
1314 |
// the import queue |
// the import queue |
1315 |
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); |
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); |
1327 |
// remove respective row(s) from samples tree view |
// remove respective row(s) from samples tree view |
1328 |
m_refSamplesTreeModel->erase(it); |
m_refSamplesTreeModel->erase(it); |
1329 |
} catch (RIFF::Exception e) { |
} catch (RIFF::Exception e) { |
1330 |
|
// pretend we're done with removal (i.e. to avoid dead locks) |
1331 |
|
samples_removed_signal.emit(); |
1332 |
|
// show error message |
1333 |
Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR); |
Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR); |
1334 |
msg.run(); |
msg.run(); |
1335 |
} |
} |
1376 |
// drop success |
// drop success |
1377 |
context->drop_reply(true, time); |
context->drop_reply(true, time); |
1378 |
|
|
1379 |
// find the samplechannel dimension |
//TODO: we should better move most of the following code to DimRegionEdit::set_sample() |
1380 |
|
|
1381 |
|
// notify everybody that we're going to alter the region |
1382 |
gig::Region* region = m_RegionChooser.get_region(); |
gig::Region* region = m_RegionChooser.get_region(); |
1383 |
|
region_to_be_changed_signal.emit(region); |
1384 |
|
|
1385 |
|
// find the samplechannel dimension |
1386 |
gig::dimension_def_t* stereo_dimension = 0; |
gig::dimension_def_t* stereo_dimension = 0; |
1387 |
for (int i = 0 ; i < region->Dimensions ; i++) { |
for (int i = 0 ; i < region->Dimensions ; i++) { |
1388 |
if (region->pDimensionDefinitions[i].dimension == |
if (region->pDimensionDefinitions[i].dimension == |
1416 |
for (int i = 0 ; i < region->DimensionRegions ; i++) { |
for (int i = 0 ; i < region->DimensionRegions ; i++) { |
1417 |
gig::DimensionRegion* d = region->pDimensionRegions[i]; |
gig::DimensionRegion* d = region->pDimensionRegions[i]; |
1418 |
if (d->pSample && d->pSample->Channels != sample->Channels) { |
if (d->pSample && d->pSample->Channels != sample->Channels) { |
1419 |
d->pSample = 0; |
gig::Sample* oldref = d->pSample; |
1420 |
|
d->pSample = NULL; |
1421 |
|
sample_ref_changed_signal.emit(oldref, NULL); |
1422 |
} |
} |
1423 |
} |
} |
1424 |
} |
} |
1425 |
|
|
1426 |
|
// notify we're done with altering |
1427 |
|
region_changed_signal.emit(region); |
1428 |
|
|
1429 |
return; |
return; |
1430 |
} |
} |
1431 |
// drop failed |
// drop failed |
1465 |
file_changed(); |
file_changed(); |
1466 |
} |
} |
1467 |
} |
} |
1468 |
|
|
1469 |
|
sigc::signal<void, gig::File*> MainWindow::signal_file_structure_to_be_changed() { |
1470 |
|
return file_structure_to_be_changed_signal; |
1471 |
|
} |
1472 |
|
|
1473 |
|
sigc::signal<void, gig::File*> MainWindow::signal_file_structure_changed() { |
1474 |
|
return file_structure_changed_signal; |
1475 |
|
} |
1476 |
|
|
1477 |
|
sigc::signal<void, std::list<gig::Sample*> > MainWindow::signal_samples_to_be_removed() { |
1478 |
|
return samples_to_be_removed_signal; |
1479 |
|
} |
1480 |
|
|
1481 |
|
sigc::signal<void> MainWindow::signal_samples_removed() { |
1482 |
|
return samples_removed_signal; |
1483 |
|
} |
1484 |
|
|
1485 |
|
sigc::signal<void, gig::Region*> MainWindow::signal_region_to_be_changed() { |
1486 |
|
return region_to_be_changed_signal; |
1487 |
|
} |
1488 |
|
|
1489 |
|
sigc::signal<void, gig::Region*> MainWindow::signal_region_changed() { |
1490 |
|
return region_changed_signal; |
1491 |
|
} |
1492 |
|
|
1493 |
|
sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> MainWindow::signal_sample_ref_changed() { |
1494 |
|
return sample_ref_changed_signal; |
1495 |
|
} |
1496 |
|
|
1497 |
|
sigc::signal<void, gig::DimensionRegion*> MainWindow::signal_dimreg_to_be_changed() { |
1498 |
|
return dimreg_to_be_changed_signal; |
1499 |
|
} |
1500 |
|
|
1501 |
|
sigc::signal<void, gig::DimensionRegion*> MainWindow::signal_dimreg_changed() { |
1502 |
|
return dimreg_changed_signal; |
1503 |
|
} |