Commit 51a0712b authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Emit boot relative Pin/AddTinyDir commands where possible

When saving the desktop settings, use the same substring matching logic that !Configure's boot addapps/lookat/run uses, and replace the base of the name with Boot: or Boot:^.
This means that if the boot drive is renamed the pinboard still starts up with the same items on it.
Ditch support for Message_SaveDesktop - the code's been a NOP since Ursula (circa 1998).
Tested on a Raspberry Pi, renaming the SD card.

Version 1.01. Tagged as 'Pinboard-1_01'
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.00"
Module_Version SETA 100
Module_MajorVersion SETS "1.01"
Module_Version SETA 101
Module_MinorVersion SETS ""
Module_Date SETS "08 May 2016"
Module_ApplicationDate SETS "08-May-16"
Module_Date SETS "10 May 2016"
Module_ApplicationDate SETS "10-May-16"
Module_ComponentName SETS "Pinboard"
Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/Pinboard"
Module_FullVersion SETS "1.00"
Module_HelpVersion SETS "1.00 (08 May 2016)"
Module_FullVersion SETS "1.01"
Module_HelpVersion SETS "1.01 (10 May 2016)"
END
/* (1.00)
/* (1.01)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.00
#define Module_MajorVersion_CMHG 1.01
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 May 2016
#define Module_Date_CMHG 10 May 2016
#define Module_MajorVersion "1.00"
#define Module_Version 100
#define Module_MajorVersion "1.01"
#define Module_Version 101
#define Module_MinorVersion ""
#define Module_Date "08 May 2016"
#define Module_Date "10 May 2016"
#define Module_ApplicationDate "08-May-16"
#define Module_ApplicationDate "10-May-16"
#define Module_ComponentName "Pinboard"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/Pinboard"
#define Module_FullVersion "1.00"
#define Module_HelpVersion "1.00 (08 May 2016)"
#define Module_LibraryVersionInfo "1:0"
#define Module_FullVersion "1.01"
#define Module_HelpVersion "1.01 (10 May 2016)"
#define Module_LibraryVersionInfo "1:1"
......@@ -87,9 +87,6 @@ message_received
TEQ r0, r14
BEQ close_task
TEQ r0, #Message_SaveDesktop
BEQ DesktopSave
LDR r14, =Message_HelpRequest
TEQ r0, r14
BEQ HelpRequest
......
......@@ -279,6 +279,8 @@ drag_start # 8 ; x,y of iconized drag start
drag_window # 4
drag_icon # 4
save_filename_address # 4
save_boot_length # 4
save_boothat_length # 4
icon_bar_height # 4
;EventV_Claimed # 4 ; non-zero when we have EventV claimed
CaretPos # 4*6 ; stored caret position (e.g. who we took it from)
......
......@@ -14,7 +14,7 @@
;
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; s.Save
; Save and Desktop save handling.
; Save pinboard menu handling.
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -218,17 +218,8 @@ Save_DataSaveAck ROUT
DebugS sa,"Filename is ",r14
;MOV r0,#&8F
ADD r1,r1,#44
;DebugS sa,"Filename is ",r1
;SWI XOS_Find
;Pull "PC",VS
;Push "r0" ; SMC: save file handle for CloseFile
BL DoSave
;BL CloseFile
;ADD sp, sp, #4 ; SMC: don't need file handle now
;Pull "PC",VS ; SMC: return error from DoSave or CloseFile
ADR r1,dataarea
LDR r0,[r1,#8]
......@@ -253,12 +244,6 @@ Save_DataSaveAck ROUT
Pull "PC"
DesktopSave
;LDR r0, [r1, #msSaveDesktop_handle]
;BL DoSave
Pull "PC"
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; DoSave
;
......@@ -272,6 +257,36 @@ DoSave ROUT
MOV r8, r1 ; r8 -> filename
; Get substrings of Boot:
ADR r0, BootPathVar
ADR r1, dest_directory
MOV r2, #?dest_directory
MOV r3, #0
MOV r4, #VarType_Expanded
SWI XOS_ReadVarVal
MOV r0, #0
STRVCB r0, [r1, r2] ; FSName::Drive.$.![Arm]Boot.[,OtherStuff]...
BVS %FT20
10
LDRB lr, [r1, r0]
CMP lr, #','
BEQ %FT20
CMP lr, #' '
ADDHI r0, r0, #1
BHI %BT10
20
STR r0, save_boot_length ; FSName::Drive.$.![Arm]Boot.
STR r0, save_boothat_length
SUBS r0, r0, #2
BMI %FT40
30
LDRB lr, [r1, r0]
CMP lr, #'.'
BEQ %FT40
STR r0, save_boothat_length ; FSName::Drive.$.
SUBS r0, r0, #1
BPL %BT30
40
; Open file to write
MOV r0, #open_write :OR: open_pathbits :OR: open_mustopen :OR: open_nodir
MOV r1, r8
......@@ -304,9 +319,57 @@ DoSave ROUT
PinboardCommand DCB "Pinboard",0
TinyDirsCommand DCB "X AddTinyDir ", 0 ; ignore errors so that entering the desktop
PinCommand DCB "X Pin ", 0 ; doesn't result in scores of error boxes
BootPathVar DCB "Boot$$Path", 0
BootSubst DCB "Boot:", 0
BootHatSubst DCB "Boot:^.", 0
Space DCB " ", 0
NL DCB 10, 0
ALIGN
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; TryMatchBoot[Hat]
;
; Look for a match in the first <n> characters of a pin or addtinydir name
;
; In: r0 = filehandle of output
; r1 = null terminated string to try for a match
;
; Out: r1 = adjusted if match made, and prefix string written to filehandle
; all other regs preserved
TryMatchBoot Entry "r2-r5"
LDR r3, save_boot_length
ADR r4, BootSubst
B %FT10
TryMatchBootHat ALTENTRY
LDR r3, save_boothat_length
ADR r4, BootHatSubst
10
TEQ r3, #0
EXIT EQ ; Boot$Path unset, no match
ADR r2, dest_directory
LDRB r5, [r1, r3]
LDRB lr, [r2, r3]
Push "r0, r3, r5, lr"
MOV r5, #0
STRB r5, [r1, r3] ; Trim string for compare
STRB r5, [r2, r3] ; Trim Boot$Path for compare
MOV r0, #-1
MOV r3, #Collate_IgnoreCase
SWI XTerritory_Collate
CMP r0, #0
Pull "r0, r3, r5, lr"
STRB r5, [r1, r3] ; Restore
STRB lr, [r2, r3] ; Restore
EXIT NE ; No match (or error)
MOV r2, r1
MOV r1, r4
BL PutString
ADD r1, r2, r3 ; Adjust to string remainder
EXIT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; write_pin_commands
......@@ -325,20 +388,23 @@ write_pin_commands Entry "r1-r3"
CMP r2,#0
EXIT EQ
LDR r3,[r2,#ic_window]
CMP r3,#-2
CMP r3,#iconbar_whandle
ADREQ r1,TinyDirsCommand
ADRNE r1,PinCommand
BL PutString
EXIT VS
ADD r1,r2,#ic_path
BL TryMatchBoot
ADD lr,r2,#ic_path
TEQ lr,r1 ; Was there a substitution?
BLEQ TryMatchBootHat ; No, so try the smaller substring
BL PutString
EXIT VS
ADREQ r1,NL
BLEQ PutString
EXIT VS
BEQ %BT02
CMP r3,#iconbar_whandle
BEQ %FT03 ; AddTinyDir has no x,y
ADR r1,Space
BL PutString
EXIT VS
......@@ -346,9 +412,6 @@ write_pin_commands Entry "r1-r3"
Push "r0-r2"
ADR r1,ConversionSpace
LDR r0,[r2,#ic_x]
CMP r0,#0
MOVLT r2,#"0"
STRLTB r2,[r1],#1
MOV r2,#256
SWI XOS_ConvertInteger4
STRVS r0,[sp]
......@@ -357,6 +420,7 @@ write_pin_commands Entry "r1-r3"
ADR r1,ConversionSpace
BL PutString
EXIT VS
ADRL r1,Space
BL PutString
EXIT VS
......@@ -372,6 +436,7 @@ write_pin_commands Entry "r1-r3"
ADR r1,ConversionSpace
BL PutString
EXIT VS
03
ADRL r1,NL
BL PutString
EXIT VS
......
......@@ -73,7 +73,6 @@ MessagesList
[ :LNOT: ursulawimp
DCD Message_PaletteChange
]
DCD Message_SaveDesktop
DCD Message_MenusDeleted
DCD Message_HelpRequest
DCD Message_Iconize
......
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