Commit 30c0dbf5 authored by Andy Vawer's avatar Andy Vawer Committed by ROOL

Fixes for dropping text into writable icons

* If dragging text from a writable icon and the source text or selection disappears during the drag, an ofla error occurs. Change to abort quietly (ie no text copied as nothing to copy) and remove the ghost caret from view.
* Remove ghost caret on invalid dropped drags
* Either use correct insert point from ghost caret when receiving a drag, or use current mouse coords for the destination if no ghost caret present.
* Change datasave handling to check ghost caret presence for the destination rather than trying to check the enhanced datasave state.
* Use window X coord for drop rather than screen Xcoord to ensure correct insert point.

Fixes dragging multiline text areas from Draw leaving a ghost caret when it failed, and dragging a basic text object from Draw now inserts at the correct place.

Version 5.80. Tagged as 'Wimp-5_80'
parent 5e0e65cc
......@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
Module_MajorVersion SETS "5.79"
Module_Version SETA 579
Module_MajorVersion SETS "5.80"
Module_Version SETA 580
Module_MinorVersion SETS ""
Module_Date SETS "12 Sep 2020"
Module_ApplicationDate SETS "12-Sep-20"
Module_Date SETS "17 Oct 2020"
Module_ApplicationDate SETS "17-Oct-20"
Module_ComponentName SETS "Wimp"
Module_FullVersion SETS "5.79"
Module_HelpVersion SETS "5.79 (12 Sep 2020)"
Module_FullVersion SETS "5.80"
Module_HelpVersion SETS "5.80 (17 Oct 2020)"
END
/* (5.79)
/* (5.80)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 5.79
#define Module_MajorVersion_CMHG 5.80
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 12 Sep 2020
#define Module_Date_CMHG 17 Oct 2020
#define Module_MajorVersion "5.79"
#define Module_Version 579
#define Module_MajorVersion "5.80"
#define Module_Version 580
#define Module_MinorVersion ""
#define Module_Date "12 Sep 2020"
#define Module_Date "17 Oct 2020"
#define Module_ApplicationDate "12-Sep-20"
#define Module_ApplicationDate "17-Oct-20"
#define Module_ComponentName "Wimp"
#define Module_FullVersion "5.79"
#define Module_HelpVersion "5.79 (12 Sep 2020)"
#define Module_LibraryVersionInfo "5:79"
#define Module_FullVersion "5.80"
#define Module_HelpVersion "5.80 (17 Oct 2020)"
#define Module_LibraryVersionInfo "5:80"
......@@ -1092,7 +1092,7 @@ cbtask_copy
BNE %BT01
Pull "R0-R2,PC"
cbtask_report_error_msgtrans
cbtask_report_error_msgtrans ROUT
; R0->error block
ADRL R1,message_block
MOV R2,#0
......@@ -1304,14 +1304,7 @@ cbtask_dragging_x_to_work_x
; Message_DataSave received
cbtask_datasave_rx
; we have received a datasave. We need to see if it's an enhanced one or not.
LDR R0,[R1,#ms_yourref]
TEQ R0,#0
LDRNEB R0,[R11,#cbtask_var_claiming]
TEQNE R0,#CNPFALSE
BEQ %FT50 ; simple drop, not enhanced one
; enhanced drag/drop
; we have received a datasave.
; clear states
MOV R0,#CNPFALSE
STRB R0,[R11,#cbtask_var_claiming]
......@@ -1341,13 +1334,16 @@ cbtask_datasave_rx
50
; simple drop : import data to position if possible
; determine data insert point from message x/y coords
ADD R1,R11,#cbtask_pollblock
LDR R0,[R1,#msDataTransfer_window]
LDR R2,[R1,#msDataTransfer_x]
LDR R3,[R1,#msDataTransfer_y]
LDR R2,[R1,#msDataTransfer_x] ; is screen coord. Need to adjust to window coords
BL cbtask_dragging_x_to_work_x
LDR R3,[R1,#msDataTransfer_y] ; not so important
LDR R1,[R1,#msDataTransfer_icon]
MOV R5,#-1
51
; set caret position ready to receive data
MOV R4,#-1
MOV R9,R1 ; window/icon handles for pastedata_perform below
MOV R8,R0 ; ditto
SWI XWimp_SetCaretPosition
......@@ -1932,7 +1928,11 @@ cbtask_send_message_datasave
STMIA R7!,{R5,R6} ; store window/icon only
STMIA R7,{R2,R3} ; store x/y only
BL cbtask_get_selected_text ; transfers text to clipboard_flexblock_dragdata
LDR R10,selectionwindow
CMP R10,#-1
SETV EQ
BLVC cbtask_get_selected_text ; transfers text to clipboard_flexblock_dragdata
BVS cbtask_poll
; do the datasave stuff
ADD R1,R11,#cbtask_pollblock
......@@ -1941,19 +1941,16 @@ cbtask_send_message_datasave
B cbtask_run_datasave
cbtask_get_selected_text
; R10 contains window handle of selection
Push "R14"
; obtain the data we want to send so we can work out length etc
; get pointer to icon data
LDR R10,selectionwindow ; selection window handle
CMP R10,#-1 ; for some reason, it's no longer valid
SETV EQ
Pull "PC",VS ; bail out with error
Abs R10,R10
LDR R6,[R10,#w_seldata+wselicon] ; icon handle of selected text
MOV R7,#clipboard_flexblock_dragdata
BL cbtask_get_icon_text
BVS cbtask_poll
Pull "PC",VS
; we have the icon text. Now adjust so we just have the selected text.
MOV R0,#clipboard_flexblock_dragdata
......@@ -2094,10 +2091,23 @@ cbtask_dragdrop_internal_xfer
MOV R0,#af_scrollicon
SWI XWimp_AutoScroll ; stop autoscroll
BL cbtask_get_selected_text ; transfers text to clipboard_flexblock_dragdata
MOVVS R9,#CNPFALSE
BVS cbtask_export_finished
LDR R10,selectionwindow
CMP R10,#-1
SETV EQ
BLVC cbtask_get_selected_text ; transfers text to clipboard_flexblock_dragdata
BVC %FT66
; failed to get source text. Remove ghost caret
MOV R0,#-1
LDR R2,cbtask_TASK3
MOV R4,#crf_ghostcaret
SWI XWimp_SetCaretPosition
; and abort the transfer
MOV R9,#CNPFALSE
B cbtask_export_finished
66
LDR R7,ghostcaretdata+ghostcaretindex ; text insert position
LDR R8,ghostcaretdata+ghostcaretwindow ; window
LDR R9,ghostcaretdata+ghostcareticon ; icon
......
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