mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-16 15:49:24 +03:00
Trap RMB and select the node under the pointer if no other node selected
svn path=/trunk/netsurf/; revision=13146
This commit is contained in:
parent
36599a09ce
commit
dd267bd90a
29
amiga/tree.c
29
amiga/tree.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008 - 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
|
* Copyright 2008 - 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
|
||||||
*
|
*
|
||||||
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
||||||
*
|
*
|
||||||
@ -95,6 +95,7 @@ struct treeview_window {
|
|||||||
int max_height;
|
int max_height;
|
||||||
struct gui_globals globals;
|
struct gui_globals globals;
|
||||||
struct sslcert_session_data *ssl_data;
|
struct sslcert_session_data *ssl_data;
|
||||||
|
BOOL rmbtrapped;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ami_tree_draw(struct treeview_window *twin);
|
void ami_tree_draw(struct treeview_window *twin);
|
||||||
@ -840,6 +841,26 @@ BOOL ami_tree_event(struct treeview_window *twin)
|
|||||||
|
|
||||||
GetAttr(SPACE_AreaBox, twin->objects[GID_BROWSER], (ULONG *)&bbox);
|
GetAttr(SPACE_AreaBox, twin->objects[GID_BROWSER], (ULONG *)&bbox);
|
||||||
|
|
||||||
|
if((twin->win->MouseX - bbox->Left >=0) &&
|
||||||
|
(twin->win->MouseX - bbox->Width - bbox->Left <=0) &&
|
||||||
|
(twin->win->MouseY - bbox->Top >=0) &&
|
||||||
|
(twin->win->MouseY - bbox->Height - bbox->Top <=0))
|
||||||
|
{
|
||||||
|
if(twin->rmbtrapped == FALSE)
|
||||||
|
{
|
||||||
|
SetWindowAttr(twin->win, WA_RMBTrap, (APTR)(BOOL)TRUE, sizeof(BOOL));
|
||||||
|
twin->rmbtrapped = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(twin->rmbtrapped == TRUE)
|
||||||
|
{
|
||||||
|
SetWindowAttr(twin->win, WA_RMBTrap, (APTR)(BOOL)FALSE, sizeof(BOOL));
|
||||||
|
twin->rmbtrapped = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&xs);
|
GetAttr(SCROLLER_Top, twin->objects[OID_HSCROLL], (ULONG *)&xs);
|
||||||
x = twin->win->MouseX - bbox->Left + xs;
|
x = twin->win->MouseX - bbox->Left + xs;
|
||||||
|
|
||||||
@ -920,6 +941,12 @@ BOOL ami_tree_event(struct treeview_window *twin)
|
|||||||
if(twin->drag_x == 0) twin->drag_x = x;
|
if(twin->drag_x == 0) twin->drag_x = x;
|
||||||
if(twin->drag_y == 0) twin->drag_y = y;
|
if(twin->drag_y == 0) twin->drag_y = y;
|
||||||
break;
|
break;
|
||||||
|
case MENUDOWN:
|
||||||
|
if(tree_node_has_selection(tree_get_root(twin->tree)) == false)
|
||||||
|
{
|
||||||
|
tree_set_node_selected_at(twin->tree, x, y, true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2313,6 +2313,29 @@ void tree_launch_selected(struct tree *tree, bool tabs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the node at position x,y to a selected state.
|
||||||
|
* The required areas of the tree are redrawn.
|
||||||
|
*
|
||||||
|
* \param tree the tree to update nodes for, may be NULL
|
||||||
|
* \param x x position in tree
|
||||||
|
* \param y y position in tree
|
||||||
|
* \param selected the selection state to set
|
||||||
|
*/
|
||||||
|
void tree_set_node_selected_at(struct tree *tree, int x, int y, bool selected)
|
||||||
|
{
|
||||||
|
bool expansion_toggle;
|
||||||
|
struct node *node;
|
||||||
|
|
||||||
|
node = tree_get_node_at(tree->root, x, y, &expansion_toggle);
|
||||||
|
|
||||||
|
if ((node == NULL) || (expansion_toggle == true))
|
||||||
|
return;
|
||||||
|
|
||||||
|
tree_set_node_selected(tree, node, false, selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a mouse action for a tree
|
* Handles a mouse action for a tree
|
||||||
*
|
*
|
||||||
|
@ -157,6 +157,7 @@ void tree_set_node_expanded(struct tree *tree, struct node *node, bool expanded,
|
|||||||
bool folder, bool leaf);
|
bool folder, bool leaf);
|
||||||
void tree_set_node_selected(struct tree *tree, struct node *node, bool all,
|
void tree_set_node_selected(struct tree *tree, struct node *node, bool all,
|
||||||
bool selected);
|
bool selected);
|
||||||
|
void tree_set_node_selected_at(struct tree *tree, int x, int y, bool selected);
|
||||||
void tree_set_node_sort_function(struct tree *tree, struct node *node,
|
void tree_set_node_sort_function(struct tree *tree, struct node *node,
|
||||||
int (*sort) (struct node *, struct node *));
|
int (*sort) (struct node *, struct node *));
|
||||||
void tree_set_node_user_callback(struct node *node,
|
void tree_set_node_user_callback(struct node *node,
|
||||||
|
Loading…
Reference in New Issue
Block a user