mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
foldback gui: simplify button code where possible
use signal_clicked rather than signal_button_press_event for cases where a menu is not launched.
This commit is contained in:
parent
da88e9d34c
commit
81bbc3be1e
2 changed files with 59 additions and 84 deletions
|
|
@ -447,10 +447,10 @@ FoldbackStrip::init ()
|
||||||
output_button.signal_button_release_event().connect (sigc::mem_fun(*this, &FoldbackStrip::output_release), false);
|
output_button.signal_button_release_event().connect (sigc::mem_fun(*this, &FoldbackStrip::output_release), false);
|
||||||
|
|
||||||
name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &FoldbackStrip::name_button_button_press), false);
|
name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &FoldbackStrip::name_button_button_press), false);
|
||||||
_previous_button.signal_button_press_event().connect (sigc::mem_fun (*this, &FoldbackStrip::previous_button_button_press), false);
|
_previous_button.signal_clicked.connect (sigc::mem_fun (*this, &FoldbackStrip::previous_button_clicked));
|
||||||
_next_button.signal_button_press_event().connect (sigc::mem_fun (*this, &FoldbackStrip::next_button_button_press), false);
|
_next_button.signal_clicked.connect (sigc::mem_fun (*this, &FoldbackStrip::next_button_clicked));
|
||||||
_hide_button.signal_clicked.connect (sigc::mem_fun(*this, &FoldbackStrip::hide_clicked));
|
_hide_button.signal_clicked.connect (sigc::mem_fun(*this, &FoldbackStrip::hide_clicked));
|
||||||
_show_sends_button.signal_button_press_event().connect (sigc::mem_fun(*this, &FoldbackStrip::show_sends_press), false);
|
_show_sends_button.signal_clicked.connect (sigc::mem_fun(*this, &FoldbackStrip::show_sends_clicked));
|
||||||
send_scroller.signal_button_press_event().connect (sigc::mem_fun (*this, &FoldbackStrip::send_button_press_event));
|
send_scroller.signal_button_press_event().connect (sigc::mem_fun (*this, &FoldbackStrip::send_button_press_event));
|
||||||
_comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor));
|
_comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor));
|
||||||
|
|
||||||
|
|
@ -1221,75 +1221,57 @@ FoldbackStrip::name_button_button_press (GdkEventButton* ev)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
void
|
||||||
FoldbackStrip::previous_button_button_press (GdkEventButton* ev)
|
FoldbackStrip::previous_button_clicked ()
|
||||||
{
|
{
|
||||||
if (ev->button == 1 || ev->button == 3) {
|
bool past_current = false;
|
||||||
bool past_current = false;
|
StripableList slist;
|
||||||
StripableList slist;
|
boost::shared_ptr<Route> previous = boost::shared_ptr<Route> ();
|
||||||
boost::shared_ptr<Route> previous = boost::shared_ptr<Route> ();
|
_session->get_stripables (slist, PresentationInfo::FoldbackBus);
|
||||||
boost::shared_ptr<Route> last = boost::shared_ptr<Route> ();
|
if (slist.size () > 1) {
|
||||||
_session->get_stripables (slist, PresentationInfo::FoldbackBus);
|
for (StripableList::iterator s = slist.begin(); s != slist.end(); ++s) {
|
||||||
if (slist.size () > 1) {
|
if ((*s) == _route) {
|
||||||
for (StripableList::iterator s = slist.begin(); s != slist.end(); ++s) {
|
past_current = true;
|
||||||
last = boost::dynamic_pointer_cast<Route> (*s);
|
}
|
||||||
if ((*s) == _route) {
|
if (!past_current) {
|
||||||
past_current = true;
|
previous = boost::dynamic_pointer_cast<Route> (*s);
|
||||||
}
|
|
||||||
if (!past_current) {
|
|
||||||
previous = boost::dynamic_pointer_cast<Route> (*s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// only one route do nothing
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//use previous to set route
|
} else {
|
||||||
if (previous) {
|
// only one route do nothing
|
||||||
set_route (previous);
|
return;
|
||||||
} /*else { no wrap around
|
}
|
||||||
set_route (last);
|
//use previous to set route
|
||||||
}*/
|
if (previous) {
|
||||||
return true;
|
set_route (previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
void
|
||||||
FoldbackStrip::next_button_button_press (GdkEventButton* ev)
|
FoldbackStrip::next_button_clicked ()
|
||||||
{
|
{
|
||||||
if (ev->button == 1 || ev->button == 3) {
|
bool past_current = false;
|
||||||
bool past_current = false;
|
StripableList slist;
|
||||||
StripableList slist;
|
boost::shared_ptr<Route> next = boost::shared_ptr<Route> ();
|
||||||
boost::shared_ptr<Route> next = boost::shared_ptr<Route> ();
|
_session->get_stripables (slist, PresentationInfo::FoldbackBus);
|
||||||
boost::shared_ptr<Route> first = boost::shared_ptr<Route> ();
|
if (slist.size () > 1) {
|
||||||
_session->get_stripables (slist, PresentationInfo::FoldbackBus);
|
for (StripableList::iterator s = slist.begin(); s != slist.end(); ++s) {
|
||||||
if (slist.size () > 1) {
|
if (past_current) {
|
||||||
first = boost::dynamic_pointer_cast<Route> (*(slist.begin()));
|
next = boost::dynamic_pointer_cast<Route> (*s);
|
||||||
for (StripableList::iterator s = slist.begin(); s != slist.end(); ++s) {
|
break;
|
||||||
if (past_current) {
|
}
|
||||||
next = boost::dynamic_pointer_cast<Route> (*s);
|
if ((*s) == _route) {
|
||||||
break;
|
past_current = true;
|
||||||
}
|
|
||||||
if ((*s) == _route) {
|
|
||||||
past_current = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// only one route do nothing
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//use next to set route
|
} else {
|
||||||
if (next) {
|
// only one route do nothing
|
||||||
set_route (next);
|
return;
|
||||||
} /*else { no wrap around
|
}
|
||||||
set_route (first);
|
//use next to set route
|
||||||
}*/
|
if (next) {
|
||||||
return true;
|
set_route (next);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1317,27 +1299,20 @@ FoldbackStrip::hide_clicked()
|
||||||
_hide_button.set_sensitive(true);
|
_hide_button.set_sensitive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
void
|
||||||
FoldbackStrip::show_sends_press (GdkEventButton* ev)
|
FoldbackStrip::show_sends_clicked ()
|
||||||
{
|
{
|
||||||
if (ev->button == 1 || ev->button == 3) {
|
if (_showing_sends) {
|
||||||
|
BusSendDisplayChanged (boost::shared_ptr<Route> ()); /* EMIT SIGNAL */
|
||||||
if (_showing_sends) {
|
_showing_sends = false;
|
||||||
BusSendDisplayChanged (boost::shared_ptr<Route> ()); /* EMIT SIGNAL */
|
_show_sends_button.set_active (false);
|
||||||
_showing_sends = false;
|
send_blink_connection.disconnect ();
|
||||||
_show_sends_button.set_active (false);
|
} else {
|
||||||
send_blink_connection.disconnect ();
|
BusSendDisplayChanged (_route); /* EMIT SIGNAL */
|
||||||
} else {
|
_showing_sends = true;
|
||||||
BusSendDisplayChanged (_route); /* EMIT SIGNAL */
|
_show_sends_button.set_active (true);
|
||||||
_showing_sends = true;
|
send_blink_connection = Timers::blink_connect (sigc::mem_fun (*this, &FoldbackStrip::send_blink));
|
||||||
_show_sends_button.set_active (true);
|
|
||||||
send_blink_connection = Timers::blink_connect (sigc::mem_fun (*this, &FoldbackStrip::send_blink));
|
|
||||||
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -252,10 +252,10 @@ private:
|
||||||
void build_route_select_menu ();
|
void build_route_select_menu ();
|
||||||
void list_fb_routes ();
|
void list_fb_routes ();
|
||||||
|
|
||||||
gboolean previous_button_button_press (GdkEventButton*);
|
void previous_button_clicked ();
|
||||||
gboolean next_button_button_press (GdkEventButton*);
|
void next_button_clicked ();
|
||||||
void prev_next_changed ();
|
void prev_next_changed ();
|
||||||
gboolean show_sends_press (GdkEventButton*);
|
void show_sends_clicked ();
|
||||||
void send_blink (bool);
|
void send_blink (bool);
|
||||||
|
|
||||||
Gtk::Menu *sends_menu;
|
Gtk::Menu *sends_menu;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue