45 |
#include "mainwindow.h" |
#include "mainwindow.h" |
46 |
#include "Settings.h" |
#include "Settings.h" |
47 |
#include "CombineInstrumentsDialog.h" |
#include "CombineInstrumentsDialog.h" |
48 |
|
#include "scripteditor.h" |
49 |
|
#include "scriptslots.h" |
50 |
#include "../../gfx/status_attached.xpm" |
#include "../../gfx/status_attached.xpm" |
51 |
#include "../../gfx/status_detached.xpm" |
#include "../../gfx/status_detached.xpm" |
52 |
|
|
80 |
m_ScrolledWindowSamples.add(m_TreeViewSamples); |
m_ScrolledWindowSamples.add(m_TreeViewSamples); |
81 |
m_ScrolledWindowSamples.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
m_ScrolledWindowSamples.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
82 |
|
|
83 |
|
m_ScrolledWindowScripts.add(m_TreeViewScripts); |
84 |
|
m_ScrolledWindowScripts.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
85 |
|
|
86 |
|
|
87 |
m_TreeViewNotebook.set_size_request(300); |
m_TreeViewNotebook.set_size_request(300); |
88 |
|
|
103 |
|
|
104 |
m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, _("Samples")); |
m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, _("Samples")); |
105 |
m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments")); |
m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments")); |
106 |
|
m_TreeViewNotebook.append_page(m_ScrolledWindowScripts, _("Scripts")); |
107 |
|
|
108 |
actionGroup = Gtk::ActionGroup::create(); |
actionGroup = Gtk::ActionGroup::create(); |
109 |
|
|
135 |
sigc::mem_fun( |
sigc::mem_fun( |
136 |
*this, &MainWindow::show_instr_props)); |
*this, &MainWindow::show_instr_props)); |
137 |
actionGroup->add(Gtk::Action::create("MidiRules", |
actionGroup->add(Gtk::Action::create("MidiRules", |
138 |
_("_Midi Rules")), |
_("_Midi Rules...")), |
139 |
sigc::mem_fun( |
sigc::mem_fun( |
140 |
*this, &MainWindow::show_midi_rules)); |
*this, &MainWindow::show_midi_rules)); |
141 |
|
actionGroup->add(Gtk::Action::create("ScriptSlots", |
142 |
|
_("_Script Slots...")), |
143 |
|
sigc::mem_fun( |
144 |
|
*this, &MainWindow::show_script_slots)); |
145 |
actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT), |
actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT), |
146 |
sigc::mem_fun( |
sigc::mem_fun( |
147 |
*this, &MainWindow::on_action_quit)); |
*this, &MainWindow::on_action_quit)); |
240 |
_("Replace All Samples in All Groups...")), |
_("Replace All Samples in All Groups...")), |
241 |
sigc::mem_fun(*this, &MainWindow::on_action_replace_all_samples_in_all_groups) |
sigc::mem_fun(*this, &MainWindow::on_action_replace_all_samples_in_all_groups) |
242 |
); |
); |
243 |
|
|
244 |
|
// script right-click popup actions |
245 |
|
actionGroup->add( |
246 |
|
Gtk::Action::create("AddScriptGroup", _("Add _Group")), |
247 |
|
sigc::mem_fun(*this, &MainWindow::on_action_add_script_group) |
248 |
|
); |
249 |
|
actionGroup->add( |
250 |
|
Gtk::Action::create("AddScript", _("Add _Script")), |
251 |
|
sigc::mem_fun(*this, &MainWindow::on_action_add_script) |
252 |
|
); |
253 |
|
actionGroup->add( |
254 |
|
Gtk::Action::create("EditScript", _("_Edit Script...")), |
255 |
|
sigc::mem_fun(*this, &MainWindow::on_action_edit_script) |
256 |
|
); |
257 |
|
actionGroup->add( |
258 |
|
Gtk::Action::create("RemoveScript", Gtk::Stock::REMOVE), |
259 |
|
sigc::mem_fun(*this, &MainWindow::on_action_remove_script) |
260 |
|
); |
261 |
|
|
262 |
uiManager = Gtk::UIManager::create(); |
uiManager = Gtk::UIManager::create(); |
263 |
uiManager->insert_action_group(actionGroup); |
uiManager->insert_action_group(actionGroup); |
301 |
" <popup name='PopupMenu'>" |
" <popup name='PopupMenu'>" |
302 |
" <menuitem action='InstrProperties'/>" |
" <menuitem action='InstrProperties'/>" |
303 |
" <menuitem action='MidiRules'/>" |
" <menuitem action='MidiRules'/>" |
304 |
|
" <menuitem action='ScriptSlots'/>" |
305 |
" <menuitem action='AddInstrument'/>" |
" <menuitem action='AddInstrument'/>" |
306 |
" <menuitem action='DupInstrument'/>" |
" <menuitem action='DupInstrument'/>" |
307 |
" <separator/>" |
" <separator/>" |
315 |
" <separator/>" |
" <separator/>" |
316 |
" <menuitem action='RemoveSample'/>" |
" <menuitem action='RemoveSample'/>" |
317 |
" </popup>" |
" </popup>" |
318 |
|
" <popup name='ScriptPopupMenu'>" |
319 |
|
" <menuitem action='AddScriptGroup'/>" |
320 |
|
" <menuitem action='AddScript'/>" |
321 |
|
" <menuitem action='EditScript'/>" |
322 |
|
" <separator/>" |
323 |
|
" <menuitem action='RemoveScript'/>" |
324 |
|
" </popup>" |
325 |
"</ui>"; |
"</ui>"; |
326 |
uiManager->add_ui_from_string(ui_info); |
uiManager->add_ui_from_string(ui_info); |
327 |
|
|
413 |
sigc::mem_fun(*this, &MainWindow::sample_name_changed) |
sigc::mem_fun(*this, &MainWindow::sample_name_changed) |
414 |
); |
); |
415 |
|
|
416 |
|
// create scripts treeview (including its data model) |
417 |
|
m_refScriptsTreeModel = ScriptsTreeStore::create(m_ScriptsModel); |
418 |
|
m_TreeViewScripts.set_model(m_refScriptsTreeModel); |
419 |
|
m_TreeViewScripts.set_tooltip_text(_( |
420 |
|
"Note: instrument scripts are a LinuxSampler extension of the gig " |
421 |
|
"format. This feature will not work with the GigaStudio software!" |
422 |
|
)); |
423 |
|
// m_TreeViewScripts.set_reorderable(); |
424 |
|
m_TreeViewScripts.append_column_editable("Samples", m_ScriptsModel.m_col_name); |
425 |
|
m_TreeViewScripts.set_headers_visible(false); |
426 |
|
m_TreeViewScripts.signal_button_press_event().connect_notify( |
427 |
|
sigc::mem_fun(*this, &MainWindow::on_script_treeview_button_release) |
428 |
|
); |
429 |
|
m_refScriptsTreeModel->signal_row_changed().connect( |
430 |
|
sigc::mem_fun(*this, &MainWindow::script_name_changed) |
431 |
|
); |
432 |
|
|
433 |
|
// establish drag&drop between scripts tree view and ScriptSlots window |
434 |
|
std::vector<Gtk::TargetEntry> drag_target_gig_script; |
435 |
|
drag_target_gig_script.push_back(Gtk::TargetEntry("gig::Script")); |
436 |
|
m_TreeViewScripts.drag_source_set(drag_target_gig_script); |
437 |
|
m_TreeViewScripts.signal_drag_begin().connect( |
438 |
|
sigc::mem_fun(*this, &MainWindow::on_scripts_treeview_drag_begin) |
439 |
|
); |
440 |
|
m_TreeViewScripts.signal_drag_data_get().connect( |
441 |
|
sigc::mem_fun(*this, &MainWindow::on_scripts_treeview_drag_data_get) |
442 |
|
); |
443 |
|
|
444 |
// establish drag&drop between samples tree view and dimension region 'Sample' text entry |
// establish drag&drop between samples tree view and dimension region 'Sample' text entry |
445 |
std::vector<Gtk::TargetEntry> drag_target_gig_sample; |
std::vector<Gtk::TargetEntry> drag_target_gig_sample; |
446 |
drag_target_gig_sample.push_back(Gtk::TargetEntry("gig::Sample")); |
drag_target_gig_sample.push_back(Gtk::TargetEntry("gig::Sample")); |
697 |
// clear the samples and instruments tree views |
// clear the samples and instruments tree views |
698 |
m_refTreeModel->clear(); |
m_refTreeModel->clear(); |
699 |
m_refSamplesTreeModel->clear(); |
m_refSamplesTreeModel->clear(); |
700 |
|
m_refScriptsTreeModel->clear(); |
701 |
// remove all entries from "Instrument" menu |
// remove all entries from "Instrument" menu |
702 |
while (!instrument_menu->get_children().empty()) { |
while (!instrument_menu->get_children().empty()) { |
703 |
remove_instrument_from_menu(0); |
remove_instrument_from_menu(0); |
712 |
// clear the samples and instruments tree views |
// clear the samples and instruments tree views |
713 |
m_refTreeModel->clear(); |
m_refTreeModel->clear(); |
714 |
m_refSamplesTreeModel->clear(); |
m_refSamplesTreeModel->clear(); |
715 |
|
m_refScriptsTreeModel->clear(); |
716 |
// remove all entries from "Instrument" menu |
// remove all entries from "Instrument" menu |
717 |
while (!instrument_menu->get_children().empty()) { |
while (!instrument_menu->get_children().empty()) { |
718 |
remove_instrument_from_menu(0); |
remove_instrument_from_menu(0); |
1219 |
} |
} |
1220 |
std::vector<const char*> texts; |
std::vector<const char*> texts; |
1221 |
for (int i = 0; i < txts.size(); ++i) texts.push_back(txts[i].c_str()); |
for (int i = 0; i < txts.size(); ++i) texts.push_back(txts[i].c_str()); |
1222 |
texts.push_back(NULL); values.push_back(NULL); |
texts.push_back(NULL); values.push_back(0); |
1223 |
eFileFormat.set_choices(&texts[0], &values[0]); |
eFileFormat.set_choices(&texts[0], &values[0]); |
1224 |
eFileFormat.set_value(major); |
eFileFormat.set_value(major); |
1225 |
} |
} |
1407 |
} |
} |
1408 |
} |
} |
1409 |
} |
} |
1410 |
|
|
1411 |
|
for (int i = 0; gig->GetScriptGroup(i); ++i) { |
1412 |
|
gig::ScriptGroup* group = gig->GetScriptGroup(i); |
1413 |
|
|
1414 |
|
Gtk::TreeModel::iterator iterGroup = m_refScriptsTreeModel->append(); |
1415 |
|
Gtk::TreeModel::Row rowGroup = *iterGroup; |
1416 |
|
rowGroup[m_ScriptsModel.m_col_name] = gig_to_utf8(group->Name); |
1417 |
|
rowGroup[m_ScriptsModel.m_col_group] = group; |
1418 |
|
rowGroup[m_ScriptsModel.m_col_script] = NULL; |
1419 |
|
for (int s = 0; group->GetScript(s); ++s) { |
1420 |
|
gig::Script* script = group->GetScript(s); |
1421 |
|
|
1422 |
|
Gtk::TreeModel::iterator iterScript = |
1423 |
|
m_refScriptsTreeModel->append(rowGroup.children()); |
1424 |
|
Gtk::TreeModel::Row rowScript = *iterScript; |
1425 |
|
rowScript[m_ScriptsModel.m_col_name] = gig_to_utf8(script->Name); |
1426 |
|
rowScript[m_ScriptsModel.m_col_script] = script; |
1427 |
|
rowScript[m_ScriptsModel.m_col_group] = NULL; |
1428 |
|
} |
1429 |
|
} |
1430 |
|
// unfold all script groups by default |
1431 |
|
m_TreeViewScripts.expand_all(); |
1432 |
|
|
1433 |
file = gig; |
file = gig; |
1434 |
|
|
1497 |
} |
} |
1498 |
} |
} |
1499 |
|
|
1500 |
|
void MainWindow::show_script_slots() { |
1501 |
|
if (!file) return; |
1502 |
|
// get selected instrument |
1503 |
|
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
1504 |
|
Gtk::TreeModel::iterator it = sel->get_selected(); |
1505 |
|
if (!it) return; |
1506 |
|
Gtk::TreeModel::Row row = *it; |
1507 |
|
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
1508 |
|
if (!instrument) return; |
1509 |
|
|
1510 |
|
ScriptSlots* window = new ScriptSlots; |
1511 |
|
window->setInstrument(instrument); |
1512 |
|
//window->reparent(*this); |
1513 |
|
window->show(); |
1514 |
|
} |
1515 |
|
|
1516 |
void MainWindow::on_action_view_status_bar() { |
void MainWindow::on_action_view_status_bar() { |
1517 |
Gtk::CheckMenuItem* item = |
Gtk::CheckMenuItem* item = |
1518 |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
1609 |
} |
} |
1610 |
} |
} |
1611 |
|
|
1612 |
|
void MainWindow::on_script_treeview_button_release(GdkEventButton* button) { |
1613 |
|
if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
1614 |
|
Gtk::Menu* script_popup = |
1615 |
|
dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/ScriptPopupMenu")); |
1616 |
|
// update enabled/disabled state of sample popup items |
1617 |
|
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection(); |
1618 |
|
Gtk::TreeModel::iterator it = sel->get_selected(); |
1619 |
|
bool group_selected = false; |
1620 |
|
bool script_selected = false; |
1621 |
|
if (it) { |
1622 |
|
Gtk::TreeModel::Row row = *it; |
1623 |
|
group_selected = row[m_ScriptsModel.m_col_group]; |
1624 |
|
script_selected = row[m_ScriptsModel.m_col_script]; |
1625 |
|
} |
1626 |
|
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/AddScript"))-> |
1627 |
|
set_sensitive(group_selected || script_selected); |
1628 |
|
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/AddScriptGroup"))-> |
1629 |
|
set_sensitive(file); |
1630 |
|
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/EditScript"))-> |
1631 |
|
set_sensitive(script_selected); |
1632 |
|
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/RemoveScript"))-> |
1633 |
|
set_sensitive(group_selected || script_selected); |
1634 |
|
// show sample popup |
1635 |
|
script_popup->popup(button->button, button->time); |
1636 |
|
} |
1637 |
|
} |
1638 |
|
|
1639 |
Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu( |
Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu( |
1640 |
const Glib::ustring& name, int position) { |
const Glib::ustring& name, int position) { |
1782 |
msg.run(); |
msg.run(); |
1783 |
} |
} |
1784 |
|
|
1785 |
|
void MainWindow::on_action_add_script_group() { |
1786 |
|
static int __script_indexer = 0; |
1787 |
|
if (!file) return; |
1788 |
|
gig::ScriptGroup* group = file->AddScriptGroup(); |
1789 |
|
group->Name = gig_from_utf8(_("Unnamed Group")); |
1790 |
|
if (__script_indexer) group->Name += " " + ToString(__script_indexer); |
1791 |
|
__script_indexer++; |
1792 |
|
// update sample tree view |
1793 |
|
Gtk::TreeModel::iterator iterGroup = m_refScriptsTreeModel->append(); |
1794 |
|
Gtk::TreeModel::Row rowGroup = *iterGroup; |
1795 |
|
rowGroup[m_ScriptsModel.m_col_name] = gig_to_utf8(group->Name); |
1796 |
|
rowGroup[m_ScriptsModel.m_col_script] = NULL; |
1797 |
|
rowGroup[m_ScriptsModel.m_col_group] = group; |
1798 |
|
file_changed(); |
1799 |
|
} |
1800 |
|
|
1801 |
|
void MainWindow::on_action_add_script() { |
1802 |
|
if (!file) return; |
1803 |
|
// get selected group |
1804 |
|
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection(); |
1805 |
|
Gtk::TreeModel::iterator it = sel->get_selected(); |
1806 |
|
if (!it) return; |
1807 |
|
Gtk::TreeModel::Row row = *it; |
1808 |
|
gig::ScriptGroup* group = row[m_ScriptsModel.m_col_group]; |
1809 |
|
if (!group) { // not a group, but a script is selected (probably) |
1810 |
|
gig::Script* script = row[m_ScriptsModel.m_col_script]; |
1811 |
|
if (!script) return; |
1812 |
|
it = row.parent(); // resolve parent (that is the script's group) |
1813 |
|
if (!it) return; |
1814 |
|
row = *it; |
1815 |
|
group = row[m_ScriptsModel.m_col_group]; |
1816 |
|
if (!group) return; |
1817 |
|
} |
1818 |
|
|
1819 |
|
// add a new script to the .gig file |
1820 |
|
gig::Script* script = group->AddScript(); |
1821 |
|
Glib::ustring name = _("Unnamed Script"); |
1822 |
|
script->Name = gig_from_utf8(name); |
1823 |
|
|
1824 |
|
// add script to the tree view |
1825 |
|
Gtk::TreeModel::iterator iterScript = |
1826 |
|
m_refScriptsTreeModel->append(row.children()); |
1827 |
|
Gtk::TreeModel::Row rowScript = *iterScript; |
1828 |
|
rowScript[m_ScriptsModel.m_col_name] = name; |
1829 |
|
rowScript[m_ScriptsModel.m_col_script] = script; |
1830 |
|
rowScript[m_ScriptsModel.m_col_group] = NULL; |
1831 |
|
|
1832 |
|
// unfold group of new script item in treeview |
1833 |
|
Gtk::TreeModel::Path path(iterScript); |
1834 |
|
m_TreeViewScripts.expand_to_path(path); |
1835 |
|
} |
1836 |
|
|
1837 |
|
void MainWindow::on_action_edit_script() { |
1838 |
|
if (!file) return; |
1839 |
|
// get selected script |
1840 |
|
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection(); |
1841 |
|
Gtk::TreeModel::iterator it = sel->get_selected(); |
1842 |
|
if (!it) return; |
1843 |
|
Gtk::TreeModel::Row row = *it; |
1844 |
|
gig::Script* script = row[m_ScriptsModel.m_col_script]; |
1845 |
|
if (!script) return; |
1846 |
|
|
1847 |
|
ScriptEditor* editor = new ScriptEditor; |
1848 |
|
editor->setScript(script); |
1849 |
|
//editor->reparent(*this); |
1850 |
|
editor->show(); |
1851 |
|
} |
1852 |
|
|
1853 |
|
void MainWindow::on_action_remove_script() { |
1854 |
|
if (!file) return; |
1855 |
|
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection(); |
1856 |
|
Gtk::TreeModel::iterator it = sel->get_selected(); |
1857 |
|
if (it) { |
1858 |
|
Gtk::TreeModel::Row row = *it; |
1859 |
|
gig::ScriptGroup* group = row[m_ScriptsModel.m_col_group]; |
1860 |
|
gig::Script* script = row[m_ScriptsModel.m_col_script]; |
1861 |
|
Glib::ustring name = row[m_ScriptsModel.m_col_name]; |
1862 |
|
try { |
1863 |
|
// remove script group or script from the gig file |
1864 |
|
if (group) { |
1865 |
|
// notify everybody that we're going to remove these samples |
1866 |
|
//TODO: scripts_to_be_removed_signal.emit(members); |
1867 |
|
// delete the group in the .gig file including the |
1868 |
|
// samples that belong to the group |
1869 |
|
file->DeleteScriptGroup(group); |
1870 |
|
// notify that we're done with removal |
1871 |
|
//TODO: scripts_removed_signal.emit(); |
1872 |
|
file_changed(); |
1873 |
|
} else if (script) { |
1874 |
|
// notify everybody that we're going to remove this sample |
1875 |
|
//TODO: std::list<gig::Script*> lscripts; |
1876 |
|
//TODO: lscripts.push_back(script); |
1877 |
|
//TODO: scripts_to_be_removed_signal.emit(lscripts); |
1878 |
|
// remove sample from the .gig file |
1879 |
|
script->GetGroup()->DeleteScript(script); |
1880 |
|
// notify that we're done with removal |
1881 |
|
//TODO: scripts_removed_signal.emit(); |
1882 |
|
dimreg_changed(); |
1883 |
|
file_changed(); |
1884 |
|
} |
1885 |
|
// remove respective row(s) from samples tree view |
1886 |
|
m_refScriptsTreeModel->erase(it); |
1887 |
|
} catch (RIFF::Exception e) { |
1888 |
|
// pretend we're done with removal (i.e. to avoid dead locks) |
1889 |
|
//TODO: scripts_removed_signal.emit(); |
1890 |
|
// show error message |
1891 |
|
Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR); |
1892 |
|
msg.run(); |
1893 |
|
} |
1894 |
|
} |
1895 |
|
} |
1896 |
|
|
1897 |
void MainWindow::on_action_add_group() { |
void MainWindow::on_action_add_group() { |
1898 |
static int __sample_indexer = 0; |
static int __sample_indexer = 0; |
1899 |
if (!file) return; |
if (!file) return; |
2263 |
} |
} |
2264 |
} |
} |
2265 |
|
|
2266 |
|
// see comment on on_sample_treeview_drag_begin() |
2267 |
|
void MainWindow::on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context) |
2268 |
|
{ |
2269 |
|
first_call_to_drag_data_get = true; |
2270 |
|
} |
2271 |
|
|
2272 |
|
void MainWindow::on_scripts_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
2273 |
|
Gtk::SelectionData& selection_data, guint, guint) |
2274 |
|
{ |
2275 |
|
if (!first_call_to_drag_data_get) return; |
2276 |
|
first_call_to_drag_data_get = false; |
2277 |
|
|
2278 |
|
// get selected script |
2279 |
|
gig::Script* script = NULL; |
2280 |
|
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection(); |
2281 |
|
Gtk::TreeModel::iterator it = sel->get_selected(); |
2282 |
|
if (it) { |
2283 |
|
Gtk::TreeModel::Row row = *it; |
2284 |
|
script = row[m_ScriptsModel.m_col_script]; |
2285 |
|
} |
2286 |
|
// pass the gig::Script as pointer |
2287 |
|
selection_data.set(selection_data.get_target(), 0/*unused*/, |
2288 |
|
(const guchar*)&script, |
2289 |
|
sizeof(script)/*length of data in bytes*/); |
2290 |
|
} |
2291 |
|
|
2292 |
// For some reason drag_data_get gets called two times for each |
// For some reason drag_data_get gets called two times for each |
2293 |
// drag'n'drop (at least when target is an Entry). This work-around |
// drag'n'drop (at least when target is an Entry). This work-around |
2294 |
// makes sure the code in drag_data_get and drop_drag_data_received is |
// makes sure the code in drag_data_get and drop_drag_data_received is |
2415 |
file_changed(); |
file_changed(); |
2416 |
} |
} |
2417 |
} |
} |
2418 |
|
} |
2419 |
|
|
2420 |
|
void MainWindow::script_name_changed(const Gtk::TreeModel::Path& path, |
2421 |
|
const Gtk::TreeModel::iterator& iter) { |
2422 |
|
if (!iter) return; |
2423 |
|
Gtk::TreeModel::Row row = *iter; |
2424 |
|
Glib::ustring name = row[m_ScriptsModel.m_col_name]; |
2425 |
|
gig::ScriptGroup* group = row[m_ScriptsModel.m_col_group]; |
2426 |
|
gig::Script* script = row[m_ScriptsModel.m_col_script]; |
2427 |
|
gig::String gigname(gig_from_utf8(name)); |
2428 |
|
if (group) { |
2429 |
|
if (group->Name != gigname) { |
2430 |
|
group->Name = gigname; |
2431 |
|
printf("script group name changed\n"); |
2432 |
|
file_changed(); |
2433 |
|
} |
2434 |
|
} else if (script) { |
2435 |
|
if (script->Name != gigname) { |
2436 |
|
script->Name = gigname; |
2437 |
|
printf("script name changed\n"); |
2438 |
|
file_changed(); |
2439 |
|
} |
2440 |
|
} |
2441 |
} |
} |
2442 |
|
|
2443 |
void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path, |
void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path, |