1345 |
void MainWindow::on_action_file_save() |
void MainWindow::on_action_file_save() |
1346 |
{ |
{ |
1347 |
if (!file) return; |
if (!file) return; |
1348 |
file->Save(); |
std::cout << "Saving file\n" << std::flush; |
1349 |
|
try { |
1350 |
|
file->Save(); |
1351 |
|
} catch (RIFF::Exception e) { |
1352 |
|
Glib::ustring txt = "Could not save file: " + e.Message; |
1353 |
|
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
1354 |
|
msg.run(); |
1355 |
|
return; |
1356 |
|
} |
1357 |
|
std::cout << "Saving file done\n" << std::flush; |
1358 |
__import_queued_samples(); |
__import_queued_samples(); |
1359 |
} |
} |
1360 |
|
|
1369 |
dialog.set_filter(filter); |
dialog.set_filter(filter); |
1370 |
if (dialog.run() == Gtk::RESPONSE_OK) { |
if (dialog.run() == Gtk::RESPONSE_OK) { |
1371 |
printf("filename=%s\n", dialog.get_filename().c_str()); |
printf("filename=%s\n", dialog.get_filename().c_str()); |
1372 |
file->Save(dialog.get_filename()); |
try { |
1373 |
|
file->Save(dialog.get_filename()); |
1374 |
|
} catch (RIFF::Exception e) { |
1375 |
|
Glib::ustring txt = "Could not save file: " + e.Message; |
1376 |
|
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
1377 |
|
msg.run(); |
1378 |
|
return; |
1379 |
|
} |
1380 |
__import_queued_samples(); |
__import_queued_samples(); |
1381 |
} |
} |
1382 |
} |
} |
1383 |
|
|
1384 |
// actually write the sample(s)' data to the gig file |
// actually write the sample(s)' data to the gig file |
1385 |
void MainWindow::__import_queued_samples() { |
void MainWindow::__import_queued_samples() { |
1386 |
|
std::cout << "Starting sample import\n" << std::flush; |
1387 |
Glib::ustring error_files; |
Glib::ustring error_files; |
1388 |
|
printf("Samples to import: %d\n", m_SampleImportQueue.size()); |
1389 |
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); iter != m_SampleImportQueue.end(); ) { |
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); iter != m_SampleImportQueue.end(); ) { |
1390 |
printf("Importing sample %s\n",(*iter).sample_path.c_str()); |
printf("Importing sample %s\n",(*iter).sample_path.c_str()); |
1391 |
SF_INFO info; |
SF_INFO info; |