root/trunk/max-genlive/gfxboot/dia_modes.inc @ 235

Revision 235, 4.1 KB (checked in by max, 19 months ago)

mario.izquierdo
max-genlive (4.0.max0.46)

  • Update gfxboot-theme-ubuntu package (0.5.20)
    • Better language support
Line 
1% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2%
3% Panel installation modes selector.
4%
5% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6
7
8/modes.selected.append .undef def
9/modes.selected.replace .undef def
10
11
12% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13% Initialise installation modes menu.
14%
15% ( ) ==> ( )
16%
17/modes.init {
18  /xmenu.modes .xm_size array def
19  /xmenu xmenu.modes def
20
21  xmenu .xm_current 0 put
22
23  /modes.gfxconfig listgfxconfig def
24
25  /modes.rawlabels [
26    modes.gfxconfig {
27      dup 0 get 6 strndup dup "label " eq exch free { 1 get } { pop } ifelse
28    } forall
29  ] def
30  /modes.append [
31    modes.gfxconfig {
32      0 get /modes.tmp.key exch def
33      modes.tmp.key 6 strndup dup "label " eq exch free {
34        modes.tmp.key 6 add dup length 8 add string /modes.tmp.str exch def
35        "append %s" modes.tmp.str sprintf
36        modes.tmp.str getgfxconfig
37        modes.tmp.str free
38      } if
39    } forall
40  ] def
41  /modes.replace [
42    modes.gfxconfig {
43      0 get /modes.tmp.key exch def
44      modes.tmp.key 6 strndup dup "label " eq exch free {
45        modes.tmp.key 6 add dup length 9 add string /modes.tmp.str exch def
46        "replace %s" modes.tmp.str sprintf
47        modes.tmp.str getgfxconfig
48        modes.tmp.str free
49      } if
50    } forall
51  ] def
52  /modes.applies [
53    modes.gfxconfig {
54      0 get /modes.tmp.key exch def
55      modes.tmp.key 6 strndup dup "label " eq exch free {
56        modes.tmp.key 6 add dup length 9 add string /modes.tmp.str exch def
57        "applies %s" modes.tmp.str sprintf
58        modes.tmp.str getgfxconfig
59        modes.tmp.str free
60      } if
61    } forall
62  ] def
63  modes.rawlabels length 0 eq {
64    /modes.rawlabels [ txt_mode_normal ] def
65    /modes.append [ .undef ] def
66    /modes.replace [ .undef ] def
67    /modes.applies [ .undef ] def
68  } if
69  /modes.map .undef def
70
71  menu.entry modes.filter
72
73  xmenu .xm_title /txt_modes put
74} def
75
76
77% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
78% Update installation modes status.
79%
80% ( ) ==> ( )
81%
82/modes.update {
83  /xmenu xmenu.modes def
84
85  modes.map xmenu .xm_current get get
86  modes.append over get /modes.selected.append exch def
87  modes.replace over get /modes.selected.replace exch def
88
89  /window.action actRedrawPanel def
90
91  pmenu.update
92} def
93
94
95% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
96% Filter displayed modes when a menu item changes.
97%
98% ( index ) ==> ( )
99%
100/modes.filter {
101  modes.rawlabels .undef eq { pop return } if
102
103  menu.texts exch get
104  dup length 3 add string /modes.tmp.label exch def
105  " %s " modes.tmp.label sprintf
106
107  xmenu % save
108  /xmenu xmenu.modes def
109
110  modes.map {
111    /modes.tmp.oldidx modes.map xmenu .xm_current get get def
112  } {
113    /modes.tmp.oldidx .undef def
114  } ifelse
115
116  modes.map free
117  % mapping of current menu index to underlying option index
118  /modes.map [
119    0 1 modes.rawlabels length 1 sub {
120      modes.applies over get dup .undef ne {
121        dup length 3 add string /modes.tmp.applies exch def
122        " %s " modes.tmp.applies sprintf
123        modes.tmp.applies modes.tmp.label strstr 0 eq { pop } if
124        modes.tmp.applies free
125      } {
126        pop
127      } ifelse
128    } for
129  ] def
130
131  modes.tmp.label free
132
133  xmenu .xm_list get free
134  xmenu .xm_list [
135    modes.map { modes.rawlabels exch get translate } forall
136  ] put
137
138  xmenu .xm_current 0 put
139  0 1 modes.map length 1 sub {
140    modes.map over get modes.tmp.oldidx eq {
141      xmenu .xm_current rot put exit
142    } {
143      pop
144    } ifelse
145  } for
146
147  pmenu.init
148
149  /xmenu exch def % restore
150} def
151
152% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
153% Show window.
154%
155% ( ) ==> ( )
156%
157/panel.modes {
158  "modes" help.setcontext
159
160  window.xmenu
161  dup .xmenu xmenu.modes put
162  dup .xmenu.update /modes.update put
163  dup window.init
164      window.show
165} def
166
167
168% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
169% Return width of panel entry.
170%
171% ( ) => ( width )
172%
173/panel.modes.width {
174  /xmenu xmenu.modes def
175
176  pmenu.width
177} def
178
179
180% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
181% Redraw panel entry.
182%
183% ( panel ) => ( )
184%
185/panel.modes.update {
186  /xmenu xmenu.modes def
187
188  pmenu.panel.update
189} def
Note: See TracBrowser for help on using the browser.