annotate src/menu_processor.inc @ 628:cd58f7fc86db

3.05 stable work
author heinrichsweikamp
date Thu, 19 Sep 2019 12:01:29 +0200
parents c40025d8e750
children 4050675965ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
3 ; File menu_processor.asm combined next generation V3.0.4b
0
heinrichsweikamp
parents:
diff changeset
4 ;
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 169
diff changeset
5 ; Routines to handle all OSTC graphic/text menus.
0
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2011-05-30 : [jDG] Creation.
heinrichsweikamp
parents:
diff changeset
11
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
12 ; restart menu-system from first icon/line
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
13 extern menu_processor_reset
0
heinrichsweikamp
parents:
diff changeset
14
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
15 ; recall last (automatically) saved icon/line when returning from submenu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
16 extern menu_processor_pop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
17 extern menu_processor_double_pop
0
heinrichsweikamp
parents:
diff changeset
18
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
19 ; execute the menu block
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
20 extern menu_processor
169
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 0
diff changeset
21
0
heinrichsweikamp
parents:
diff changeset
22 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
23 ; Menus parameters
heinrichsweikamp
parents:
diff changeset
24
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
25 ;NOTE: needs to be identical in .inc and .asm files!
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
26 #define MENU_LINES_MAX .7 ; max number of lines per screen
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
27 #define MENU_HEIGHT .27 ; spacing on screen
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
28 #define MENU_VCENTER .125 ; position on screen
0
heinrichsweikamp
parents:
diff changeset
29
heinrichsweikamp
parents:
diff changeset
30 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
31
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
32 COMMON_BEGIN_MENU MACRO dynamic, txt, nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
33 local center
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
34
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
35 If nb_items > MENU_LINES_MAX
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
36 center set MENU_VCENTER - (MENU_HEIGHT/2) * MENU_LINES_MAX
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
37 Else
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
38 center set MENU_VCENTER - (MENU_HEIGHT/2) * nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
39 Endif
0
heinrichsweikamp
parents:
diff changeset
40
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
41 If nb_items <= 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
42 Error "Zero items in menu ", x
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
43 Endif
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
44
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
45 extern txt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
46 call menu_processor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
47
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
48 ; Push 6 bytes of menu header data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
49 db nb_items, dynamic
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
50 db LOW(txt), HIGH(txt)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
51 db UPPER(txt), center
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
52 ENDM
0
heinrichsweikamp
parents:
diff changeset
53
heinrichsweikamp
parents:
diff changeset
54 ;=============================================================================
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
55
0
heinrichsweikamp
parents:
diff changeset
56 ; Macro to generat (and check) menu vertical menu blocks with data.
heinrichsweikamp
parents:
diff changeset
57
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
58 MENU_BEGIN MACRO menu_title, nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
59 COMMON_BEGIN_MENU 0, menu_title, nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
60 ENDM
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
61
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
62 MENU_BEGIN_DYNAMIC MACRO title_proc, nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
63 COMMON_BEGIN_MENU 1, title_proc, nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
64 ENDM
0
heinrichsweikamp
parents:
diff changeset
65
heinrichsweikamp
parents:
diff changeset
66 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
67
heinrichsweikamp
parents:
diff changeset
68 ; Submenu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
69
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
70 MENU_CALL MACRO txt, proc
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
71 extern txt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
72 db 0, 0, 0, 0
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
73 db LOW(proc), HIGH(proc), UPPER(proc), 0
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
74 db LOW(txt), HIGH(txt)
0
heinrichsweikamp
parents:
diff changeset
75 ENDM
heinrichsweikamp
parents:
diff changeset
76
heinrichsweikamp
parents:
diff changeset
77 ; Generic option menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
78
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
79 MENU_OPTION MACRO txt, option, callback
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
80 extern txt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
81 extern option
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
82 db 2, LOW(callback), HIGH(callback), UPPER(callback)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
83 db LOW(option), HIGH(option), UPPER(option), 0
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
84 db LOW(txt), HIGH(txt)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
85 ENDM
0
heinrichsweikamp
parents:
diff changeset
86
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
87 MENU_DYNAMIC MACRO callback, proc
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
88 extern callback
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
89 db 3, LOW(callback), HIGH(callback), UPPER(callback)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
90 db LOW(proc), HIGH(proc), UPPER(proc), 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
91 db 0, 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
92 ENDM
0
heinrichsweikamp
parents:
diff changeset
93
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
94 MENU_END MACRO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 582
diff changeset
95 ENDM