Commits (2)
  • Robert Sprowson's avatar
    Store choices alongside the Alarms, get out of CMOS · fed41f1c
    Robert Sprowson authored
    Per ticket #471 the ROM app's use of system variables to store their choices harks back to a time when the Choices/Choices$Write system didn't exist. Doubly so for Alarm which stores 5 of its settings in CMOS, 3 in an obey file, plus another (potentially inconsistent) set in the desktop boot file for good measure.
    
    Consolidate these into a single choices file, and no longer write out Alarm$Options as part of the Message_SaveDesktop Wimp message. This also frees up 7 bits of CMOS.
    
    Version 2.94. Tagged as 'Alarm-2_94'
    fed41f1c
  • Robert Sprowson's avatar
    Fade seconds label when continuous beep · 8248b1e8
    Robert Sprowson authored
    In the choices window, fade 'seconds' when the number field is also faded.
    
    Version 2.95. Tagged as 'Alarm-2_95'
    8248b1e8
;
; This file is automatically maintained by srccommit, do not edit manually.
; Last processed by srccommit version: 1.1.
;
GBLS Module_MajorVersion
GBLA Module_Version
......@@ -10,14 +9,12 @@
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.93"
Module_Version SETA 293
Module_MajorVersion SETS "2.95"
Module_Version SETA 295
Module_MinorVersion SETS ""
Module_Date SETS "17 Mar 2018"
Module_ApplicationDate SETS "17-Mar-18"
Module_Date SETS "18 Apr 2020"
Module_ApplicationDate SETS "18-Apr-20"
Module_ComponentName SETS "Alarm"
Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Alarm"
Module_FullVersion SETS "2.93"
Module_HelpVersion SETS "2.93 (17 Mar 2018)"
Module_FullVersion SETS "2.95"
Module_HelpVersion SETS "2.95 (18 Apr 2020)"
END
/* (2.93)
/* (2.95)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.93
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 17 Mar 2018
#define Module_MajorVersion_CMHG 2.95
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 18 Apr 2020
#define Module_MajorVersion "2.93"
#define Module_Version 293
#define Module_MajorVersion "2.95"
#define Module_Version 295
#define Module_MinorVersion ""
#define Module_Date "17 Mar 2018"
#define Module_Date "18 Apr 2020"
#define Module_ApplicationDate "17-Mar-18"
#define Module_ApplicationDate "18-Apr-20"
#define Module_ComponentName "Alarm"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Alarm"
#define Module_FullVersion "2.93"
#define Module_HelpVersion "2.93 (17 Mar 2018)"
#define Module_LibraryVersionInfo "2:93"
#define Module_FullVersion "2.95"
#define Module_HelpVersion "2.95 (18 Apr 2020)"
#define Module_LibraryVersionInfo "2:95"
......@@ -296,11 +296,13 @@ DEFPROCopen_setup
PROCsetstate(setup%,ic_setup_cont_beep%,1<<21,1<<21)
PROCsetstate(setup%,ic_setup_beep_off%,0,1<<21)
PROCsetstate(setup%,ic_setup_beep_time%,1<<22,1<<22)
PROCsetstate(setup%,ic_setup_seconds_label%,1<<22,1<<22)
ELSE
PROCsetstate(setup%,ic_setup_cont_beep%,0,1<<21)
PROCsetstate(setup%,ic_setup_beep_off%,1<<21,1<<21)
PROCset_string(setup%,ic_setup_beep_time%,STR$(global_timeout%))
PROCsetstate(setup%,ic_setup_beep_time%,0,1<<22)
PROCsetstate(setup%,ic_setup_seconds_label%,0,1<<22)
ENDIF
IFalarm_autosave% THEN
PROCsetstate(setup%,ic_setup_auto_database%,1<<21,1<<21)
......@@ -385,8 +387,10 @@ DEFPROCcheck_setup_window(P%,M%,I%)
PROCsetstate(setup%,ic_setup_user_string%,0,1<<22)
WHEN ic_setup_cont_beep%:PROCsetstate(setup%,I%,1<<21,1<<21)
PROCsetstate(setup%,ic_setup_beep_time%,1<<22,1<<22)
PROCsetstate(setup%,ic_setup_seconds_label%,1<<22,1<<22)
WHEN ic_setup_beep_off%:PROCsetstate(setup%,I%,1<<21,1<<21)
PROCsetstate(setup%,ic_setup_beep_time%,0,1<<22)
PROCsetstate(setup%,ic_setup_seconds_label%,0,1<<22)
ENDCASE
IF (I% >= ic_setup_analogue_ws%) AND (I% <= ic_setup_hh_mm_ss%) THEN
PROCsetstate(setup%,ic_setup_user_string%,1<<22,1<<22)
......
......@@ -179,44 +179,53 @@ DEFPROCinit_heap_constants
ENDPROC
:
DEFPROCinit_config
LOCAL i%,j%
SYS"OS_Byte",161,&DC TO ,,i%
IF(i% AND %111)=0 i%=%00001001
format% =(i% AND %111)
alarm_confirm% =((i% AND %1000)<>0)
alarm_autosave%=((i% AND %10000)<>0)
fivedayweek% =((i% AND %100000)<>0)
silent_alarm% =((i% AND %1000000)<>0)
$Q1%=FNread_system_string("Alarm$Options","")
REM format is -timeout value -weekwork days -format string
SYS"XOS_ReadArgs","timeout/k,weekwork/k,format/k",Q1%,Q%,2048 TO ;i%
IF(i% AND 1) THEN !Q%=0:Q%!4=0:Q%!8=0
LOCAL i%,j%,opts%,pos%,line$,value$
REM Preset the defaults
format%=-1
opts%=-1
global_timeout%=-1
userformat$="%z12:%mi:%se %pm. %zdy/%zmn/%yr"
REM Timeout
IFQ%!0 THEN
global_timeout%=VAL(FNrtoz(!Q%))
ELSE
global_timeout%=10
ENDIF
?cur_clock%=3:SYS"OS_Word",14,cur_clock%
SYS"Territory_ReadCalendarInformation",-1,cur_clock%,Q2%
global_weekwork%=0
FORi%=1 TO 7
IFi%>=Q2%!0 AND i%<=Q2%!4 global_weekwork%+=(1<<(i%-1))
NEXT
REM Working week
IFQ%!4 THEN
global_weekwork%=VAL(FNrtoz(Q%!4))
ELSE
?cur_clock%=3:SYS"OS_Word",14,cur_clock%
SYS"Territory_ReadCalendarInformation",-1,cur_clock%,Q2%
global_weekwork%=0
FORi%=1 TO 7
IFi%>=Q2%!0 AND i%<=Q2%!4 global_weekwork%+=(1<<(i%-1))
NEXT
i%=OPENIN"Choices:Alarm.Choices"
IFi%<>0 THEN
WHILE NOT EOF#i%
line$=GET$#i%
pos%=INSTR(line$,":"):REM Split point
IF pos%>0 THEN
value$=RIGHT$(line$,LEN(line$)-pos%)
CASE LEFT$(line$,pos%-1) OF
WHEN"Display":
format%=VALvalue$
WHEN"Flags":
opts%=VALvalue$
WHEN"Timeout":
global_timeout%=VALvalue$
WHEN"WeekWork":
global_weekwork%=VALvalue$
WHEN"UserFormat":
userformat$=value$
ENDCASE
ENDIF
ENDWHILE
CLOSE#i%
ENDIF
REM User format
IFQ%!8 THEN
PROCset_string(setup%,ic_setup_user_string%,FNrtoz(Q%!8))
ELSE
PROCset_string(setup%,ic_setup_user_string%,"%z12:%mi:%se %pm. %zdy/%zmn/%yr")
ENDIF
REM Pull format into range
IF format%<1 OR format%>5 THEN format%=1
REM Reset flags if undefined bits set
IF (opts% ANDNOT&78)<>0 THEN opts%=%00001000
alarm_confirm% =((opts% AND %1000)<>0)
alarm_autosave%=((opts% AND %10000)<>0)
fivedayweek% =((opts% AND %100000)<>0)
silent_alarm% =((opts% AND %1000000)<>0)
REM Timeout
IFglobal_timeout%=-1 THEN
......@@ -242,7 +251,7 @@ DEFPROCinit_config
NEXT
REM User format
userformat$=FNread_string(setup%,ic_setup_user_string%)
PROCset_string(setup%,ic_setup_user_string%,userformat$)
PROCset_format(format%)
ENDPROC
:
......@@ -950,7 +959,6 @@ DEFPROCsave_desktop_state
LOCAL ERROR
ON ERROR LOCAL Q%!12=Q%!8:SYS"Wimp_SendMessage",19,Q%,Q%!4:ENDPROC
I%=Q%!20
BPUT#I%,FNbuild_alarm_options
BPUT#I%,"Run "+FNread_system_string("Alarm$Dir","");
IF FNupper(ra$)=FNupper(def_fn$) THEN BPUT#I%,10 ELSE BPUT#I%," "+ra$:REM Append alarms file location if non default
ENDPROC
......
......@@ -427,25 +427,6 @@ REM if we exceed max basic string length then an empty string is returned
SYS"OS_GSTrans",f$,STRING$(255,"*"),254 TO ,f$
=f$
:
DEFFNbuild_alarm_options
LOCAL s$,q$,form$,fix_form$,c$
q$ =CHR$(34)
s$="Set Alarm$Options"
s$+=" -timeout "+q$+STR$(global_timeout%)+q$
s$+=" -weekwork "+STR$(global_weekwork%)
form$ =FNread_string(setup%,ic_setup_user_string%)
fix_form$ =""
REM we need to change '<' to '|<' to preserve variable names
WHILE form$ >""
c$ =LEFT$(form$,1)
form$ =MID$(form$,2)
IF c$ ="<" THEN fix_form$ +="|"
fix_form$ +=c$
ENDWHILE
s$+=" -format "+q$+fix_form$+q$
=s$
:
DEFFNread_system_string(v$,default$)
LOCAL P%
SYS"XOS_ReadVarVal",v$,Q%,-1,0,3 TO ,,P%
......@@ -785,38 +766,26 @@ DEFFNgot_time_setup
=ftype%=8192
DEFPROCsave_config
LOCAL cmos%,cli$,cli2$,i%,opt_file$,f%
cli$ =FNbuild_alarm_options
SYS"OS_CLI",cli$
REM for obey file we must double every % otherwise it will change
REM "%24" into "4" as it think's %2 is a cli parameter
cli2$ =""
WHILE cli$ >""
IF ASC(cli$) =37 THEN cli2$ +="%"
cli2$ +=LEFT$(cli$,1)
cli$ =MID$(cli$,2)
ENDWHILE
opt_file$ ="<Choices$Write>.Boot.Predesk.Alarm"
SYS"XOS_Find",&80,opt_file$ TO i%;f%
LOCAL opts%,i%,f%
SYS"XOS_File",8,"<Choices$Write>.Alarm"
SYS"XOS_Find",&80,"<Choices$Write>.Alarm.Choices" TO i%;f%
IF(f%AND1) THEN
PROCok(FNrtoz(i%+4))
ELSE
BPUT#i%,cli2$
REM Collect various option flags
IFalarm_confirm% opts%=opts% OR %1000
IFalarm_autosave% opts%=opts% OR %10000
IFfivedayweek% opts%=opts% OR %100000
IFsilent_alarm% opts%=opts% OR %1000000
REM Write out
BPUT#i%,"| Choices file for Alarm"
BPUT#i%,"Display:"+STR$format%
BPUT#i%,"Flags:"+STR$opts%
BPUT#i%,"Timeout:"+STR$global_timeout%
BPUT#i%,"WeekWork:"+STR$global_weekwork%
BPUT#i%,"UserFormat:"+FNread_string(setup%,ic_setup_user_string%)
CLOSE#i%
SYS"XOS_File",18,opt_file$,&FEB
ENDIF
SYS"XOS_Byte",161,&DC TO ,,cmos%
cmos%=(cmos% AND &80) OR format% :REM Preserve DST, mix in display format
IFalarm_confirm% cmos%=cmos% OR %1000
IFalarm_autosave% cmos%=cmos% OR %10000
IFfivedayweek% cmos%=cmos% OR %100000
IFsilent_alarm% cmos%=cmos% OR %1000000
SYS"XOS_Byte",162,&DC,cmos% TO i%;f%
IF(f%AND1) THEN PROCok(FNrtoz(i%+4))
ENDPROC
:
DEFPROCsave_setup(filetype%,filesize%,handle%,icon_name$)
......