Commit 046e063b authored by Daniel Elstner's avatar Daniel Elstner
Browse files

:next_match_file): Move code from FileTree::next_match_file() here.

* src/filetreeprivate.{cc,h} (FileTreePrivate::next_match_file):
Move code from FileTree::next_match_file() here.
(FileTreePrivate::prev_match_file):
Move code from FileTree::prev_match_file() here.

* src/filetree.{cc,h} (FileTree::next_match_file): Remove.
(FileTree::prev_match_file): Remove.
parent 7101175f
2004-06-09 Daniel Elstner <daniel.elstner@gmx.net>
* src/filetreeprivate.{cc,h} (FileTreePrivate::next_match_file):
Move code from FileTree::next_match_file() here.
(FileTreePrivate::prev_match_file):
Move code from FileTree::prev_match_file() here.
* src/filetree.{cc,h} (FileTree::next_match_file): Remove.
(FileTree::prev_match_file): Remove.
2004-06-09 Daniel Elstner <daniel.elstner@gmx.net>
* src/filetree.{cc,h} (FileTree::next_match_file): Replace the
......
......@@ -638,87 +638,6 @@ bool FileTree::replace_matches_at_path_iter(const Gtk::TreeModel::Path& path,
return false;
}
bool FileTree::next_match_file(Gtk::TreeModel::iterator& iter, Gtk::TreeModel::Path* collapse)
{
g_return_val_if_fail(iter, false);
const FileTreeColumns& columns = FileTreeColumns::instance();
Gtk::TreeModel::iterator parent = iter->parent();
for (++iter;;)
{
if (iter)
{
if ((*iter)[columns.matchcount] > 0)
{
if (const Gtk::TreeModel::Children& children = iter->children()) // directory?
{
parent = iter;
iter = children.begin();
continue;
}
return true;
}
}
else if (parent)
{
iter = parent;
parent = iter->parent();
if (collapse)
*collapse = iter;
}
else
break;
++iter;
}
return false;
}
bool FileTree::prev_match_file(Gtk::TreeModel::iterator& iter, Gtk::TreeModel::Path* collapse)
{
g_return_val_if_fail(iter, false);
const FileTreeColumns& columns = FileTreeColumns::instance();
Gtk::TreeModel::iterator parent = iter->parent();
Gtk::TreeModel::Path path (iter);
for (;;)
{
if (path.prev())
{
iter = parent->children()[path.back()];
if ((*iter)[columns.matchcount] > 0)
{
if (const Gtk::TreeModel::Children& children = iter->children()) // directory?
{
parent = iter;
path.push_back(children.size());
continue;
}
return true;
}
}
else if (parent)
{
parent = parent->parent();
path.up();
if (collapse)
*collapse = path;
}
else
break;
}
return false;
}
void FileTree::expand_and_select(const Gtk::TreePath& path)
{
expand_to_path(path);
......
......@@ -136,9 +136,6 @@ private:
const Gtk::TreeModel::iterator& iter,
ReplaceMatchesData* replace_data);
bool next_match_file(Gtk::TreeModel::iterator& iter, Gtk::TreeModel::Path* collapse = 0);
bool prev_match_file(Gtk::TreeModel::iterator& iter, Gtk::TreeModel::Path* collapse = 0);
void expand_and_select(const Gtk::TreePath& path);
void on_treestore_rows_reordered(const Gtk::TreeModel::Path& path,
......
......@@ -60,6 +60,87 @@ int collatekey_sort_func(const Gtk::TreeModel::iterator& lhs, const Gtk::TreeMod
return (lhs_key.size() - rhs_key.size());
}
bool next_match_file(Gtk::TreeModel::iterator& iter, Gtk::TreeModel::Path* collapse)
{
g_return_val_if_fail(iter, false);
const FileTreeColumns& columns = FileTreeColumns::instance();
Gtk::TreeModel::iterator parent = iter->parent();
for (++iter;;)
{
if (iter)
{
if ((*iter)[columns.matchcount] > 0)
{
if (const Gtk::TreeModel::Children& children = iter->children()) // directory?
{
parent = iter;
iter = children.begin();
continue;
}
return true;
}
}
else if (parent)
{
iter = parent;
parent = iter->parent();
if (collapse)
*collapse = iter;
}
else
break;
++iter;
}
return false;
}
bool prev_match_file(Gtk::TreeModel::iterator& iter, Gtk::TreeModel::Path* collapse)
{
g_return_val_if_fail(iter, false);
const FileTreeColumns& columns = FileTreeColumns::instance();
Gtk::TreeModel::iterator parent = iter->parent();
Gtk::TreeModel::Path path (iter);
for (;;)
{
if (path.prev())
{
iter = parent->children()[path.back()];
if ((*iter)[columns.matchcount] > 0)
{
if (const Gtk::TreeModel::Children& children = iter->children()) // directory?
{
parent = iter;
path.push_back(children.size());
continue;
}
return true;
}
}
else if (parent)
{
parent = parent->parent();
path.up();
if (collapse)
*collapse = path;
}
else
break;
}
return false;
}
} // namespace FileTreePrivate
......
......@@ -68,6 +68,9 @@ FileInfoPtr get_fileinfo_from_iter(const Gtk::TreeModel::iterator& iter)
int default_sort_func (const Gtk::TreeModel::iterator& lhs, const Gtk::TreeModel::iterator& rhs);
int collatekey_sort_func(const Gtk::TreeModel::iterator& lhs, const Gtk::TreeModel::iterator& rhs);
bool next_match_file(Gtk::TreeModel::iterator& iter, Gtk::TreeModel::Path* collapse = 0);
bool prev_match_file(Gtk::TreeModel::iterator& iter, Gtk::TreeModel::Path* collapse = 0);
typedef std::pair<std::string,Gtk::TreeModel::iterator> DirNodePair;
typedef std::list<DirNodePair> DirStack;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment