X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FGraph.cpp;h=036bb38857359e6d8a6f78b8c568b97ca6d8c89e;hb=cda56c0dc3d5e43b68b464fa1a483d8973d2b692;hp=09db31e5f24e4d62c784e515076bf1c13ab0a632;hpb=c71040e6106563a99bba12bae1a1a0c019a7351a;p=lyx.git diff --git a/src/Graph.cpp b/src/Graph.cpp index 09db31e5f2..036bb38857 100644 --- a/src/Graph.cpp +++ b/src/Graph.cpp @@ -28,7 +28,7 @@ bool Graph::bfs_init(int s, bool clear_visited, queue & Q) { if (s < 0) return false; - + if (!Q.empty()) Q = queue(); @@ -46,10 +46,10 @@ bool Graph::bfs_init(int s, bool clear_visited, queue & Q) } -vector const +Graph::EdgePath const Graph::getReachableTo(int target, bool clear_visited) { - vector result; + EdgePath result; queue Q; if (!bfs_init(target, clear_visited, Q)) return result; @@ -63,7 +63,7 @@ vector const while (!Q.empty()) { int const current = Q.front(); Q.pop(); - if (current != target || formats.get(target).name() != "lyx") + if (current != target || theFormats().get(target).name() != "lyx") result.push_back(current); vector::iterator it = vertices_[current].in_arrows.begin(); @@ -81,11 +81,11 @@ vector const } -vector const +Graph::EdgePath const Graph::getReachable(int from, bool only_viewable, - bool clear_visited) + bool clear_visited, set excludes) { - vector result; + EdgePath result; queue Q; if (!bfs_init(from, clear_visited, Q)) return result; @@ -93,12 +93,12 @@ vector const while (!Q.empty()) { int const current = Q.front(); Q.pop(); - Format const & format = formats.get(current); + Format const & format = theFormats().get(current); if (!only_viewable || !format.viewer().empty()) result.push_back(current); else if (format.isChildFormat()) { Format const * const parent = - formats.getFormat(format.parentFormat()); + theFormats().getFormat(format.parentFormat()); if (parent && !parent->viewer().empty()) result.push_back(current); } @@ -111,7 +111,8 @@ vector const int const cv = (*cit)->to; if (!vertices_[cv].visited) { vertices_[cv].visited = true; - Q.push(cv); + if (excludes.find(cv) == excludes.end()) + Q.push(cv); } } }