From 22c1636d4f6204f62d2144bd796091dfd879b831 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 5 Jan 2008 22:50:01 +0000 Subject: Replace messages pain (which was being annoying...) with a separate window. git-svn-id: http://svn.drobilla.net/lad/patchage@1009 a436a847-0d15-0410-975c-d299462d15a1 --- src/Patchage.cpp | 118 ++++++++++++++++++------------------------------------- 1 file changed, 39 insertions(+), 79 deletions(-) (limited to 'src/Patchage.cpp') diff --git a/src/Patchage.cpp b/src/Patchage.cpp index 84d1b41..20c7cbf 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -94,14 +94,10 @@ Patchage::Patchage(int argc, char** argv) , _state_manager(NULL) , _refresh(false) , _enable_refresh(true) - , _pane_closed(false) - , _update_pane_position(true) - , _user_pane_position(0) , _jack_settings_dialog(NULL) , INIT_WIDGET(_about_win) , INIT_WIDGET(_buffer_size_combo) , INIT_WIDGET(_clear_load_but) - , INIT_WIDGET(_main_paned) , INIT_WIDGET(_main_scrolledwin) , INIT_WIDGET(_main_win) , INIT_WIDGET(_main_xrun_progress) @@ -115,7 +111,9 @@ Patchage::Patchage(int argc, char** argv) , INIT_WIDGET(_menu_view_messages) , INIT_WIDGET(_menu_view_refresh) , INIT_WIDGET(_menu_view_toolbar) - , INIT_WIDGET(_messages_expander) + , INIT_WIDGET(_messages_win) + , INIT_WIDGET(_messages_clear_but) + , INIT_WIDGET(_messages_close_but) , INIT_WIDGET(_play_but) , INIT_WIDGET(_rewind_but) , INIT_WIDGET(_sample_rate_label) @@ -213,6 +211,13 @@ Patchage::Patchage(int argc, char** argv) sigc::mem_fun(this, &Patchage::on_show_messages)); _menu_help_about->signal_activate().connect( sigc::mem_fun(this, &Patchage::on_help_about)); + + _messages_clear_but->signal_clicked().connect( + sigc::mem_fun(this, &Patchage::on_messages_clear)); + _messages_close_but->signal_clicked().connect( + sigc::mem_fun(this, &Patchage::on_messages_close)); + _messages_win->signal_delete_event().connect( + sigc::mem_fun(this, &Patchage::on_messages_delete)); connect_widgets(); update_state(); @@ -220,18 +225,6 @@ Patchage::Patchage(int argc, char** argv) _canvas->show(); _main_win->present(); - _update_pane_position = false; - _main_paned->set_position(max_pane_position()); - _user_pane_position = max_pane_position() - _main_win->get_height()/8; - _messages_expander->set_expanded(false); - _pane_closed = true; - - _main_paned->property_position().signal_changed().connect( - sigc::mem_fun(*this, &Patchage::on_pane_position_changed)); - - _messages_expander->property_expanded().signal_changed().connect( - sigc::mem_fun(*this, &Patchage::on_messages_expander_changed)); - // Idle callback, check if we need to refresh Glib::signal_timeout().connect( sigc::mem_fun(this, &Patchage::idle_callback), 100); @@ -243,8 +236,6 @@ Patchage::Patchage(int argc, char** argv) _main_win->move( static_cast(_state_manager->get_window_location().x), static_cast(_state_manager->get_window_location().y)); - - _update_pane_position = true; } @@ -430,7 +421,7 @@ Patchage::clear_load() _jack_driver->reset_delay(); } - + void Patchage::status_message(const string& msg) { @@ -587,75 +578,46 @@ Patchage::menu_alsa_disconnect() void -Patchage::on_pane_position_changed() +Patchage::on_arrange() { - if (!_update_pane_position) - return; // avoid infinite recursion ... - - _update_pane_position = false; - - int new_position = _main_paned->get_position(); - - if (_pane_closed && new_position < max_pane_position()) { - // Auto open - _user_pane_position = new_position; - _messages_expander->set_expanded(true); - _pane_closed = false; - _menu_view_messages->set_active(true); - } else if (new_position >= max_pane_position()) { - // Auto close - _pane_closed = true; - - _messages_expander->set_expanded(false); - if (new_position > max_pane_position()) - _main_paned->set_position(max_pane_position()); // ... here - _menu_view_messages->set_active(false); - - _user_pane_position = max_pane_position() - _main_win->get_height()/8; - } - - _update_pane_position = true; + assert(_canvas); + + _canvas->arrange(); } - + void -Patchage::on_messages_expander_changed() +Patchage::on_help_about() { - if (!_update_pane_position) - return; - - if (!_pane_closed) { - // Store pane position for restoring - _user_pane_position = _main_paned->get_position(); - if (_update_pane_position) { - _update_pane_position = false; - _main_paned->set_position(max_pane_position()); - _update_pane_position = true; - } - _pane_closed = true; - } else { - _main_paned->set_position(_user_pane_position); - _pane_closed = false; - } + _about_win->run(); + _about_win->hide(); } void -Patchage::on_arrange() +Patchage::on_messages_clear() { - assert(_canvas); - - _canvas->arrange(); + _status_text->get_buffer()->erase( + _status_text->get_buffer()->begin(), + _status_text->get_buffer()->end()); } void -Patchage::on_help_about() +Patchage::on_messages_close() { - _about_win->run(); - _about_win->hide(); + _menu_view_messages->set_active(false); } + +bool +Patchage::on_messages_delete(GdkEventAny*) +{ + _menu_view_messages->set_active(false); + return true; +} + + void Patchage::on_quit() { @@ -666,12 +628,14 @@ Patchage::on_quit() _main_win->hide(); } - + void Patchage::on_show_messages() { - if (_update_pane_position) - _messages_expander->set_expanded(_menu_view_messages->get_active()); + if (_menu_view_messages->get_active()) + _messages_win->present(); + else + _messages_win->hide(); } @@ -686,14 +650,10 @@ Patchage::on_store_positions() void Patchage::on_view_toolbar() { - _update_pane_position = false; - if (_menu_view_toolbar->get_active()) _toolbars_box->show(); else _toolbars_box->hide(); - - _update_pane_position = true; } -- cgit v1.2.1