gui: Reactivate the "slash" keyboard shortcut
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
697c07e2df
commit
6ecb8f6b7f
61
gui/tabs.cpp
61
gui/tabs.cpp
|
@ -85,6 +85,11 @@ void Tab :: tab_unmap()
|
|||
queue_mapping.erase(tab_pq);
|
||||
}
|
||||
|
||||
void Tab :: tab_focus_search()
|
||||
{
|
||||
tab_search->grab_focus();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -170,7 +175,7 @@ void Tab :: on_entry_changed()
|
|||
* Global functions
|
||||
*/
|
||||
|
||||
Tab *find_tab(Playqueue *pq)
|
||||
static Tab *find_tab(Playqueue *pq)
|
||||
{
|
||||
std::map<Playqueue *, Tab *>::iterator it;
|
||||
it = queue_mapping.find(pq);
|
||||
|
@ -179,38 +184,52 @@ Tab *find_tab(Playqueue *pq)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void on_track_added(Playqueue *pq, unsigned int row)
|
||||
static Tab *find_tab(int num)
|
||||
{
|
||||
std::map<Playqueue *, Tab *>::iterator it;
|
||||
for (it = queue_mapping.begin(); it != queue_mapping.end(); it++) {
|
||||
if (it->second->tab_page_num() == num)
|
||||
return it->second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void on_track_added(Playqueue *pq, unsigned int row)
|
||||
{
|
||||
Tab *tab = find_tab(pq);
|
||||
if (tab)
|
||||
tab->on_track_added(row);
|
||||
}
|
||||
|
||||
void on_track_deleted(Playqueue *pq, unsigned int row)
|
||||
static void on_track_deleted(Playqueue *pq, unsigned int row)
|
||||
{
|
||||
Tab *tab = find_tab(pq);
|
||||
if (tab)
|
||||
tab->on_track_deleted(row);
|
||||
}
|
||||
|
||||
void on_track_changed(Playqueue *pq, unsigned int row)
|
||||
static void on_track_changed(Playqueue *pq, unsigned int row)
|
||||
{
|
||||
Tab *tab = find_tab(pq);
|
||||
if (tab)
|
||||
tab->on_track_changed(row);
|
||||
}
|
||||
|
||||
void on_switch_page(Gtk::Widget *page, int num)
|
||||
static void on_switch_page(Gtk::Widget *page, int num)
|
||||
{
|
||||
std::map<Playqueue *, Tab *>::iterator it;
|
||||
for (it = queue_mapping.begin(); it != queue_mapping.end(); it++) {
|
||||
if (it->second->tab_page_num() == num) {
|
||||
it->second->tab_runtime_changed();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Tab *tab = find_tab(num);
|
||||
if (tab)
|
||||
tab->tab_runtime_changed();
|
||||
else
|
||||
get_widget<Gtk::Label>("o_queue_time")->set_text("");
|
||||
}
|
||||
|
||||
get_widget<Gtk::Label>("o_queue_time")->set_text("");
|
||||
void tab_focus_search()
|
||||
{
|
||||
int page = get_widget<Gtk::Notebook>("o_notebook")->get_current_page();
|
||||
Tab *tab = find_tab(page);
|
||||
if (tab)
|
||||
tab->tab_focus_search();
|
||||
}
|
||||
|
||||
void init_tabs()
|
||||
|
@ -743,10 +762,6 @@ bool OcarinaPage::on_view_button_pressed(GdkEventButton *button)
|
|||
return true;
|
||||
}
|
||||
|
||||
void OcarinaPage::on_focus_search()
|
||||
{
|
||||
page_entry.grab_focus();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
@ -829,17 +844,7 @@ static void init_menu_item(const std::string &name, unsigned int num)
|
|||
sigc::ptr_fun(on_add_to_queue), num));
|
||||
}*/
|
||||
|
||||
/*void focus_tab_search()
|
||||
{
|
||||
std::map<Playqueue *, OcarinaPage *>::iterator it;
|
||||
for (it = tab_map.begin(); it != tab_map.end(); it++) {
|
||||
if (it->second->is_current_tab()) {
|
||||
it->second->on_focus_search();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void init_tabs()
|
||||
{
|
||||
Gtk::Notebook *notebook;
|
||||
|
|
|
@ -143,8 +143,8 @@ static bool on_window_key_pressed(GdkEventKey *event)
|
|||
|
||||
if (key == "Escape")
|
||||
window->set_focus(*window);
|
||||
//else if (key == "slash")
|
||||
// focus_tab_search();
|
||||
else if (key == "slash")
|
||||
tab_focus_search();
|
||||
else if (key >= "0" && key <= "9") {
|
||||
unsigned int n = atoi(key.c_str());
|
||||
if (n < deck::size())
|
||||
|
|
|
@ -57,7 +57,6 @@ public:
|
|||
|
||||
/* tabs.cpp */
|
||||
//void queue_selected(bool);
|
||||
//void focus_tab_search();
|
||||
|
||||
|
||||
/* wires.cpp */
|
||||
|
|
|
@ -48,8 +48,9 @@ public:
|
|||
* More helper functions
|
||||
*/
|
||||
void tab_finish_init();
|
||||
int tab_page_num();
|
||||
int tab_page_num();
|
||||
void tab_runtime_changed();
|
||||
void tab_focus_search();
|
||||
|
||||
/**
|
||||
* internal callback functions
|
||||
|
@ -72,6 +73,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
void tab_focus_search();
|
||||
void init_tabs();
|
||||
void post_init_tabs();
|
||||
void cleanup_tabs();
|
||||
|
|
Loading…
Reference in New Issue