diff options
author | David Robillard <d@drobilla.net> | 2006-09-14 23:14:53 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-09-14 23:14:53 +0000 |
commit | f9f760893e4fa1ff850becf7d98bd4c6af8b8d73 (patch) | |
tree | 1cf83435ef5ee08c31bb9ddc11b9dbca96264158 /src/progs/ingenuity/BreadCrumbBox.cpp | |
parent | a100c20612fc4f7f30372f579e355f782befa7e2 (diff) | |
download | ingen-f9f760893e4fa1ff850becf7d98bd4c6af8b8d73.tar.gz ingen-f9f760893e4fa1ff850becf7d98bd4c6af8b8d73.tar.bz2 ingen-f9f760893e4fa1ff850becf7d98bd4c6af8b8d73.zip |
Patch port and breadcrumb fixes.
git-svn-id: http://svn.drobilla.net/lad/ingen@135 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/BreadCrumbBox.cpp')
-rw-r--r-- | src/progs/ingenuity/BreadCrumbBox.cpp | 56 |
1 files changed, 30 insertions, 26 deletions
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<PatchView> 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<PatchView> 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<BreadCrumb*>::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<BreadCrumb*>::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<BreadCrumb*>::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; } |