/* input --- find out what that annoying user wants and deal with it */ #include "stuff.h" #define SMP struct IntuiMessage * extern struct Screen *scr ; extern struct Window *win, *seqwin, *clipWin; extern ST SW SuperWindows []; /* cheap storage for dots */ extern int no_help ; /* turn that thing off! */ extern USHORT izDn ; /* the mouse's pen condition */ extern USHORT Mx, My ; /* My mouse Ex Yy'z here! */ extern ULONG thisCol ; /* where points the ">"? */ extern int bloking ; extern int popping ; ULONG msgclass ; /* I only program for the */ USHORT msgcode ; /* mouse fetish... */ int gadcode ; UWORD mrQ ; int picking ; /* mousepen??? */ struct helperizer helps [] = { { 0, -1, 13, 11,(UB) "-+*-!-|> No Last Chance! <|-!-*+-", 3 }, { 33, 19,227,141,(UB) "Draw Here", 2 }, { 1, 13, 33,127,(UB) "Colors! Also Use Pick or Arrow keys", 1 }, { 42,161, 80,187,(UB) "Hit Alternate Alternate Spots ", 1 }, { 4,161, 42,187,(UB) "Only Hit Alternate Spots ", 1 }, {281,162,319,188,(UB) "Blast Current Color Everywhere", 0 }, { 80,161,118,187,(UB) "Select Color From Screen (anywhere)", 1 }, { 1,188,999,999,(UB) "User Befuddlement Enhancer ", 2 }, { 4,144, 42,170,(UB) "F; Fill a 3 x 3 Area (Ctrl == 9 x 9)", 1 }, {204,161,242,187,(UB) "S; Write a C Declaration", 1 }, {242,161,280,187,(UB) "L; Search File for DataName", 1 }, {156,161,194,187,(UB) "I; Add 1 to Name && FileName..try it!", 1 }, {194,143,315,160,(UB) "Name of the ImageData Declaration", 1 }, {156,144,194,161,(UB) "Save All or NorthWest Corner?", 1 }, {276,121,311,141,(UB) "C; Copy Into a New Little Window", 1 }, {234,122,264,141,(UB) "R; Flip thru All the Windows' Images", 1 }, {194,161,204,161+26,(UB) "Inc && Save (no stupid animations)", 1 }, {118,161,118+38,161+26,(UB) "F; Fill a Zone (Auto-BackUp)", 1 }, {231,100,248,119,(UB) "U; Jam This Back into Working Areas", 1 }, {231, 81,248,100,(UB) "Z; Copy Image Here where It's Safe", 1 }, {250, 80,316,119,(UB) "BackUp Copy for Dangerous Actions", 0 }, {243, 22,307, 62,(UB) "Your Favorite Little Picture", 0 }, { 18, -1, 39, 9,(UB) "PopArt - art movement of 1950-60s...", 2 }, { 40, -1, 60, 9,(UB) "...that used media symbols && common", 2 }, { 61, -1, 80, 9,(UB) "...objects in exaggerated contexts", 2 }, {126, -1,145, 9,(UB) "SciFi author, artist, programmer...", 2 }, {146, -1,165, 9,(UB) "...from behind the Orange Curtain...", 2 }, {166, -1,185, 9,(UB) "...at 714 641 7525 or 682 3783", 2 }, {267,121,272,145,(UB) "T; Put All Images under \"It\"", 1 }, {227,121,233,145,(UB) "Set Sequence of Images to Roll", 1 }, {118,144,156,161,(UB) "Clone && Load (no stupid animations)",1 }, {80,144,80+38,161,(UB) "Save w/ File Editing /* Comment? */",1 }, {42,144,50,149,(UB) "Ctrl-Save == Inc && Save",2 }, {42,150,50,155,(UB) "Click Window Image to Select",2 }, {42,156,50,161,(UB) "Ctrl-ColorTweaker == Save ColorMap",2 }, {51,144,58,149,(UB) "Ctrl-Load == Clone && Load",2 }, {51,150,58,155,(UB) "X; == KeyBoard Short-Cut",2 }, {51,156,58,161,(UB) "Alt-ColorTweaker == Load ColorMap",2 }, {59,144,64,149,(UB) "Right-Mouse == Pick Color",2 }, {59,150,64,155,(UB) "Ctrl-Click Image == See-Thru",2 }, {59,156,64,161,(UB) "Ctrl-Color == Search && Replace",2 }, {65,144,71,149,(UB) "L-Amiga-ColorTweaker == Default",2 }, {65,150,71,155,(UB) "Shift-Drag == Copy Area to ClipBoard",2 }, {65,156,71,161,(UB) "Click-Clip == Paste Clipped Area",2 }, {72,144,80,149,(UB) "Shift-Clip == All but Current Color",2 }, {72,150,80,155,(UB) "Alt-Clip == Only Current Color",2 }, {72,156,80,161,(UB) "Ctrl-Clip == Kill Clip Window",2 }, {201, 10,233, 19,(UB) "O; Toggle See-Thru Mode", 1 }, {169, 10,200, 19,(UB) "P; Toggle Pop-Thru Mode", 1 }, {137, 10,168, 19,(UB) "Close WorkBench && Free Memory",1 }, {104, 10,135, 19,(UB) "Write \"0xffff\" or \"65535\" in Array?",1 }, { 2,128, 12,128+16,(UB) " World's Smallest ColorTweaker",1 }, { 13,128, 21,128+16,(UB) " World's Smallest ColorTweaker",1 }, { 22,128, 34,128+16,(UB) " World's Smallest ColorTweaker",1 }, /* add new help here */ { 0, -1,999,999,(UB) "no action", 0}, {0}}; void help () /* Annoy All the Profficient Users */ { extern struct Window *win; static UB lastHelp; REG SHORT Mx = win->MouseX, My = win->MouseY; REG int i = 0; if (My < -1) My = -1; LOOP (; helps [i].help; ++i) IF ( Mx >= helps [i].xx && Mx <= helps [i].xxx && My >= helps [i].yy && My <= helps [i].yyy ) { if (lastHelp == helps [i].help) return; hotHelp ( lastHelp = helps [i].help, helps [i].heat, 0 ); return; } quit ("bug in program data arrays"); } UB widen (flub) char *flub; { static char stub [ 150 ]; stub [ 0 ] = ' '; stub [ 1 ] = 0 ; strcat ( stub, flub ); strcat ( stub, " "); stub [ 37 ] = 0; return ( UB ) stub; } /* I thought "rpad ()" would be a little tacky... */ void hotHelp (squeak, heat, persistence) UB squeak; { extern ST RastPort *reep; extern ST Gadget TGads []; static long heats [] = { 3, 28, 1, 2 }; static int lastpersistence; SS IntuiText blank = { 0, 0, JAM1 }; UB god; long wasmode = reep->DrawMode, x; if (persistence == 0 && lastpersistence--) return; lastpersistence = persistence; SetAPen (reep, heat == HHalert? 1L: 24L); SetDrMd (reep, JAM1); RectFill (reep, 0L, 187L, 319L, 199L); god = widen (squeak); if (heat != HHalert) { x = strlen (god); SetAPen (reep, 23L); Move (reep, 7L, 199L); Text (reep, god, x); SetAPen (reep, 22L); Move (reep, 8L, 198L); Text (reep, god, x); SetAPen (reep, 21L); Move (reep, 9L, 197L); Text (reep, god, x); SetAPen (reep, 20L); Move (reep, 10L, 196L); Text (reep, god, x); } SetAPen (reep, heats [heat]); Move (reep, 11L, 195L); Text (reep, god, x); SetAPen (reep, thisCol); SetDrMd (reep, wasmode); } /* this stuff is here because art.c and init.c were too big */ tweakColors () { int updn = My < 136? 1: -1; REG USHORT jack; USHORT rr, gg, bb; if izCtrl (mrQ) { saveColors (); return; } if izAlt (mrQ) { loadColors (); return; } if (mrQ == LCOM) { extern UWORD ni_colCMAP []; Mess ("Default Colors Restored"); LoadRGB4 (&(scr->ViewPort), ni_colCMAP, 32L); return; } jack = GetRGB4 (scr->ViewPort.ColorMap, thisCol); rr = jack >> 8; gg = (jack >> 4) & 0x000f; bb = (jack ) & 0x000f; switch (Mx < 13? 0: Mx < 22? 1: 2) { case 0: if (tweak (&rr, updn)) return; break; case 1: if (tweak (&gg, updn)) return; break; case 2: if (tweak (&bb, updn)) return; break; } SetRGB4 (&(scr->ViewPort), thisCol, (long) rr, (long) gg, (long) bb); } tweak (victim, assassin) USHORT *victim; { *victim += assassin; if (*victim > 15 || *victim < 0) { Mess ("Color Register at Limit"); return 1; } Mess ("Color Tweaked"); return 0; } unsigned int input () { REG struct IntuiMessage *massage; ULONG signal; void clipWinput (); msgclass = msgcode = 0; if (massage = (SMP) GetMsg (win->UserPort)) goto splashdown; ifn (izDn) { ifn (win->Flags & WINDOWACTIVE) Delay (2L); smallinput (); if (seqwin) if (GetMsg (seqwin->UserPort)) closeSeqWin (); if (clipWin) clipWinput (); if (win->Flags & WINDOWACTIVE) { extern int webefillin, CurrentWindow, curOnion; int boolshit; ifn (no_help) help (); boolshit = ((bloking && !webefillin) || (popping && curOnion != CurrentWindow))&& !picking; if (boolshit) flash_blok (); Wait (1L << win->UserPort->mp_SigBit); if (boolshit) flash_blok (); } else Delay (3L); /* okay, it's not a busy loop! satisfied? */ } while (massage = (SMP) GetMsg (win->UserPort)) { splashdown: msgclass = massage->Class; msgcode = massage->Code; Mx = massage->MouseX; My = massage->MouseY; mrQ = massage->Qualifier & Qmask; gadcode = (msgclass == GADGETUP) ? ((struct Gadget *) (massage->IAddress))->GadgetID : 0 ; ReplyMsg (massage); if (izDn && !bloking) return 1; if (msgclass == MOUSEBUTTONS || msgclass == RAWKEY) return 1; } return msgclass != CLOSEWINDOW; } /* end of life as we know it */ smallinput () { REG int k = maxsupwin; REG ST IntuiMessage *msg; while (k--) if (swin (k)) while (msg = (SMP) GetMsg (swin (k)->UserPort)) { dealwithit (k, msg); if (msg->Class == CLOSEWINDOW) break; ReplyMsg (msg); } } /* end of life as we know it also */ void clipWinput () { REG ST IntuiMessage *msg; while (msg = (SMP) GetMsg (clipWin->UserPort)) { UWORD clipQ; clipQ = msg->Qualifier & Qmask; if izCtrl (clipQ) { clozeClipWin (); Mess ("Killed ClipBoard"); RET; } if (msg->Class == MOUSEBUTTONS && msg->Code == SELECTUP) clipAction (clipQ); ReplyMsg (msg); } } /* REALLY the end of life as we know it */