john13@garfield.UUCP (04/05/87)
[] What follows is a little program I wrote to make my life easier. Not that I *hate* menus, you understand, I kinda like them; but if I'm using the mouse for other things, I don't want to have to keep moving it up to the top over and over and over again. Now Intuition allows you to avoid this using keyboard equivalents...but only if the guy writing the program thought to include them, and used the same ones *you* would have. Anyway, it's in my c: directory now. John -----Cut Here-----Cut Here-----Cut Here-----Cut Here----- #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # add.doc # add.c # add.uue echo shar: extracting add.doc sed 's/^X//' << 'END_OF_FILE' > add.doc X XADD - create keyboard shortcuts where no keyboard shortcuts have gone before. X XCopyright ((c)) 1987, John Russell X X This is a small Intuition hack, which I'm surprised not to have seen Xanywhere before. It lets you take other people's menus, and customize them X(at least with regards to keyboard equivalents, ie right-Amiga + <key> Xcombinations). The idea was brought into my consciousness when I saw how XMWB let you circumvent the assumptions made by other programmers in a Xtransparent way, although it had probably been fermenting back there for a Xwhile :-). X XSyntax: Xadd <windowname> <menunumber> <itemnumber> [ <sub-item number> ] <key> X XWindowname is the name of the window (no matter what screen it is on) to Xwhich the menu you want to alter is attached. I ran into hassles with Xlong window titles and those with spaces, so you only need specify the Xfirst word (eg VT100 instead of VT100 (2.4 861214... etc). Note that names X*are* case sensitive. X XAll numbers are from 1 upwards, so "add window 1 1 X" is the upper-left-hand Xposition in the menu list. X XIf you have 5 parameters it assumes the 4th is the position of a sub-item, Xnot the shortcut itself. Otherwise, the 2nd and 3rd supply the position info Xand the 4th is the key to use. X XThe shortcut can be specified as upper or lower case; they are treated the Xsame. Note that there is nothing to prevent you from creating duplicate Xshortcuts. Since I didn't want to get over-fancy, the size of the menu Xhitbox is unaltered and this may cause some (non-harmful) overlapping. X-------------- X XSample uses - X XInstall this file as s:loadwb (instead of "loadwb", "execute loadwb") X Xaddbuffers df0: 15 Xloadwb Xwait 4 ;wait for disk activity to finish Xadd Workbench 1 1 O Xadd Workbench 1 2 C Xadd Workbench 1 3 D Xadd Workbench 1 4 R Xadd Workbench 1 5 I Xadd Workbench 1 6 K ;for kill Xadd Workbench 2 1 E Xadd Workbench 2 2 F ;for format Xadd Workbench 3 4 S Xadd Workbench 3 5 V X XIf you use VT100 and don't have a compiler, you might want to install Xs:vt100 ("run vt100", then "execute vt100") X Xaddbuffers df0: 15 ;if none added before Xadd VT100 1 1 C Xadd VT100 1 2 A Xadd VT100 2 1 1 L ;I only use 3/1200 baud Xadd VT100 2 1 2 H Xadd VT100 2 1 3 \ ;to avoid duplicates X X-------------- XBugs/problems: X XUsing 0 or negative numbers for menu positions is *not* recommended. XBefore I added the checks for end-of-menu, I would experience strange Xscreen displays trying to access menu # 1000, etc. even though it was just Xde-referencing the pointers. Anyone know why? X XPrograms with a space as the first character in the window title (eg XPageSetter) need to be filezapped (change the space to, say, a _). X XPrograms that re-use parts of the menu structure (eg Ahost); well, it doesn't Xhurt, but you can only specify 1 shortcut which shows up several times. X XPrograms that disable menu operations at various times (eg DPaint and XWorkbench) need to be taken case-by-case. I was disappointed about DPaint, Xalthough menu operations *are* allowed once the mouse is above the drawing Xarea. For Workbench, just allow disk activity to cease before using add. X XThis was originally interactive, and I just hacked it into "expert" mode Xat someone's request. If I ever get more than 10 minutes at a time with it, XI'll combine the two, and hopefully get to use some of the neato features Xlike ItemAddress and the MenuNumber macro. Be warned, I fully intend to steal Xmenus away from programs and let you select them in *mine*! X XI can't accept responsibility for any damages that may occur as a result Xof using this program (although I highly doubt any will happen). X-------------- XThis program is made available as shareware. Anyone may give it to anyone, Xbut not impose any conditions in doing so. If you feel that this program Xhas been worth $5 or so to you, you might want to send a small donation to: X XJohn Russell X5 Alderdice Place XSt. John's, NF, Canada XA1B 2P8 X XIf I get favourable response, I may expand the idea into a general screen/ Xwindow/menu management program, allowing you to customize the Intuition-based Xfeatures of other people's programs. Hmmm, I wonder what kind of Xcopyright conundrums *that* might create? "But officer, the spreadsheet I Xwrote has *none* of these filthy messages in it..." X END_OF_FILE echo shar: extracting add.c sed 's/^X//' << 'END_OF_FILE' > add.c X/* X * ADD (add keyboard shortcuts to menus) X * X * Copyright ((c)) 1987, John Russell X * This program is freely redistributable. Nobody may impose extra X * limitations on its distribution. X * X * Please distribute at least documentation with the executable. The X * source is straightforward, but could be informative for those who get X * blurred vision from reading those structure definitions in intuition.h. X * X * This program is shareware, and if you feel that it is useful to you X * (I *know* it is to me :-) a small contribution would be appreciated X * (see documentation). X */ X X/* Manx users compile with "+l" just in case */ X X#include <intuition/intuition.h> X#include <stdio.h> X X/* include standard stuff for _intuition_ */ X Xstruct NewWindow dummy = { X 0,0,1,1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,WBENCHSCREEN X}; /* only to get address of the Workbench screen */ X Xstruct IntuitionBase *IntuitionBase; X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X struct Screen *screen; X struct Window *window; X struct MenuItem *item; X struct Menu *menu,*main_menu; X int x,cut; X X cut = argc-1; /* *argv[cut] == key to assign */ X X if ((IntuitionBase=(struct IntuitionBase *) X OpenLibrary("intuition.library",0L))==NULL) { X printf("Where is Intuition gone???\n"); X exit(0); X } X X if ((window=(struct Window *) X OpenWindow(&dummy))==NULL) { X printf("Can't open even a teeny-weeny window!\n"); X goto quit; /* background in basic shows through! */ X } X X screen = window->WScreen; /* address of Workbench screen structure */ X CloseWindow(window); /* no longer necessary */ X X while (screen != NULL) { /* do all screens */ X window = screen->FirstWindow; X while (window != NULL) { /* do all windows */ X if (compare(argv[1],window->Title)==0) { /* search for name */ X x=atoi(argv[2]); /* menu # */ X menu = window->MenuStrip; X main_menu = menu; /* main menu of window for SetMenuStrip */ X X while (--x > 0) { /* scan menu list */ X if ((menu = menu->NextMenu) == NULL) X goto quit; X } X x = atoi(argv[3]); /* item # */ X item = menu->FirstItem; Xsubmenu: X while (--x > 0) { /* scan item list */ X if ((item = item->NextItem) == NULL) X goto quit; X } X if (argc==6) { /* descend into sub-menu? */ X argc=0; X item=item->SubItem; X x=atoi(argv[4]); /* sub-item # */ X goto submenu; X } X ClearMenuStrip(window); /* disable menu structure */ X item->Flags |= COMMSEQ; /* add shortcut flag */ X item->Command = *argv[cut]; /* which key */ X printf("Added shortcut: %c.\n",*argv[cut]); X SetMenuStrip(window,main_menu); /* give it back */ X } X window = window->NextWindow; X } X screen = screen->NextScreen; X } X X quit: X X CloseLibrary(IntuitionBase); X X} X Xcompare(string1,string2) /* if spaces in windowname, only check first word */ Xchar *string1,*string2; X{ X while ((*string1 != '\0') && (*string1 != ' ')) { X if (*string1 != *string2) /* space and null both end conditions */ X return(1); X string1++; X string2++; X } X return(0); /* return weird values like strcmp() */ X} X END_OF_FILE echo shar: extracting add.uue sed 's/^X//' << 'END_OF_FILE' > add.uue Xbegin 600 add XM #\P # ( 3U V /I $]4ZY # XM)DY5_^(F+0 (4X,K0__B0J=(>@&T3KH33%!/*4""RDJ 9A)(>@&T3KH#/EA/ XM0J=.N@WL6$](;( "3KH3>EA/*T#_^$J 9@Y(>@&L3KH#&EA/8 !9BQM__@K XM;@ N__PO+?_X3KH31%A/2JW__&< 4HL;?_\*VX !/_X2JW_^&< 2PL;?_X XM+RX ("QM PO+@ $3KH!G%!/2H!F $$+&T #"\N A.N@'86$\K0/_F+&W_ XM^"MN !S_\"MM__#_[%.M_^8,K0 #_YF\2+&W_\"M6__!*K?_P9P W&#@ XM+&T #"\N Q.N@&66$\K0/_F+&W_\"MN !+_]%.M_^8,K0 #_YF\2+&W_ XM]"M6__1*K?_T9P H&#@#*T & AF(D*M @L;?_T*VX '/_T+&T #"\N XM !!.N@%"6$\K0/_F8+0O+?_X3KH23EA/+&W_] !N 0 #"QM__0F+?_BY8,B XM;0 ,('$X !U0 !HF+?_BY8,L;0 ,(G8X !812(-(PR\#2'H D4ZZ =A03R\M XM_^PO+?_X3KH2)%!/+&W_^"M6__A@ /[0+&W__"M6__Q@ /ZR+RR"RDZZ$598 XM3TY=3G5I;G1U:71I;VXN;&EB<F%R>0!7:&5R92!I<R!);G1U:71I;VX@9V]N XM93\_/PT* $-A;B=T(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XM1(!21$J!:@9$@0T*1 !82Q*1&<"1( H'TYU+P1"A$J :@1$@%)$2H%J!D2! XM#0I$ %A#0H@ 6#:800@ 4YU2.<P $A!2D%F*$A!0D. P6@.- !"0$A @,$V XM # "@,$B $A , -(0$)!2$%,WP ,3G5(04*"=A_C@..2E(%K$%* 4<O_]& . XMXX#CDM2!:O!1R__VU($B DS? Q.=4Y5 !(YPP@)&T "" M PB+0 03KH) XM*BH > !@*B\M !0L2E**%A9(@TC#+P-.N@ B4$^PO/____]F#0IP $S?!#!. XM74YU4H2XA672("T $&#L3E4 "\-"B1M PL4KWJ 1E&B8M C&O /\O XM R\-"DZZ .I03R1?3EU.=2Q24I(0+0 +'(!(@$C P+P #_8.1.50 +PT* XM3>R 1"1.+$K5_ !8O#F$06$]-[('\M<YEZB1?3EU.=4Y5 !(YP@@)&T XM"'@ )@T*9@T*</],WP003EU.=4HJ QG;!8J Q(@TC#QKP $9PQ(>/__ XM+PT*86A03R@ %BH #4B#2,,O TZZ!]Q83XB %BH #$B#2,/&O )G#0HO XM*@ (3KH"6%A/%BH #$B#2,/&O "!G%"\J !).N@*T6$\O*@ 23KH"-%A/ XM0I)"J@ $0JH "$(J P@!& _W1.5?_^2.<(("1M A-^O\H*4Z!_!8J Q( XM@TC#QKP 09PT*</],WP003EU.=18J Q(@TC#QKP $9S(H$IBJ @O XM!"\J @6*@ -2(-(PR\#3KH"8$_O RPA&<0 "H $ ,0I)"J@ $</]@M@RM XM_____P ,9A "*@#[ Q"DD*J 1P &"<2JH "&8(+PT*3KH JEA/-BH $$C# XMMKP !9C ;;0 /__](> !2&W__Q8J U(@TC#+P-.N@'V3^\ #+"\ XM 6:2("T #& _U(DJ@ (-BH $$C#UJH ""5# 0 *@ $ PL4E*2$"T #QR XM2(!(P,"\ _V _R).50 +PT*3>R 1"1.2BH #&<8U?P 63>R!_+7. XM90AP "1?3EU.=6#B0I)"J@ $0JH "" -"F#J3E7__"\-"B1M @6*@ -2(-( XMPR\#3KH!%%A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KH 3$WL@M8D0-7.N+P ;0RXO !-N!$J29A(I? .#3G#_3-\$ XM<$Y=3G4V*@ $2,/&O @ !F""\23KH +EA/0I)P &#<2.<P #0!Q, F 4A# XMQL!(0T)#U(-(0,#!2$!"0-""3-\ #$YU(B\ !"QL@U9.[O_<(B\ !"QL@U9. XM[O^"(B\ !"QL@U9.[O^X(B\ !"QL@U9.[O]P+&R#5D[N_\HL;(-63N[_?"(O XM 0L;(-63N[_*$SO 8 !"QL@U9.[O_B+&R#5D[N_\1,[P . 0L;(-63N[_ XMT$CG 01,[R" PL;(+23J[_E$S?((!.=4[Z (B;P $+&R"TD[N_F),[P # XM 0L;(+23N[_.B)O 0L;(+23N[^VBQL@M).[O]\(F\ !" O @L;(+23N[_ XM+B!O 0L;(+23N[^C$[Z (L;(+2(F\ !" O A.[OW8(F\ !"QL@M).[OZ& XM3.\ P $+&R"TD[N_LX@;P $+&R"TD[N_H @;P $+&R"RD[N_\H@;P $+&R" XMRD[N_[@@;P $+&R"RD[N_S1,[P, 0L;(+*3N[^^ ^P ! XM ( #\0 ( _( /J H0 0 ! XM 3 Q,C,T-38W XM.#EA8F-D968 $ 0 ! XM 0 $ 0( ! XM XM XM XM XM XM XM XM XM (" @(" @(" @,# P,# @(" @(" @(" @(" @(" @(""00$! XM0$! 0$! 0$! 0$! # P,# P,# P,#$! 0$! 0$ )"0D)"0D! 0$! 0$! 0$! XM 0$! 0$! 0$! 4! 0$! 0 T*#0H-"@T*#0H-"@(" @(" @(" @(" @(" @(" X9 @("0$! 0" #\@ ^L #\@H- X Xend END_OF_FILE exit
mwm@eris.UUCP (04/13/87)
You need to Forbid() and Permit() around your outer loop. If you're running add with nothing else going on, not having this won't cause any problems. But I tend to start vt100 (with run), and then go do other things. If those other things open new windows/screens while add is walking the list, badness can happen... <mike -- Here's a song about absolutely nothing. Mike Meyer It's not about me, not about anyone else, ucbvax!mwm Not about love, not about being young. mwm@berkeley.edu Not about anything else, either. mwm@ucbjade.BITNET
john13@garfield.UUCP (04/19/87)
Here is a leaner & meaner version of ADD, and a new utility, UNTIL. Add is now smaller, works with any arrangement of screens, and allows you to delete shortcuts as well as add them. Forbid() and Permit() are used around the delicate sections. Eg: add VT100 1 1 C ;create new shortcut add VT100 2 1 3 -kill ;get rid of an existing one As before, only the first word of the window name need be specified. Until may turn out to have more uses than I envisioned. I intended to use it in the context of waiting for a run task to finish loading before adding keyboard shortcuts, as opposed to having to "wait" some small number of seconds; waiting can get you into trouble if you have to swap disks, etc. It also seems to solve (at least for stuff that opens windows) the problem of excessive disk seeking when running many tasks; ideally it should be run out of ram: to avoid *any* clashing whatsoever. Eg: run df1:vt100 ;start task _loading_ until VT100 60 -m ;wait until window named VT100 appears _and sets a ;menustrip_ or 60 seconds, whichever comes first addbuffers df0: 20 add VT100 1 1 C ;now do as many adds as you want Eg: run clock until Clock 30 ;wait for "Clock" window to appear or 30 seconds. ;we don't care about the menu here run DME ;nice to have an editor always loaded until DME 45 ;again no menu run vt100 ;etc. Although all tasks are independent, we don't ;load the next until the current one is started John Russell john13@garfield.mun.cdn 5 Alderdice Place john13@garfield.UUCP St. John's, NF (Canada) A1B 2P8 (709) 726-7847 ----CUT HERE------------------- begin 600 add M #\P # ( .# O0 /I #@TZY # M?DY5_^(F+0 (4X,K0__B0J=(>@&N3KH-E%!/*4""7DJ 9A)(>@&N3KH"X%A/ M0J=.N@@P6$\L;()>*VX //_\3KH-0DJM__QG %F+&W__"MN 3_^$JM__AG M %(+&W_^"\N " L;0 ,+RX !$ZZ :I03TJ 9@ !("QM PO+@ (3KH!YEA/ M*T#_YBQM__@K;@ <__ K;?_P_^Q3K?_F#*T _^9O$BQM__ K5O_P2JW_ M\&< /A@X"QM PO+@ ,3KH!I%A/*T#_YBQM__ K;@ 2__13K?_F#*T M_^9O$BQM__0K5O_T2JW_]&< +Q@X RM !@ (9B)"K0 (+&W_]"MN !S_ M]"QM PO+@ 03KH!4%A/*T#_YF"T+RW_^$ZZ#,183TAZ , F+?_BY8,L;0 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$! 0$! 0$! 0$! 0$! 0$!0$! 0$! M"@H*"@H* @(" @(" @(" @(" @(" @(" @) 0$! ( _( /K % _(* end ----CUT HERE------------------- begin 600 until M #\P # ( -J O0 /I #:DZY # M*$Y5__1"ITAZ .!.N@U44$\I0()>2H!F$DAZ .!.N@*46$]"ITZZ!^183PRM M P (;0H,K0 0 "&\<2'H T4ZZ FY83R\L@EY.N@S 6$]"ITZZ![18 M3RQM PO+@ (3KH!KEA/*T#_^$*M__1@4"QM PO+@ $3KH XEA/*T#__$J M9RPL;?_\2JX '&8@#*T # AG%DAZ )TL;0 ,+RX #$ZZ 1A03TJ 9P)@ M)DAX !E.N@O86$]2K?_T)BW_^..#)"W_]+2#;:)(>@!L3KH!W%A/+RR"7DZZ M#"Y83TY=3G5I;G1U:71I;VXN;&EB<F%R>0!.;R!I;G1U:71I;VX@;&EB<F%R M>2X* %5S86=E.B!U;G1I;" \=VEN9&]W/B \<V5C;VYD<SX@6R \+6T^(%T* M "UM %1I;65O=70@+2!W:6YD;W<@9&ED(&YO="!O<&5N+@ 3E7_^$ZZ"]0L M;()>*VX //_\8$(L;?_\*VX !/_X8"@O+0 (+&W_^"\N "!A-E!/2H!F#$ZZ M"^ @+?_X3EU.=2QM__@K5O_X2JW_^&;2+&W__"M6__Q*K?_\9KA.N@NX< !@ MV$Y5 L;0 (%A9(@TC#2H-G.BQM @6%DB#2,.VO "!G*"QM @6%DB# M2,,L;0 ,%!9(@DC"MH)G!G !3EU.=5*M A2K0 ,8+AP &#N3E4 $CG#" D M;0 (%A)(@TC#MKP @9PX6$DB#2,.VO EF!%**8.!Z !822(-(P[:\ M +68&>@%2BF 0%A)(@TC#MKP K9@)2BG@ 8!PL2E**%A9(@TC#( 1R M"DZZ"=[6@"@#F+P P%A)(@TC#3>R!PQ0V. !(@DC"Q+P $9LI*A6<& M( 1$@& "( 1,WP0P3EU.=4Y5 O"B1M A*$F<D+$I2BA862(-(PR\#3KH M(EA/L+S_____9@AP_R1?3EU.=6#82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D[N_\HL;(+J3N[_?"(O 0L;(+J3N[_*$SO M 8 !"QL@NI.[O_B+&R"ZD[N_\1,[P . 0L;(+J3N[_T$CG 01,[R" PL M;()F3J[_E$S?((!.=4[Z (B;P $+&R"9D[N_F),[P # 0L;()F3N[_.B)O M 0L;()F3N[^VD[Z (L;()F3N[_?")O 0@+P (+&R"9D[N_RX@;P $+&R" M9D[N_HQ.^@ "+&R"9B)O 0@+P (3N[]V"QL@F9.[O]V(F\ !"QL@F9.[OZ& M3.\ P $+&R"9D[N_LX@;P $+&R"9D[N_H /L 0 " M _$ " /R #Z@ )$ ! M $ 0$ ! $" M 0 M M M M M M M M " @(" @(" @(# P,# P(" @ M(" @(" @(" @(" @(" @D$! 0$! 0$! 0$! 0$! 0 P,# P,# P,# Q 0$! M0$! "0D)"0D) 0$! 0$! 0$! 0$! 0$! 0$! 0% 0$! 0$ *"@H*"@H" @(" H @(" @(" @(" @(" @(" D! 0$ @ #\@ ^L #\@H" end
spencer@eris.BERKELEY.EDU (Randy Spencer) (04/24/87)
In article <3597@garfield.UUCP> john13@garfield.UUCP writes: >Here is a leaner & meaner version of ADD, and a new utility, UNTIL. >----CUT HERE------------------- > >begin 600 add >M #\P # ( .# O0 /I #@TZY # >M0$! "0D)"0D) 0$! 0$! 0$! 0$! 0$! 0$! 0% 0$! 0$ *"@H*"@H" @(" >H @(" @(" @(" @(" @(" D! 0$ @ #\@ ^L #\@H" > >end I am sorry, did I miss the source for these? Where can I look for more information about how they work. I didn't get it all from the poster. (If you didn't get it, this is another plea from Randy not to start posting UUencoded stuff to a net that is hacker oriented, without the source code.) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Randy Spencer P.O. Box 4542 Berkeley CA 94704 (415)284-4740 I N F I N I T Y BBS: (415)283-5469 Now working for |||||||||||::::... . . BUD-LINX But in no way |||||||||||||||::::.. .. . Officially representing ||||||||||||:::::... .. ....ucbvax!mica!spencer s o f t w a r e spencer@mica.berkeley.edu -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
john13@garfield.UUCP (04/26/87)
In article <3297@jade.BERKELEY.EDU>, spencer@eris.BERKELEY.EDU (Randy Spencer) writes: > I am sorry, did I miss the source for these? Where can I look for more > information about how they work. I didn't get it all from the poster. > > (If you didn't get it, this is another plea from Randy not to start > posting UUencoded stuff to a net that is hacker oriented, without > the source code.) > Sorry if you missed ADD the first time around; you are the second person to ask about this, although I know the original posting got to ".Berkeley.edu". I was kind of leery about posting the only-slightly-modified source to add again, and if you have the source to add, then the source to until becomes kind of redundant. And add.doc - I just got to editing it and it seems to have grown into 100+ lines! Geez, a long posting by itself. To tell you the truth, I was more worried about responses saying "my grandmother had the same idea the second day I had my Amiga home...and she hand-coded it in assembler to make it more challenging!" :-) There are a million different things you can do using the same basic loop (for all screens, for all windows in each screen {..........} ). Someday I hope to have done all of them; but I gotta warn ya, ya seen one of these sources, ya seen them all! Exception #1: Expose, which had a major bug as posted, and major limitations also. These are fixed and I will post today or tomorrow source and executable. Exception #2: Menutext (it has a shorter name on my disk) & Restore, whose method of execution may not be immediately obvious from add.c, until.c, and expose.c. But I want to include a lot of extra features...aw, what the heck, they work as is so I will post them too and see what kind of feedback I get. The rest of this posting is ADD.C, ADD.DOC, and UNTIL.C. ADD.C (final): /* * ADD (add keyboard shortcuts to menus) * * Copyright ((c)) 1987, John Russell * This program is freely redistributable. Nobody may impose extra * limitations on its distribution. * * Please distribute at least documentation with the executable. The * source is straightforward, but could be informative for those who get * blurred vision from reading those structure definitions in intuition.h. * * This program is shareware, and if you feel that it is useful to you * (I *know* it is to me :-) a small contribution would be appreciated * (see documentation). */ /* Manx users compile with "+l" just in case */ #include <intuition/intuition.h> #include <stdio.h> /* include all the standard stuff for _intuition_ */ struct IntuitionBase *IntuitionBase; main(argc,argv) int argc; char *argv[]; { struct Screen *screen; struct Window *window; struct MenuItem *item; struct Menu *menu,*main_menu; char answer,*gets(); int x,cut; cut = argc-1; /* *argv[cut] == key to assign */ if ((IntuitionBase=(struct IntuitionBase *) OpenLibrary("intuition.library",0L))==NULL) { puts("Where is Intuition gone???\n"); exit(0); } Forbid(); /* the following line was outside the Forbid-Permit loop in the posted executable, but should be inside */ screen = IntuitionBase->FirstScreen; /* address of Workbench screen structure */ while (screen != NULL) { /* do all screens */ window = screen->FirstWindow; while (window != NULL) { /* do all windows */ if (compare(argv[1],window->Title)==0) { /* search for name */ x=atoi(argv[2]); /* menu # */ menu = window->MenuStrip; main_menu = menu; /* main menu of window for SetMenuStrip */ while (--x > 0) { /* scan menu list */ if ((menu = menu->NextMenu) == NULL) goto quit; } x = atoi(argv[3]); /* item # */ item = menu->FirstItem; submenu: while (--x > 0) { /* scan item list */ if ((item = item->NextItem) == NULL) goto quit; } if (argc==6) { /* descend into sub-menu? */ argc=0; item=item->SubItem; x=atoi(argv[4]); /* sub-item # */ goto submenu; } ClearMenuStrip(window); /* disable menu structure */ if (!compare(argv[cut],"-kill")) { item->Flags &= -(COMMSEQ+1); /* turn off bit */ puts("Deleted shortcut."); } else { item->Flags |= COMMSEQ; /* add shortcut flag */ item->Command = *argv[cut]; /* which key */ puts("Added shortcut."); /* took out stray newline */ } SetMenuStrip(window,main_menu); /* give it back */ } window = window->NextWindow; } screen = screen->NextScreen; } quit: Permit(); CloseLibrary(IntuitionBase); } compare(string1,string2) /* if spaces in windowname, only check first word */ char *string1,*string2; { while ((*string1 != '\0') && (*string1 != ' ')) { if (*string1 != *string2) /* space and null both end conditions */ return(1); string1++; string2++; } return(0); /* return weird values like strcmp() */ } ---------------------------------- ADD.DOC: ADD - create keyboard shortcuts where no keyboard shortcuts have gone before. Copyright ((c)) 1987, John Russell This is a small Intuition hack, which I'm surprised not to have seen anywhere before. It lets you take other people's menus, and customize them (at least with regards to keyboard equivalents, ie right-Amiga + <key> combinations). The idea was brought into my consciousness when I saw how MWB let you circumvent the assumptions made by other programmers in a transparent way, although it had probably been fermenting back there for a while :-). Syntax: add <windowname> <menunumber> <itemnumber> [ <sub-item number> ] <key | "-kill"> Windowname is the name of the window (no matter what screen it is on) to which the menu you want to alter is attached. I ran into hassles with long window titles and those with spaces, so you only need specify the first word (eg VT100 instead of VT100 (2.4 861214... etc). Note that names *are* case sensitive. All numbers are from 1 upwards, so "add window 1 1 X" is the upper-left-hand position in the menu list. If you have 5 parameters it assumes the 4th is the position of a sub-item, not the shortcut itself. Otherwise, the 2nd and 3rd supply the position info and the 4th is the key to use. The shortcut can be specified as upper or lower case; they are treated the same. Note that there is nothing to prevent you from creating duplicate shortcuts. Since I didn't want to get over-fancy, the size of the menu hitbox is unaltered and this may cause some (non-harmful) overlapping. The "-kill" option is position-dependent (it must go last) and just turns off an existing shortcut. -------------- Sample uses - Install this file as s:loadwb (instead of "loadwb", "execute loadwb") loadwb until Workbench 60 -m ; wait until window opens and sets menu (also posted) addbuffers df0: 15 add Workbench 1 1 O add Workbench 1 2 C add Workbench 1 3 D add Workbench 1 4 R add Workbench 1 5 I add Workbench 1 6 K ;for kill add Workbench 2 1 E add Workbench 2 2 F ;for format add Workbench 3 4 S add Workbench 3 5 V If you use VT100 and don't have a compiler, you might want to install s:vt100 ("run vt100", then "execute vt100") until VT100 60 -m ;wait 'til VT100 opens window, sets menu strip addbuffers df0: 15 ;if none added before add VT100 1 1 C add VT100 1 2 A add VT100 2 1 1 L ;I only use 3/1200 baud add VT100 2 1 2 H add VT100 2 1 3 -kill ;because this one was originally "H" -------------- Bugs/problems: Using 0 or negative numbers for menu positions is *not* recommended. Before I added the checks for end-of-menu, I would experience strange screen displays trying to access menu # 1000, etc. even though it was just de-referencing the pointers. Anyone know why? Programs with a space as the first character in the window title (eg PageSetter) need to be filezapped (change the space to, say, a _). Programs that re-use parts of the menu structure (eg Ahost); well, it doesn't hurt, but you can only specify 1 shortcut which shows up several times. Programs that disable menu operations at various times (eg DPaint and Workbench) need to be taken case-by-case. I was disappointed about DPaint, although menu operations *are* allowed once the mouse is above the drawing area. For Workbench, just allow disk activity to cease before using add. This was originally interactive, and I just hacked it into "expert" mode at someone's request. If I ever get more than 10 minutes at a time with it, I'll combine the two, and hopefully get to use some of the neato features like ItemAddress and the MenuNumber macro. Be warned, I fully intend to steal menus away from programs and let you select them in *mine*! I can't accept responsibility for any damages that may occur as a result of using this program (although I highly doubt any will happen). -------------- This program is made available as shareware. Anyone may give it to anyone, but not impose any conditions in doing so. If you feel that any and/or all programs you have from me have been worth $5 or so to you, you might want to send a small donation to: John Russell 5 Alderdice Place St. John's, NF, Canada A1B 2P8 (709) 726-7847 If I get favourable response, I may expand the idea into a general screen/ window/menu management program, allowing you to customize the Intuition-based features of other people's programs. Hmmm, I wonder what kind of copyright conundrums *that* might create? "But officer, the spreadsheet I wrote has *none* of these filthy messages in it..." ------------------------------ UNTIL.C: /* * This is a short program which will wait until a particular window * is opened, or until a certain amount of time has passed. * * Specify -m at the end to wait until the window has finished setting * its menu structure. * * Usage : until <window> <seconds> [ <-m> ] * * NB: Window name is case sensitive; for multi-word names, only the first * is checked, so if name is "My Window" use "My" when invoking "until". */ /* * Use of this program? Anytime you run one application that opens windows, * and then want to start another, but not until the first has opened its * window (and optionally constructed a menulist). Could also be used to * reduce disk grinding (hey, this is a neat idea I just thought of!): * * run Scribble! ;fine and dandy * until Scribble! 20 ;wait till loaded, or 20 secs if load fails * run Pagesetter ;I'll imagine I have lots of ram * * This works well as a companion to ADD, so you can construct script files * that run a program like Scribble or Pagesetter, wait until they have * finished loading, and then do an addbuffers and add some keyboard * shortcuts: * * run df1:vt100 ;start it up * until VT100 20 -m ;wait until it loads, gets ser: device, and * ;constructs menu * addbuffers df0: 20 * add VT100 1 1 C ;create keyboard shortcuts * etc. * * Copyright ((c)) 1987, John Russell. Unlimited distribution. */ #include <intuition/intuition.h> struct IntuitionBase *IntuitionBase; /* actually has a use! */ struct Window *findwindow(); main(argc, argv) int argc; char *argv[]; { struct Window *open; int seconds,x; if (!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0L))) { puts("No intuition library.\n"); exit(0); } if ((argc < 3) || (argc > 4)) { /* instructions */ puts("Usage: until <window> <seconds> [ <-m> ]\n"); CloseLibrary(IntuitionBase); exit(0); } seconds = atoi(argv[2]); for (x=0; x<2*seconds; x++) { /* check every 1/2 second */ if (open = findwindow(argv[1])) { /* if window open yet */ /* now is menu bar set (or doesn't user care)? */ if (open->MenuStrip || (argc==3) || compare(argv[3],"-m")) { goto end; } } Delay(25); /* half a second or so */ } puts("Timeout - window did not open."); end: CloseLibrary(IntuitionBase); } struct Window *findwindow(title) char *title; { struct Screen *Screen; struct Window *Window; Forbid(); /* just to be safe, disable interrupts */ /* now loop through all screens/windows */ for (Screen=IntuitionBase->FirstScreen; Screen; Screen=Screen->NextScreen) { for (Window=Screen->FirstWindow; Window; Window=Window->NextWindow) { /* if found, return window pointer so we can check menu status */ if (!compare(Window->Title,title)) { Permit(); /* what happens if I don't do this, hm? */ return(Window); } } } Permit(); return(0L); } compare(string1,string2) /* compare strings that end with nulls or spaces */ char *string1,*string2; { while ((*string1 != '\0') && (*string1 != ' ')) { if (*string1 != *string2) return(1); string1++; string2++; } return(0); /* return reverse of intuitive value, as strcmp does */ } ------------------------------- John
FRANCIS@ukpr.uky.edu (11/28/90)
Please add me to the gateway. Thanks.