1 | #define INCL_DOS
|
---|
2 | #define INCL_WIN
|
---|
3 | #define INCL_GPI
|
---|
4 | #define INCL_DOSERRORS
|
---|
5 |
|
---|
6 | #include <os2.h>
|
---|
7 | #include <stdarg.h>
|
---|
8 | #include <stdio.h>
|
---|
9 | #include <stdlib.h>
|
---|
10 | #include <string.h>
|
---|
11 | #include <ctype.h>
|
---|
12 | #include <time.h>
|
---|
13 | #include <share.h>
|
---|
14 | #include <limits.h>
|
---|
15 | #include "fm3dll.h"
|
---|
16 | #include "fm3dlg.h"
|
---|
17 | #include "fm3str.h"
|
---|
18 | #include "mle.h"
|
---|
19 | #include "grep.h"
|
---|
20 |
|
---|
21 | #pragma data_seg(DATA1)
|
---|
22 | #pragma alloc_text(COLLECTOR,CollectorCnrWndProc,CollectorObjWndProc)
|
---|
23 | #pragma alloc_text(COLLECTOR,CollectorClientWndProc,CollectorTextProc)
|
---|
24 | #pragma alloc_text(COLLECTOR,CollectorFrameWndProc)
|
---|
25 | #pragma alloc_text(STARTUP,StartCollector)
|
---|
26 |
|
---|
27 |
|
---|
28 | MRESULT EXPENTRY CollectorFrameWndProc (HWND hwnd,ULONG msg,MPARAM mp1,
|
---|
29 | MPARAM mp2) {
|
---|
30 |
|
---|
31 | return CommonFrameWndProc(COLLECTOR_CNR,hwnd,msg,mp1,mp2);
|
---|
32 | }
|
---|
33 |
|
---|
34 |
|
---|
35 | MRESULT EXPENTRY CollectorTextProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
36 |
|
---|
37 | static BOOL emphasized = FALSE;
|
---|
38 | static HWND hwndButtonPopup = (HWND)0;
|
---|
39 | static ULONG timestamp = ULONG_MAX;
|
---|
40 | static USHORT lastid = 0;
|
---|
41 |
|
---|
42 | switch(msg) {
|
---|
43 | case WM_CREATE:
|
---|
44 | return CommonTextProc(hwnd,msg,mp1,mp2);
|
---|
45 |
|
---|
46 | case UM_CONTEXTMENU:
|
---|
47 | case WM_CONTEXTMENU:
|
---|
48 | {
|
---|
49 | USHORT id;
|
---|
50 |
|
---|
51 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
52 | switch(id) {
|
---|
53 | case DIR_SELECTED:
|
---|
54 | case DIR_VIEW:
|
---|
55 | case DIR_SORT:
|
---|
56 | {
|
---|
57 | POINTL ptl = {0,0};
|
---|
58 | SWP swp;
|
---|
59 | DIRCNRDATA *dcd;
|
---|
60 |
|
---|
61 | if(hwndButtonPopup)
|
---|
62 | WinDestroyWindow(hwndButtonPopup);
|
---|
63 | if(id == lastid) {
|
---|
64 |
|
---|
65 | ULONG check;
|
---|
66 |
|
---|
67 | DosQuerySysInfo(QSV_MS_COUNT,
|
---|
68 | QSV_MS_COUNT,
|
---|
69 | &check,
|
---|
70 | sizeof(check));
|
---|
71 | if(check < timestamp + 500) {
|
---|
72 | lastid = 0;
|
---|
73 | goto MenuAbort;
|
---|
74 | }
|
---|
75 | }
|
---|
76 | hwndButtonPopup = WinLoadMenu(HWND_DESKTOP,
|
---|
77 | FM3ModHandle,
|
---|
78 | id);
|
---|
79 | if(hwndButtonPopup) {
|
---|
80 | WinSetWindowUShort(hwndButtonPopup,
|
---|
81 | QWS_ID,
|
---|
82 | id);
|
---|
83 | dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
|
---|
84 | QW_PARENT),
|
---|
85 | COLLECTOR_CNR),
|
---|
86 | 0);
|
---|
87 | if(id == DIR_VIEW) {
|
---|
88 | if(dcd) {
|
---|
89 | SetViewMenu(hwndButtonPopup,
|
---|
90 | dcd->flWindowAttr);
|
---|
91 | SetDetailsSwitches(hwndButtonPopup,
|
---|
92 | dcd);
|
---|
93 | }
|
---|
94 |
|
---|
95 | /* don't have tree view in collector */
|
---|
96 | WinSendMsg(hwndButtonPopup,
|
---|
97 | MM_DELETEITEM,
|
---|
98 | MPFROM2SHORT(IDM_TREEVIEW,
|
---|
99 | FALSE),
|
---|
100 | MPVOID);
|
---|
101 |
|
---|
102 | }
|
---|
103 | else if(id == DIR_SORT) {
|
---|
104 | if(dcd)
|
---|
105 | SetSortChecks(hwndButtonPopup,
|
---|
106 | dcd->sortFlags);
|
---|
107 | }
|
---|
108 | ptl.x = 0;
|
---|
109 | if(WinPopupMenu(HWND_OBJECT,
|
---|
110 | HWND_OBJECT,
|
---|
111 | hwndButtonPopup,
|
---|
112 | -32767,
|
---|
113 | -32767,
|
---|
114 | 0,
|
---|
115 | 0)) {
|
---|
116 | WinQueryWindowPos(hwndButtonPopup,
|
---|
117 | &swp);
|
---|
118 | ptl.y = -(swp.cy + 2);
|
---|
119 | }
|
---|
120 | else {
|
---|
121 | WinQueryWindowPos(hwnd,
|
---|
122 | &swp);
|
---|
123 | ptl.y = swp.cy + 2;
|
---|
124 | }
|
---|
125 | if(WinPopupMenu(hwnd,
|
---|
126 | hwnd,
|
---|
127 | hwndButtonPopup,
|
---|
128 | ptl.x,
|
---|
129 | ptl.y,
|
---|
130 | 0,
|
---|
131 | PU_HCONSTRAIN | PU_VCONSTRAIN |
|
---|
132 | PU_KEYBOARD | PU_MOUSEBUTTON1)) {
|
---|
133 | CenterOverWindow(hwndButtonPopup);
|
---|
134 | PaintRecessedWindow(hwnd,
|
---|
135 | (HPS)0,
|
---|
136 | FALSE,
|
---|
137 | FALSE);
|
---|
138 | }
|
---|
139 | }
|
---|
140 | }
|
---|
141 | break;
|
---|
142 | default:
|
---|
143 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
144 | COLLECTOR_CNR),
|
---|
145 | WM_CONTROL,
|
---|
146 | MPFROM2SHORT(COLLECTOR_CNR,
|
---|
147 | CN_CONTEXTMENU),
|
---|
148 | MPVOID);
|
---|
149 | break;
|
---|
150 | }
|
---|
151 | }
|
---|
152 | MenuAbort:
|
---|
153 | if(msg == UM_CONTEXTMENU)
|
---|
154 | return 0;
|
---|
155 | break;
|
---|
156 |
|
---|
157 | case WM_MENUEND:
|
---|
158 | if(hwndButtonPopup == (HWND)mp2) {
|
---|
159 | lastid = WinQueryWindowUShort((HWND)mp2,
|
---|
160 | QWS_ID);
|
---|
161 | WinDestroyWindow(hwndButtonPopup);
|
---|
162 | hwndButtonPopup = (HWND)0;
|
---|
163 | DosQuerySysInfo(QSV_MS_COUNT,
|
---|
164 | QSV_MS_COUNT,
|
---|
165 | ×tamp,
|
---|
166 | sizeof(timestamp));
|
---|
167 | switch(lastid) {
|
---|
168 | case DIR_SELECTED:
|
---|
169 | case DIR_VIEW:
|
---|
170 | case DIR_SORT:
|
---|
171 | PaintRecessedWindow(hwnd,
|
---|
172 | (HPS)0,
|
---|
173 | TRUE,
|
---|
174 | FALSE);
|
---|
175 | break;
|
---|
176 | }
|
---|
177 | }
|
---|
178 | break;
|
---|
179 |
|
---|
180 | case WM_COMMAND:
|
---|
181 | {
|
---|
182 | DIRCNRDATA *dcd;
|
---|
183 | MRESULT mr;
|
---|
184 |
|
---|
185 | mr = WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,
|
---|
186 | QW_PARENT),
|
---|
187 | COLLECTOR_CNR),
|
---|
188 | msg,
|
---|
189 | mp1,
|
---|
190 | mp2);
|
---|
191 | if(hwndButtonPopup &&
|
---|
192 | SHORT1FROMMP(mp1) > IDM_DETAILSTITLES &&
|
---|
193 | SHORT1FROMMP(mp1) < IDM_DETAILSSETUP) {
|
---|
194 | dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
|
---|
195 | QW_PARENT),
|
---|
196 | COLLECTOR_CNR),
|
---|
197 | 0);
|
---|
198 | if(dcd)
|
---|
199 | SetDetailsSwitches(hwndButtonPopup,
|
---|
200 | dcd);
|
---|
201 | }
|
---|
202 | return mr;
|
---|
203 | }
|
---|
204 |
|
---|
205 | case WM_MOUSEMOVE:
|
---|
206 | {
|
---|
207 | USHORT id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
208 | char *s = NULL;
|
---|
209 |
|
---|
210 | if(fOtherHelp) {
|
---|
211 | if((!hwndBubble ||
|
---|
212 | WinQueryWindowULong(hwndBubble,0) != hwnd) &&
|
---|
213 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
214 | switch(id) {
|
---|
215 | case DIR_SELECTED:
|
---|
216 | s = GetPString(IDS_COLSELECTEDHELP);
|
---|
217 | break;
|
---|
218 | case DIR_TOTALS:
|
---|
219 | s = GetPString(IDS_COLTOTALSHELP);
|
---|
220 | break;
|
---|
221 | case DIR_VIEW:
|
---|
222 | s = GetPString(IDS_DIRCNRVIEWHELP);
|
---|
223 | break;
|
---|
224 | case DIR_SORT:
|
---|
225 | s = GetPString(IDS_DIRCNRSORTHELP);
|
---|
226 | break;
|
---|
227 | case DIR_FILTER:
|
---|
228 | s = GetPString(IDS_DIRCNRFILTERHELP);
|
---|
229 | break;
|
---|
230 | default:
|
---|
231 | break;
|
---|
232 | }
|
---|
233 | if(s)
|
---|
234 | MakeBubble(hwnd,TRUE,s);
|
---|
235 | else if(hwndBubble)
|
---|
236 | WinDestroyWindow(hwndBubble);
|
---|
237 | }
|
---|
238 | }
|
---|
239 | switch(id) {
|
---|
240 | case DIR_FILTER:
|
---|
241 | case DIR_SORT:
|
---|
242 | case DIR_VIEW:
|
---|
243 | case DIR_SELECTED:
|
---|
244 | return CommonTextButton(hwnd,msg,mp1,mp2);
|
---|
245 | }
|
---|
246 | }
|
---|
247 | break;
|
---|
248 |
|
---|
249 | case WM_BUTTON3UP:
|
---|
250 | case WM_BUTTON1UP:
|
---|
251 | case WM_BUTTON3DOWN:
|
---|
252 | case WM_BUTTON1DOWN:
|
---|
253 | {
|
---|
254 | USHORT id;
|
---|
255 |
|
---|
256 | id = WinQueryWindowUShort(hwnd,
|
---|
257 | QWS_ID);
|
---|
258 | switch(id) {
|
---|
259 | case DIR_FILTER:
|
---|
260 | case DIR_SORT:
|
---|
261 | case DIR_VIEW:
|
---|
262 | case DIR_SELECTED:
|
---|
263 | return CommonTextButton(hwnd,msg,mp1,mp2);
|
---|
264 | }
|
---|
265 | }
|
---|
266 | break;
|
---|
267 |
|
---|
268 | case UM_CLICKED:
|
---|
269 | case UM_CLICKED3:
|
---|
270 | {
|
---|
271 | USHORT id,cmd = 0;
|
---|
272 |
|
---|
273 | id = WinQueryWindowUShort(hwnd,
|
---|
274 | QWS_ID);
|
---|
275 | switch(id) {
|
---|
276 | case DIR_VIEW:
|
---|
277 | case DIR_SORT:
|
---|
278 | case DIR_SELECTED:
|
---|
279 | PostMsg(hwnd,
|
---|
280 | UM_CONTEXTMENU,
|
---|
281 | MPVOID,
|
---|
282 | MPVOID);
|
---|
283 | break;
|
---|
284 | case DIR_FILTER:
|
---|
285 | cmd = IDM_FILTER;
|
---|
286 | break;
|
---|
287 | default:
|
---|
288 | break;
|
---|
289 | }
|
---|
290 | if(cmd)
|
---|
291 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd,
|
---|
292 | QW_PARENT),
|
---|
293 | COLLECTOR_CNR),
|
---|
294 | WM_COMMAND,
|
---|
295 | MPFROM2SHORT(cmd,0),
|
---|
296 | MPVOID);
|
---|
297 | }
|
---|
298 | return 0;
|
---|
299 |
|
---|
300 | case DM_DROP:
|
---|
301 | case DM_DRAGOVER:
|
---|
302 | case DM_DRAGLEAVE:
|
---|
303 | case DM_DROPHELP:
|
---|
304 | if(msg == DM_DRAGOVER) {
|
---|
305 | if(!emphasized) {
|
---|
306 | emphasized = TRUE;
|
---|
307 | DrawTargetEmphasis(hwnd,emphasized);
|
---|
308 | }
|
---|
309 | }
|
---|
310 | else {
|
---|
311 | if(emphasized) {
|
---|
312 | emphasized = FALSE;
|
---|
313 | DrawTargetEmphasis(hwnd,emphasized);
|
---|
314 | }
|
---|
315 | }
|
---|
316 | {
|
---|
317 | CNRDRAGINFO cnd;
|
---|
318 | USHORT dcmd;
|
---|
319 |
|
---|
320 | switch(msg) {
|
---|
321 | case DM_DROP:
|
---|
322 | dcmd = CN_DROP;
|
---|
323 | break;
|
---|
324 | case DM_DRAGOVER:
|
---|
325 | dcmd = CN_DRAGOVER;
|
---|
326 | break;
|
---|
327 | case DM_DRAGLEAVE:
|
---|
328 | dcmd = CN_DRAGLEAVE;
|
---|
329 | break;
|
---|
330 | case DM_DROPHELP:
|
---|
331 | dcmd = CN_DROPHELP;
|
---|
332 | break;
|
---|
333 | }
|
---|
334 | memset(&cnd,0,sizeof(cnd));
|
---|
335 | cnd.pDragInfo = (PDRAGINFO)mp1;
|
---|
336 | cnd.pRecord = NULL;
|
---|
337 | return WinSendMsg(WinQueryWindow(hwnd,QW_PARENT),WM_CONTROL,
|
---|
338 | MPFROM2SHORT(COLLECTOR_CNR,dcmd),MPFROMP(&cnd));
|
---|
339 | }
|
---|
340 | }
|
---|
341 | return PFNWPStatic(hwnd,msg,mp1,mp2);
|
---|
342 | }
|
---|
343 |
|
---|
344 |
|
---|
345 | MRESULT EXPENTRY CollectorClientWndProc (HWND hwnd,ULONG msg,MPARAM mp1,
|
---|
346 | MPARAM mp2) {
|
---|
347 |
|
---|
348 | switch(msg) {
|
---|
349 | case UM_CONTAINERHWND:
|
---|
350 | return MRFROMLONG(WinWindowFromID(hwnd,COLLECTOR_CNR));
|
---|
351 |
|
---|
352 | case UM_VIEWSMENU:
|
---|
353 | return MRFROMLONG(CheckMenu(&CollectorCnrMenu,COLLECTORCNR_POPUP));
|
---|
354 |
|
---|
355 | case MM_PORTHOLEINIT:
|
---|
356 | case WM_INITMENU:
|
---|
357 | case UM_INITMENU:
|
---|
358 | case UM_CONTAINER_FILLED:
|
---|
359 | case UM_FILESMENU:
|
---|
360 | case UM_UPDATERECORD:
|
---|
361 | case UM_UPDATERECORDLIST:
|
---|
362 | return WinSendMsg(WinWindowFromID(hwnd,COLLECTOR_CNR),msg,mp1,mp2);
|
---|
363 |
|
---|
364 | case WM_PSETFOCUS:
|
---|
365 | case WM_SETFOCUS:
|
---|
366 | if(mp2)
|
---|
367 | PostMsg(hwnd,UM_FOCUSME,MPVOID,MPVOID);
|
---|
368 | break;
|
---|
369 |
|
---|
370 | case UM_FOCUSME:
|
---|
371 | WinSetFocus(HWND_DESKTOP,WinWindowFromID(hwnd,COLLECTOR_CNR));
|
---|
372 | break;
|
---|
373 |
|
---|
374 | case WM_PAINT:
|
---|
375 | {
|
---|
376 | HPS hps;
|
---|
377 | RECTL rcl;
|
---|
378 |
|
---|
379 | hps = WinBeginPaint(hwnd,(HPS)0,NULL);
|
---|
380 | if(hps) {
|
---|
381 | WinQueryWindowRect(hwnd,&rcl);
|
---|
382 | WinFillRect(hps,&rcl,CLR_PALEGRAY);
|
---|
383 | CommonTextPaint(hwnd,hps);
|
---|
384 | WinEndPaint(hps);
|
---|
385 | }
|
---|
386 | }
|
---|
387 | break;
|
---|
388 |
|
---|
389 | case UM_SIZE:
|
---|
390 | case WM_SIZE:
|
---|
391 | if(msg == UM_SIZE) {
|
---|
392 |
|
---|
393 | SWP swp;
|
---|
394 |
|
---|
395 | WinQueryWindowPos(hwnd,&swp);
|
---|
396 | mp1 = MPFROM2SHORT(swp.cx,swp.cy);
|
---|
397 | mp2 = MPFROM2SHORT(swp.cx,swp.cy);
|
---|
398 | }
|
---|
399 | {
|
---|
400 | USHORT cx,cy,bx;
|
---|
401 |
|
---|
402 | cx = SHORT1FROMMP(mp2);
|
---|
403 | cy = SHORT2FROMMP(mp2);
|
---|
404 | WinSetWindowPos(WinWindowFromID(hwnd,COLLECTOR_CNR),HWND_TOP,
|
---|
405 | 0,
|
---|
406 | 0,
|
---|
407 | cx,
|
---|
408 | cy - 24,
|
---|
409 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
410 | WinSetWindowPos(WinWindowFromID(hwnd,DIR_TOTALS),HWND_TOP,
|
---|
411 | 2,
|
---|
412 | cy - 22,
|
---|
413 | (cx / 3) - 2,
|
---|
414 | 20,
|
---|
415 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
416 | WinSetWindowPos(WinWindowFromID(hwnd,DIR_SELECTED),HWND_TOP,
|
---|
417 | 2 + (cx / 3) + 2,
|
---|
418 | cy - 22,
|
---|
419 | (cx / 3) - 2,
|
---|
420 | 20,
|
---|
421 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
422 | bx = (cx - (2 + (((cx / 3) + 2) * 2))) / 3;
|
---|
423 | WinSetWindowPos(WinWindowFromID(hwnd,DIR_VIEW),HWND_TOP,
|
---|
424 | 2 + (((cx / 3) + 2) * 2),
|
---|
425 | cy - 22,
|
---|
426 | bx - 4,
|
---|
427 | 20,
|
---|
428 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
429 | WinSetWindowPos(WinWindowFromID(hwnd,DIR_SORT),HWND_TOP,
|
---|
430 | 2 + (((cx / 3) + 2) * 2) + bx,
|
---|
431 | cy - 22,
|
---|
432 | bx - 4,
|
---|
433 | 20,
|
---|
434 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
435 | WinSetWindowPos(WinWindowFromID(hwnd,DIR_FILTER),HWND_TOP,
|
---|
436 | 2 + (((cx / 3) + 2) * 2) + (bx * 2),
|
---|
437 | cy - 22,
|
---|
438 | bx - 4,
|
---|
439 | 20,
|
---|
440 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
441 | }
|
---|
442 | CommonTextPaint(hwnd,(HPS)0);
|
---|
443 | if(msg == UM_SIZE) {
|
---|
444 | WinSetWindowPos(WinQueryWindow(hwnd,QW_PARENT),HWND_TOP,0,0,0,0,
|
---|
445 | SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
|
---|
446 | return 0;
|
---|
447 | }
|
---|
448 | break;
|
---|
449 |
|
---|
450 | case UM_COMMAND:
|
---|
451 | case WM_COMMAND:
|
---|
452 | case WM_CONTROL:
|
---|
453 | case WM_CLOSE:
|
---|
454 | return WinSendMsg(WinWindowFromID(hwnd,COLLECTOR_CNR),msg,mp1,mp2);
|
---|
455 | }
|
---|
456 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
---|
457 | }
|
---|
458 |
|
---|
459 |
|
---|
460 | MRESULT EXPENTRY CollectorObjWndProc (HWND hwnd,ULONG msg,MPARAM mp1,
|
---|
461 | MPARAM mp2) {
|
---|
462 |
|
---|
463 | DIRCNRDATA *dcd;
|
---|
464 |
|
---|
465 | switch(msg) {
|
---|
466 | case WM_CREATE:
|
---|
467 | break;
|
---|
468 |
|
---|
469 | case DM_PRINTOBJECT:
|
---|
470 | return MRFROMLONG(DRR_TARGET);
|
---|
471 |
|
---|
472 | case DM_DISCARDOBJECT:
|
---|
473 | dcd = INSTDATA(hwnd);
|
---|
474 | if(fFM2Deletes && dcd) {
|
---|
475 |
|
---|
476 | LISTINFO *li;
|
---|
477 | CNRDRAGINFO cni;
|
---|
478 |
|
---|
479 | cni.pRecord = NULL;
|
---|
480 | cni.pDragInfo = (PDRAGINFO)mp1;
|
---|
481 | li = DoFileDrop(dcd->hwndCnr,NULL,FALSE,MPVOID,MPFROMP(&cni));
|
---|
482 | if(li) {
|
---|
483 | li->type = (fDefaultDeletePerm) ? IDM_PERMDELETE : IDM_DELETE;
|
---|
484 | if(!PostMsg(hwnd,UM_MASSACTION,MPFROMP(li),MPVOID))
|
---|
485 | FreeListInfo(li);
|
---|
486 | else
|
---|
487 | return MRFROMLONG(DRR_SOURCE);
|
---|
488 | }
|
---|
489 | }
|
---|
490 | return MRFROMLONG(DRR_TARGET);
|
---|
491 |
|
---|
492 | case UM_UPDATERECORDLIST:
|
---|
493 | dcd = WinQueryWindowPtr(hwnd,0);
|
---|
494 | if(dcd && mp1) {
|
---|
495 |
|
---|
496 | INT numentries = 0;
|
---|
497 | CHAR **list = (CHAR **)mp1;
|
---|
498 |
|
---|
499 | while(list[numentries])
|
---|
500 | numentries++;
|
---|
501 | if(numentries)
|
---|
502 | UpdateCnrList(dcd->hwndCnr,list,numentries,FALSE,dcd);
|
---|
503 | }
|
---|
504 | return 0;
|
---|
505 |
|
---|
506 | case UM_SETUP:
|
---|
507 | dcd = WinQueryWindowPtr(hwnd,0);
|
---|
508 | if(dcd) {
|
---|
509 | /* set unique id */
|
---|
510 | WinSetWindowUShort(hwnd,QWS_ID,COLLECTOROBJ_FRAME +
|
---|
511 | (COLLECTOR_FRAME - dcd->id));
|
---|
512 | dcd->hwndObject = hwnd;
|
---|
513 | if(ParentIsDesktop(hwnd,dcd->hwndParent))
|
---|
514 | DosSleep(250L);
|
---|
515 | }
|
---|
516 | else
|
---|
517 | PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID);
|
---|
518 | return 0;
|
---|
519 |
|
---|
520 | case UM_COMMAND:
|
---|
521 | if(mp1) {
|
---|
522 |
|
---|
523 | LISTINFO *li = (LISTINFO *)mp1;
|
---|
524 |
|
---|
525 | switch(li->type) {
|
---|
526 | case IDM_DOITYOURSELF:
|
---|
527 | case IDM_APPENDTOCLIP:
|
---|
528 | case IDM_SAVETOCLIP:
|
---|
529 | case IDM_ARCHIVE:
|
---|
530 | case IDM_ARCHIVEM:
|
---|
531 | case IDM_VIEW:
|
---|
532 | case IDM_VIEWTEXT:
|
---|
533 | case IDM_VIEWBINARY:
|
---|
534 | case IDM_VIEWARCHIVE:
|
---|
535 | case IDM_EDIT:
|
---|
536 | case IDM_EDITTEXT:
|
---|
537 | case IDM_EDITBINARY:
|
---|
538 | case IDM_OBJECT:
|
---|
539 | case IDM_SHADOW:
|
---|
540 | case IDM_SHADOW2:
|
---|
541 | case IDM_PRINT:
|
---|
542 | case IDM_ATTRS:
|
---|
543 | case IDM_DELETE:
|
---|
544 | case IDM_PERMDELETE:
|
---|
545 | case IDM_FAKEEXTRACT:
|
---|
546 | case IDM_FAKEEXTRACTM:
|
---|
547 | case IDM_MCIPLAY:
|
---|
548 | case IDM_UPDATE:
|
---|
549 | if(PostMsg(hwnd,UM_MASSACTION,mp1,mp2))
|
---|
550 | return (MRESULT)TRUE;
|
---|
551 | break;
|
---|
552 | default:
|
---|
553 | if(PostMsg(hwnd,UM_ACTION,mp1,mp2))
|
---|
554 | return (MRESULT)TRUE;
|
---|
555 | }
|
---|
556 | }
|
---|
557 | return 0;
|
---|
558 |
|
---|
559 | case UM_COLLECT:
|
---|
560 | DosError(FERR_DISABLEHARDERR);
|
---|
561 | dcd = WinQueryWindowPtr(hwnd,0);
|
---|
562 | if(dcd) {
|
---|
563 |
|
---|
564 | LISTINFO *li = (LISTINFO *)mp1;
|
---|
565 | INT x;
|
---|
566 | FILEFINDBUF4 fb4;
|
---|
567 | HDIR hdir;
|
---|
568 | ULONG nm;
|
---|
569 | PCNRITEM pci,pciFirst,pciT,pciP = NULL;
|
---|
570 | RECORDINSERT ri;
|
---|
571 | ULONG ulMaxFiles;
|
---|
572 | CHAR fullname[CCHMAXPATH];
|
---|
573 |
|
---|
574 | WinSetWindowText(WinWindowFromID(dcd->hwndClient,
|
---|
575 | DIR_SELECTED),
|
---|
576 | GetPString(IDS_COLLECTINGTEXT));
|
---|
577 | for(x = 0;li->list[x];x++)
|
---|
578 | ;
|
---|
579 | ulMaxFiles = x;
|
---|
580 | if(ulMaxFiles) {
|
---|
581 | pci = WinSendMsg(dcd->hwndCnr, CM_ALLOCRECORD,
|
---|
582 | MPFROMLONG(EXTRA_RECORD_BYTES),
|
---|
583 | MPFROMLONG(ulMaxFiles));
|
---|
584 | if(pci) {
|
---|
585 | pciFirst = pci;
|
---|
586 | for(x = 0;li->list[x];x++) {
|
---|
587 | nm = 1L;
|
---|
588 | hdir = HDIR_CREATE;
|
---|
589 | DosError(FERR_DISABLEHARDERR);
|
---|
590 | if(*li->list[x] &&
|
---|
591 | !DosQueryPathInfo(li->list[x],FIL_QUERYFULLNAME,
|
---|
592 | fullname,sizeof(fullname)) &&
|
---|
593 | !IsRoot(fullname) &&
|
---|
594 | !FindCnrRecord(dcd->hwndCnr,
|
---|
595 | fullname,
|
---|
596 | NULL,
|
---|
597 | FALSE,
|
---|
598 | FALSE,
|
---|
599 | TRUE) &&
|
---|
600 | !DosFindFirst(fullname,
|
---|
601 | &hdir,
|
---|
602 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
603 | FILE_ARCHIVED | FILE_SYSTEM |
|
---|
604 | FILE_HIDDEN | FILE_READONLY,
|
---|
605 | &fb4,
|
---|
606 | sizeof(fb4),
|
---|
607 | &nm,
|
---|
608 | FIL_QUERYEASIZE)) {
|
---|
609 | DosFindClose(hdir);
|
---|
610 | priority_normal();
|
---|
611 | *fb4.achName = 0;
|
---|
612 | dcd->totalbytes += FillInRecordFromFFB(dcd->hwndCnr,pci,
|
---|
613 | fullname,
|
---|
614 | &fb4,FALSE,
|
---|
615 | dcd);
|
---|
616 | pciP = pci;
|
---|
617 | pci = (PCNRITEM)pci->rc.preccNextRecord;
|
---|
618 | }
|
---|
619 | else {
|
---|
620 | pciT = pci;
|
---|
621 | pci = (PCNRITEM)pci->rc.preccNextRecord;
|
---|
622 | if(pciP)
|
---|
623 | pciP->rc.preccNextRecord = (PMINIRECORDCORE)pci;
|
---|
624 | else
|
---|
625 | pciFirst = pci;
|
---|
626 | WinSendMsg(hwnd,CM_FREERECORD,MPFROMP(&pciT),
|
---|
627 | MPFROM2SHORT(1,0));
|
---|
628 | ulMaxFiles--;
|
---|
629 | }
|
---|
630 | DosSleep(1L);
|
---|
631 | }
|
---|
632 | if(ulMaxFiles) {
|
---|
633 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
634 | ri.cb = sizeof(RECORDINSERT);
|
---|
635 | ri.pRecordOrder = (PRECORDCORE) CMA_END;
|
---|
636 | ri.pRecordParent = (PRECORDCORE) 0;
|
---|
637 | ri.zOrder = (ULONG) CMA_TOP;
|
---|
638 | ri.cRecordsInsert = ulMaxFiles;
|
---|
639 | ri.fInvalidateRecord = TRUE;
|
---|
640 | WinSendMsg(dcd->hwndCnr,
|
---|
641 | CM_INSERTRECORD,
|
---|
642 | MPFROMP(pciFirst),
|
---|
643 | MPFROMP(&ri));
|
---|
644 | PostMsg(dcd->hwndCnr,
|
---|
645 | UM_RESCAN,
|
---|
646 | MPVOID,
|
---|
647 | MPVOID);
|
---|
648 | }
|
---|
649 | }
|
---|
650 | }
|
---|
651 | }
|
---|
652 | if(dcd->flWindowAttr & CV_DETAIL)
|
---|
653 | WinSendDlgItemMsg(hwnd,
|
---|
654 | COLLECTOR_CNR,
|
---|
655 | CM_INVALIDATERECORD,
|
---|
656 | MPVOID,
|
---|
657 | MPFROM2SHORT(0,
|
---|
658 | CMA_ERASE | CMA_REPOSITION));
|
---|
659 | return 0;
|
---|
660 |
|
---|
661 | case UM_COLLECTFROMFILE:
|
---|
662 | dcd = WinQueryWindowPtr(hwnd,0);
|
---|
663 | if(dcd && mp1) {
|
---|
664 |
|
---|
665 | FILESTATUS4 fs4;
|
---|
666 | PCNRITEM pci;
|
---|
667 | RECORDINSERT ri;
|
---|
668 | CHAR fullname[1024],*p;
|
---|
669 | FILE *fp;
|
---|
670 | ULONG errs = 0L;
|
---|
671 |
|
---|
672 | fp = _fsopen((CHAR *)mp1,"r",SH_DENYNO);
|
---|
673 | if(fp) {
|
---|
674 | while(!feof(fp)) {
|
---|
675 | if(!fgets(fullname,1024,fp))
|
---|
676 | break;
|
---|
677 | fullname[1023] = 0;
|
---|
678 | stripcr(fullname);
|
---|
679 | lstrip(rstrip(fullname));
|
---|
680 | if(*fullname == '\"') {
|
---|
681 | memmove(fullname,fullname + 1,strlen(fullname) + 1);
|
---|
682 | lstrip(fullname);
|
---|
683 | p = strchr(fullname,'\"');
|
---|
684 | if(p)
|
---|
685 | *p = 0;
|
---|
686 | rstrip(fullname);
|
---|
687 | }
|
---|
688 | else {
|
---|
689 | p = strchr(fullname,' ');
|
---|
690 | if(p)
|
---|
691 | *p = 0;
|
---|
692 | }
|
---|
693 | /* fullname now contains name of file to collect */
|
---|
694 | DosError(FERR_DISABLEHARDERR);
|
---|
695 | if(IsFullName(fullname) &&
|
---|
696 | !IsRoot(fullname) &&
|
---|
697 | !DosQueryPathInfo(fullname,
|
---|
698 | FIL_QUERYEASIZE,
|
---|
699 | &fs4,
|
---|
700 | sizeof(fs4)) &&
|
---|
701 | !FindCnrRecord(dcd->hwndCnr,
|
---|
702 | fullname,
|
---|
703 | NULL,
|
---|
704 | FALSE,
|
---|
705 | FALSE,
|
---|
706 | TRUE)) {
|
---|
707 | /* collect it */
|
---|
708 | pci = WinSendMsg(dcd->hwndCnr,
|
---|
709 | CM_ALLOCRECORD,
|
---|
710 | MPFROMLONG(EXTRA_RECORD_BYTES),
|
---|
711 | MPFROMLONG(1L));
|
---|
712 | if(pci) {
|
---|
713 | dcd->totalbytes += FillInRecordFromFSA(dcd->hwndCnr,pci,
|
---|
714 | fullname,
|
---|
715 | &fs4,FALSE,dcd);
|
---|
716 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
717 | ri.cb = sizeof(RECORDINSERT);
|
---|
718 | ri.pRecordOrder = (PRECORDCORE) CMA_END;
|
---|
719 | ri.pRecordParent = (PRECORDCORE) 0;
|
---|
720 | ri.zOrder = (ULONG) CMA_TOP;
|
---|
721 | ri.cRecordsInsert = 1L;
|
---|
722 | ri.fInvalidateRecord = TRUE;
|
---|
723 | WinSendMsg(dcd->hwndCnr, CM_INSERTRECORD,
|
---|
724 | MPFROMP(pci),MPFROMP(&ri));
|
---|
725 | }
|
---|
726 | }
|
---|
727 | else {
|
---|
728 | errs++;
|
---|
729 | if(errs > 50L) { /* prevent runaway on bad file */
|
---|
730 |
|
---|
731 | APIRET ret;
|
---|
732 |
|
---|
733 | ret = saymsg(MB_YESNO,dcd->hwndCnr,
|
---|
734 | GetPString(IDS_COLLECTNOLISTHDRTEXT),
|
---|
735 | GetPString(IDS_COLLECTNOLISTTEXT),
|
---|
736 | (CHAR *)mp1);
|
---|
737 | if(ret == MBID_NO)
|
---|
738 | break;
|
---|
739 | errs = 0L;
|
---|
740 | }
|
---|
741 | }
|
---|
742 | }
|
---|
743 | fclose(fp);
|
---|
744 | }
|
---|
745 | }
|
---|
746 | if(mp1)
|
---|
747 | free(mp1);
|
---|
748 | return 0;
|
---|
749 |
|
---|
750 | case UM_SELECT:
|
---|
751 | dcd = WinQueryWindowPtr(hwnd,0);
|
---|
752 | if(dcd) {
|
---|
753 | switch(SHORT1FROMMP(mp1)) {
|
---|
754 | case IDM_SELECTLIST:
|
---|
755 | {
|
---|
756 | CHAR filename[CCHMAXPATH],*p,*pp;
|
---|
757 | ULONG size;
|
---|
758 |
|
---|
759 | strcpy(filename,"*.LST");
|
---|
760 | size = CCHMAXPATH;
|
---|
761 | PrfQueryProfileData(fmprof,
|
---|
762 | appname,
|
---|
763 | "SaveToListName",
|
---|
764 | filename,
|
---|
765 | &size);
|
---|
766 | pp = strrchr(filename,'\\');
|
---|
767 | if(!pp)
|
---|
768 | pp = filename;
|
---|
769 | p = strrchr(pp,'.');
|
---|
770 | if(p && *(p + 1) && p > pp + 1) {
|
---|
771 | if(pp > filename)
|
---|
772 | pp++;
|
---|
773 | *pp = '*';
|
---|
774 | pp++;
|
---|
775 | if(p > pp)
|
---|
776 | memmove(pp,p,strlen(p) + 1);
|
---|
777 | }
|
---|
778 | if(insert_filename(hwnd,filename,FALSE,FALSE))
|
---|
779 | SelectList(dcd->hwndCnr,TRUE,FALSE,FALSE,NULL,filename,NULL);
|
---|
780 | }
|
---|
781 | break;
|
---|
782 | case IDM_SELECTALL:
|
---|
783 | SelectAll(dcd->hwndCnr,TRUE,TRUE,NULL,NULL,FALSE);
|
---|
784 | break;
|
---|
785 | case IDM_DESELECTALL:
|
---|
786 | DeselectAll(dcd->hwndCnr,TRUE,TRUE,NULL,NULL,FALSE);
|
---|
787 | break;
|
---|
788 | case IDM_SELECTALLFILES:
|
---|
789 | SelectAll(dcd->hwndCnr,TRUE,FALSE,NULL,NULL,FALSE);
|
---|
790 | break;
|
---|
791 | case IDM_DESELECTALLFILES:
|
---|
792 | DeselectAll(dcd->hwndCnr,TRUE,FALSE,NULL,NULL,FALSE);
|
---|
793 | break;
|
---|
794 | case IDM_SELECTALLDIRS:
|
---|
795 | SelectAll(dcd->hwndCnr,FALSE,TRUE,NULL,NULL,FALSE);
|
---|
796 | break;
|
---|
797 | case IDM_DESELECTALLDIRS:
|
---|
798 | DeselectAll(dcd->hwndCnr,FALSE,TRUE,NULL,NULL,FALSE);
|
---|
799 | break;
|
---|
800 | case IDM_DESELECTMASK:
|
---|
801 | case IDM_SELECTMASK:
|
---|
802 | {
|
---|
803 | MASK mask;
|
---|
804 | PCNRITEM pci = (PCNRITEM)mp2;
|
---|
805 |
|
---|
806 | memset(&mask,0,sizeof(MASK));
|
---|
807 | mask.fNoAttribs = TRUE;
|
---|
808 | mask.fNoDirs = TRUE;
|
---|
809 | mask.fText = TRUE;
|
---|
810 | strcpy(mask.prompt,
|
---|
811 | GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
|
---|
812 | IDS_SELECTFILTERTEXT :
|
---|
813 | IDS_DESELECTFILTERTEXT));
|
---|
814 | if(pci && (INT)pci != -1)
|
---|
815 | strcpy(mask.szMask,pci->szFileName);
|
---|
816 | if(WinDlgBox(HWND_DESKTOP,dcd->hwndCnr,PickMaskDlgProc,
|
---|
817 | FM3ModHandle,MSK_FRAME,MPFROMP(&mask))) {
|
---|
818 | if(SHORT1FROMMP(mp1) == IDM_SELECTMASK)
|
---|
819 | SelectAll(dcd->hwndCnr,TRUE,TRUE,mask.szMask,mask.szText,
|
---|
820 | FALSE);
|
---|
821 | else
|
---|
822 | DeselectAll(dcd->hwndCnr,TRUE,TRUE,mask.szMask,mask.szText,
|
---|
823 | FALSE);
|
---|
824 | }
|
---|
825 | }
|
---|
826 |
|
---|
827 | case IDM_DESELECTCLIP:
|
---|
828 | case IDM_SELECTCLIP:
|
---|
829 | {
|
---|
830 | CHAR **list;
|
---|
831 |
|
---|
832 | list = ListFromClipboard(hwnd);
|
---|
833 | if(list) {
|
---|
834 | SelectList(dcd->hwndCnr,TRUE,FALSE,
|
---|
835 | (SHORT1FROMMP(mp1) == IDM_DESELECTCLIP),
|
---|
836 | NULL,NULL,list);
|
---|
837 | FreeList(list);
|
---|
838 | }
|
---|
839 | }
|
---|
840 | break;
|
---|
841 |
|
---|
842 | case IDM_INVERT:
|
---|
843 | InvertAll(dcd->hwndCnr);
|
---|
844 | break;
|
---|
845 | }
|
---|
846 | }
|
---|
847 | return 0;
|
---|
848 |
|
---|
849 | case UM_MASSACTION:
|
---|
850 | if(mp1) {
|
---|
851 |
|
---|
852 | dcd = WinQueryWindowPtr(hwnd,0);
|
---|
853 | if(dcd) {
|
---|
854 |
|
---|
855 | WORKER *wk;
|
---|
856 |
|
---|
857 | wk = malloc(sizeof(WORKER));
|
---|
858 | if(wk) {
|
---|
859 | memset(wk,0,sizeof(WORKER));
|
---|
860 | wk->size = sizeof(WORKER);
|
---|
861 | wk->hwndCnr = dcd->hwndCnr;
|
---|
862 | wk->hwndParent = dcd->hwndParent;
|
---|
863 | wk->hwndFrame = dcd->hwndFrame;
|
---|
864 | wk->hwndClient = dcd->hwndClient;
|
---|
865 | wk->li = (LISTINFO *)mp1;
|
---|
866 | strcpy(wk->directory,dcd->directory);
|
---|
867 | if(_beginthread(MassAction,NULL,122880,(PVOID)wk) == -1) {
|
---|
868 | free(wk);
|
---|
869 | FreeListInfo((LISTINFO *)mp1);
|
---|
870 | }
|
---|
871 | }
|
---|
872 | else
|
---|
873 | FreeListInfo((LISTINFO *)mp1);
|
---|
874 | }
|
---|
875 | }
|
---|
876 | return 0;
|
---|
877 |
|
---|
878 | case UM_ACTION:
|
---|
879 | if(mp1) {
|
---|
880 |
|
---|
881 | dcd = WinQueryWindowPtr(hwnd,0);
|
---|
882 | if(dcd) {
|
---|
883 |
|
---|
884 | WORKER *wk;
|
---|
885 |
|
---|
886 | wk = malloc(sizeof(WORKER));
|
---|
887 | if(wk) {
|
---|
888 | memset(wk,0,sizeof(WORKER));
|
---|
889 | wk->size = sizeof(WORKER);
|
---|
890 | wk->hwndCnr = dcd->hwndCnr;
|
---|
891 | wk->hwndParent = dcd->hwndParent;
|
---|
892 | wk->hwndFrame = dcd->hwndFrame;
|
---|
893 | wk->hwndClient = dcd->hwndClient;
|
---|
894 | wk->li = (LISTINFO *)mp1;
|
---|
895 | strcpy(wk->directory,dcd->directory);
|
---|
896 | if(_beginthread(Action,NULL,122880,(PVOID)wk) == -1) {
|
---|
897 | free(wk);
|
---|
898 | FreeListInfo((LISTINFO *)mp1);
|
---|
899 | }
|
---|
900 | }
|
---|
901 | else
|
---|
902 | FreeListInfo((LISTINFO *)mp1);
|
---|
903 | }
|
---|
904 | }
|
---|
905 | return 0;
|
---|
906 |
|
---|
907 | case WM_CLOSE:
|
---|
908 | WinDestroyWindow(hwnd);
|
---|
909 | break;
|
---|
910 |
|
---|
911 | case WM_DESTROY:
|
---|
912 | dcd = WinQueryWindowPtr(hwnd,0);
|
---|
913 | if(dcd) {
|
---|
914 |
|
---|
915 | INT x = 0;
|
---|
916 |
|
---|
917 | dcd->stopflag = 1;
|
---|
918 | while(x++ < 10 && dcd->amextracted)
|
---|
919 | DosSleep(250L);
|
---|
920 | WinSendMsg(dcd->hwndCnr,UM_CLOSE,MPVOID,MPVOID);
|
---|
921 | FreeList(dcd->lastselection);
|
---|
922 | free(dcd);
|
---|
923 | }
|
---|
924 | DosPostEventSem(CompactSem);
|
---|
925 | if(!PostMsg((HWND)0,WM_QUIT,MPVOID,MPVOID))
|
---|
926 | WinSendMsg((HWND)0,WM_QUIT,MPVOID,MPVOID);
|
---|
927 | break;
|
---|
928 | }
|
---|
929 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
---|
930 | }
|
---|
931 |
|
---|
932 |
|
---|
933 | MRESULT EXPENTRY CollectorCnrWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
934 |
|
---|
935 | DIRCNRDATA *dcd = WinQueryWindowPtr(hwnd,0);
|
---|
936 | INT tempsortFlags;
|
---|
937 |
|
---|
938 | switch(msg) {
|
---|
939 | case DM_PRINTOBJECT:
|
---|
940 | return MRFROMLONG(DRR_TARGET);
|
---|
941 |
|
---|
942 | case DM_DISCARDOBJECT:
|
---|
943 | if(dcd)
|
---|
944 | return WinSendMsg(dcd->hwndObject,msg,mp1,mp2);
|
---|
945 | else
|
---|
946 | return MRFROMLONG(DRR_TARGET);
|
---|
947 |
|
---|
948 | case WM_CHAR:
|
---|
949 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
950 | if(SHORT1FROMMP(mp1) & KC_KEYUP)
|
---|
951 | return (MRESULT)TRUE;
|
---|
952 | if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
---|
953 | switch(SHORT2FROMMP(mp2)) {
|
---|
954 | case VK_DELETE:
|
---|
955 | if((shiftstate & KC_CTRL) == KC_CTRL)
|
---|
956 | PostMsg(hwnd,WM_COMMAND,MPFROM2SHORT(IDM_PERMDELETE,0),MPVOID);
|
---|
957 | else if((shiftstate & KC_SHIFT) == KC_SHIFT)
|
---|
958 | PostMsg(hwnd,WM_COMMAND,MPFROM2SHORT(IDM_SAVETOCLIP,0),MPVOID);
|
---|
959 | else
|
---|
960 | PostMsg(hwnd,WM_COMMAND,MPFROM2SHORT(IDM_DELETE,0),MPVOID);
|
---|
961 | break;
|
---|
962 | }
|
---|
963 | }
|
---|
964 | if(shiftstate || fNoSearch)
|
---|
965 | break;
|
---|
966 | if(SHORT1FROMMP(mp1) & KC_CHAR) {
|
---|
967 |
|
---|
968 | ULONG thistime,len;
|
---|
969 | SEARCHSTRING srch;
|
---|
970 | PCNRITEM pci;
|
---|
971 |
|
---|
972 | if(!dcd)
|
---|
973 | break;
|
---|
974 | switch(SHORT1FROMMP(mp2)) {
|
---|
975 | case '\x1b':
|
---|
976 | case '\r':
|
---|
977 | case '\n':
|
---|
978 | dcd->lasttime = 0;
|
---|
979 | *dcd->comnam = 0;
|
---|
980 | break;
|
---|
981 | default:
|
---|
982 | thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
|
---|
983 | if(thistime > dcd->lasttime + 1250)
|
---|
984 | *dcd->comnam = 0;
|
---|
985 | dcd->lasttime = thistime;
|
---|
986 | if(SHORT1FROMMP(mp2) == ' ' && !dcd->comnam)
|
---|
987 | break;
|
---|
988 | KbdRetry:
|
---|
989 | len = strlen(dcd->comnam);
|
---|
990 | if(len >= CCHMAXPATH - 1) {
|
---|
991 | *dcd->comnam = 0;
|
---|
992 | len = 0;
|
---|
993 | }
|
---|
994 | dcd->comnam[len] = toupper(SHORT1FROMMP(mp2));
|
---|
995 | dcd->comnam[len + 1] = 0;
|
---|
996 | memset(&srch,0,sizeof(SEARCHSTRING));
|
---|
997 | srch.cb = (ULONG)sizeof(SEARCHSTRING);
|
---|
998 | srch.pszSearch = (PSZ)dcd->comnam;
|
---|
999 | srch.fsPrefix = TRUE;
|
---|
1000 | srch.fsCaseSensitive = FALSE;
|
---|
1001 | srch.usView = CV_ICON;
|
---|
1002 | pci = WinSendMsg(hwnd,CM_SEARCHSTRING,MPFROMP(&srch),
|
---|
1003 | MPFROMLONG(CMA_FIRST));
|
---|
1004 | if(pci && (INT)pci != -1) {
|
---|
1005 |
|
---|
1006 | USHORT attrib = CRA_CURSORED;
|
---|
1007 |
|
---|
1008 | /* make found item current item */
|
---|
1009 | if(!stricmp(pci->pszFileName,dcd->comnam))
|
---|
1010 | attrib |= CRA_SELECTED;
|
---|
1011 | WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPFROMP(pci),
|
---|
1012 | MPFROM2SHORT(TRUE,attrib));
|
---|
1013 | /* make sure that record shows in viewport */
|
---|
1014 | ShowCnrRecord(hwnd,(PMINIRECORDCORE)pci);
|
---|
1015 | return (MRESULT)TRUE;
|
---|
1016 | }
|
---|
1017 | else {
|
---|
1018 | if(SHORT1FROMMP(mp2) == ' ') {
|
---|
1019 | dcd->comnam[len] = 0;
|
---|
1020 | break;
|
---|
1021 | }
|
---|
1022 | *dcd->comnam = 0;
|
---|
1023 | dcd->lasttime = 0;
|
---|
1024 | if(len) // retry as first letter if no match
|
---|
1025 | goto KbdRetry;
|
---|
1026 | }
|
---|
1027 | break;
|
---|
1028 | }
|
---|
1029 | }
|
---|
1030 | break;
|
---|
1031 |
|
---|
1032 | case WM_MOUSEMOVE:
|
---|
1033 | case WM_BUTTON1UP:
|
---|
1034 | case WM_BUTTON2UP:
|
---|
1035 | case WM_BUTTON3UP:
|
---|
1036 | case WM_CHORD:
|
---|
1037 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
1038 | break;
|
---|
1039 |
|
---|
1040 | case WM_BUTTON1MOTIONEND:
|
---|
1041 | {
|
---|
1042 | CNRINFO cnri;
|
---|
1043 |
|
---|
1044 | memset(&cnri,0,sizeof(CNRINFO));
|
---|
1045 | cnri.cb = sizeof(CNRINFO);
|
---|
1046 | if(WinSendMsg(hwnd,CM_QUERYCNRINFO,MPFROMP(&cnri),
|
---|
1047 | MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
1048 | if(cnri.flWindowAttr & CV_DETAIL)
|
---|
1049 | PrfWriteProfileData(fmprof,appname,"CollectorCnrSplitBar",
|
---|
1050 | (PVOID)&cnri.xVertSplitbar,sizeof(LONG));
|
---|
1051 | }
|
---|
1052 | }
|
---|
1053 | break;
|
---|
1054 |
|
---|
1055 | case WM_PRESPARAMCHANGED:
|
---|
1056 | PresParamChanged(hwnd,"Collector",mp1,mp2);
|
---|
1057 | break;
|
---|
1058 |
|
---|
1059 | case UM_COMPARE:
|
---|
1060 | if(dcd && mp1 && mp2) {
|
---|
1061 |
|
---|
1062 | COMPARE *cmp;
|
---|
1063 | CHAR *leftdir = (CHAR *)mp1,*rightdir = (CHAR *)mp2;
|
---|
1064 |
|
---|
1065 | if(!IsFile(leftdir) && !IsFile(rightdir)) {
|
---|
1066 | cmp = malloc(sizeof(COMPARE));
|
---|
1067 | if(cmp) {
|
---|
1068 | memset(cmp,0,sizeof(COMPARE));
|
---|
1069 | cmp->size = sizeof(COMPARE);
|
---|
1070 | strcpy(cmp->leftdir,leftdir);
|
---|
1071 | strcpy(cmp->rightdir,rightdir);
|
---|
1072 | cmp->hwndParent = dcd->hwndParent;
|
---|
1073 | cmp->dcd.hwndParent = dcd->hwndParent;
|
---|
1074 | WinDlgBox(HWND_DESKTOP,HWND_DESKTOP,CompareDlgProc,
|
---|
1075 | FM3ModHandle,COMP_FRAME,MPFROMP(cmp));
|
---|
1076 | }
|
---|
1077 | }
|
---|
1078 | }
|
---|
1079 | return 0;
|
---|
1080 |
|
---|
1081 | case UM_UPDATERECORDLIST:
|
---|
1082 | if(dcd && mp1)
|
---|
1083 | WinSendMsg(dcd->hwndObject,msg,mp1,mp2);
|
---|
1084 | return 0;
|
---|
1085 |
|
---|
1086 | case UM_UPDATERECORD:
|
---|
1087 | if(dcd && mp1) {
|
---|
1088 |
|
---|
1089 | CHAR *filename;
|
---|
1090 |
|
---|
1091 | filename = mp1;
|
---|
1092 | if(filename)
|
---|
1093 | UpdateCnrRecord(hwnd,filename,TRUE,dcd);
|
---|
1094 | }
|
---|
1095 | return 0;
|
---|
1096 |
|
---|
1097 | case WM_SETFOCUS:
|
---|
1098 | /*
|
---|
1099 | * put name of our window on status line
|
---|
1100 | */
|
---|
1101 | if(dcd && hwndStatus && mp2) {
|
---|
1102 |
|
---|
1103 | PCNRITEM pci = NULL;
|
---|
1104 |
|
---|
1105 | if(fAutoView && hwndMain) {
|
---|
1106 | pci = WinSendMsg(hwnd,
|
---|
1107 | CM_QUERYRECORDEMPHASIS,
|
---|
1108 | MPFROMLONG(CMA_FIRST),
|
---|
1109 | MPFROMSHORT(CRA_CURSORED));
|
---|
1110 | if(pci && (INT)pci != -1 &&
|
---|
1111 | (!(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_SLOW)))
|
---|
1112 | WinSendMsg(hwndMain,
|
---|
1113 | UM_LOADFILE,
|
---|
1114 | MPFROMP(pci->szFileName),
|
---|
1115 | MPVOID);
|
---|
1116 | else
|
---|
1117 | WinSendMsg(hwndMain,
|
---|
1118 | UM_LOADFILE,
|
---|
1119 | MPVOID,
|
---|
1120 | MPVOID);
|
---|
1121 | }
|
---|
1122 | if(dcd->amextracted)
|
---|
1123 | WinSetWindowText(hwndStatus2,
|
---|
1124 | GetPString(IDS_INSEEKSCANTEXT));
|
---|
1125 | WinSendMsg(hwnd,
|
---|
1126 | UM_RESCAN,
|
---|
1127 | MPVOID,
|
---|
1128 | MPVOID);
|
---|
1129 | }
|
---|
1130 | break;
|
---|
1131 |
|
---|
1132 | case UM_RESCAN:
|
---|
1133 | if(dcd) {
|
---|
1134 |
|
---|
1135 | CNRINFO cnri;
|
---|
1136 | CHAR s[CCHMAXPATH + 69],tb[81],tf[81],*p;
|
---|
1137 | PCNRITEM pci = NULL;
|
---|
1138 |
|
---|
1139 | memset(&cnri,0,sizeof(CNRINFO));
|
---|
1140 | cnri.cb = sizeof(CNRINFO);
|
---|
1141 | WinSendMsg(hwnd,CM_QUERYCNRINFO,MPFROMP(&cnri),
|
---|
1142 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
1143 | dcd->totalfiles = cnri.cRecords;
|
---|
1144 | commafmt(tf,sizeof(tf),dcd->totalfiles);
|
---|
1145 | if(dcd->totalbytes > 1024)
|
---|
1146 | commafmt(tb,sizeof(tb),dcd->totalbytes / 1024L);
|
---|
1147 | else
|
---|
1148 | commafmt(tb,sizeof(tb),dcd->totalbytes);
|
---|
1149 | sprintf(s,"%s / %s%s",tf,tb,(dcd->totalbytes > 1024) ? "k" : "b");
|
---|
1150 | WinSetDlgItemText(dcd->hwndClient,DIR_TOTALS,s);
|
---|
1151 | commafmt(tf,sizeof(tf),dcd->selectedfiles);
|
---|
1152 | if(dcd->selectedbytes > 1024)
|
---|
1153 | commafmt(tb,sizeof(tb),dcd->selectedbytes / 1024L);
|
---|
1154 | else
|
---|
1155 | commafmt(tb,sizeof(tb),dcd->selectedbytes);
|
---|
1156 | sprintf(s,"%s / %s%s",tf,tb,(dcd->selectedbytes > 1024) ? "k" : "b");
|
---|
1157 | WinSetDlgItemText(dcd->hwndClient,DIR_SELECTED,s);
|
---|
1158 | if(hwndStatus &&
|
---|
1159 | dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
|
---|
1160 | if(hwndMain) {
|
---|
1161 | pci = WinSendMsg(hwnd,CM_QUERYRECORDEMPHASIS,
|
---|
1162 | MPFROMLONG(CMA_FIRST),
|
---|
1163 | MPFROMSHORT(CRA_CURSORED));
|
---|
1164 | if(pci && (INT)pci != -1)
|
---|
1165 | PostMsg(hwndMain,UM_LOADFILE,MPFROMP(pci->szFileName),MPVOID);
|
---|
1166 | else
|
---|
1167 | PostMsg(hwndMain,UM_LOADFILE,MPVOID,MPVOID);
|
---|
1168 | }
|
---|
1169 | if(!fMoreButtons)
|
---|
1170 | sprintf(s," %s%s%s%s",GetPString(IDS_COLLECTORTEXT),
|
---|
1171 | (*dcd->mask.szMask || dcd->mask.antiattr ||
|
---|
1172 | dcd->mask.attrFile != ALLATTRS) ? " (" : NullStr,
|
---|
1173 | (*dcd->mask.szMask) ? dcd->mask.szMask :
|
---|
1174 | (dcd->mask.antiattr ||
|
---|
1175 | dcd->mask.attrFile != ALLATTRS) ?
|
---|
1176 | GetPString(IDS_ATTRTEXT) : NullStr,
|
---|
1177 | (*dcd->mask.szMask || dcd->mask.antiattr ||
|
---|
1178 | dcd->mask.attrFile != ALLATTRS) ? ")" : NullStr);
|
---|
1179 | else
|
---|
1180 | strcpy(s,GetPString(IDS_COLLECTORTEXT));
|
---|
1181 | WinSetWindowText(hwndStatus,s);
|
---|
1182 | if(!pci)
|
---|
1183 | pci = WinSendMsg(hwnd,CM_QUERYRECORDEMPHASIS,
|
---|
1184 | MPFROMLONG(CMA_FIRST),
|
---|
1185 | MPFROMSHORT(CRA_CURSORED));
|
---|
1186 | if(pci && (INT)pci != -1) {
|
---|
1187 | if(fSplitStatus && hwndStatus2) {
|
---|
1188 | if(pci->attrFile & FILE_DIRECTORY)
|
---|
1189 | p = pci->pszFileName;
|
---|
1190 | else {
|
---|
1191 | p = strrchr(pci->szFileName,'\\');
|
---|
1192 | if(p) {
|
---|
1193 | if(*(p + 1))
|
---|
1194 | p++;
|
---|
1195 | else
|
---|
1196 | p = pci->pszFileName;
|
---|
1197 | }
|
---|
1198 | else
|
---|
1199 | p = pci->pszFileName;
|
---|
1200 | }
|
---|
1201 | commafmt(tb,sizeof(tb),pci->cbFile + pci->easize);
|
---|
1202 | if(!fMoreButtons)
|
---|
1203 | sprintf(s," %sb %04u/%02u/%02u %02u:%02u:%02u [%s] %s",
|
---|
1204 | tb,pci->date.year,pci->date.month,
|
---|
1205 | pci->date.day,pci->time.hours,pci->time.minutes,
|
---|
1206 | pci->time.seconds,pci->pszDispAttr,p);
|
---|
1207 | else {
|
---|
1208 | *tf = 0;
|
---|
1209 | if(pci->cbFile + pci->easize > 1024)
|
---|
1210 | commafmt(tf,sizeof(tf),
|
---|
1211 | (pci->cbFile + pci->easize) / 1024);
|
---|
1212 | sprintf(s,GetPString(IDS_STATUSSIZETEXT),
|
---|
1213 | tb,
|
---|
1214 | (*tf) ? " (" : NullStr,
|
---|
1215 | tf,
|
---|
1216 | (*tf) ? "k)" : NullStr);
|
---|
1217 | }
|
---|
1218 | WinSetWindowText(hwndStatus2,s);
|
---|
1219 | }
|
---|
1220 | if(fMoreButtons) {
|
---|
1221 | WinSetWindowText(hwndName,pci->pszFileName);
|
---|
1222 | sprintf(s,"%04u/%02u/%02u %02u:%02u:%02u",
|
---|
1223 | pci->date.year,pci->date.month,
|
---|
1224 | pci->date.day,pci->time.hours,pci->time.minutes,
|
---|
1225 | pci->time.seconds);
|
---|
1226 | WinSetWindowText(hwndDate,s);
|
---|
1227 | WinSetWindowText(hwndAttr,pci->pszDispAttr);
|
---|
1228 | }
|
---|
1229 | if(dcd->amextracted && hwndStatus2)
|
---|
1230 | WinSetWindowText(hwndStatus2,GetPString(IDS_INSEEKSCANTEXT));
|
---|
1231 | }
|
---|
1232 | else {
|
---|
1233 | if(hwndStatus2)
|
---|
1234 | WinSetWindowText(hwndStatus2,NullStr);
|
---|
1235 | if(fMoreButtons) {
|
---|
1236 | WinSetWindowText(hwndName,NullStr);
|
---|
1237 | WinSetWindowText(hwndDate,NullStr);
|
---|
1238 | WinSetWindowText(hwndAttr,NullStr);
|
---|
1239 | }
|
---|
1240 | }
|
---|
1241 | }
|
---|
1242 | }
|
---|
1243 | return 0;
|
---|
1244 |
|
---|
1245 | case UM_CONTAINER_FILLED:
|
---|
1246 | DosBeep(1000,50);
|
---|
1247 | WinSendMsg(hwnd,
|
---|
1248 | CM_INVALIDATERECORD,
|
---|
1249 | MPVOID,
|
---|
1250 | MPFROM2SHORT(0,CMA_ERASE | CMA_REPOSITION));
|
---|
1251 | WinSendMsg(CollectorCnrMenu,
|
---|
1252 | MM_SETITEMATTR,
|
---|
1253 | MPFROM2SHORT(DID_CANCEL,TRUE),
|
---|
1254 | MPFROM2SHORT(MIA_DISABLED,MIA_DISABLED));
|
---|
1255 | WinSendMsg(CollectorCnrMenu,
|
---|
1256 | MM_SETITEMATTR,
|
---|
1257 | MPFROM2SHORT(IDM_GREP,TRUE),
|
---|
1258 | MPFROM2SHORT(MIA_DISABLED,0));
|
---|
1259 | PostMsg(hwnd,
|
---|
1260 | UM_RESCAN,
|
---|
1261 | MPVOID,
|
---|
1262 | MPVOID);
|
---|
1263 | if(dcd) {
|
---|
1264 | dcd->stopflag = 0;
|
---|
1265 | dcd->amextracted = FALSE;
|
---|
1266 | if(dcd->namecanchange) {
|
---|
1267 | if(!PostMsg(hwnd,
|
---|
1268 | WM_CLOSE,
|
---|
1269 | MPVOID,
|
---|
1270 | MPVOID))
|
---|
1271 | WinSendMsg(hwnd,
|
---|
1272 | WM_CLOSE,
|
---|
1273 | MPVOID,
|
---|
1274 | MPVOID);
|
---|
1275 | }
|
---|
1276 | else
|
---|
1277 | WinSetWindowPos(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
1278 | QW_PARENT),
|
---|
1279 | HWND_TOP,
|
---|
1280 | 0,
|
---|
1281 | 0,
|
---|
1282 | 0,
|
---|
1283 | 0,
|
---|
1284 | SWP_SHOW | SWP_RESTORE | SWP_ZORDER);
|
---|
1285 | }
|
---|
1286 | return 0;
|
---|
1287 |
|
---|
1288 | case UM_SETUP:
|
---|
1289 | if(dcd) {
|
---|
1290 | if(!dcd->hwndObject) {
|
---|
1291 | /*
|
---|
1292 | * first time through -- set things up
|
---|
1293 | */
|
---|
1294 |
|
---|
1295 | CNRINFO cnri;
|
---|
1296 |
|
---|
1297 | RestorePresParams(hwnd,"Collector");
|
---|
1298 | LoadDetailsSwitches("Collector",dcd);
|
---|
1299 | WinSendMsg(CollectorCnrMenu,MM_SETITEMATTR,
|
---|
1300 | MPFROM2SHORT(DID_CANCEL,TRUE),
|
---|
1301 | MPFROM2SHORT(MIA_DISABLED,MIA_DISABLED));
|
---|
1302 | WinSendMsg(CollectorCnrMenu,MM_SETITEMATTR,MPFROM2SHORT(IDM_GREP,TRUE),
|
---|
1303 | MPFROM2SHORT(MIA_DISABLED,0));
|
---|
1304 | dcd->amextracted = FALSE;
|
---|
1305 | dcd->stopflag = 0;
|
---|
1306 | memset(&cnri,0,sizeof(CNRINFO));
|
---|
1307 | cnri.cb = sizeof(CNRINFO);
|
---|
1308 | WinSendMsg(hwnd,CM_QUERYCNRINFO,MPFROMP(&cnri),
|
---|
1309 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
1310 | cnri.cyLineSpacing = 0;
|
---|
1311 | cnri.cxTreeIndent = 12L;
|
---|
1312 |
|
---|
1313 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
|
---|
1314 | CV_DETAIL));
|
---|
1315 | cnri.flWindowAttr |= (CV_NAME | CA_DETAILSVIEWTITLES |
|
---|
1316 | CV_MINI | CV_FLOW);
|
---|
1317 | cnri.pSortRecord = (PVOID)SortCollectorCnr;
|
---|
1318 |
|
---|
1319 | {
|
---|
1320 | ULONG size = sizeof(ULONG);
|
---|
1321 |
|
---|
1322 | PrfQueryProfileData(fmprof,appname,"CollectorflWindowAttr",
|
---|
1323 | (PVOID)&cnri.flWindowAttr,&size);
|
---|
1324 | size = sizeof(MASK);
|
---|
1325 | if(PrfQueryProfileSize(fmprof,appname,"CollectorFilter",&size) &&
|
---|
1326 | size) {
|
---|
1327 | PrfQueryProfileData(fmprof,appname,"CollectorFilter",&dcd->mask,
|
---|
1328 | &size);
|
---|
1329 | SetMask(dcd->mask.szMask,&dcd->mask);
|
---|
1330 | }
|
---|
1331 | else {
|
---|
1332 | dcd->mask.attrFile = (FILE_NORMAL | FILE_READONLY |
|
---|
1333 | FILE_DIRECTORY | FILE_HIDDEN |
|
---|
1334 | FILE_SYSTEM | FILE_ARCHIVED);
|
---|
1335 | dcd->mask.antiattr = 0;
|
---|
1336 | }
|
---|
1337 | *(dcd->mask.prompt) = 0;
|
---|
1338 | }
|
---|
1339 | cnri.flWindowAttr |= CV_FLOW;
|
---|
1340 | cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH));
|
---|
1341 | dcd->flWindowAttr = cnri.flWindowAttr;
|
---|
1342 | WinSendMsg(hwnd,CM_SETCNRINFO,MPFROMP(&cnri),
|
---|
1343 | MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
|
---|
1344 | CMA_CXTREEINDENT | CMA_PSORTRECORD));
|
---|
1345 | SetCnrCols(hwnd,FALSE);
|
---|
1346 | AdjustCnrColsForPref(hwnd,NULL,dcd,FALSE);
|
---|
1347 | { /* fix splitbar for collector container */
|
---|
1348 | ULONG size;
|
---|
1349 |
|
---|
1350 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
|
---|
1351 | size = sizeof(LONG);
|
---|
1352 | PrfQueryProfileData(fmprof,appname,"CollectorCnrSplitBar",
|
---|
1353 | &cnri.xVertSplitbar,&size);
|
---|
1354 | if(cnri.xVertSplitbar <= 0)
|
---|
1355 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
|
---|
1356 | WinSendMsg(hwnd,CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
1357 | MPFROMLONG(CMA_XVERTSPLITBAR));
|
---|
1358 | }
|
---|
1359 | if(_beginthread(MakeObjWin,NULL,245760,(PVOID)dcd) == -1) {
|
---|
1360 | PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID);
|
---|
1361 | return 0;
|
---|
1362 | }
|
---|
1363 | else
|
---|
1364 | DosSleep(64L);
|
---|
1365 | }
|
---|
1366 | SayFilter(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
1367 | DIR_FILTER),&dcd->mask,FALSE);
|
---|
1368 | SaySort(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
1369 | DIR_SORT),CollectorsortFlags,FALSE);
|
---|
1370 | SayView(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
1371 | DIR_VIEW),dcd->flWindowAttr);
|
---|
1372 | }
|
---|
1373 | else {
|
---|
1374 | PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID);
|
---|
1375 | return 0;
|
---|
1376 | }
|
---|
1377 | return 0;
|
---|
1378 |
|
---|
1379 | case WM_MENUEND:
|
---|
1380 | if(dcd) {
|
---|
1381 |
|
---|
1382 | HWND hwndMenu = (HWND)mp2;
|
---|
1383 |
|
---|
1384 | if(hwndMenu == CollectorCnrMenu || hwndMenu == CollectorFileMenu ||
|
---|
1385 | hwndMenu == CollectorDirMenu) {
|
---|
1386 | MarkAll(hwnd,TRUE,FALSE,TRUE);
|
---|
1387 | if(dcd->cnremphasized) {
|
---|
1388 | WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPVOID,
|
---|
1389 | MPFROM2SHORT(FALSE,CRA_SOURCE));
|
---|
1390 | dcd->cnremphasized = FALSE;
|
---|
1391 | }
|
---|
1392 | }
|
---|
1393 | }
|
---|
1394 | break;
|
---|
1395 |
|
---|
1396 | case UM_OPENWINDOWFORME:
|
---|
1397 | if(dcd) {
|
---|
1398 | if(mp1 &&
|
---|
1399 | !IsFile((CHAR *)mp1))
|
---|
1400 | OpenDirCnr((HWND)0,
|
---|
1401 | hwndMain,
|
---|
1402 | dcd->hwndFrame,
|
---|
1403 | FALSE,
|
---|
1404 | (char *)mp1);
|
---|
1405 | else if(mp1 &&
|
---|
1406 | IsFile(mp1) == 1)
|
---|
1407 | StartArcCnr(HWND_DESKTOP,
|
---|
1408 | dcd->hwndFrame,
|
---|
1409 | (CHAR *)mp1,
|
---|
1410 | 4,
|
---|
1411 | (ARC_TYPE *)mp2);
|
---|
1412 | }
|
---|
1413 | return 0;
|
---|
1414 |
|
---|
1415 | case MM_PORTHOLEINIT:
|
---|
1416 | if(dcd) {
|
---|
1417 | switch(SHORT1FROMMP(mp1)) {
|
---|
1418 | case 0:
|
---|
1419 | case 1:
|
---|
1420 | {
|
---|
1421 | ULONG wmsg;
|
---|
1422 |
|
---|
1423 | wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
|
---|
1424 | PortholeInit((HWND)WinSendMsg(dcd->hwndClient,wmsg,MPVOID,
|
---|
1425 | MPVOID),mp1,mp2);
|
---|
1426 | }
|
---|
1427 | break;
|
---|
1428 | }
|
---|
1429 | }
|
---|
1430 | break;
|
---|
1431 |
|
---|
1432 | case UM_INITMENU:
|
---|
1433 | case WM_INITMENU:
|
---|
1434 | if(dcd) {
|
---|
1435 | switch(SHORT1FROMMP(mp1)) {
|
---|
1436 | case IDM_VIEWSMENU:
|
---|
1437 | SetViewMenu((HWND)mp2,dcd->flWindowAttr);
|
---|
1438 | WinEnableMenuItem((HWND)mp2,IDM_RESELECT,
|
---|
1439 | (dcd->lastselection != NULL));
|
---|
1440 | break;
|
---|
1441 |
|
---|
1442 | case IDM_DETAILSSETUP:
|
---|
1443 | SetDetailsSwitches((HWND)mp2,dcd);
|
---|
1444 | break;
|
---|
1445 |
|
---|
1446 | case IDM_COMMANDSMENU:
|
---|
1447 | SetupCommandMenu((HWND)mp2,hwnd);
|
---|
1448 | break;
|
---|
1449 |
|
---|
1450 | case IDM_SORTSUBMENU:
|
---|
1451 | SetSortChecks((HWND)mp2,CollectorsortFlags);
|
---|
1452 | break;
|
---|
1453 | }
|
---|
1454 | dcd->hwndLastMenu = (HWND)mp2;
|
---|
1455 | }
|
---|
1456 | if(msg == WM_INITMENU)
|
---|
1457 | break;
|
---|
1458 | return 0;
|
---|
1459 |
|
---|
1460 | case UM_COLLECTFROMFILE:
|
---|
1461 | if(mp1) {
|
---|
1462 | if(dcd) {
|
---|
1463 | if(!PostMsg(dcd->hwndObject,UM_COLLECTFROMFILE,mp1,mp2)) {
|
---|
1464 | free(mp1);
|
---|
1465 | DosBeep(50,100);
|
---|
1466 | }
|
---|
1467 | }
|
---|
1468 | else
|
---|
1469 | free(mp1);
|
---|
1470 | }
|
---|
1471 | else
|
---|
1472 | free(mp1);
|
---|
1473 | return 0;
|
---|
1474 |
|
---|
1475 |
|
---|
1476 | case UM_COMMAND:
|
---|
1477 | if(mp1) {
|
---|
1478 | if(dcd) {
|
---|
1479 | if(!PostMsg(dcd->hwndObject,UM_COMMAND,mp1,mp2)) {
|
---|
1480 | FreeListInfo((LISTINFO *)mp1);
|
---|
1481 | DosBeep(50,100);
|
---|
1482 | }
|
---|
1483 | else
|
---|
1484 | return (MRESULT)TRUE;
|
---|
1485 | }
|
---|
1486 | else
|
---|
1487 | FreeListInfo((LISTINFO *)mp1);
|
---|
1488 | }
|
---|
1489 | return 0;
|
---|
1490 |
|
---|
1491 | case UM_NOTIFY:
|
---|
1492 | if(mp2)
|
---|
1493 | AddNote((CHAR *)mp2);
|
---|
1494 | return 0;
|
---|
1495 |
|
---|
1496 | case WM_COMMAND:
|
---|
1497 | DosError(FERR_DISABLEHARDERR);
|
---|
1498 | if(dcd) {
|
---|
1499 | switch(SHORT1FROMMP(mp1)) {
|
---|
1500 | case IDM_SETTARGET:
|
---|
1501 | SetTargetDir(hwnd,FALSE);
|
---|
1502 | break;
|
---|
1503 |
|
---|
1504 | case IDM_CONTEXTMENU:
|
---|
1505 | {
|
---|
1506 | PCNRITEM pci;
|
---|
1507 |
|
---|
1508 | pci = (PCNRITEM)CurrentRecord(hwnd);
|
---|
1509 | PostMsg(hwnd,WM_CONTROL,MPFROM2SHORT(COLLECTOR_CNR,
|
---|
1510 | CN_CONTEXTMENU),MPFROMP(pci));
|
---|
1511 | }
|
---|
1512 | break;
|
---|
1513 |
|
---|
1514 | case IDM_SHOWALLFILES:
|
---|
1515 | {
|
---|
1516 | PCNRITEM pci;
|
---|
1517 |
|
---|
1518 | pci = WinSendMsg(hwnd,CM_QUERYRECORDEMPHASIS,
|
---|
1519 | MPFROMLONG(CMA_FIRST),
|
---|
1520 | MPFROMSHORT(CRA_CURSORED));
|
---|
1521 | if(pci && (INT)pci != -1) {
|
---|
1522 |
|
---|
1523 | static CHAR dirname[CCHMAXPATH];
|
---|
1524 |
|
---|
1525 | strcpy(dirname,pci->szFileName);
|
---|
1526 | MakeValidDir(dirname);
|
---|
1527 | StartSeeAll(HWND_DESKTOP,FALSE,dirname);
|
---|
1528 | }
|
---|
1529 | }
|
---|
1530 | break;
|
---|
1531 |
|
---|
1532 | case IDM_BEGINEDIT:
|
---|
1533 | OpenEdit(hwnd);
|
---|
1534 | break;
|
---|
1535 |
|
---|
1536 | case IDM_ENDEDIT:
|
---|
1537 | WinSendMsg(hwnd,CM_CLOSEEDIT,MPVOID,MPVOID);
|
---|
1538 | break;
|
---|
1539 |
|
---|
1540 | case IDM_SHOWSELECT:
|
---|
1541 | QuickPopup(hwnd,dcd,CheckMenu(&CollectorCnrMenu,COLLECTORCNR_POPUP),
|
---|
1542 | IDM_SELECTSUBMENU);
|
---|
1543 | break;
|
---|
1544 |
|
---|
1545 | case IDM_SHOWSORT:
|
---|
1546 | QuickPopup(hwnd,dcd,CheckMenu(&CollectorCnrMenu,COLLECTORCNR_POPUP),
|
---|
1547 | IDM_SORTSUBMENU);
|
---|
1548 | break;
|
---|
1549 |
|
---|
1550 | case IDM_VIEWORARC:
|
---|
1551 | {
|
---|
1552 | SWP swp;
|
---|
1553 | PCNRITEM pci;
|
---|
1554 |
|
---|
1555 | pci = (PCNRITEM)WinSendMsg(hwnd,CM_QUERYRECORDEMPHASIS,
|
---|
1556 | MPFROMLONG(CMA_FIRST),
|
---|
1557 | MPFROMSHORT(CRA_CURSORED));
|
---|
1558 | if(pci && (INT)pci != -1) {
|
---|
1559 | WinQueryWindowPos(dcd->hwndFrame,&swp);
|
---|
1560 | DefaultViewKeys(hwnd,dcd->hwndFrame,dcd->hwndParent,&swp,
|
---|
1561 | pci->szFileName);
|
---|
1562 | }
|
---|
1563 | }
|
---|
1564 | break;
|
---|
1565 |
|
---|
1566 | case IDM_SEEALL:
|
---|
1567 | StartSeeAll(HWND_DESKTOP,
|
---|
1568 | FALSE,
|
---|
1569 | NULL);
|
---|
1570 | break;
|
---|
1571 |
|
---|
1572 | case IDM_COLLECTSELECT:
|
---|
1573 | {
|
---|
1574 | CHAR filename[CCHMAXPATH],*p,*pp;
|
---|
1575 | ULONG size;
|
---|
1576 |
|
---|
1577 | strcpy(filename,"*.LST");
|
---|
1578 | size = CCHMAXPATH;
|
---|
1579 | PrfQueryProfileData(fmprof,appname,"SaveToListName",
|
---|
1580 | filename,&size);
|
---|
1581 | pp = strrchr(filename,'\\');
|
---|
1582 | if(!pp)
|
---|
1583 | pp = filename;
|
---|
1584 | p = strrchr(pp,'.');
|
---|
1585 | if(p && *(p + 1) && p > pp + 1) {
|
---|
1586 | if(pp > filename)
|
---|
1587 | pp++;
|
---|
1588 | *pp = '*';
|
---|
1589 | pp++;
|
---|
1590 | if(p > pp)
|
---|
1591 | memmove(pp,p,strlen(p) + 1);
|
---|
1592 | }
|
---|
1593 | if(insert_filename(hwnd,filename,FALSE,FALSE)) {
|
---|
1594 | p = strdup(filename);
|
---|
1595 | if(p) {
|
---|
1596 | if(!PostMsg(hwnd,UM_COLLECTFROMFILE,MPFROMP(p),MPVOID))
|
---|
1597 | free(p);
|
---|
1598 | }
|
---|
1599 | }
|
---|
1600 | }
|
---|
1601 | break;
|
---|
1602 |
|
---|
1603 | case IDM_NOTEBOOK:
|
---|
1604 | if(!ParentIsDesktop(dcd->hwndParent,dcd->hwndParent))
|
---|
1605 | PostMsg(dcd->hwndParent,msg,mp1,mp2);
|
---|
1606 | else
|
---|
1607 | WinDlgBox(HWND_DESKTOP,hwnd,CfgDlgProc,FM3ModHandle,
|
---|
1608 | CFG_FRAME,(PVOID)"Collector");
|
---|
1609 | break;
|
---|
1610 |
|
---|
1611 | case IDM_RESELECT:
|
---|
1612 | SelectList(hwnd,FALSE,FALSE,FALSE,NULL,NULL,dcd->lastselection);
|
---|
1613 | break;
|
---|
1614 |
|
---|
1615 | case IDM_HELP:
|
---|
1616 | if(hwndHelp)
|
---|
1617 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
1618 | MPFROM2SHORT(HELP_COLLECT,0),
|
---|
1619 | MPFROMSHORT(HM_RESOURCEID));
|
---|
1620 | break;
|
---|
1621 |
|
---|
1622 | case IDM_SORTNONE:
|
---|
1623 | case IDM_SORTSMARTNAME:
|
---|
1624 | case IDM_SORTNAME:
|
---|
1625 | case IDM_SORTFILENAME:
|
---|
1626 | case IDM_SORTSIZE:
|
---|
1627 | case IDM_SORTEASIZE:
|
---|
1628 | case IDM_SORTFIRST:
|
---|
1629 | case IDM_SORTLAST:
|
---|
1630 | case IDM_SORTLWDATE:
|
---|
1631 | case IDM_SORTLADATE:
|
---|
1632 | case IDM_SORTCRDATE:
|
---|
1633 | case IDM_SORTSUBJECT:
|
---|
1634 | tempsortFlags = CollectorsortFlags;
|
---|
1635 | CollectorsortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
|
---|
1636 | case IDM_SORTDIRSFIRST:
|
---|
1637 | case IDM_SORTDIRSLAST:
|
---|
1638 | case IDM_SORTREVERSE:
|
---|
1639 | switch(SHORT1FROMMP(mp1)) {
|
---|
1640 | case IDM_SORTSUBJECT:
|
---|
1641 | CollectorsortFlags |= SORT_SUBJECT;
|
---|
1642 | break;
|
---|
1643 | case IDM_SORTNONE:
|
---|
1644 | CollectorsortFlags |= SORT_NOSORT;
|
---|
1645 | break;
|
---|
1646 | case IDM_SORTSMARTNAME:
|
---|
1647 | if(!(tempsortFlags & SORT_FILENAME))
|
---|
1648 | CollectorsortFlags |= SORT_FILENAME;
|
---|
1649 | break;
|
---|
1650 | case IDM_SORTFILENAME:
|
---|
1651 | CollectorsortFlags |= SORT_FILENAME;
|
---|
1652 | break;
|
---|
1653 | case IDM_SORTSIZE:
|
---|
1654 | CollectorsortFlags |= SORT_SIZE;
|
---|
1655 | break;
|
---|
1656 | case IDM_SORTEASIZE:
|
---|
1657 | CollectorsortFlags |= SORT_EASIZE;
|
---|
1658 | break;
|
---|
1659 | case IDM_SORTFIRST:
|
---|
1660 | CollectorsortFlags |= SORT_FIRSTEXTENSION;
|
---|
1661 | break;
|
---|
1662 | case IDM_SORTLAST:
|
---|
1663 | CollectorsortFlags |= SORT_LASTEXTENSION;
|
---|
1664 | break;
|
---|
1665 | case IDM_SORTLWDATE:
|
---|
1666 | CollectorsortFlags |= SORT_LWDATE;
|
---|
1667 | break;
|
---|
1668 | case IDM_SORTLADATE:
|
---|
1669 | CollectorsortFlags |= SORT_LADATE;
|
---|
1670 | break;
|
---|
1671 | case IDM_SORTCRDATE:
|
---|
1672 | CollectorsortFlags |= SORT_CRDATE;
|
---|
1673 | break;
|
---|
1674 | case IDM_SORTDIRSFIRST:
|
---|
1675 | if(CollectorsortFlags & SORT_DIRSFIRST)
|
---|
1676 | CollectorsortFlags &= (~SORT_DIRSFIRST);
|
---|
1677 | else {
|
---|
1678 | CollectorsortFlags |= SORT_DIRSFIRST;
|
---|
1679 | CollectorsortFlags &= (~SORT_DIRSLAST);
|
---|
1680 | }
|
---|
1681 | break;
|
---|
1682 | case IDM_SORTDIRSLAST:
|
---|
1683 | if(CollectorsortFlags & SORT_DIRSLAST)
|
---|
1684 | CollectorsortFlags &= (~SORT_DIRSLAST);
|
---|
1685 | else {
|
---|
1686 | CollectorsortFlags |= SORT_DIRSLAST;
|
---|
1687 | CollectorsortFlags &= (~SORT_DIRSFIRST);
|
---|
1688 | }
|
---|
1689 | break;
|
---|
1690 | case IDM_SORTREVERSE:
|
---|
1691 | if(CollectorsortFlags & SORT_REVERSE)
|
---|
1692 | CollectorsortFlags &= (~SORT_REVERSE);
|
---|
1693 | else
|
---|
1694 | CollectorsortFlags |= SORT_REVERSE;
|
---|
1695 | break;
|
---|
1696 | }
|
---|
1697 | PrfWriteProfileData(fmprof,appname,"CollectorSort",
|
---|
1698 | &CollectorsortFlags,sizeof(INT));
|
---|
1699 | WinSendMsg(hwnd,CM_SORTRECORD,MPFROMP(SortCollectorCnr),MPVOID);
|
---|
1700 | SaySort(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
1701 | DIR_SORT),CollectorsortFlags,FALSE);
|
---|
1702 | break;
|
---|
1703 |
|
---|
1704 | case IDM_COLLECTFROMCLIP:
|
---|
1705 | {
|
---|
1706 |
|
---|
1707 | LISTINFO *li;
|
---|
1708 |
|
---|
1709 | li = malloc(sizeof(LISTINFO));
|
---|
1710 | if(li) {
|
---|
1711 | memset(li,0,sizeof(LISTINFO));
|
---|
1712 | li->list = ListFromClipboard(hwnd);
|
---|
1713 | if(!li->list || !li->list[0])
|
---|
1714 | FreeListInfo(li);
|
---|
1715 | else {
|
---|
1716 | li->type = IDM_COLLECT;
|
---|
1717 | if(!PostMsg(dcd->hwndObject,UM_COLLECT,MPFROMP(li),
|
---|
1718 | MPVOID))
|
---|
1719 | FreeListInfo(li);
|
---|
1720 | }
|
---|
1721 | }
|
---|
1722 | }
|
---|
1723 | break;
|
---|
1724 |
|
---|
1725 | case IDM_REMOVE:
|
---|
1726 | if(fAutoView &&
|
---|
1727 | hwndMain)
|
---|
1728 | PostMsg(hwndMain,
|
---|
1729 | UM_LOADFILE,
|
---|
1730 | MPVOID,
|
---|
1731 | MPVOID);
|
---|
1732 | dcd->suspendview = 1;
|
---|
1733 | RemoveAll(hwnd,
|
---|
1734 | &dcd->totalbytes,
|
---|
1735 | &dcd->totalfiles);
|
---|
1736 | dcd->suspendview = 0;
|
---|
1737 | PostMsg(hwnd,
|
---|
1738 | UM_RESCAN,
|
---|
1739 | MPVOID,
|
---|
1740 | MPVOID);
|
---|
1741 | break;
|
---|
1742 |
|
---|
1743 | case IDM_CLEARCNR:
|
---|
1744 | {
|
---|
1745 | PCNRITEM pci;
|
---|
1746 |
|
---|
1747 | pci = (PCNRITEM)WinSendMsg(hwnd,
|
---|
1748 | CM_QUERYRECORD,
|
---|
1749 | MPVOID,
|
---|
1750 | MPFROM2SHORT(CMA_FIRST,
|
---|
1751 | CMA_ITEMORDER));
|
---|
1752 | if(pci && (INT)pci != -1) {
|
---|
1753 | WinSendMsg(hwnd,
|
---|
1754 | CM_REMOVERECORD,
|
---|
1755 | MPVOID,
|
---|
1756 | MPFROM2SHORT(0,CMA_FREE | CMA_INVALIDATE));
|
---|
1757 | dcd->totalbytes = dcd->selectedbytes = dcd->selectedfiles =
|
---|
1758 | dcd->totalfiles = 0L;
|
---|
1759 | PostMsg(hwnd,
|
---|
1760 | UM_RESCAN,
|
---|
1761 | MPVOID,
|
---|
1762 | MPVOID);
|
---|
1763 | }
|
---|
1764 | }
|
---|
1765 | break;
|
---|
1766 |
|
---|
1767 | case DID_CANCEL:
|
---|
1768 | if(dcd->amextracted)
|
---|
1769 | dcd->stopflag = 1;
|
---|
1770 | break;
|
---|
1771 |
|
---|
1772 | case IDM_COLLECTOR:
|
---|
1773 | if(mp2) {
|
---|
1774 |
|
---|
1775 | LISTINFO *li;
|
---|
1776 |
|
---|
1777 | li = malloc(sizeof(LISTINFO));
|
---|
1778 | if(li) {
|
---|
1779 | memset(li,0,sizeof(LISTINFO));
|
---|
1780 | li->list = mp2;
|
---|
1781 | if(!li->list || !li->list[0])
|
---|
1782 | FreeListInfo(li);
|
---|
1783 | else {
|
---|
1784 | li->type = IDM_COLLECT;
|
---|
1785 | if(!PostMsg(dcd->hwndObject,UM_COLLECT,MPFROMP(li),
|
---|
1786 | MPVOID))
|
---|
1787 | FreeListInfo(li);
|
---|
1788 | }
|
---|
1789 | }
|
---|
1790 | else
|
---|
1791 | FreeList(mp2);
|
---|
1792 | }
|
---|
1793 | break;
|
---|
1794 |
|
---|
1795 | case IDM_UNDELETE:
|
---|
1796 | {
|
---|
1797 | PCNRITEM pci;
|
---|
1798 | CHAR path[CCHMAXPATH];
|
---|
1799 |
|
---|
1800 | pci = (PCNRITEM)CurrentRecord(hwnd);
|
---|
1801 | if(pci) {
|
---|
1802 | strcpy(path,pci->szFileName);
|
---|
1803 | MakeValidDir(path);
|
---|
1804 | WinDlgBox(HWND_DESKTOP,hwnd,UndeleteDlgProc,FM3ModHandle,
|
---|
1805 | UNDEL_FRAME,MPFROMP(path));
|
---|
1806 | }
|
---|
1807 | }
|
---|
1808 | break;
|
---|
1809 |
|
---|
1810 | case IDM_GREP:
|
---|
1811 | if(!dcd->amextracted) {
|
---|
1812 | if(WinDlgBox(HWND_DESKTOP,hwnd,GrepDlgProc,
|
---|
1813 | FM3ModHandle,GREP_FRAME,(PVOID)&hwnd)) {
|
---|
1814 | dcd->amextracted = TRUE;
|
---|
1815 | WinSendMsg(CollectorCnrMenu,MM_SETITEMATTR,
|
---|
1816 | MPFROM2SHORT(DID_CANCEL,TRUE),
|
---|
1817 | MPFROM2SHORT(MIA_DISABLED,0));
|
---|
1818 | WinSendMsg(CollectorCnrMenu,MM_SETITEMATTR,
|
---|
1819 | MPFROM2SHORT(IDM_GREP,TRUE),
|
---|
1820 | MPFROM2SHORT(MIA_DISABLED,MIA_DISABLED));
|
---|
1821 | PostMsg(hwnd,UM_RESCAN,MPVOID,MPVOID);
|
---|
1822 | }
|
---|
1823 | }
|
---|
1824 | else
|
---|
1825 | DosBeep(50,100);
|
---|
1826 | break;
|
---|
1827 |
|
---|
1828 | case IDM_RESORT:
|
---|
1829 | WinSendMsg(hwnd,CM_SORTRECORD,MPFROMP(SortCollectorCnr),MPVOID);
|
---|
1830 | break;
|
---|
1831 |
|
---|
1832 | case IDM_FILTER:
|
---|
1833 | {
|
---|
1834 | BOOL empty = FALSE;
|
---|
1835 | PCNRITEM pci;
|
---|
1836 | CHAR *p;
|
---|
1837 |
|
---|
1838 | if(!*dcd->mask.szMask) {
|
---|
1839 | empty = TRUE;
|
---|
1840 | pci = (PCNRITEM)CurrentRecord(hwnd);
|
---|
1841 | if(pci && !(pci->attrFile & FILE_DIRECTORY)) {
|
---|
1842 | p = strrchr(pci->szFileName,'\\');
|
---|
1843 | if(p) {
|
---|
1844 | p++;
|
---|
1845 | strcpy(dcd->mask.szMask,p);
|
---|
1846 | }
|
---|
1847 | }
|
---|
1848 | }
|
---|
1849 | *(dcd->mask.prompt) = 0;
|
---|
1850 |
|
---|
1851 | if(WinDlgBox(HWND_DESKTOP,hwnd,PickMaskDlgProc,
|
---|
1852 | FM3ModHandle,MSK_FRAME,MPFROMP(&dcd->mask))) {
|
---|
1853 | PrfWriteProfileData(fmprof,appname,"CollectorFilter",&dcd->mask,
|
---|
1854 | sizeof(MASK));
|
---|
1855 | dcd->suspendview = 1;
|
---|
1856 | WinSendMsg(hwnd,CM_FILTER,MPFROMP(Filter),MPFROMP(&dcd->mask));
|
---|
1857 | dcd->suspendview = 0;
|
---|
1858 | if(fAutoView && hwndMain) {
|
---|
1859 | pci = WinSendMsg(hwnd,CM_QUERYRECORDEMPHASIS,
|
---|
1860 | MPFROMLONG(CMA_FIRST),
|
---|
1861 | MPFROMSHORT(CRA_CURSORED));
|
---|
1862 | if(pci && (INT)pci != -1 &&
|
---|
1863 | (!(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_SLOW)))
|
---|
1864 | WinSendMsg(hwndMain,UM_LOADFILE,MPFROMP(pci->szFileName),
|
---|
1865 | MPVOID);
|
---|
1866 | else
|
---|
1867 | WinSendMsg(hwndMain,UM_LOADFILE,MPVOID,MPVOID);
|
---|
1868 | }
|
---|
1869 | PostMsg(hwnd,UM_RESCAN,MPVOID,MPVOID);
|
---|
1870 | }
|
---|
1871 | else if(empty)
|
---|
1872 | *dcd->mask.szMask = 0;
|
---|
1873 | SayFilter(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
1874 | DIR_FILTER),&dcd->mask,FALSE);
|
---|
1875 | }
|
---|
1876 | break;
|
---|
1877 |
|
---|
1878 | case IDM_HIDEALL:
|
---|
1879 | if(fAutoView && hwndMain)
|
---|
1880 | PostMsg(hwndMain,UM_LOADFILE,MPVOID,MPVOID);
|
---|
1881 | dcd->suspendview = 1;
|
---|
1882 | HideAll(hwnd);
|
---|
1883 | dcd->suspendview = 0;
|
---|
1884 | PostMsg(hwnd,UM_RESCAN,MPVOID,MPVOID);
|
---|
1885 | break;
|
---|
1886 |
|
---|
1887 | case IDM_SELECTLIST:
|
---|
1888 | case IDM_SELECTALL:
|
---|
1889 | case IDM_DESELECTALL:
|
---|
1890 | case IDM_SELECTALLFILES:
|
---|
1891 | case IDM_DESELECTALLFILES:
|
---|
1892 | case IDM_SELECTALLDIRS:
|
---|
1893 | case IDM_DESELECTALLDIRS:
|
---|
1894 | case IDM_SELECTMASK:
|
---|
1895 | case IDM_DESELECTMASK:
|
---|
1896 | case IDM_INVERT:
|
---|
1897 | case IDM_SELECTCLIP:
|
---|
1898 | case IDM_DESELECTCLIP:
|
---|
1899 | {
|
---|
1900 | PCNRITEM pci;
|
---|
1901 |
|
---|
1902 | pci = (PCNRITEM)CurrentRecord(hwnd);
|
---|
1903 | if((INT)pci == -1)
|
---|
1904 | pci = NULL;
|
---|
1905 | if(SHORT1FROMMP(mp1) == IDM_HIDEALL) {
|
---|
1906 | if(pci) {
|
---|
1907 | if(!(pci->rc.flRecordAttr & CRA_SELECTED))
|
---|
1908 | pci->rc.flRecordAttr |= CRA_FILTERED;
|
---|
1909 | WinSendMsg(hwnd,CM_INVALIDATERECORD,MPFROMP(&pci),
|
---|
1910 | MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION));
|
---|
1911 | break;
|
---|
1912 | }
|
---|
1913 | }
|
---|
1914 | PostMsg(dcd->hwndObject,UM_SELECT,mp1,MPFROMP(pci));
|
---|
1915 | }
|
---|
1916 | break;
|
---|
1917 |
|
---|
1918 | case IDM_RESCAN:
|
---|
1919 | PostMsg(dcd->hwndObject,UM_RESCAN,MPVOID,MPVOID);
|
---|
1920 | break;
|
---|
1921 |
|
---|
1922 | case IDM_SHOWLNAMES:
|
---|
1923 | case IDM_SHOWSUBJECT:
|
---|
1924 | case IDM_SHOWEAS:
|
---|
1925 | case IDM_SHOWSIZE:
|
---|
1926 | case IDM_SHOWICON:
|
---|
1927 | case IDM_SHOWLWDATE:
|
---|
1928 | case IDM_SHOWLWTIME:
|
---|
1929 | case IDM_SHOWLADATE:
|
---|
1930 | case IDM_SHOWLATIME:
|
---|
1931 | case IDM_SHOWCRDATE:
|
---|
1932 | case IDM_SHOWCRTIME:
|
---|
1933 | case IDM_SHOWATTR:
|
---|
1934 | AdjustDetailsSwitches(hwnd,dcd->hwndLastMenu,
|
---|
1935 | SHORT1FROMMP(mp1),NULL,
|
---|
1936 | "Collector",dcd,FALSE);
|
---|
1937 | break;
|
---|
1938 |
|
---|
1939 | case IDM_ICON:
|
---|
1940 | case IDM_TEXT:
|
---|
1941 | case IDM_DETAILS:
|
---|
1942 | case IDM_NAME:
|
---|
1943 | case IDM_MINIICONS:
|
---|
1944 | case IDM_DETAILSTITLES:
|
---|
1945 | {
|
---|
1946 | CNRINFO cnri;
|
---|
1947 |
|
---|
1948 | memset(&cnri,0,sizeof(CNRINFO));
|
---|
1949 | cnri.cb = sizeof(CNRINFO);
|
---|
1950 | WinSendMsg(hwnd,CM_QUERYCNRINFO,MPFROMP(&cnri),
|
---|
1951 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
1952 | switch(SHORT1FROMMP(mp1)) {
|
---|
1953 | case IDM_ICON:
|
---|
1954 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
|
---|
1955 | CV_DETAIL | CV_NAME));
|
---|
1956 | cnri.flWindowAttr |= CV_ICON;
|
---|
1957 | break;
|
---|
1958 | case IDM_NAME:
|
---|
1959 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
|
---|
1960 | CV_DETAIL | CV_NAME));
|
---|
1961 | cnri.flWindowAttr |= CV_NAME;
|
---|
1962 | break;
|
---|
1963 | case IDM_TEXT:
|
---|
1964 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
|
---|
1965 | CV_DETAIL | CV_NAME));
|
---|
1966 | cnri.flWindowAttr |= CV_TEXT;
|
---|
1967 | break;
|
---|
1968 | case IDM_DETAILS:
|
---|
1969 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
|
---|
1970 | CV_DETAIL | CV_NAME));
|
---|
1971 | cnri.flWindowAttr |= CV_DETAIL;
|
---|
1972 | break;
|
---|
1973 | case IDM_MINIICONS:
|
---|
1974 | if(cnri.flWindowAttr & CV_MINI)
|
---|
1975 | cnri.flWindowAttr &= (~CV_MINI);
|
---|
1976 | else
|
---|
1977 | cnri.flWindowAttr |= CV_MINI;
|
---|
1978 | break;
|
---|
1979 | case IDM_DETAILSTITLES:
|
---|
1980 | if(cnri.flWindowAttr & CA_DETAILSVIEWTITLES)
|
---|
1981 | cnri.flWindowAttr &= (~CA_DETAILSVIEWTITLES);
|
---|
1982 | else
|
---|
1983 | cnri.flWindowAttr |= CA_DETAILSVIEWTITLES;
|
---|
1984 | break;
|
---|
1985 | }
|
---|
1986 | cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH |
|
---|
1987 | CA_MIXEDTARGETEMPH));
|
---|
1988 | cnri.flWindowAttr |= CV_FLOW;
|
---|
1989 | dcd->flWindowAttr = cnri.flWindowAttr;
|
---|
1990 | PrfWriteProfileData(fmprof,appname,"CollectorflWindowAttr",
|
---|
1991 | &cnri.flWindowAttr,sizeof(ULONG));
|
---|
1992 | WinSendMsg(hwnd,CM_SETCNRINFO,MPFROMP(&cnri),
|
---|
1993 | MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
1994 | WinSendMsg(hwnd,CM_INVALIDATERECORD,MPVOID,
|
---|
1995 | MPFROM2SHORT(0,CMA_ERASE | CMA_REPOSITION));
|
---|
1996 | SayView(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
1997 | DIR_VIEW),dcd->flWindowAttr);
|
---|
1998 | }
|
---|
1999 | break;
|
---|
2000 |
|
---|
2001 | case IDM_SAVETOLIST:
|
---|
2002 | WinDlgBox(HWND_DESKTOP,hwnd,SaveListDlgProc,FM3ModHandle,
|
---|
2003 | SAV_FRAME,MPFROMP(&hwnd));
|
---|
2004 | break;
|
---|
2005 |
|
---|
2006 | case IDM_SIZES:
|
---|
2007 | {
|
---|
2008 | PCNRITEM pci;
|
---|
2009 |
|
---|
2010 | pci = (PCNRITEM)CurrentRecord(hwnd);
|
---|
2011 | if(pci && (INT)pci != -1)
|
---|
2012 | WinDlgBox(HWND_DESKTOP,HWND_DESKTOP,DirSizeProc,FM3ModHandle,
|
---|
2013 | DSZ_FRAME,pci->szFileName);
|
---|
2014 | }
|
---|
2015 | break;
|
---|
2016 |
|
---|
2017 | case IDM_MKDIR:
|
---|
2018 | {
|
---|
2019 | PCNRITEM pci;
|
---|
2020 |
|
---|
2021 | pci = (PCNRITEM)CurrentRecord(hwnd);
|
---|
2022 | PMMkDir(dcd->hwndParent,(pci && (INT)pci != -1) ?
|
---|
2023 | pci->szFileName : NULL,FALSE);
|
---|
2024 | }
|
---|
2025 | break;
|
---|
2026 |
|
---|
2027 | case IDM_DOITYOURSELF:
|
---|
2028 | case IDM_UPDATE:
|
---|
2029 | case IDM_COLLECTFROMFILE:
|
---|
2030 | case IDM_OPENWINDOW:
|
---|
2031 | case IDM_OPENSETTINGS:
|
---|
2032 | case IDM_OPENDEFAULT:
|
---|
2033 | case IDM_OPENICON:
|
---|
2034 | case IDM_OPENDETAILS:
|
---|
2035 | case IDM_OPENTREE:
|
---|
2036 | case IDM_OBJECT:
|
---|
2037 | case IDM_SHADOW:
|
---|
2038 | case IDM_SHADOW2:
|
---|
2039 | case IDM_DELETE:
|
---|
2040 | case IDM_PERMDELETE:
|
---|
2041 | case IDM_PRINT:
|
---|
2042 | case IDM_ATTRS:
|
---|
2043 | case IDM_INFO:
|
---|
2044 | case IDM_COPY:
|
---|
2045 | case IDM_MOVE:
|
---|
2046 | case IDM_WPSCOPY:
|
---|
2047 | case IDM_WPSMOVE:
|
---|
2048 | case IDM_COPYPRESERVE:
|
---|
2049 | case IDM_MOVEPRESERVE:
|
---|
2050 | case IDM_WILDCOPY:
|
---|
2051 | case IDM_WILDMOVE:
|
---|
2052 | case IDM_RENAME:
|
---|
2053 | case IDM_COMPARE:
|
---|
2054 | case IDM_EAS:
|
---|
2055 | case IDM_SUBJECT:
|
---|
2056 | case IDM_VIEW:
|
---|
2057 | case IDM_VIEWTEXT:
|
---|
2058 | case IDM_VIEWBINARY:
|
---|
2059 | case IDM_VIEWARCHIVE:
|
---|
2060 | case IDM_EDIT:
|
---|
2061 | case IDM_EDITTEXT:
|
---|
2062 | case IDM_EDITBINARY:
|
---|
2063 | case IDM_SAVETOCLIP:
|
---|
2064 | case IDM_APPENDTOCLIP:
|
---|
2065 | case IDM_ARCHIVE:
|
---|
2066 | case IDM_ARCHIVEM:
|
---|
2067 | case IDM_EXTRACT:
|
---|
2068 | case IDM_MCIPLAY:
|
---|
2069 | case IDM_UUDECODE:
|
---|
2070 | case IDM_MERGE:
|
---|
2071 | {
|
---|
2072 | LISTINFO *li;
|
---|
2073 | ULONG action = UM_ACTION;
|
---|
2074 |
|
---|
2075 | li = malloc(sizeof(LISTINFO));
|
---|
2076 | if(li) {
|
---|
2077 | memset(li,0,sizeof(LISTINFO));
|
---|
2078 | li->type = SHORT1FROMMP(mp1);
|
---|
2079 | li->hwnd = hwnd;
|
---|
2080 | li->list = BuildList(hwnd);
|
---|
2081 | if(li->list) {
|
---|
2082 | switch(SHORT1FROMMP(mp1)) {
|
---|
2083 | case IDM_DOITYOURSELF:
|
---|
2084 | case IDM_APPENDTOCLIP:
|
---|
2085 | case IDM_SAVETOCLIP:
|
---|
2086 | case IDM_ARCHIVE:
|
---|
2087 | case IDM_ARCHIVEM:
|
---|
2088 | case IDM_DELETE:
|
---|
2089 | case IDM_PERMDELETE:
|
---|
2090 | case IDM_ATTRS:
|
---|
2091 | case IDM_PRINT:
|
---|
2092 | case IDM_SHADOW:
|
---|
2093 | case IDM_SHADOW2:
|
---|
2094 | case IDM_OBJECT:
|
---|
2095 | case IDM_VIEW:
|
---|
2096 | case IDM_VIEWTEXT:
|
---|
2097 | case IDM_VIEWBINARY:
|
---|
2098 | case IDM_EDIT:
|
---|
2099 | case IDM_EDITTEXT:
|
---|
2100 | case IDM_EDITBINARY:
|
---|
2101 | case IDM_MCIPLAY:
|
---|
2102 | case IDM_UPDATE:
|
---|
2103 | case IDM_INFO:
|
---|
2104 | case IDM_EAS:
|
---|
2105 | action = UM_MASSACTION;
|
---|
2106 | break;
|
---|
2107 | }
|
---|
2108 | if(li->type == IDM_SHADOW || li->type == IDM_OBJECT ||
|
---|
2109 | li->type == IDM_SHADOW2)
|
---|
2110 | *li->targetpath = 0;
|
---|
2111 | if(!PostMsg(dcd->hwndObject,action,MPFROMP(li),
|
---|
2112 | MPVOID)) {
|
---|
2113 | FreeListInfo(li);
|
---|
2114 | DosBeep(50,100);
|
---|
2115 | }
|
---|
2116 | else if(fUnHilite)
|
---|
2117 | UnHilite(hwnd,TRUE,&dcd->lastselection);
|
---|
2118 | }
|
---|
2119 | else
|
---|
2120 | free(li);
|
---|
2121 | }
|
---|
2122 | }
|
---|
2123 | break;
|
---|
2124 |
|
---|
2125 | default:
|
---|
2126 | if(!cmdloaded)
|
---|
2127 | load_commands();
|
---|
2128 | if(SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
---|
2129 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
---|
2130 |
|
---|
2131 | INT x;
|
---|
2132 |
|
---|
2133 | x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
|
---|
2134 | if(x >= 0) {
|
---|
2135 | x++;
|
---|
2136 | RunCommand(hwnd,x);
|
---|
2137 | if(fUnHilite)
|
---|
2138 | UnHilite(hwnd,TRUE,&dcd->lastselection);
|
---|
2139 | }
|
---|
2140 | }
|
---|
2141 | break;
|
---|
2142 | }
|
---|
2143 | }
|
---|
2144 | return 0;
|
---|
2145 |
|
---|
2146 | case UM_FIXCNRMLE:
|
---|
2147 | case UM_FIXEDITNAME:
|
---|
2148 | return CommonCnrProc(hwnd,msg,mp1,mp2);
|
---|
2149 |
|
---|
2150 | case UM_FILESMENU:
|
---|
2151 | {
|
---|
2152 | PCNRITEM pci;
|
---|
2153 | HWND menuHwnd = (HWND)0;
|
---|
2154 |
|
---|
2155 | pci = (PCNRITEM)CurrentRecord(hwnd);
|
---|
2156 | if(pci && (INT)pci != -1) {
|
---|
2157 | if(pci->attrFile & FILE_DIRECTORY)
|
---|
2158 | menuHwnd = CheckMenu(&CollectorDirMenu,COLLECTORDIR_POPUP);
|
---|
2159 | else
|
---|
2160 | menuHwnd = CheckMenu(&CollectorFileMenu,COLLECTORFILE_POPUP);
|
---|
2161 | }
|
---|
2162 | return MRFROMLONG(menuHwnd);
|
---|
2163 | }
|
---|
2164 |
|
---|
2165 | case WM_CONTROL:
|
---|
2166 | DosError(FERR_DISABLEHARDERR);
|
---|
2167 | if(dcd) {
|
---|
2168 | switch(SHORT2FROMMP(mp1)) {
|
---|
2169 | case CN_CONTEXTMENU:
|
---|
2170 | {
|
---|
2171 | PCNRITEM pci = (PCNRITEM)mp2;
|
---|
2172 |
|
---|
2173 | if(pci) {
|
---|
2174 | WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPFROMP(pci),
|
---|
2175 | MPFROM2SHORT(TRUE,CRA_CURSORED));
|
---|
2176 | MarkAll(hwnd,FALSE,FALSE,TRUE);
|
---|
2177 | if(pci->attrFile & FILE_DIRECTORY)
|
---|
2178 | dcd->hwndLastMenu = CheckMenu(&CollectorDirMenu,
|
---|
2179 | COLLECTORDIR_POPUP);
|
---|
2180 | else
|
---|
2181 | dcd->hwndLastMenu = CheckMenu(&CollectorFileMenu,
|
---|
2182 | COLLECTORFILE_POPUP);
|
---|
2183 | }
|
---|
2184 | else {
|
---|
2185 | dcd->hwndLastMenu = CheckMenu(&CollectorCnrMenu,
|
---|
2186 | COLLECTORCNR_POPUP);
|
---|
2187 | if(dcd->hwndLastMenu && !dcd->cnremphasized) {
|
---|
2188 | WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPVOID,
|
---|
2189 | MPFROM2SHORT(TRUE,CRA_SOURCE));
|
---|
2190 | dcd->cnremphasized = TRUE;
|
---|
2191 | }
|
---|
2192 | }
|
---|
2193 | if(dcd->hwndLastMenu) {
|
---|
2194 | if(dcd->hwndLastMenu == CollectorCnrMenu) {
|
---|
2195 | SetViewMenu(dcd->hwndLastMenu,dcd->flWindowAttr);
|
---|
2196 | SetDetailsSwitches(dcd->hwndLastMenu,dcd);
|
---|
2197 | if(dcd->flWindowAttr & CV_MINI)
|
---|
2198 | WinCheckMenuItem(dcd->hwndLastMenu,IDM_MINIICONS,TRUE);
|
---|
2199 | }
|
---|
2200 | if(!PopupMenu(hwnd,hwnd,dcd->hwndLastMenu)) {
|
---|
2201 | if(dcd->cnremphasized) {
|
---|
2202 | WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPVOID,
|
---|
2203 | MPFROM2SHORT(FALSE,CRA_SOURCE));
|
---|
2204 | dcd->cnremphasized = TRUE;
|
---|
2205 | }
|
---|
2206 | MarkAll(hwnd,TRUE,FALSE,TRUE);
|
---|
2207 | }
|
---|
2208 | }
|
---|
2209 | }
|
---|
2210 | break;
|
---|
2211 |
|
---|
2212 | case CN_DROPHELP:
|
---|
2213 | if(mp2) {
|
---|
2214 |
|
---|
2215 | PDRAGINFO pDInfo;
|
---|
2216 | PCNRITEM pci;
|
---|
2217 | ULONG numitems;
|
---|
2218 | USHORT usOperation;
|
---|
2219 |
|
---|
2220 | pci = (PCNRITEM)((PCNRDRAGINFO)mp2)->pRecord;
|
---|
2221 | pDInfo = ((PCNRDRAGINFO)mp2)->pDragInfo;
|
---|
2222 | if(!DrgAccessDraginfo(pDInfo)) {
|
---|
2223 | General_Error(WinQueryAnchorBlock(hwnd),
|
---|
2224 | hwnd,
|
---|
2225 | __FILE__,
|
---|
2226 | __LINE__,
|
---|
2227 | "%s",
|
---|
2228 | GetPString(IDS_DROPERRORTEXT));
|
---|
2229 | break;
|
---|
2230 | }
|
---|
2231 | numitems = DrgQueryDragitemCount(pDInfo);
|
---|
2232 | usOperation = pDInfo->usOperation;
|
---|
2233 | DrgDeleteDraginfoStrHandles(pDInfo);
|
---|
2234 | DrgFreeDraginfo(pDInfo);
|
---|
2235 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
---|
2236 | hwnd,
|
---|
2237 | GetPString(IDS_DROPHELPHDRTEXT),
|
---|
2238 | GetPString(IDS_DROPHELPTEXT),
|
---|
2239 | numitems,
|
---|
2240 | &"s"[numitems == 1L],
|
---|
2241 | (pci) ? NullStr : GetPString(IDS_NOTEXT),
|
---|
2242 | (pci) ? NullStr : " ",
|
---|
2243 | (pci) ? pci->szFileName : NullStr,
|
---|
2244 | (pci) ? " " : NullStr,
|
---|
2245 | GetPString((usOperation == DO_COPY) ?
|
---|
2246 | IDS_COPYTEXT :
|
---|
2247 | (usOperation == DO_LINK) ?
|
---|
2248 | IDS_LINKTEXT : IDS_MOVETEXT));
|
---|
2249 | }
|
---|
2250 | return 0;
|
---|
2251 |
|
---|
2252 | case CN_DRAGLEAVE:
|
---|
2253 | if(mp2) {
|
---|
2254 |
|
---|
2255 | PDRAGINFO pDInfo;
|
---|
2256 |
|
---|
2257 | pDInfo = ((PCNRDRAGINFO)mp2)->pDragInfo;
|
---|
2258 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
---|
2259 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
2260 | }
|
---|
2261 | return 0;
|
---|
2262 |
|
---|
2263 | case CN_DRAGAFTER:
|
---|
2264 | case CN_DRAGOVER:
|
---|
2265 | if(mp2) {
|
---|
2266 |
|
---|
2267 | PDRAGITEM pDItem; /* Pointer to DRAGITEM */
|
---|
2268 | PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
|
---|
2269 | PCNRITEM pci;
|
---|
2270 | USHORT uso;
|
---|
2271 |
|
---|
2272 | pci = (PCNRITEM)((PCNRDRAGINFO)mp2)->pRecord;
|
---|
2273 | // if(SHORT1FROMMP(mp1) == CN_DRAGAFTER)
|
---|
2274 | // pci = NULL;
|
---|
2275 | pDInfo = ((PCNRDRAGINFO)mp2)->pDragInfo;
|
---|
2276 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
---|
2277 | if(pci) {
|
---|
2278 | if(pci->rc.flRecordAttr & CRA_SOURCE) {
|
---|
2279 | DrgFreeDraginfo(pDInfo);
|
---|
2280 | return(MRFROM2SHORT(DOR_NODROP,0));
|
---|
2281 | }
|
---|
2282 | uso = pDInfo->usOperation;
|
---|
2283 | if(uso == DO_DEFAULT)
|
---|
2284 | uso = (fCopyDefault) ? DO_COPY : DO_MOVE;
|
---|
2285 | if(!(pci->attrFile & FILE_DIRECTORY)) {
|
---|
2286 | if(uso != DO_LINK && uso != DO_MOVE &&
|
---|
2287 | uso != DO_COPY) {
|
---|
2288 | DrgFreeDraginfo(pDInfo);
|
---|
2289 | return MRFROM2SHORT(DOR_NODROP,0);
|
---|
2290 | }
|
---|
2291 | if(uso != DO_LINK &&
|
---|
2292 | !(driveflags[toupper(*pci->szFileName) - 'A'] &
|
---|
2293 | DRIVE_NOTWRITEABLE)) {
|
---|
2294 |
|
---|
2295 | ARC_TYPE *info = NULL;
|
---|
2296 |
|
---|
2297 | if(!fQuickArcFind &&
|
---|
2298 | !(driveflags[toupper(*pci->szFileName) - 'A'] &
|
---|
2299 | DRIVE_SLOW))
|
---|
2300 | info = find_type(pci->szFileName,NULL);
|
---|
2301 | else
|
---|
2302 | info = quick_find_type(pci->szFileName,NULL);
|
---|
2303 | if(!info || ((uso == DO_MOVE && !info->move) ||
|
---|
2304 | (uso == DO_COPY && !info->create))) {
|
---|
2305 | DrgFreeDraginfo(pDInfo);
|
---|
2306 | return MRFROM2SHORT(DOR_NODROP,0);
|
---|
2307 | }
|
---|
2308 | }
|
---|
2309 | }
|
---|
2310 | }
|
---|
2311 | pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
|
---|
2312 | 0); /* Index to DRAGITEM */
|
---|
2313 | if(DrgVerifyRMF(pDItem, /* Check valid rendering */
|
---|
2314 | DRM_OS2FILE, /* mechanisms and data */
|
---|
2315 | NULL)) {
|
---|
2316 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
2317 | if(pci) {
|
---|
2318 | if(driveflags[toupper(*pci->szFileName) - 'A'] &
|
---|
2319 | DRIVE_NOTWRITEABLE)
|
---|
2320 | return MRFROM2SHORT(DOR_DROP,DO_LINK);
|
---|
2321 | if(toupper(*pci->szFileName) < 'C')
|
---|
2322 | return MRFROM2SHORT(DOR_DROP,DO_COPY);
|
---|
2323 | return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
---|
2324 | ((fCopyDefault) ?
|
---|
2325 | DO_COPY :
|
---|
2326 | DO_MOVE));
|
---|
2327 | }
|
---|
2328 | else
|
---|
2329 | return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
---|
2330 | DO_COPY);
|
---|
2331 | }
|
---|
2332 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
2333 | }
|
---|
2334 | return(MRFROM2SHORT(DOR_NODROP,0)); /* Drop not valid */
|
---|
2335 |
|
---|
2336 | case CN_INITDRAG:
|
---|
2337 | if(mp2) {
|
---|
2338 |
|
---|
2339 | BOOL wasemphasized = FALSE;
|
---|
2340 | PCNRDRAGINIT pcd = (PCNRDRAGINIT)mp2;
|
---|
2341 | PCNRITEM pci;
|
---|
2342 |
|
---|
2343 | if(pcd) {
|
---|
2344 | pci = (PCNRITEM)pcd->pRecord;
|
---|
2345 | if(pci) {
|
---|
2346 | if(pci->rc.flRecordAttr & CRA_SELECTED)
|
---|
2347 | wasemphasized = TRUE;
|
---|
2348 | if(IsRoot(pci->szFileName))
|
---|
2349 | break;
|
---|
2350 | if(hwndStatus2)
|
---|
2351 | WinSetWindowText(hwndStatus2,
|
---|
2352 | GetPString(IDS_DRAGFILEOBJTEXT));
|
---|
2353 | if(DoFileDrag(hwnd,
|
---|
2354 | dcd->hwndObject,
|
---|
2355 | mp2,
|
---|
2356 | NULL,
|
---|
2357 | NULL,
|
---|
2358 | TRUE)) {
|
---|
2359 | if(fUnHilite && wasemphasized)
|
---|
2360 | UnHilite(hwnd,TRUE,&dcd->lastselection);
|
---|
2361 | }
|
---|
2362 | if(hwndStatus2)
|
---|
2363 | PostMsg(hwnd,UM_RESCAN,MPVOID,MPVOID);
|
---|
2364 | }
|
---|
2365 | }
|
---|
2366 | }
|
---|
2367 | return 0;
|
---|
2368 |
|
---|
2369 | case CN_DROP:
|
---|
2370 | if(mp2) {
|
---|
2371 |
|
---|
2372 | LISTINFO *li;
|
---|
2373 | ULONG action = UM_ACTION;
|
---|
2374 |
|
---|
2375 | li = DoFileDrop(hwnd,NULL,TRUE,mp1,mp2);
|
---|
2376 | if(li) {
|
---|
2377 | if(!*li->targetpath) {
|
---|
2378 | li->type = IDM_COLLECT;
|
---|
2379 | action = UM_COLLECT;
|
---|
2380 | }
|
---|
2381 | else {
|
---|
2382 | if(li->list && li->list[0] && IsRoot(li->list[0]))
|
---|
2383 | li->type = DO_LINK;
|
---|
2384 | else if(fDragndropDlg && (!*li->arcname || !li->info)) {
|
---|
2385 |
|
---|
2386 | CHECKLIST cl;
|
---|
2387 |
|
---|
2388 | memset(&cl,0,sizeof(cl));
|
---|
2389 | cl.size = sizeof(cl);
|
---|
2390 | cl.flags = li->type;
|
---|
2391 | cl.list = li->list;
|
---|
2392 | cl.cmd = li->type;
|
---|
2393 | cl.prompt = li->targetpath;
|
---|
2394 | li->type = WinDlgBox(HWND_DESKTOP,dcd->hwndParent,
|
---|
2395 | DropListProc,FM3ModHandle,
|
---|
2396 | DND_FRAME,MPFROMP(&cl));
|
---|
2397 | if(!li->type) {
|
---|
2398 | FreeListInfo(li);
|
---|
2399 | return 0;
|
---|
2400 | }
|
---|
2401 | li->list = cl.list;
|
---|
2402 | if(!li->list || !li->list[0]) {
|
---|
2403 | FreeListInfo(li);
|
---|
2404 | return 0;
|
---|
2405 | }
|
---|
2406 | }
|
---|
2407 | switch(li->type) {
|
---|
2408 | case DND_LAUNCH:
|
---|
2409 | strcat(li->targetpath," %a");
|
---|
2410 | ExecOnList(dcd->hwndParent,li->targetpath,
|
---|
2411 | PROMPT | WINDOWED,NULL,li->list,NULL);
|
---|
2412 | FreeList(li->list);
|
---|
2413 | li->list = NULL;
|
---|
2414 | break;
|
---|
2415 | case DO_LINK:
|
---|
2416 | if(fLinkSetsIcon) {
|
---|
2417 | li->type = IDM_SETICON;
|
---|
2418 | action = UM_MASSACTION;
|
---|
2419 | }
|
---|
2420 | else
|
---|
2421 | li->type = IDM_COMPARE;
|
---|
2422 | break;
|
---|
2423 | case DND_EXTRACT:
|
---|
2424 | if(*li->targetpath && !IsFile(li->targetpath))
|
---|
2425 | li->type = IDM_EXTRACT;
|
---|
2426 | break;
|
---|
2427 | case DND_MOVE:
|
---|
2428 | li->type = IDM_MOVE;
|
---|
2429 | if(*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
2430 | action = UM_MASSACTION;
|
---|
2431 | li->type = IDM_ARCHIVEM;
|
---|
2432 | }
|
---|
2433 | break;
|
---|
2434 | case DND_WILDMOVE:
|
---|
2435 | li->type = IDM_WILDMOVE;
|
---|
2436 | if(*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
2437 | action = UM_MASSACTION;
|
---|
2438 | li->type = IDM_ARCHIVEM;
|
---|
2439 | }
|
---|
2440 | break;
|
---|
2441 | case DND_OBJECT:
|
---|
2442 | li->type = IDM_OBJECT;
|
---|
2443 | action = UM_MASSACTION;
|
---|
2444 | break;
|
---|
2445 | case DND_SHADOW:
|
---|
2446 | li->type = IDM_SHADOW;
|
---|
2447 | action = UM_MASSACTION;
|
---|
2448 | break;
|
---|
2449 | case DND_COMPARE:
|
---|
2450 | li->type = IDM_COMPARE;
|
---|
2451 | break;
|
---|
2452 | case DND_SETICON:
|
---|
2453 | action = UM_MASSACTION;
|
---|
2454 | li->type = IDM_SETICON;
|
---|
2455 | break;
|
---|
2456 | case DND_WILDCOPY:
|
---|
2457 | li->type = IDM_WILDCOPY;
|
---|
2458 | if(*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
2459 | action = UM_MASSACTION;
|
---|
2460 | li->type = IDM_ARCHIVE;
|
---|
2461 | }
|
---|
2462 | break;
|
---|
2463 | case DND_COPY:
|
---|
2464 | li->type = IDM_COPY;
|
---|
2465 | if(*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
2466 | action = UM_MASSACTION;
|
---|
2467 | li->type = IDM_ARCHIVE;
|
---|
2468 | }
|
---|
2469 | break;
|
---|
2470 | default:
|
---|
2471 | if(*li->arcname && li->info) {
|
---|
2472 | action = UM_MASSACTION;
|
---|
2473 | li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
|
---|
2474 | }
|
---|
2475 | else if(*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
2476 | action = UM_MASSACTION;
|
---|
2477 | li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
|
---|
2478 | }
|
---|
2479 | else
|
---|
2480 | li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
|
---|
2481 | break;
|
---|
2482 | }
|
---|
2483 | }
|
---|
2484 | if(!li->list || !li->list[0])
|
---|
2485 | FreeListInfo(li);
|
---|
2486 | else if(!PostMsg(dcd->hwndObject,action,MPFROMP(li),MPVOID))
|
---|
2487 | FreeListInfo(li);
|
---|
2488 | else {
|
---|
2489 |
|
---|
2490 | USHORT usop = 0;
|
---|
2491 |
|
---|
2492 | switch(li->type) {
|
---|
2493 | case IDM_COPY:
|
---|
2494 | case IDM_WILDCOPY:
|
---|
2495 | usop = DO_COPY;
|
---|
2496 | break;
|
---|
2497 | case IDM_MOVE:
|
---|
2498 | case IDM_WILDMOVE:
|
---|
2499 | case IDM_ARCHIVEM:
|
---|
2500 | usop = DO_MOVE;
|
---|
2501 | break;
|
---|
2502 | }
|
---|
2503 | if(usop)
|
---|
2504 | return MRFROM2SHORT(DOR_DROP,usop);
|
---|
2505 | }
|
---|
2506 | }
|
---|
2507 | }
|
---|
2508 | return 0;
|
---|
2509 |
|
---|
2510 | case CN_BEGINEDIT:
|
---|
2511 | case CN_REALLOCPSZ:
|
---|
2512 | case CN_ENDEDIT:
|
---|
2513 | {
|
---|
2514 | MRESULT mre;
|
---|
2515 |
|
---|
2516 | mre = CnrDirectEdit(hwnd,msg,mp1,mp2);
|
---|
2517 | if(mre != (MRESULT)-1)
|
---|
2518 | return mre;
|
---|
2519 | }
|
---|
2520 | break;
|
---|
2521 |
|
---|
2522 | case CN_EMPHASIS:
|
---|
2523 | if(mp2) {
|
---|
2524 |
|
---|
2525 | PNOTIFYRECORDEMPHASIS pre = mp2;
|
---|
2526 | PCNRITEM pci;
|
---|
2527 | CHAR s[CCHMAXPATH + 91],tb[81],tf[81],*p;
|
---|
2528 |
|
---|
2529 | pci = (PCNRITEM)((pre) ? pre->pRecord : NULL);
|
---|
2530 | if(!pci) {
|
---|
2531 | if(hwndStatus2)
|
---|
2532 | WinSetWindowText(hwndStatus2,NullStr);
|
---|
2533 | if(fMoreButtons) {
|
---|
2534 | WinSetWindowText(hwndName,NullStr);
|
---|
2535 | WinSetWindowText(hwndDate,NullStr);
|
---|
2536 | WinSetWindowText(hwndAttr,NullStr);
|
---|
2537 | }
|
---|
2538 | if(hwndMain)
|
---|
2539 | WinSendMsg(hwndMain,UM_LOADFILE,MPVOID,MPVOID);
|
---|
2540 | break;
|
---|
2541 | }
|
---|
2542 | if(pre->fEmphasisMask & CRA_SELECTED) {
|
---|
2543 | if(pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
2544 | dcd->selectedbytes += (pci->cbFile + pci->easize);
|
---|
2545 | dcd->selectedfiles++;
|
---|
2546 | }
|
---|
2547 | else if(dcd->selectedfiles) {
|
---|
2548 | dcd->selectedbytes -= (pci->cbFile + pci->easize);
|
---|
2549 | dcd->selectedfiles--;
|
---|
2550 | }
|
---|
2551 | if(!dcd->suspendview) {
|
---|
2552 | commafmt(tf,sizeof(tf),dcd->selectedfiles);
|
---|
2553 | if(dcd->selectedbytes > 1024)
|
---|
2554 | commafmt(tb,sizeof(tb),dcd->selectedbytes / 1024L);
|
---|
2555 | else
|
---|
2556 | commafmt(tb,sizeof(tb),dcd->selectedbytes);
|
---|
2557 | sprintf(s,"%s / %s%s",tf,tb,
|
---|
2558 | (dcd->selectedbytes > 1024) ? "k" : "b");
|
---|
2559 | WinSetDlgItemText(dcd->hwndClient,DIR_SELECTED,s);
|
---|
2560 | }
|
---|
2561 | }
|
---|
2562 | else if(!dcd->suspendview &&
|
---|
2563 | WinQueryActiveWindow(dcd->hwndParent) ==
|
---|
2564 | dcd->hwndFrame) {
|
---|
2565 | if(pre->fEmphasisMask & CRA_CURSORED) {
|
---|
2566 | if(pci->rc.flRecordAttr & CRA_CURSORED) {
|
---|
2567 | if(fSplitStatus && hwndStatus2) {
|
---|
2568 | if(pci->attrFile & FILE_DIRECTORY)
|
---|
2569 | p = pci->pszFileName;
|
---|
2570 | else {
|
---|
2571 | p = strrchr(pci->szFileName,'\\');
|
---|
2572 | if(p) {
|
---|
2573 | if(*(p + 1))
|
---|
2574 | p++;
|
---|
2575 | else
|
---|
2576 | p = pci->pszFileName;
|
---|
2577 | }
|
---|
2578 | else
|
---|
2579 | p = pci->pszFileName;
|
---|
2580 | }
|
---|
2581 | commafmt(tb,sizeof(tb),pci->cbFile + pci->easize);
|
---|
2582 | if(!fMoreButtons)
|
---|
2583 | sprintf(s," %sb %04u/%02u/%02u %02u:%02u:%02u [%s] %s",
|
---|
2584 | tb,pci->date.year,
|
---|
2585 | pci->date.month,pci->date.day,pci->time.hours,
|
---|
2586 | pci->time.minutes,pci->time.seconds,
|
---|
2587 | pci->pszDispAttr,p);
|
---|
2588 | else {
|
---|
2589 | *tf = 0;
|
---|
2590 | if(pci->cbFile + pci->easize > 1024)
|
---|
2591 | commafmt(tf,sizeof(tf),
|
---|
2592 | (pci->cbFile + pci->easize) / 1024);
|
---|
2593 | sprintf(s,GetPString(IDS_STATUSSIZETEXT),
|
---|
2594 | tb,
|
---|
2595 | (*tf) ? " (" : NullStr,
|
---|
2596 | tf,
|
---|
2597 | (*tf) ? "k)" : NullStr);
|
---|
2598 | }
|
---|
2599 | WinSetWindowText(hwndStatus2,s);
|
---|
2600 | }
|
---|
2601 | if(fMoreButtons) {
|
---|
2602 | WinSetWindowText(hwndName,pci->pszFileName);
|
---|
2603 | sprintf(s,"%04u/%02u/%02u %02u:%02u:%02u",
|
---|
2604 | pci->date.year,pci->date.month,
|
---|
2605 | pci->date.day,pci->time.hours,pci->time.minutes,
|
---|
2606 | pci->time.seconds);
|
---|
2607 | WinSetWindowText(hwndDate,s);
|
---|
2608 | WinSetWindowText(hwndAttr,pci->pszDispAttr);
|
---|
2609 | }
|
---|
2610 | }
|
---|
2611 | }
|
---|
2612 | }
|
---|
2613 | if(!dcd->suspendview && hwndMain &&
|
---|
2614 | (pre->fEmphasisMask & CRA_CURSORED) &&
|
---|
2615 | (pci->rc.flRecordAttr & CRA_CURSORED) &&
|
---|
2616 | WinQueryActiveWindow(dcd->hwndParent) ==dcd->hwndFrame)
|
---|
2617 | WinSendMsg(hwndMain,UM_LOADFILE,
|
---|
2618 | MPFROMP(((fComments || (pci->attrFile & FILE_DIRECTORY) == 0) ?
|
---|
2619 | pci->szFileName : NULL)),MPVOID);
|
---|
2620 | }
|
---|
2621 | break;
|
---|
2622 |
|
---|
2623 | case CN_ENTER:
|
---|
2624 | if(mp2) {
|
---|
2625 |
|
---|
2626 | PCNRITEM pci = (PCNRITEM)((PNOTIFYRECORDENTER)mp2)->pRecord;
|
---|
2627 | FILEFINDBUF3 ffb;
|
---|
2628 | HDIR hDir = HDIR_CREATE;
|
---|
2629 | ULONG nm = 1L;
|
---|
2630 | APIRET status = 0;
|
---|
2631 |
|
---|
2632 | SetShiftState();
|
---|
2633 | if(pci) {
|
---|
2634 | if(pci->rc.flRecordAttr & CRA_INUSE)
|
---|
2635 | break;
|
---|
2636 | DosError(FERR_DISABLEHARDERR);
|
---|
2637 | status = DosFindFirst(pci->szFileName,&hDir,
|
---|
2638 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
2639 | FILE_ARCHIVED | FILE_READONLY |
|
---|
2640 | FILE_HIDDEN | FILE_SYSTEM,
|
---|
2641 | &ffb,sizeof(ffb),&nm,
|
---|
2642 | FIL_STANDARD);
|
---|
2643 | priority_bumped();
|
---|
2644 | if(!status) {
|
---|
2645 | DosFindClose(hDir);
|
---|
2646 | if(ffb.attrFile & FILE_DIRECTORY) {
|
---|
2647 | if((shiftstate & (KC_CTRL | KC_ALT)) ==
|
---|
2648 | (KC_CTRL | KC_ALT))
|
---|
2649 | PostMsg(hwnd,WM_COMMAND,MPFROM2SHORT(IDM_SHOWALLFILES,0),
|
---|
2650 | MPVOID);
|
---|
2651 | else if((shiftstate & (KC_CTRL | KC_SHIFT)) ==
|
---|
2652 | (KC_CTRL | KC_SHIFT))
|
---|
2653 | OpenObject(pci->szFileName,Settings,dcd->hwndFrame);
|
---|
2654 | else if(shiftstate & KC_CTRL)
|
---|
2655 | OpenObject(pci->szFileName,Default,dcd->hwndFrame);
|
---|
2656 | else
|
---|
2657 | OpenDirCnr((HWND)0,
|
---|
2658 | hwndMain,
|
---|
2659 | dcd->hwndFrame,
|
---|
2660 | FALSE,
|
---|
2661 | pci->szFileName);
|
---|
2662 | }
|
---|
2663 | else {
|
---|
2664 |
|
---|
2665 | SWP swp;
|
---|
2666 |
|
---|
2667 | WinSendMsg(hwnd,
|
---|
2668 | CM_SETRECORDEMPHASIS,
|
---|
2669 | MPFROMP(pci),
|
---|
2670 | MPFROM2SHORT(TRUE,CRA_INUSE));
|
---|
2671 | WinQueryWindowPos(dcd->hwndFrame,&swp);
|
---|
2672 | DefaultViewKeys(hwnd,
|
---|
2673 | dcd->hwndFrame,
|
---|
2674 | dcd->hwndParent,
|
---|
2675 | &swp,
|
---|
2676 | pci->szFileName);
|
---|
2677 | WinSendMsg(hwnd,
|
---|
2678 | CM_SETRECORDEMPHASIS,
|
---|
2679 | MPFROMP(pci),
|
---|
2680 | MPFROM2SHORT(FALSE,CRA_INUSE |
|
---|
2681 | ((fUnHilite) ? CRA_SELECTED : 0)));
|
---|
2682 | }
|
---|
2683 | }
|
---|
2684 | else
|
---|
2685 | WinSendMsg(hwnd,
|
---|
2686 | CM_REMOVERECORD,
|
---|
2687 | MPFROMP(&pci),
|
---|
2688 | MPFROM2SHORT(1,
|
---|
2689 | CMA_FREE | CMA_INVALIDATE | CMA_ERASE));
|
---|
2690 | }
|
---|
2691 | }
|
---|
2692 | break;
|
---|
2693 | }
|
---|
2694 | }
|
---|
2695 | return 0;
|
---|
2696 |
|
---|
2697 | case UM_LOADFILE:
|
---|
2698 | if(dcd && mp2) {
|
---|
2699 |
|
---|
2700 | HWND ret;
|
---|
2701 |
|
---|
2702 | ret = StartMLEEditor(dcd->hwndParent,
|
---|
2703 | (INT)mp1,
|
---|
2704 | (CHAR *)mp2,
|
---|
2705 | dcd->hwndFrame);
|
---|
2706 | if(mp2)
|
---|
2707 | free((CHAR *)mp2);
|
---|
2708 | return MRFROMLONG(ret);
|
---|
2709 | }
|
---|
2710 | return 0;
|
---|
2711 |
|
---|
2712 | case UM_CLOSE:
|
---|
2713 | WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
2714 | QW_PARENT));
|
---|
2715 | return 0;
|
---|
2716 |
|
---|
2717 | case UM_FOLDUP:
|
---|
2718 | if(!PostMsg((HWND)0,WM_QUIT,MPVOID,MPVOID))
|
---|
2719 | DosExit(EXIT_PROCESS,1);
|
---|
2720 | return 0;
|
---|
2721 |
|
---|
2722 | case WM_CLOSE:
|
---|
2723 | if(dcd) {
|
---|
2724 | dcd->namecanchange = TRUE;
|
---|
2725 | dcd->stopflag = 1;
|
---|
2726 | if(dcd->amextracted)
|
---|
2727 | return 0;
|
---|
2728 | }
|
---|
2729 | WinSendMsg(hwnd,WM_SAVEAPPLICATION,MPVOID,MPVOID);
|
---|
2730 | if(dcd) {
|
---|
2731 | if(!dcd->dontclose && ParentIsDesktop(hwnd,dcd->hwndParent))
|
---|
2732 | PostMsg(hwnd,UM_FOLDUP,MPVOID,MPVOID);
|
---|
2733 | if(dcd->hwndObject) {
|
---|
2734 | DosSleep(64L);
|
---|
2735 | if(!PostMsg(dcd->hwndObject,WM_CLOSE,MPVOID,MPVOID))
|
---|
2736 | WinSendMsg(dcd->hwndObject,WM_CLOSE,MPVOID,MPVOID);
|
---|
2737 | }
|
---|
2738 | }
|
---|
2739 | else
|
---|
2740 | WinSendMsg(hwnd,UM_CLOSE,MPVOID,MPVOID);
|
---|
2741 | return 0;
|
---|
2742 |
|
---|
2743 | case WM_DESTROY:
|
---|
2744 | if(CollectorDirMenu)
|
---|
2745 | WinDestroyWindow(CollectorDirMenu);
|
---|
2746 | if(CollectorFileMenu)
|
---|
2747 | WinDestroyWindow(CollectorFileMenu);
|
---|
2748 | if(CollectorCnrMenu)
|
---|
2749 | WinDestroyWindow(CollectorCnrMenu);
|
---|
2750 | CollectorCnrMenu = CollectorFileMenu = CollectorDirMenu = (HWND)0;
|
---|
2751 | Collector = (HWND)0;
|
---|
2752 | EmptyCnr(hwnd);
|
---|
2753 | break;
|
---|
2754 | }
|
---|
2755 | return (dcd && dcd->oldproc) ? dcd->oldproc(hwnd,msg,mp1,mp2) :
|
---|
2756 | PFNWPCnr(hwnd,msg,mp1,mp2);
|
---|
2757 | }
|
---|
2758 |
|
---|
2759 |
|
---|
2760 | HWND StartCollector (HWND hwndParent,INT flags) {
|
---|
2761 |
|
---|
2762 | HWND hwndFrame = (HWND)0,hwndClient;
|
---|
2763 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
|
---|
2764 | FCF_SIZEBORDER | FCF_MINMAX |
|
---|
2765 | FCF_ICON | FCF_NOBYTEALIGN |
|
---|
2766 | FCF_ACCELTABLE;
|
---|
2767 | USHORT id;
|
---|
2768 | static USHORT idinc = 0;
|
---|
2769 | DIRCNRDATA *dcd;
|
---|
2770 |
|
---|
2771 | if(ParentIsDesktop(hwndParent,hwndParent))
|
---|
2772 | FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION | FCF_MENU);
|
---|
2773 | if(Collector) {
|
---|
2774 | WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
|
---|
2775 | QW_PARENT),
|
---|
2776 | QW_PARENT),
|
---|
2777 | HWND_TOP,
|
---|
2778 | 0,
|
---|
2779 | 0,
|
---|
2780 | 0,
|
---|
2781 | 0,
|
---|
2782 | SWP_SHOW | SWP_RESTORE);
|
---|
2783 | return WinQueryWindow(WinQueryWindow(Collector,
|
---|
2784 | QW_PARENT),
|
---|
2785 | QW_PARENT);
|
---|
2786 | }
|
---|
2787 | hwndFrame = WinCreateStdWindow(hwndParent,
|
---|
2788 | WS_VISIBLE,
|
---|
2789 | &FrameFlags,
|
---|
2790 | GetPString(IDS_WCCOLLECTOR),
|
---|
2791 | NULL,
|
---|
2792 | WS_VISIBLE | fwsAnimate,
|
---|
2793 | FM3ModHandle,
|
---|
2794 | COLLECTOR_FRAME,
|
---|
2795 | &hwndClient);
|
---|
2796 | if(hwndFrame && hwndClient) {
|
---|
2797 | id = COLLECTOR_FRAME + idinc++;
|
---|
2798 | WinSetWindowUShort(hwndFrame,QWS_ID,id);
|
---|
2799 | dcd = malloc(sizeof(DIRCNRDATA));
|
---|
2800 | if(dcd) {
|
---|
2801 | memset(dcd,0,sizeof(DIRCNRDATA));
|
---|
2802 | dcd->size = sizeof(DIRCNRDATA);
|
---|
2803 | dcd->id = id;
|
---|
2804 | dcd->type = COLLECTOR_FRAME;
|
---|
2805 | dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
|
---|
2806 | dcd->hwndFrame = hwndFrame;
|
---|
2807 | dcd->hwndClient = hwndClient;
|
---|
2808 | if(flags & 4)
|
---|
2809 | dcd->dontclose = TRUE;
|
---|
2810 | {
|
---|
2811 | PFNWP oldproc;
|
---|
2812 |
|
---|
2813 | oldproc = WinSubclassWindow(hwndFrame,
|
---|
2814 | (PFNWP)CollectorFrameWndProc);
|
---|
2815 | WinSetWindowPtr(hwndFrame,
|
---|
2816 | 0,
|
---|
2817 | (PVOID)oldproc);
|
---|
2818 | }
|
---|
2819 | dcd->hwndCnr = WinCreateWindow(hwndClient,
|
---|
2820 | WC_CONTAINER,
|
---|
2821 | NULL,
|
---|
2822 | CCS_AUTOPOSITION | CCS_MINIICONS |
|
---|
2823 | CCS_MINIRECORDCORE | ulCnrType |
|
---|
2824 | WS_VISIBLE,
|
---|
2825 | 0,
|
---|
2826 | 0,
|
---|
2827 | 0,
|
---|
2828 | 0,
|
---|
2829 | hwndClient,
|
---|
2830 | HWND_TOP,
|
---|
2831 | (ULONG)COLLECTOR_CNR,
|
---|
2832 | NULL,
|
---|
2833 | NULL);
|
---|
2834 | if(dcd->hwndCnr) {
|
---|
2835 | Collector = dcd->hwndCnr;
|
---|
2836 | WinSetWindowPtr(dcd->hwndCnr,0,(PVOID)dcd);
|
---|
2837 | WinSetWindowText(hwndFrame,
|
---|
2838 | GetPString(IDS_COLLECTORTITLETEXT));
|
---|
2839 | if(FrameFlags & FCF_MENU) {
|
---|
2840 | if(!fToolbar) {
|
---|
2841 |
|
---|
2842 | HWND hwndMenu = WinWindowFromID(hwndFrame,FID_MENU);
|
---|
2843 |
|
---|
2844 | if(hwndMenu) {
|
---|
2845 | WinSendMsg(hwndMenu,
|
---|
2846 | MM_DELETEITEM,
|
---|
2847 | MPFROM2SHORT(IDM_SEEALL,FALSE),
|
---|
2848 | MPVOID);
|
---|
2849 | WinSendMsg(hwndMenu,
|
---|
2850 | MM_DELETEITEM,
|
---|
2851 | MPFROM2SHORT(IDM_GREP,FALSE),
|
---|
2852 | MPVOID);
|
---|
2853 | WinSendMsg(hwndMenu,
|
---|
2854 | MM_DELETEITEM,
|
---|
2855 | MPFROM2SHORT(IDM_CLEARCNR,FALSE),
|
---|
2856 | MPVOID);
|
---|
2857 | WinSendMsg(hwndMenu,
|
---|
2858 | MM_DELETEITEM,
|
---|
2859 | MPFROM2SHORT(IDM_REMOVE,FALSE),
|
---|
2860 | MPVOID);
|
---|
2861 | }
|
---|
2862 | }
|
---|
2863 | }
|
---|
2864 | dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
|
---|
2865 | (PFNWP)CollectorCnrWndProc);
|
---|
2866 | {
|
---|
2867 | USHORT ids[] = {DIR_TOTALS,DIR_SELECTED,DIR_VIEW,DIR_SORT,
|
---|
2868 | DIR_FILTER,0};
|
---|
2869 |
|
---|
2870 | CommonCreateTextChildren(dcd->hwndClient,
|
---|
2871 | GetPString(IDS_WCCOLSTATUS),
|
---|
2872 | ids);
|
---|
2873 | }
|
---|
2874 | if(FrameFlags & FCF_SHELLPOSITION)
|
---|
2875 | PostMsg(hwndClient,
|
---|
2876 | UM_SIZE,
|
---|
2877 | MPVOID,
|
---|
2878 | MPVOID);
|
---|
2879 | if(!PostMsg(dcd->hwndCnr,
|
---|
2880 | UM_SETUP,
|
---|
2881 | MPVOID,
|
---|
2882 | MPVOID))
|
---|
2883 | WinSendMsg(dcd->hwndCnr,
|
---|
2884 | UM_SETUP,
|
---|
2885 | MPVOID,
|
---|
2886 | MPVOID);
|
---|
2887 | }
|
---|
2888 | else {
|
---|
2889 | PostMsg(hwndClient,
|
---|
2890 | WM_CLOSE,
|
---|
2891 | MPVOID,
|
---|
2892 | MPVOID);
|
---|
2893 | free(dcd);
|
---|
2894 | hwndFrame = (HWND)0;
|
---|
2895 | }
|
---|
2896 | }
|
---|
2897 | else {
|
---|
2898 | PostMsg(hwndClient,
|
---|
2899 | WM_CLOSE,
|
---|
2900 | MPVOID,
|
---|
2901 | MPVOID);
|
---|
2902 | hwndFrame = (HWND)0;
|
---|
2903 | }
|
---|
2904 | }
|
---|
2905 | return hwndFrame;
|
---|
2906 | }
|
---|
2907 |
|
---|