summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-22 17:29:36 +0000
committerDavid Robillard <d@drobilla.net>2008-11-22 17:29:36 +0000
commitae9644045846190f13dda828e2f75115f2c8601f (patch)
treeff0682b600558533f1b9cf3b3f1008142dc60544 /src/gui
parentbb8bf97474863c14e6f22bdbeb4d77990e830e1d (diff)
downloadingen-ae9644045846190f13dda828e2f75115f2c8601f.tar.gz
ingen-ae9644045846190f13dda828e2f75115f2c8601f.tar.bz2
ingen-ae9644045846190f13dda828e2f75115f2c8601f.zip
Add status bar to display information about objects on mouse hover.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1769 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/BreadCrumb.hpp9
-rw-r--r--src/gui/BreadCrumbBox.hpp16
-rw-r--r--src/gui/PatchView.cpp27
-rw-r--r--src/gui/PatchView.hpp12
-rw-r--r--src/gui/PatchWindow.cpp50
-rw-r--r--src/gui/PatchWindow.hpp24
-rw-r--r--src/gui/ingen_gui.glade19
-rw-r--r--src/gui/wscript2
8 files changed, 128 insertions, 31 deletions
diff --git a/src/gui/BreadCrumb.hpp b/src/gui/BreadCrumb.hpp
index 45bdae31..62900a23 100644
--- a/src/gui/BreadCrumb.hpp
+++ b/src/gui/BreadCrumb.hpp
@@ -22,6 +22,7 @@
#include "raul/Path.hpp"
#include "raul/SharedPtr.hpp"
#include "PatchView.hpp"
+#include "client/PatchModel.hpp"
namespace Ingen {
namespace GUI {
@@ -39,7 +40,7 @@ namespace GUI {
class BreadCrumb : public Gtk::ToggleButton
{
public:
- BreadCrumb(const Path& path, SharedPtr<PatchView> view = SharedPtr<PatchView>())
+ BreadCrumb(const Raul::Path& path, SharedPtr<PatchView> view = SharedPtr<PatchView>())
: _path(path)
, _view(view)
{
@@ -54,10 +55,10 @@ public:
_view = view;
}
- const Path& path() const { return _path; }
+ const Raul::Path& path() const { return _path; }
SharedPtr<PatchView> view() const { return _view; }
- void set_path(const Path& path)
+ void set_path(const Raul::Path& path)
{
remove();
const string text = (path == "/") ? "/" : path.name().c_str();
@@ -71,7 +72,7 @@ public:
}
private:
- Path _path;
+ Raul::Path _path;
SharedPtr<PatchView> _view;
};
diff --git a/src/gui/BreadCrumbBox.hpp b/src/gui/BreadCrumbBox.hpp
index caaca612..7c4764c1 100644
--- a/src/gui/BreadCrumbBox.hpp
+++ b/src/gui/BreadCrumbBox.hpp
@@ -43,23 +43,23 @@ class BreadCrumbBox : public Gtk::HBox
public:
BreadCrumbBox();
- SharedPtr<PatchView> view(const Path& path);
+ SharedPtr<PatchView> view(const Raul::Path& path);
- void build(Path path, SharedPtr<PatchView> view);
+ void build(Raul::Path path, SharedPtr<PatchView> view);
- sigc::signal<void, const Path&, SharedPtr<PatchView> > signal_patch_selected;
+ sigc::signal<void, const Raul::Path&, SharedPtr<PatchView> > signal_patch_selected;
private:
- BreadCrumb* create_crumb(const Path& path,
+ BreadCrumb* create_crumb(const Raul::Path& path,
SharedPtr<PatchView> view = SharedPtr<PatchView>());
void breadcrumb_clicked(BreadCrumb* crumb);
- void object_destroyed(const Path& path);
- void object_renamed(const Path& old_path, const Path& new_path);
+ void object_destroyed(const Raul::Path& path);
+ void object_renamed(const Raul::Path& old_path, const Raul::Path& new_path);
- Path _active_path;
- Path _full_path;
+ Raul::Path _active_path;
+ Raul::Path _full_path;
bool _enable_signal;
std::list<BreadCrumb*> _breadcrumbs;
};
diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp
index 1c5c2c51..6e2ff1cd 100644
--- a/src/gui/PatchView.cpp
+++ b/src/gui/PatchView.cpp
@@ -107,6 +107,12 @@ 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->grab_focus();
}
@@ -121,7 +127,8 @@ SharedPtr<PatchView>
PatchView::create(SharedPtr<PatchModel> patch)
{
- const Glib::RefPtr<Gnome::Glade::Xml>& xml = GladeFactory::new_glade_reference("patch_view_box");
+
+const Glib::RefPtr<Gnome::Glade::Xml>& xml = GladeFactory::new_glade_reference("patch_view_box");
PatchView* result = NULL;
xml->get_widget_derived("patch_view_box", result);
assert(result);
@@ -148,6 +155,24 @@ PatchView::editable_toggled()
void
+PatchView::canvas_port_entered(FlowCanvas::Port* port)
+{
+ Port* p = dynamic_cast<Port*>(port);
+ if (p)
+ signal_object_entered.emit(p->model().get());
+}
+
+
+void
+PatchView::canvas_item_entered(FlowCanvas::Item* item)
+{
+ NodeModule* m = dynamic_cast<NodeModule*>(item);
+ if (m)
+ signal_object_entered.emit(m->node().get());
+}
+
+
+void
PatchView::process_toggled()
{
if (!_enable_signal)
diff --git a/src/gui/PatchView.hpp b/src/gui/PatchView.hpp
index 209480f2..beb1de2f 100644
--- a/src/gui/PatchView.hpp
+++ b/src/gui/PatchView.hpp
@@ -23,16 +23,17 @@
#include <libglademm/xml.h>
#include <libglademm.h>
#include "raul/SharedPtr.hpp"
-#include "client/PatchModel.hpp"
-
-using std::string;
+#include "raul/Atom.hpp"
namespace Ingen { namespace Client {
class PortModel;
class MetadataModel;
+ class PatchModel;
+ class ObjectModel;
} }
using namespace Ingen::Client;
+namespace FlowCanvas { class Port; class Item; }
namespace Ingen {
namespace GUI {
@@ -45,7 +46,6 @@ class NewSubpatchWindow;
class NodeControlWindow;
class PatchDescriptionWindow;
class SubpatchModule;
-class OmPort;
/** The patch specific contents of a PatchWindow (ie the canvas and whatever else).
@@ -64,6 +64,8 @@ public:
static SharedPtr<PatchView> create(SharedPtr<PatchModel> patch);
+ sigc::signal<void, ObjectModel*> signal_object_entered;
+
private:
void set_patch(SharedPtr<PatchModel> patch);
@@ -73,6 +75,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 property_changed(const std::string& predicate, const Raul::Atom& value);
diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp
index fbc85d34..7cd095f5 100644
--- a/src/gui/PatchWindow.cpp
+++ b/src/gui/PatchWindow.cpp
@@ -19,6 +19,7 @@
#include <iostream>
#include <cassert>
#include <fstream>
+#include "raul/AtomRDF.hpp"
#include "interface/EngineInterface.hpp"
#include "client/PatchModel.hpp"
#include "client/ClientStore.hpp"
@@ -55,6 +56,7 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
xml->get_widget("patch_win_vbox", _vbox);
xml->get_widget("patch_win_viewport", _viewport);
+ xml->get_widget("patch_win_status_bar", _status_bar);
//xml->get_widget("patch_win_status_bar", _status_bar);
//xml->get_widget("patch_open_menuitem", _menu_open);
xml->get_widget("patch_import_menuitem", _menu_import);
@@ -76,6 +78,7 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
xml->get_widget("patch_fullscreen_menuitem", _menu_fullscreen);
xml->get_widget("patch_human_names_menuitem", _menu_human_names);
xml->get_widget("patch_show_port_names_menuitem", _menu_show_port_names);
+ xml->get_widget("patch_status_bar_menuitem", _menu_show_status_bar);
xml->get_widget("patch_arrange_menuitem", _menu_arrange);
xml->get_widget("patch_clear_menuitem", _menu_clear);
xml->get_widget("patch_destroy_menuitem", _menu_destroy_patch);
@@ -113,6 +116,8 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
sigc::mem_fun(this, &PatchWindow::event_fullscreen_toggled));
_menu_human_names->signal_activate().connect(
sigc::mem_fun(this, &PatchWindow::event_human_names_toggled));
+ _menu_show_status_bar->signal_activate().connect(
+ sigc::mem_fun(this, &PatchWindow::event_status_bar_toggled));
_menu_show_port_names->signal_activate().connect(
sigc::mem_fun(this, &PatchWindow::event_port_names_toggled));
_menu_arrange->signal_activate().connect(
@@ -186,6 +191,7 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view)
new_port_connection.disconnect();
removed_port_connection.disconnect();
+ _entered_connection.disconnect();
_patch = patch;
@@ -246,6 +252,8 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view)
removed_port_connection = patch->signal_removed_port.connect(sigc::mem_fun(this, &PatchWindow::patch_port_removed));
show_all();
+ _view->signal_object_entered.connect(sigc::mem_fun(this, &PatchWindow::object_entered));
+
_enable_signal = true;
}
@@ -278,6 +286,37 @@ 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();
+ msg.append(" \"").append(plugin->human_name()).append("\"");
+ }
+
+ PortModel* port = dynamic_cast<PortModel*>(model);
+ if (port) {
+ NodeModel* parent = dynamic_cast<NodeModel*>(port->parent().get());
+ if (parent) {
+ const PluginModel* plugin = dynamic_cast<const PluginModel*>(parent->plugin());
+ if (plugin) {
+ msg.append(" \"").append(plugin->port_human_name(port->index())).append("\"");
+ const Atom& value = port->value();
+ if (value.is_valid()) {
+ const Redland::Node node = AtomRDF::atom_to_node(
+ *App::instance().world()->rdf_world, value);
+ msg.append(" = ").append(node.to_string());
+ }
+ }
+ }
+ }
+
+ _status_bar->push(msg);
+}
+
void
PatchWindow::event_show_engine()
@@ -539,6 +578,17 @@ PatchWindow::event_fullscreen_toggled()
void
+PatchWindow::event_status_bar_toggled()
+{
+ if (_menu_show_status_bar->get_active())
+ _status_bar->show();
+ else
+ _status_bar->hide();
+}
+
+
+
+void
PatchWindow::event_human_names_toggled()
{
_view->canvas()->show_human_names(_menu_human_names->get_active());
diff --git a/src/gui/PatchWindow.hpp b/src/gui/PatchWindow.hpp
index 62adf4c8..a0c9792c 100644
--- a/src/gui/PatchWindow.hpp
+++ b/src/gui/PatchWindow.hpp
@@ -25,17 +25,11 @@
#include <libglademm.h>
#include "raul/Path.hpp"
#include "raul/SharedPtr.hpp"
-#include "client/PatchModel.hpp"
-#include "PatchView.hpp"
-using Ingen::Client::PatchModel;
-
-using std::string; using std::list;
-
namespace Ingen { namespace Client {
class PatchModel;
class PortModel;
- class MetadataModel;
+ class ObjectModel;
} }
using namespace Ingen::Client;
@@ -51,8 +45,8 @@ class NewSubpatchWindow;
class NodeControlWindow;
class PatchDescriptionWindow;
class SubpatchModule;
-class OmPort;
class BreadCrumbBox;
+class PatchView;
/** A window for a patch.
@@ -65,7 +59,7 @@ public:
PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml);
~PatchWindow();
- void set_patch_from_path(const Path& path, SharedPtr<PatchView> view);
+ void set_patch_from_path(const Raul::Path& path, SharedPtr<PatchView> view);
void set_patch(SharedPtr<PatchModel> pc, SharedPtr<PatchView> view);
SharedPtr<PatchModel> patch() const { return _patch; }
@@ -82,6 +76,7 @@ private:
void patch_port_added(SharedPtr<PortModel> port);
void patch_port_removed(SharedPtr<PortModel> port);
+ void object_entered(ObjectModel* model);
void event_import();
void event_import_location();
@@ -96,6 +91,7 @@ private:
void event_destroy();
void event_clear();
void event_fullscreen_toggled();
+ void event_status_bar_toggled();
void event_human_names_toggled();
void event_port_names_toggled();
void event_arrange();
@@ -129,6 +125,7 @@ private:
Gtk::MenuItem* _menu_quit;
Gtk::CheckMenuItem* _menu_human_names;
Gtk::CheckMenuItem* _menu_show_port_names;
+ Gtk::CheckMenuItem* _menu_show_status_bar;
Gtk::MenuItem* _menu_fullscreen;
Gtk::MenuItem* _menu_clear;
Gtk::MenuItem* _menu_destroy_patch;
@@ -139,13 +136,14 @@ private:
Gtk::MenuItem* _menu_view_messages_window;
Gtk::MenuItem* _menu_view_patch_tree_window;
Gtk::MenuItem* _menu_help_about;
-
+
Gtk::VBox* _vbox;
Gtk::Viewport* _viewport;
BreadCrumbBox* _breadcrumb_box;
-
- //Gtk::Statusbar* _status_bar;
-
+ Gtk::Statusbar* _status_bar;
+
+ sigc::connection _entered_connection;
+
/** Invisible bin used to store breadcrumbs when not shown by a view */
Gtk::Alignment _breadcrumb_bin;
};
diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade
index 9328893b..5d249bd4 100644
--- a/src/gui/ingen_gui.glade
+++ b/src/gui/ingen_gui.glade
@@ -321,6 +321,15 @@
<accelerator key="n" modifiers="GDK_CONTROL_MASK" signal="activate"/>
</widget>
</child>
+ <child>
+ <widget class="GtkCheckMenuItem" id="patch_status_bar_menuitem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Status Bar</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <accelerator key="b" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+ </widget>
+ </child>
</widget>
</child>
</widget>
@@ -468,6 +477,16 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkStatusbar" id="patch_win_status_bar">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/gui/wscript b/src/gui/wscript
index 62cefaf5..d00606eb 100644
--- a/src/gui/wscript
+++ b/src/gui/wscript
@@ -42,7 +42,7 @@ def build(bld):
if bld.env()['HAVE_CURL'] != 0:
obj.source += 'UploadPatchWindow.cpp'
- obj.includes = ['.', '..', '../common']
+ obj.includes = ['.', '..', '../common', '../client', '../module']
obj.name = 'libingen_gui'
obj.target = 'ingen_gui'
obj.inst_dir = bld.env()['LIBDIRNAME'] + 'ingen'