| 1 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 2 |
% |
|---|
| 3 |
% Profile selection dialog. |
|---|
| 4 |
% |
|---|
| 5 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 9 |
% Some global vars. |
|---|
| 10 |
% |
|---|
| 11 |
|
|---|
| 12 |
% fallback if we can't parse "profiles" |
|---|
| 13 |
/profile.options [ "" ] def |
|---|
| 14 |
/profile.items [ "Broken Profiles" ] def |
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 18 |
% Parse "profiles" file. |
|---|
| 19 |
% |
|---|
| 20 |
% ( ) ==> ( ) |
|---|
| 21 |
% |
|---|
| 22 |
/profile.parsedata { |
|---|
| 23 |
/pf.tmp.datalen profile.data length def |
|---|
| 24 |
/pf.tmp.str profile.data cvs def |
|---|
| 25 |
|
|---|
| 26 |
/profile.default 0 def |
|---|
| 27 |
|
|---|
| 28 |
pf.tmp.datalen 0 eq { return } if |
|---|
| 29 |
pf.tmp.str pf.tmp.datalen 1 sub get '\n' ne { return } if |
|---|
| 30 |
|
|---|
| 31 |
'\n' seteotchar |
|---|
| 32 |
|
|---|
| 33 |
/profile.items [ |
|---|
| 34 |
|
|---|
| 35 |
/pf.tmp.len 0 def |
|---|
| 36 |
/pf.tmp.cnt 0 def |
|---|
| 37 |
{ |
|---|
| 38 |
pf.tmp.str pf.tmp.len add strdup |
|---|
| 39 |
dup dup length 0 put |
|---|
| 40 |
/pf.tmp.len over length 1 add pf.tmp.len add def |
|---|
| 41 |
|
|---|
| 42 |
dup 0 get '*' eq { 1 add /profile.default pf.tmp.cnt def } if |
|---|
| 43 |
|
|---|
| 44 |
pf.tmp.len pf.tmp.datalen ge { exit } if |
|---|
| 45 |
|
|---|
| 46 |
/pf.tmp.cnt inc |
|---|
| 47 |
} loop |
|---|
| 48 |
|
|---|
| 49 |
] def |
|---|
| 50 |
|
|---|
| 51 |
' ' seteotchar |
|---|
| 52 |
|
|---|
| 53 |
/profile.options [ |
|---|
| 54 |
|
|---|
| 55 |
profile.items { |
|---|
| 56 |
dup length add |
|---|
| 57 |
dup 0 0 put |
|---|
| 58 |
1 add |
|---|
| 59 |
} forall |
|---|
| 60 |
|
|---|
| 61 |
] def |
|---|
| 62 |
|
|---|
| 63 |
0 seteotchar |
|---|
| 64 |
|
|---|
| 65 |
} def |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 69 |
% Build profile list. |
|---|
| 70 |
% |
|---|
| 71 |
% ( ) ==> ( ) |
|---|
| 72 |
% |
|---|
| 73 |
/profile.init { |
|---|
| 74 |
/xmenu.profile .xm_size array def |
|---|
| 75 |
/xmenu xmenu.profile def |
|---|
| 76 |
|
|---|
| 77 |
profile.parsedata |
|---|
| 78 |
|
|---|
| 79 |
xmenu .xm_current profile.default put |
|---|
| 80 |
xmenu .xm_list profile.items put |
|---|
| 81 |
|
|---|
| 82 |
pmenu.init |
|---|
| 83 |
} def |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 87 |
% Update profile. |
|---|
| 88 |
% |
|---|
| 89 |
% ( ) ==> ( ) |
|---|
| 90 |
% |
|---|
| 91 |
/profile.update { |
|---|
| 92 |
/xmenu xmenu.profile def |
|---|
| 93 |
|
|---|
| 94 |
/window.action actRedrawPanel def |
|---|
| 95 |
|
|---|
| 96 |
pmenu.update |
|---|
| 97 |
} def |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 101 |
% Show profile menu. |
|---|
| 102 |
% |
|---|
| 103 |
% ( ) => ( ) |
|---|
| 104 |
% |
|---|
| 105 |
/panel.profile { |
|---|
| 106 |
"profile" help.setcontext |
|---|
| 107 |
|
|---|
| 108 |
window.xmenu |
|---|
| 109 |
dup .xmenu xmenu.profile put |
|---|
| 110 |
dup .xmenu.update /profile.update put |
|---|
| 111 |
dup window.init |
|---|
| 112 |
window.show |
|---|
| 113 |
} def |
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 117 |
% Return width of panel entry. |
|---|
| 118 |
% |
|---|
| 119 |
% ( ) => ( width ) |
|---|
| 120 |
% |
|---|
| 121 |
/panel.profile.width { |
|---|
| 122 |
/xmenu xmenu.profile def |
|---|
| 123 |
|
|---|
| 124 |
pmenu.width |
|---|
| 125 |
} def |
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 129 |
% Redraw panel entry. |
|---|
| 130 |
% |
|---|
| 131 |
% ( panel ) => ( ) |
|---|
| 132 |
% |
|---|
| 133 |
/panel.profile.update { |
|---|
| 134 |
/xmenu xmenu.profile def |
|---|
| 135 |
|
|---|
| 136 |
pmenu.panel.update |
|---|
| 137 |
} def |
|---|
| 138 |
|
|---|
| 139 |
|
|---|