From e0d452db27924fbef0d6d02000bb893c67879763 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 25 Nov 2011 22:01:07 +0000 Subject: Move more logging into the messages window. Make View->Messages a plain menu item. Pop up messages window on error. git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@3632 a436a847-0d15-0410-975c-d299462d15a1 --- src/Patchage.cpp | 27 ++++++++------------------- src/Patchage.hpp | 3 +-- src/PatchageCanvas.cpp | 9 ++++++--- src/patchage.ui | 7 +++---- 4 files changed, 18 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/Patchage.cpp b/src/Patchage.cpp index 706b1d2..0b77244 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -175,7 +175,7 @@ Patchage::Patchage(int argc, char** argv) sigc::mem_fun(this, &Patchage::refresh)); _menu_view_arrange->signal_activate().connect( sigc::mem_fun(this, &Patchage::on_arrange)); - _menu_view_messages->signal_toggled().connect( + _menu_view_messages->signal_activate().connect( sigc::mem_fun(this, &Patchage::on_show_messages)); _menu_help_about->signal_activate().connect( sigc::mem_fun(this, &Patchage::on_help_about)); @@ -190,8 +190,6 @@ Patchage::Patchage(int argc, char** argv) 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)); _error_tag = Gtk::TextTag::create(); _error_tag->property_foreground() = "#FF0000"; @@ -373,6 +371,7 @@ Patchage::error_msg(const std::string& msg) Glib::RefPtr buffer = _status_text->get_buffer(); buffer->insert_with_tag(buffer->end(), msg + "\n", _error_tag); _status_text->scroll_to_mark(buffer->get_insert(), 0); + _messages_win->present(); } void @@ -453,14 +452,14 @@ Patchage::show_open_session_dialog() const std::string dir = dialog.get_filename(); if (g_chdir(dir.c_str())) { - Raul::error << "Failed to switch to session directory " << dir << endl; + error_msg("Failed to switch to session directory " + dir); return; } if (system("./jack-session") < 0) { - Raul::error << "Error executing `./jack-session' in " << dir << endl; + error_msg("Error executing `./jack-session' in " + dir); } else { - Raul::info << "Loaded session " << dir << endl; + info_msg("Loaded session " + dir); } } @@ -480,7 +479,7 @@ Patchage::save_session(bool close) std::string path = dialog.get_filename(); if (g_mkdir_with_parents(path.c_str(), 0740)) { - Raul::error << "Failed to create session directory " << path << endl; + error_msg("Failed to create session directory " + path); return; } @@ -601,14 +600,7 @@ Patchage::on_messages_clear() void Patchage::on_messages_close() { - _menu_view_messages->set_active(false); -} - -bool -Patchage::on_messages_delete(GdkEventAny*) -{ - _menu_view_messages->set_active(false); - return true; + _messages_win->hide(); } void @@ -627,10 +619,7 @@ Patchage::on_quit() void Patchage::on_show_messages() { - if (_menu_view_messages->get_active()) - _messages_win->present(); - else - _messages_win->hide(); + _messages_win->present(); } void diff --git a/src/Patchage.hpp b/src/Patchage.hpp index 8ff3ff5..0027b2c 100644 --- a/src/Patchage.hpp +++ b/src/Patchage.hpp @@ -90,7 +90,6 @@ protected: 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(); @@ -141,7 +140,7 @@ protected: Widget _menu_save_close_session; Widget _menu_store_positions; Widget _menu_view_arrange; - Widget _menu_view_messages; + Widget _menu_view_messages; Widget _menu_view_refresh; Widget _menu_zoom_in; Widget _menu_zoom_out; diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp index 148466e..070ef8c 100644 --- a/src/PatchageCanvas.cpp +++ b/src/PatchageCanvas.cpp @@ -14,11 +14,12 @@ * along with Patchage. If not, see . */ -#include "patchage-config.h" +#include -#include "raul/log.hpp" #include "raul/SharedPtr.hpp" +#include "patchage-config.h" + #if defined(HAVE_JACK_DBUS) #include "JackDbusDriver.hpp" #elif defined(PATCHAGE_LIBJACK) @@ -34,6 +35,7 @@ #include "PatchagePort.hpp" using std::string; +using boost::format; PatchageCanvas::PatchageCanvas(Patchage* app, int width, int height) : FlowCanvas::Canvas(width, height) @@ -113,7 +115,8 @@ PatchageCanvas::remove_port(const PortID& id) { PatchagePort* const port = find_port(id); if (!port) { - Raul::error << "Failed to find port " << id << " to remove" << std::endl; + _app->error_msg((format("Failed to find port with ID `%1' to remove.") + % id).str()); } _port_index.erase(id); diff --git a/src/patchage.ui b/src/patchage.ui index 68aed08..d34bcd3 100644 --- a/src/patchage.ui +++ b/src/patchage.ui @@ -874,14 +874,13 @@ Nedko Arnaudov <nedko@arnaudov.name> False - + False True False - _Messages + _Messages... True - @@ -898,8 +897,8 @@ Nedko Arnaudov <nedko@arnaudov.name> False True True - + -- cgit v1.2.1