



DoMenu (lines 825-936)
Back to List
Browsing verblibm.h
0825 #Endif; ! V5
0826
0827 #Ifnot; ! TARGET_GLULX
0828
0829 [ DoMenu menu_choices EntryR ChoiceR
0830 winwid winhgt lines main_title main_wid cl i oldcl pkey;
0831
0832 if (pretty_flag == 0 || gg_statuswin == 0) return LowKey_Menu(menu_choices, EntryR, ChoiceR);
0833
0834 menu_nesting++;
0835 menu_item = 0;
0836 lines = indirect(EntryR);
0837 main_title = item_name;
0838 main_wid = item_width;
0839
0840 cl = 0;
0841
0842 ! If we printed "hit arrow keys" here, it would be appropriate to
0843 ! check for the availability of Glk input keys. But we actually
0844 ! print "hit N/P/Q". So it's reasonable to silently accept Glk
0845 ! arrow key codes as secondary options.
0846
0847 .ReDisplay;
0848
0849 glk($002A, gg_statuswin); ! window_clear
0850 glk($002A, gg_mainwin); ! window_clear
0851 glk($002F, gg_statuswin); ! set_window
0852 StatusLineHeight(lines+7);
0853 glk($0025, gg_statuswin, gg_arguments, gg_arguments+4); ! window_get_size
0854 winwid = gg_arguments-->0;
0855 winhgt = gg_arguments-->1;
0856 glk($0086, 4); ! set subheader style
0857 glk($002B, gg_statuswin, winwid/2-main_wid, 0); ! window_move_cursor
0858 print (string) main_title;
0859 glk($002B, gg_statuswin, 1, 1); ! window_move_cursor
0860 print (string) NKEY__TX;
0861 glk($002B, gg_statuswin, winwid-13, 1); ! window_move_cursor
0862 print (string) PKEY__TX;
0863 glk($002B, gg_statuswin, 1, 2); ! window_move_cursor
0864 print (string) RKEY__TX;
0865 glk($002B, gg_statuswin, winwid-18, 2); ! window_move_cursor
0866 if (menu_nesting == 1) print (string) QKEY1__TX;
0867 else print (string) QKEY2__TX;
0868 glk($0086, 0); ! set normal style
0869
0870 glk($002B, gg_statuswin, 1, 4); ! window_move_cursor
0871 if (menu_choices ofclass String) print (string) menu_choices;
0872 else menu_choices.call();
0873
0874 oldcl = -1;
0875
0876 for (::) {
0877 if (cl ~= oldcl) {
0878 if (cl < 0 || cl >= lines) cl = 0;
0879 if (oldcl >= 0) {
0880 glk($002B, gg_statuswin, 3, oldcl+6);
0881 print (char) ' ';
0882 }
0883 oldcl = cl;
0884 glk($002B, gg_statuswin, 3, oldcl+6);
0885 print (char) '>';
0886 }
0887 pkey = KeyCharPrimitive(gg_statuswin, true);
0888 if (pkey == $80000000) jump ReDisplay;
0889 if (pkey == NKEY1__KY or NKEY2__KY or $fffffffb) {
0890 cl++;
0891 if (cl >= lines) cl = 0;
0892 continue;
0893 }
0894 if (pkey == PKEY1__KY or PKEY2__KY or $fffffffc) {
0895 cl--;
0896 if (cl < 0) cl = lines-1;
0897 continue;
0898 }
0899 if (pkey == QKEY1__KY or QKEY2__KY or $fffffff8 or $fffffffe) break;
0900 if (pkey == $fffffffa or $fffffffd) {
0901 glk($002F, gg_mainwin); ! set_window
0902 new_line; new_line; new_line;
0903 menu_item = cl+1;
0904 EntryR.call();
0905
0906 glk($002A, gg_statuswin); ! window_clear
0907 glk($002A, gg_mainwin); ! window_clear
0908 glk($002F, gg_statuswin); ! set_window
0909 StatusLineHeight(1);
0910 glk($0025, gg_statuswin, gg_arguments, gg_arguments+4); ! window_get_size
0911 winwid = gg_arguments-->0;
0912 winhgt = gg_arguments-->1;
0913 glk($0086, 4); ! set subheader style
0914 glk($002B, gg_statuswin, winwid/2-item_width, 0); ! window_move_cursor
0915 print (string) item_name;
0916 glk($0086, 0); ! set normal style
0917
0918 glk($002F, gg_mainwin); ! set_window
0919 new_line;
0920 i = ChoiceR.call();
0921 if (i == 2) jump ReDisplay;
0922 if (i == 3) break;
0923 L__M(##Miscellany, 53);
0924 pkey = KeyCharPrimitive(gg_mainwin, 1);
0925 jump ReDisplay;
0926 }
0927 }
0928
0929 ! done with this menu...
0930 menu_nesting--;
0931 if (menu_nesting > 0) rfalse;
0932 glk($002F, gg_mainwin); ! set_window
0933 glk($002A, gg_mainwin); ! window_clear
0934 new_line; new_line; new_line;
0935 if (deadflag == 0) <<Look>>;
0936 ];
Last updated 27 February 2004. The librarian in charge of this page is Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight. Please email any comments, suggestions or corrections to cedenqs@inform-fiction.org.