1356 |
m_TreeView.set_model(m_refTreeModelFilter); |
m_TreeView.set_model(m_refTreeModelFilter); |
1357 |
|
|
1358 |
m_TreeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE); |
m_TreeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE); |
1359 |
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_has_tooltip(true); |
1360 |
|
m_TreeView.signal_query_tooltip().connect( |
1361 |
|
sigc::mem_fun(*this, &MainWindow::onQueryTreeViewTooltip) |
1362 |
|
); |
1363 |
instrument_name_connection = m_refTreeModel->signal_row_changed().connect( |
instrument_name_connection = m_refTreeModel->signal_row_changed().connect( |
1364 |
sigc::mem_fun(*this, &MainWindow::instrument_name_changed) |
sigc::mem_fun(*this, &MainWindow::instrument_name_changed) |
1365 |
); |
); |
2639 |
dimreg_all_regions.set_has_tooltip(b); |
dimreg_all_regions.set_has_tooltip(b); |
2640 |
dimreg_all_dimregs.set_has_tooltip(b); |
dimreg_all_dimregs.set_has_tooltip(b); |
2641 |
dimreg_stereo.set_has_tooltip(b); |
dimreg_stereo.set_has_tooltip(b); |
2642 |
m_TreeView.set_has_tooltip(b); |
|
2643 |
|
// Not doing this here, we let onQueryTreeViewTooltip() handle this per cell |
2644 |
|
//m_TreeView.set_has_tooltip(b); |
2645 |
|
|
2646 |
m_TreeViewSamples.set_has_tooltip(b); |
m_TreeViewSamples.set_has_tooltip(b); |
2647 |
m_TreeViewScripts.set_has_tooltip(b); |
m_TreeViewScripts.set_has_tooltip(b); |
2648 |
|
|
2994 |
} |
} |
2995 |
} |
} |
2996 |
|
|
2997 |
|
bool MainWindow::onQueryTreeViewTooltip(int x, int y, bool keyboardTip, const Glib::RefPtr<Gtk::Tooltip>& tooltip) { |
2998 |
|
Gtk::TreeModel::iterator iter; |
2999 |
|
m_TreeView.get_tooltip_context_iter(x, y, keyboardTip, iter); |
3000 |
|
Gtk::TreeModel::Path path(iter); |
3001 |
|
Gtk::TreeModel::Row row = *iter; |
3002 |
|
Gtk::TreeViewColumn* pointedColumn = NULL; |
3003 |
|
// resolve the precise table column the mouse points to |
3004 |
|
{ |
3005 |
|
Gtk::TreeModel::Path path; // unused |
3006 |
|
int cellX, cellY; // unused |
3007 |
|
m_TreeView.get_path_at_pos(x, y, path, pointedColumn, cellX, cellY); |
3008 |
|
} |
3009 |
|
Gtk::TreeViewColumn* scriptsColumn = m_TreeView.get_column(2); |
3010 |
|
if (pointedColumn == scriptsColumn) { // mouse hovers scripts column ... |
3011 |
|
// show the script(s) assigned to the hovered instrument as tooltip |
3012 |
|
tooltip->set_markup( row[m_Columns.m_col_tooltip] ); |
3013 |
|
m_TreeView.set_tooltip_cell(tooltip, &path, scriptsColumn, NULL); |
3014 |
|
} else { |
3015 |
|
// if beginners' tooltips is disabled then don't show the following one |
3016 |
|
if (!Settings::singleton()->showTooltips) |
3017 |
|
return false; |
3018 |
|
// yeah, a beginners tooltip |
3019 |
|
tooltip->set_text(_( |
3020 |
|
"Right click here for actions on instruments & MIDI Rules. " |
3021 |
|
"Drag & drop to change the order of instruments." |
3022 |
|
)); |
3023 |
|
m_TreeView.set_tooltip_cell(tooltip, &path, pointedColumn, NULL); |
3024 |
|
} |
3025 |
|
return true; |
3026 |
|
} |
3027 |
|
|
3028 |
|
static Glib::ustring scriptTooltipFor(gig::Instrument* instrument, int index) { |
3029 |
|
Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); |
3030 |
|
const int iScriptSlots = instrument->ScriptSlotCount(); |
3031 |
|
Glib::ustring tooltip = "<u>(" + ToString(index) + ") „" + name + "”</u>\n\n"; |
3032 |
|
if (!iScriptSlots) |
3033 |
|
tooltip += "<span foreground='red'><i>No script assigned</i></span>"; |
3034 |
|
else { |
3035 |
|
for (int i = 0; i < iScriptSlots; ++i) { |
3036 |
|
tooltip += "• " + ToString(i+1) + ". Script: „<span foreground='#46DEFF'><b>" + |
3037 |
|
instrument->GetScriptOfSlot(i)->Name + "</b></span>”"; |
3038 |
|
if (i + 1 < iScriptSlots) tooltip += "\n\n"; |
3039 |
|
} |
3040 |
|
} |
3041 |
|
return tooltip; |
3042 |
|
} |
3043 |
|
|
3044 |
void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument) |
void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument) |
3045 |
{ |
{ |
3046 |
file = 0; |
file = 0; |
3070 |
row[m_Columns.m_col_name] = name; |
row[m_Columns.m_col_name] = name; |
3071 |
row[m_Columns.m_col_instr] = instrument; |
row[m_Columns.m_col_instr] = instrument; |
3072 |
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
3073 |
|
row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index); |
3074 |
|
|
3075 |
#if !USE_GTKMM_BUILDER |
#if !USE_GTKMM_BUILDER |
3076 |
add_instrument_to_menu(name); |
add_instrument_to_menu(name); |
3188 |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
3189 |
Glib::ustring gigname(gig_to_utf8(instrument->pInfo->Name)); |
Glib::ustring gigname(gig_to_utf8(instrument->pInfo->Name)); |
3190 |
if (gigname != name) { |
if (gigname != name) { |
3191 |
|
Gtk::TreeModel::Path path(*it); |
3192 |
|
const int index = path[0]; |
3193 |
row[m_Columns.m_col_name] = gigname; |
row[m_Columns.m_col_name] = gigname; |
3194 |
|
row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index); |
3195 |
} |
} |
3196 |
} |
} |
3197 |
|
|
3237 |
Gtk::TreeModel::Row row = model->children()[i]; |
Gtk::TreeModel::Row row = model->children()[i]; |
3238 |
if (row[m_Columns.m_col_instr] != pInstrument) continue; |
if (row[m_Columns.m_col_instr] != pInstrument) continue; |
3239 |
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
3240 |
|
row[m_Columns.m_col_tooltip] = scriptTooltipFor(pInstrument, i); |
3241 |
break; |
break; |
3242 |
} |
} |
3243 |
|
|
3751 |
instrument_name_connection.block(); |
instrument_name_connection.block(); |
3752 |
Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append(); |
Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append(); |
3753 |
Gtk::TreeModel::Row rowInstr = *iterInstr; |
Gtk::TreeModel::Row rowInstr = *iterInstr; |
3754 |
rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1; |
const int index = m_refTreeModel->children().size() - 1; |
3755 |
|
rowInstr[m_Columns.m_col_nr] = index; |
3756 |
rowInstr[m_Columns.m_col_name] = name; |
rowInstr[m_Columns.m_col_name] = name; |
3757 |
rowInstr[m_Columns.m_col_instr] = instrument; |
rowInstr[m_Columns.m_col_instr] = instrument; |
3758 |
rowInstr[m_Columns.m_col_scripts] = ""; |
rowInstr[m_Columns.m_col_scripts] = ""; |
3759 |
|
rowInstr[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index); |
3760 |
instrument_name_connection.unblock(); |
instrument_name_connection.unblock(); |
3761 |
|
|
3762 |
#if !USE_GTKMM_BUILDER |
#if !USE_GTKMM_BUILDER |
3843 |
it != m_refTreeModel->children().end(); ++it, ++index) |
it != m_refTreeModel->children().end(); ++it, ++index) |
3844 |
{ |
{ |
3845 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
3846 |
|
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
3847 |
row[m_Columns.m_col_nr] = index; |
row[m_Columns.m_col_nr] = index; |
3848 |
|
row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index); |
3849 |
} |
} |
3850 |
} |
} |
3851 |
|
|