X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbclistbox.C;h=4a7d7543212c3ff0eb2b53b6240b7fd59d0773fa;hb=fea29181a5e69959e00d520173d66577c2056989;hp=e85cb599d00915743081ba8eeab9fe3351c4401b;hpb=0d37fdc03a4c5eeffef41d15490ebc528079ea52;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bclistbox.C b/cinelerra-5.1/guicast/bclistbox.C index e85cb599..4a7d7543 100644 --- a/cinelerra-5.1/guicast/bclistbox.C +++ b/cinelerra-5.1/guicast/bclistbox.C @@ -2443,6 +2443,14 @@ int BC_ListBox::button_press_event() if( debug ) printf("BC_ListBox::button_press_event %d\n", __LINE__); } + if( current_operation != NO_OPERATION ) { + switch( current_operation ) { + case DRAG_ITEM: + case COLUMN_DRAG: + return drag_stop_event(); + } + } + // Wheel mouse pressed if( get_buttonpress() == 4 ) { if( current_operation == NO_OPERATION ) { @@ -3126,22 +3134,15 @@ int BC_ListBox::drag_start_event() int cx, cy; get_abs_cursor(cx, cy); if( item_return->icon_vframe ) { - cx -= item_return->icon_vframe->get_w() / 2, - cy -= item_return->icon_vframe->get_h() / 2; drag_popup = new BC_DragWindow(this, item_return->icon_vframe, cx, cy); } else -// this probably works not! if( item_return->icon ) { - cx -= item_return->icon->get_w() / 2, - cy -= item_return->icon->get_h() / 2; drag_popup = new BC_DragWindow(this, item_return->icon, cx, cy); } else { - cx -= drag_icon_vframe->get_w() / 2, - cy -= drag_icon_vframe->get_h() / 2; drag_popup = new BC_DragWindow(this, drag_icon_vframe, cx, cy); } @@ -3215,6 +3216,7 @@ int BC_ListBox::drag_motion_event() int BC_ListBox::drag_stop_event() { + int result = 0; switch( current_operation ) { case DRAG_ITEM: unset_repeat(get_resources()->scroll_repeat); @@ -3229,9 +3231,9 @@ int BC_ListBox::drag_stop_event() if( display_format == LISTBOX_ICONS ) { reposition_item(data, selection_number, - top_level->cursor_x + drag_popup->get_offset_x() - + top_level->cursor_x - drag_popup->get_w() / 2 - LISTBOX_MARGIN - 2 + xposition, - top_level->cursor_y + drag_popup->get_offset_y() - + top_level->cursor_y - drag_popup->get_h() / 2 - LISTBOX_MARGIN - 2 + yposition); } else @@ -3255,13 +3257,8 @@ int BC_ListBox::drag_stop_event() } else drag_popup->drag_failure_event(); - - delete drag_popup; - flush(); - drag_popup = 0; - current_operation = NO_OPERATION; - new_value = 0; - return 1; + result = 1; + break; case COLUMN_DRAG: if( dragged_title != highlighted_title ) { @@ -3271,13 +3268,18 @@ int BC_ListBox::drag_stop_event() else drag_popup->drag_failure_event(); } + result = 1; + } + + if( result ) { current_operation = NO_OPERATION; delete drag_popup; flush(); drag_popup = 0; - return 1; + new_value = 0; } - return 0; + + return result; } BC_DragWindow* BC_ListBox::get_drag_popup()