summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/BreadCrumb.hpp82
-rw-r--r--src/gui/BreadCrumbs.cpp27
-rw-r--r--src/gui/BreadCrumbs.hpp55
-rw-r--r--src/gui/PatchWindow.cpp22
-rw-r--r--src/gui/PatchWindow.hpp4
5 files changed, 76 insertions, 114 deletions
diff --git a/src/gui/BreadCrumb.hpp b/src/gui/BreadCrumb.hpp
deleted file mode 100644
index 1c0ba286..00000000
--- a/src/gui/BreadCrumb.hpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef BREADCRUMB_H
-#define BREADCRUMB_H
-
-#include <gtkmm.h>
-#include "raul/Path.hpp"
-#include "raul/SharedPtr.hpp"
-#include "client/PatchModel.hpp"
-#include "PatchView.hpp"
-
-namespace Ingen {
-namespace GUI {
-
-
-/** Breadcrumb button in a PatchWindow.
- *
- * Each Breadcrumb stores a reference to a PatchView for quick switching.
- * So, the amount of allocated PatchViews at a given time is equal to the
- * number of visible breadcrumbs (which is the perfect cache for GUI
- * responsiveness balanced with mem consumption).
- *
- * \ingroup GUI
- */
-class BreadCrumb : public Gtk::ToggleButton
-{
-public:
- BreadCrumb(const Raul::Path& path, SharedPtr<PatchView> view = SharedPtr<PatchView>())
- : _path(path)
- , _view(view)
- {
- assert( !view || view->patch()->path() == path);
- set_border_width(0);
- set_path(path);
- show_all();
- }
-
- void set_view(SharedPtr<PatchView> view) {
- assert( !view || view->patch()->path() == _path);
- _view = view;
- }
-
- const Raul::Path& path() const { return _path; }
- SharedPtr<PatchView> view() const { return _view; }
-
- void set_path(const Raul::Path& path)
- {
- remove();
- const std::string text = (path.is_root()) ? "/" : path.name().c_str();
- Gtk::Label* lab = manage(new Gtk::Label(text));
- lab->set_padding(0, 0);
- lab->show();
- add(*lab);
-
- if (_view && _view->patch()->path() != path)
- _view.reset();
- }
-
-private:
- Raul::Path _path;
- SharedPtr<PatchView> _view;
-};
-
-} // namespace GUI
-} // namespace Ingen
-
-#endif // BREADCRUMB_H
diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp
index 8e9dd629..43f9fc21 100644
--- a/src/gui/BreadCrumbs.cpp
+++ b/src/gui/BreadCrumbs.cpp
@@ -15,10 +15,9 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "BreadCrumbs.hpp"
-#include "BreadCrumb.hpp"
-#include "App.hpp"
#include "client/SigClientInterface.hpp"
+#include "App.hpp"
+#include "BreadCrumbs.hpp"
namespace Ingen {
namespace GUI {
@@ -26,19 +25,19 @@ namespace GUI {
using namespace std;
using namespace Raul;
-BreadCrumbBox::BreadCrumbBox()
+BreadCrumbs::BreadCrumbs()
: Gtk::HBox()
, _active_path("/")
, _full_path("/")
, _enable_signal(true)
{
App::instance().client()->signal_object_deleted.connect(
- sigc::mem_fun(this, &BreadCrumbBox::object_destroyed));
+ sigc::mem_fun(this, &BreadCrumbs::object_destroyed));
}
SharedPtr<PatchView>
-BreadCrumbBox::view(const Path& path)
+BreadCrumbs::view(const Path& path)
{
for (std::list<BreadCrumb*>::const_iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i)
if ((*i)->path() == path)
@@ -54,7 +53,7 @@ BreadCrumbBox::view(const Path& path)
* children preserved.
*/
void
-BreadCrumbBox::build(Path path, SharedPtr<PatchView> view)
+BreadCrumbs::build(Path path, SharedPtr<PatchView> view)
{
bool old_enable_signal = _enable_signal;
_enable_signal = false;
@@ -148,22 +147,22 @@ BreadCrumbBox::build(Path path, SharedPtr<PatchView> view)
/** Create a new crumb, assigning it a reference to @a view if their paths
* match, otherwise ignoring @a view.
*/
-BreadCrumb*
-BreadCrumbBox::create_crumb(const Path& path,
- SharedPtr<PatchView> view)
+BreadCrumbs::BreadCrumb*
+BreadCrumbs::create_crumb(const Path& path,
+ SharedPtr<PatchView> view)
{
BreadCrumb* but = manage(new BreadCrumb(path,
(view && path == view->patch()->path()) ? view : SharedPtr<PatchView>()));
but->signal_toggled().connect(sigc::bind(sigc::mem_fun(
- this, &BreadCrumbBox::breadcrumb_clicked), but));
+ this, &BreadCrumbs::breadcrumb_clicked), but));
return but;
}
void
-BreadCrumbBox::breadcrumb_clicked(BreadCrumb* crumb)
+BreadCrumbs::breadcrumb_clicked(BreadCrumb* crumb)
{
if (_enable_signal) {
_enable_signal = false;
@@ -182,7 +181,7 @@ BreadCrumbBox::breadcrumb_clicked(BreadCrumb* crumb)
void
-BreadCrumbBox::object_destroyed(const Path& path)
+BreadCrumbs::object_destroyed(const Path& path)
{
for (std::list<BreadCrumb*>::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) {
if ((*i)->path() == path) {
@@ -199,7 +198,7 @@ BreadCrumbBox::object_destroyed(const Path& path)
void
-BreadCrumbBox::object_moved(const Path& old_path, const Path& new_path)
+BreadCrumbs::object_moved(const Path& old_path, const Path& new_path)
{
for (std::list<BreadCrumb*>::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) {
if ((*i)->path() == old_path)
diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp
index 6938c154..adabe88f 100644
--- a/src/gui/BreadCrumbs.hpp
+++ b/src/gui/BreadCrumbs.hpp
@@ -24,24 +24,22 @@
#include <libglademm.h>
#include "raul/Path.hpp"
#include "raul/SharedPtr.hpp"
+#include "client/PatchModel.hpp"
#include "PatchView.hpp"
namespace Ingen {
namespace GUI {
-class BreadCrumb;
-
/** Collection of breadcrumb buttons forming a path.
- *
* This doubles as a cache for PatchViews.
*
* \ingroup GUI
*/
-class BreadCrumbBox : public Gtk::HBox
+class BreadCrumbs : public Gtk::HBox
{
public:
- BreadCrumbBox();
+ BreadCrumbs();
SharedPtr<PatchView> view(const Raul::Path& path);
@@ -50,6 +48,53 @@ public:
sigc::signal<void, const Raul::Path&, SharedPtr<PatchView> > signal_patch_selected;
private:
+ /** Breadcrumb button.
+ *
+ * Each Breadcrumb stores a reference to a PatchView for quick switching.
+ * So, the amount of allocated PatchViews at a given time is equal to the
+ * number of visible breadcrumbs (which is the perfect cache for GUI
+ * responsiveness balanced with mem consumption).
+ *
+ * \ingroup GUI
+ */
+ class BreadCrumb : public Gtk::ToggleButton
+ {
+ public:
+ BreadCrumb(const Raul::Path& path, SharedPtr<PatchView> view = SharedPtr<PatchView>())
+ : _path(path)
+ , _view(view)
+ {
+ assert( !view || view->patch()->path() == path);
+ set_border_width(0);
+ set_path(path);
+ show_all();
+ }
+
+ void set_view(SharedPtr<PatchView> view) {
+ assert( !view || view->patch()->path() == _path);
+ _view = view;
+ }
+
+ const Raul::Path& path() const { return _path; }
+ SharedPtr<PatchView> view() const { return _view; }
+
+ void set_path(const Raul::Path& path) {
+ remove();
+ const std::string text = (path.is_root()) ? "/" : path.name().c_str();
+ Gtk::Label* lab = manage(new Gtk::Label(text));
+ lab->set_padding(0, 0);
+ lab->show();
+ add(*lab);
+
+ if (_view && _view->patch()->path() != path)
+ _view.reset();
+ }
+
+ private:
+ Raul::Path _path;
+ SharedPtr<PatchView> _view;
+ };
+
BreadCrumb* create_crumb(const Raul::Path& path,
SharedPtr<PatchView> view = SharedPtr<PatchView>());
diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp
index e1992d1e..af651e34 100644
--- a/src/gui/PatchWindow.cpp
+++ b/src/gui/PatchWindow.cpp
@@ -56,7 +56,7 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
, _position_stored(false)
, _x(0)
, _y(0)
- , _breadcrumb_box(NULL)
+ , _breadcrumbs(NULL)
{
property_visible() = false;
@@ -151,8 +151,8 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
_menu_help_about->signal_activate().connect(sigc::hide_return(
sigc::mem_fun(App::instance(), &App::show_about)));
- _breadcrumb_box = new BreadCrumbBox();
- _breadcrumb_box->signal_patch_selected.connect(sigc::mem_fun(this, &PatchWindow::set_patch_from_path));
+ _breadcrumbs = new BreadCrumbs();
+ _breadcrumbs->signal_patch_selected.connect(sigc::mem_fun(this, &PatchWindow::set_patch_from_path));
#ifndef HAVE_CURL
_menu_upload->hide();
@@ -168,11 +168,11 @@ PatchWindow::~PatchWindow()
// Prevents deletion
//m_patch->claim_patch_view();
- delete _breadcrumb_box;
+ delete _breadcrumbs;
}
-/** Set the patch controller from a Path (for use by eg. BreadCrumbBox)
+/** Set the patch controller from a Path (for use by eg. BreadCrumbs)
*/
void
PatchWindow::set_patch_from_path(const Path& path, SharedPtr<PatchView> view)
@@ -212,7 +212,7 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view)
_view = view;
if (!_view)
- _view = _breadcrumb_box->view(patch->path());
+ _view = _breadcrumbs->view(patch->path());
if (!_view)
_view = PatchView::create(patch);
@@ -227,15 +227,15 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view)
_viewport->add(*_view.get());
- if (_breadcrumb_box->get_parent())
- _breadcrumb_box->get_parent()->remove(*_breadcrumb_box);
+ if (_breadcrumbs->get_parent())
+ _breadcrumbs->get_parent()->remove(*_breadcrumbs);
_view->breadcrumb_container()->remove();
- _view->breadcrumb_container()->add(*_breadcrumb_box);
+ _view->breadcrumb_container()->add(*_breadcrumbs);
_view->breadcrumb_container()->show();
- _breadcrumb_box->build(patch->path(), _view);
- _breadcrumb_box->show();
+ _breadcrumbs->build(patch->path(), _view);
+ _breadcrumbs->show();
_menu_view_control_window->property_sensitive() = false;
diff --git a/src/gui/PatchWindow.hpp b/src/gui/PatchWindow.hpp
index 5216b90a..0dbf1316 100644
--- a/src/gui/PatchWindow.hpp
+++ b/src/gui/PatchWindow.hpp
@@ -46,7 +46,7 @@ class NewSubpatchWindow;
class NodeControlWindow;
class PatchDescriptionWindow;
class SubpatchModule;
-class BreadCrumbBox;
+class BreadCrumbs;
class PatchView;
@@ -146,7 +146,7 @@ private:
Gtk::VBox* _vbox;
Gtk::Viewport* _viewport;
- BreadCrumbBox* _breadcrumb_box;
+ BreadCrumbs* _breadcrumbs;
Gtk::Statusbar* _status_bar;
sigc::connection _entered_connection;