1 |
/* |
/* |
2 |
* Copyright (C) 2006-2016 Andreas Persson |
* Copyright (C) 2006-2017 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 |
57 |
#include "ReferencesView.h" |
#include "ReferencesView.h" |
58 |
#include "../../gfx/status_attached.xpm" |
#include "../../gfx/status_attached.xpm" |
59 |
#include "../../gfx/status_detached.xpm" |
#include "../../gfx/status_detached.xpm" |
60 |
|
#include "gfx/builtinpix.h" |
61 |
|
|
62 |
MainWindow::MainWindow() : |
MainWindow::MainWindow() : |
63 |
m_DimRegionChooser(*this), |
m_DimRegionChooser(*this), |
64 |
dimreg_label(_("Changes apply to:")), |
dimreg_label(_("Changes apply to:")), |
65 |
dimreg_all_regions(_("all regions")), |
dimreg_all_regions(_("all regions")), |
66 |
dimreg_all_dimregs(_("all dimension splits")), |
dimreg_all_dimregs(_("all dimension splits")), |
67 |
dimreg_stereo(_("both channels")) |
dimreg_stereo(_("both channels")), |
68 |
|
labelLegend(_("Legend:")), |
69 |
|
labelNoSample(_(" No Sample")), |
70 |
|
labelMissingSample(_(" Missing some Sample(s)")), |
71 |
|
labelLooped(_(" Looped")), |
72 |
|
labelSomeLoops(_(" Some Loop(s)")) |
73 |
{ |
{ |
74 |
|
loadBuiltInPix(); |
75 |
|
|
76 |
// set_border_width(5); |
// set_border_width(5); |
77 |
// set_default_size(400, 200); |
// set_default_size(400, 200); |
78 |
|
|
|
|
|
79 |
add(m_VBox); |
add(m_VBox); |
80 |
|
|
81 |
// Handle selection |
// Handle selection |
109 |
dimreg_hbox.add(dimreg_stereo); |
dimreg_hbox.add(dimreg_stereo); |
110 |
dimreg_vbox.add(dimreg_edit); |
dimreg_vbox.add(dimreg_edit); |
111 |
dimreg_vbox.pack_start(dimreg_hbox, Gtk::PACK_SHRINK); |
dimreg_vbox.pack_start(dimreg_hbox, Gtk::PACK_SHRINK); |
112 |
|
{ |
113 |
|
legend_hbox.add(labelLegend); |
114 |
|
|
115 |
|
imageNoSample.set(redDot); |
116 |
|
imageNoSample.set_alignment(Gtk::ALIGN_END); |
117 |
|
labelNoSample.set_alignment(Gtk::ALIGN_START); |
118 |
|
legend_hbox.add(imageNoSample); |
119 |
|
legend_hbox.add(labelNoSample); |
120 |
|
|
121 |
|
imageMissingSample.set(yellowDot); |
122 |
|
imageMissingSample.set_alignment(Gtk::ALIGN_END); |
123 |
|
labelMissingSample.set_alignment(Gtk::ALIGN_START); |
124 |
|
legend_hbox.add(imageMissingSample); |
125 |
|
legend_hbox.add(labelMissingSample); |
126 |
|
|
127 |
|
imageLooped.set(blackLoop); |
128 |
|
imageLooped.set_alignment(Gtk::ALIGN_END); |
129 |
|
labelLooped.set_alignment(Gtk::ALIGN_START); |
130 |
|
legend_hbox.add(imageLooped); |
131 |
|
legend_hbox.add(labelLooped); |
132 |
|
|
133 |
|
imageSomeLoops.set(grayLoop); |
134 |
|
imageSomeLoops.set_alignment(Gtk::ALIGN_END); |
135 |
|
labelSomeLoops.set_alignment(Gtk::ALIGN_START); |
136 |
|
legend_hbox.add(imageSomeLoops); |
137 |
|
legend_hbox.add(labelSomeLoops); |
138 |
|
|
139 |
|
legend_hbox.show_all_children(); |
140 |
|
} |
141 |
|
dimreg_vbox.pack_start(legend_hbox, Gtk::PACK_SHRINK); |
142 |
m_HPaned.add2(dimreg_vbox); |
m_HPaned.add2(dimreg_vbox); |
143 |
|
|
144 |
dimreg_label.set_tooltip_text(_("To automatically apply your changes above globally to the entire instrument, check all 3 check boxes on the right.")); |
dimreg_label.set_tooltip_text(_("To automatically apply your changes above globally to the entire instrument, check all 3 check boxes on the right.")); |
205 |
|
|
206 |
actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit"))); |
actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit"))); |
207 |
|
|
208 |
|
const Gdk::ModifierType primaryModifierKey = |
209 |
|
#if defined(__APPLE__) |
210 |
|
Gdk::META_MASK; // Cmd key on Mac |
211 |
|
#else |
212 |
|
Gdk::CONTROL_MASK; // Ctrl key on all other OSs |
213 |
|
#endif |
214 |
|
|
215 |
|
actionGroup->add(Gtk::Action::create("SelectPrevRegion", |
216 |
|
_("Select Previous Region")), |
217 |
|
Gtk::AccelKey(GDK_KEY_Left, primaryModifierKey), |
218 |
|
sigc::mem_fun(*this, &MainWindow::select_prev_region)); |
219 |
|
|
220 |
|
actionGroup->add(Gtk::Action::create("SelectNextRegion", |
221 |
|
_("Select Next Region")), |
222 |
|
Gtk::AccelKey(GDK_KEY_Right, primaryModifierKey), |
223 |
|
sigc::mem_fun(*this, &MainWindow::select_next_region)); |
224 |
|
|
225 |
|
actionGroup->add(Gtk::Action::create("SelectPrevDimRgnZone", |
226 |
|
_("Select Previous Dimension Region Zone")), |
227 |
|
Gtk::AccelKey(GDK_KEY_Left, Gdk::MOD1_MASK), |
228 |
|
sigc::mem_fun(*this, &MainWindow::select_prev_dim_rgn_zone)); |
229 |
|
|
230 |
|
actionGroup->add(Gtk::Action::create("SelectNextDimRgnZone", |
231 |
|
_("Select Next Dimension Region Zone")), |
232 |
|
Gtk::AccelKey(GDK_KEY_Right, Gdk::MOD1_MASK), |
233 |
|
sigc::mem_fun(*this, &MainWindow::select_next_dim_rgn_zone)); |
234 |
|
|
235 |
|
actionGroup->add(Gtk::Action::create("SelectPrevDimension", |
236 |
|
_("Select Previous Dimension")), |
237 |
|
Gtk::AccelKey(GDK_KEY_Up, Gdk::MOD1_MASK), |
238 |
|
sigc::mem_fun(*this, &MainWindow::select_prev_dimension)); |
239 |
|
|
240 |
|
actionGroup->add(Gtk::Action::create("SelectNextDimension", |
241 |
|
_("Select Next Dimension")), |
242 |
|
Gtk::AccelKey(GDK_KEY_Down, Gdk::MOD1_MASK), |
243 |
|
sigc::mem_fun(*this, &MainWindow::select_next_dimension)); |
244 |
|
|
245 |
|
|
246 |
Glib::RefPtr<Gtk::ToggleAction> toggle_action = |
Glib::RefPtr<Gtk::ToggleAction> toggle_action = |
247 |
Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note")); |
Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note")); |
248 |
toggle_action->set_active(true); |
toggle_action->set_active(true); |
417 |
" <menuitem action='Quit'/>" |
" <menuitem action='Quit'/>" |
418 |
" </menu>" |
" </menu>" |
419 |
" <menu action='MenuEdit'>" |
" <menu action='MenuEdit'>" |
420 |
|
" <menuitem action='SelectPrevRegion'/>" |
421 |
|
" <menuitem action='SelectNextRegion'/>" |
422 |
|
" <separator/>" |
423 |
|
" <menuitem action='SelectPrevDimRgnZone'/>" |
424 |
|
" <menuitem action='SelectNextDimRgnZone'/>" |
425 |
|
" <menuitem action='SelectPrevDimension'/>" |
426 |
|
" <menuitem action='SelectNextDimension'/>" |
427 |
|
" <separator/>" |
428 |
" <menuitem action='CopySampleUnity'/>" |
" <menuitem action='CopySampleUnity'/>" |
429 |
" <menuitem action='CopySampleTune'/>" |
" <menuitem action='CopySampleTune'/>" |
430 |
" <menuitem action='CopySampleLoop'/>" |
" <menuitem action='CopySampleLoop'/>" |
603 |
// Create the Tree model: |
// Create the Tree model: |
604 |
m_refTreeModel = Gtk::ListStore::create(m_Columns); |
m_refTreeModel = Gtk::ListStore::create(m_Columns); |
605 |
m_TreeView.set_model(m_refTreeModel); |
m_TreeView.set_model(m_refTreeModel); |
606 |
|
m_TreeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE); |
607 |
m_TreeView.set_tooltip_text(_("Right click here for actions on instruments & MIDI Rules. Drag & drop to change the order of instruments.")); |
m_TreeView.set_tooltip_text(_("Right click here for actions on instruments & MIDI Rules. Drag & drop to change the order of instruments.")); |
608 |
instrument_name_connection = m_refTreeModel->signal_row_changed().connect( |
instrument_name_connection = m_refTreeModel->signal_row_changed().connect( |
609 |
sigc::mem_fun(*this, &MainWindow::instrument_name_changed) |
sigc::mem_fun(*this, &MainWindow::instrument_name_changed) |
610 |
); |
); |
611 |
|
|
612 |
// Add the TreeView's view columns: |
// Add the TreeView's view columns: |
613 |
m_TreeView.append_column_editable("Instrument", m_Columns.m_col_name); |
m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr); |
614 |
m_TreeView.set_headers_visible(false); |
m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name); |
615 |
|
m_TreeView.set_headers_visible(true); |
616 |
|
|
617 |
// establish drag&drop within the instrument tree view, allowing to reorder |
// establish drag&drop within the instrument tree view, allowing to reorder |
618 |
// the sequence of instruments within the gig file |
// the sequence of instruments within the gig file |
635 |
// create samples treeview (including its data model) |
// create samples treeview (including its data model) |
636 |
m_refSamplesTreeModel = SamplesTreeStore::create(m_SamplesModel); |
m_refSamplesTreeModel = SamplesTreeStore::create(m_SamplesModel); |
637 |
m_TreeViewSamples.set_model(m_refSamplesTreeModel); |
m_TreeViewSamples.set_model(m_refSamplesTreeModel); |
638 |
|
m_TreeViewSamples.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE); |
639 |
m_TreeViewSamples.set_tooltip_text(_("To actually use a sample, drag it from this list view to \"Sample\" -> \"Sample:\" on the region's settings pane on the right.\n\nRight click here for more actions on samples.")); |
m_TreeViewSamples.set_tooltip_text(_("To actually use a sample, drag it from this list view to \"Sample\" -> \"Sample:\" on the region's settings pane on the right.\n\nRight click here for more actions on samples.")); |
640 |
// m_TreeViewSamples.set_reorderable(); |
// m_TreeViewSamples.set_reorderable(); |
641 |
m_TreeViewSamples.append_column_editable(_("Name"), m_SamplesModel.m_col_name); |
m_TreeViewSamples.append_column_editable(_("Name"), m_SamplesModel.m_col_name); |
813 |
gig::Instrument* MainWindow::get_instrument() |
gig::Instrument* MainWindow::get_instrument() |
814 |
{ |
{ |
815 |
gig::Instrument* instrument = 0; |
gig::Instrument* instrument = 0; |
816 |
Gtk::TreeModel::const_iterator it = |
std::vector<Gtk::TreeModel::Path> rows = m_TreeView.get_selection()->get_selected_rows(); |
817 |
m_TreeView.get_selection()->get_selected(); |
if (rows.empty()) return NULL; |
818 |
|
Gtk::TreeModel::const_iterator it = m_refTreeModel->get_iter(rows[0]); |
819 |
if (it) { |
if (it) { |
820 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
821 |
instrument = row[m_Columns.m_col_instr]; |
instrument = row[m_Columns.m_col_instr]; |
858 |
add_region_to_dimregs(region, stereo, all_dimregs); |
add_region_to_dimregs(region, stereo, all_dimregs); |
859 |
} |
} |
860 |
} |
} |
861 |
|
|
862 |
|
m_DimRegionChooser.setModifyAllRegions(all_regions); |
863 |
|
m_DimRegionChooser.setModifyAllDimensionRegions(all_dimregs); |
864 |
|
m_DimRegionChooser.setModifyBothChannels(stereo); |
865 |
} |
} |
866 |
|
|
867 |
void MainWindow::dimreg_all_dimregs_toggled() |
void MainWindow::dimreg_all_dimregs_toggled() |
879 |
void MainWindow::on_sel_change() |
void MainWindow::on_sel_change() |
880 |
{ |
{ |
881 |
// select item in instrument menu |
// select item in instrument menu |
882 |
Gtk::TreeModel::iterator it = m_TreeView.get_selection()->get_selected(); |
std::vector<Gtk::TreeModel::Path> rows = m_TreeView.get_selection()->get_selected_rows(); |
883 |
if (it) { |
if (!rows.empty()) { |
884 |
Gtk::TreePath path(it); |
Gtk::TreeModel::iterator it = m_refTreeModel->get_iter(rows[0]); |
885 |
int index = path[0]; |
if (it) { |
886 |
const std::vector<Gtk::Widget*> children = |
Gtk::TreePath path(it); |
887 |
instrument_menu->get_children(); |
int index = path[0]; |
888 |
static_cast<Gtk::RadioMenuItem*>(children[index])->set_active(); |
const std::vector<Gtk::Widget*> children = |
889 |
|
instrument_menu->get_children(); |
890 |
|
static_cast<Gtk::RadioMenuItem*>(children[index])->set_active(); |
891 |
|
} |
892 |
} |
} |
893 |
|
|
894 |
m_RegionChooser.set_instrument(get_instrument()); |
m_RegionChooser.set_instrument(get_instrument()); |
913 |
progress_dispatcher(); |
progress_dispatcher(); |
914 |
} |
} |
915 |
|
|
916 |
|
#if defined(WIN32) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) |
917 |
|
// make sure stack is 16-byte aligned for SSE instructions |
918 |
|
__attribute__((force_align_arg_pointer)) |
919 |
|
#endif |
920 |
void Loader::thread_function() |
void Loader::thread_function() |
921 |
{ |
{ |
922 |
printf("thread_function self=%p\n", |
printf("thread_function self=%p\n", |
996 |
progress_dispatcher.emit(); |
progress_dispatcher.emit(); |
997 |
} |
} |
998 |
|
|
999 |
|
#if defined(WIN32) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) |
1000 |
|
// make sure stack is 16-byte aligned for SSE instructions |
1001 |
|
__attribute__((force_align_arg_pointer)) |
1002 |
|
#endif |
1003 |
void Saver::thread_function() |
void Saver::thread_function() |
1004 |
{ |
{ |
1005 |
printf("thread_function self=%p\n", |
printf("thread_function self=%p\n", |
1024 |
String tmpname = filename + ".TMP"; |
String tmpname = filename + ".TMP"; |
1025 |
gig->Save(tmpname, &progress); |
gig->Save(tmpname, &progress); |
1026 |
#if defined(WIN32) |
#if defined(WIN32) |
1027 |
if (!DeleteFile(filename.c_str()) { |
if (!DeleteFile(filename.c_str())) { |
1028 |
throw RIFF::Exception("Could not replace original file with temporary file (unable to remove original file)."); |
throw RIFF::Exception("Could not replace original file with temporary file (unable to remove original file)."); |
1029 |
} |
} |
1030 |
#else // POSIX ... |
#else // POSIX ... |
1494 |
std::cout << "Starting sample import\n" << std::flush; |
std::cout << "Starting sample import\n" << std::flush; |
1495 |
Glib::ustring error_files; |
Glib::ustring error_files; |
1496 |
printf("Samples to import: %d\n", int(m_SampleImportQueue.size())); |
printf("Samples to import: %d\n", int(m_SampleImportQueue.size())); |
1497 |
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); |
for (std::map<gig::Sample*, SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); |
1498 |
iter != m_SampleImportQueue.end(); ) { |
iter != m_SampleImportQueue.end(); ) { |
1499 |
printf("Importing sample %s\n",(*iter).sample_path.c_str()); |
printf("Importing sample %s\n",iter->second.sample_path.c_str()); |
1500 |
SF_INFO info; |
SF_INFO info; |
1501 |
info.format = 0; |
info.format = 0; |
1502 |
SNDFILE* hFile = sf_open((*iter).sample_path.c_str(), SFM_READ, &info); |
SNDFILE* hFile = sf_open(iter->second.sample_path.c_str(), SFM_READ, &info); |
1503 |
sf_command(hFile, SFC_SET_SCALE_FLOAT_INT_READ, 0, SF_TRUE); |
sf_command(hFile, SFC_SET_SCALE_FLOAT_INT_READ, 0, SF_TRUE); |
1504 |
try { |
try { |
1505 |
if (!hFile) throw std::string(_("could not open file")); |
if (!hFile) throw std::string(_("could not open file")); |
1522 |
throw std::string(_("format not supported")); // unsupported subformat (yet?) |
throw std::string(_("format not supported")); // unsupported subformat (yet?) |
1523 |
} |
} |
1524 |
|
|
1525 |
|
// reset write position for sample |
1526 |
|
iter->first->SetPos(0); |
1527 |
|
|
1528 |
const int bufsize = 10000; |
const int bufsize = 10000; |
1529 |
switch (bitdepth) { |
switch (bitdepth) { |
1530 |
case 16: { |
case 16: { |
1534 |
// libsndfile does the conversion for us (if needed) |
// libsndfile does the conversion for us (if needed) |
1535 |
int n = sf_readf_short(hFile, buffer, bufsize); |
int n = sf_readf_short(hFile, buffer, bufsize); |
1536 |
// write from buffer directly (physically) into .gig file |
// write from buffer directly (physically) into .gig file |
1537 |
iter->gig_sample->Write(buffer, n); |
iter->first->Write(buffer, n); |
1538 |
cnt -= n; |
cnt -= n; |
1539 |
} |
} |
1540 |
delete[] buffer; |
delete[] buffer; |
1554 |
dstbuf[j++] = srcbuf[i] >> 24; |
dstbuf[j++] = srcbuf[i] >> 24; |
1555 |
} |
} |
1556 |
// write from buffer directly (physically) into .gig file |
// write from buffer directly (physically) into .gig file |
1557 |
iter->gig_sample->Write(dstbuf, n); |
iter->first->Write(dstbuf, n); |
1558 |
cnt -= n; |
cnt -= n; |
1559 |
} |
} |
1560 |
delete[] srcbuf; |
delete[] srcbuf; |
1565 |
// cleanup |
// cleanup |
1566 |
sf_close(hFile); |
sf_close(hFile); |
1567 |
// let the sampler re-cache the sample if needed |
// let the sampler re-cache the sample if needed |
1568 |
sample_changed_signal.emit(iter->gig_sample); |
sample_changed_signal.emit(iter->first); |
1569 |
// on success we remove the sample from the import queue, |
// on success we remove the sample from the import queue, |
1570 |
// otherwise keep it, maybe it works the next time ? |
// otherwise keep it, maybe it works the next time ? |
1571 |
std::list<SampleImportItem>::iterator cur = iter; |
std::map<gig::Sample*, SampleImportItem>::iterator cur = iter; |
1572 |
++iter; |
++iter; |
1573 |
m_SampleImportQueue.erase(cur); |
m_SampleImportQueue.erase(cur); |
1574 |
} catch (std::string what) { |
} catch (std::string what) { |
1575 |
// remember the files that made trouble (and their cause) |
// remember the files that made trouble (and their cause) |
1576 |
if (!error_files.empty()) error_files += "\n"; |
if (!error_files.empty()) error_files += "\n"; |
1577 |
error_files += (*iter).sample_path += " (" + what + ")"; |
error_files += iter->second.sample_path += " (" + what + ")"; |
1578 |
++iter; |
++iter; |
1579 |
} |
} |
1580 |
} |
} |
1616 |
dialog.set_name("Gigedit"); |
dialog.set_name("Gigedit"); |
1617 |
#endif |
#endif |
1618 |
dialog.set_version(VERSION); |
dialog.set_version(VERSION); |
1619 |
dialog.set_copyright("Copyright (C) 2006-2016 Andreas Persson"); |
dialog.set_copyright("Copyright (C) 2006-2017 Andreas Persson"); |
1620 |
const std::string sComment = |
const std::string sComment = |
1621 |
_("Built " __DATE__ "\nUsing ") + |
_("Built " __DATE__ "\nUsing ") + |
1622 |
::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" + |
::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" + |
1911 |
propDialog.set_info(gig->pInfo); |
propDialog.set_info(gig->pInfo); |
1912 |
|
|
1913 |
instrument_name_connection.block(); |
instrument_name_connection.block(); |
1914 |
|
int index = 0; |
1915 |
for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; |
for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; |
1916 |
instrument = gig->GetNextInstrument()) { |
instrument = gig->GetNextInstrument(), ++index) { |
1917 |
Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); |
Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); |
1918 |
|
|
1919 |
Gtk::TreeModel::iterator iter = m_refTreeModel->append(); |
Gtk::TreeModel::iterator iter = m_refTreeModel->append(); |
1920 |
Gtk::TreeModel::Row row = *iter; |
Gtk::TreeModel::Row row = *iter; |
1921 |
|
row[m_Columns.m_col_nr] = index; |
1922 |
row[m_Columns.m_col_name] = name; |
row[m_Columns.m_col_name] = name; |
1923 |
row[m_Columns.m_col_instr] = instrument; |
row[m_Columns.m_col_instr] = instrument; |
1924 |
|
|
1991 |
{ |
{ |
1992 |
instrumentProps.signal_name_changed().clear(); |
instrumentProps.signal_name_changed().clear(); |
1993 |
|
|
1994 |
Gtk::TreeModel::const_iterator it = |
std::vector<Gtk::TreeModel::Path> rows = m_TreeView.get_selection()->get_selected_rows(); |
1995 |
m_TreeView.get_selection()->get_selected(); |
if (rows.empty()) { |
1996 |
|
instrumentProps.hide(); |
1997 |
|
return false; |
1998 |
|
} |
1999 |
|
Gtk::TreeModel::const_iterator it = m_refTreeModel->get_iter(rows[0]); |
2000 |
if (it) { |
if (it) { |
2001 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
2002 |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
2049 |
void MainWindow::show_script_slots() { |
void MainWindow::show_script_slots() { |
2050 |
if (!file) return; |
if (!file) return; |
2051 |
// get selected instrument |
// get selected instrument |
2052 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
std::vector<Gtk::TreeModel::Path> rows = m_TreeView.get_selection()->get_selected_rows(); |
2053 |
Gtk::TreeModel::iterator it = sel->get_selected(); |
if (rows.empty()) return; |
2054 |
|
Gtk::TreeModel::iterator it = m_refTreeModel->get_iter(rows[0]); |
2055 |
if (!it) return; |
if (!it) return; |
2056 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
2057 |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
2171 |
if (row[m_Columns.m_col_instr] == instrument) { |
if (row[m_Columns.m_col_instr] == instrument) { |
2172 |
// select and show the respective instrument in the list view |
// select and show the respective instrument in the list view |
2173 |
show_intruments_tab(); |
show_intruments_tab(); |
2174 |
|
m_TreeView.get_selection()->unselect_all(); |
2175 |
m_TreeView.get_selection()->select(model->children()[i]); |
m_TreeView.get_selection()->select(model->children()[i]); |
2176 |
Gtk::TreePath path( |
std::vector<Gtk::TreeModel::Path> rows = |
2177 |
m_TreeView.get_selection()->get_selected() |
m_TreeView.get_selection()->get_selected_rows(); |
2178 |
); |
if (!rows.empty()) |
2179 |
m_TreeView.scroll_to_row(path); |
m_TreeView.scroll_to_row(rows[0]); |
2180 |
on_sel_change(); // the regular instrument selection change callback |
on_sel_change(); // the regular instrument selection change callback |
2181 |
} |
} |
2182 |
} |
} |
2193 |
if (row[m_Columns.m_col_instr] == pInstrument) { |
if (row[m_Columns.m_col_instr] == pInstrument) { |
2194 |
// select and show the respective instrument in the list view |
// select and show the respective instrument in the list view |
2195 |
show_intruments_tab(); |
show_intruments_tab(); |
2196 |
|
m_TreeView.get_selection()->unselect_all(); |
2197 |
m_TreeView.get_selection()->select(model->children()[i]); |
m_TreeView.get_selection()->select(model->children()[i]); |
2198 |
Gtk::TreePath path( |
std::vector<Gtk::TreeModel::Path> rows = |
2199 |
m_TreeView.get_selection()->get_selected() |
m_TreeView.get_selection()->get_selected_rows(); |
2200 |
); |
if (!rows.empty()) |
2201 |
m_TreeView.scroll_to_row(path); |
m_TreeView.scroll_to_row(rows[0]); |
2202 |
on_sel_change(); // the regular instrument selection change callback |
on_sel_change(); // the regular instrument selection change callback |
2203 |
|
|
2204 |
// select respective region in the region selector |
// select respective region in the region selector |
2224 |
Gtk::TreeModel::Row rowSample = rowGroup.children()[s]; |
Gtk::TreeModel::Row rowSample = rowGroup.children()[s]; |
2225 |
if (rowSample[m_SamplesModel.m_col_sample] == sample) { |
if (rowSample[m_SamplesModel.m_col_sample] == sample) { |
2226 |
show_samples_tab(); |
show_samples_tab(); |
2227 |
|
m_TreeViewSamples.get_selection()->unselect_all(); |
2228 |
m_TreeViewSamples.get_selection()->select(rowGroup.children()[s]); |
m_TreeViewSamples.get_selection()->select(rowGroup.children()[s]); |
2229 |
Gtk::TreePath path( |
std::vector<Gtk::TreeModel::Path> rows = |
2230 |
m_TreeViewSamples.get_selection()->get_selected() |
m_TreeViewSamples.get_selection()->get_selected_rows(); |
2231 |
); |
if (rows.empty()) return; |
2232 |
m_TreeViewSamples.scroll_to_row(path); |
m_TreeViewSamples.scroll_to_row(rows[0]); |
2233 |
return; |
return; |
2234 |
} |
} |
2235 |
} |
} |
2238 |
|
|
2239 |
void MainWindow::on_sample_treeview_button_release(GdkEventButton* button) { |
void MainWindow::on_sample_treeview_button_release(GdkEventButton* button) { |
2240 |
if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
2241 |
|
// by default if Ctrl keys is pressed down, then a mouse right-click |
2242 |
|
// does not select the respective row, so we must assure this |
2243 |
|
// programmatically ... |
2244 |
|
/*{ |
2245 |
|
Gtk::TreeModel::Path path; |
2246 |
|
Gtk::TreeViewColumn* pColumn = NULL; |
2247 |
|
int cellX, cellY; |
2248 |
|
bool bSuccess = m_TreeViewSamples.get_path_at_pos( |
2249 |
|
(int)button->x, (int)button->y, |
2250 |
|
path, pColumn, cellX, cellY |
2251 |
|
); |
2252 |
|
if (bSuccess) { |
2253 |
|
if (m_TreeViewSamples.get_selection()->count_selected_rows() <= 0) { |
2254 |
|
printf("not selected !!!\n"); |
2255 |
|
m_TreeViewSamples.get_selection()->select(path); |
2256 |
|
} |
2257 |
|
} |
2258 |
|
}*/ |
2259 |
|
|
2260 |
Gtk::Menu* sample_popup = |
Gtk::Menu* sample_popup = |
2261 |
dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/SamplePopupMenu")); |
dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/SamplePopupMenu")); |
2262 |
// update enabled/disabled state of sample popup items |
// update enabled/disabled state of sample popup items |
2263 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
2264 |
Gtk::TreeModel::iterator it = sel->get_selected(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
2265 |
bool group_selected = false; |
const int n = rows.size(); |
2266 |
bool sample_selected = false; |
int nGroups = 0; |
2267 |
if (it) { |
int nSamples = 0; |
2268 |
|
for (int r = 0; r < n; ++r) { |
2269 |
|
Gtk::TreeModel::iterator it = m_refSamplesTreeModel->get_iter(rows[r]); |
2270 |
|
if (!it) continue; |
2271 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
2272 |
group_selected = row[m_SamplesModel.m_col_group]; |
if (row[m_SamplesModel.m_col_group]) nGroups++; |
2273 |
sample_selected = row[m_SamplesModel.m_col_sample]; |
if (row[m_SamplesModel.m_col_sample]) nSamples++; |
2274 |
} |
} |
2275 |
|
|
|
|
|
2276 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/SampleProperties"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/SampleProperties"))-> |
2277 |
set_sensitive(group_selected || sample_selected); |
set_sensitive(n == 1); |
2278 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/AddSample"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/AddSample"))-> |
2279 |
set_sensitive(group_selected || sample_selected); |
set_sensitive(n); |
2280 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/AddGroup"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/AddGroup"))-> |
2281 |
set_sensitive(file); |
set_sensitive(file); |
2282 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/ShowSampleRefs"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/ShowSampleRefs"))-> |
2283 |
set_sensitive(sample_selected); |
set_sensitive(nSamples == 1); |
2284 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/RemoveSample"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/RemoveSample"))-> |
2285 |
set_sensitive(group_selected || sample_selected); |
set_sensitive(n); |
2286 |
// show sample popup |
// show sample popup |
2287 |
sample_popup->popup(button->button, button->time); |
sample_popup->popup(button->button, button->time); |
2288 |
|
|
2289 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/SampleProperties"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/SampleProperties"))-> |
2290 |
set_sensitive(group_selected || sample_selected); |
set_sensitive(n == 1); |
2291 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/AddSample"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/AddSample"))-> |
2292 |
set_sensitive(group_selected || sample_selected); |
set_sensitive(n); |
2293 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/AddGroup"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/AddGroup"))-> |
2294 |
set_sensitive(file); |
set_sensitive(file); |
2295 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/ShowSampleRefs"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/ShowSampleRefs"))-> |
2296 |
set_sensitive(sample_selected); |
set_sensitive(nSamples == 1); |
2297 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/RemoveSample"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/RemoveSample"))-> |
2298 |
set_sensitive(group_selected || sample_selected); |
set_sensitive(n); |
2299 |
} |
} |
2300 |
} |
} |
2301 |
|
|
2374 |
instrument_name_connection.block(); |
instrument_name_connection.block(); |
2375 |
Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append(); |
Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append(); |
2376 |
Gtk::TreeModel::Row rowInstr = *iterInstr; |
Gtk::TreeModel::Row rowInstr = *iterInstr; |
2377 |
|
rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1; |
2378 |
rowInstr[m_Columns.m_col_name] = name; |
rowInstr[m_Columns.m_col_name] = name; |
2379 |
rowInstr[m_Columns.m_col_instr] = instrument; |
rowInstr[m_Columns.m_col_instr] = instrument; |
2380 |
instrument_name_connection.unblock(); |
instrument_name_connection.unblock(); |
2403 |
// retrieve the currently selected instrument |
// retrieve the currently selected instrument |
2404 |
// (being the original instrument to be duplicated) |
// (being the original instrument to be duplicated) |
2405 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
2406 |
Gtk::TreeModel::iterator itSelection = sel->get_selected(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
2407 |
if (!itSelection) return; |
for (int r = 0; r < rows.size(); ++r) { |
2408 |
Gtk::TreeModel::Row row = *itSelection; |
Gtk::TreeModel::iterator it = m_refTreeModel->get_iter(rows[r]); |
2409 |
gig::Instrument* instrOrig = row[m_Columns.m_col_instr]; |
if (it) { |
2410 |
if (!instrOrig) return; |
Gtk::TreeModel::Row row = *it; |
2411 |
|
gig::Instrument* instrOrig = row[m_Columns.m_col_instr]; |
2412 |
// duplicate the orginal instrument |
if (instrOrig) { |
2413 |
gig::Instrument* instrNew = file->AddDuplicateInstrument(instrOrig); |
// duplicate the orginal instrument |
2414 |
instrNew->pInfo->Name = |
gig::Instrument* instrNew = file->AddDuplicateInstrument(instrOrig); |
2415 |
instrOrig->pInfo->Name + |
instrNew->pInfo->Name = |
2416 |
gig_from_utf8(Glib::ustring(" (") + _("Copy") + ")"); |
instrOrig->pInfo->Name + |
2417 |
|
gig_from_utf8(Glib::ustring(" (") + _("Copy") + ")"); |
2418 |
|
|
2419 |
add_instrument(instrNew); |
add_instrument(instrNew); |
2420 |
|
} |
2421 |
|
} |
2422 |
|
} |
2423 |
} |
} |
2424 |
|
|
2425 |
void MainWindow::on_action_remove_instrument() { |
void MainWindow::on_action_remove_instrument() { |
2436 |
} |
} |
2437 |
|
|
2438 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
2439 |
Gtk::TreeModel::iterator it = sel->get_selected(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
2440 |
if (it) { |
for (int r = rows.size() - 1; r >= 0; --r) { |
2441 |
|
Gtk::TreeModel::iterator it = m_refTreeModel->get_iter(rows[r]); |
2442 |
|
if (!it) continue; |
2443 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
2444 |
gig::Instrument* instr = row[m_Columns.m_col_instr]; |
gig::Instrument* instr = row[m_Columns.m_col_instr]; |
2445 |
try { |
try { |
2454 |
|
|
2455 |
// remove row from instruments tree view |
// remove row from instruments tree view |
2456 |
m_refTreeModel->erase(it); |
m_refTreeModel->erase(it); |
2457 |
|
// update "Nr" column of all instrument rows |
2458 |
|
{ |
2459 |
|
int index = 0; |
2460 |
|
for (Gtk::TreeModel::iterator it = m_refTreeModel->children().begin(); |
2461 |
|
it != m_refTreeModel->children().end(); ++it, ++index) |
2462 |
|
{ |
2463 |
|
Gtk::TreeModel::Row row = *it; |
2464 |
|
row[m_Columns.m_col_nr] = index; |
2465 |
|
} |
2466 |
|
} |
2467 |
|
|
2468 |
#if GTKMM_MAJOR_VERSION < 3 |
#if GTKMM_MAJOR_VERSION < 3 |
2469 |
// select another instrument (in gtk3 this is done |
// select another instrument (in gtk3 this is done |
2645 |
|
|
2646 |
// get selected group (and probably selected sample) |
// get selected group (and probably selected sample) |
2647 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
2648 |
Gtk::TreeModel::iterator it = sel->get_selected(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
2649 |
|
if (rows.empty()) return; |
2650 |
|
Gtk::TreeModel::iterator it = m_refSamplesTreeModel->get_iter(rows[0]); |
2651 |
if (!it) return; |
if (!it) return; |
2652 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
2653 |
gig::Sample* sample = NULL; |
gig::Sample* sample = NULL; |
2796 |
SampleImportItem sched_item; |
SampleImportItem sched_item; |
2797 |
sched_item.gig_sample = sample; |
sched_item.gig_sample = sample; |
2798 |
sched_item.sample_path = *iter; |
sched_item.sample_path = *iter; |
2799 |
m_SampleImportQueue.push_back(sched_item); |
m_SampleImportQueue[sample] = sched_item; |
2800 |
// add sample to the tree view |
// add sample to the tree view |
2801 |
if (replace) { |
if (replace) { |
2802 |
row[m_SamplesModel.m_col_name] = gig_to_utf8(sample->pInfo->Name); |
row[m_SamplesModel.m_col_name] = gig_to_utf8(sample->pInfo->Name); |
2906 |
SampleImportItem sched_item; |
SampleImportItem sched_item; |
2907 |
sched_item.gig_sample = sample; |
sched_item.gig_sample = sample; |
2908 |
sched_item.sample_path = filename; |
sched_item.sample_path = filename; |
2909 |
m_SampleImportQueue.push_back(sched_item); |
m_SampleImportQueue[sample] = sched_item; |
2910 |
sf_close(hFile); |
sf_close(hFile); |
2911 |
file_changed(); |
file_changed(); |
2912 |
} |
} |
2930 |
void MainWindow::on_action_remove_sample() { |
void MainWindow::on_action_remove_sample() { |
2931 |
if (!file) return; |
if (!file) return; |
2932 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
2933 |
Gtk::TreeModel::iterator it = sel->get_selected(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
2934 |
if (it) { |
for (int r = rows.size() - 1; r >= 0; --r) { |
2935 |
|
Gtk::TreeModel::iterator it = m_refSamplesTreeModel->get_iter(rows[r]); |
2936 |
|
if (!it) continue; |
2937 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
2938 |
gig::Group* group = row[m_SamplesModel.m_col_group]; |
gig::Group* group = row[m_SamplesModel.m_col_group]; |
2939 |
gig::Sample* sample = row[m_SamplesModel.m_col_sample]; |
gig::Sample* sample = row[m_SamplesModel.m_col_sample]; |
2958 |
// if sample(s) were just previously added, remove |
// if sample(s) were just previously added, remove |
2959 |
// them from the import queue |
// them from the import queue |
2960 |
for (std::list<gig::Sample*>::iterator member = members.begin(); |
for (std::list<gig::Sample*>::iterator member = members.begin(); |
2961 |
member != members.end(); ++member) { |
member != members.end(); ++member) |
2962 |
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); |
{ |
2963 |
iter != m_SampleImportQueue.end(); ++iter) { |
if (m_SampleImportQueue.count(*member)) { |
2964 |
if ((*iter).gig_sample == *member) { |
printf("Removing previously added sample '%s' from group '%s'\n", |
2965 |
printf("Removing previously added sample '%s' from group '%s'\n", |
m_SampleImportQueue[sample].sample_path.c_str(), name.c_str()); |
2966 |
(*iter).sample_path.c_str(), name.c_str()); |
m_SampleImportQueue.erase(*member); |
|
m_SampleImportQueue.erase(iter); |
|
|
break; |
|
|
} |
|
2967 |
} |
} |
2968 |
} |
} |
2969 |
file_changed(); |
file_changed(); |
2978 |
samples_removed_signal.emit(); |
samples_removed_signal.emit(); |
2979 |
// if sample was just previously added, remove it from |
// if sample was just previously added, remove it from |
2980 |
// the import queue |
// the import queue |
2981 |
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); |
if (m_SampleImportQueue.count(sample)) { |
2982 |
iter != m_SampleImportQueue.end(); ++iter) { |
printf("Removing previously added sample '%s'\n", |
2983 |
if ((*iter).gig_sample == sample) { |
m_SampleImportQueue[sample].sample_path.c_str()); |
2984 |
printf("Removing previously added sample '%s'\n", |
m_SampleImportQueue.erase(sample); |
|
(*iter).sample_path.c_str()); |
|
|
m_SampleImportQueue.erase(iter); |
|
|
break; |
|
|
} |
|
2985 |
} |
} |
2986 |
dimreg_changed(); |
dimreg_changed(); |
2987 |
file_changed(); |
file_changed(); |
3037 |
gig::Sample* sample = *itSample; |
gig::Sample* sample = *itSample; |
3038 |
// remove sample from the .gig file |
// remove sample from the .gig file |
3039 |
file->DeleteSample(sample); |
file->DeleteSample(sample); |
3040 |
// if sample was just previously added, remove it fro the import queue |
// if sample was just previously added, remove it from the import queue |
3041 |
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); |
if (m_SampleImportQueue.count(sample)) { |
3042 |
iter != m_SampleImportQueue.end(); ++iter) |
printf("Removing previously added sample '%s'\n", |
3043 |
{ |
m_SampleImportQueue[sample].sample_path.c_str()); |
3044 |
if ((*iter).gig_sample == sample) { |
m_SampleImportQueue.erase(sample); |
|
printf("Removing previously added sample '%s'\n", |
|
|
(*iter).sample_path.c_str()); |
|
|
m_SampleImportQueue.erase(iter); |
|
|
break; |
|
|
} |
|
3045 |
} |
} |
3046 |
} |
} |
3047 |
} catch (RIFF::Exception e) { |
} catch (RIFF::Exception e) { |
3100 |
gig::Instrument* src = NULL; |
gig::Instrument* src = NULL; |
3101 |
{ |
{ |
3102 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
3103 |
Gtk::TreeModel::iterator it = sel->get_selected(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
3104 |
if (it) { |
if (!rows.empty()) { |
3105 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::iterator it = m_refTreeModel->get_iter(rows[0]); |
3106 |
src = row[m_Columns.m_col_instr]; |
if (it) { |
3107 |
|
Gtk::TreeModel::Row row = *it; |
3108 |
|
src = row[m_Columns.m_col_instr]; |
3109 |
|
} |
3110 |
} |
} |
3111 |
} |
} |
3112 |
if (!src) return; |
if (!src) return; |
3161 |
// get selected sample |
// get selected sample |
3162 |
gig::Sample* sample = NULL; |
gig::Sample* sample = NULL; |
3163 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
3164 |
Gtk::TreeModel::iterator it = sel->get_selected(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
3165 |
if (it) { |
if (!rows.empty()) { |
3166 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::iterator it = m_refSamplesTreeModel->get_iter(rows[0]); |
3167 |
sample = row[m_SamplesModel.m_col_sample]; |
if (it) { |
3168 |
|
Gtk::TreeModel::Row row = *it; |
3169 |
|
sample = row[m_SamplesModel.m_col_sample]; |
3170 |
|
} |
3171 |
} |
} |
3172 |
// pass the gig::Sample as pointer |
// pass the gig::Sample as pointer |
3173 |
selection_data.set(selection_data.get_target(), 0/*unused*/, (const guchar*)&sample, |
selection_data.set(selection_data.get_target(), 0/*unused*/, (const guchar*)&sample, |
3366 |
|
|
3367 |
void MainWindow::on_action_view_references() { |
void MainWindow::on_action_view_references() { |
3368 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
3369 |
Gtk::TreeModel::iterator it = sel->get_selected(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
3370 |
|
if (rows.empty()) return; |
3371 |
|
Gtk::TreeModel::iterator it = m_refSamplesTreeModel->get_iter(rows[0]); |
3372 |
if (!it) return; |
if (!it) return; |
3373 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
3374 |
gig::Sample* sample = row[m_SamplesModel.m_col_sample]; |
gig::Sample* sample = row[m_SamplesModel.m_col_sample]; |
3617 |
m_TreeViewNotebook.set_current_page(2); |
m_TreeViewNotebook.set_current_page(2); |
3618 |
} |
} |
3619 |
|
|
3620 |
|
void MainWindow::select_prev_region() { |
3621 |
|
m_RegionChooser.select_prev_region(); |
3622 |
|
} |
3623 |
|
|
3624 |
|
void MainWindow::select_next_region() { |
3625 |
|
m_RegionChooser.select_next_region(); |
3626 |
|
} |
3627 |
|
|
3628 |
|
void MainWindow::select_next_dim_rgn_zone() { |
3629 |
|
if (m_DimRegionChooser.has_focus()) return; // avoid conflict with key stroke handler of DimenionRegionChooser |
3630 |
|
m_DimRegionChooser.select_next_dimzone(); |
3631 |
|
} |
3632 |
|
|
3633 |
|
void MainWindow::select_prev_dim_rgn_zone() { |
3634 |
|
if (m_DimRegionChooser.has_focus()) return; // avoid conflict with key stroke handler of DimenionRegionChooser |
3635 |
|
m_DimRegionChooser.select_prev_dimzone(); |
3636 |
|
} |
3637 |
|
|
3638 |
|
void MainWindow::select_prev_dimension() { |
3639 |
|
if (m_DimRegionChooser.has_focus()) return; // avoid conflict with key stroke handler of DimenionRegionChooser |
3640 |
|
m_DimRegionChooser.select_prev_dimension(); |
3641 |
|
} |
3642 |
|
|
3643 |
|
void MainWindow::select_next_dimension() { |
3644 |
|
if (m_DimRegionChooser.has_focus()) return; // avoid conflict with key stroke handler of DimenionRegionChooser |
3645 |
|
m_DimRegionChooser.select_next_dimension(); |
3646 |
|
} |
3647 |
|
|
3648 |
sigc::signal<void, gig::File*>& MainWindow::signal_file_structure_to_be_changed() { |
sigc::signal<void, gig::File*>& MainWindow::signal_file_structure_to_be_changed() { |
3649 |
return file_structure_to_be_changed_signal; |
return file_structure_to_be_changed_signal; |
3650 |
} |
} |