コード例 #1
0
static void
tree_move_to_child (WTree * tree)
{
    tree_entry *current;

    /* Do we have a starting point? */
    if (!tree->selected_ptr)
        return;
    /* Take the next entry */
    current = tree->selected_ptr->next;
    /* Is it the child of the selected entry */
    if (current && current->sublevel > tree->selected_ptr->sublevel)
    {
        /* Yes -> select this entry */
        tree->selected_ptr = current;
        tree->topdiff++;
        tree_check_focus (tree);
    }
    else
    {
        /* No -> rescan and try again */
        tree_rescan (tree);
        current = tree->selected_ptr->next;
        if (current && current->sublevel > tree->selected_ptr->sublevel)
        {
            tree->selected_ptr = current;
            tree->topdiff++;
            tree_check_focus (tree);
        }
    }
}
コード例 #2
0
static int
search_tree (WTree * tree, char *text)
{
    tree_entry *current;
    int len;
    int wrapped = 0;
    int found = 0;

    len = strlen (text);
    current = tree->selected_ptr;
    found = 0;
    while (!wrapped || current != tree->selected_ptr)
    {
        if (strncmp (current->subname, text, len) == 0)
        {
            tree->selected_ptr = current;
            found = 1;
            break;
        }
        current = current->next;
        if (!current)
        {
            current = tree->store->tree_first;
            wrapped = 1;
        }
        tree->topdiff++;
    }
    tree_check_focus (tree);
    return found;
}
コード例 #3
0
static void
tree_move_forward (WTree * tree, int i)
{
    if (!tree_navigation_flag)
        tree->selected_ptr = forw_ptr (tree->selected_ptr, &i);
    else
    {
        tree_entry *current;
        int j = 0;

        current = tree->selected_ptr;
        while (j < i && current->next && current->next->sublevel >= tree->selected_ptr->sublevel)
        {
            current = current->next;
            if (current->sublevel == tree->selected_ptr->sublevel)
            {
                tree->selected_ptr = current;
                j++;
            }
        }
        i = j;
    }

    tree->topdiff += i;
    tree_check_focus (tree);
}
コード例 #4
0
void
tree_chdir (WTree * tree, const vfs_path_t * dir)
{
    tree_entry *current;

    current = tree_store_whereis (dir);
    if (current != NULL)
    {
        tree->selected_ptr = current;
        tree_check_focus (tree);
    }
}
コード例 #5
0
ファイル: tree.c プロジェクト: GalaxyTab4/workbench
void
tree_chdir (WTree * tree, const char *dir)
{
    vfs_path_t *vpath;
    tree_entry *current;

    vpath = vfs_path_from_str (dir);
    current = tree_store_whereis (vpath);
    if (current != NULL)
    {
        tree->selected_ptr = current;
        tree_check_focus (tree);
    }
    vfs_path_free (vpath);
}
コード例 #6
0
static gboolean
tree_move_to_parent (WTree * tree)
{
    tree_entry *current;
    tree_entry *old;

    if (!tree->selected_ptr)
        return FALSE;

    old = tree->selected_ptr;
    current = tree->selected_ptr->prev;
    while (current && current->sublevel >= tree->selected_ptr->sublevel)
    {
        current = current->prev;
        tree->topdiff--;
    }
    if (!current)
        current = tree->store->tree_first;
    tree->selected_ptr = current;
    tree_check_focus (tree);
    return tree->selected_ptr != old;
}