105 |
( |
( |
106 |
sigc::mem_fun(*this, &ScriptPatchVars::onTreeViewKeyRelease) |
sigc::mem_fun(*this, &ScriptPatchVars::onTreeViewKeyRelease) |
107 |
); |
); |
|
// Gtk "row-activated" signal (Gtkmm's signal_row_activated) is only fired |
|
|
// if this single click property is set to true |
|
108 |
//m_treeView.set_activate_on_single_click(true); |
//m_treeView.set_activate_on_single_click(true); |
109 |
m_treeView.signal_row_activated().connect( |
m_treeView.signal_row_activated().connect( |
110 |
[this](const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column){ |
[this](const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column) { |
111 |
printf("row activated !!!!\n"); |
// open script source code editor for double clicked script title row |
112 |
//m_editing = true; // so we can detect while user is editing some value |
Gtk::TreeModel::iterator iter = m_treeStore->get_iter(path); |
113 |
|
Gtk::TreeModel::Row row = *iter; |
114 |
|
gig::Script* script = row[m_treeModel.m_col_script]; |
115 |
|
if (!script || row[m_treeModel.m_col_value] != "✎") return; |
116 |
|
signal_edit_script.emit(script); |
117 |
} |
} |
118 |
); |
); |
119 |
m_treeView.set_has_tooltip(true); |
m_treeView.set_has_tooltip(true); |
268 |
row[m_treeModel.m_col_name] = pScript->Name + " <sup>Slot " + ToString(iScriptSlot+1) + "</sup>"; |
row[m_treeModel.m_col_name] = pScript->Name + " <sup>Slot " + ToString(iScriptSlot+1) + "</sup>"; |
269 |
row[m_treeModel.m_col_name_weight] = PANGO_WEIGHT_BOLD; |
row[m_treeModel.m_col_name_weight] = PANGO_WEIGHT_BOLD; |
270 |
row[m_treeModel.m_col_type] = "Script"; |
row[m_treeModel.m_col_type] = "Script"; |
271 |
row[m_treeModel.m_col_value] = ""; |
row[m_treeModel.m_col_value] = "✎"; // make user visually aware that he might access script's source code here |
272 |
row[m_treeModel.m_col_slot] = -1; |
row[m_treeModel.m_col_slot] = -1; |
273 |
row[m_treeModel.m_col_allowTextEntry] = false; |
row[m_treeModel.m_col_allowTextEntry] = false; |
274 |
row[m_treeModel.m_col_editable] = false; |
row[m_treeModel.m_col_editable] = false; |
275 |
row[m_treeModel.m_col_script] = NULL; |
row[m_treeModel.m_col_script] = pScript; |
276 |
row[m_treeModel.m_col_value_tooltip] = ""; |
row[m_treeModel.m_col_value_tooltip] = _("Double click or hit ⏎ to open script code editor."); |
277 |
|
|
278 |
std::map<std::string,PatchVar> vars = getPatchVars(m_instrument, iScriptSlot); |
std::map<std::string,PatchVar> vars = getPatchVars(m_instrument, iScriptSlot); |
279 |
for (const auto& var : vars) { |
for (const auto& var : vars) { |
327 |
m_treeView.get_path_at_pos(x, y, path, pointedColumn, cellX, cellY); |
m_treeView.get_path_at_pos(x, y, path, pointedColumn, cellX, cellY); |
328 |
} |
} |
329 |
Gtk::TreeViewColumn* valueColumn = m_treeView.get_column(2); |
Gtk::TreeViewColumn* valueColumn = m_treeView.get_column(2); |
330 |
if (pointedColumn == valueColumn) { // mouse hovers value column ... |
if (pointedColumn == valueColumn || row[m_treeModel.m_col_value] == "✎") { // mouse hovers value column or on any "Script" meta row's columns... |
331 |
const Glib::ustring tip = row[m_treeModel.m_col_value_tooltip]; |
const Glib::ustring tip = row[m_treeModel.m_col_value_tooltip]; |
332 |
if (tip.empty()) return false; // don't show tooltip |
if (tip.empty()) return false; // don't show tooltip |
333 |
// show model / cell's assigned tooltip |
// show model / cell's assigned tooltip |
334 |
tooltip->set_markup(tip); |
tooltip->set_markup(tip); |
335 |
m_treeView.set_tooltip_cell(tooltip, &path, valueColumn, NULL); |
m_treeView.set_tooltip_cell(tooltip, &path, pointedColumn, NULL); |
336 |
return true; // show tooltip |
return true; // show tooltip |
337 |
} |
} |
338 |
return false; // don't show tooltip |
return false; // don't show tooltip |