4 Original GPL release version 4.12
5 Copyright 1993-2000 Jonathan Potter
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 All users of Directory Opus 4 (including versions distributed
22 under the GPL) are entitled to upgrade to the latest version of
23 Directory Opus version 5 at a reduced price. Please see
24 http://www.gpsoft.com.au for more information.
26 The release of Directory Opus 4 under the GPL in NO WAY affects
27 the existing commercial status of Directory Opus 5.
33 int __saveds
DoRawkeyToStr(register UWORD code
__asm("d0"),
34 register UWORD qual
__asm("d1"),
35 register char *buf
__asm("a0"),
36 register char *kbuf
__asm("a1"),
37 register int len
__asm("d2"))
39 struct InputEvent inev
;
42 struct Process
*myproc
;
43 struct ConsoleDevice
*ConsoleDevice
;
44 char ocbuf
[20],cbuf
[20],*foo
;
48 if (code
!=(UWORD
)~0 && code
!=0xff) {
49 if (code
&IECODE_UP_PREFIX
) code
-=0x80;
50 if (code
>=0x50 && code
<=0x59) LSprintf(cbuf
,"F%ld",code
-0x4f);
51 else if (code
!=(UWORD
)~0 && code
!=0xff) {
54 case 0x45: foo
="ESCAPE"; break;
55 case 0x46: foo
="DELETE"; break;
56 case 0x41: foo
="BACKSPACE"; break;
57 case 0x42: foo
="TAB"; break;
59 case 0x2b: foo
="RETURN"; break;
60 case 0x5f: foo
="HELP"; break;
62 case 0x4c: foo
="CURSOR-UP"; break;
63 case 0x4d: foo
="CURSOR-DOWN"; break;
64 case 0x4f: foo
="CURSOR-LEFT"; break;
65 case 0x4e: foo
="CURSOR-RIGHT"; break;
66 case 0x43: foo
="ENTER"; break;
67 case 0x40: foo
="SPACE"; break;
69 if (foo
) LStrCpy(cbuf
,foo
);
70 if (!(myproc
=(struct Process
*)FindTask(NULL
))) return(0);
71 port
=&myproc
->pr_MsgPort
;
72 if (!(req
=(struct IOStdReq
*)CreateExtIO(port
,sizeof(struct IOStdReq
)))) return(0);
73 if (OpenDevice("console.device",-1,(struct IORequest
*)req
,0)) {
74 DeleteExtIO((struct IORequest
*)req
);
77 ConsoleDevice
=(struct ConsoleDevice
*)req
->io_Device
;
78 inev
.ie_NextEvent
=NULL
;
79 inev
.ie_Class
=IECLASS_RAWKEY
;
82 inev
.ie_Qualifier
=qual
&(IEQUALIFIER_LSHIFT
|IEQUALIFIER_RSHIFT
);
83 inev
.ie_EventAddress
=NULL
;
85 RawKeyConvert(&inev
,ocbuf
,2,NULL
);
87 CloseDevice((struct IORequest
*)req
);
88 DeleteExtIO((struct IORequest
*)req
);
89 if (kbuf
) kbuf
[0]=ocbuf
[0];
90 if (!foo
) LStrCpy(cbuf
,ocbuf
);
94 if (qual
&IEQUALIFIER_LCOMMAND
) DoStrConcat(buf
,"LAMIGA + ",len
);
95 if (qual
&IEQUALIFIER_RCOMMAND
) DoStrConcat(buf
,"RAMIGA + ",len
);
96 if (qual
&IEQUALIFIER_CONTROL
) DoStrConcat(buf
,"CONTROL + ",len
);
97 if (qual
&IEQUALIFIER_LSHIFT
) DoStrConcat(buf
,"LSHIFT + ",len
);
98 if (qual
&IEQUALIFIER_RSHIFT
) DoStrConcat(buf
,"RSHIFT + ",len
);
99 if (qual
&IEQUALIFIER_LALT
) DoStrConcat(buf
,"LALT + ",len
);
100 if (qual
&IEQUALIFIER_RALT
) DoStrConcat(buf
,"RALT + ",len
);
101 if ((code
==(UWORD
)~0 || code
==0xff/* || code==0*/) && buf
[0]) buf
[strlen(buf
)-3]=0;
103 StrToUpper(cbuf
,ocbuf
);
104 DoStrConcat(buf
,"'",len
);
105 DoStrConcat(buf
,ocbuf
,len
);
106 DoStrConcat(buf
,"'",len
);
112 int __saveds
DoCheckNumGad(register struct Gadget
*gad
__asm("a0"),
113 register struct Window
*win
__asm("a1"),
114 register int min
__asm("d0"),
115 register int max
__asm("d1"))
117 struct StringInfo
*sinfo
;
120 sinfo
=(struct StringInfo
*)gad
->SpecialInfo
;
121 a
=b
=atoi((char *)sinfo
->Buffer
);
123 else if (a
>max
) a
=max
;
124 LSprintf((char *)sinfo
->Buffer
,"%ld",a
);
126 if (win
) RefreshStrGad(gad
,win
);
132 int __saveds
DoCheckHexGad(register struct Gadget
*gad
__asm("a0"),
133 register struct Window
*win
__asm("a1"),
134 register int min
__asm("d0"),
135 register int max
__asm("d1"))
137 struct StringInfo
*sinfo
;
140 sinfo
=(struct StringInfo
*)gad
->SpecialInfo
;
141 b
=DoAtoh((char *)sinfo
->Buffer
,0);
142 if (sinfo
->Buffer
[0]==0) a
=0;
146 else if (a
>max
) a
=max
;
148 LSprintf((char *)sinfo
->Buffer
,"%lx",a
);
150 if (win
) RefreshStrGad(gad
,win
);
156 void __saveds
DoDecode_RLE(register char *source
__asm("a0"),
157 register char *dest
__asm("a1"),
158 register int size
__asm("d0"))
161 register char copy
,count
;
164 if ((count
=source
[a
++])>=0) {
166 while (copy
--) *dest
++=source
[a
++];
168 else if (count
!=-128) {
170 while (copy
--) *dest
++=source
[a
];
176 const static struct TagItem
181 //extern UWORD __chip busydata13[];
182 //extern UWORD __chip busydata20[];
184 void __saveds
DoSetBusyPointer(register struct Window
*wind
__asm("a0"))
186 // if (IntuitionBase->LibNode.lib_Version>38)
187 SetWindowPointerA(wind
,busytags
);
188 // else if (IntuitionBase->LibNode.lib_Version<36)
189 // SetPointer(wind,busydata13,22,16,-6,0);
190 // else SetPointer(wind,busydata20,16,16,-6,0);