diff options
author | David Robillard <d@drobilla.net> | 2008-01-05 22:50:01 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-01-05 22:50:01 +0000 |
commit | 22c1636d4f6204f62d2144bd796091dfd879b831 (patch) | |
tree | 24c2b4072c28183745adf981bf18822d195e548a | |
parent | 3581b6a2b1b5d95ea5a79bd3273e694ebef6137b (diff) | |
download | patchage-22c1636d4f6204f62d2144bd796091dfd879b831.tar.gz patchage-22c1636d4f6204f62d2144bd796091dfd879b831.tar.bz2 patchage-22c1636d4f6204f62d2144bd796091dfd879b831.zip |
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
-rw-r--r-- | src/Patchage.cpp | 118 | ||||
-rw-r--r-- | src/Patchage.hpp | 16 | ||||
-rw-r--r-- | src/patchage.glade | 143 |
3 files changed, 132 insertions, 145 deletions
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<int>(_state_manager->get_window_location().x), static_cast<int>(_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; } diff --git a/src/Patchage.hpp b/src/Patchage.hpp index 30ba925..811a05f 100644 --- a/src/Patchage.hpp +++ b/src/Patchage.hpp @@ -61,16 +61,14 @@ public: void update_state(); void store_window_location(); - int max_pane_position() { - return _main_paned->property_max_position() - - _messages_expander->get_label_widget()->get_height() - 10; - } - protected: void connect_widgets(); void on_arrange(); void on_help_about(); + void on_messages_clear(); + void on_messages_close(); + bool on_messages_delete(GdkEventAny*); void on_quit(); void on_show_messages(); void on_store_positions(); @@ -83,9 +81,6 @@ protected: void buffer_size_changed(); - void on_pane_position_changed(); - void on_messages_expander_changed(); - Glib::RefPtr<Gnome::Glade::Xml> xml; #ifdef HAVE_LASH @@ -131,7 +126,6 @@ protected: Widget<Gtk::AboutDialog> _about_win; Widget<Gtk::ComboBox> _buffer_size_combo; Widget<Gtk::ToolButton> _clear_load_but; - Widget<Gtk::Paned> _main_paned; Widget<Gtk::ScrolledWindow> _main_scrolledwin; Widget<Gtk::Window> _main_win; Widget<Gtk::ProgressBar> _main_xrun_progress; @@ -145,7 +139,9 @@ protected: Widget<Gtk::CheckMenuItem> _menu_view_messages; Widget<Gtk::MenuItem> _menu_view_refresh; Widget<Gtk::CheckMenuItem> _menu_view_toolbar; - Widget<Gtk::Expander> _messages_expander; + Widget<Gtk::Dialog> _messages_win; + Widget<Gtk::Button> _messages_clear_but; + Widget<Gtk::Button> _messages_close_but; Widget<Gtk::Button> _play_but; Widget<Gtk::Button> _rewind_but; Widget<Gtk::Label> _sample_rate_label; diff --git a/src/patchage.glade b/src/patchage.glade index 0c50d59..ae388f9 100644 --- a/src/patchage.glade +++ b/src/patchage.glade @@ -689,68 +689,20 @@ The bar represents the maximum processing delay as a fraction of the time availa </packing> </child> <child> - <widget class="GtkVPaned" id="main_paned"> + <widget class="GtkScrolledWindow" id="main_scrolledwin"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="has_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> <child> - <widget class="GtkScrolledWindow" id="main_scrolledwin"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="resize">True</property> - <property name="shrink">False</property> - </packing> - </child> - <child> - <widget class="GtkExpander" id="messages_expander"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <child> - <widget class="GtkTextView" id="status_text"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> - <property name="wrap_mode">GTK_WRAP_WORD</property> - <property name="accepts_tab">False</property> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes">Messages</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="resize">True</property> - <property name="shrink">True</property> - </packing> + <placeholder/> </child> </widget> <packing> - <property name="padding">2</property> <property name="position">3</property> </packing> </child> @@ -908,4 +860,83 @@ along with Patchage; if not, write to the Free Software Foundation, Inc., </widget> </child> </widget> + <widget class="GtkDialog" id="messages_win"> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Patchage - Messages</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> + <property name="icon">patchage.svg</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="has_separator">False</property> + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox3"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">2</property> + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <child> + <widget class="GtkTextView" id="status_text"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="wrap_mode">GTK_WRAP_WORD</property> + <property name="cursor_visible">False</property> + <property name="accepts_tab">False</property> + </widget> + </child> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area3"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + <child> + <widget class="GtkButton" id="messages_clear_but"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">gtk-clear</property> + <property name="use_stock">True</property> + <property name="response_id">0</property> + </widget> + </child> + <child> + <widget class="GtkButton" id="messages_close_but"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">gtk-close</property> + <property name="use_stock">True</property> + <property name="response_id">0</property> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + </child> + </widget> </glade-interface> |