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.
32 #include <devices/newmouse.h>
34 #include <devices/rawkeycodes.h>
38 #include <libraries/screennotify.h>
43 int x
,y
,a
,function
,wmes
,stringgd
=0,waitbits
,b
,x1
,y1
,c
,win
,dir
,num
;
45 UWORD code
,gadgetid
,menunum
,itemnum
,qual
;
46 UBYTE old_change_state
;
47 char buf
[80],buf2
[30],ch
;
48 struct dopusgadgetbanks
*bank
,*bank1
;
49 struct AppMessage
*apmsg
;
50 struct dopushotkey
*hotkey
;
51 struct dopusfuncpar par
;
53 struct MenuItem
*item
;
57 waitbits
=1<<Window
->UserPort
->mp_SigBit
|1<<count_port
->mp_SigBit
|rexx_signalbit
|INPUTSIG_HOTKEY
|1<<snm_port
->mp_SigBit
;
58 if (/*system_version2 &&*/ WorkbenchBase
&& dopus_appwindow
)
59 waitbits
|=1<<appmsg_port
->mp_SigBit
;
60 if ((wmes
=Wait(waitbits
))&INPUTSIG_HOTKEY
) {
61 if (dopus_globalhotkey
==(struct dopushotkey
*)-1) {
62 function
=FUNC_QUIT
; dopus_globalhotkey
=NULL
;
65 else if (dopus_globalhotkey
==(struct dopushotkey
*)-2) {
66 function
=FUNC_ICONIFY
; dopus_globalhotkey
=NULL
;
69 else if (!dopus_globalhotkey
) continue;
70 hotkey
=dopus_globalhotkey
; dopus_globalhotkey
=NULL
;
71 CopyMem((char *)&hotkey
->func
.which
,(char *)&par
,sizeof(struct dopusfuncpar
));
72 par
.which
&=FLAG_OUTWIND
|FLAG_NOQUOTE
|FLAG_SHELLUP
|FLAG_DOPUSUP
;
73 par
.which
|=FLAG_ASYNC
;
74 if (par
.which
&FLAG_OUTWIND
) par
.which
|=FLAG_WB2F
;
75 status_flags
|=STATUS_FROMHOTKEY
;
76 dofunctionstring(hotkey
->func
.function
,hotkey
->name
,NULL
,&par
);
77 status_flags
&=~STATUS_FROMHOTKEY
;
80 if (wmes
&rexx_signalbit
) {
82 if (func_global_function
)
83 internal_function(func_global_function
,rexx_global_flag
,NULL
,NULL
);
88 if (WorkbenchBase
&& dopus_appwindow
&&
89 (wmes
&(1<<appmsg_port
->mp_SigBit
))) {
90 ActivateWindow(Window
);
91 while ((apmsg
=(struct AppMessage
*)GetMsg(appmsg_port
))) {
92 if (apmsg
->am_Type
==AMTYPE_APPWINDOW
&& apmsg
->am_ID
==APPWINID
) {
93 for (a
=0;a
<apmsg
->am_NumArgs
;a
++) {
94 if (apmsg
->am_ArgList
[a
].wa_Lock
) {
95 if ((b
=isinwindow(apmsg
->am_MouseX
,apmsg
->am_MouseY
))!=-1) { // lister area
96 if (!(*apmsg
->am_ArgList
[a
].wa_Name
)) {
97 PathName(apmsg
->am_ArgList
[a
].wa_Lock
,str_pathbuffer
[b
],256);
98 checkdir(str_pathbuffer
[b
],&path_strgadget
[b
]);
99 startgetdir(b
,SGDFLAGS_CANMOVEEMPTY
);
103 c
=data_active_window
;
105 PathName(apmsg
->am_ArgList
[a
].wa_Lock
,func_external_file
,256);
106 TackOn(func_external_file
,apmsg
->am_ArgList
[a
].wa_Name
,256);
107 dofunctionstring("*copy",NULL
,NULL
,NULL
);
111 else if (dopus_curgadbank
&&
112 (b
=gadgetfrompos(apmsg
->am_MouseX
,apmsg
->am_MouseY
))!=-1) { // gadget bank area
113 b
+=(data_gadgetrow_offset
*7);
114 if (isvalidgad(&dopus_curgadbank
->gadgets
[b
])) {
115 PathName(apmsg
->am_ArgList
[a
].wa_Lock
,func_external_file
,256);
116 if (func_external_file
[0] &&
117 func_external_file
[(strlen(func_external_file
)-1)]==':' &&
118 !apmsg
->am_ArgList
[a
].wa_Name
[0])
119 TackOn(func_external_file
,"Disk.info",256);
120 else TackOn(func_external_file
,apmsg
->am_ArgList
[a
].wa_Name
,256);
121 if (!(CheckExist(func_external_file
,NULL
)))
122 StrConcat(func_external_file
,".info",256);
123 dofunctionstring(dopus_curgadbank
->gadgets
[b
].function
,
124 dopus_curgadbank
->gadgets
[b
].name
,
125 NULL
,(struct dopusfuncpar
*)&dopus_curgadbank
->gadgets
[b
].which
);
128 else if (apmsg
->am_MouseY
<scrdata_yoffset
+scrdata_status_height
) {
129 if (apmsg
->am_ArgList
[a
].wa_Name
[0]) {
132 PathName(apmsg
->am_ArgList
[a
].wa_Lock
,pathbuf
,256);
133 strcpy(func_external_file
,pathbuf
);
134 TackOn(func_external_file
,apmsg
->am_ArgList
[a
].wa_Name
,256);
135 ftype_doubleclick(pathbuf
,apmsg
->am_ArgList
[a
].wa_Name
,0);
141 func_external_file
[0]=0;
143 ReplyMsg((struct Message
*)apmsg
);
148 if (wmes
&(1<<count_port
->mp_SigBit
)) {
149 struct NotifyMessage
*note
;
152 while ((note
=(struct NotifyMessage
*)GetMsg(count_port
))) {
153 D(bug("DOS notification message\n"));
154 if (/*system_version2 &&*/ config
->dynamicflags
&UPDATE_NOTIFY
) {
155 a
=note
->nm_NReq
->nr_UserData
;
156 ReplyMsg((struct Message
*)note
);
161 if (!(config
->dirflags
&DIRFLAGS_REREADOLD
) ||
162 IntuitionBase
->ActiveWindow
==Window
) {
163 struct DirWindowPars notifypars
;
165 notifypars
.reselection_list
=NULL
;
166 makereselect(¬ifypars
,a
);
167 startgetdir(a
,SGDFLAGS_CANMOVEEMPTY
);
168 doreselect(¬ifypars
,0);
169 makereselect(¬ifypars
,-1);
174 else ReplyMsg((struct Message
*)note
);
180 if (wmes
& (1 << snm_port
->mp_SigBit
))
184 while ((snm
= (struct ScreenNotifyMessage
*) GetMsg(snm_port
)))
187 if (snm
->snm_Type
== SCREENNOTIFY_TYPE_WORKBENCH
)
189 if (snm
->snm_Value
== FALSE
) /* Workbench close notification */
191 if (! status_iconified
) if (config
->screenmode
== MODE_WORKBENCHUSE
) do_iconify
= TRUE
;
194 if (do_iconify
) internal_function(FUNC_SCREENNOTIFY
,0,NULL
,NULL
);
195 else ReplyMsg((struct Message
*) snm
);
200 while (getintuimsg()) {
203 time_current_sec
=IMsg
->Seconds
;
204 time_current_micro
=IMsg
->Micros
;
207 qual
=IMsg
->Qualifier
;
208 if (class==IDCMP_GADGETUP
|| class==IDCMP_GADGETDOWN
) {
209 gad
=(struct Gadget
*) IMsg
->IAddress
;
210 gadgetid
=gad
->GadgetID
;
212 ReplyMsg((struct Message
*) IMsg
);
213 if (Window
->FirstRequest
) continue;
215 function
=status_haveaborted
=0;
217 /// "IDCMP_ACTIVEWINDOW"
218 case IDCMP_ACTIVEWINDOW
:
219 for (a
=0;a
<2;a
++) check_old_buffer(a
);
225 config
->scr_winw
=Window
->Width
;
226 config
->scr_winh
=Window
->Height
;
228 config
->scrw
=config
->scr_winw
;
229 config
->scrh
=config
->scr_winh
;
231 config
->screenflags
&=~(SCRFLAGS_DEFWIDTH
|SCRFLAGS_DEFHEIGHT
);
234 dostatustext(str_last_statustext
);
238 /// "IDCMP_CLOSEWINDOW"
239 case IDCMP_CLOSEWINDOW
:
241 if (!(config
->generalflags
&GENERAL_FORCEQUIT
)) a
=simplerequest(globstring
[STR_REALLY_QUIT
],globstring
[STR_QUIT
],str_cancelstring
,globstring
[STR_ICONIFY
],NULL
);
244 if (a
==2) function
=FUNC_ICONIFY
;
249 strcpy(rexx_args
[0],"force");
255 /// "IDCMP_DISKREMOVED"
256 case IDCMP_DISKREMOVED
:
261 /// "IDCMP_DISKINSERTED"
262 case IDCMP_DISKINSERTED
:
263 old_change_state
=disk_change_state
;
265 if (config
->dirflags
&DIRFLAGS_AUTODISKC
) {
266 if (IntuitionBase
->ActiveWindow
==Window
268 || !(status_flags
&STATUS_IANSCRAP
)
273 if ((old_change_state
&(1<<a
))!=(disk_change_state
&(1<<a
))) {
274 lsprintf(buf
,"DF%ld:",(long int)a
);
275 lsprintf(buf2
,"PC%ld:",(long int)a
);
277 if ((Stricmp(dopus_curwin
[b
]->realdevice
,buf
)==0) ||
278 (Stricmp(dopus_curwin
[b
]->realdevice
,buf2
)==0)) {
279 identify_and_load(b
,a
);
289 if (IntuitionBase
->ActiveWindow
==Window
) {
290 if (config
->dirflags
&DIRFLAGS_AUTODISKL
) {
292 if ((old_change_state
&(1<<a
))!=(disk_change_state
&(1<<a
)) &&
293 identify_and_load(-1,a
)) {
294 lsprintf(buf
,globstring
[STR_NEW_DISK_INSERTED
],a
);
295 if ((b
=simplerequest(buf
,globstring
[STR_LEFT_WINDOW
],
296 str_cancelstring
,globstring
[STR_RIGHT_WINDOW
],NULL
))) {
297 identify_and_load(b
-1,a
);
308 Window
->Flags
|=RMBTRAP
;
309 if (!Window
->MenuStrip
) break;
311 checkstringgads(stringgd
);
314 if (code
==MENUNULL
) break;
315 menunum
=menu_real_number
[MENUNUM(code
)];
317 item
=menu_menus
[menunum
].FirstItem
;
318 for (a
=0,itemnum
=0;a
<num
&& item
;a
++) {
319 if (item
->Flags
&ITEMTEXT
) ++itemnum
;
323 a
=(menunum
*20)+itemnum
;
324 if (!isvalidgad(&config
->menu
[a
])) break;
325 dofunctionstring(config
->menu
[a
].function
,config
->menu
[a
].name
,
326 NULL
,(struct dopusfuncpar
*)&config
->menu
[a
].which
);
330 /// "IDCMP_GADGETDOWN"
331 case IDCMP_GADGETDOWN
:
333 checkstringgads(stringgd
);
338 case SCRGAD_MOVEDOWN1
:
340 case SCRGAD_MOVEDOWN2
:
341 if (gadgetid
==SCRGAD_MOVEUP1
|| gadgetid
==SCRGAD_MOVEUP2
) dir
=-1;
343 if (gadgetid
==SCRGAD_MOVEUP1
|| gadgetid
==SCRGAD_MOVEDOWN1
) win
=0;
345 if (config
->generalflags
&GENERAL_ACTIVATE
) makeactive(win
,0);
346 verticalscroll(win
,dir
);
348 while (!getintuimsg())
349 if (gad
->Flags
&SELECTED
) verticalscroll(win
,dir
);
350 ReplyMsg((struct Message
*) IMsg
);
353 case SCRGAD_MOVELEFT1
:
354 case SCRGAD_MOVERIGHT1
:
355 case SCRGAD_MOVELEFT2
:
356 case SCRGAD_MOVERIGHT2
:
357 if (gadgetid
==SCRGAD_MOVELEFT1
|| gadgetid
==SCRGAD_MOVELEFT2
) dir
=-1;
359 if (gadgetid
==SCRGAD_MOVELEFT1
|| gadgetid
==SCRGAD_MOVERIGHT1
) win
=0;
361 if (config
->generalflags
&GENERAL_ACTIVATE
) makeactive(win
,0);
362 horizontalscroll(win
,dir
);
364 while (!getintuimsg())
365 if (gad
->Flags
&SELECTED
) horizontalscroll(win
,dir
);
366 ReplyMsg((struct Message
*) IMsg
);
369 case SCRGAD_LEFTPROP
:
370 case SCRGAD_RIGHTPROP
:
371 if (gadgetid
==SCRGAD_LEFTPROP
) a
=0;
373 if (config
->generalflags
&GENERAL_ACTIVATE
) makeactive(a
,0);
376 Wait(1<<Window
->UserPort
->mp_SigBit
);
378 while (getintuimsg()) {
380 ReplyMsg((struct Message
*) IMsg
);
381 if (class==IDCMP_MOUSEMOVE
) doposprop(a
);
382 else if (class==IDCMP_GADGETUP
) break;
384 if (class==IDCMP_GADGETUP
) break;
386 dopus_curwin
[a
]->offset
=-1;
390 case SCRGAD_LEFTHPROP
:
391 case SCRGAD_RIGHTHPROP
:
392 if (gadgetid
==SCRGAD_LEFTHPROP
) a
=0;
394 if (config
->generalflags
&GENERAL_ACTIVATE
) makeactive(a
,0);
397 Wait(1<<Window
->UserPort
->mp_SigBit
);
399 while (getintuimsg()) {
401 ReplyMsg((struct Message
*) IMsg
);
402 if (class==IDCMP_MOUSEMOVE
) doposhprop(a
);
403 else if (class==IDCMP_GADGETUP
) break;
405 if (class==IDCMP_GADGETUP
) break;
407 dopus_curwin
[a
]->hoffset
=-1;
411 case SCRGAD_DRIVEPROP
:
412 if (config
->generalscreenflags
&SCR_GENERAL_GADSLIDERS
) {
415 Wait(1<<Window
->UserPort
->mp_SigBit
);
417 while (getintuimsg()) {
419 ReplyMsg((struct Message
*) IMsg
);
420 if (class==IDCMP_MOUSEMOVE
) doposdriveprop();
421 else if (class==IDCMP_GADGETUP
) break;
423 if (class==IDCMP_GADGETUP
) break;
429 case SCRGAD_GADGETPROP
:
430 if (config
->generalscreenflags
&SCR_GENERAL_GADSLIDERS
) {
435 ReplyMsg((struct Message
*) IMsg
);
436 if (class==IDCMP_MOUSEMOVE
) continue;
437 else if (class==IDCMP_GADGETUP
) break;
439 Wait(1<<Window
->UserPort
->mp_SigBit
);
445 case SCRGAD_LEFTSTRING
:
446 case SCRGAD_RIGHTSTRING
:
456 if (gadgetid
!=SCRGAD_LEFTSTRING
&& gadgetid
!=SCRGAD_RIGHTSTRING
)
457 checkstringgads(stringgd
);
460 if (gadgetid
>=MAIN_GAD_BASE
&& gadgetid
<MAIN_GAD_BASE
+GADCOUNT
) {
461 a
=(gadgetid
-MAIN_GAD_BASE
)+(data_gadgetrow_offset
*7);
463 D(bug("doidcmp: a = %ld\n",a
);KDump(&dopus_curgadbank
->gadgets
[a
],sizeof(struct newdopusfunction
)));
465 if (!dopus_curgadbank
|| !(isvalidgad(&dopus_curgadbank
->gadgets
[a
]))) break;
466 dofunctionstring(dopus_curgadbank
->gadgets
[a
].function
,
467 dopus_curgadbank
->gadgets
[a
].name
,
468 NULL
,(struct dopusfuncpar
*)&dopus_curgadbank
->gadgets
[a
].which
);
472 case SCRGAD_LEFTSTRING
:
473 case SCRGAD_RIGHTSTRING
:
474 if (code
==0x5f) do_path_completion(gadgetid
,qual
);
475 else if (code
!=0x9) {
476 makeactive(gadgetid
,0);
477 startgetdir(gadgetid
,SGDFLAGS_CANMOVEEMPTY
);
481 case SCRGAD_BUFFERLEFT1
:
482 incrementbuf(0,-1,1);
485 case SCRGAD_BUFFERRIGHT1
:
489 case SCRGAD_BUFFERLEFT2
:
490 incrementbuf(1,-1,1);
493 case SCRGAD_BUFFERRIGHT2
:
499 function
=FUNC_PARENT
;
504 function
=FUNC_PARENT
;
507 case SCRGAD_TINYFILTER
:
508 if (status_flags
&STATUS_HELP
) {
509 dohelp(NULL
,"*Filter",0,0,NULL
);
510 screen_gadgets
[SCRGAD_TINYFILTER
].Flags
^=GFLG_SELECTED
;
511 dolittlegads(&screen_gadgets
[SCRGAD_TINYFILTER
],&globstring
[STR_TINY_BUTTONS
][6],1);
513 else if (screen_gadgets
[SCRGAD_TINYFILTER
].Flags
&GFLG_SELECTED
) {
515 if (!(whatsit(globstring
[STR_ENTER_FILTER
],40,str_filter
,NULL
)) ||
517 screen_gadgets
[SCRGAD_TINYFILTER
].Flags
&=~GFLG_SELECTED
;
518 dolittlegads(&screen_gadgets
[SCRGAD_TINYFILTER
],&globstring
[STR_TINY_BUTTONS
][6],1);
519 str_filter_parsed
[0]=0;
521 else LParsePatternI(str_filter
,str_filter_parsed
);
524 else str_filter_parsed
[0]=0;
530 if (function
==FUNC_QUIT
&& status_flags
&STATUS_IANSCRAP
) {
532 strcpy(rexx_args
[0],"force");
544 readkeys(var_key_matrix);
546 if (!(var_key_matrix[a]&(1<<b)))
548 if (code
& IECODE_UP_PREFIX
)
553 qual
&=VALID_QUALIFIERS
;
554 bank
=dopus_firstgadbank
;
556 for (a
=0;a
<GADCOUNT
;a
++) {
557 if (check_key_press((struct dopusfunction
*)&bank
->gadgets
[a
],code
,qual
)) {
558 dofunctionstring(bank
->gadgets
[a
].function
,bank
->gadgets
[a
].name
,
559 NULL
,(struct dopusfuncpar
*)&bank
->gadgets
[a
].which
);
565 for (a
=0;a
<MENUCOUNT
;a
++) {
566 if (check_key_press((struct dopusfunction
*)&config
->menu
[a
],code
,qual
)) {
567 dofunctionstring(config
->menu
[a
].function
,config
->menu
[a
].name
,
568 NULL
,(struct dopusfuncpar
*)&config
->menu
[a
].which
);
572 for (a
=0;a
<USEDRIVECOUNT
;a
++) {
573 if (check_key_press(&config
->drive
[a
],code
,qual
)) {
574 strcpy(str_pathbuffer
[data_active_window
],config
->drive
[a
].function
);
575 startgetdir(data_active_window
,SGDFLAGS_CANMOVEEMPTY
);
579 if (qual
&(IEQUALIFIER_RCOMMAND
|IEQUALIFIER_LCOMMAND
)) {
580 RawkeyToStr(code
,qual
,NULL
,buf
,0);
581 switch (ToUpper(buf
[0])) {
582 case 'R': function
=FUNC_RESELECT
; break;
583 case 'A': function
=FUNC_AREXX
; break;
584 case 'S': function
=FUNC_SELECT
; break;
585 case 'B': function
=FUNC_BUFFERLIST
; break;
587 if (qual
&IEQUALIFIER_LCOMMAND
) findfirstsel(data_active_window
,ENTRY_FILE
);
588 else findfirstsel(data_active_window
,ENTRY_DIRECTORY
);
592 case 0x13: function=FUNC_RESELECT; break; // R
593 case 0x20: function=FUNC_AREXX; break; // A
594 case 0x21: function=FUNC_SELECT; break; // S
595 case 0x35: function=FUNC_BUFFERLIST; break;// B
597 if (qual&IEQUALIFIER_LCOMMAND) findfirstsel(data_active_window,ENTRY_FILE);
598 else findfirstsel(data_active_window,ENTRY_DIRECTORY);
606 case RAWKEY_NM_WHEEL_UP
:
607 if ((y
>=scrdata_gadget_ypos
) && (y
<=scrdata_gadget_ypos
+(scr_gadget_rows
*scrdata_gadget_height
))) // gadget bank area
609 if ((x
>=scrdata_gadget_offset
) && (x
<scrdata_gadget_xpos
) && scr_gadget_rows
) //drive bank
611 if (scrdata_drive_width
)
614 if (data_drive_offset
< 0) data_drive_offset
= 0;
615 if (config
->generalscreenflags
&SCR_GENERAL_GADSLIDERS
) {
616 FixSliderPot(Window
,&drive_propgad
,data_drive_offset
,
617 USEDRIVECOUNT
,scr_gadget_rows
,!status_iconified
);
619 if (!status_iconified
) fixdrivegadgets();
624 int max
= (getgadbankcount()*6)/scr_gadget_rows
,
625 pos
= GetSliderPos(&gadget_propgad
,max
,1);
627 if (--pos
< 0) pos
= 0;
630 FixSliderPot(Window
,&gadget_propgad
,pos
,max
,1,0);
637 win
= isinwindow(x
,y
); // lister area
639 if (win
== -1) break;
641 if (win
== -1) win
= data_active_window
;
642 if (dopus_curwin
[win
]->total
<scrdata_dispwin_lines
) break;
643 if (qual
&(IEQUALIFIER_CONTROL
|IEQUALIFIER_ANYSHIFT
)) {
644 if (qual
&IEQUALIFIER_CONTROL
) dopus_curwin
[win
]->offset
=0;
646 dopus_curwin
[win
]->offset
-=scrdata_dispwin_lines
;
647 if (dopus_curwin
[win
]->offset
<0)
648 dopus_curwin
[win
]->offset
=0;
654 verticalscroll(win
,-1);
656 case RAWKEY_NM_WHEEL_DOWN
:
657 if ((y
>=scrdata_gadget_ypos
) && (y
<=scrdata_gadget_ypos
+(scr_gadget_rows
*scrdata_gadget_height
))) // gadget bank area
659 if ((x
>=scrdata_gadget_offset
) && (x
<scrdata_gadget_xpos
) && scr_gadget_rows
) //drive bank
661 if (scrdata_drive_width
)
664 if (data_drive_offset
> (USEDRIVECOUNT
-scr_gadget_rows
)) data_drive_offset
= USEDRIVECOUNT
- scr_gadget_rows
;
665 if (config
->generalscreenflags
&SCR_GENERAL_GADSLIDERS
) {
666 FixSliderPot(Window
,&drive_propgad
,data_drive_offset
,
667 USEDRIVECOUNT
,scr_gadget_rows
,!status_iconified
);
669 if (!status_iconified
) fixdrivegadgets();
674 int max
= (getgadbankcount()*6)/scr_gadget_rows
,
675 pos
= GetSliderPos(&gadget_propgad
,max
,1);
677 if (++pos
== max
) pos
= max
-1;
680 FixSliderPot(Window
,&gadget_propgad
,pos
,max
,1,0);
687 win
= isinwindow(x
,y
); // lister area
689 if (win
== -1) break;
691 if (win
== -1) win
= data_active_window
;
692 if (dopus_curwin
[win
]->total
<scrdata_dispwin_lines
) break;
693 if (qual
&(IEQUALIFIER_CONTROL
|IEQUALIFIER_ANYSHIFT
)) {
694 if (qual
&IEQUALIFIER_CONTROL
)
695 dopus_curwin
[win
]->offset
=dopus_curwin
[win
]->total
-scrdata_dispwin_lines
;
697 dopus_curwin
[win
]->offset
+=scrdata_dispwin_lines
;
698 if (dopus_curwin
[win
]->offset
>dopus_curwin
[win
]->total
-scrdata_dispwin_lines
)
699 dopus_curwin
[win
]->offset
=dopus_curwin
[win
]->total
-scrdata_dispwin_lines
;
705 verticalscroll(win
,1);
708 if (qual
&(IEQUALIFIER_LALT
|IEQUALIFIER_RALT
)) {
709 incrementbuf(data_active_window
,-1,1);
712 case RAWKEY_NM_WHEEL_LEFT
:
713 if (code
== RAWKEY_NM_WHEEL_LEFT
)
715 win
= isinwindow(x
,y
); // lister area
716 if (win
== -1) break;
718 if (win
== -1) win
= data_active_window
;
719 if (dopus_curwin
[win
]->total
==0) break;
720 if (qual
&(IEQUALIFIER_CONTROL
|IEQUALIFIER_ANYSHIFT
)) {
721 if (qual
&IEQUALIFIER_CONTROL
) dopus_curwin
[win
]->hoffset
=0;
723 dopus_curwin
[win
]->hoffset
-=scrdata_dispwin_nchars
[win
];
724 if (dopus_curwin
[win
]->hoffset
<0) dopus_curwin
[win
]->hoffset
=0;
726 refreshwindow(win
,1);
729 horizontalscroll(win
,-1);
732 if (qual
&(IEQUALIFIER_LALT
|IEQUALIFIER_RALT
)) {
733 incrementbuf(data_active_window
,1,1);
736 case RAWKEY_NM_WHEEL_RIGHT
:
737 if (code
== RAWKEY_NM_WHEEL_RIGHT
)
739 win
= isinwindow(x
,y
); // lister area
740 if (win
== -1) break;
742 if (win
== -1) win
= data_active_window
;
743 if (dopus_curwin
[win
]->total
==0) break;
744 if (qual
&(IEQUALIFIER_CONTROL
|IEQUALIFIER_ANYSHIFT
)) {
745 if (qual
&IEQUALIFIER_CONTROL
) {
746 dopus_curwin
[win
]->hoffset
=dopus_curwin
[win
]->hlen
-scrdata_dispwin_nchars
[win
];
747 if (dopus_curwin
[win
]->hoffset
<0) dopus_curwin
[win
]->hoffset
=0;
750 dopus_curwin
[win
]->hoffset
+=scrdata_dispwin_nchars
[win
];
751 if (dopus_curwin
[win
]->hoffset
>=(dopus_curwin
[win
]->hlen
-scrdata_dispwin_nchars
[win
]))
752 dopus_curwin
[win
]->hoffset
=dopus_curwin
[win
]->hlen
-scrdata_dispwin_nchars
[win
];
754 refreshwindow(win
,1);
757 horizontalscroll(win
,1);
766 makeactive(1-data_active_window
,1);
769 if (qual
&IEQUALIFIER_ANYSHIFT
) function
=FUNC_BUFFERLIST
;
770 else if (qual
&(IEQUALIFIER_LALT
|IEQUALIFIER_RALT
)) function
=FUNC_DEVICELIST
;
771 else ActivateStrGad(&path_strgadget
[data_active_window
],Window
);
774 dosizedirwindows(-60000);
780 dosizedirwindows(60000);
789 if (code
<0x40 && !(qual
&IEQUALIFIER_CONTROL
)) { // a digit or char
790 RawkeyToStr(code
,qual
,NULL
,buf
,0);
792 if (_isprint(ch
)) findfirstchar(data_active_window
,ch
);
801 /// "IDCMP_MOUSEBUTTONS"
802 case IDCMP_MOUSEBUTTONS
:
804 checkstringgads(stringgd
);
807 if (code
==SELECTDOWN
) {
808 if (y
>=scrdata_diskname_ypos
&& y
<scrdata_diskname_ypos
+scrdata_diskname_height
) { // disk name bar
809 a
=(x
<scrdata_dispwin_center
)?0:1;
810 if (data_active_window
==1-a
) {
811 if (DoubleClick(time_previous_sec
,time_previous_micro
,
812 time_current_sec
,time_current_micro
)) {
813 copydirwin(dopus_curwin
[1-a
],dopus_curwin
[a
],a
);
818 if (DoubleClick(time_previous_sec
,time_previous_micro
,
819 time_current_sec
,time_current_micro
)) {
821 if (str_pathbuffer
[data_active_window
][0] &&
822 do_parent_multi(str_pathbuffer
[data_active_window
]))
823 startgetdir(data_active_window
,SGDFLAGS_CANMOVEEMPTY
|SGDFLAGS_CANCHECKBUFS
);
826 time_previous_sec
=time_current_sec
;
827 time_previous_micro
=time_current_micro
;
832 else if (x
>scrdata_dispwin_center
-3 && x
<scrdata_dispwin_center
+2 &&
833 y
>=scrdata_dispwin_ypos
&& y
<scrdata_dispwin_height
+scrdata_dispwin_ypos
) { // lister inner edge
834 dosizedirwindows(65536);
836 else if ((a
=isinwindow(x
,y
))!=-1) doselection(a
,TRUE
); // lister area
837 else if (x
>=scrdata_xoffset
&& x
<scrdata_xoffset
+scrdata_clock_width
&& // button bank area
838 y
>scrdata_clock_ypos
-3) {
840 if ((data_gadgetrow_offset
+=scr_gadget_rows
)>=6) {
841 data_gadgetrow_offset
=0;
842 bank
=dopus_curgadbank
;
843 if (dopus_curgadbank
&& dopus_curgadbank
->next
)
844 dopus_curgadbank
=dopus_curgadbank
->next
;
845 else dopus_curgadbank
=dopus_firstgadbank
;
846 if (bank
!=dopus_curgadbank
|| scr_gadget_rows
<6) drawgadgets(0,0);
848 else drawgadgets(0,0);
852 else if (code
==MENUDOWN
) {
853 if ((a
=DoRMBGadget(mainrmbgads
,Window
))>-1) { // check buttons reacting on RMB click
858 if (x
<scrdata_xoffset
+3) w
= 0;
862 if (!(dopus_curwin
[w
]->flags
& DWF_ARCHIVE
))
864 strcpy(buf
,dopus_curwin
[w
]->directory
);
867 function
= FUNC_DEVICELIST
;
874 else if (y
<scrdata_diskname_ypos
||
875 y
>scrdata_yoffset
+scrdata_height
||
877 x
>scrdata_xoffset
+scrdata_width
) // window frame
880 else if (y
>=scrdata_diskname_ypos
&& y
<=scrdata_dispwin_ypos
) { /* diskname bar */
881 if (x
<scrdata_dispwin_center
) a
=1;
883 if (data_active_window
==a
) {
884 if (DoubleClick(time_previous_sec
,time_previous_micro
,
885 time_current_sec
,time_current_micro
)) {
892 time_previous_sec
=time_current_sec
;
893 time_previous_micro
=time_current_micro
;
896 handlelistermenu(1-a
);
901 else if (x
>=scrdata_xoffset
&& x
<scrdata_xoffset
+scrdata_clock_width
&&
902 y
>scrdata_clock_ypos
-3) { // clock bar
903 if (qual
&IEQUALIFIER_ANYSHIFT
) {
904 drawgadgets(0,GADCOUNT
/2);
906 while (getintuimsg()) {
907 class=IMsg
->Class
; code
=IMsg
->Code
;
908 ReplyMsg((struct Message
*) IMsg
);
909 if (class==MOUSEBUTTONS
&& code
==MENUUP
) break;
911 if (class==MOUSEBUTTONS
&& code
==MENUUP
) break;
912 Wait(1<<Window
->UserPort
->mp_SigBit
);
918 if ((data_gadgetrow_offset
-=scr_gadget_rows
)<0) {
919 data_gadgetrow_offset
=6-scr_gadget_rows
;
920 bank1
=dopus_curgadbank
;
921 bank
=dopus_firstgadbank
;
922 while (bank
&& bank
->next
&& bank
->next
!=dopus_curgadbank
) bank
=bank
->next
;
923 if (!bank
) dopus_curgadbank
=dopus_firstgadbank
;
924 else dopus_curgadbank
=bank
;
925 if (bank1
!=dopus_curgadbank
|| scr_gadget_rows
<6) drawgadgets(0,0);
927 else drawgadgets(0,0);
931 else if (y
>scrdata_dispwin_ypos
+1 &&
932 y
<scrdata_dispwin_height
+scrdata_dispwin_ypos
+2) { // lister area
933 if (x
>1 && x
<scrdata_dispwin_center
-13) {
934 if (config
->generalflags
& GENERAL_FMPARENT
) function
= FUNC_PARENT
;
940 else if (x
>scrdata_dispwin_center
+12 &&
941 x
<screen_gadgets
[SCRGAD_RIGHTPARENT
].LeftEdge
) {
942 if (config
->generalflags
& GENERAL_FMPARENT
) function
= FUNC_PARENT
;
949 else if (x
>=scrdata_gadget_xpos
&& y
>=scrdata_gadget_ypos
&& // gadget bank area
950 y
<scrdata_gadget_ypos
+(scr_gadget_rows
*scrdata_gadget_height
)+1 &&
953 if ((c
=gadgetfrompos(x
,y
))>-1) {
954 a
=c
+(GADCOUNT
/2)+(data_gadgetrow_offset
*7);
955 if (isvalidgad(&dopus_curgadbank
->gadgets
[a
])) {
956 x1
=scrdata_gadget_xpos
+((c
%7)*scrdata_gadget_width
);
957 y1
=scrdata_gadget_ypos
+((c
/7)*scrdata_gadget_height
)-1;
958 if (!(dormbgadget(x1
,y1
,
959 &dopus_curgadbank
->gadgets
[c
+(data_gadgetrow_offset
*7)],
960 &dopus_curgadbank
->gadgets
[a
]))) {
961 dofunctionstring(dopus_curgadbank
->gadgets
[a
].function
,
962 dopus_curgadbank
->gadgets
[a
].name
,NULL
,
963 (struct dopusfuncpar
*)&dopus_curgadbank
->gadgets
[a
].which
);
969 else if (code
== MIDDLEUP
)
973 if (config
->hotkeyflags
& HOTKEY_USEMMB
) break;
975 if ((win
=isinwindow(x
,y
))!=-1) // lister area
977 if (DoubleClick(time_previous_sec
,time_previous_micro
,time_current_sec
,time_current_micro
))
980 owin
= data_active_window
;
981 data_active_window
= win
;
982 a
= (y
- scrdata_dirwin_ypos
[win
]) / scrdata_font_ysize
;
983 a
+= dopus_curwin
[win
]->offset
;
984 if (a
< dopus_curwin
[win
]->total
)
987 struct dopusfiletype
*type
;
988 struct Directory
*file
;
990 select(win
,a
- dopus_curwin
[win
]->offset
);
991 for (file
= dopus_curwin
[win
]->firstentry
; a
--; file
=file
->next
);
992 strcpy(buf
,str_pathbuffer
[win
]);
993 TackOn(buf
,file
->name
,256);
994 D(bug("MMB double click on \"%s\"\n",buf
));
996 if ((type
=checkfiletype(buf
,FTFUNC_MMBCLICK
,0)))
998 struct dopusfuncpar par
;
1000 D(bug("filetype %s matched\n",type
->type
));
1001 par
.which
=type
->which
[FTFUNC_MMBCLICK
];
1002 par
.stack
=type
->stack
[FTFUNC_MMBCLICK
];
1003 par
.pri
=type
->pri
[FTFUNC_MMBCLICK
];
1004 par
.delay
=type
->delay
[FTFUNC_MMBCLICK
];
1005 par
.key
=par
.qual
=0; par
.type
=3;
1007 if (type
->actionstring
[FTFUNC_MMBCLICK
][0]) {
1008 do_title_string(type
->actionstring
[FTFUNC_MMBCLICK
],buf
,0,file
->name
);
1012 strcpy(func_single_file
,file
->name
);
1013 dofunctionstring(type
->function
[FTFUNC_MMBCLICK
],file
->name
,buf
,&par
);
1014 func_single_file
[0]=0;
1018 data_active_window
= owin
;
1019 time_previous_sec
=0;
1023 if (config
->generalflags
& GENERAL_MMBSELECTS
) makeactive(win
,0);
1024 time_previous_sec
=time_current_sec
;
1025 time_previous_micro
=time_current_micro
;
1033 if (function
) internal_function(function
,0,NULL
,NULL
);
1034 status_haveaborted
=0;
1037 // goto foreverloop; // JRZ: Just in case???
1040 struct IntuiMessage
*getintuimsg(void)
1042 return((IMsg
=(struct IntuiMessage
*)GetMsg(Window
->UserPort
)));
1047 while (getintuimsg()) ReplyMsg((struct Message
*)IMsg
);
1055 for (win
=0;win
<2;win
++) {
1056 if (x
>=scrdata_dirwin_xpos
[win
] && x
<scrdata_dirwin_xpos
[win
]+scrdata_dirwin_width
[win
] &&
1057 y
>=scrdata_dirwin_ypos
[win
] && y
<scrdata_dirwin_ypos
[win
]+scrdata_dirwin_height
) return(win
);