Re: [Bashburn-info] New menu subsystem.
Brought to you by:
bashburn
|
From: Steven W. O. <st...@sy...> - 2008-08-23 02:38:18
|
On Friday, Aug 22nd 2008 at 21:16 -0000, quoth Markus Kollmar:
=>Steven W. Orr wrote:
=>> As I mentioned the other day, I really hate the way we currently draw menus.
=>> I wrote a module (bbmenu.sh) which takes an array of descriptors as an
=>> argument and then just runs with it. All of the menu code is just duped
=>> everywhere for every menu, so this just seemed like a no brainer. It will
=>> reduce the size of bb quite significantly.
=>>
=>> Here's my plan: I can't do this all in one day, and since we don't currently
=>> have a devel branch seperate from a main trunk, it's really not going to be
=>> possible to check in all of the changes atomically without making extra
=>> work. Therefore, if I promise to get it all done by the end of the weekend,
=>> will that be ok with everyone? All this means is that the tree *may* be
=>> broken until I finish. I will check in bbmenu.sh tonight (which won't hurt
=>> anything since it's not yet referenced. It will need to be tweaked further,
=>> but you'll be able to see what I'm doing.
=>>
=>> For taste, in BashBurn.sh where the MAIN menu is posted, it will eventually
=>> end up with this:
=>>
=>> bbmenu=( \
=>> "$bb_menu_1:audio_menu" \
=>> "$bb_menu_2:data_menu" \
=>> "$bb_menu_3:iso" \
=>> "$bb_menu_4:bincue" \
=>> "$bb_menu_5:multi" \
=>> "$bb_menu_6:configure_menu" \
=>> "$bb_menu_7:check_path" \
=>> "$bb_menu_8:datadefine" \
=>> "$bb_menu_9:bbexit" )
=>>
=>> and the whole menu will happen by simply saying:
=>>
=>> menu MAIN "${bbmenu[@]}"
=>>
=>>
=>>
=>
=>Well, the idea is nice to have one call to create and execute menu's. So we
=>have a single point to look on in case of menue debugging or changing the look
=>of all bashburn-menu's easily.
=>But it seems that this will be a bigger cut - since you must provide for every
=>menue point a function?
Almost correct. Things like
44)
doodis
doodat
;;
don't *have* to be a new function. You could just as easily say something
like:
doomenu=( \
....
"$doomenu_44:{ doodis; doodat; }" \
... \
)
but either way, it seems like a fair tradeoff.
You do however raise an interesting point. Let's go further with it.
bbmenu=( \
"$bb_menu_1:audio_menu" \
"$bb_menu_2:data_menu" \
"$bb_menu_3:iso" \
"$bb_menu_4:bincue" \
"$bb_menu_5:multi" \
"$bb_menu_6:configure_menu" \
"$bb_menu_7:check_path" \
"$bb_menu_8:datadefine" \
"$bb_menu_9:bbexit" )
could be
typeset -ra bbaction=(audio_menu \
data_menu \
iso \
bincue \
multi \
configure_menu \
check_path \
datadefine \
bbexit )
followed by
for (( ii=1; ii < bbsize; ii++ ))
do
bbmenu[ii]="bb_menu_${ii}:${bbaction[ii]}"
done
menu MAIN "${bbmenu[@]}"
I'm just exploring so you can see some of the types of constructs
that are available, (And yes I know that as a wrote it, the subscripts
are off. Gimme a break, it's late here.;-)>
=>
=>Markus Kollmar
=>
=>
--
steveo at syslang dot net TMMP1 http://frambors.syslang.net/
Do you have neighbors who are not frambors? Steven W. Orr
|