Commit 37aa211c authored by David Brown's avatar David Brown
Browse files

Canceling of drags implemented

parent bece97ef
......@@ -120,6 +120,7 @@ static ToolboxEventHandler hotlist_reset_url_handler;
static ToolboxEventHandler hotlist_reset_directory_handler;
static ToolboxEventHandler hotlist_show_descriptions_handler;
static ToolboxEventHandler hotlist_show_urls_handler;
static ToolboxEventHandler hotlist_drag_stop_handler;
static WimpMessageHandler hotlist_data_save_ack_handler;
static WimpMessageHandler hotlist_ram_fetch_handler;
......@@ -1079,7 +1080,7 @@ static int hotlist_clear_flags(hotlist_item * list, hotlist_type type, unsigned
if (type == hl_ALL || type == list->type)
{
if (list->flags & ~flags != list->flags)
if ((list->flags & ~flags) != list->flags)
{
list->flags |= HOTLIST_G_REDRAW_NOW;
changed = 1;
......@@ -3247,6 +3248,11 @@ _kernel_oserror * hotlist_initialise(void)
hotlist_ram_fetch_handler,
NULL));
RetError(event_register_toolbox_handler(-1,
HotlistEscape,
hotlist_drag_stop_handler,
NULL));
return NULL;
}
......@@ -4052,6 +4058,53 @@ void hotlist_start_drag(void)
// return 0;
// }
/*************************************************/
/* hotlist_drag_stop_handler() */
/* */
/* Terminates any hotlist drag in progress */
/*************************************************/
static int hotlist_drag_stop_handler(int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle)
{
if (hotlist_current_highlighted)
{
hotlist_current_highlighted->flags &= ~HOTLIST_D_IS_HIGHLIGHTED;
hotlist_redraw_items(highlighted_itemno, highlighted_itemno);
hotlist_current_highlighted = NULL;
}
switch(hotlist_dragging)
{
default:
return 0;
break;
case HOTLIST_SOLID_DRAG_OBJECT:
/* Stop drag an object */
_swix(DragAnObject_Stop, 0);
deregister_null_claimant(Wimp_ENull, hotlist_null_handler, NULL);
hotlist_dragging = 0;
break;
case HOTLIST_SOLID_DRAG_SPRITE:
/* Stop drag a sprite */
_swix(DragASprite_Stop, 0);
deregister_null_claimant(Wimp_ENull, hotlist_null_handler, NULL);
hotlist_dragging = 0;
break;
case HOTLIST_BOX_DRAG_SELECTION:
/* Stop drag box */
wimp_drag_box(NULL);
deregister_null_claimant(Wimp_ENull, hotlist_null_drag_select_handler, NULL);
hotlist_clear_flags(hotlist_root->data.directory_content, hl_ALL, HOTLIST_G_DRAG_SELECTED);
hotlist_redraw_now();
hotlist_dragging = 0;
break;
}
return 1;
}
/*************************************************/
/* hotlist_drag_completed_handler() */
/* */
......
......@@ -58,6 +58,8 @@
#define HotlistShowDesc 0x3013
#define HotlistShowURLs 0x3014
#define HotlistEscape 0x3015
/* Enumerations */
typedef enum hotlist_type
......
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