Commit 2487da00 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix for incorrect menu widths in system font

Width counting of menus in the system font would continue until a control terminator was found, however in the case of a non indirected menu entry of exactly 12 characters there is no terminator, so the menu would be too wide (by however many non terminator bytes happened to follow the menu definition in memory). This would normally end up 16 OS units too wide (because it'd encounter a zero after the menu items flags of the next menu entry).

Version 5.44. Tagged as 'Wimp-5_44'
parent 2ddbcbf5
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.43"
Module_Version SETA 543
Module_MajorVersion SETS "5.44"
Module_Version SETA 544
Module_MinorVersion SETS ""
Module_Date SETS "20 Jul 2014"
Module_ApplicationDate SETS "20-Jul-14"
Module_Date SETS "18 Aug 2014"
Module_ApplicationDate SETS "18-Aug-14"
Module_ComponentName SETS "Wimp"
Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/Wimp"
Module_FullVersion SETS "5.43"
Module_HelpVersion SETS "5.43 (20 Jul 2014)"
Module_FullVersion SETS "5.44"
Module_HelpVersion SETS "5.44 (18 Aug 2014)"
END
/* (5.43)
/* (5.44)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 5.43
#define Module_MajorVersion_CMHG 5.44
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 20 Jul 2014
#define Module_Date_CMHG 18 Aug 2014
#define Module_MajorVersion "5.43"
#define Module_Version 543
#define Module_MajorVersion "5.44"
#define Module_Version 544
#define Module_MinorVersion ""
#define Module_Date "20 Jul 2014"
#define Module_Date "18 Aug 2014"
#define Module_ApplicationDate "20-Jul-14"
#define Module_ApplicationDate "18-Aug-14"
#define Module_ComponentName "Wimp"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/Wimp"
#define Module_FullVersion "5.43"
#define Module_HelpVersion "5.43 (20 Jul 2014)"
#define Module_LibraryVersionInfo "5:43"
#define Module_FullVersion "5.44"
#define Module_HelpVersion "5.44 (18 Aug 2014)"
#define Module_LibraryVersionInfo "5:44"
......@@ -4156,8 +4156,8 @@ fixupmenuwidth_item_loop
LDRB R1,auto_menu_flag
CMP R1,#0
BNE %FT33
LDR R1,[R8]
TST R1,#4 ; is it writeable
LDR R1,[R8, #mi_mflags]
TST R1,#mif_writeable ; is it writeable
STRNEB R1,auto_menu_flag
33
LDR R1, [R8, #mi_iflags]
......@@ -4246,17 +4246,22 @@ fixupmenuwidth_vdu TraceL menuw
TST R0, #mif_longtitle
ADDEQ R2, userblk, #m_title
LDRNE R2, [userblk, #m_title]
MOVEQ R9, #12*16
MOVNE R9, #bignum
; R2 -> string to paint
; R9 = maximum length of string
Trace menuw, "fixupmenuwidth_vdu: title at ", X, R2
MOV R6,#0
01
CMP R6, R9
BCS %FT02 ; Non indirected text buffer ended
LDRB R1,[R2],#1
CMP R1,#32
ADDGE R6,R6,#16 ; 16 OS units per char
BGE %BT01
; R6 = maximum width so far (mpt)
02
; R6 = maximum width so far (osu)
Trace menuw, "fixupmenuwidth_vdu: max so far ", D, R6
;Now start loop for the menu items
......@@ -4267,8 +4272,8 @@ fixupmenuwidth_vdu TraceL menuw
fixupmenuwidth_vdu_item_loop
CMP R5,#0
BNE %FT33
LDR R1,[R8]
TST R1,#4 ; is it writeable
LDR R1,[R8,#mi_mflags]
TST R1,#mif_writeable ; is it writeable
MOVNE R5,R1
33
LDR R1, [R8, #mi_iflags]
......@@ -4280,15 +4285,20 @@ fixupmenuwidth_vdu_item_loop
TST R1, #if_indirected
ADDEQ R2, R8, #mi_idata
LDRNE R2, [R8, #mi_idata]
MOVEQ R9, #12*16
MOVNE R9, #bignum
; R2 -> string to paint
; R9 = maximum length of string
MOV R3,#0
05
CMP R3, R9
BCS %FT06 ; Non indirected text buffer ended
LDRB R1,[R2],#1
CMP R1,#32
ADDGE R3,R3,#16 ; 16 OS units per char
BGE %BT05
06
MOV R2, R3
45
......@@ -4297,7 +4307,7 @@ fixupmenuwidth_vdu_item_loop
CMP R6, R2
MOVLT R6, R2
; R6 = maximum width so far (mpt)
; R6 = maximum width so far (osu)
Trace menuw, "fixupmenuwidth_vdu: max so far ", D, R6
;More items?
......@@ -4307,7 +4317,7 @@ fixupmenuwidth_vdu_item_loop
; R8 -> next item
BEQ fixupmenuwidth_vdu_item_loop
ADD R1, R6, #16 ;add 16 OSU for good luck
ADD R1, R6, #16 ; add half a char either end for good luck
CMP R5,#0
LDRNE R5,[userblk,#m_width]
......@@ -5639,7 +5649,7 @@ cpdcmlp
[ outlinefont
;---------------------------------------------------------------------------
; Stuff for parsing menu entries and justifying the keyboad shortcut
; Stuff for parsing menu entries and justifying the keyboard shortcut
;---------------------------------------------------------------------------
; menu_entry: character_sequence SPACE shortcut;
......
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