source: trunk/dll/dircnrs.c@ 1402

Last change on this file since 1402 was 1402, checked in by Gregg Young, 16 years ago

Remove variable aurgs from docopy & unlinkf (not used); Move more strings to PCSZs and string table; Move PCSZs to compile time initialization; Fix hang on startup caused by a drive scan and a dircnr scan trying to update a drive in the tree at the same time (related to the "treeswitch options); Code cleanup mainly removal of old printfs, SayMsgs, DbgMsg and unneeded %s.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 100.9 KB
RevLine 
[1335]1
[36]2/***********************************************************************
3
4 $Id: dircnrs.c 1402 2009-03-14 17:17:59Z gyoung $
5
6 Directory containers
7
8 Copyright (c) 1993-98 M. Kimes
[1394]9 Copyright (c) 2001, 2009 Steven H. Levine
[36]10
[130]11 16 Oct 02 SHL Handle large partitions
12 01 Aug 04 SHL Rework lstrip/rstrip usage
13 23 May 05 SHL Use QWL_USER
[145]14 24 May 05 SHL Rework Win_Error usage
[150]15 25 May 05 SHL Use ULONGLONG and CommaFmtULL
[171]16 26 May 05 SHL More large file formatting updates
[186]17 05 Jun 05 SHL Use QWL_USER
[275]18 10 Nov 05 SHL Comments
[358]19 13 Jul 06 SHL Use Runtime_Error
[369]20 26 Jul 06 SHL Use chop_at_crnl
[449]21 15 Aug 06 SHL Rework warning message text
[552]22 07 Jan 07 GKY Move error strings etc. to string file
[593]23 30 Mar 07 GKY Remove GetPString for window class names
[603]24 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
25 06 Apr 07 GKY Add some error checking in drag/drop
[618]26 19 Apr 07 SHL Use FreeDragInfoData. Add more drag/drop error checking.
[672]27 12 May 07 SHL Use dcd->ulItemsToUnHilite; sync with UnHilite arg mods
[688]28 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
[751]29 02 Aug 07 SHL Sync with CNRITEM mods
[775]30 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
[793]31 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
[814]32 26 Aug 07 GKY DosSleep(1) in loops changed to (0)
[872]33 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
[917]34 10 Jan 08 SHL Sync with CfgDlgProc mods
[972]35 19 Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
[953]36 15 Feb 08 SHL Sync with settings menu rework
[972]37 22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file.
[1016]38 11 May 08 GKY Avoid using stale dcd after free
39 11 May 08 SHL Add stale dcd sanity checks
[1028]40 21 Jun 08 GKY Fix columns to honor preferences on new container open.
[1029]41 22 Jun 08 GKY Included free_... functions for fortify checking
[1041]42 06 Jul 08 GKY Update delete/undelete to include move to and open XWP trashcan
[1065]43 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
[1077]44 all the details view settings (both the global variables and those in the
45 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
[1084]46 20 Jul 08 GKY Add save/append filename to clipboard.
[1335]47 Change menu wording to make these easier to find
[1102]48 02 Aug 08 GKY Always pass temp variable point to treecnr UM_SHOWME to avoid
[1335]49 freeing dcd->directory early
[1120]50 25 Aug 08 GKY Check TMP directory space warn if lee than 5 MiB prevent archiver from opening if
[1335]51 less than 10 KiB (It hangs and can't be closed)
[1303]52 29 Nov 08 GKY Remove or replace with a mutex semaphore DosEnterCriSec where appropriate.
[1335]53 10 Dec 08 SHL Integrate exception handler support
[1357]54 26 Dec 08 GKY Fixed DROPHELP to check for copy as default is action is DO_DEFAULT
[1375]55 01 Jan 09 GKY Add Seek and Scan to drives & directory context menus pass drive/dir as search root
[1395]56 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
57 07 Feb 09 GKY Move repeated strings to PCSZs.
58 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
59 07 Feb 09 GKY Add *DateFormat functions to format dates based on locale
[1400]60 08 Mar 09 GKY Renamed commafmt.h i18nutil.h
61 08 Mar 09 GKY Additional strings move to PCSZs in init.c
[1402]62 14 Mar 09 GKY Prevent execution of UM_SHOWME while drive scan is occuring
[36]63
64***********************************************************************/
65
[907]66#include <stdlib.h>
67#include <string.h>
68#include <ctype.h>
69#include <limits.h>
[1335]70// #include <process.h> // _beginthread
[907]71
[2]72#define INCL_DOS
73#define INCL_WIN
74#define INCL_DOSERRORS
[150]75#define INCL_LONGLONG
[1041]76#define INCL_WINWORKPLACE
[2]77
[1177]78#include "fm3dll.h"
[1222]79#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
[1206]80#include "mainwnd2.h" // Data declaration(s)
81#include "grep.h" // Data declaration(s)
82#include "info.h" // Data declaration(s)
83#include "treecnr.h" // Data declaration(s)
84#include "dircnrs.h" // Data declaration(s)
85#include "init.h" // Data declaration(s)
[2]86#include "fm3dlg.h"
87#include "fm3str.h"
88#include "mle.h"
[907]89#include "arccnrs.h" // StartArcCnr
90#include "comp.h" // COMPARE
91#include "filldir.h" // EmptyCnr...
92#include "errutil.h" // Dos_Error...
93#include "strutil.h" // GetPString
[953]94#include "notebook.h" // CfgDlgProc
[1016]95#include "command.h" // RunCommand
[1335]96#include "worker.h" // Action, MassAction
[1156]97#include "misc.h" // GetTidForThread, AdjustCnrColsForFSType, AdjustCnrColsForPref
[1335]98 // AdjustDetailsSwitches, CnrDirectEdit, OpenEdit, QuickPopup
99 // SayFilter, SaySort, SayView, SetCnrCols, SetDetailsSwitches
100 // SetSortChecks, SetViewMenu, SwitchCommand, CheckMenu
101 // CurrentRecord, DrawTargetEmphasis, IsFm2Window
[1156]102#include "chklist.h" // CenterOverWindow, DropListProc
103#include "common.h" // CommonCnrProc, CommonCreateTextChildren, CommonFrameWndProc
[1335]104 // CommonTextPaint, CommonTextButton, CommonTextProc
[1177]105#include "mainwnd.h" // CountDirCnrs, GetNextWindowPos, MakeBubble, TopWindow
[1156]106#include "select.h" // DeselectAll, HideAll, InvertAll, SelectAll, SelectList
[1335]107 // SpecialSelect2
[1156]108#include "dirsize.h" // DirSizeProc
109#include "flesh.h" // Flesh, Stubby, UnFlesh
110#include "valid.h" // IsValidDir
111#include "objwin.h" // MakeObjWin
112#include "notify.h" // NotifyError
113#include "objcnr.h" // ObjCnrDlgProc
[1177]114#include "draglist.h" // DoFileDrag, FreeDragInfoData, PickUp
[1156]115#include "saveclip.h" // SaveListDlgProc
116#include "findrec.h" // ShowCnrRecord
117#include "sortcnr.h" // SortDirCnr
118#include "seeall.h" // StartSeeAll
119#include "update.h" // UpdateCnrList, UpdateCnrRecord
120#include "walkem.h" // add_udir
121#include "strips.h" // chop_at_crnl
[1177]122#include "droplist.h" // AcceptOneDrop, CheckPmDrgLimit, DropHelp, GetOneDrop
123#include "presparm.h" // CopyPresParams
124#include "defview.h" // DefaultViewKeys
125#include "systemf.h" // ExecOnList
126#include "filter.h" // Filter
127#include "findrec.h" // FindCnrRecord
128#include "input.h" // InputDlgProc
129#include "shadow.h" // OpenObject
130#include "mkdir.h" // PMMkDir
131#include "collect.h" // StartCollector
132#include "viewer.h" // StartMLEEditor
133#include "newview.h" // StartViewer
134#include "undel.h" // UndeleteDlgProc
[1400]135#include "i18nutil.h" // commafmt
[1177]136#include "getnames.h" // insert_filename
137#include "wrappers.h" // xfree
[1012]138#include "fortify.h"
[1335]139#include "excputil.h" // 06 May 08 SHL added
[2]140
[1206]141// Data definitions
142#pragma data_seg(GLOBAL1)
143HWND DirCnrMenu;
144HWND hwndAttr;
145HWND hwndDate;
146
147#pragma data_seg(GLOBAL2)
148INT sortFlags;
149
[2]150#pragma data_seg(DATA1)
151
[358]152static PSZ pszSrcFile = __FILE__;
[2]153
[551]154MRESULT EXPENTRY DirFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[275]155{
[551]156 return CommonFrameWndProc(DIR_CNR, hwnd, msg, mp1, mp2);
[2]157}
158
[551]159MRESULT EXPENTRY DirTextProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[275]160{
[551]161 static BOOL emphasized = FALSE;
162 static HWND hwndButtonPopup = (HWND) 0;
163 static USHORT lastid = 0;
164 static ULONG timestamp = ULONG_MAX;
[2]165
[551]166 switch (msg) {
167 case WM_CREATE:
168 return CommonTextProc(hwnd, msg, mp1, mp2);
[2]169
[551]170 case WM_COMMAND:
171 {
172 DIRCNRDATA *dcd;
173 MRESULT mr;
[2]174
[551]175 mr = WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,
176 QW_PARENT),
177 DIR_CNR), msg, mp1, mp2);
178 if (hwndButtonPopup &&
179 SHORT1FROMMP(mp1) > IDM_DETAILSTITLES &&
180 SHORT1FROMMP(mp1) < IDM_DETAILSSETUP) {
181 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
182 QW_PARENT),
183 DIR_CNR), QWL_USER);
184 if (dcd)
[1065]185 SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
[2]186 }
[551]187 return mr;
188 }
[2]189
[551]190 case UM_CONTEXTMENU:
191 case WM_CONTEXTMENU:
192 {
193 USHORT id;
[2]194
[551]195 id = WinQueryWindowUShort(hwnd, QWS_ID);
196 switch (id) {
197 case DIR_FOLDERICON:
198 if (fNoFoldMenu) {
199 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
200 DIR_CNR),
201 WM_COMMAND, MPFROM2SHORT(IDM_PREVIOUS, 0), mp2);
202 break;
203 }
204 /* else intentional fallthru */
205 case DIR_SELECTED:
206 case DIR_VIEW:
207 case DIR_SORT:
208 {
209 POINTL ptl = { 0, 0 };
210 SWP swp;
211 DIRCNRDATA *dcd;
[2]212
[551]213 if (hwndButtonPopup)
214 WinDestroyWindow(hwndButtonPopup);
215 if (id == DIR_SELECTED && msg == WM_CONTEXTMENU)
216 id = DIR_MAX;
217 if (id == lastid) {
[2]218
[551]219 ULONG check;
[2]220
[551]221 DosQuerySysInfo(QSV_MS_COUNT,
222 QSV_MS_COUNT, &check, sizeof(check));
223 if (check < timestamp + 500) {
224 lastid = 0;
225 goto MenuAbort;
226 }
227 }
[907]228 hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
229 CopyPresParams(hwndButtonPopup, hwnd);
[551]230 if (hwndButtonPopup) {
231 WinSetWindowUShort(hwndButtonPopup, QWS_ID, id);
232 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
233 QW_PARENT),
234 DIR_CNR), QWL_USER);
235 if (id == DIR_SORT) { /* don't have sort pathname in dirs */
236 WinSendMsg(hwndButtonPopup,
237 MM_DELETEITEM,
238 MPFROM2SHORT(IDM_SORTNAME, FALSE), MPVOID);
239 WinSendMsg(hwndButtonPopup,
240 MM_DELETEITEM,
241 MPFROM2SHORT(IDM_SORTNONE, FALSE), MPVOID);
242 if (dcd)
243 SetSortChecks(hwndButtonPopup, dcd->sortFlags);
244 }
245 else if (id == DIR_VIEW) {
246 if (dcd) {
247 SetViewMenu(hwndButtonPopup, dcd->flWindowAttr);
[1065]248 SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
[551]249 }
250 }
251 else if (id == DIR_MAX) {
[2]252
[551]253 int x;
254 BOOL enable;
255 USHORT ids[] = { IDM_SELECTBOTH,
256 IDM_SELECTMORE,
257 IDM_SELECTONE,
258 IDM_SELECTNEWER,
259 IDM_SELECTOLDER,
260 IDM_SELECTBIGGER,
261 IDM_SELECTSMALLER,
262 IDM_DESELECTBOTH,
263 IDM_DESELECTMORE,
264 IDM_DESELECTONE,
265 IDM_DESELECTNEWER,
266 IDM_DESELECTOLDER,
267 IDM_DESELECTBIGGER,
268 IDM_DESELECTSMALLER,
269 0
270 };
[2]271
[551]272 enable = (CountDirCnrs(dcd->hwndParent) > 1);
273 for (x = 0; ids[x]; x++)
274 WinEnableMenuItem(hwndButtonPopup, ids[x], enable);
275 }
276 else if (id == DIR_SELECTED) {
277 if (dcd)
278 WinEnableMenuItem(hwndButtonPopup,
279 IDM_RESELECT, (dcd->lastselection != NULL));
280 }
281 ptl.x = 0;
282 if (WinPopupMenu(HWND_OBJECT,
283 HWND_OBJECT,
284 hwndButtonPopup, -32767, -32767, 0, 0)) {
285 WinQueryWindowPos(hwndButtonPopup, &swp);
286 ptl.y = -(swp.cy + 2);
287 }
288 else {
289 WinQueryWindowPos(hwnd, &swp);
290 ptl.y = swp.cy + 2;
291 }
292 if (WinPopupMenu(hwnd,
293 hwnd,
294 hwndButtonPopup,
295 ptl.x,
296 ptl.y,
297 0,
298 PU_HCONSTRAIN | PU_VCONSTRAIN |
299 PU_KEYBOARD | PU_MOUSEBUTTON1)) {
300 CenterOverWindow(hwndButtonPopup);
301 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE);
302 }
303 }
304 }
305 break;
306 default:
307 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), DIR_CNR),
308 WM_CONTROL, MPFROM2SHORT(DIR_CNR, CN_CONTEXTMENU), MPVOID);
309 break;
310 }
311 } // case WM_CONTENT_MENU
[275]312
[551]313 MenuAbort:
[275]314
[551]315 if (msg == UM_CONTEXTMENU)
316 return 0;
317 break;
[2]318
[551]319 case WM_MENUEND:
320 if (hwndButtonPopup == (HWND) mp2) {
321 lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
322 WinDestroyWindow(hwndButtonPopup);
323 hwndButtonPopup = (HWND) 0;
324 DosQuerySysInfo(QSV_MS_COUNT,
325 QSV_MS_COUNT, &timestamp, sizeof(timestamp));
326 switch (lastid) {
327 case DIR_VIEW:
328 case DIR_SORT:
329 case DIR_FOLDERICON:
330 case DIR_SELECTED:
331 case DIR_MAX:
332 PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
333 break;
[2]334 }
[551]335 }
336 break;
[2]337
[551]338 case WM_BUTTON3DOWN:
339 case WM_BUTTON1DOWN:
340 case WM_BUTTON3UP:
341 case WM_BUTTON1UP:
342 {
343 USHORT id;
[2]344
[551]345 id = WinQueryWindowUShort(hwnd, QWS_ID);
346 switch (id) {
347 case DIR_FILTER:
348 case DIR_VIEW:
349 case DIR_SORT:
350 case DIR_SELECTED:
351 case DIR_FOLDERICON:
352 case DIR_MAX:
353 return CommonTextButton(hwnd, msg, mp1, mp2);
[2]354 }
[551]355 }
356 break;
[2]357
[551]358 case WM_BUTTON1DBLCLK:
359 {
360 NOTIFYRECORDENTER nr;
[2]361
[551]362 memset(&nr, 0, sizeof(NOTIFYRECORDENTER));
363 nr.hwndCnr = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), DIR_CNR);
364 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
365 WM_CONTROL, MPFROM2SHORT(DIR_CNR, CN_ENTER), MPFROMP(&nr));
366 }
367 break;
[2]368
[551]369 case WM_MOUSEMOVE:
370 {
371 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
[1394]372 PCSZ s = NULL;
[2]373
[551]374 if (fOtherHelp) {
375 if ((!hwndBubble ||
376 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
377 !WinQueryCapture(HWND_DESKTOP)) {
378 switch (id) {
379 case DIR_TOTALS:
380 s = GetPString(IDS_DIRCNRTOTALHELP);
381 break;
382 case DIR_SELECTED:
383 s = GetPString(IDS_DIRCNRSELECTEDHELP);
384 break;
385 case DIR_VIEW:
386 s = GetPString(IDS_DIRCNRVIEWHELP);
387 break;
388 case DIR_SORT:
389 s = GetPString(IDS_DIRCNRSORTHELP);
390 break;
391 case DIR_FILTER:
392 s = GetPString(IDS_DIRCNRFILTERHELP);
393 break;
394 case DIR_MAX:
395 s = GetPString(IDS_DIRCNRMAXHELP);
396 break;
397 case DIR_FOLDERICON:
398 s = GetPString(IDS_DIRCNRFOLDERHELP);
399 break;
400 default:
401 break;
402 }
403 if (s)
404 MakeBubble(hwnd, TRUE, s);
405 else if (hwndBubble)
406 WinDestroyWindow(hwndBubble);
407 }
[2]408 }
[551]409 switch (id) {
410 case DIR_MAX:
411 case DIR_FOLDERICON:
412 case DIR_FILTER:
413 case DIR_SORT:
414 case DIR_VIEW:
415 case DIR_SELECTED:
416 return CommonTextButton(hwnd, msg, mp1, mp2);
417 }
418 }
419 break;
[2]420
[551]421 case WM_CHORD:
422 case WM_BUTTON3CLICK:
423 case WM_BUTTON1CLICK:
424 case UM_CLICKED:
425 case UM_CLICKED3:
426 {
427 USHORT id, cmd = 0;
[2]428
[551]429 id = WinQueryWindowUShort(hwnd, QWS_ID);
430 if (msg == UM_CLICKED || msg == UM_CLICKED3) {
431 switch (id) {
432 case DIR_MAX:
433 cmd = IDM_MAXIMIZE;
434 break;
435 case DIR_VIEW:
436 case DIR_SELECTED:
437 case DIR_SORT:
438 PostMsg(hwnd, UM_CONTEXTMENU, MPVOID, MPVOID);
439 break;
440 case DIR_FILTER:
441 cmd = IDM_FILTER;
442 break;
443 default:
444 break;
445 }
[2]446 }
[551]447 else if (id == DIR_FOLDERICON) {
448 if ((msg == WM_BUTTON1CLICK && (SHORT2FROMMP(mp2) & KC_CTRL)))
449 cmd = IDM_PREVIOUS;
450 else if (msg == WM_BUTTON3CLICK || msg == WM_CHORD)
451 cmd = IDM_RESCAN;
452 else if (msg == WM_BUTTON1CLICK && (SHORT2FROMMP(mp2) & KC_SHIFT))
453 cmd = IDM_WALKDIR;
454 else if (msg == WM_BUTTON1CLICK && (SHORT2FROMMP(mp2) & KC_ALT))
455 cmd = IDM_WINDOWDLG;
456 else
457 cmd = IDM_PARENT;
458 }
459 if (cmd)
460 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
461 DIR_CNR),
462 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
463 }
464 if (msg == UM_CLICKED || msg == UM_CLICKED3)
465 return 0;
466 break;
[2]467
[551]468 case DM_DROP:
469 case DM_DRAGOVER:
470 case DM_DRAGLEAVE:
471 case DM_DROPHELP:
472 case WM_BEGINDRAG:
473 if (msg == DM_DRAGOVER) {
474 if (!emphasized) {
475 emphasized = TRUE;
476 DrawTargetEmphasis(hwnd, emphasized);
[2]477 }
[551]478 }
479 else if (msg != WM_BEGINDRAG) {
480 if (emphasized) {
481 emphasized = FALSE;
482 DrawTargetEmphasis(hwnd, emphasized);
[2]483 }
[551]484 }
485 switch (WinQueryWindowUShort(hwnd, QWS_ID)) {
486 case DIR_FOLDERICON:
487 switch (msg) {
488 case DM_DRAGOVER:
[618]489 if (AcceptOneDrop(hwnd, mp1, mp2))
[551]490 return MRFROM2SHORT(DOR_DROP, DO_MOVE);
[618]491 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
[551]492 case DM_DROPHELP:
493 DropHelp(mp1, mp2, hwnd, GetPString(IDS_DIRCNRFOLDERDROPHELP));
494 return 0;
495 case DM_DROP:
496 {
497 char szFrom[CCHMAXPATH + 2];
[2]498
[551]499 if (emphasized) {
500 emphasized = FALSE;
501 DrawTargetEmphasis(hwnd, emphasized);
502 }
[618]503 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom)))
[551]504 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
505 DIR_CNR),
506 WM_COMMAND, MPFROM2SHORT(IDM_SWITCH, 0),
507 MPFROMP(szFrom));
508 }
509 return 0;
510 default:
511 return PFNWPStatic(hwnd, msg, mp1, mp2);
512 }
513 case DIR_MAX:
514 if (msg == WM_BEGINDRAG)
515 return PFNWPStatic(hwnd, msg, mp1, mp2);
516 default:
517 {
518 CNRDRAGINFO cnd;
519 USHORT dcmd;
[2]520
[551]521 switch (msg) {
522 case DM_DROP:
523 dcmd = CN_DROP;
524 break;
525 case DM_DRAGOVER:
526 dcmd = CN_DRAGOVER;
527 break;
528 case DM_DRAGLEAVE:
529 dcmd = CN_DRAGLEAVE;
530 break;
531 case DM_DROPHELP:
532 dcmd = CN_DROPHELP;
533 break;
534 case WM_BEGINDRAG:
535 dcmd = CN_INITDRAG;
536 break;
537 }
538 memset(&cnd, 0, sizeof(cnd));
539 cnd.pDragInfo = (PDRAGINFO) mp1;
540 cnd.pRecord = NULL;
541 return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
542 WM_CONTROL,
543 MPFROM2SHORT(DIR_CNR, dcmd), MPFROMP(&cnd));
[2]544 }
[551]545 }
[2]546 }
[551]547 return PFNWPStatic(hwnd, msg, mp1, mp2);
[2]548}
549
[551]550MRESULT EXPENTRY DirClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
551 MPARAM mp2)
[275]552{
[551]553 switch (msg) {
554 case UM_CONTAINERDIR:
555 if (mp1) {
[2]556
[551]557 DIRCNRDATA *dcd;
[2]558
[1009]559 *(CHAR *)mp1 = 0;
[551]560 dcd = WinQueryWindowPtr(WinWindowFromID(hwnd, DIR_CNR), QWL_USER);
561 if (dcd)
[1009]562 strcpy((CHAR *)mp1, dcd->directory);
[551]563 return MRFROMLONG(TRUE);
564 }
565 return 0;
[2]566
[551]567 case UM_CONTAINERHWND:
568 return MRFROMLONG(WinWindowFromID(hwnd, DIR_CNR));
[2]569
[551]570 case UM_VIEWSMENU:
[877]571 return MRFROMLONG(CheckMenu(hwnd, &DirCnrMenu, DIRCNR_POPUP));
[2]572
[551]573 case UM_DRIVECMD:
574 case WM_INITMENU:
575 case UM_FILTER:
576 case UM_INITMENU:
577 case MM_PORTHOLEINIT:
578 case UM_COMMAND:
579 case UM_FILESMENU:
580 case UM_UPDATERECORD:
581 case UM_UPDATERECORDLIST:
582 return WinSendMsg(WinWindowFromID(hwnd, DIR_CNR), msg, mp1, mp2);
[2]583
[551]584 case WM_PSETFOCUS:
585 case WM_SETFOCUS:
586 if (mp2)
587 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
588 break;
[2]589
[551]590 case UM_FOCUSME:
591 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, DIR_CNR));
592 break;
[2]593
[551]594 case WM_PAINT:
595 {
596 HPS hps;
597 RECTL rcl;
[2]598
[551]599 hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
600 if (hps) {
601 WinQueryWindowRect(hwnd, &rcl);
602 WinFillRect(hps, &rcl, CLR_PALEGRAY);
603 CommonTextPaint(hwnd, hps);
604 WinEndPaint(hps);
[2]605 }
[551]606 }
607 break;
[2]608
[551]609 case UM_SIZE:
610 case WM_SIZE:
611 if (msg == UM_SIZE) {
[2]612
[551]613 SWP swp;
[2]614
[551]615 WinQueryWindowPos(hwnd, &swp);
616 mp1 = MPFROM2SHORT(swp.cx, swp.cy);
617 mp2 = MPFROM2SHORT(swp.cx, swp.cy);
618 }
619 {
620 USHORT cx, cy, bx;
[2]621
[551]622 cx = SHORT1FROMMP(mp2);
623 cy = SHORT2FROMMP(mp2);
624 WinSetWindowPos(WinWindowFromID(hwnd, DIR_CNR), HWND_TOP,
625 0, 0, cx, cy - 24, SWP_SHOW | SWP_MOVE | SWP_SIZE);
626 if (WinWindowFromID(hwnd, DIR_MAX) != (HWND) 0) {
627 WinSetWindowPos(WinWindowFromID(hwnd, DIR_MAX), HWND_TOP,
628 cx - 22,
629 cy - 22, 20, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
630 cx -= 24;
[2]631 }
[551]632 WinSetWindowPos(WinWindowFromID(hwnd, DIR_FOLDERICON), HWND_TOP,
633 2, cy - 22, 24, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
634 WinSetWindowPos(WinWindowFromID(hwnd, DIR_TOTALS), HWND_TOP,
635 29,
636 cy - 22,
637 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
638 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SELECTED), HWND_TOP,
639 29 + (cx / 3) + 2,
640 cy - 22,
641 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
642 bx = (cx - (29 + (((cx / 3) + 2) * 2))) / 3;
643 WinSetWindowPos(WinWindowFromID(hwnd, DIR_VIEW), HWND_TOP,
644 29 + (((cx / 3) + 2) * 2),
645 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
646 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SORT), HWND_TOP,
647 29 + (((cx / 3) + 2) * 2) + bx,
648 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
649 WinSetWindowPos(WinWindowFromID(hwnd, DIR_FILTER), HWND_TOP,
650 29 + (((cx / 3) + 2) * 2) + (bx * 2),
651 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
652 }
653 CommonTextPaint(hwnd, (HPS) 0);
654 if (msg == UM_SIZE) {
655 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
656 SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
657 return 0;
658 }
659 break;
[2]660
[551]661 case WM_COMMAND:
662 case WM_CONTROL:
663 case WM_CLOSE:
664 return WinSendMsg(WinWindowFromID(hwnd, DIR_CNR), msg, mp1, mp2);
[2]665 }
[551]666 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]667}
668
[551]669MRESULT EXPENTRY DirObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[150]670{
[2]671 DIRCNRDATA *dcd;
672
[551]673 switch (msg) {
674 case WM_CREATE:
[1077]675 DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme
[551]676 break;
[2]677
[551]678 case DM_PRINTOBJECT:
679 return MRFROMLONG(DRR_TARGET);
[2]680
[551]681 case DM_DISCARDOBJECT:
682 dcd = INSTDATA(hwnd);
683 if (fFM2Deletes && dcd) {
684 LISTINFO *li;
685 CNRDRAGINFO cni;
686 cni.pRecord = NULL;
687 cni.pDragInfo = (PDRAGINFO) mp1;
688 li =
689 DoFileDrop(dcd->hwndCnr, dcd->directory, FALSE, MPVOID,
[907]690 MPFROMP(&cni));
[687]691 CheckPmDrgLimit(cni.pDragInfo);
[551]692 if (li) {
693 li->type = (fDefaultDeletePerm) ? IDM_PERMDELETE : IDM_DELETE;
694 if (!PostMsg(hwnd, UM_MASSACTION, MPFROMP(li), MPVOID))
695 FreeListInfo(li);
696 else
697 return MRFROMLONG(DRR_SOURCE);
[2]698 }
[551]699 }
700 return MRFROMLONG(DRR_TARGET);
[2]701
[551]702 case UM_UPDATERECORDLIST:
703 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
704 if (dcd && mp1) {
[2]705
[551]706 INT numentries = 0;
707 CHAR **list = (CHAR **) mp1;
[2]708
[551]709 while (list[numentries])
710 numentries++;
711 if (numentries)
[1394]712 UpdateCnrList(dcd->hwndCnr, list, numentries, TRUE, dcd);
[551]713 }
714 return 0;
[2]715
[551]716 case UM_SETUP:
[1077]717# ifdef FORTIFY
[1113]718 //DbgMsg(pszSrcFile, __LINE__, "UM_SETUP hwnd %p TID %u", hwnd, GetTidForThread()); // 18 Jul 08 SHL fixme
[1077]719 Fortify_EnterScope();
720# endif
[551]721 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
722 if (dcd) {
[1077]723# ifdef FORTIFY
[1078]724 Fortify_BecomeOwner(dcd); // We free dcd
[1335]725 if (GetTidForThread() != 1)
726 Fortify_ChangeScope(dcd, -1);
[1077]727# endif
[551]728 /* set unique id */
729 WinSetWindowUShort(hwnd, QWS_ID, DIROBJ_FRAME + (DIR_FRAME - dcd->id));
730 dcd->hwndObject = hwnd;
731 if (ParentIsDesktop(hwnd, dcd->hwndParent))
[771]732 DosSleep(100); //05 Aug 07 GKY 250
[551]733 }
734 else
735 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[1335]736# ifdef FORTIFY
737 // TID 1 will free data
738 if (GetTidForThread() != 1)
739 Fortify_LeaveScope();
740# endif
[551]741 return 0;
742
743 case UM_RESCAN2:
744 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
745 if (dcd && dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
746
747 FSALLOCATE fsa;
748 CHAR s[CCHMAXPATH * 2];
749 CHAR tf[64];
750 CHAR tb[64];
751 CHAR szFree[64];
752
753 DosError(FERR_DISABLEHARDERR);
754 if (!DosQueryFSInfo(toupper(*dcd->directory) - '@',
755 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
756 CommaFmtULL(tb, sizeof(tb),
757 (ULONGLONG) fsa.cUnitAvail * (fsa.cSectorUnit *
758 fsa.cbSector), 'K');
759 sprintf(szFree, " {%s %s}", tb, GetPString(IDS_FREETEXT));
[2]760 }
761 else
[551]762 *szFree = 0;
763 commafmt(tf, sizeof(tf), dcd->totalfiles);
764 CommaFmtULL(tb, sizeof(tb), dcd->ullTotalBytes, ' ');
765 if (!fMoreButtons) {
766 sprintf(s, " [%s / %s]%s%s%s%s %s",
767 tf, tb, szFree,
768 (*dcd->mask.szMask || dcd->mask.antiattr ||
769 dcd->mask.attrFile != ALLATTRS) ? " (" : NullStr,
770 (*dcd->mask.szMask) ? dcd->mask.szMask :
771 (dcd->mask.antiattr ||
772 dcd->mask.attrFile != ALLATTRS) ?
773 GetPString(IDS_ALLTEXT) : NullStr,
774 (*dcd->mask.szMask || dcd->mask.antiattr ||
775 dcd->mask.attrFile != ALLATTRS) ? ")" : NullStr,
776 dcd->directory);
777 }
778 else {
779 sprintf(s, " [%s / %s]%s %s", tf, tb, szFree, dcd->directory);
780 }
781 if (dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent))
782 WinSetWindowText(hwndStatus, s);
783 }
784 return 0;
[2]785
[551]786 case UM_FLESH:
787 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
788 if (dcd) {
[2]789
[551]790 PCNRITEM pci, pciC;
[2]791
[551]792 pci = WinSendMsg(dcd->hwndCnr,
793 CM_QUERYRECORD,
794 MPVOID, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
795 while (pci && (INT) pci != -1) {
796 if (pci->attrFile & FILE_DIRECTORY) {
797 pciC = WinSendMsg(dcd->hwndCnr,
798 CM_QUERYRECORD,
799 MPFROMP(pci),
800 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
[1335]801 if (!pciC) {
802 Stubby(dcd->hwndCnr, pci);
[551]803 }
[171]804 }
[551]805 pci = WinSendMsg(dcd->hwndCnr,
806 CM_QUERYRECORD,
[1335]807 MPFROMP(pci), MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
[2]808 }
[551]809 dcd->firsttree = TRUE;
810 }
811 return 0;
[2]812
[551]813 case UM_RESCAN:
814 /*
815 * populate container
816 */
817 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
818 if (dcd) {
[1303]819 //DosEnterCritSec(); //GKY 11-29-08
820 DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
[551]821 if (dcd->stopflag)
822 dcd->stopflag--;
823 if (dcd->stopflag) {
[1335]824 DosReleaseMutexSem(hmtxFM2Globals);
825 //DosExitCritSec();
[551]826 return 0;
827 }
[1303]828 DosReleaseMutexSem(hmtxFM2Globals);
829 //DosExitCritSec();
[551]830 if (mp1) {
831 strcpy(dcd->previous, dcd->directory);
[1009]832 strcpy(dcd->directory, (CHAR *)mp1);
[551]833 }
834 MakeValidDir(dcd->directory);
835 {
836 CHAR s[CCHMAXPATH + 8];
[2]837
[551]838 sprintf(s,
839 "%s%s%s",
840 (ParentIsDesktop(dcd->hwndFrame, (HWND) 0)) ?
841 "VDir" :
842 NullStr,
843 (ParentIsDesktop(dcd->hwndFrame, (HWND) 0)) ?
844 (!dcd->dontclose) ?
845 " Master: " : ": " : NullStr, dcd->directory);
846 WinSetWindowText(dcd->hwndFrame, s);
847 WinSetWindowText(WinWindowFromID(dcd->hwndFrame, FID_TITLEBAR), s);
[2]848 }
[751]849 RemoveCnrItems(dcd->hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
[1065]850 AdjustCnrColsForFSType(dcd->hwndCnr, dcd->directory, &dcd->ds);
[551]851 dcd->ullTotalBytes = dcd->totalfiles =
852 dcd->selectedfiles = dcd->selectedbytes = 0;
853 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, "0 / 0k");
854 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, "0 / 0k");
855 if (hwndStatus &&
856 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
857 WinSetWindowText(hwndStatus, GetPString(IDS_SCANNINGTEXT));
858 if (hwndMain)
859 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
860 }
861 if (fSwitchTree && hwndTree) {
[1335]862 PSZ pszTempDir = xstrdup(dcd->directory, pszSrcFile, __LINE__);
[1102]863
[1335]864 if (hwndMain) {
[1102]865 if (TopWindow(hwndMain, (HWND) 0) == dcd->hwndFrame && pszTempDir)
[1402]866 if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszTempDir), MPVOID))
[1335]867 free(pszTempDir);
[551]868 }
[1335]869 else {
870 if (pszTempDir)
[1402]871 if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszTempDir), MPVOID))
[1335]872 free(pszTempDir);
873 }
[551]874 }
875 dcd->firsttree = FALSE;
876 // fixme to check errors
877 FillDirCnr(dcd->hwndCnr, dcd->directory, dcd, &dcd->ullTotalBytes);
878 PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
879 if (mp2 && !fLeaveTree && (dcd->flWindowAttr & CV_TREE)) {
[2]880
[551]881 ULONG flWindowAttr = dcd->flWindowAttr;
882 CNRINFO cnri;
[2]883
[551]884 flWindowAttr &=
885 (~(CV_NAME | CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
886 if (dcd->lastattr) {
887 if (dcd->lastattr & CV_TEXT)
888 flWindowAttr |= CV_TEXT;
889 else if (dcd->lastattr & CV_DETAIL)
890 flWindowAttr |= CV_DETAIL;
891 else if (dcd->lastattr & CV_ICON)
892 flWindowAttr |= CV_ICON;
893 else
894 flWindowAttr |= CV_NAME;
895 }
896 else
897 flWindowAttr |= CV_NAME;
898 flWindowAttr |= CV_FLOW;
899 memset(&cnri, 0, sizeof(CNRINFO));
900 cnri.cb = sizeof(CNRINFO);
901 if (WinSendMsg(dcd->hwndCnr, CM_QUERYCNRINFO, MPFROMP(&cnri),
902 MPFROMLONG(sizeof(CNRINFO)))) {
903 dcd->flWindowAttr = cnri.flWindowAttr = flWindowAttr;
904 WinSendMsg(dcd->hwndCnr, CM_SETCNRINFO,
905 MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
906 SayView(WinWindowFromID(dcd->hwndClient,
907 DIR_VIEW), dcd->flWindowAttr);
908 }
909 }
910 if (dcd->flWindowAttr & CV_TREE)
911 PostMsg(dcd->hwndObject, UM_FLESH, MPVOID, MPVOID);
912 if (*dcd->previous) {
913 if (strlen(dcd->previous) > strlen(dcd->directory) &&
914 !strnicmp(dcd->directory, dcd->previous,
[787]915 strlen(dcd->directory)))
[907]916 {
[787]917 PCNRITEM pci = FindCnrRecord(dcd->hwndCnr,
[907]918 dcd->previous,
[787]919 NULL, TRUE, FALSE, TRUE);
[551]920 if (pci && (INT) pci != -1) {
[787]921 // make found item current (cursored) item
[551]922 WinSendMsg(dcd->hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
923 MPFROM2SHORT(TRUE, CRA_CURSORED));
924 /* make sure that record shows in viewport */
925 ShowCnrRecord(dcd->hwndCnr, (PMINIRECORDCORE) pci);
926 }
927 }
[2]928 }
[551]929 }
930 return 0;
[2]931
[551]932 case UM_COMMAND:
933 if (mp1) {
[2]934
[551]935 LISTINFO *li = (LISTINFO *) mp1;
[2]936
[551]937 switch (li->type) {
938 case IDM_DOITYOURSELF:
939 case IDM_APPENDTOCLIP:
[1084]940 case IDM_APPENDTOCLIPFILENAME:
[551]941 case IDM_SAVETOCLIP:
[1084]942 case IDM_SAVETOCLIPFILENAME:
[551]943 case IDM_ARCHIVE:
944 case IDM_ARCHIVEM:
945 case IDM_VIEWTEXT:
946 case IDM_VIEWBINARY:
947 case IDM_VIEWARCHIVE:
948 case IDM_VIEW:
949 case IDM_EDITTEXT:
950 case IDM_EDITBINARY:
951 case IDM_EDIT:
952 case IDM_OBJECT:
953 case IDM_SHADOW:
954 case IDM_SHADOW2:
955 case IDM_PRINT:
956 case IDM_ATTRS:
957 case IDM_DELETE:
958 case IDM_PERMDELETE:
959 case IDM_MCIPLAY:
960 case IDM_UPDATE:
961 if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
962 return (MRESULT) TRUE;
963 break;
964 default:
965 if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
966 return (MRESULT) TRUE;
[2]967 }
[551]968 }
969 return 0;
[2]970
[551]971 case UM_SELECT:
972 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
973 if (dcd) {
974 switch (SHORT1FROMMP(mp1)) {
975 case IDM_SELECTBOTH:
976 case IDM_SELECTONE:
977 case IDM_SELECTMORE:
978 case IDM_SELECTNEWER:
979 case IDM_SELECTOLDER:
980 case IDM_SELECTBIGGER:
981 case IDM_SELECTSMALLER:
982 case IDM_DESELECTBOTH:
983 case IDM_DESELECTONE:
984 case IDM_DESELECTMORE:
985 case IDM_DESELECTNEWER:
986 case IDM_DESELECTOLDER:
987 case IDM_DESELECTBIGGER:
988 case IDM_DESELECTSMALLER:
989 SpecialSelect2(dcd->hwndParent, SHORT1FROMMP(mp1));
990 break;
991 case IDM_SELECTLIST:
992 {
993 CHAR filename[CCHMAXPATH], *p, *pp;
994 ULONG size;
[2]995
[1395]996 strcpy(filename, PCSZ_STARDOTLST);
[551]997 size = CCHMAXPATH;
998 PrfQueryProfileData(fmprof, appname, "SaveToListName",
999 filename, &size);
1000 pp = strrchr(filename, '\\');
1001 if (!pp)
1002 pp = filename;
1003 p = strrchr(pp, '.');
1004 if (p && *(p + 1) && p > pp + 1) {
1005 if (pp > filename)
1006 pp++;
1007 *pp = '*';
1008 pp++;
1009 if (p > pp)
1010 memmove(pp, p, strlen(p) + 1);
1011 }
1012 if (insert_filename(hwnd, filename, FALSE, FALSE))
1013 SelectList(dcd->hwndCnr, TRUE, FALSE, FALSE, NULL, filename,
1014 NULL);
1015 }
1016 break;
1017 case IDM_SELECTALL:
1018 SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
1019 break;
1020 case IDM_DESELECTALL:
1021 DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
1022 break;
1023 case IDM_SELECTALLFILES:
1024 SelectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
1025 break;
1026 case IDM_DESELECTALLFILES:
1027 DeselectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
1028 break;
1029 case IDM_SELECTALLDIRS:
1030 SelectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
1031 break;
1032 case IDM_DESELECTALLDIRS:
1033 DeselectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
1034 break;
1035 case IDM_DESELECTMASK:
1036 case IDM_SELECTMASK:
1037 {
1038 MASK mask;
1039 PCNRITEM pci = (PCNRITEM) mp2;
[2]1040
[551]1041 memset(&mask, 0, sizeof(MASK));
1042 mask.fNoAttribs = TRUE;
1043 mask.fNoDirs = TRUE;
1044 mask.fText = TRUE;
1045 strcpy(mask.prompt,
1046 GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
1047 IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
1048 if (pci && (INT) pci != -1)
[730]1049 strcpy(mask.szMask, pci->pszFileName);
[551]1050 if (WinDlgBox(HWND_DESKTOP,
1051 dcd->hwndCnr,
1052 PickMaskDlgProc,
1053 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
1054 if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
1055 SelectAll(dcd->hwndCnr,
1056 TRUE, TRUE, mask.szMask, mask.szText, FALSE);
1057 else
1058 DeselectAll(dcd->hwndCnr,
1059 TRUE, TRUE, mask.szMask, mask.szText, FALSE);
1060 }
1061 }
1062 break;
[2]1063
[551]1064 case IDM_DESELECTCLIP:
1065 case IDM_SELECTCLIP:
1066 {
1067 CHAR **list;
[2]1068
[551]1069 list = ListFromClipboard(hwnd);
1070 if (list) {
1071 SelectList(dcd->hwndCnr, TRUE, FALSE,
1072 (SHORT1FROMMP(mp1) == IDM_DESELECTCLIP),
1073 NULL, NULL, list);
1074 FreeList(list);
1075 }
1076 }
1077 break;
[2]1078
[551]1079 case IDM_INVERT:
1080 InvertAll(dcd->hwndCnr);
1081 break;
[2]1082 }
[551]1083 }
1084 return 0;
[2]1085
[551]1086 case UM_MASSACTION:
1087 if (mp1) {
1088 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1089 if (dcd) {
1090 WORKER *wk;
[1077]1091# ifdef FORTIFY
1092 Fortify_EnterScope();
1093# endif
[551]1094 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
1095 if (!wk)
1096 FreeListInfo((LISTINFO *) mp1);
1097 else {
1098 wk->size = sizeof(WORKER);
1099 wk->hwndCnr = dcd->hwndCnr;
1100 wk->hwndParent = dcd->hwndParent;
1101 wk->hwndFrame = dcd->hwndFrame;
1102 wk->hwndClient = dcd->hwndClient;
1103 wk->li = (LISTINFO *) mp1;
1104 strcpy(wk->directory, dcd->directory);
[1335]1105 if (xbeginthread(MassAction,
1106 122880,
1107 wk,
1108 pszSrcFile,
1109 __LINE__) == -1)
1110 {
[1077]1111 free(wk);
[1335]1112 FreeListInfo((LISTINFO *)mp1);
[551]1113 }
1114 }
[1077]1115# ifdef FORTIFY
1116 DosSleep(1); // Allow MassAction to take ownership
1117 Fortify_LeaveScope();
1118# endif
[2]1119 }
[551]1120 }
1121 return 0;
[2]1122
[551]1123 case UM_ACTION:
1124 if (mp1) {
[2]1125
[551]1126 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1127 if (dcd) {
[2]1128
[551]1129 WORKER *wk;
[1077]1130# ifdef FORTIFY
1131 Fortify_EnterScope();
1132# endif
[551]1133 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
1134 if (!wk)
1135 FreeListInfo((LISTINFO *) mp1);
1136 else {
1137 wk->size = sizeof(WORKER);
1138 wk->hwndCnr = dcd->hwndCnr;
1139 wk->hwndParent = dcd->hwndParent;
1140 wk->hwndFrame = dcd->hwndFrame;
1141 wk->hwndClient = dcd->hwndClient;
1142 wk->li = (LISTINFO *) mp1;
1143 strcpy(wk->directory, dcd->directory);
[1335]1144 if (xbeginthread(Action,
1145 122880,
1146 wk,
1147 pszSrcFile,
1148 __LINE__) == -1)
1149 {
[551]1150 Runtime_Error(pszSrcFile, __LINE__,
1151 GetPString(IDS_COULDNTSTARTTHREADTEXT));
[1077]1152 free(wk);
[1018]1153 FreeListInfo((LISTINFO *) mp1);
[551]1154 }
1155 }
[1077]1156# ifdef FORTIFY
1157 Fortify_LeaveScope();
1158# endif
[2]1159 }
[551]1160 }
1161 return 0;
[2]1162
[551]1163 case WM_CLOSE:
1164 WinDestroyWindow(hwnd);
1165 break;
[2]1166
[551]1167 case WM_DESTROY:
[1078]1168# ifdef FORTIFY
[1079]1169 DbgMsg(pszSrcFile, __LINE__, "WM_DESTROY hwnd %p TID %u", hwnd, GetTidForThread()); // 18 Jul 08 SHL fixme
[1078]1170# endif
[551]1171 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[1335]1172 if (!dcd)
[1398]1173 Runtime_Error(pszSrcFile, __LINE__, NULL);
[1335]1174 else {
[551]1175 if (dcd->hwndRestore)
1176 WinSetWindowPos(dcd->hwndRestore,
1177 HWND_TOP,
1178 0,
1179 0,
1180 0,
1181 0,
1182 SWP_RESTORE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);
1183 FreeList(dcd->lastselection);
[1009]1184 xfree(dcd, pszSrcFile, __LINE__);
[1017]1185 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL);
[551]1186 DosPostEventSem(CompactSem);
1187 }
[1335]1188# ifdef FORTIFY
1189 Fortify_LeaveScope();
1190# endif
1191 // 22 Jul 08 SHL fixme to understand
[551]1192 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
1193 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
1194 break;
[2]1195 }
[551]1196 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]1197}
1198
[551]1199MRESULT EXPENTRY DirCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[275]1200{
[672]1201 DIRCNRDATA *dcd = INSTDATA(hwnd);
[2]1202
[551]1203 switch (msg) {
[1077]1204 case WM_CREATE:
1205# ifdef FORTIFY
1206 Fortify_EnterScope();
1207# endif
1208 break;
1209
[551]1210 case DM_PRINTOBJECT:
1211 return MRFROMLONG(DRR_TARGET);
1212
1213 case DM_DISCARDOBJECT:
1214 if (dcd)
1215 return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
1216 else
[2]1217 return MRFROMLONG(DRR_TARGET);
1218
[551]1219 case WM_CHAR:
1220 shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
1221 if (SHORT1FROMMP(mp1) & KC_KEYUP)
1222 return (MRESULT) TRUE;
1223 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
1224 switch (SHORT2FROMMP(mp2)) {
1225 case VK_INSERT:
1226 if ((shiftstate & KC_CTRL) == KC_CTRL)
1227 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_MKDIR, 0), MPVOID);
1228 else if ((shiftstate & KC_ALT) == KC_ALT)
1229 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_CREATE, 0), MPVOID);
1230 break;
1231 case VK_PAGEUP:
1232 if ((shiftstate & KC_CTRL) == KC_CTRL)
1233 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PARENT, 0), MPVOID);
1234 break;
1235 case VK_PAGEDOWN:
1236 if ((shiftstate & KC_CTRL) == KC_CTRL)
1237 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PREVIOUS, 0), MPVOID);
1238 break;
1239 case VK_HOME:
1240 if ((shiftstate & KC_CTRL) == KC_CTRL && dcd) {
[2]1241
[551]1242 CHAR s[CCHMAXPATH], *p;
[2]1243
[551]1244 strcpy(s, dcd->directory);
1245 p = strchr(s, '\\');
1246 if (p) {
1247 p++;
1248 *p = 0;
1249 WinSendMsg(hwnd, UM_SETDIR, MPFROMP(s), MPVOID);
1250 }
1251 }
1252 break;
1253 case VK_DELETE:
1254 if ((shiftstate & KC_CTRL) == KC_CTRL)
1255 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), MPVOID);
1256 else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
1257 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), MPVOID);
1258 else
1259 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
1260 break;
[2]1261 }
[551]1262 }
1263 if (shiftstate || fNoSearch)
1264 break;
1265 if (SHORT1FROMMP(mp1) & KC_CHAR) {
[2]1266
[551]1267 ULONG thistime, len;
1268 SEARCHSTRING srch;
1269 PCNRITEM pci;
[2]1270
[551]1271 if (!dcd)
1272 break;
1273 switch (SHORT1FROMMP(mp2)) {
1274 case '\x1b':
1275 case '\r':
1276 case '\n':
1277 dcd->lasttime = 0;
1278 *dcd->szCommonName = 0;
1279 break;
1280 default:
1281 thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
1282 if (thistime > dcd->lasttime + 1250)
1283 *dcd->szCommonName = 0;
1284 dcd->lasttime = thistime;
1285 if (SHORT1FROMMP(mp2) == ' ' && !dcd->szCommonName)
1286 break;
1287 KbdRetry:
1288 len = strlen(dcd->szCommonName);
1289 if (len >= CCHMAXPATH - 1) {
1290 *dcd->szCommonName = 0;
1291 len = 0;
1292 }
1293 dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
1294 dcd->szCommonName[len + 1] = 0;
1295 memset(&srch, 0, sizeof(SEARCHSTRING));
1296 srch.cb = (ULONG) sizeof(SEARCHSTRING);
1297 srch.pszSearch = (PSZ) dcd->szCommonName;
1298 srch.fsPrefix = TRUE;
1299 srch.fsCaseSensitive = FALSE;
1300 srch.usView = CV_ICON;
1301 pci = WinSendMsg(hwnd, CM_SEARCHSTRING, MPFROMP(&srch),
1302 MPFROMLONG(CMA_FIRST));
1303 if (pci && (INT) pci != -1) {
[2]1304
[551]1305 USHORT attrib = CRA_CURSORED;
[2]1306
[551]1307 /* make found item current item */
1308 if (!stricmp(pci->pszFileName, dcd->szCommonName))
1309 attrib |= CRA_SELECTED;
1310 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
1311 MPFROM2SHORT(TRUE, attrib));
1312 /* make sure that record shows in viewport */
1313 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
1314 return (MRESULT) TRUE;
1315 }
1316 else {
1317 if (SHORT1FROMMP(mp2) == ' ') {
1318 dcd->szCommonName[len] = 0;
1319 break;
1320 }
1321 *dcd->szCommonName = 0;
1322 dcd->lasttime = 0;
1323 if (len) // retry as first letter if no match
1324 goto KbdRetry;
1325 }
1326 break;
[2]1327 }
[551]1328 }
1329 break;
[2]1330
[551]1331 case WM_MOUSEMOVE:
1332 case WM_BUTTON1UP:
1333 case WM_BUTTON2UP:
1334 case WM_BUTTON3UP:
1335 case WM_CHORD:
1336 shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
1337 break;
[2]1338
[551]1339 case WM_BUTTON1MOTIONEND:
1340 {
1341 CNRINFO cnri;
[2]1342
[551]1343 memset(&cnri, 0, sizeof(CNRINFO));
1344 cnri.cb = sizeof(CNRINFO);
1345 if (WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1346 MPFROMLONG(sizeof(CNRINFO)))) {
1347 if (cnri.flWindowAttr & CV_DETAIL)
1348 PrfWriteProfileData(fmprof, appname, "CnrSplitBar",
1349 (PVOID) & cnri.xVertSplitbar, sizeof(LONG));
[2]1350 }
[551]1351 }
1352 break;
[2]1353
[551]1354 case UM_COMPARE:
1355 if (dcd && mp1 && mp2) {
[2]1356
[551]1357 COMPARE *cmp;
[1009]1358 CHAR *leftdir = (CHAR *)mp1, *rightdir = (CHAR *)mp2;
[2]1359
[551]1360 if (!IsFile(leftdir) && !IsFile(rightdir)) {
[1077]1361# ifdef FORTIFY
1362 Fortify_EnterScope();
1363# endif
[551]1364 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
1365 if (cmp) {
1366 cmp->size = sizeof(COMPARE);
1367 strcpy(cmp->leftdir, leftdir);
1368 strcpy(cmp->rightdir, rightdir);
1369 cmp->hwndParent = dcd->hwndParent;
1370 cmp->dcd.hwndParent = dcd->hwndParent;
1371 WinDlgBox(HWND_DESKTOP,
1372 HWND_DESKTOP,
1373 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
1374 }
[1077]1375# ifdef FORTIFY
1376 Fortify_LeaveScope();
1377# endif
[2]1378 }
[551]1379 }
1380 return 0;
[2]1381
[978]1382 case WM_PRESPARAMCHANGED:
[1400]1383 PresParamChanged(hwnd, PCSZ_DIRCNR, mp1, mp2);
[978]1384 break;
[2]1385
[551]1386 case UM_UPDATERECORDLIST:
1387 if (dcd && mp1)
1388 WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
1389 return 0;
[2]1390
[551]1391 case UM_UPDATERECORD:
1392 if (dcd && mp1) {
[2]1393
[551]1394 CHAR *filename;
[2]1395
[551]1396 filename = mp1;
1397 if (filename)
1398 UpdateCnrRecord(hwnd, filename, TRUE, dcd);
1399 }
1400 return 0;
[2]1401
[551]1402 case WM_SETFOCUS:
1403 /*
1404 * put name of our window (directory name) on status line
1405 */
1406 if (dcd && hwndStatus && mp2) {
[2]1407
[551]1408 PCNRITEM pci = NULL;
[2]1409
[551]1410 if (fAutoView && hwndMain) {
1411 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
1412 MPFROMSHORT(CRA_CURSORED));
1413 if (pci && (INT) pci != -1 &&
[730]1414 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
1415 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
[551]1416 else
1417 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
[2]1418 }
[551]1419 if (*dcd->directory) {
1420 if (hwndMain)
1421 WinSendMsg(hwndMain,
1422 UM_SETUSERLISTNAME, MPFROMP(dcd->directory), MPVOID);
1423 else
1424 add_udir(FALSE, dcd->directory);
[2]1425 }
[551]1426 if (hwndMain)
1427 PostMsg(hwndMain, UM_ADVISEFOCUS, MPFROMLONG(dcd->hwndFrame), MPVOID);
1428 }
1429 if (mp2) {
1430 LastDir = hwnd;
1431 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
[1102]1432 if (fSwitchTreeOnFocus && hwndTree && dcd && *dcd->directory) {
[1335]1433 PSZ pszTempDir = xstrdup(dcd->directory, pszSrcFile, __LINE__);
[1102]1434
[1335]1435 if (pszTempDir) {
[1402]1436 if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszTempDir), MPVOID))
[1335]1437 free(pszTempDir);
1438 }
[1102]1439 }
[551]1440 }
1441 break;
[2]1442
[551]1443 case UM_SETDIR:
1444 if (dcd && mp1) {
[2]1445
[551]1446 CHAR fullname[CCHMAXPATH];
[2]1447
[551]1448 DosError(FERR_DISABLEHARDERR);
[1009]1449 if (!DosQueryPathInfo((CHAR *)mp1,
[551]1450 FIL_QUERYFULLNAME, fullname, sizeof(fullname))) {
1451 if (stricmp(dcd->directory, fullname)) {
1452 strcpy(dcd->previous, dcd->directory);
1453 strcpy(dcd->directory, fullname);
[1303]1454 //DosEnterCritSec(); //GKY 11-27-08
[551]1455 dcd->stopflag++;
[1303]1456 //DosExitCritSec();
[551]1457 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
1458 strcpy(dcd->directory, dcd->previous);
[1303]1459 //DosEnterCritSec(); //GKY 11-27-08
[551]1460 dcd->stopflag--;
[1303]1461 //DosExitCritSec();
[551]1462 }
1463 else if (*dcd->directory) {
1464 if (hwndMain)
1465 WinSendMsg(hwndMain,
1466 UM_SETUSERLISTNAME, MPFROMP(dcd->directory), MPVOID);
1467 else
1468 add_udir(FALSE, dcd->directory);
1469 }
1470 }
[2]1471 }
[551]1472 }
1473 break;
[2]1474
[551]1475 case UM_RESCAN:
1476 if (dcd) {
[2]1477
[551]1478 CNRINFO cnri;
[1397]1479 CHAR s[CCHMAXPATH * 2], tf[81], tb[81], szDate[DATE_BUF_BYTES];
[551]1480 PCNRITEM pci;
[2]1481
[551]1482 memset(&cnri, 0, sizeof(CNRINFO));
1483 cnri.cb = sizeof(CNRINFO);
1484 WinSendMsg(hwnd,
1485 CM_QUERYCNRINFO,
1486 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1487 cnri.pszCnrTitle = dcd->directory;
1488 WinSendMsg(hwnd,
1489 CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_CNRTITLE));
1490 dcd->totalfiles = cnri.cRecords;
1491 commafmt(tb, sizeof(tb), dcd->totalfiles);
1492 CommaFmtULL(tf, sizeof(tf), dcd->ullTotalBytes, 'K');
1493 sprintf(s, "%s / %s", tb, tf);
1494 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, s);
1495 commafmt(tb, sizeof(tb), dcd->selectedfiles);
1496 CommaFmtULL(tf, sizeof(tf), dcd->selectedbytes, 'K');
1497 sprintf(s, "%s / %s", tb, tf);
1498 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
1499 if (hwndStatus &&
1500 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
1501 PostMsg(dcd->hwndObject, UM_RESCAN2, MPVOID, MPVOID);
1502 if ((fSplitStatus && hwndStatus2) || fMoreButtons) {
1503 pci = WinSendMsg(hwnd,
1504 CM_QUERYRECORDEMPHASIS,
1505 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1506 if (pci && (INT) pci != -1) {
1507 if (fSplitStatus && hwndStatus2) {
1508 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
[1395]1509 if (!fMoreButtons) {
1510 DateFormat(szDate, pci->date);
1511 sprintf(s, " %s %s %02u%s%02u%s%02u [%s] %s",
[551]1512 tb,
[1395]1513 szDate,
1514 pci->time.hours,
1515 TimeSeparator,
1516 pci->time.minutes,
1517 TimeSeparator,
[551]1518 pci->time.seconds,
[1395]1519 pci->pszDispAttr, pci->pszFileName);
1520 }
[551]1521 else {
1522 *tf = 0;
1523 if (pci->cbFile + pci->easize > 1024) {
1524 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize, 'K');
1525 }
1526 sprintf(s,
1527 GetPString(IDS_STATUSSIZETEXT),
1528 tb, *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
1529 }
1530 WinSetWindowText(hwndStatus2, s);
1531 }
1532 else
1533 WinSetWindowText(hwndStatus2, NullStr);
1534 if (fMoreButtons) {
[1395]1535 WinSetWindowText(hwndName, pci->pszFileName);
1536 DateFormat(szDate, pci->date);
1537 sprintf(s, "%s %02u%s%02u%s%02u",
1538 szDate,
1539 pci->time.hours, TimeSeparator,
1540 pci->time.minutes, TimeSeparator,
1541 pci->time.seconds);
[551]1542 WinSetWindowText(hwndDate, s);
1543 WinSetWindowText(hwndAttr, pci->pszDispAttr);
1544 }
1545 }
1546 else {
1547 WinSetWindowText(hwndStatus2, NullStr);
1548 WinSetWindowText(hwndName, NullStr);
1549 WinSetWindowText(hwndDate, NullStr);
1550 WinSetWindowText(hwndAttr, NullStr);
1551 }
1552 }
[2]1553 }
[551]1554 }
1555 return 0;
[2]1556
[551]1557 case UM_SORTRECORD:
1558 if (dcd) {
[2]1559
[551]1560 CNRINFO cnri;
[2]1561
[551]1562 memset(&cnri, 0, sizeof(CNRINFO));
1563 cnri.cb = sizeof(CNRINFO);
1564 WinSendMsg(hwnd,
1565 CM_QUERYCNRINFO,
1566 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1567 cnri.pSortRecord = (PVOID) SortDirCnr;
1568 WinSendMsg(hwnd,
1569 CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PSORTRECORD));
1570 WinSendMsg(hwnd,
1571 CM_SORTRECORD,
1572 MPFROMP(SortDirCnr), MPFROMLONG(dcd->sortFlags));
1573 }
1574 return 0;
[2]1575
[551]1576 case UM_SETUP:
1577 if (dcd) {
1578 if (!dcd->hwndObject) {
1579 /*
1580 * first time through -- set things up
1581 */
[2]1582
[551]1583 CNRINFO cnri;
[2]1584
[551]1585 memset(&cnri, 0, sizeof(CNRINFO));
1586 cnri.cb = sizeof(CNRINFO);
1587 WinSendMsg(hwnd,
1588 CM_QUERYCNRINFO,
1589 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1590 cnri.cyLineSpacing = 0;
1591 cnri.cxTreeIndent = 12L;
[2]1592
[551]1593 cnri.flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
1594 cnri.flWindowAttr |= (CV_NAME | CA_DETAILSVIEWTITLES | CV_MINI |
1595 CV_FLOW);
1596 cnri.pSortRecord = (PVOID) SortDirCnr;
[2]1597
[551]1598 {
1599 ULONG size = sizeof(ULONG);
[2]1600
[551]1601 PrfQueryProfileData(fmprof,
1602 appname,
1603 "DirflWindowAttr",
1604 (PVOID) & cnri.flWindowAttr, &size);
1605 size = sizeof(MASK);
1606 if (!*dcd->mask.szMask &&
1607 !dcd->mask.attrFile && !dcd->mask.antiattr) {
1608 if (PrfQueryProfileSize(fmprof,
1609 appname, "DirFilter", &size) && size) {
1610 PrfQueryProfileData(fmprof,
1611 appname, "DirFilter", &dcd->mask, &size);
1612 SetMask(dcd->mask.szMask, &dcd->mask);
1613 }
1614 else
1615 dcd->mask.attrFile = (FILE_READONLY | FILE_NORMAL |
1616 FILE_ARCHIVED | FILE_DIRECTORY |
1617 FILE_HIDDEN | FILE_SYSTEM);
1618 }
1619 *(dcd->mask.prompt) = 0;
1620 }
1621 if (dcd->flWindowAttr)
1622 cnri.flWindowAttr = dcd->flWindowAttr;
1623 else
1624 dcd->flWindowAttr = cnri.flWindowAttr;
1625 cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH |
1626 CA_TITLEREADONLY | CA_TITLESEPARATOR));
1627 cnri.flWindowAttr |= CV_FLOW;
1628 dcd->flWindowAttr |= CV_FLOW;
1629 if (WinWindowFromID(dcd->hwndFrame, FID_TITLEBAR))
1630 cnri.flWindowAttr &= (~CA_CONTAINERTITLE);
1631 else
1632 cnri.flWindowAttr |= CA_CONTAINERTITLE;
1633 if (!dcd->sortFlags)
1634 dcd->sortFlags = sortFlags;
1635 WinSendMsg(hwnd,
1636 CM_SETCNRINFO,
1637 MPFROMP(&cnri),
1638 MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
1639 CMA_CXTREEINDENT | CMA_PSORTRECORD));
1640 SetCnrCols(hwnd, FALSE);
[1335]1641 if (xbeginthread(MakeObjWin,
1642 245760,
1643 dcd,
1644 pszSrcFile,
1645 __LINE__) == -1)
1646 {
[551]1647 Runtime_Error(pszSrcFile, __LINE__,
1648 GetPString(IDS_COULDNTSTARTTHREADTEXT));
1649 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1650 return 0;
1651 }
1652 else
[771]1653 DosSleep(32); //05 Aug 07 GKY 64
[551]1654 WinEnableMenuItem(DirCnrMenu, IDM_FINDINTREE, (hwndTree != (HWND) 0));
[2]1655 }
[1028]1656 PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
[551]1657 }
1658 else {
1659 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[2]1660 return 0;
[551]1661 }
1662 return 0;
[2]1663
[923]1664 case UM_SETUP2:
[992]1665 if (dcd) {
[1065]1666 AdjustCnrColsForPref(hwnd, NULL, &dcd->ds, FALSE);
[992]1667 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[1016]1668 DIR_FILTER), &dcd->mask, FALSE);
[992]1669 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[1016]1670 DIR_SORT), dcd->sortFlags, FALSE);
[992]1671 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[1016]1672 DIR_VIEW), dcd->flWindowAttr);
[992]1673 } else
[923]1674 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1675 return 0;
1676
[551]1677 case WM_MENUEND:
1678 if (dcd) {
[2]1679
[551]1680 HWND hwndMenu = (HWND) mp2;
[2]1681
[551]1682 if (hwndMenu == DirCnrMenu ||
[1016]1683 hwndMenu == FileMenu ||
1684 hwndMenu == DirMenu) {
[551]1685 MarkAll(hwnd, TRUE, FALSE, TRUE);
1686 if (dcd->cnremphasized) {
1687 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
1688 MPFROM2SHORT(FALSE, CRA_SOURCE));
1689 dcd->cnremphasized = FALSE;
1690 }
[2]1691 }
[551]1692 }
1693 break;
[2]1694
[551]1695 case UM_OPENWINDOWFORME:
1696 if (dcd) {
[1009]1697 if (mp1 && !IsFile((CHAR *)mp1)) {
[551]1698 OpenDirCnr(hwnd, dcd->hwndParent, dcd->hwndFrame, FALSE, (char *)mp1);
[2]1699 }
[1120]1700 else if (mp1 && IsFile(mp1) == 1 &&
[1335]1701 CheckDriveSpaceAvail(ArcTempRoot, ullDATFileSpaceNeeded, ullTmpSpaceNeeded) != 2) {
[551]1702 StartArcCnr(HWND_DESKTOP,
[1009]1703 dcd->hwndFrame, (CHAR *)mp1, 4, (ARC_TYPE *) mp2);
[551]1704 }
1705 }
1706 return 0;
[2]1707
[551]1708 case MM_PORTHOLEINIT:
1709 if (dcd) {
1710 switch (SHORT1FROMMP(mp1)) {
1711 case 0:
1712 case 1:
1713 {
1714 ULONG wmsg;
[2]1715
[551]1716 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
1717 PortholeInit((HWND) WinSendMsg(dcd->hwndClient,
1718 wmsg, MPVOID, MPVOID), mp1, mp2);
1719 }
1720 break;
[2]1721 }
[551]1722 }
1723 break;
[2]1724
[551]1725 case UM_INITMENU:
1726 case WM_INITMENU:
1727 if (dcd) {
1728 switch (SHORT1FROMMP(mp1)) {
1729 case IDM_FILESMENU:
[907]1730 CopyPresParams((HWND) mp2, hwndMainMenu);
1731 if (isalpha(*dcd->directory)) {
[551]1732 if (driveflags[toupper(*dcd->directory) - 'A'] & DRIVE_NOTWRITEABLE) {
1733 WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU, FALSE);
1734 WinEnableMenuItem((HWND) mp2, IDM_RENAME, FALSE);
1735 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, FALSE);
1736 WinEnableMenuItem((HWND) mp2, IDM_UNDELETE, FALSE);
1737 WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU, FALSE);
1738 WinEnableMenuItem((HWND) mp2, IDM_DELETE, FALSE);
1739 WinEnableMenuItem((HWND) mp2, IDM_EDIT, FALSE);
1740 WinEnableMenuItem((HWND) mp2, IDM_EDITTEXT, FALSE);
1741 WinEnableMenuItem((HWND) mp2, IDM_EDITBINARY, FALSE);
1742 WinEnableMenuItem((HWND) mp2, IDM_ATTRS, FALSE);
1743 }
1744 else {
1745 WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU, TRUE);
1746 WinEnableMenuItem((HWND) mp2, IDM_RENAME, TRUE);
1747 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, TRUE);
1748 WinEnableMenuItem((HWND) mp2, IDM_UNDELETE, TRUE);
1749 WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU, TRUE);
1750 WinEnableMenuItem((HWND) mp2, IDM_DELETE, TRUE);
1751 WinEnableMenuItem((HWND) mp2, IDM_EDIT, TRUE);
1752 WinEnableMenuItem((HWND) mp2, IDM_EDITTEXT, TRUE);
1753 WinEnableMenuItem((HWND) mp2, IDM_EDITBINARY, TRUE);
[907]1754 WinEnableMenuItem((HWND) mp2, IDM_ATTRS, TRUE);
[551]1755 }
1756 }
1757 break;
[2]1758
[551]1759 case IDM_VIEWSMENU:
[907]1760 SetViewMenu((HWND) mp2, dcd->flWindowAttr);
[877]1761 CopyPresParams((HWND) mp2, hwndMainMenu);
[907]1762 WinEnableMenuItem((HWND) mp2, IDM_RESELECT,
1763 (dcd->lastselection != NULL));
1764 if (isalpha(*dcd->directory)) {
[551]1765 if (driveflags[toupper(*dcd->directory) - 'A'] & DRIVE_NOTWRITEABLE)
1766 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, FALSE);
1767 else
1768 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, TRUE);
1769 }
1770 WinEnableMenuItem((HWND) mp2,
1771 IDM_SELECTCOMPAREMENU,
1772 (CountDirCnrs(dcd->hwndParent) > 1));
1773 break;
[2]1774
[551]1775 case IDM_DETAILSSETUP:
[1065]1776 SetDetailsSwitches((HWND) mp2, &dcd->ds);
[551]1777 break;
[2]1778
[551]1779 case IDM_COMMANDSMENU:
1780 SetupCommandMenu((HWND) mp2, hwnd);
1781 break;
[2]1782
[551]1783 case IDM_SORTSUBMENU:
1784 SetSortChecks((HWND) mp2, dcd->sortFlags);
1785 break;
[2]1786
[551]1787 case IDM_WINDOWSMENU:
1788 SetupWinList((HWND) mp2,
1789 (hwndMain) ? hwndMain : (HWND) 0, dcd->hwndFrame);
1790 break;
[2]1791 }
[551]1792 dcd->hwndLastMenu = (HWND) mp2;
1793 }
1794 if (msg == WM_INITMENU)
1795 break;
1796 return 0;
[2]1797
[551]1798 case UM_FILTER:
1799 if (dcd) {
[2]1800
[551]1801 PCNRITEM pci;
[2]1802
[551]1803 if (mp1) {
[1304]1804 //DosEnterCritSec(); // GKY 11-30-08 moved to SetMask
[1009]1805 SetMask((CHAR *)mp1, &dcd->mask);
[1304]1806 //DosExitCritSec();
[2]1807 }
[551]1808 dcd->suspendview = 1;
1809 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
1810 dcd->suspendview = 0;
1811 if (fAutoView && hwndMain) {
1812 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1813 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1814 if (pci && (INT) pci != -1 &&
[730]1815 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
1816 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
[551]1817 else
1818 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1819 }
1820 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1821 }
1822 return 0;
[2]1823
[551]1824 case UM_COMMAND:
1825 if (mp1) {
1826 if (dcd) {
1827 if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
[1400]1828 Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
[551]1829 FreeListInfo((LISTINFO *) mp1);
1830 }
1831 else
1832 return (MRESULT) TRUE;
[2]1833 }
[551]1834 else
1835 FreeListInfo((LISTINFO *) mp1);
1836 }
1837 return 0;
[2]1838
[551]1839 case UM_NOTIFY:
1840 if (mp2)
[1009]1841 Notify((CHAR *)mp2);
[551]1842 return 0;
[2]1843
[551]1844 case UM_DRIVECMD:
1845 if (mp1)
1846 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SWITCH, 0), mp1);
1847 return 0;
[2]1848
[551]1849 case WM_COMMAND:
1850 DosError(FERR_DISABLEHARDERR);
1851 if (dcd) {
1852 switch (SHORT1FROMMP(mp1)) {
1853 case IDM_SETTARGET:
1854 SetTargetDir(hwnd, FALSE);
1855 break;
[2]1856
[551]1857 case IDM_CREATE:
1858 {
1859 STRINGINPARMS sip;
1860 CHAR filename[CCHMAXPATHCOMP];
[2]1861
[551]1862 memset(&sip, 0, sizeof(sip));
1863 sip.help = GetPString(IDS_CREATETEXT);
1864 sip.prompt = GetPString(IDS_CREATEPROMPTTEXT);
1865 sip.inputlen = CCHMAXPATHCOMP - (strlen(dcd->directory) - 1);
1866 strcpy(filename, "NEWFILE.TXT");
1867 sip.ret = filename;
1868 sip.title = GetPString(IDS_CREATETITLETEXT);
1869 if (WinDlgBox(HWND_DESKTOP, hwnd, InputDlgProc, FM3ModHandle,
1870 STR_FRAME, &sip)) {
1871 bstrip(sip.ret);
1872 if (*sip.ret) {
1873 CHAR newfile[CCHMAXPATH];
1874 FILE *fp;
1875 INT test;
1876 PCNRITEM pci;
[2]1877
[551]1878 strcpy(newfile, dcd->directory);
1879 if (newfile[strlen(newfile) - 1] != '\\')
1880 strcat(newfile, "\\");
1881 strcat(newfile, sip.ret);
1882 test = IsFile(newfile);
1883 if (test != 1)
1884 fp = fopen(newfile, "w");
1885 if (test != 1 && !fp) {
1886 saymsg(MB_ENTER,
1887 hwnd,
1888 GetPString(IDS_ERRORTEXT),
1889 GetPString(IDS_CREATEERRORTEXT), newfile);
1890 }
1891 else {
1892 if (fp) {
1893 WinSendMsg(hwnd, UM_UPDATERECORD, MPFROMP(newfile), MPVOID);
1894 fclose(fp);
1895 }
1896 if (*editor) {
[2]1897
[551]1898 CHAR *dummy[2];
[2]1899
[551]1900 dummy[0] = newfile;
1901 dummy[1] = NULL;
1902 ExecOnList(hwnd,
[907]1903 editor, WINDOWED | SEPARATE, NULL, dummy, NULL,
1904 pszSrcFile, __LINE__);
[551]1905 }
1906 else
1907 StartMLEEditor(dcd->hwndParent, 4, newfile, dcd->hwndFrame);
1908 pci = FindCnrRecord(hwnd, newfile, NULL, TRUE, FALSE, TRUE);
1909 if (pci && (INT) pci != -1)
1910 /* make sure that record shows in viewport */
1911 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
1912 }
1913 }
1914 }
1915 }
1916 break;
[2]1917
[551]1918 case IDM_CONTEXTMENU:
1919 {
1920 PCNRITEM pci;
[2]1921
[551]1922 pci = (PCNRITEM) CurrentRecord(hwnd);
1923 PostMsg(hwnd, WM_CONTROL, MPFROM2SHORT(DIR_CNR, CN_CONTEXTMENU),
1924 MPFROMP(pci));
1925 }
1926 break;
[2]1927
[551]1928 case IDM_MAXIMIZE:
1929 PostMsg(hwndMain, UM_MAXIMIZE, MPFROMLONG(dcd->hwndFrame), MPVOID);
1930 break;
[2]1931
[551]1932 case IDM_SHOWALLFILESCNR:
1933 StartSeeAll(HWND_DESKTOP, FALSE, dcd->directory);
1934 break;
[2]1935
[551]1936 case IDM_SHOWALLFILES:
1937 {
1938 PCNRITEM pci;
[2]1939
[551]1940 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1941 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1942 if (pci && (INT) pci != -1) {
[2]1943
[551]1944 static CHAR dirname[CCHMAXPATH];
[2]1945
[730]1946 strcpy(dirname, pci->pszFileName);
[551]1947 MakeValidDir(dirname);
1948 StartSeeAll(HWND_DESKTOP, FALSE, dirname);
1949 }
1950 }
[1394]1951 break;
[2]1952
[551]1953 case IDM_FINDINTREE:
[1335]1954 if (hwndTree) {
1955 PSZ pszTempDir = xstrdup(dcd->directory, pszSrcFile, __LINE__);
[1102]1956
[1335]1957 if (pszTempDir) {
[1402]1958 if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszTempDir),
[1335]1959 MPFROMLONG(1L)))
1960 free(pszTempDir);
1961 }
1962 }
[551]1963 break;
[2]1964
[551]1965 case IDM_BEGINEDIT:
1966 OpenEdit(hwnd);
1967 break;
[2]1968
[551]1969 case IDM_ENDEDIT:
1970 WinSendMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
1971 break;
[2]1972
[551]1973 case IDM_SHOWSELECT:
1974 QuickPopup(hwnd,
1975 dcd,
[877]1976 CheckMenu(hwnd, &DirCnrMenu, DIRCNR_POPUP), IDM_SELECTSUBMENU);
[551]1977 break;
[2]1978
[551]1979 case IDM_SHOWSORT:
[877]1980 QuickPopup(hwnd, dcd, CheckMenu(hwnd, &DirCnrMenu, DIRCNR_POPUP),
[551]1981 IDM_SORTSUBMENU);
1982 break;
[2]1983
[551]1984 case IDM_VIEWORARC:
1985 {
1986 SWP swp;
1987 PCNRITEM pci;
[2]1988
[551]1989 pci = (PCNRITEM) WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1990 MPFROMLONG(CMA_FIRST),
1991 MPFROMSHORT(CRA_CURSORED));
1992 if (pci && (INT) pci != -1) {
1993 WinQueryWindowPos(dcd->hwndFrame, &swp);
1994 DefaultViewKeys(hwnd,
1995 dcd->hwndFrame,
[730]1996 dcd->hwndParent, &swp, pci->pszFileName);
[551]1997 }
1998 }
1999 break;
[2]2000
[953]2001 case IDM_DIRCNRSETTINGS:
[551]2002 if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
[917]2003 PostMsg(dcd->hwndParent, msg, MPFROMLONG(IDM_DIRCNRSETTINGS), mp2);
2004 else {
2005 WinDlgBox(HWND_DESKTOP,
2006 hwnd,
2007 CfgDlgProc,
2008 FM3ModHandle,
2009 CFG_FRAME,
2010 MPFROMLONG(IDM_DIRCNRSETTINGS));
2011 }
[551]2012 break;
[2]2013
[551]2014 case IDM_QTREE:
2015 case IDM_TREE:
2016 {
2017 CHAR newpath[CCHMAXPATH];
2018 APIRET rc;
2019 PCNRITEM pci;
[2]2020
[551]2021 if (SHORT1FROMMP(mp1) == IDM_TREE) {
2022 pci = (PCNRITEM) CurrentRecord(hwnd);
2023 if (pci && (INT) pci != -1)
[730]2024 strcpy(newpath, pci->pszFileName);
[551]2025 else
2026 strcpy(newpath, dcd->directory);
2027 }
2028 else
2029 strcpy(newpath, dcd->directory);
2030 MakeValidDir(newpath);
2031 rc = WinDlgBox(HWND_DESKTOP, dcd->hwndClient, ObjCnrDlgProc,
2032 FM3ModHandle, QTREE_FRAME, MPFROMP(newpath));
2033 if (rc)
2034 WinSendMsg(hwnd, UM_SETDIR, MPFROMP(newpath), MPVOID);
2035 }
2036 break;
[2]2037
[551]2038 case IDM_RESELECT:
2039 SelectList(hwnd, TRUE, FALSE, FALSE, NULL, NULL, dcd->lastselection);
2040 break;
[2]2041
[551]2042 case IDM_HELP:
2043 if (hwndHelp) {
2044 if (!ParentIsDesktop(dcd->hwndFrame, dcd->hwndParent))
2045 PostMsg(dcd->hwndParent, UM_COMMAND, mp1, mp2);
2046 else
2047 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
2048 }
2049 break;
[2]2050
[551]2051 case IDM_WINDOWDLG:
2052 if (!ParentIsDesktop(dcd->hwndFrame, dcd->hwndParent))
2053 PostMsg(dcd->hwndParent, UM_COMMAND,
2054 MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
2055 break;
[2]2056
[551]2057 case IDM_SORTSMARTNAME:
2058 case IDM_SORTNAME:
2059 case IDM_SORTFILENAME:
2060 case IDM_SORTSIZE:
2061 case IDM_SORTEASIZE:
2062 case IDM_SORTFIRST:
2063 case IDM_SORTLAST:
2064 case IDM_SORTLWDATE:
2065 case IDM_SORTLADATE:
2066 case IDM_SORTCRDATE:
2067 case IDM_SORTSUBJECT:
2068 dcd->sortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
2069 case IDM_SORTDIRSFIRST:
2070 case IDM_SORTDIRSLAST:
2071 case IDM_SORTREVERSE:
2072 switch (SHORT1FROMMP(mp1)) {
2073 case IDM_SORTSUBJECT:
2074 dcd->sortFlags |= SORT_SUBJECT;
2075 break;
2076 case IDM_SORTSMARTNAME:
2077 case IDM_SORTFILENAME:
2078 dcd->sortFlags |= SORT_FILENAME;
2079 break;
2080 case IDM_SORTSIZE:
2081 dcd->sortFlags |= SORT_SIZE;
2082 break;
2083 case IDM_SORTEASIZE:
2084 dcd->sortFlags |= SORT_EASIZE;
2085 break;
2086 case IDM_SORTFIRST:
2087 dcd->sortFlags |= SORT_FIRSTEXTENSION;
2088 break;
2089 case IDM_SORTLAST:
2090 dcd->sortFlags |= SORT_LASTEXTENSION;
2091 break;
2092 case IDM_SORTLWDATE:
2093 dcd->sortFlags |= SORT_LWDATE;
2094 break;
2095 case IDM_SORTLADATE:
2096 dcd->sortFlags |= SORT_LADATE;
2097 break;
2098 case IDM_SORTCRDATE:
2099 dcd->sortFlags |= SORT_CRDATE;
2100 break;
2101 case IDM_SORTDIRSFIRST:
2102 if (dcd->sortFlags & SORT_DIRSFIRST)
2103 dcd->sortFlags &= (~SORT_DIRSFIRST);
2104 else {
2105 dcd->sortFlags |= SORT_DIRSFIRST;
2106 dcd->sortFlags &= (~SORT_DIRSLAST);
2107 }
2108 break;
2109 case IDM_SORTDIRSLAST:
2110 if (dcd->sortFlags & SORT_DIRSLAST)
2111 dcd->sortFlags &= (~SORT_DIRSLAST);
2112 else {
2113 dcd->sortFlags |= SORT_DIRSLAST;
2114 dcd->sortFlags &= (~SORT_DIRSFIRST);
2115 }
2116 break;
2117 case IDM_SORTREVERSE:
2118 if (dcd->sortFlags & SORT_REVERSE)
2119 dcd->sortFlags &= (~SORT_REVERSE);
2120 else
2121 dcd->sortFlags |= SORT_REVERSE;
2122 break;
2123 }
2124 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortDirCnr),
2125 MPFROMLONG(dcd->sortFlags));
2126 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
2127 DIR_SORT), dcd->sortFlags, FALSE);
2128 break;
[2]2129
[551]2130 case IDM_COLLECT:
[1350]2131 case IDM_GREP:
[551]2132 if (!Collector) {
[2]2133
[551]2134 HWND hwndC;
2135 SWP swp;
[2]2136
[551]2137 if (!ParentIsDesktop(hwnd, dcd->hwndParent) && !fAutoTile &&
2138 (!fExternalCollector && !strcmp(realappname, FM3Str)))
2139 GetNextWindowPos(dcd->hwndParent, &swp, NULL, NULL);
2140 hwndC = StartCollector((fExternalCollector ||
2141 strcmp(realappname, FM3Str)) ?
2142 HWND_DESKTOP : dcd->hwndParent, 4);
2143 if (hwndC) {
2144 if (!ParentIsDesktop(hwnd, dcd->hwndParent) && !fAutoTile &&
2145 (!fExternalCollector && !strcmp(realappname, FM3Str)))
2146 WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y,
2147 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE |
2148 SWP_SHOW | SWP_ZORDER);
2149 else if (!ParentIsDesktop(hwnd, dcd->hwndParent) && fAutoTile &&
2150 !strcmp(realappname, FM3Str))
2151 TileChildren(dcd->hwndParent, TRUE);
2152 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
[771]2153 DosSleep(100); //05 Aug 07 GKY 250
[551]2154 }
2155 }
2156 else
[1394]2157 StartCollector(dcd->hwndParent, 4);
2158 if (SHORT1FROMMP(mp1) == IDM_GREP) {
2159 PCNRITEM pci = NULL;
[1366]2160
[1394]2161 pci = WinSendMsg(hwnd,
2162 CM_QUERYRECORDEMPHASIS,
2163 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
2164 if (pci && (INT) pci != -1)
2165 PostMsg(Collector, WM_COMMAND,
2166 MPFROM2SHORT(IDM_GREP, 0), MPFROMP(pci->pszFileName));
2167 else
2168 PostMsg(Collector, WM_COMMAND,
2169 MPFROM2SHORT(IDM_GREP, 0), MPVOID);
2170 }
2171 else
[1350]2172 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID);
[551]2173 break;
[2]2174
[551]2175 case IDM_COLLECTOR:
[771]2176 DosSleep(32); //05 Aug 07 GKY 64
[551]2177 {
2178 CHAR **list;
[2]2179
[551]2180 list = BuildList(hwnd);
2181 if (list) {
2182 if (Collector) {
2183 if (!PostMsg(Collector,
2184 WM_COMMAND,
2185 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(list)))
2186 FreeList(list);
2187 else if (fUnHilite)
[672]2188 UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
[551]2189 }
2190 else
2191 FreeList(list);
2192 }
2193 }
2194 break;
[2]2195
[551]2196 case IDM_UNDELETE:
2197 {
2198 PCNRITEM pci;
[1077]2199 CHAR path[CCHMAXPATH];
2200 HOBJECT hObject;
2201 HWND hwndDesktop;
[2]2202
[1077]2203 hObject = WinQueryObject("<XWP_TRASHCAN>");
2204 if (hObject != NULLHANDLE && fTrashCan) {
2205 hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE);
[1041]2206 WinSetFocus(HWND_DESKTOP, hwndDesktop);
[1077]2207 WinOpenObject(hObject, 0, TRUE);
[551]2208 }
[1077]2209 else {
2210 pci = (PCNRITEM) CurrentRecord(hwnd);
2211 if (pci && (INT) pci != -1) {
2212 strcpy(path, pci->pszFileName);
2213 MakeValidDir(path);
2214 WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle,
2215 UNDEL_FRAME, MPFROMP(path));
2216 }
2217 }
[551]2218 }
2219 break;
[2]2220
[551]2221 case IDM_UNDELETESPEC:
[1077]2222 {
2223 HOBJECT hObject;
2224 HWND hwndDesktop;
[2]2225
[1077]2226 hObject = WinQueryObject("<XWP_TRASHCAN>");
2227 if (hObject != NULLHANDLE && fTrashCan) {
2228 hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE);
[1041]2229 WinSetFocus(HWND_DESKTOP, hwndDesktop);
[1077]2230 WinOpenObject(hObject, 0, TRUE);
2231 }
2232 else
[1041]2233 WinDlgBox(HWND_DESKTOP,
2234 hwnd,
2235 UndeleteDlgProc,
[1077]2236 FM3ModHandle, UNDEL_FRAME, MPFROMP(dcd->directory));
2237 }
2238 break;
[1041]2239
[551]2240 case IDM_RESORT:
[930]2241// WinSendMsg(hwnd,
2242// CM_SORTRECORD,
2243// MPFROMP(SortDirCnr),
2244// MPFROMLONG((fSyncUpdates) ? sortFlags : dcd->sortFlags));
[551]2245 WinSendMsg(hwnd,
2246 CM_SORTRECORD,
2247 MPFROMP(SortDirCnr), MPFROMLONG(dcd->sortFlags));
2248 break;
[2]2249
[551]2250 case IDM_FILTER:
2251 {
2252 BOOL empty = FALSE;
2253 PCNRITEM pci;
2254 CHAR *p;
[2]2255
[551]2256 if (!*dcd->mask.szMask) {
2257 empty = TRUE;
2258 pci = (PCNRITEM) CurrentRecord(hwnd);
2259 if (pci && !(pci->attrFile & FILE_DIRECTORY)) {
[730]2260 p = strrchr(pci->pszFileName, '\\');
[551]2261 if (p) {
2262 p++;
2263 strcpy(dcd->mask.szMask, p);
2264 }
2265 }
2266 }
2267 *(dcd->mask.prompt) = 0;
[2]2268
[551]2269 if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
2270 FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask)))
2271 WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
2272 else if (empty)
2273 *dcd->mask.szMask = 0;
2274 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
2275 DIR_FILTER), &dcd->mask, FALSE);
2276 }
[1016]2277 break;
[2]2278
[958]2279 case IDM_UNHIDEALL:
[1016]2280 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
2281 break;
[958]2282
[551]2283 case IDM_HIDEALL:
2284 if (fAutoView && hwndMain)
2285 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
2286 dcd->suspendview = 1;
2287 HideAll(hwnd);
2288 dcd->suspendview = 0;
2289 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2290 break;
[2]2291
[551]2292 case IDM_SELECTBOTH:
2293 case IDM_SELECTONE:
2294 case IDM_SELECTMORE:
2295 case IDM_SELECTNEWER:
2296 case IDM_SELECTOLDER:
2297 case IDM_SELECTBIGGER:
2298 case IDM_SELECTSMALLER:
2299 case IDM_DESELECTBOTH:
2300 case IDM_DESELECTONE:
2301 case IDM_DESELECTMORE:
2302 case IDM_DESELECTNEWER:
2303 case IDM_DESELECTOLDER:
2304 case IDM_DESELECTBIGGER:
2305 case IDM_DESELECTSMALLER:
2306 if (ParentIsDesktop(hwnd, dcd->hwndParent)) {
2307 Runtime_Error(pszSrcFile, __LINE__, "ParentIsDesktop unexpected");
2308 break;
2309 }
2310 case IDM_SELECTLIST:
2311 case IDM_SELECTALL:
2312 case IDM_DESELECTALL:
2313 case IDM_SELECTALLFILES:
2314 case IDM_DESELECTALLFILES:
2315 case IDM_SELECTALLDIRS:
2316 case IDM_DESELECTALLDIRS:
2317 case IDM_SELECTMASK:
2318 case IDM_DESELECTMASK:
2319 case IDM_INVERT:
2320 case IDM_SELECTCLIP:
2321 case IDM_DESELECTCLIP:
2322 {
2323 PCNRITEM pci;
[2]2324
[551]2325 pci = (PCNRITEM) CurrentRecord(hwnd);
2326 if ((INT) pci == -1)
2327 pci = NULL;
2328 if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {
2329 if (pci) {
2330 if (!(pci->rc.flRecordAttr & CRA_SELECTED))
2331 pci->rc.flRecordAttr |= CRA_FILTERED;
2332 WinSendMsg(hwnd, CM_INVALIDATERECORD, MPFROMP(&pci),
2333 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
2334 break;
2335 }
2336 }
2337 PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pci));
2338 }
2339 break;
[2]2340
[551]2341 case IDM_RESCAN:
[1303]2342 //DosEnterCritSec(); //GKY 11-27-08
[551]2343 dcd->stopflag++;
[1303]2344 //DosExitCritSec();
[551]2345 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID)) {
[1303]2346 //DosEnterCritSec(); //GKY 11-27-08
[551]2347 dcd->stopflag--;
[1303]2348 //DosExitCritSec();
[551]2349 }
2350 break;
[2]2351
[551]2352 case IDM_SHOWLNAMES:
2353 case IDM_SHOWSUBJECT:
2354 case IDM_SHOWEAS:
2355 case IDM_SHOWSIZE:
2356 case IDM_SHOWICON:
2357 case IDM_SHOWLWDATE:
2358 case IDM_SHOWLWTIME:
2359 case IDM_SHOWLADATE:
2360 case IDM_SHOWLATIME:
2361 case IDM_SHOWCRDATE:
2362 case IDM_SHOWCRTIME:
2363 case IDM_SHOWATTR:
2364 AdjustDetailsSwitches(hwnd,
2365 dcd->hwndLastMenu,
2366 SHORT1FROMMP(mp1),
[1065]2367 dcd->directory, NULL, &dcd->ds, FALSE);
[551]2368 break;
[2]2369
[551]2370 case IDM_TREEVIEW:
2371 case IDM_ICON:
2372 case IDM_TEXT:
2373 case IDM_DETAILS:
2374 case IDM_NAME:
2375 case IDM_MINIICONS:
2376 case IDM_DETAILSTITLES:
2377 {
2378 CNRINFO cnri;
[2]2379
[551]2380 memset(&cnri, 0, sizeof(CNRINFO));
2381 cnri.cb = sizeof(CNRINFO);
2382 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
2383 MPFROMLONG(sizeof(CNRINFO)));
2384 switch (SHORT1FROMMP(mp1)) {
2385 case IDM_TREEVIEW:
2386 if (!(cnri.flWindowAttr & CV_TREE))
2387 dcd->lastattr = cnri.flWindowAttr;
2388 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2389 CV_DETAIL | CV_NAME | CA_TREELINE));
2390 cnri.flWindowAttr |= CA_TREELINE | CV_TREE | CV_ICON;
2391 if (!dcd->firsttree)
2392 PostMsg(dcd->hwndObject, UM_FLESH, MPVOID, MPVOID);
2393 break;
2394 case IDM_ICON:
2395 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2396 CV_DETAIL | CV_NAME | CA_TREELINE));
2397 cnri.flWindowAttr |= CV_ICON;
2398 break;
2399 case IDM_NAME:
2400 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2401 CV_DETAIL | CV_NAME | CA_TREELINE));
2402 cnri.flWindowAttr |= CV_NAME;
2403 break;
2404 case IDM_TEXT:
2405 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2406 CV_DETAIL | CV_NAME | CA_TREELINE));
2407 cnri.flWindowAttr |= CV_TEXT;
2408 break;
2409 case IDM_DETAILS:
2410 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2411 CV_DETAIL | CV_NAME | CA_TREELINE));
2412 cnri.flWindowAttr |= CV_DETAIL;
2413 break;
2414 case IDM_MINIICONS:
2415 if (cnri.flWindowAttr & CV_MINI)
2416 cnri.flWindowAttr &= (~CV_MINI);
2417 else
2418 cnri.flWindowAttr |= CV_MINI;
2419 break;
2420 case IDM_DETAILSTITLES:
2421 if (cnri.flWindowAttr & CA_DETAILSVIEWTITLES)
2422 cnri.flWindowAttr &= (~CA_DETAILSVIEWTITLES);
2423 else
2424 cnri.flWindowAttr |= CA_DETAILSVIEWTITLES;
2425 break;
2426 }
2427 cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH | CA_MIXEDTARGETEMPH));
2428 cnri.flWindowAttr |= CV_FLOW;
2429 dcd->flWindowAttr = cnri.flWindowAttr;
2430 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
2431 MPFROMLONG(CMA_FLWINDOWATTR));
2432 WinSendMsg(hwnd, CM_INVALIDATERECORD, MPVOID,
2433 MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
2434 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
2435 DIR_VIEW), dcd->flWindowAttr);
2436 }
2437 break;
[2]2438
[551]2439 case IDM_SAVETOLIST:
2440 WinDlgBox(HWND_DESKTOP, hwnd, SaveListDlgProc, FM3ModHandle,
2441 SAV_FRAME, MPFROMP(&hwnd));
2442 break;
[2]2443
[551]2444 case IDM_SIZES:
2445 {
2446 PCNRITEM pci;
2447 CHAR path[CCHMAXPATH];
[2]2448
[551]2449 pci = (PCNRITEM) CurrentRecord(hwnd);
2450 if (pci && (INT) pci != -1)
[730]2451 strcpy(path, pci->pszFileName);
[551]2452 else
2453 strcpy(path, dcd->directory);
2454 MakeValidDir(path);
2455 WinDlgBox(HWND_DESKTOP,
2456 HWND_DESKTOP, DirSizeProc, FM3ModHandle, DSZ_FRAME, path);
2457 }
2458 break;
[2]2459
[551]2460 case IDM_MKDIR:
2461 {
[907]2462 PCNRITEM pci;
2463 BOOL saved;
[2]2464
[907]2465 saved = fSelectedAlways;
2466 fSelectedAlways = FALSE;
2467 pci = (PCNRITEM)CurrentRecord(hwnd);
2468 // 01 Oct 07 SHL Make below selected directory or in current directory
[551]2469 PMMkDir(dcd->hwndParent,
[907]2470 pci && (INT)pci != -1 ? pci->pszFileName : dcd->directory,
2471 FALSE);
2472 fSelectedAlways = saved;
[551]2473 }
2474 break;
[2]2475
[551]2476 case IDM_SWITCH:
2477 if (mp2) {
2478 strcpy(dcd->previous, dcd->directory);
[1009]2479 strcpy(dcd->directory, (CHAR *)mp2);
[1303]2480 //DosEnterCritSec(); // GKY 11-27-08
[551]2481 dcd->stopflag++;
[1303]2482 //DosExitCritSec();
[551]2483 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
2484 strcpy(dcd->directory, dcd->previous);
[1303]2485 //DosEnterCritSec(); // GKY 11-27-08
[551]2486 dcd->stopflag--;
[1303]2487 //DosExitCritSec();
[551]2488 }
2489 else if (*dcd->directory) {
2490 if (hwndMain)
2491 WinSendMsg(hwndMain,
2492 UM_SETUSERLISTNAME, MPFROMP(dcd->directory), MPVOID);
2493 else
2494 add_udir(FALSE, dcd->directory);
2495 }
2496 }
2497 break;
[2]2498
[551]2499 case IDM_PARENT:
2500 {
2501 CHAR tempname1[CCHMAXPATH], tempname2[CCHMAXPATH];
[2]2502
[551]2503 strcpy(tempname1, dcd->directory);
2504 if (tempname1[strlen(tempname1) - 1] != '\\')
2505 strcat(tempname1, "\\");
2506 strcat(tempname1, "..");
2507 DosError(FERR_DISABLEHARDERR);
2508 if (!DosQueryPathInfo(tempname1,
2509 FIL_QUERYFULLNAME,
2510 tempname2, sizeof(tempname2))) {
2511 if (stricmp(dcd->directory, tempname2)) {
2512 strcpy(dcd->previous, dcd->directory);
2513 strcpy(dcd->directory, tempname2);
[1303]2514 //DosEnterCritSec(); // GKY 11-27-08
[551]2515 dcd->stopflag++;
[1303]2516 //DosExitCritSec();
[551]2517 if (!PostMsg(dcd->hwndObject,
2518 UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
2519 strcpy(dcd->directory, dcd->previous);
[1303]2520 //DosEnterCritSec();// GKY 11-27-08
[551]2521 dcd->stopflag--;
[1303]2522 //DosExitCritSec();
[551]2523 }
2524 else if (*dcd->directory) {
2525 if (hwndMain)
2526 WinSendMsg(hwndMain,
2527 UM_SETUSERLISTNAME,
2528 MPFROMP(dcd->directory), MPVOID);
2529 else
2530 add_udir(FALSE, dcd->directory);
2531 }
2532 }
2533 }
2534 }
2535 break;
[2]2536
[551]2537 case IDM_PREVIOUS:
2538 if (*dcd->previous && stricmp(dcd->directory, dcd->previous)) {
[2]2539
[551]2540 CHAR tempname[CCHMAXPATH];
[2]2541
[551]2542 if (IsValidDir(dcd->previous)) {
2543 strcpy(tempname, dcd->directory);
2544 strcpy(dcd->directory, dcd->previous);
2545 strcpy(dcd->previous, tempname);
[1303]2546 //DosEnterCritSec(); // GKY 11-27-08
[551]2547 dcd->stopflag++;
[1303]2548 //DosExitCritSec();
[551]2549 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
2550 strcpy(dcd->directory, dcd->previous);
[1303]2551 //DosEnterCritSec(); // GKY 11-27-08
[551]2552 dcd->stopflag--;
[1303]2553 //DosExitCritSec();
[551]2554 }
2555 else if (*dcd->directory) {
2556 if (hwndMain)
2557 WinSendMsg(hwndMain,
2558 UM_SETUSERLISTNAME,
2559 MPFROMP(dcd->directory), MPVOID);
2560 else
2561 add_udir(FALSE, dcd->directory);
2562 }
2563 }
2564 else
2565 *dcd->previous = 0;
2566 }
2567 break;
[2]2568
[551]2569 case IDM_WALKDIR:
2570 {
2571 CHAR newdir[CCHMAXPATH];
[2]2572
[551]2573 strcpy(newdir, dcd->directory);
2574 if (!WinDlgBox(HWND_DESKTOP,
2575 dcd->hwndParent,
2576 WalkAllDlgProc,
2577 FM3ModHandle,
2578 WALK_FRAME, MPFROMP(newdir)) || !*newdir)
2579 break;
2580 if (stricmp(newdir, dcd->directory)) {
2581 strcpy(dcd->previous, dcd->directory);
2582 strcpy(dcd->directory, newdir);
[1303]2583 //DosEnterCritSec(); //GKY 11-27-08
[551]2584 dcd->stopflag++;
[1303]2585 //DosExitCritSec();
[551]2586 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
2587 strcpy(dcd->directory, dcd->previous);
[1303]2588 //DosEnterCritSec(); // GKY 11-27-08
[551]2589 dcd->stopflag--;
[1303]2590 //DosExitCritSec();
[551]2591 }
2592 else if (*dcd->directory) {
2593 if (hwndMain)
2594 WinSendMsg(hwndMain,
2595 UM_SETUSERLISTNAME,
2596 MPFROMP(dcd->directory), MPVOID);
2597 else
2598 add_udir(FALSE, dcd->directory);
2599 }
2600 }
2601 }
2602 break;
[2]2603
[551]2604 case IDM_OPENICONME:
[1402]2605 OpenObject(dcd->directory, PCSZ_ICON, dcd->hwndFrame);
[551]2606 break;
2607 case IDM_OPENDETAILSME:
[1402]2608 OpenObject(dcd->directory, Details, dcd->hwndFrame);
[551]2609 break;
2610 case IDM_OPENTREEME:
[1402]2611 OpenObject(dcd->directory, PCSZ_TREE, dcd->hwndFrame);
[551]2612 break;
2613 case IDM_OPENSETTINGSME:
2614 OpenObject(dcd->directory, Settings, dcd->hwndFrame);
2615 break;
[2]2616
[551]2617 case IDM_DOITYOURSELF:
2618 case IDM_UPDATE:
2619 case IDM_OPENWINDOW:
2620 case IDM_OPENSETTINGS:
2621 case IDM_OPENDEFAULT:
2622 case IDM_OPENICON:
2623 case IDM_OPENDETAILS:
2624 case IDM_OPENTREE:
2625 case IDM_OBJECT:
2626 case IDM_SHADOW:
2627 case IDM_SHADOW2:
2628 case IDM_DELETE:
2629 case IDM_PERMDELETE:
2630 case IDM_PRINT:
2631 case IDM_ATTRS:
2632 case IDM_INFO:
2633 case IDM_COPY:
2634 case IDM_MOVE:
2635 case IDM_WPSMOVE:
2636 case IDM_WPSCOPY:
2637 case IDM_WILDCOPY:
2638 case IDM_WILDMOVE:
2639 case IDM_RENAME:
2640 case IDM_COMPARE:
2641 case IDM_EAS:
2642 case IDM_SUBJECT:
2643 case IDM_VIEW:
2644 case IDM_VIEWTEXT:
2645 case IDM_VIEWBINARY:
2646 case IDM_VIEWARCHIVE:
2647 case IDM_EDIT:
2648 case IDM_EDITTEXT:
2649 case IDM_EDITBINARY:
2650 case IDM_SAVETOCLIP:
[1084]2651 case IDM_SAVETOCLIPFILENAME:
[551]2652 case IDM_APPENDTOCLIP:
[1084]2653 case IDM_APPENDTOCLIPFILENAME:
[551]2654 case IDM_ARCHIVE:
2655 case IDM_ARCHIVEM:
2656 case IDM_EXTRACT:
2657 case IDM_MCIPLAY:
2658 case IDM_COLLECTFROMFILE:
2659 case IDM_UUDECODE:
2660 case IDM_MERGE:
2661 {
2662 LISTINFO *li;
2663 ULONG action = UM_ACTION;
2664 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
2665 if (li) {
2666 li->type = SHORT1FROMMP(mp1);
2667 li->hwnd = hwnd;
2668 li->list = BuildList(hwnd);
2669 switch (SHORT1FROMMP(mp1)) {
2670 case IDM_WILDMOVE:
2671 case IDM_WILDCOPY:
2672 case IDM_MOVE:
2673 case IDM_COPY:
2674 case IDM_WPSMOVE:
2675 case IDM_WPSCOPY:
2676 break;
2677 default:
2678 strcpy(li->targetpath, dcd->directory);
2679 break;
2680 }
2681 if (li->list) {
2682 if (SHORT1FROMMP(mp1) == IDM_COLLECTFROMFILE) {
2683 if (!Collector) {
[2]2684
[551]2685 HWND hwndC;
2686 SWP swp;
[2]2687
[551]2688 if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
2689 !fAutoTile &&
2690 (!fExternalCollector && !strcmp(realappname, FM3Str)))
2691 GetNextWindowPos(dcd->hwndParent, &swp, NULL, NULL);
2692 hwndC = StartCollector((fExternalCollector ||
2693 strcmp(realappname, FM3Str)) ?
2694 HWND_DESKTOP : dcd->hwndParent, 4);
2695 if (hwndC) {
2696 if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
2697 !fAutoTile && (!fExternalCollector &&
2698 !strcmp(realappname, FM3Str)))
2699 WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y,
2700 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE |
2701 SWP_SHOW | SWP_ZORDER);
2702 else if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
2703 fAutoTile && !strcmp(realappname, FM3Str))
2704 TileChildren(dcd->hwndParent, TRUE);
2705 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0,
2706 SWP_ACTIVATE);
[771]2707 DosSleep(100); //05 Aug 07 GKY 250
[551]2708 }
2709 }
2710 else
2711 StartCollector(dcd->hwndParent, 4);
2712 }
2713 switch (SHORT1FROMMP(mp1)) {
[1335]2714 case IDM_APPENDTOCLIP:
2715 case IDM_APPENDTOCLIPFILENAME:
2716 case IDM_SAVETOCLIP:
2717 case IDM_SAVETOCLIPFILENAME:
[551]2718 case IDM_ARCHIVE:
2719 case IDM_ARCHIVEM:
2720 case IDM_DELETE:
2721 case IDM_PERMDELETE:
2722 case IDM_ATTRS:
2723 case IDM_PRINT:
2724 case IDM_SHADOW:
2725 case IDM_SHADOW2:
2726 case IDM_OBJECT:
2727 case IDM_VIEW:
2728 case IDM_VIEWTEXT:
2729 case IDM_VIEWBINARY:
2730 case IDM_EDIT:
2731 case IDM_EDITTEXT:
2732 case IDM_EDITBINARY:
2733 case IDM_MCIPLAY:
2734 case IDM_UPDATE:
2735 case IDM_DOITYOURSELF:
2736 case IDM_INFO:
2737 case IDM_EAS:
2738 action = UM_MASSACTION;
2739 break;
2740 }
2741 if (SHORT1FROMMP(mp1) == IDM_OBJECT ||
2742 SHORT1FROMMP(mp1) == IDM_SHADOW ||
2743 SHORT1FROMMP(mp1) == IDM_SHADOW2)
2744 *li->targetpath = 0;
2745 if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID)) {
[1400]2746 Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
[551]2747 FreeListInfo(li);
2748 }
2749 else if (fUnHilite)
[672]2750 UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
[551]2751 }
2752 else
[1039]2753 free(li);
[551]2754 }
2755 }
2756 break;
[2]2757
[551]2758 case IDM_DRIVESMENU:
2759 if (!hwndMain)
2760 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_WALKDIR, 0), MPVOID);
2761 break;
[2]2762
[551]2763 default:
2764 if (SwitchCommand(dcd->hwndLastMenu, SHORT1FROMMP(mp1)))
2765 return 0;
2766 else {
2767 if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
2768 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
[2]2769
[551]2770 register INT x;
[2]2771
[551]2772 if (!cmdloaded)
2773 load_commands();
2774 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
2775 if (x >= 0) {
2776 x++;
2777 RunCommand(hwnd, x);
2778 if (fUnHilite)
[672]2779 UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
[551]2780 }
2781 }
2782 }
2783 break;
[2]2784 }
[551]2785 }
2786 return 0;
[2]2787
[551]2788 case UM_FIXCNRMLE:
2789 case UM_FIXEDITNAME:
2790 return CommonCnrProc(hwnd, msg, mp1, mp2);
[2]2791
[551]2792 case UM_FILESMENU:
2793 {
2794 PCNRITEM pci;
2795 HWND menuHwnd = (HWND) 0;
[2]2796
[551]2797 pci = (PCNRITEM) CurrentRecord(hwnd);
2798 if (pci && (INT) pci != -1) {
2799 if (pci->attrFile & FILE_DIRECTORY) {
[875]2800 menuHwnd = CheckMenu(hwndMainMenu, &DirMenu, DIR_POPUP);
[930]2801// WinEnableMenuItem(DirMenu,IDM_TREE,TRUE);
[551]2802 }
2803 else
[875]2804 menuHwnd = CheckMenu(hwndMainMenu, &FileMenu, FILE_POPUP);
[2]2805 }
[551]2806 return MRFROMLONG(menuHwnd);
2807 }
[2]2808
[551]2809 case WM_CONTROL:
2810 DosError(FERR_DISABLEHARDERR);
2811 if (dcd) {
2812 switch (SHORT2FROMMP(mp1)) {
2813 case CN_COLLAPSETREE:
2814 case CN_EXPANDTREE:
2815 {
2816 PCNRITEM pci = (PCNRITEM) mp2;
[2]2817
[551]2818 if (pci && (INT) pci != -1 && !(pci->flags & RECFLAGS_ENV)) {
[730]2819 if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_REMOVABLE) {
[551]2820 struct
[275]2821 {
[551]2822 ULONG serial;
2823 CHAR volumelength;
2824 CHAR volumelabel[CCHMAXPATH];
2825 }
2826 volser;
2827 APIRET rc;
[2]2828
[551]2829 memset(&volser, 0, sizeof(volser));
2830 DosError(FERR_DISABLEHARDERR);
[907]2831 // fixme?
[730]2832 rc = DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
[551]2833 FSIL_VOLSER, &volser, sizeof(volser));
2834 if (rc) {
2835 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
[552]2836 GetPString(IDS_CANTFINDDIRTEXT),
[1395]2837 pci->pszFileName);
2838 if (!fErrorBeepOff)
2839 DosBeep(250,100);
[730]2840 driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
[551]2841 UnFlesh(hwnd, pci);
2842 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2843 }
2844 else {
2845 if (SHORT2FROMMP(mp1) == CN_COLLAPSETREE &&
2846 !volser.serial ||
[907]2847 driveserial[toupper(*pci->pszFileName) - 'A'] !=
[551]2848 volser.serial)
2849 UnFlesh(hwnd, pci);
2850 if (SHORT2FROMMP(mp1) != CN_COLLAPSETREE ||
2851 (!volser.serial ||
[730]2852 driveserial[toupper(*pci->pszFileName) - 'A'] !=
[551]2853 volser.serial)) {
2854 if (Flesh(hwnd, pci) &&
2855 SHORT2FROMMP(mp1) == CN_EXPANDTREE &&
2856 !dcd->suspendview && fTopDir)
2857 PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
2858 }
[730]2859 driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
[551]2860 }
2861 }
2862 else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
2863 if (Flesh(hwnd, pci) && !dcd->suspendview && fTopDir)
2864 PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
2865 }
2866 if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && !dcd->suspendview)
2867 WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
2868 }
2869 }
2870 break;
[2]2871
2872/*
[618]2873 case CN_PICKUP:
2874 return PickUp(hwnd,dcd->hwndObject,mp2);
[2]2875*/
2876
[551]2877 case CN_CONTEXTMENU:
2878 {
2879 PCNRITEM pci = (PCNRITEM) mp2;
[2]2880
[551]2881 if (pci) {
2882 WinSendMsg(hwnd,
2883 CM_SETRECORDEMPHASIS,
2884 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
[907]2885 MarkAll(hwnd, FALSE, FALSE, TRUE);
2886 if (pci->attrFile & FILE_DIRECTORY)
[875]2887 dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &DirMenu, DIR_POPUP);
[551]2888 else
[875]2889 dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &FileMenu, FILE_POPUP);
[551]2890 }
2891 else {
[877]2892 dcd->hwndLastMenu = CheckMenu(hwnd, &DirCnrMenu, DIRCNR_POPUP);
[551]2893 if (dcd->hwndLastMenu && !dcd->cnremphasized) {
2894 WinSendMsg(hwnd,
2895 CM_SETRECORDEMPHASIS,
2896 MPVOID, MPFROM2SHORT(TRUE, CRA_SOURCE));
2897 dcd->cnremphasized = TRUE;
2898 }
2899 }
2900 if (dcd->hwndLastMenu) {
2901 if (dcd->hwndLastMenu == DirCnrMenu) {
2902 if (dcd->flWindowAttr & CV_MINI)
2903 WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
2904 }
2905 if (dcd->hwndLastMenu == DirMenu)
2906 WinEnableMenuItem(DirMenu, IDM_TREE, TRUE);
2907 if (!PopupMenu(hwnd, hwnd, dcd->hwndLastMenu)) {
2908 if (dcd->cnremphasized) {
2909 WinSendMsg(hwnd,
2910 CM_SETRECORDEMPHASIS,
2911 MPVOID, MPFROM2SHORT(FALSE, CRA_SOURCE));
2912 dcd->cnremphasized = TRUE;
2913 }
2914 MarkAll(hwnd, TRUE, FALSE, TRUE);
2915 }
2916 }
2917 }
2918 break;
[2]2919
[551]2920 case CN_DROPHELP:
2921 if (mp2) {
[2]2922
[551]2923 PDRAGINFO pDInfo;
2924 PCNRITEM pci;
2925 ULONG numitems;
2926 USHORT usOperation;
[2]2927
[551]2928 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
2929 pDInfo = (PDRAGINFO) ((PCNRDRAGINFO) mp2)->pDragInfo;
2930 if (!DrgAccessDraginfo(pDInfo)) {
2931 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
2932 GetPString(IDS_DROPERRORTEXT));
2933 }
[618]2934 else {
2935 numitems = DrgQueryDragitemCount(pDInfo);
[1394]2936 usOperation = pDInfo->usOperation;
2937 if (usOperation == DO_DEFAULT)
2938 usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
[618]2939 FreeDragInfoData(hwnd, pDInfo);
2940 saymsg(MB_ENTER | MB_ICONASTERISK,
2941 hwnd,
2942 GetPString(IDS_DROPHELPHDRTEXT),
2943 GetPString(IDS_DROPHELPTEXT),
2944 numitems,
2945 &"s"[numitems == 1L],
2946 pci ? NullStr : GetPString(IDS_NOTEXT),
2947 pci ? NullStr : " ",
[730]2948 pci ? pci->pszFileName : NullStr,
[618]2949 pci ? " " : NullStr,
[1357]2950 GetPString((usOperation == DO_MOVE) ?
2951 IDS_MOVETEXT :
[618]2952 (usOperation == DO_LINK) ?
[1357]2953 IDS_LINKTEXT : IDS_COPYTEXT));
[618]2954 }
[551]2955 }
2956 return 0;
[2]2957
[551]2958 case CN_DRAGLEAVE:
2959 return 0;
[2]2960
[551]2961 case CN_DRAGAFTER:
2962 case CN_DRAGOVER:
2963 if (mp2) {
[2]2964
[618]2965 PDRAGITEM pDItem; /* Pointer to DRAGITEM */
2966 PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
[551]2967 PCNRITEM pci;
2968 USHORT uso;
[2]2969
[551]2970 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
2971 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[907]2972 if (!DrgAccessDraginfo(pDInfo)) {
2973 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
[1402]2974 PCSZ_DRGACCESSDRAGINFO);
[618]2975 return (MRFROM2SHORT(DOR_NEVERDROP, 0));
[907]2976 }
2977 if (*dcd->directory &&
[687]2978 (driveflags[toupper(*dcd->directory) - 'A'] &
2979 DRIVE_NOTWRITEABLE)) {
[551]2980 DrgFreeDraginfo(pDInfo);
2981 return MRFROM2SHORT(DOR_DROP, /* Return okay to link */
[618]2982 DO_LINK); /* (compare) only */
[551]2983 }
2984 if (pci) {
2985 if (pci->rc.flRecordAttr & CRA_SOURCE) {
2986 DrgFreeDraginfo(pDInfo);
2987 return (MRFROM2SHORT(DOR_NODROP, 0));
2988 }
2989 uso = pDInfo->usOperation;
2990 if (uso == DO_DEFAULT)
[618]2991 uso = fCopyDefault ? DO_COPY : DO_MOVE;
[551]2992 if (!(pci->attrFile & FILE_DIRECTORY)) {
2993 if (uso != DO_LINK && uso != DO_COPY && uso != DO_MOVE) {
2994 DrgFreeDraginfo(pDInfo);
2995 return MRFROM2SHORT(DOR_NODROP, 0);
2996 }
2997 if (uso != DO_LINK &&
[730]2998 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]2999 DRIVE_NOTWRITEABLE)) {
[2]3000
[551]3001 ARC_TYPE *info = NULL;
[2]3002
[551]3003 if (!fQuickArcFind &&
[730]3004 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]3005 DRIVE_SLOW))
[730]3006 info = find_type(pci->pszFileName, NULL);
[551]3007 else
[730]3008 info = quick_find_type(pci->pszFileName, NULL);
[551]3009 if (!info || ((uso == DO_MOVE && !info->move) ||
3010 (uso == DO_COPY && !info->create))) {
3011 DrgFreeDraginfo(pDInfo);
3012 return MRFROM2SHORT(DOR_NODROP, 0);
3013 }
3014 }
3015 }
3016 }
[275]3017
[551]3018 /* Access DRAGITEM index to DRAGITEM
3019 * Check valid rendering mechanisms and data
3020 */
3021 pDItem = DrgQueryDragitemPtr(pDInfo, 0);
3022 if (DrgVerifyRMF(pDItem, DRM_OS2FILE, NULL) ||
3023 ((!pci || (pci->attrFile & FILE_DIRECTORY)) &&
3024 DrgVerifyRMF(pDItem, DRM_FM2ARCMEMBER, DRF_FM2ARCHIVE))) {
3025 DrgFreeDraginfo(pDInfo);
3026 if (driveflags[toupper(*dcd->directory) - 'A'] &
3027 DRIVE_NOTWRITEABLE)
3028 return MRFROM2SHORT(DOR_DROP, DO_LINK);
3029 if (toupper(*dcd->directory) < 'C')
3030 return MRFROM2SHORT(DOR_DROP, DO_COPY);
[618]3031 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
[551]3032 ((fCopyDefault) ? DO_COPY : DO_MOVE));
3033 }
[618]3034 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[551]3035 }
[618]3036 return MRFROM2SHORT(DOR_NODROP, 0); /* Drop not valid */
[2]3037
[551]3038 case CN_INITDRAG:
3039 {
3040 BOOL wasemphasized = FALSE;
3041 PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
3042 PCNRITEM pci;
[2]3043
[551]3044 if (pcd) {
3045 pci = (PCNRITEM) pcd->pRecord;
3046 if (pci) {
3047 if ((INT) pci == -1)
3048 pci = NULL;
3049 else if (pci->rc.flRecordAttr & CRA_SELECTED)
3050 wasemphasized = TRUE;
3051 }
3052 else if (!*dcd->directory) {
[1398]3053 Runtime_Error(pszSrcFile, __LINE__, NULL);
[551]3054 break;
3055 }
3056 else if (IsRoot(dcd->directory)) {
[618]3057 saymsg(MB_ENTER, hwnd, GetPString(IDS_ERRORTEXT),
3058 GetPString(IDS_CANTDRAGROOTDIR));
[551]3059 break;
3060 }
3061 if (hwndStatus2) {
3062 if (pci)
3063 WinSetWindowText(hwndStatus2,
3064 GetPString(IDS_DRAGFILEOBJTEXT));
3065 else
3066 WinSetWindowText(hwndStatus2, GetPString(IDS_DRAGDIRTEXT));
3067 }
3068 if (DoFileDrag(hwnd,
3069 dcd->hwndObject,
3070 mp2,
3071 NULL,
[618]3072 pci ? NULL : dcd->directory,
3073 pci ? TRUE : FALSE)) {
[672]3074 if ((pci && fUnHilite && wasemphasized) || dcd->ulItemsToUnHilite) {
3075 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
[618]3076 }
[551]3077 }
3078 if (hwndStatus2) {
3079 WinSetFocus(HWND_DESKTOP, hwnd);
3080 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
3081 }
3082 }
3083 }
3084 return 0;
[2]3085
[551]3086 case CN_DROP:
3087 if (mp2) {
[2]3088
[551]3089 LISTINFO *li;
3090 ULONG action = UM_ACTION;
[2]3091
[907]3092 li = DoFileDrop(hwnd, dcd->directory, TRUE, mp1, mp2);
3093 CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
[551]3094 if (li) {
3095 if (li->list && li->list[0] && IsRoot(li->list[0]))
3096 li->type = DO_LINK;
3097 else if (fDragndropDlg && (!*li->arcname || !li->info)) {
[2]3098
[551]3099 CHECKLIST cl;
[2]3100
[551]3101 memset(&cl, 0, sizeof(cl));
3102 cl.size = sizeof(cl);
3103 cl.flags = li->type;
3104 cl.list = li->list;
3105 cl.cmd = li->type;
3106 cl.prompt = li->targetpath;
3107 li->type = WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
3108 DropListProc, FM3ModHandle,
[618]3109 DND_FRAME, MPFROMP(&cl));
3110 if (li->type == DID_ERROR)
3111 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
[1402]3112 GetPString(IDS_DRAGDROPDIALOGTEXT));
[618]3113 if (!li->type) {
[551]3114 FreeListInfo(li);
3115 return 0;
3116 }
3117 li->list = cl.list;
[618]3118 if (!li->list || !li->list[0]) {
[551]3119 FreeListInfo(li);
3120 return 0;
3121 }
3122 }
3123 switch (li->type) {
3124 case DND_LAUNCH:
3125 strcat(li->targetpath, " %a");
3126 ExecOnList(dcd->hwndParent, li->targetpath,
[907]3127 PROMPT | WINDOWED, NULL, li->list, NULL,
3128 pszSrcFile, __LINE__);
[551]3129 FreeList(li->list);
3130 li->list = NULL;
3131 break;
3132 case DO_LINK:
3133 if (fLinkSetsIcon) {
3134 li->type = IDM_SETICON;
3135 action = UM_MASSACTION;
3136 }
3137 else
3138 li->type = IDM_COMPARE;
3139 break;
3140 case DND_EXTRACT:
3141 if (*li->targetpath && !IsFile(li->targetpath))
3142 li->type = IDM_EXTRACT;
3143 break;
3144 case DND_MOVE:
3145 li->type = IDM_MOVE;
3146 if (*li->targetpath && IsFile(li->targetpath) == 1) {
3147 action = UM_MASSACTION;
3148 li->type = IDM_ARCHIVEM;
3149 }
3150 break;
3151 case DND_WILDMOVE:
3152 li->type = IDM_WILDMOVE;
3153 if (*li->targetpath && IsFile(li->targetpath) == 1) {
3154 action = UM_MASSACTION;
3155 li->type = IDM_ARCHIVEM;
3156 }
3157 break;
3158 case DND_OBJECT:
3159 li->type = IDM_OBJECT;
3160 action = UM_MASSACTION;
3161 break;
3162 case DND_SHADOW:
3163 li->type = IDM_SHADOW;
3164 action = UM_MASSACTION;
3165 break;
3166 case DND_COMPARE:
3167 li->type = IDM_COMPARE;
3168 break;
3169 case DND_SETICON:
3170 action = UM_MASSACTION;
3171 li->type = IDM_SETICON;
3172 break;
3173 case DND_COPY:
3174 li->type = IDM_COPY;
3175 if (*li->targetpath && IsFile(li->targetpath) == 1) {
3176 action = UM_MASSACTION;
3177 li->type = IDM_ARCHIVE;
3178 }
3179 break;
3180 case DND_WILDCOPY:
3181 li->type = IDM_WILDCOPY;
3182 if (*li->targetpath && IsFile(li->targetpath) == 1) {
3183 action = UM_MASSACTION;
3184 li->type = IDM_ARCHIVE;
3185 }
3186 break;
3187 default:
3188 if (*li->arcname && li->info) {
3189 action = UM_MASSACTION;
3190 li->type =
3191 (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
3192 }
3193 else if (*li->targetpath && IsFile(li->targetpath) == 1) {
3194 action = UM_MASSACTION;
3195 li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
3196 }
3197 else
3198 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
3199 break;
3200 }
3201 if (!li->list || !li->list[0])
3202 FreeListInfo(li);
3203 else if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
3204 FreeListInfo(li);
3205 else {
[2]3206
[551]3207 USHORT usop = 0;
[2]3208
[551]3209 switch (li->type) {
3210 case IDM_COPY:
3211 case IDM_WILDCOPY:
3212 usop = DO_COPY;
3213 break;
3214 case IDM_MOVE:
3215 case IDM_WILDMOVE:
3216 case IDM_ARCHIVEM:
3217 usop = DO_MOVE;
3218 break;
3219 }
3220 if (usop)
3221 return MRFROM2SHORT(DOR_DROP, usop);
3222 }
3223 }
3224 }
3225 return 0;
[2]3226
[551]3227 case CN_ENDEDIT:
3228 case CN_BEGINEDIT:
3229 {
3230 PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
3231 PCNRITEM pci = (PCNRITEM) ((PCNREDITDATA) mp2)->pRecord;
[2]3232
[551]3233 if (pfi || pci) {
[2]3234
[551]3235 MRESULT mre;
[2]3236
[551]3237 mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
3238 if (mre != (MRESULT) - 1)
3239 return mre;
3240 }
3241 else if (!pfi && !pci)
3242 PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(CCHMAXPATH), MPVOID);
3243 }
3244 return 0;
[2]3245
[551]3246 case CN_REALLOCPSZ:
3247 {
3248 PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
3249 PCNRITEM pci = (PCNRITEM) ((PCNREDITDATA) mp2)->pRecord;
3250 HWND hwndMLE;
3251 static CHAR szData[CCHMAXPATH];
[689]3252 CHAR testname[CCHMAXPATH];
[2]3253
[551]3254 if (!pci && !pfi) {
3255 hwndMLE = WinWindowFromID(hwnd, CID_MLE);
3256 WinQueryWindowText(hwndMLE, sizeof(szData), szData);
3257 chop_at_crnl(szData);
3258 bstrip(szData);
3259 if (*szData) {
3260 if (!DosQueryPathInfo(szData,
3261 FIL_QUERYFULLNAME,
3262 testname, sizeof(testname))) {
3263 if (!SetDir(dcd->hwndParent, hwnd, testname, 1)) {
3264 PostMsg(hwnd, UM_SETDIR, MPFROMP(testname), MPVOID);
3265 }
3266 }
3267 }
3268 }
3269 else {
[2]3270
[551]3271 MRESULT mre;
[2]3272
[551]3273 mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
3274 if (mre != (MRESULT) - 1)
3275 return mre;
3276 }
3277 }
3278 return 0;
[2]3279
[551]3280 case CN_EMPHASIS:
3281 if (!mp2)
3282 Runtime_Error(pszSrcFile, __LINE__, "mp2 NULL");
3283 else {
3284 PNOTIFYRECORDEMPHASIS pre = mp2;
3285 PCNRITEM pci;
3286 CHAR s[CCHMAXPATHCOMP + 91], tb[81], tf[81];
[2]3287
[762]3288 pci = (PCNRITEM) (pre ? pre->pRecord : NULL);
[551]3289 if (!pci) {
3290 if (hwndStatus2)
3291 WinSetWindowText(hwndStatus2, NullStr);
3292 if (fMoreButtons) {
3293 WinSetWindowText(hwndName, NullStr);
3294 WinSetWindowText(hwndDate, NullStr);
3295 WinSetWindowText(hwndAttr, NullStr);
3296 }
3297 if (hwndMain)
3298 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
3299 break;
3300 }
3301 if (pre->fEmphasisMask & CRA_SELECTED) {
3302 if (pci->rc.flRecordAttr & CRA_SELECTED) {
3303 dcd->selectedbytes += (pci->cbFile + pci->easize);
3304 dcd->selectedfiles++;
3305 }
3306 else if (dcd->selectedfiles) {
3307 dcd->selectedbytes -= (pci->cbFile + pci->easize);
3308 dcd->selectedfiles--;
3309 }
3310 if (!dcd->suspendview) {
3311 commafmt(tf, sizeof(tf), dcd->selectedfiles);
3312 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, 'K');
3313 sprintf(s, "%s / %s", tf, tb);
3314 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
3315 }
3316 }
3317 if (!dcd->suspendview && hwndMain &&
3318 (pre->fEmphasisMask & CRA_CURSORED) &&
3319 (pci->rc.flRecordAttr & CRA_CURSORED) &&
3320 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame) {
[730]3321 if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)
[551]3322 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
3323 else
3324 WinSendMsg(hwndMain,
[730]3325 UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
[551]3326 }
3327 if (!dcd->suspendview &&
3328 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame) {
3329 if (pre->fEmphasisMask & CRA_CURSORED) {
3330 if (pci->rc.flRecordAttr & CRA_CURSORED) {
3331 if (fSplitStatus && hwndStatus2) {
3332 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
[1395]3333 if (!fMoreButtons) {
3334 CHAR date[11];
3335
3336 DateFormat(date, pci->date);
3337 sprintf(s, " %s %s %02u%s%02u%s%02u [%s] %s",
3338 tb, date, pci->time.hours, TimeSeparator,
3339 pci->time.minutes, TimeSeparator, pci->time.seconds,
[551]3340 pci->pszDispAttr, pci->pszFileName);
3341 }
3342 else {
3343 *tf = 0;
3344 if (pci->cbFile + pci->easize > 1024) {
3345 CommaFmtULL(tf, sizeof(tf),
3346 pci->cbFile + pci->easize, 'K');
3347 }
3348 sprintf(s, GetPString(IDS_STATUSSIZETEXT),
3349 tb,
3350 *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
3351 }
3352 WinSetWindowText(hwndStatus2, s);
3353 }
[1395]3354 if (fMoreButtons) {
[1397]3355 CHAR szDate[DATE_BUF_BYTES];
[1395]3356
3357 WinSetWindowText(hwndName, pci->pszFileName);
3358 DateFormat(szDate, pci->date);
3359 sprintf(s, "%s %02u%s%02u%s%02u",
3360 szDate, pci->time.hours, TimeSeparator, pci->time.minutes,
3361 TimeSeparator, pci->time.seconds);
[551]3362 WinSetWindowText(hwndDate, s);
3363 WinSetWindowText(hwndAttr, pci->pszDispAttr);
3364 }
3365 }
3366 }
3367 }
3368 }
3369 break;
[2]3370
[551]3371 case CN_ENTER:
3372 if (mp2) {
[2]3373
[551]3374 PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
[847]3375 FILEFINDBUF3 ffb;
[551]3376 HDIR hDir = HDIR_CREATE;
[761]3377 ULONG nm = 1;
[551]3378 APIRET status = 0;
[2]3379
[551]3380 SetShiftState();
3381 if (pci) {
3382 if (pci->rc.flRecordAttr & CRA_INUSE)
3383 break;
3384 DosError(FERR_DISABLEHARDERR);
[847]3385 status = DosFindFirst(pci->pszFileName,
[838]3386 &hDir,
3387 FILE_NORMAL | FILE_DIRECTORY |
3388 FILE_ARCHIVED | FILE_READONLY |
3389 FILE_HIDDEN | FILE_SYSTEM,
[847]3390 &ffb, sizeof(ffb), &nm, FIL_STANDARD);
[551]3391 priority_bumped();
3392 if (!status) {
3393 DosFindClose(hDir);
3394 if (ffb.attrFile & FILE_DIRECTORY) {
3395 if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT))
3396 PostMsg(hwnd,
3397 WM_COMMAND,
3398 MPFROM2SHORT(IDM_SHOWALLFILES, 0), MPVOID);
3399 else if ((shiftstate & (KC_CTRL | KC_SHIFT)) ==
3400 (KC_CTRL | KC_SHIFT))
[730]3401 OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
[551]3402 else if (shiftstate & KC_CTRL)
[730]3403 OpenObject(pci->pszFileName, Default, dcd->hwndFrame);
[551]3404 else if (shiftstate & KC_SHIFT) {
[2]3405
[551]3406 HWND hwndDir;
[2]3407
[551]3408 hwndDir = OpenDirCnr((HWND) 0,
3409 dcd->hwndParent,
3410 dcd->hwndFrame,
[730]3411 FALSE, pci->pszFileName);
[551]3412 if (hwndDir) {
3413 if (fMinOnOpen)
3414 WinSetWindowPos(dcd->hwndFrame,
3415 HWND_BOTTOM,
3416 0, 0, 0, 0, SWP_MINIMIZE | SWP_ZORDER);
3417 if (fAutoTile)
3418 TileChildren(dcd->hwndParent, TRUE);
3419 WinSetWindowPos(hwndDir,
3420 HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
3421 }
3422 }
3423 else {
3424 strcpy(dcd->previous, dcd->directory);
[730]3425 strcpy(dcd->directory, pci->pszFileName);
[1303]3426 //DosEnterCritSec(); // GKY 11-27-08
[551]3427 dcd->stopflag++;
[1303]3428 //DosExitCritSec();
[551]3429 if (!PostMsg(dcd->hwndObject,
[841]3430 UM_RESCAN, MPVOID, MPFROMLONG(1))) {
[1303]3431 //DosEnterCritSec(); // GKY 11-27-08
[551]3432 dcd->stopflag--;
[1303]3433 //DosExitCritSec();
[551]3434 }
3435 else if (*dcd->directory) {
3436 if (hwndMain)
3437 WinSendMsg(hwndMain,
3438 UM_SETUSERLISTNAME,
3439 MPFROMP(dcd->directory), MPVOID);
3440 else
3441 add_udir(FALSE, dcd->directory);
3442 }
3443 }
3444 }
3445 else {
[2]3446
[551]3447 SWP swp;
[2]3448
[551]3449 WinQueryWindowPos(dcd->hwndFrame, &swp);
3450 WinSendMsg(hwnd,
3451 CM_SETRECORDEMPHASIS,
3452 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_INUSE));
3453 DefaultViewKeys(hwnd,
3454 dcd->hwndFrame,
[730]3455 dcd->hwndParent, &swp, pci->pszFileName);
[551]3456 WinSendMsg(hwnd,
3457 CM_SETRECORDEMPHASIS,
3458 MPFROMP(pci),
3459 MPFROM2SHORT(FALSE,
3460 CRA_INUSE |
3461 ((fUnHilite) ? CRA_SELECTED : 0)));
3462 }
3463 }
3464 else {
3465 if (!*dcd->directory || IsValidDir(dcd->directory)) {
[730]3466 NotifyError(pci->pszFileName, status);
[751]3467 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
[551]3468 if (hwndStatus)
3469 WinSetWindowText(hwndStatus,
3470 GetPString(IDS_RESCANSUGGESTEDTEXT));
3471 }
3472 else {
[1303]3473 //DosEnterCritSec(); // GKY 11-27-08
[551]3474 dcd->stopflag++;
[1303]3475 //DosExitCritSec();
[551]3476 if (!PostMsg(dcd->hwndObject,
3477 UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
[1303]3478 //DosEnterCritSec(); // GKY 11-27-08
[551]3479 dcd->stopflag--;
[1303]3480 //DosExitCritSec();
[551]3481 }
3482 else if (*dcd->directory) {
3483 if (hwndMain)
3484 WinSendMsg(hwndMain,
3485 UM_SETUSERLISTNAME,
3486 MPFROMP(dcd->directory), MPVOID);
3487 else
3488 add_udir(FALSE, dcd->directory);
3489 }
3490 }
3491 }
3492 }
3493 else if (*dcd->directory)
3494 OpenObject(dcd->directory, Default, hwnd);
[787]3495 } // CN_ENTER
[551]3496 break;
[787]3497 } // switch mp1
[551]3498 break;
[787]3499 } // if dcd
[551]3500 return 0;
[2]3501
[551]3502 case UM_LOADFILE:
3503 if (dcd && mp2) {
[2]3504
[1037]3505 HWND hwnd;
3506
3507 if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21)
[1077]3508 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,
3509 (CHAR *)mp2, dcd->hwndFrame);
[1037]3510 else
[1077]3511 hwnd = StartMLEEditor(dcd->hwndParent,
3512 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);
[1009]3513 xfree((CHAR *)mp2, pszSrcFile, __LINE__);
[1037]3514 return MRFROMLONG(hwnd);
[551]3515 }
3516 return 0;
[2]3517
[551]3518 case WM_SAVEAPPLICATION:
3519 if (dcd && ParentIsDesktop(hwnd, dcd->hwndParent)) {
[2]3520
[551]3521 SWP swp;
[2]3522
[551]3523 WinQueryWindowPos(dcd->hwndFrame, &swp);
3524 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE | SWP_MAXIMIZE)))
3525 PrfWriteProfileData(fmprof,
3526 appname, "VDirSizePos", &swp, sizeof(swp));
3527 }
3528 break;
[2]3529
[551]3530 case WM_CLOSE:
3531 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
3532 if (LastDir == hwnd)
3533 LastDir = (HWND) 0;
3534 if (dcd) {
3535 dcd->stopflag++;
3536 if (!dcd->dontclose && ParentIsDesktop(dcd->hwndFrame, (HWND) 0))
[1016]3537 PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
[1012]3538 if (dcd->hwndObject) {
[1016]3539 // Ensure object window destroy does not attempt duplicate clean up
3540 WinSetWindowPtr(dcd->hwndObject, QWL_USER, NULL);
3541 if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
3542 Win_Error(dcd->hwndObject, hwnd, pszSrcFile, __LINE__, "hwndObject WinPostMsg failed");
[2]3543 }
[1012]3544 if (dcd->hwndRestore)
[1016]3545 WinSetWindowPos(dcd->hwndRestore,
3546 HWND_TOP,
3547 0,
3548 0,
3549 0,
3550 0,
3551 SWP_RESTORE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);
[1012]3552 FreeList(dcd->lastselection);
[1039]3553 free(dcd);
[1012]3554 WinSetWindowPtr(hwnd, QWL_USER, NULL);
3555 DosPostEventSem(CompactSem);
[551]3556 }
3557 WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
3558 QW_PARENT));
3559 return 0;
[2]3560
[551]3561 case WM_DESTROY:
[1078]3562# ifdef FORTIFY
[1079]3563 DbgMsg(pszSrcFile, __LINE__, "WM_DESTROY hwnd %p TID %u", hwnd, GetTidForThread()); // 18 Jul 08 SHL fixme
[1078]3564# endif
[551]3565 if (DirMenu)
3566 WinDestroyWindow(DirMenu);
3567 if (DirCnrMenu)
3568 WinDestroyWindow(DirCnrMenu);
3569 if (FileMenu)
3570 WinDestroyWindow(FileMenu);
3571 DirMenu = DirCnrMenu = FileMenu = (HWND) 0;
3572 EmptyCnr(hwnd);
[1077]3573# ifdef FORTIFY
3574 Fortify_LeaveScope();
3575# endif
[551]3576 break;
[1016]3577 } // switch
3578
3579 if (dcd && dcd->oldproc) {
3580 // 11 May 08 SHL fixme debug fortify
3581 if ((ULONG)dcd->oldproc == 0xa9a9a9a9)
3582 DbgMsg(pszSrcFile, __LINE__, "calling oldproc after dcd free msg %x mp1 %x mp2 %x", msg, mp1, mp2);
[705]3583 return dcd->oldproc(hwnd, msg, mp1, mp2);
3584 }
3585 else
3586 return PFNWPCnr(hwnd, msg, mp1, mp2);
[2]3587}
3588
[551]3589HWND StartDirCnr(HWND hwndParent, CHAR * directory, HWND hwndRestore,
3590 ULONG flags)
[275]3591{
[2]3592 /* bitmapped flags:
3593 * 0x00000001 = don't close app when window closes
3594 * 0x00000002 = no frame controls
3595 */
3596
[551]3597 HWND hwndFrame = (HWND) 0, hwndClient;
3598 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
3599 FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
3600 USHORT id;
[2]3601 static USHORT idinc = 0;
[551]3602 DIRCNRDATA *dcd;
3603 static BOOL first = FALSE;
[2]3604
[551]3605 if (flags & 2)
[2]3606 FrameFlags &= (~(FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER |
[551]3607 FCF_MINMAX | FCF_ICON));
3608 if (!idinc)
[2]3609 idinc = (rand() % 100);
[551]3610 if (!hwndParent)
[2]3611 hwndParent = HWND_DESKTOP;
[551]3612 if (ParentIsDesktop(hwndParent, hwndParent))
[2]3613 FrameFlags |= (FCF_TASKLIST | FCF_MENU);
[551]3614 if (!hwndMain && !first) {
3615 if (DirCnrMenu) {
[2]3616 MENUITEM mi;
[551]3617 memset(&mi, 0, sizeof(mi));
[2]3618 WinSendMsg(DirCnrMenu,
[551]3619 MM_DELETEITEM, MPFROM2SHORT(IDM_DRIVESMENU, FALSE), MPVOID);
[2]3620 mi.iPosition = MIT_END;
3621 mi.afStyle = MIS_TEXT;
3622 mi.id = IDM_DRIVESMENU;
3623 WinSendMsg(DirCnrMenu,
[551]3624 MM_INSERTITEM,
3625 MPFROMP(&mi), MPFROMP(GetPString(IDS_DRIVESMENUTEXT)));
[2]3626 }
3627 first = TRUE;
3628 }
[551]3629 if (directory) {
[2]3630 hwndFrame = WinCreateStdWindow(hwndParent,
[551]3631 WS_VISIBLE,
3632 &FrameFlags,
[593]3633 WC_DIRCONTAINER,
[551]3634 NULL,
[1394]3635 WS_VISIBLE | fwsAnimate,
[551]3636 FM3ModHandle, DIR_FRAME, &hwndClient);
3637 if (hwndFrame && hwndClient) {
[2]3638 id = DIR_FRAME + idinc++;
[551]3639 if (idinc > 99)
3640 idinc = 0;
3641 WinSetWindowUShort(hwndFrame, QWS_ID, id);
[1063]3642# ifdef FORTIFY
3643 Fortify_EnterScope();
[1077]3644# endif
[551]3645 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
[358]3646 if (!dcd) {
[1016]3647 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
[551]3648 hwndFrame = (HWND) 0;
[358]3649 }
3650 else {
[551]3651 dcd->size = sizeof(DIRCNRDATA);
3652 dcd->id = id;
3653 dcd->type = DIR_FRAME;
3654 dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
3655 dcd->hwndFrame = hwndFrame;
3656 dcd->hwndClient = hwndClient;
3657 dcd->hwndRestore = hwndRestore;
3658 dcd->dontclose = ((flags & 1) != 0);
[1065]3659 dcd->ds.detailslongname = dsDirCnrDefault.detailslongname;
3660 dcd->ds.detailssubject = dsDirCnrDefault.detailssubject;
3661 dcd->ds.detailsea = dsDirCnrDefault.detailsea;
3662 dcd->ds.detailssize = dsDirCnrDefault.detailssize;
3663 dcd->ds.detailsicon = dsDirCnrDefault.detailsicon;
3664 dcd->ds.detailsattr = dsDirCnrDefault.detailsattr;
3665 dcd->ds.detailscrdate = dsDirCnrDefault.detailscrdate;
3666 dcd->ds.detailscrtime = dsDirCnrDefault.detailscrtime;
3667 dcd->ds.detailslwdate = dsDirCnrDefault.detailslwdate;
3668 dcd->ds.detailslwtime = dsDirCnrDefault.detailslwtime;
3669 dcd->ds.detailsladate = dsDirCnrDefault.detailsladate;
3670 dcd->ds.detailslatime = dsDirCnrDefault.detailslatime;
[551]3671 strcpy(dcd->directory, directory);
3672 add_udir(FALSE, directory);
3673 {
3674 PFNWP oldproc;
[2]3675
[551]3676 oldproc = WinSubclassWindow(hwndFrame, (PFNWP) DirFrameWndProc);
3677 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
[377]3678 }
[551]3679 dcd->hwndCnr = WinCreateWindow(hwndClient,
3680 WC_CONTAINER,
3681 NULL,
3682 CCS_AUTOPOSITION | CCS_MINIICONS |
[1350]3683 CCS_MINIRECORDCORE | ulCnrType, // |
3684 //WS_VISIBLE,
[551]3685 0,
3686 0,
3687 0,
3688 0,
3689 hwndClient,
3690 HWND_TOP, (ULONG) DIR_CNR, NULL, NULL);
3691 if (!dcd->hwndCnr) {
[1395]3692 Win_Error(hwndClient, hwndClient, pszSrcFile, __LINE__,
3693 PCSZ_WINCREATEWINDOW);
[551]3694 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
[1077]3695 free(dcd);
[551]3696 hwndFrame = (HWND) 0;
3697 }
[377]3698 else {
[1078]3699# ifdef FORTIFY
3700 Fortify_ChangeScope(dcd, -1);
3701# endif
[1400]3702 RestorePresParams(dcd->hwndCnr, PCSZ_DIRCNR);
[551]3703 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
3704 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
[1016]3705 (PFNWP) DirCnrWndProc);
[551]3706 {
3707 USHORT ids[] = { DIR_TOTALS, DIR_SELECTED, DIR_VIEW, DIR_SORT,
3708 DIR_FILTER, DIR_FOLDERICON, DIR_MAX, 0
3709 };
[2]3710
[551]3711 if (!(flags & 2))
3712 ids[6] = 0;
3713 CommonCreateTextChildren(dcd->hwndClient,
[593]3714 WC_DIRSTATUS, ids);
[1335]3715 }
[551]3716 if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
3717 WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
3718 if (FrameFlags & FCF_TASKLIST) {
[2]3719
[551]3720 SWP swp, swpD;
3721 ULONG size = sizeof(swp);
3722 LONG cxScreen, cyScreen;
[2]3723
[551]3724 WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame), 0, &swp);
3725 if (PrfQueryProfileData(fmprof,
3726 appname, "VDirSizePos", &swpD, &size)) {
3727 cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
3728 cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
3729 if (swp.x + swpD.cx > cxScreen)
3730 swp.x = cxScreen - swpD.cx;
3731 if (swp.y + swpD.cy > cyScreen)
3732 swp.y = cyScreen - swpD.cy;
3733 swp.cx = swpD.cx;
3734 swp.cy = swpD.cy;
3735 }
3736 WinSetWindowPos(hwndFrame,
3737 HWND_TOP,
3738 swp.x,
3739 swp.y,
3740 swp.cx,
3741 swp.cy,
3742 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER |
3743 SWP_ACTIVATE);
[1394]3744 }
3745 WinShowWindow(dcd->hwndCnr, TRUE);
[551]3746 }
[2]3747 }
[1077]3748# ifdef FORTIFY
3749 Fortify_LeaveScope();
3750# endif
[2]3751 }
3752 }
3753 return hwndFrame;
3754}
[793]3755
3756#pragma alloc_text(DIRCNRS,DirCnrWndProc,DirObjWndProc,DirClientWndProc)
3757#pragma alloc_text(DIRCNRS,DirTextProc,DirFrameWndProc)
3758#pragma alloc_text(STARTUP,StartDirCnr)
Note: See TracBrowser for help on using the repository browser.