diff options
author | David Robillard <d@drobilla.net> | 2011-03-17 06:32:50 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-03-17 06:32:50 +0000 |
commit | 08a6a9058d114a3208f5304799e2c84576e52f90 (patch) | |
tree | 87d103383c852535c63105d89fa27d906779f313 /src/gui | |
parent | 69191cb00b87c5fda9e65d592a3b73ce80da9b0e (diff) | |
download | ingen-08a6a9058d114a3208f5304799e2c84576e52f90.tar.gz ingen-08a6a9058d114a3208f5304799e2c84576e52f90.tar.bz2 ingen-08a6a9058d114a3208f5304799e2c84576e52f90.zip |
Show plugin/port documentation in side pane when selected.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3103 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/NodeModule.cpp | 15 | ||||
-rw-r--r-- | src/gui/PatchCanvas.cpp | 12 | ||||
-rw-r--r-- | src/gui/PatchCanvas.hpp | 1 | ||||
-rw-r--r-- | src/gui/PatchWindow.cpp | 1 | ||||
-rw-r--r-- | src/gui/PatchWindow.hpp | 4 | ||||
-rw-r--r-- | src/gui/Port.cpp | 24 | ||||
-rw-r--r-- | src/gui/Port.hpp | 2 | ||||
-rw-r--r-- | src/gui/WindowFactory.cpp | 10 | ||||
-rw-r--r-- | src/gui/WindowFactory.hpp | 1 | ||||
-rw-r--r-- | src/gui/ingen_gui.glade | 39 |
10 files changed, 101 insertions, 8 deletions
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index ea4c8079..d7523083 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -439,9 +439,22 @@ NodeModule::property_changed(const URI& key, const Atom& value) void NodeModule::set_selected(bool b) { - const LV2URIMap& uris = App::instance().uris(); + const App& app = App::instance(); + const LV2URIMap& uris = app.uris(); if (b != selected()) { Module::set_selected(b); + if (b) { + PatchWindow* win = app.window_factory()->parent_patch_window(node()); + if (win) { + const std::string& doc = node()->plugin_model()->documentation(); + if (!doc.empty()) { + win->doc_textview()->get_buffer()->set_text(doc); + win->doc_textview()->show(); + } else { + win->doc_textview()->hide(); + } + } + } if (App::instance().signal()) App::instance().engine()->set_property(_node->path(), uris.ingen_selected, b); } diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index beb2da23..d3d8c5c4 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -606,6 +606,18 @@ PatchCanvas::canvas_event(GdkEvent* event) return (ret ? true : Canvas::canvas_event(event)); } +void +PatchCanvas::clear_selection() +{ + const App& app = App::instance(); + PatchWindow* win = app.window_factory()->patch_window(_patch); + if (win) { + win->doc_textview()->hide(); + } + + FlowCanvas::Canvas::clear_selection(); +} + #define FOREACH_ITEM(iter, coll) \ for (list<boost::shared_ptr<Item> >::iterator (iter) = coll.begin(); \ (iter) != coll.end(); ++(iter)) diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp index aa27c9e1..702f90bb 100644 --- a/src/gui/PatchCanvas.hpp +++ b/src/gui/PatchCanvas.hpp @@ -77,6 +77,7 @@ public: void get_new_module_location(double& x, double& y); + void clear_selection(); void destroy_selection(); void copy_selection(); void paste(); diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index adbfc933..c64d72b9 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -95,6 +95,7 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad xml->get_widget("patch_view_messages_window_menuitem", _menu_view_messages_window); xml->get_widget("patch_view_patch_tree_window_menuitem", _menu_view_patch_tree_window); xml->get_widget("patch_help_about_menuitem", _menu_help_about); + xml->get_widget("patch_documentation_textview", _doc_textview); _menu_view_control_window->property_sensitive() = false; string engine_name = App::instance().engine()->uri().str(); diff --git a/src/gui/PatchWindow.hpp b/src/gui/PatchWindow.hpp index aafb9d2c..096343bd 100644 --- a/src/gui/PatchWindow.hpp +++ b/src/gui/PatchWindow.hpp @@ -57,6 +57,8 @@ public: PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); ~PatchWindow(); + Gtk::TextView* doc_textview() { return _doc_textview; } + void set_patch_from_path(const Raul::Path& path, SharedPtr<PatchView> view); void set_patch(SharedPtr<PatchModel> pc, SharedPtr<PatchView> view); @@ -151,6 +153,8 @@ private: BreadCrumbs* _breadcrumbs; Gtk::Statusbar* _status_bar; + Gtk::TextView* _doc_textview; + sigc::connection _entered_connection; sigc::connection _left_connection; diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 4102a52c..949e459d 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -253,6 +253,30 @@ Port::dash() return _dash; } +void +Port::set_selected(bool b) +{ + if (b != selected()) { + FlowCanvas::Port::set_selected(b); + SharedPtr<PortModel> pm = _port_model.lock(); + if (pm && b) { + const App& app = App::instance(); + SharedPtr<NodeModel> node = PtrCast<NodeModel>(pm->parent()); + PatchWindow* win = app.window_factory()->parent_patch_window(node); + if (win) { + const std::string& doc = node->plugin_model()->port_documentation( + pm->index()); + if (!doc.empty()) { + win->doc_textview()->get_buffer()->set_text(doc); + win->doc_textview()->show(); + } else { + win->doc_textview()->hide(); + } + } + } + } +} + } // namespace GUI } // namespace Ingen diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index 49409510..ba2f2f99 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -58,6 +58,8 @@ public: void value_changed(const Raul::Atom& value); void activity(); + void set_selected(bool b); + ArtVpathDash* dash(); private: diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 99c596dd..6c48d11d 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -116,6 +116,16 @@ WindowFactory::patch_window(SharedPtr<PatchModel> patch) } +PatchWindow* +WindowFactory::parent_patch_window(SharedPtr<NodeModel> node) +{ + if (!node) + return NULL; + + return patch_window(PtrCast<PatchModel>(node->parent())); +} + + NodeControlWindow* WindowFactory::control_window(SharedPtr<NodeModel> node) { diff --git a/src/gui/WindowFactory.hpp b/src/gui/WindowFactory.hpp index 113cfc3d..a00ffc1e 100644 --- a/src/gui/WindowFactory.hpp +++ b/src/gui/WindowFactory.hpp @@ -62,6 +62,7 @@ public: size_t num_open_patch_windows(); PatchWindow* patch_window(SharedPtr<PatchModel> patch); + PatchWindow* parent_patch_window(SharedPtr<NodeModel> node); NodeControlWindow* control_window(SharedPtr<NodeModel> node); void present_patch(SharedPtr<PatchModel> model, diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade index 15e38061..0a38bbb2 100644 --- a/src/gui/ingen_gui.glade +++ b/src/gui/ingen_gui.glade @@ -9,6 +9,7 @@ <child> <widget class="GtkVBox" id="patch_win_vbox"> <property name="visible">True</property> + <property name="orientation">vertical</property> <child> <widget class="GtkMenuBar" id="menubar"> <property name="visible">True</property> @@ -335,8 +336,8 @@ </child> <child> <widget class="GtkImageMenuItem" id="patch_fullscreen_menuitem"> - <property name="visible">True</property> <property name="label">gtk-fullscreen</property> + <property name="visible">True</property> <property name="use_underline">True</property> <property name="use_stock">True</property> <signal name="activate" handler="patch_fullscreen_menuitem"/> @@ -460,19 +461,43 @@ </packing> </child> <child> - <widget class="GtkScrolledWindow" id="patch_win_scrolledwin"> + <widget class="GtkHPaned" id="hpaned1"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> <child> - <widget class="GtkViewport" id="patch_win_viewport"> + <widget class="GtkScrolledWindow" id="patch_win_scrolledwin"> <property name="visible">True</property> - <property name="shadow_type">none</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> <child> - <placeholder/> + <widget class="GtkViewport" id="patch_win_viewport"> + <property name="visible">True</property> + <property name="resize_mode">queue</property> + <property name="shadow_type">none</property> + <child> + <placeholder/> + </child> + </widget> </child> </widget> + <packing> + <property name="resize">True</property> + <property name="shrink">False</property> + </packing> + </child> + <child> + <widget class="GtkTextView" id="patch_documentation_textview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="wrap_mode">word</property> + <property name="cursor_visible">False</property> + </widget> + <packing> + <property name="resize">False</property> + <property name="shrink">True</property> + </packing> </child> </widget> <packing> |