From f9f760893e4fa1ff850becf7d98bd4c6af8b8d73 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 14 Sep 2006 23:14:53 +0000 Subject: Patch port and breadcrumb fixes. git-svn-id: http://svn.drobilla.net/lad/ingen@135 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/ingenuity/BreadCrumbBox.cpp | 56 +++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 26 deletions(-) (limited to 'src/progs/ingenuity/BreadCrumbBox.cpp') diff --git a/src/progs/ingenuity/BreadCrumbBox.cpp b/src/progs/ingenuity/BreadCrumbBox.cpp index 8dc0b8a0..c4234e8a 100644 --- a/src/progs/ingenuity/BreadCrumbBox.cpp +++ b/src/progs/ingenuity/BreadCrumbBox.cpp @@ -53,11 +53,10 @@ BreadCrumbBox::build(Path path, CountedPtr view) _active_path = path; _enable_signal = old_enable_signal; - return; - } + // Moving to a child of the full path, just append crumbs (preserve view cache) - if (_breadcrumbs.size() > 0 && (path.is_child_of(_full_path))) { + } else if (_breadcrumbs.size() > 0 && (path.is_child_of(_full_path))) { string postfix = path.substr(_full_path.length()); while (postfix.length() > 0) { const string name = postfix.substr(0, postfix.find("/")); @@ -66,40 +65,45 @@ BreadCrumbBox::build(Path path, CountedPtr view) BreadCrumb* but = create_crumb(_full_path, view); pack_end(*but, false, false, 1); _breadcrumbs.push_back(but); + but->show(); if (postfix.find("/") == string::npos) break; else postfix = postfix.substr(postfix.find("/")+1); } - } + + for (std::list::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) + (*i)->set_active(false); + _breadcrumbs.back()->set_active(true); + + // Rebuild from scratch // Getting here is bad unless absolutely necessary, since the PatchView cache is lost - - // Otherwise rebuild from scratch - _full_path = path; - _active_path = path; - - // Empty existing breadcrumbs - for (std::list::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) - remove(**i); - _breadcrumbs.clear(); - - // Add root - BreadCrumb* but = create_crumb("/", view); - pack_start(*but, false, false, 1); - _breadcrumbs.push_front(but); - but->set_active(but->path() == _active_path); - - // Add the others - while (path != "/") { - BreadCrumb* but = create_crumb(path, view); + } else { + + _full_path = path; + _active_path = path; + + // Empty existing breadcrumbs + for (std::list::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) + remove(**i); + _breadcrumbs.clear(); + + // Add root + BreadCrumb* but = create_crumb("/", view); pack_start(*but, false, false, 1); _breadcrumbs.push_front(but); but->set_active(but->path() == _active_path); - path = path.parent(); - } - show_all_children(); + // Add the others + while (path != "/") { + BreadCrumb* but = create_crumb(path, view); + pack_start(*but, false, false, 1); + _breadcrumbs.push_front(but); + but->set_active(but->path() == _active_path); + path = path.parent(); + } + } _enable_signal = old_enable_signal; } -- cgit v1.2.1