summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity/BreadCrumbBox.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-11 11:10:35 +0000
committerDavid Robillard <d@drobilla.net>2006-09-11 11:10:35 +0000
commitb15864870d34a1188eda93ad215734275037278e (patch)
tree224a1669a29091ea4198425d4a002e448cde8b30 /src/progs/ingenuity/BreadCrumbBox.cpp
parent22bf43352ddfc48452d776f10ad4d12161255049 (diff)
downloadingen-b15864870d34a1188eda93ad215734275037278e.tar.gz
ingen-b15864870d34a1188eda93ad215734275037278e.tar.bz2
ingen-b15864870d34a1188eda93ad215734275037278e.zip
Switched homebrew CountedPtr to boost::shared_ptr.
Factories for patch windows, controller. Robustness updated in many places. Tons of cleanups, rewrites, bugfixes, etc. git-svn-id: http://svn.drobilla.net/lad/ingen@128 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/BreadCrumbBox.cpp')
-rw-r--r--src/progs/ingenuity/BreadCrumbBox.cpp39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/progs/ingenuity/BreadCrumbBox.cpp b/src/progs/ingenuity/BreadCrumbBox.cpp
index d2bf7f97..aea1cdf0 100644
--- a/src/progs/ingenuity/BreadCrumbBox.cpp
+++ b/src/progs/ingenuity/BreadCrumbBox.cpp
@@ -28,9 +28,10 @@ BreadCrumbBox::BreadCrumbBox()
}
-/** Destroys current breadcrumbs and rebuilds from scratch.
- *
- * (Needs to be called when a patch is cleared to eliminate children crumbs)
+/** Sets up the crumbs to display a @a path.
+ *
+ * If @a path is already part of the shown path, it will be selected and the
+ * children preserved.
*/
void
BreadCrumbBox::build(Path path)
@@ -38,8 +39,8 @@ BreadCrumbBox::build(Path path)
bool old_enable_signal = _enable_signal;
_enable_signal = false;
- // Moving to a parent path, just switch the active button
- if (path.length() < _full_path.length() && _full_path.substr(0, path.length()) == path) {
+ // Moving to a path we already contain, just switch the active button
+ if (_breadcrumbs.size() > 0 && (path.is_parent_of(_full_path) || path == _full_path)) {
for (std::list<BreadCrumb*>::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i)
(*i)->set_active( ((*i)->path() == path) );
@@ -102,5 +103,33 @@ BreadCrumbBox::breadcrumb_clicked(BreadCrumb* crumb)
}
}
+
+void
+BreadCrumbBox::object_removed(const Path& path)
+{
+ for (std::list<BreadCrumb*>::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) {
+ if ((*i)->path() == path) {
+ // Remove all crumbs after the removed one (inclusive)
+ for (std::list<BreadCrumb*>::iterator j = i; j != _breadcrumbs.end(); ) {
+ BreadCrumb* bc = *j;
+ j = _breadcrumbs.erase(j);
+ remove(*bc);
+ }
+ break;
+ }
+ }
+}
+
+
+void
+BreadCrumbBox::object_renamed(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)
+ (*i)->set_path(new_path);
+ }
+}
+
+
} // namespace Ingenuity