Allow show/hide all spots, fixes #5270
This commit is contained in:
parent
680dd1a424
commit
e431e86fe2
@ -2131,10 +2131,13 @@ TP_LOCALLAB_ROW_VIS;Visible
|
||||
TP_LOCALLAB_ROW_NVIS;Not visible
|
||||
TP_LOCALLAB_EV_VIS;Show
|
||||
TP_LOCALLAB_EV_NVIS;Hide
|
||||
TP_LOCALLAB_EV_VIS_ALL;Show all
|
||||
TP_LOCALLAB_EV_NVIS_ALL;Hide all
|
||||
TP_LOCALLAB_REN_DIALOG_NAME;Renaming Control Spot
|
||||
TP_LOCALLAB_REN_DIALOG_LAB;Enter the new Control Spot name
|
||||
TP_LOCALLAB_EV_DUPL;Copy of
|
||||
TP_LOCALLAB_DUPLSPOTNAME;Copy
|
||||
TP_LOCALLAB_VIS_TOOLTIP;<b>Click</b> to show/hide selected Control Spot.\n<b>Ctrl</b>+<b>click</b> to show/hide all Control Spot.
|
||||
TP_LOCAL_HEIGHT;Bottom
|
||||
TP_LOCAL_HEIGHT_T;Top
|
||||
TP_LOCAL_WIDTH;Right
|
||||
|
@ -95,8 +95,9 @@ ControlSpotPanel::ControlSpotPanel():
|
||||
Gtk::HBox* const hbox2_ = Gtk::manage(new Gtk::HBox(true, 4));
|
||||
buttonrenameconn_ = button_rename_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &ControlSpotPanel::on_button_rename));
|
||||
buttonvisibilityconn_ = button_visibility_->signal_clicked().connect(
|
||||
buttonvisibilityconn_ = button_visibility_->signal_button_release_event().connect(
|
||||
sigc::mem_fun(*this, &ControlSpotPanel::on_button_visibility));
|
||||
if(showtooltip) button_visibility_->set_tooltip_markup(M("TP_LOCALLAB_VIS_TOOLTIP"));
|
||||
hbox2_->pack_start(*button_rename_);
|
||||
hbox2_->pack_start(*button_visibility_);
|
||||
pack_start(*hbox2_);
|
||||
@ -446,37 +447,70 @@ void ControlSpotPanel::on_button_rename()
|
||||
}
|
||||
}
|
||||
|
||||
void ControlSpotPanel::on_button_visibility()
|
||||
bool ControlSpotPanel::on_button_visibility(GdkEventButton* event)
|
||||
{
|
||||
// printf("on_button_visibility\n");
|
||||
|
||||
if (!listener) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get selected control spot
|
||||
const auto s = treeview_->get_selection();
|
||||
|
||||
if (!s->count_selected_rows()) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto iter = s->get_selected();
|
||||
const Gtk::TreeModel::Row row = *iter;
|
||||
|
||||
// Update visibility
|
||||
row[spots_.isvisible] = !(bool)row[spots_.isvisible];
|
||||
const int ctrl = event->state & GDK_CONTROL_MASK;
|
||||
|
||||
if (event->button == 1) { // Left click on button
|
||||
if (ctrl) { // Ctrl+click case: all spots are shown/hidden
|
||||
// Get visibility of selected spot
|
||||
const bool selVisibility = row[spots_.isvisible];
|
||||
|
||||
// Update visibility of all spot
|
||||
const Gtk::TreeModel::Children children = treemodel_->children();
|
||||
|
||||
for (auto i = children.begin(); i != children.end(); i++) {
|
||||
Gtk::TreeModel::Row r = *i;
|
||||
r[spots_.isvisible] = !selVisibility;
|
||||
updateControlSpotCurve(r);
|
||||
}
|
||||
|
||||
// Raise event
|
||||
visibilityChanged_ = true;
|
||||
|
||||
if (!selVisibility) {
|
||||
listener->panelChanged(EvLocallabSpotVisibility, M("TP_LOCALLAB_EV_VIS_ALL"));
|
||||
} else {
|
||||
listener->panelChanged(EvLocallabSpotVisibility, M("TP_LOCALLAB_EV_NVIS_ALL"));
|
||||
}
|
||||
|
||||
return true;
|
||||
} else { // Click case: only selected spot is shown/hidden
|
||||
// Update visibility for selected spot only
|
||||
row[spots_.isvisible] = !row[spots_.isvisible];
|
||||
updateControlSpotCurve(row);
|
||||
|
||||
// Raise event
|
||||
visibilityChanged_ = true;
|
||||
const int id = getSelectedSpot();
|
||||
|
||||
if ((bool)row[spots_.isvisible]) {
|
||||
if (row[spots_.isvisible]) {
|
||||
listener->panelChanged(EvLocallabSpotVisibility, M("TP_LOCALLAB_EV_VIS") + " ID#" + std::to_string(id));
|
||||
} else {
|
||||
listener->panelChanged(EvLocallabSpotVisibility, M("TP_LOCALLAB_EV_NVIS") + " ID#" + std::to_string(id));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ControlSpotPanel::blockTreeviewSearch(GdkEventKey* event)
|
||||
|
@ -239,7 +239,7 @@ private:
|
||||
void on_button_delete();
|
||||
void on_button_duplicate();
|
||||
void on_button_rename();
|
||||
void on_button_visibility();
|
||||
bool on_button_visibility(GdkEventButton* event);
|
||||
|
||||
bool blockTreeviewSearch(GdkEventKey* event);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user