diff options
-rw-r--r-- | src/client/ObjectModel.hpp | 2 | ||||
-rw-r--r-- | src/gui/PatchView.cpp | 28 | ||||
-rw-r--r-- | src/gui/PatchView.hpp | 6 | ||||
-rw-r--r-- | src/gui/PatchWindow.cpp | 40 | ||||
-rw-r--r-- | src/gui/PatchWindow.hpp | 2 |
5 files changed, 57 insertions, 21 deletions
diff --git a/src/client/ObjectModel.hpp b/src/client/ObjectModel.hpp index d4c74ee0..5f4eb11c 100644 --- a/src/client/ObjectModel.hpp +++ b/src/client/ObjectModel.hpp @@ -62,7 +62,7 @@ public: virtual ~ObjectModel(); const Atom& get_variable(const string& key) const; - Atom& get_variable( string& key); + Atom& get_variable(string& key); virtual void set_property(const string& key, const Atom& value) { ResourceImpl::set_property(key, value); diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp index 6e2ff1cd..02e6fc97 100644 --- a/src/gui/PatchView.cpp +++ b/src/gui/PatchView.cpp @@ -107,11 +107,11 @@ PatchView::set_patch(SharedPtr<PatchModel> patch) _poly_spin->signal_value_changed().connect( sigc::mem_fun(*this, &PatchView::poly_changed)); - _canvas->signal_port_entered.connect( - sigc::mem_fun(*this, &PatchView::canvas_port_entered)); - _canvas->signal_item_entered.connect( sigc::mem_fun(*this, &PatchView::canvas_item_entered)); + + _canvas->signal_item_left.connect( + sigc::mem_fun(*this, &PatchView::canvas_item_left)); _canvas->grab_focus(); } @@ -155,20 +155,32 @@ PatchView::editable_toggled() void -PatchView::canvas_port_entered(FlowCanvas::Port* port) +PatchView::canvas_item_entered(Gnome::Canvas::Item* item) { - Port* p = dynamic_cast<Port*>(port); + NodeModule* m = dynamic_cast<NodeModule*>(item); + if (m) { + signal_object_entered.emit(m->node().get()); + return; + } + + Port* p = dynamic_cast<Port*>(item); if (p) signal_object_entered.emit(p->model().get()); } void -PatchView::canvas_item_entered(FlowCanvas::Item* item) +PatchView::canvas_item_left(Gnome::Canvas::Item* item) { NodeModule* m = dynamic_cast<NodeModule*>(item); - if (m) - signal_object_entered.emit(m->node().get()); + if (m) { + signal_object_left.emit(m->node().get()); + return; + } + + Port* p = dynamic_cast<Port*>(item); + if (p) + signal_object_left.emit(p->model().get()); } diff --git a/src/gui/PatchView.hpp b/src/gui/PatchView.hpp index beb1de2f..77da6263 100644 --- a/src/gui/PatchView.hpp +++ b/src/gui/PatchView.hpp @@ -22,6 +22,7 @@ #include <gtkmm.h> #include <libglademm/xml.h> #include <libglademm.h> +#include <libgnomecanvasmm.h> #include "raul/SharedPtr.hpp" #include "raul/Atom.hpp" @@ -65,6 +66,7 @@ public: static SharedPtr<PatchView> create(SharedPtr<PatchModel> patch); sigc::signal<void, ObjectModel*> signal_object_entered; + sigc::signal<void, ObjectModel*> signal_object_left; private: void set_patch(SharedPtr<PatchModel> patch); @@ -75,8 +77,8 @@ private: void refresh_clicked(); void on_editable_sig(bool locked); void editable_toggled(); - void canvas_port_entered(FlowCanvas::Port* port); - void canvas_item_entered(FlowCanvas::Item* item); + void canvas_item_entered(Gnome::Canvas::Item* item); + void canvas_item_left(Gnome::Canvas::Item* item); void property_changed(const std::string& predicate, const Raul::Atom& value); diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index fe3c498a..280682ba 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -19,6 +19,7 @@ #include <iostream> #include <cassert> #include <fstream> +#include <boost/format.hpp> #include "raul/AtomRDF.hpp" #include "interface/EngineInterface.hpp" #include "client/PatchModel.hpp" @@ -43,6 +44,9 @@ namespace Ingen { namespace GUI { +static const int STATUS_CONTEXT_ENGINE = 0; +static const int STATUS_CONTEXT_PATCH = 1; +static const int STATUS_CONTEXT_HOVER = 2; PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Gtk::Window(cobject) @@ -87,11 +91,11 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad xml->get_widget("patch_help_about_menuitem", _menu_help_about); _menu_view_control_window->property_sensitive() = false; - //m_status_bar->push(App::instance().engine()->engine_url()); - //m_status_bar->pack_start(*Gtk::manage(new Gtk::Image(Gtk::Stock::CONNECT, Gtk::ICON_SIZE_MENU)), false, false); + string engine_name = App::instance().engine()->uri(); + if (engine_name == "ingen:internal") + engine_name = "internal engine"; + _status_bar->push(string("Connected to ") + engine_name, STATUS_CONTEXT_ENGINE); - /*_menu_open->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_open));*/ _menu_import->signal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_import)); _menu_import_location->signal_activate().connect( @@ -192,10 +196,12 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view) new_port_connection.disconnect(); removed_port_connection.disconnect(); _entered_connection.disconnect(); + _left_connection.disconnect(); - _patch = patch; + _status_bar->pop(STATUS_CONTEXT_PATCH); - _view = view; + _patch = patch; + _view = view; if (!_view) _view = _breadcrumb_box->view(patch->path()); @@ -253,6 +259,7 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view) show_all(); _view->signal_object_entered.connect(sigc::mem_fun(this, &PatchWindow::object_entered)); + _view->signal_object_left.connect(sigc::mem_fun(this, &PatchWindow::object_left)); _enable_signal = true; } @@ -289,13 +296,12 @@ PatchWindow::patch_port_removed(SharedPtr<PortModel> port) void PatchWindow::object_entered(ObjectModel* model) { - _status_bar->pop(); string msg = model->path(); NodeModel* node = dynamic_cast<NodeModel*>(model); if (node) { PluginModel* plugin = (PluginModel*)node->plugin(); if (plugin) - msg.append(" \"").append(plugin->human_name()).append("\""); + msg.append((boost::format(" (%1%)") % plugin->human_name()).str()); } PortModel* port = dynamic_cast<PortModel*>(model); @@ -304,7 +310,8 @@ PatchWindow::object_entered(ObjectModel* model) if (parent) { const PluginModel* plugin = dynamic_cast<const PluginModel*>(parent->plugin()); if (plugin) { - msg.append(" \"").append(plugin->port_human_name(port->index())).append("\""); + msg.append((boost::format(" (%1%)") + % plugin->port_human_name(port->index())).str()); const Atom& value = port->value(); if (value.is_valid()) { const Redland::Node node = AtomRDF::atom_to_node( @@ -315,7 +322,14 @@ PatchWindow::object_entered(ObjectModel* model) } } - _status_bar->push(msg); + _status_bar->push(msg, STATUS_CONTEXT_HOVER); +} + + +void +PatchWindow::object_left(ObjectModel* model) +{ + _status_bar->pop(STATUS_CONTEXT_HOVER); } @@ -372,6 +386,9 @@ PatchWindow::event_save() } else { const Glib::ustring& filename = Glib::filename_from_uri(doc->second.get_string()); App::instance().loader()->save_patch(_patch, filename); + _status_bar->push( + (boost::format("Wrote %1% to %2%") % _patch->path() % filename).str(), + STATUS_CONTEXT_PATCH); } } @@ -420,6 +437,9 @@ PatchWindow::event_save_as() if (confirm) { App::instance().loader()->save_patch(_patch, filename); _patch->set_variable("ingen:document", Atom(Glib::filename_to_uri(filename).c_str())); + _status_bar->push( + (boost::format("Wrote %1% to %2%") % _patch->path() % filename).str(), + STATUS_CONTEXT_PATCH); } } App::instance().configuration()->set_patch_folder(dialog.get_current_folder()); diff --git a/src/gui/PatchWindow.hpp b/src/gui/PatchWindow.hpp index a0c9792c..3e0c75bf 100644 --- a/src/gui/PatchWindow.hpp +++ b/src/gui/PatchWindow.hpp @@ -77,6 +77,7 @@ private: void patch_port_added(SharedPtr<PortModel> port); void patch_port_removed(SharedPtr<PortModel> port); void object_entered(ObjectModel* model); + void object_left(ObjectModel* model); void event_import(); void event_import_location(); @@ -143,6 +144,7 @@ private: Gtk::Statusbar* _status_bar; sigc::connection _entered_connection; + sigc::connection _left_connection; /** Invisible bin used to store breadcrumbs when not shown by a view */ Gtk::Alignment _breadcrumb_bin; |